Page 2 of 4

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Wed Mar 04, 2015 12:46 pm
by abrist
Apurv wrote:I would like to know how to implement graphite to generate real time graphs using nagios data.
See: https://github.com/shawn-sterling/graphios
You could also use pnp4nagios or nagiosgraph:
https://docs.pnp4nagios.org/
http://sourceforge.net/projects/nagiosgraph/

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Thu Mar 05, 2015 12:43 am
by Box293
Glad I could help :)
Apurv wrote:Do u have any idea about using graphite to generate real time graphs? If yes, then I would like to know how to implement graphite to generate real time graphs using nagios data.

Counting on you.... Thanks for your help in advance....
Alas my Nagios magic has run out :lol:

I've not used graphite, I would follow abrist's suggestions.

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Fri Mar 13, 2015 5:51 am
by Apurv
Hey Box293,

Could you please let me know the below :

When we add comment for a particular (host/service) from web interface of nagios.. To which file are these comments written to ?

Where does this file reside?

Thanks for your help in advance!

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Fri Mar 13, 2015 9:29 am
by jolson
It looks like comments are stored in the /usr/local/nagios/var/status.dat file. See my example below.

Code: Select all

cat /usr/local/nagios/var/status.dat |grep comment
        next_comment_id=3
hostcomment {
        comment_id=2
        comment_data=test comment!
From the Nagios guide:
Current and retained comments are now stored in the status file and retention file, respectively.

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Fri Mar 13, 2015 9:29 pm
by Apurv
Hi Jolson,

Thanks for your reply!

I am trying to add comments to my nagios interface using a php script that we have developed. We are writing these comments to the "status.dat" file only.

The problem that I am facing is that I have set the nagios interface to refresh after every 10 secs. Due to this the "status.dat" file gets written/modified after every 10 secs and the comments added using the php script get deleted from web interface.

This is the reason, I became doubtful if we are writing comments to the correct file or not.

So could you please let me know which file should write/modify, "status.dat" or "retention" file ?

Awaiting your reply! Thanks in advance!

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Sun Mar 15, 2015 9:38 pm
by Box293
If you want to submit comments to Nagios, you should look at using the command pipe.

Here's some examples when executing locally on the Nagios server:

This is for the host object:

Code: Select all

now_epoch=$(eval date +%s); printf "[$now_epoch] ADD_HOST_COMMENT;centos03;1;nagiosadmin;This host does funny stuff\n" > /usr/local/nagios/var/rw/nagios.cmd

This is for a service object:

Code: Select all

now_epoch=$(eval date +%s); printf "[$now_epoch] ADD_SVC_COMMENT;centos03;Total Processes;1;nagiosadmin;Keep an eye on this service\n" > /usr/local/nagios/var/rw/nagios.cmd
Here's all the commands:
http://old.nagios.org/developerinfo/ext ... ndlist.php

When testing, you might want to turn on log_external_commands=1 in nagios.cfg. With this enabled you can see the commands being logged in nagios.log.

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Tue Mar 17, 2015 2:06 am
by Apurv
Hi Box293,

Will give that a try. And yes the option "log_external_commands=1" is already enabled in nagios.cfg

Thanks for you help.. I will let you know how it goes.

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Tue Mar 17, 2015 9:17 am
by jolson
Sounds good, be sure to keep us informed. Thanks!

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Wed Mar 18, 2015 5:51 am
by Apurv
Hi Box293 and jolson,


It worked....

Implement adding of comments to nagios web-interface from command line. A big thanks to both of you.

Will keep troubling you now and then if I face any more obstacles. That is if you don't mind..... ;-) ;-)

Thanks alot guys!!

Re: Monitoring remote hosts using NRPE on another remote hos

Posted: Wed Mar 18, 2015 9:08 am
by tmcdonald
We can keep this thread open for a bit in case you have any questions.