I'm experimenting with a module that wraps nagios plugins. I figured I'd share and see if others are doing anything like this. I wanted to be able to set classes based on the results of the nagios plugin execution. Here's the module shell script:
#!/bin/sh PREFIX=/usr/local/libexec/nagios PLUGIN=${1} shift 1 OUTPUT=`$PREFIX/$PLUGIN $*` EXIT=$? /bin/echo "=output=$OUTPUT" case "$EXIT" in '0') echo "+nagios_plugin_${PLUGIN}_ok" ;; '1') echo "+nagios_plugin_${PLUGIN}_warning" ;; '2') echo "+nagios_plugin_${PLUGIN}_critical" ;; '3') echo "+nagios_plugin_${PLUGIN}_unknown" ;; esac Here's the bundle I'm using for testing: bundle agent nagios_mailq_check { classes: "nagios_mailq_alert" or => { "nagios_plugin_check_mailq_warning", "nagios_plugin_check_mailq_critical", "nagios_plugin_check_mailq_unknown" }; commands: my_mta_host.Hr00:: "/usr/local/cfengine/modules/nagios_plugin_wrapper check_mailq -w 10 -c 20" module => "true"; reports: nagios_mailq_alert:: "$(nagios_plugin_wrapper.output)"; } My test configuration is FreeBSD 7.3-RELEASE-p2, running cfengine-3.0.5p1 and nagios-plugins-1.4.15_1,1 from ports. I guess there might be a better way to do this, but it's what I have so far. I'd be curious to know if anyone else is trying to do a generalized nagios plugin wrapper module. I'm not suggesting this is a better way to do host checks, but there are a lot of people cranking out nagios plugins of various kinds. I figured this would be a way to have Cfengine be able to make use of that work. Best, --Bruce _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine