The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::Nsca - a perl way to send status checks to NetSaint, locally and remotely

SYNOPSIS

        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 ]);

DESCRIPTION

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:

Net::Nsca::local_message($message [, $log_file]);

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.

Net::Nsca::send_message($message, $remote_host [, $config_file [, $remote_port ]]);

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.

($password, $encryption_method) = Net::Nsca::read_config( [ $configfile ]);

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.

MESSAGE OBJECT

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',
        };

COPYRIGHT

See the LICENSE file. Parts are based on work by Ethan Galstad, the rest is mine.

PERL IMPLEMENTATION

P Kent, Started Nov 2001 $Id: Nsca.pm,v 1.6 2001/12/14 01:42:11 piers Exp $