How to add Python 3.X Script to Nagios Core

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

How to add Python 3.X Script to Nagios Core

Postby chunye » Mon Jan 28, 2019 12:59 am

The Nagios version is Nagios® Core™ 3.2.3 and the NSClient Version is NSClient++ 0.5.2.35 2018-01-28.
I want to add a Python 3.X Script to Nagios Core.
I have copied all needed Python libs which include urllib3 to C:\Python37\Lib\site-packages on the Windows Server 2012 by following https://docs.nsclient.org/extending/python/.
But I will meet below error when running "nscp py add --script my_script.py".
The Python script to be added(get_ata_lastupdate.py) can run successfully under Python 3.7 after installing urllib3/requests_ntlm, etc.

-->>Error message:
C:\Program Files\NSClient++>nscp py add --script d:\CC\ScriptByXuChunye\InstalledPythonLibs\get_ata_lastupdate.py
E python Failed to load script: d:\CC\ScriptByXuChunye\InstalledPythonLibs\get_ata_lastupdate.py
c:\source\master\modules\PythonScript\python_script.cpp:237
Added get_ata_lastupdate as d:\CC\ScriptByXuChunye\InstalledPythonLibs\get_ata_lastupdate.py
E python Traceback (most recent call last):
File "d:\CC\ScriptByXuChunye\InstalledPythonLibs\get_ata_lastupdate.py", line 3, in <module>
import urllib3
ImportError: No module named urllib3

c:\source\master\modules\PythonScript\script_wrapper.cpp:171
E python Failed to load script: d:\CC\ScriptByXuChunye\InstalledPythonLibs\get_ata_lastupdate.py
c:\source\master\modules\PythonScript\python_script.cpp:237
E python Traceback (most recent call last):
File "d:\CC\ScriptByXuChunye\InstalledPythonLibs\get_ata_lastupdate.py", line 3, in <module>
import urllib3
ImportError: No module named urllib3

c:\source\master\modules\PythonScript\script_wrapper.cpp:171

C:\Program Files\NSClient++>

Can anyone give a comment or suggestion? Thanks!
chunye
 
Posts: 2
Joined: Thu Dec 06, 2018 6:42 pm

Return to Nagios Core

Who is online

Users browsing this forum: proxibid and 22 guests