check_dhcp error

i had this error when running the check_dhcp command in the plugins:
/usr/local/libexec/nagios

nagios# ./check_dhcp -s 192.168.0.10 -i eth0 -v
DHCP socket: 3
Error: if_nametoindex error - Device not configured.

or

nagios# ./check_dhcp -s 192.168.0.10
Error: if_nametoindex error - Device not configured.

is this because the network setting on the NIC of my server is having static IP?

No, it’s not. But use the command without any options for a test. Perhaps, that IP is not the DHCP server. The command does NOT need to have any options in the command line.
./check_dhcp -v

i have try with ./check_dhcp -v but have the same error

nagios# ./check_dhcp -v
DHCP socket: 3
Error: if_nametoindex error - Device not configured.

i downloaded and install the latest plugin - nagios-plugins-1.4.3.

i got the same error when running check_dhcp in the libexec directory, ie
./check_dhcp -v
DHCP socket: 3
Error: if_nametoindex error - Device not configured.

however when checking through through the web it show
"Return code of 126 is out of bounds - plugin may be missing" instead

any advice on this? is the plugin error? or something need to be done at nagios configurations files??

You have the wrong permissions on the file check_dhcp. Compare it to the others in your directory.

most of the files are having -rwxr-xr-x 755. i change the permission from -rwsr-sr-x to 755, i had this error instead
" Error: Could not bind to DHCP socket (port 68)! Check your privileges… "

You might be firewalled out. So disable your firewall for now.

The setuid permissions on check_dhcp were correct as they were - you need to set them back (chmod 4755 check_dhcp).

Run ‘ifconfig’ and see what your network cards are called, then use the ‘-i em0’ (or whatever it is for you) along with the check_dhcp command.

Steve :slight_smile: