Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax error #10

Open
og900aero opened this issue Mar 22, 2024 · 2 comments
Open

Syntax error #10

og900aero opened this issue Mar 22, 2024 · 2 comments
Assignees

Comments

@og900aero
Copy link

I try this python script on Debian 11, but I get error messagem when I running:

First run I get error message:

/usr/bin/env: ‘python’: No such file or directory

Then I installed python-is-python3 package, then I get new error messages:

File "/home/nio/check_apcaccess/./check_apcaccess.py", line 146
print "{0}: {1}{2}".format(get_return_str(), str(", ".join(snips)), perfdata)
^
SyntaxError: invalid syntax

@stdevel stdevel self-assigned this Mar 23, 2024
@stdevel
Copy link
Owner

stdevel commented Mar 23, 2024

Hi @og900aero,
this plugin is really old, it was developed for Python 2, which is EOL. I tried porting it to Python 3 - see also the feat-python3 branch. Can't test it, but the code seems to execute. Does it work for you?

@og900aero
Copy link
Author

I try, but theres is a problem:

./check_apcaccess.py
/bin/sh: 1: apcaccess: not found
CRITICAL: temperature okay (0.0), load okay (0.0), battery load critical (0.0)

Here, the problem may be because the apcaccess command requires sudo rights, so I started it like this:

sudo ./check_apcaccess.py
CRITICAL: temperature okay (0.0), load okay (0.0), battery load critical (0.0)

It apparently ran without errors, but it shows incorrect values.

If run apcaccess alone:
sudo apcaccess
APC : 001,036,0861
DATE : 2024-03-24 12:08:33 +0100
HOSTNAME : SERVER
VERSION : 3.14.14 (31 May 2016) debian
UPSNAME : SERVER
CABLE : USB Cable
DRIVER : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: 2024-03-22 18:01:05 +0100
MODEL : Back-UPS BX1600MI
STATUS : ONLINE
LINEV : 237.0 Volts
LOADPCT : 12.0 Percent
BCHARGE : 100.0 Percent
TIMELEFT : 42.6 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
SENSE : Medium
LOTRANS : 145.0 Volts
HITRANS : 295.0 Volts
ALARMDEL : 30 Seconds
BATTV : 27.1 Volts
LASTXFER : Automatic or explicit self test
NUMXFERS : 0
TONBATT : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : OK
STATFLAG : 0x05000008
SERIALNO : 9B2350A11751
BATTDATE : 2001-01-01
NOMINV : 230 Volts
NOMBATTV : 24.0 Volts
NOMPOWER : 900 Watts
FIRMWARE : 378600G -302202G
END APC : 2024-03-24 12:08:35 +0100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants