From e1d1f3f902617303f1b9d4d6d7dc7baec08f624f Mon Sep 17 00:00:00 2001 From: Stephen L Johnson Date: Thu, 14 Sep 2000 17:01:09 +0000 Subject: [PATCH] removed $cat from message which was causing mis-formatted messages --- contrib/plugins/spong-server/data_sendmsg | 126 ++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 contrib/plugins/spong-server/data_sendmsg diff --git a/contrib/plugins/spong-server/data_sendmsg b/contrib/plugins/spong-server/data_sendmsg new file mode 100644 index 0000000..fe2c64d --- /dev/null +++ b/contrib/plugins/spong-server/data_sendmsg @@ -0,0 +1,126 @@ +=head1 NAME + +B - spong-network module that sends copies of update messages to +other spong-servers + +=head1 DESCRIPTION + +This is a plugin module for the Spong L program. This module +sends incoming update messages to other spong-servers. It's purpose is to set +up regional Spong configurations that feed incoming status messages to +upper level Spong configurations. + +=cut + +# data_sendmsg - plugins module for spong-server +# This module copies/clones all of a subset of status messages to other +# spong-servers. Typical use would be to setup Spong regions and feeding all +# regional status messages to a top level server. + +# $Id: data_sendmsg,v 1.1 2000/09/14 17:01:09 sljohnson Exp $ + +use Spong::Status "0.02"; + +# Register the routine with the plugin registry +$DATAFUNCS{'sendmsg'} = \&data_sendmsg; + +my $SENDMSG_SERVERS = "spong-server-2.my-inc.com:10998 spong-top.my-inc.com"; + +# These are list of hostname to send/not-send to other servers. There are +# lists of perl regular expressions + +# List of hosts to send to other servers +my @SENDMSG_INC_HOSTS = ( '.*' ); + +# List of hosts to exclude +my @SENDMSG_EXCL_HOSTS = ( ); + +sub data_sendmsg { + my( $host, $service, $color, $start, $time, $sum, $message ) = @_; + + # Check the list of hosts to exclude + foreach my $re (@SENDMSG_EXCL_HOSTS) { + if ( $host =~ /$re/o ) { return; } # If we get a hit, return + } + + # Check the lists of hosts to include + my $hit=0; + foreach my $re (@SENDMSG_INC_HOSTS) { + if ( $host =~ /$re/o ) { $hit=1; last; } # If we get a hit, set flag + } + return unless $hit; # Return unless we got a hit + + my $msg = "status $host $service $color $time $sum\n$message\n"; + + my $errmsg = Spong::Status::SendMsg( $SENDMSG_SERVERS, + $main::SPONG_UPDATE_PORT, $msg ); + + main::error("data_sendmsg: $errmsg") if $errmsg; + +} + +1; + + +__END__ + +=head2 Configuration + +=over 4 + +=item $SENDMSG_SERVERS + +A string that has the list of other Spong Servers that you want to the +status update messages to. The syntax is "hostname[:port] hostname[:port] ...". +If the :port is not specified, Spong::Status::SendMsg defaults to +$main::SPONG_UPDATE_PORT variable passed in the procedure call. See +L for more details. + +=item @SENDMSG_INC_HOSTS + +This is ia list of hosts who's status messages are sent to the other Spong +Server specified in $SENDMSG_SERVERS. These entries can be partial host names +or Perl regular expressions. + +=item @SENDMSG_EXCL_HOSTS + +This is a list of hosts that should be exclude from send to the other Spong +Servers specified in $SENDMSG_SERVERS. These entries can be partial host names +or Perl regulare expressions. + +=back + +=head1 EXAMPLES + + $SENDMSG_SERVERS = "spong-reg1.myinc.com:1998 spong-toplevel.myinc.com:1998 + spong-proxy.myinc.com:19980"; + + $SENDMSG_INC_HOSTS = ( '.*', ); + + $SENDMSG_EXCL_HOSTS = ( 'test1', 'test2', '.engr.myinc.com$', ); + + +=head1 SEE ALSO + +L, L, +L + +=head1 NOTES + +The B module use SNMP to poll a host. It retrieves the +B, B, B, B, and B fields +for every entry in the B table. The module then scans all of all of +the network interfaces inretrieved from the table. Any interface that is +administratively up and is not operationally up will result in an critical +status (red) being return. + +=head1 RESTRICTIONS + +B uses the C library module to work. It uses the +new capability to send a status message to multiple servers. It is only +available in versions 0.02 and up of the Spong::Status module. + +=head1 AUTHOR + +Stephen L Johnson >. + -- 2.30.2