Page 1 of 1

check_ncpa-py json error

Posted: Tue May 13, 2014 5:30 am
by Kasper
Hi.

Executing check_ncpa.py gives me this error:

kasper@gf:/usr/local/nagios/libexec$ ./check_ncpa.py -vvv -H webserver -t 'athome' 'cpu/percent'
Unable to parse json output
And error was encountered:
local variable 'rjson' referenced before assignment

I am pretty sure that there is not a variable initialization error as everyone else would suffer from the same issue.

I have checked that i have python-cjson and python-simplejson installed, do you have any other suggestions?

BR.

Kasper

Re: check_ncpa-py json error

Posted: Tue May 13, 2014 5:15 pm
by tmcdonald
What OS and version are you running this on? I know some repositories do not have the stock python-json so they use python-simplejson instead, and there might be some compatibility issues there.

Re: check_ncpa-py json error

Posted: Wed May 14, 2014 1:23 am
by Kasper
I'm running this from ubuntu 12.04.4

I think theres a check in the top of the script, using simplejson if theres no json:
try:
import json
except:
import simplejson as json

If simplejson wasn't supported, it should be mentioned, and the script would'nt be made like this? (my opinion)

/Kasper

Re: check_ncpa-py json error

Posted: Wed May 14, 2014 3:59 pm
by sreinhardt
Well, I'm sure Nick wouldn't have put it in as an acceptable alternative to standard json, if it wouldn't work. But I will definitely check with him and try some testing of it.

Re: check_ncpa-py json error

Posted: Fri May 16, 2014 2:29 am
by Kasper
Hi.

How do i get in contact with Nick?

/Kasper

Re: check_ncpa-py json error

Posted: Fri May 16, 2014 2:11 pm
by sreinhardt
You can post to the github issues page: https://www.github.com/nagiosenterprises/ncpa, otherwise once we see him, we will ask. He's got personal stuff this week.

Re: check_ncpa-py json error

Posted: Mon May 19, 2014 12:57 pm
by Kasper
Hi.
Just to let anyone who might be interested know, Scot contacted me by mail and suggested to get the newest version of the plugin, as the issue i had was from an old version.
I got the new version, and it works.
I got the first version from here: http://assets.nagios.com/downloads/ncpa/check_ncpa.py

/Kasper

Re: check_ncpa-py json error

Posted: Mon May 19, 2014 1:01 pm
by sreinhardt
Great! Thanks for posting back to let us know its resolved.