Standard for feeding test data to a Nagios plugin?
- by chiborg
I'm developing a Nagios plugin in Perl (no Nagios::Plugin, just plain Perl). The error condition I'm checking for normally comes from a command output, called inside the plugin. However, it would be very inconvenient to create the error condition, so I'm looking for a way to feed test output to the plugin to see if it works correctly.
The easiest way I found at the moment would be with a command line option to optionally read input from a file instead of calling the command.
if($opt_f) {
open(FILE, $opt_f);
@output = <FILE>;
close FILE;
}
else {
@output = `my_command`;
}
Are there other, better ways to do this?