mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-09-26 19:39:02 +02:00
* lib/PandoraFMS/SNMPServer.pm: Fixed small problem in snmp2agent forwarding and better implementation of server error control. Also solved problem with duplicated traps in SNMP console. * lib/PandoraFMS/Server.pm: better implementation of server error control. * lib/PandoraFMS/Core.pm: SNMP alerts now show the IP in _agent_ macro * lib/PandoraFMS/Tools.pm: Better management of enterprise_hook on opensource version. * util/alert_multicast.pl: Added sample of alert script for render alerts as multicast XML. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2023 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
34 lines
830 B
Perl
34 lines
830 B
Perl
#!/usr/bin/perl
|
|
# Multicast client
|
|
# Copyright (c) 2007 Artica Soluciones Tecnologicas S.L.
|
|
|
|
use strict;
|
|
use warnings;
|
|
use POSIX qw(strftime);
|
|
use IO::Socket::Multicast;
|
|
|
|
if ($#ARGV != 3) {
|
|
print "Usage: $0 <group> <port> <agent_name> <alert_name>\n";
|
|
exit 1;
|
|
}
|
|
|
|
my $group = $ARGV[0];
|
|
my $port = $ARGV[1];
|
|
my $agent_name = $ARGV[2];
|
|
my $alert_name = $ARGV[3];
|
|
|
|
my $status_report = "<status_report>\n";
|
|
|
|
$status_report .= "<element id='$agent_name' name='$alert_name' status='ALRM' timestamp='" . strftime ("%Y/%m/%d %H:%M:%S", localtime()) . "'></element>\n";
|
|
|
|
$status_report .= "</status_report>\n";
|
|
|
|
my $socket = IO::Socket::Multicast->new(Proto => 'udp',
|
|
PeerAddr => $group . ':' . $port);
|
|
return unless defined ($socket);
|
|
$socket->send($status_report);
|
|
|
|
# print $status_report;
|
|
|
|
|