send_nrdp.sh sending values for multiple measurements

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
luczynj
Posts: 88
Joined: Wed Dec 03, 2014 6:47 pm

send_nrdp.sh sending values for multiple measurements

Post by luczynj »

Hello all,

I'm trying to figure out how to get perfdata and charts for routes on a network that include the host, the route name, number of circuits, number of occupied circuits, number of blocked circuits, the number of available circuits (number of circuits - number occupied - number of blocked), and the state of the route. I've scripted it all and have been trying different examples of scripts that I've found online. And now I'm stuck and my brain hurts.

Here's my send_nrdp.sh command that I've pulled out of various sources.

Let me start with the Nagios KB article located here:

https://support.nagios.com/kb/article/n ... t-599.html

It seems to be too simple of an explanation. I've removed blank lines:

./send_nrdp.sh -h
send_nrdp.sh Revision 0.6.1 - Send NRDP script for Nagios
Usage: send_nrdp.sh -u URL -t token [options]
Usage: send_nrdp.sh -h display help
This script is used to send NRDP data to a Nagios server
Required:
-u, URL of NRDP server. Usually http://<IP_ADDRESS>/nrdp/
-t, Shared token. Must be the same token set in NRDP Server

Options:
Single Check:
-H host name
-s service name
-S State -
-o output

However, I've found an example that lead me to build this. I had it working once, but I was working very late last night and got brain freeze.

I think I've made it more complicated than I should. At the point I had it working, I was able to see perfdata along with averages over a period of time.

I have the data, I just need to know the command line to send it. Please help!


$NRDP_CLIENT -u http://168.125.36.9/nrdp/ -t "$TOKEN" -H "$t_TESname" -s "$t_route" -S "0" -o "NDV=${t_NDV}, NOCC=${t_NOCC}, NIDL=${t_NIDL}, NBLO=${t_NBLO}, RSTAT=${t_RSTAT}, AVAIL=${t_AVAIL} | NDV=${t_NDV};;;; NOCC=${t_NOCC};;;;NIDL=${t_NIDL};;;; NBLO=${t_NBLO};;;; RSTAT=${t_RSTAT};;;; AVAIL=${t_AVAIL};;;;"

QUESTIONS:

What is the significance of the | in the middle of the command?
How long should it take for the data sent to appear on the service page?
What are the semi-colons for? (I suspect this asks Nagios to provide averages?)
What is the pipe | character for? (I suspcet this separates the output versus the perfdata?
Where can I find where the server receives the NRDP info? (I suspect this is in the /var/nagiosramdisk files)

Any help would be appreciated.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: send_nrdp.sh sending values for multiple measurements

Post by cdienger »

The command looks good and tests fine on my lab machine. Note that database that the data is stored in can be picky and if you remove a field or add a new field then it may not be able to parse the information any longer and may no longer graph. There are a couple of ways of dealing with this - removing the old rrd file and allowing a new one to generate or modify the xml and rrd files. https://support.nagios.com/kb/article/n ... e-497.html is an example of removing a field(also called a data source as in the article).

The | separates the normal output from performance data. The performance data is what is graphed.

It usually takes at least a couple data points in the database before you see the graph. Usually this will happen between 5 and 10 minutes.

The semicolons are used separate the current value and the warn, critical, min, and max values. The last 4 are usually not needed. You don't have to include the semicolons if you don't set these values.

For more info:

https://nagios-plugins.org/doc/guidelines.html#AEN200

If you enable the stalking(https://assets.nagios.com/downloads/nag ... lking.html & https://www.youtube.com/watch?v=qqHg7wRrKSc) option on the service you can see every incoming entry in the /usr/local/nagios/var/nagios.log file. The perfdata is also sent off for further processing and inserting into the rrd files. https://support.nagios.com/kb/article/n ... re-41.html is a good resource and also points to https://support.nagios.com/kb/article/n ... 5-419.html which is where the attached flow chart comes from.
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
luczynj
Posts: 88
Joined: Wed Dec 03, 2014 6:47 pm

Re: send_nrdp.sh sending values for multiple measurements

Post by luczynj »

Hi cdienger,

Thank you for the quick and thorough response. I'll check it out and let you know what I find.

All the best,
JL
luczynj
Posts: 88
Joined: Wed Dec 03, 2014 6:47 pm

Re: send_nrdp.sh sending values for multiple measurements

Post by luczynj »

One more questioni for now:

I still have the source log files that I've been xferring using NRDP. I assume the timestamp on Nagios is the date/time of the trnasfer.

Is there a way to resend all of the historical data in order to get it back?

Thanks again.

JL
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: send_nrdp.sh sending values for multiple measurements

Post by cdienger »

Not through NRDP, but you can update rrd files with older data with the following steps:

1. export the rrd to xml. i.e. rrdtool dump filename.rrd > output.xml
2. edit the xml file(output.xml in the above example)
3. convert xml to rrd and replace the old rrd file:

mv filename.rrd ~
rrdtool restore output.xml filename.rrd
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
luczynj
Posts: 88
Joined: Wed Dec 03, 2014 6:47 pm

Re: send_nrdp.sh sending values for multiple measurements

Post by luczynj »

Regarding the ;;;; in the perfdata.

You said,
The semicolons are used separate the current value and the warn, critical, min, and max values. The last 4 are usually not needed. You don't have to include the semicolons if you don't set these values.
On the page you sent it shows the ; outside of the [], which means that variable is optional.

This is the expected format:

'label'=value[UOM];[warn];[crit];[min];[max]

I'm not getting perfdata when I remove the four semi-colons from the send_nrdp.sh command line. If I add them back, then I get perfdata *as well as* average stats. We are doing starts on some circuits. I don't want the performance graph to show that we had 28.9 devices. That will certainly confuse some new team members.

Any thoughts on that?
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: send_nrdp.sh sending values for multiple measurements

Post by cdienger »

The nature of the rrd files there is going to be some rounding 'issues' when there is a change in values. You can create a custom template to drop the decimal place - https://support.nagios.com/forum/viewto ... 16&t=56858.

As far as not seeing data when you have a single value, can you provide the exact command you're running? Have you tried removing the xml and rrd file for this service? It should be recreated once new data starts coming in.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked