Page 1 of 1

Graphing DHCP Availability

Posted: Sun Aug 23, 2015 4:54 am
by stebbo
Hi All,

I wish to graph the number of available DHCP leases over time.

I have managed to find this script
https://exchange.nagios.org/directory/P ... pe/details
and have followed the instructions to get it working.

When I run the command ./check_nrpe -H x.x.x.x -c check_dhcp_scope
I get the standard response which is "1 Scopes OK"

So I looked at the script and activated one of the debug lines and now I can get the following out of the script
"x.x.x.x 80 584"

So, my question is this. How do I format the output from that script so that nagios can track and graph the data over time? Is there any trick or will it just take those numbers, store and graph it?

Thanks in advance,
Chris.

PS. My DHCP server is a standard windows 2012 R2 server. If there are some other scripts / features that will achieve my goal of graphing the DHCP availability I'm willing to give them a try. And I will probably hack that script to that it gives percentage free and used rather than number.

Re: Graphing DHCP Availability

Posted: Sun Aug 23, 2015 10:41 pm
by Box293
Performance data is after the pipe | and has to be formatted in a specific way.
https://nagios-plugins.org/doc/guidelines.html#AEN200

Code: Select all

'label'=value[UOM];[warn];[crit];[min];[max]
I actually did a talk on this at the Nagios World Conference, you can watch it here:

https://www.youtube.com/watch?v=kqA2KcpUFg4
http://www.slideshare.net/nagiosinc/tro ... and-graphs

It has an example bash script that generates performance data, the method is the same in a vbs script, simply add the performance data at the end of the plugin output.

I read through the plugin. The way it's coded is not as elegant/efficient as it could be, which means you need to add it in multiple locations. Just cause I'm a nice guy, here's a modified version which *should* do what you are after. The lines I changed were 71,74,78,96. NOTE: not tested as I don't have a windows DHCP server.
check_dhcp_scope_vbs.txt

Re: Graphing DHCP Availability

Posted: Tue Aug 25, 2015 5:11 am
by stebbo
Hi Box293,

thanks very much for the info. I have modified your script slightly (it didn't like the & at the end of the line) but mostly it's working ok. I've setup the command and service in Nagios and will wait for a bit to see if it starts graphing.

Cheers,
Chris.
(fellow Aussie from Victoria :-) )

Re: Graphing DHCP Availability

Posted: Tue Aug 25, 2015 9:04 am
by hsmith
stebbo wrote:Hi Box293,

thanks very much for the info. I have modified your script slightly (it didn't like the & at the end of the line) but mostly it's working ok. I've setup the command and service in Nagios and will wait for a bit to see if it starts graphing.

Cheers,
Chris.
(fellow Aussie from Victoria :-) )
Let us know. I'll leave this one open for now.

Thanks!

Re: Graphing DHCP Availability

Posted: Wed Aug 26, 2015 5:27 pm
by stebbo
Hi Box293,

the DHCP graph is working very nicely. Thanks for your assistance.

I have uploaded the vbs script that I'm using to this email in case anyone else is interested. I hacked it to pieces a bit because I only want to graph the number of available leases.

Cheers,
Chris.