NagiosXI and Python script

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
wally
Posts: 13
Joined: Thu Oct 23, 2014 10:10 am

NagiosXI and Python script

Post by wally »

Hello!

I’m very new to Nagios and I spent the day studying how to best implement my Python plugin. I was able to run a NagioxIX virtual machine using VirtualBox, and now I am trying to understand how to build my plugin.

REQUIREMENTS:

I need to integrate into Nagios some alerts coming from my own monitoring tool. I have a Python library that queries my own monitoring tool (REST based via HTTPS), so I need to have this information displayed into Nagios.

I understood that Nagios is basically a monitoring server, so in order to have info pushed into its dashboard, I need to set up a Linux client where to run the Python script. I found this NRPE add ons that looks like what I need, since the NRPE is also able to to http_check (so would be ok with my REST based query to my monitoring tool):
Pasted_Image_10_28_14__19_56.png
So using the example in the following link, I managed to have the data from my own tool, queried via Python script, displayed into Nagios dashboard:

https://www.digitalocean.com/community/ ... untu-12-10

Alternatively, I can run the Python script directly on the Nagios server as explained here:

http://skipperkongen.dk/2011/12/06/hell ... in-python/

-----------------------------
QUESTION: What are the pros/cons of each of the two solutions?
-----------------------------

Thanks!

Wally
You do not have the required permissions to view the files attached to this post.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NagiosXI and Python script

Post by abrist »

Nagios XI can also run checks locally (I think you mentioned this). So you could make a check_http service that runs on the XI box against your remote hosts. The "NRPE proxy" method that you are suggesting is usually only used when you to get around endpoint issues like a firewall or restricted subnet. Unless you need to proxy the check, I suggest running it locally as it is much simpler and does not require editing configs on a remote box when you want to change the check.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
wally
Posts: 13
Joined: Thu Oct 23, 2014 10:10 am

Re: NagiosXI and Python script

Post by wally »

Hi Abrist,

thanks for your reply! So if I want to run my Python script locally on the Nagios Server, is this the correct and only procedure (see link)?

http://skipperkongen.dk/2011/12/06/hell ... in-python/

What is worrying me is the fact that critical NagiosXI config files:

define command{..} >>>> /usr/local/nagios/etc/commands.cfg
define service {..} >>> /usr/local/nagios/etc/services/localhost.cfg

need to be modified to run the Python script automatically in Nagios. So I need either have to modify these two config files manually (prone to errors) or automatically using my script (danger of bugs). Is there a way to avoid touching those two files?

Thanks!
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: NagiosXI and Python script

Post by abrist »

wally wrote: need to be modified to run the Python script automatically in Nagios. So I need either have to modify these two config files manually (prone to errors) or automatically using my script (danger of bugs). Is there a way to avoid touching those two files?
Yes, through the CCM in nagios XI. Go to --> Configure --> CCM --> Commands. Create a new command for your check here.
Then go to --> CCM --> Services. Add a new service check for your command here and add the remote host to the check.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
wally
Posts: 13
Joined: Thu Oct 23, 2014 10:10 am

Re: NagiosXI and Python script

Post by wally »

Thanks Abrist, much appreciated!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: NagiosXI and Python script

Post by tmcdonald »

Did that resolve the issue? If so I would like to close the thread.
Former Nagios employee
wally
Posts: 13
Joined: Thu Oct 23, 2014 10:10 am

Re: NagiosXI and Python script

Post by wally »

yes it did, please close. Thanks again.
Locked