Page 1 of 1

testing website from multiple locations

Posted: Mon Sep 21, 2020 4:54 pm
by MarkCampbell
Hello,

I've created a script to perform a check_http from multiple remote nrpe servers, and it returns it all as one check. The script works, returns the same human readable data from each server, one line per, and generates an exit code based on what each server comes back with. It then takes the perf data and tacks it all at the end with different names based on the name of the server used, like this:

Code: Select all

$ ./check_http_multiserver -H www.google.com -S nagiosxi-test,nagios-test-worker,nagios-aws
nagiosxi-test returned 0: HTTP OK: HTTP/1.1 200 OK - 13779 bytes in 0.196 second response time
nagios-test-worker returned 0: HTTP OK: HTTP/1.1 200 OK - 13785 bytes in 0.216 second response time
nagios-aws returned 0: HTTP OK: HTTP/1.1 200 OK - 13752 bytes in 0.035 second response time  | time_nagiosxi-test=0.195603s;;;0.000000 size_nagiosxi-test=13779B;;;0 time_nagios-test-worker=0.216334s;;;0.000000 size_nagios-test-worker=13785B;;;0 time_nagios-aws=0.035009s;;;0.000000 size_nagios-aws=13752B;;;0
This shows up rather nicely in the human readable output, but my question comes with the differing perf data entries. I was expecting them to show up on a graph, or at least on several graphs in the performance section. But instead, the first set of data (time_nagiosxi-test & size_nagiosxi-test in my above example) shows up in the graph, and then below it there's tachometer-style gauges for each of the other performance data entries. How do I get them all to show up as graphs? Ideally as 1 graph with multiple lines, but I'll take separate graphs for each too.

Re: testing website from multiple locations

Posted: Tue Sep 22, 2020 1:49 pm
by scottwilkerson
This is likely because you ran it once during a test and then added servers changing the number of performance metrics returned.

RRD files have a fixed number of fields determined the first time they are run and the RRD is created. You would need to delete the RRD if you change the number of metrics returned so it can create a new one

The location is

Code: Select all

/usr/local/nagios/share/perfdata/HOSTNAME/SERVICE_DESCRIPTION.rrd

Re: testing website from multiple locations

Posted: Tue Sep 22, 2020 2:24 pm
by MarkCampbell
Thanks Scott, given that this is a test box, I didn't care about the existing rrd data, so I blew away my rrd files for that host, and they started showing up. Thanks! This brings me to a question though, if at some point that I want to add another server that it is querying, but want to keep existing data, is there a way to convert the rrd data?

Re: testing website from multiple locations

Posted: Tue Sep 22, 2020 2:48 pm
by scottwilkerson
MarkCampbell wrote:Thanks Scott, given that this is a test box, I didn't care about the existing rrd data, so I blew away my rrd files for that host, and they started showing up. Thanks! This brings me to a question though, if at some point that I want to add another server that it is querying, but want to keep existing data, is there a way to convert the rrd data?
This is possible by running the following after making the change
https://support.nagios.com/kb/article.php?id=149

Re: testing website from multiple locations

Posted: Mon Oct 12, 2020 4:35 pm
by MarkCampbell
Thanks Scott. I now have this check working out very well, and it is showing the graphs properly now.

Re: testing website from multiple locations

Posted: Mon Oct 12, 2020 4:36 pm
by scottwilkerson
MarkCampbell wrote:Thanks Scott. I now have this check working out very well, and it is showing the graphs properly now.
Great!

Locking thread

Re: testing website from multiple locations

Posted: Mon Oct 12, 2020 4:37 pm
by benjaminsmith
Thanks Scott. I now have this check working out very well, and it is showing the graphs properly now.
Great. Shall we close this out or did you have any other questions?