Page 1 of 1
how to plugin python scripts in nagios xi ?
Posted: Mon Nov 28, 2016 7:03 pm
by gornm565
Our developers want an ability to run python scripts on a monitored server and have the script return data to nagios, so that nagios could monitor it and alert us in case it gets specific data from the python script. Any idea on how to implement it?
Thank you.
Re: how to plugin python scripts in nagios xi ?
Posted: Tue Nov 29, 2016 10:15 am
by rkennedy
You will want to use check_by_ssh or check_nrpe to communicate from Nagios -> the client server, then, simply have your developers write their plugins using the guidelines here -
https://assets.nagios.com/downloads/nag ... inapi.html - (more in depth here:
https://nagios-plugins.org/doc/guidelines.html)
Basically, as long as they build the logic for the exit codes and echo the output, that's all that needs to be done. Nagios will interpret the exit codes accordingly.
For the check_by_ssh / NRPE side of things, see this document -
NRPE -
https://assets.nagios.com/downloads/nag ... g_NRPE.pdf -
https://support.nagios.com/kb/article.p ... ategory=22
check_by_ssh (uses SSH auth keys) -
https://assets.nagios.com/downloads/nag ... ng_SSH.pdf
Re: how to plugin python scripts in nagios xi ?
Posted: Wed Nov 30, 2016 12:03 pm
by gornm565
Let's say our developer writes a script that checks something and returns 0 when things are good and 1 and 2 when things are bad. Where would that python script live? Would it execute on the client machine or on the nagios server itself? How would it pass that 0 or 1 to nagios?
We are running NSCLient++ on the Windows server that we want to monitor. So would the python script go onto that server? I can't seem to find the doc that describes these details.
Thanks.
Re: how to plugin python scripts in nagios xi ?
Posted: Wed Nov 30, 2016 4:13 pm
by ssax
Please read through this documentation on how to work with external scripts in nsclient++:
http://docs.nsclient.org/howto/external_scripts.html
Then let us know if you have any questions.
Are you looking to do Active or Passive checks on that server?
https://assets.nagios.com/downloads/nag ... hecks.html
https://assets.nagios.com/downloads/nag ... hecks.html
Thank you