Net::Nsca - a perl way to send status checks to NetSaint, locally and remotely
Net::Nsca::local_message($message [, $log_file]); Net::Nsca::send_message($message, $remote_host [, $config_file [, $remote_port ]]); ($password, $encryption_method) = Net::Nsca::read_config( [ $configfile ]);
This module provides a simple API to allow perl programs to send checks to the Netsaint server that is monitoring them. This server may be local or remote. The API has two main methods and one utility method:
Pass in a hashref with the message fields in it - the keys are host_name, svc_description, return_code, plugin_output - and optionally the name of the file to append the status check message to (the default is /usr/local/netsaint/rw/netsaint.cmd if you don't supply one) - Dies if anything goes wrong.
Pass in a hashref with the message fields in it - the keys are host_name, svc_description, return_code, plugin_output - the name or address of the Netsaint host, the port number (defaults to 5667), and the config file to be read - defaults to /usr/local/netsaint/etc/send_nsca.cfg - Dies if there's a problem.
You probably won't need to use this, but it's available anyway. Reads in a config file, default is /usr/local/netsaint/etc/send_nsca.cfg, and returns the password and encryption method. Dies if it can't find them.
The $message referred to loks like this, a simple hashref:
my $message = { host_name => 'www', svc_description => 'database', return_code => '0', plugin_output => 'Database is OK', };
See the LICENSE file. Parts are based on work by Ethan Galstad, the rest is mine.
P Kent, Started Nov 2001 $Id: Nsca.pm,v 1.6 2001/12/14 01:42:11 piers Exp $
To install Net::Nsca, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Nsca
CPAN shell
perl -MCPAN -e shell install Net::Nsca
For more information on module installation, please visit the detailed CPAN module installation guide.