Monitoring remote hosts using NRPE on another remote host

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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/
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.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Apurv
Posts: 27
Joined: Wed Dec 17, 2014 8:34 pm

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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!
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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.
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
Apurv
Posts: 27
Joined: Wed Dec 17, 2014 8:34 pm

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Apurv
Posts: 27
Joined: Wed Dec 17, 2014 8:34 pm

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: Monitoring remote hosts using NRPE on another remote hos

Post by jolson »

Sounds good, be sure to keep us informed. Thanks!
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
Apurv
Posts: 27
Joined: Wed Dec 17, 2014 8:34 pm

Re: Monitoring remote hosts using NRPE on another remote hos

Post 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!!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Monitoring remote hosts using NRPE on another remote hos

Post by tmcdonald »

We can keep this thread open for a bit in case you have any questions.
Former Nagios employee
Locked