The plugin works on the command line, but not in Nagios

This could be so many things!

The chances are that this is not a plugin issue ie with the code itself, but most likely with the way the plugin has been setup or how Nagios has been setup.
I’m only going to cover so of the areas at a high level since there are plenty of other resources on the Internet to sort this one out. See this FAQ article for more detail.

  • Make sure you can get some other checks with some other plugin working. Try a cutdown plugin with the following 3 lines of code:
    #!/bin/sh
    echo OK
    exit 0Then try a cutdown perl plugin with the following 3 lines of code:
    #!/usr/bin/perl
    print “OK – Test\n”;
    exit 0;
  • Run the plugin from the command line as the same user that runs the Nagios process. This should help with permissions problems.
  • Setup your Nagios Service and Command definitions using the samples provided, here and here. Make sure that there are no hidden characters eg spaces/tabs/CR in the wrong places in the files.
  • Turn on Nagios debugging in the nagios.cfg file. Set it to dump everything with high verbosity. Then in the debug output look for where the plugin is run so you can see the exact command line and then a few lines later you should be able to see the output of the plugin. If that is still not enough information then change your Nagios command and add -d to the end of the Check WMI Plus command line. You might want to do something like tail -f /var/log/nagios/nagios.debug | grep -C 10 check_wmi_plus to see the debug output.
  • Try the Nagios-users mailing list
  • Get a Nagios support contract 🙂