Page 1 of 1

Python version

Posted: Thu Dec 07, 2017 10:48 am
by vijilants
System:
Nagios XI Version : 5.4.11
2.6.32-431.29.2.el6.i686 i686
CentOS release 6.5 (Final)
Gnome Installed

Hi,

Can someone please advise me on the following:

I was trying to load a plugin called Cisco IP SLA Check.

However I was getting the following error message:
[nagios@xxxxxx libexec]$ ./check_cisco_ip_sla.py --help
Traceback (most recent call last):
File "./check_cisco_ip_sla.py", line 14, in <module>
import argparse
ImportError: No module named argparse
[nagios@cxxxxx libexec]$
The author of this plugin kindly had a look at the message and has advised me that my pyton version 2.6.6 does not support argparse and that I need to upgrade to python 2.7.

So my questions are:

1) Will I cause a problem with the Nagios application by upgrading Python ?

If it is OK...

2) How do I go about upgrading to version 2.7

Many Thanks

Re: Python version

Posted: Thu Dec 07, 2017 11:28 am
by npolovenko
Hello, @vijilants. I think as far as Nagios system goes it doesn't really rely on python, although you may be using some older plugins written in python that would not work with a newer version. If you choose to go that route I'd recommend to do it on a test instance first before implementing this in the production environment. Also, you may create a system backup to be 100% safe.
Before you upgrade. The error that you've got doesn't seem version specific so far. Rather meaning that you don't have the argpase module installed. Try any of the following commands:

Code: Select all

python setup.py install

easy_install argparse

pip install argparse
Let us know if that fixes the issue.

Re: Python version

Posted: Fri Dec 08, 2017 5:11 am
by vijilants
npolovenko wrote:Hello, @vijilants. I think as far as Nagios system goes it doesn't really rely on python, although you may be using some older plugins written in python that would not work with a newer version. If you choose to go that route I'd recommend to do it on a test instance first before implementing this in the production environment. Also, you may create a system backup to be 100% safe.
Before you upgrade. The error that you've got doesn't seem version specific so far. Rather meaning that you don't have the argpase module installed. Try any of the following commands:

Code: Select all

python setup.py install

easy_install argparse

pip install argparse
Let us know if that fixes the issue.
Thank you,

However none of the above commands worked.

I used "yum install python-argparse" and that worked.

But now I am getting the following error:
[root@XXXXX libexec]# ./check_cisco_ip_sla.py --help
Traceback (most recent call last):
File "./check_cisco_ip_sla.py", line 17, in <module>
from collections import Counter
ImportError: cannot import name Counter
[root@XXXXX libexec]#

Re: Python version

Posted: Fri Dec 08, 2017 12:10 pm
by npolovenko
@vijilants, Ok, now the error seems to be version specific. I wouldn't recommend overriding python globally on your system, however, you could make an alternative install. Check out this tutorial: https://danieleriksson.net/2017/02/08/h ... on-centos/ Basically you'd install python2.7 in a different directory and then point the plugin to the new path.
Also, you may be able to find a slightly different plugin on Nagios Exchange that does what you want but that's written in a supported programming language version. So far i've found this one https://exchange.nagios.org/directory/P ... la/details but there may be more on https://exchange.nagios.org/