I decided to write a shell (ksh) script to sudo nagios to run check_dhcp as root.
First, I added a line to /etc/sudoers.
nagios ALL=(root) NOPASSWD: /usr/local/nagios/libexec/check_dhcp
Then I wrote the script with the following line…
This all works from the command line. As user nagios, I can run the script and get an “ok” answer back.
I edited my checkcommands file with the commandline entry pointing to check_dhcp.ksh (my script).
I restarted nagios and, voila, it works!
I know this post was a little long, but I wanted to show enough that someone else with the same problem will be able to solve it.
Thanks for your help, jakkedup!