Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37881522
en ru br
ALT Linux repositórios
S:2.2.1-alt1
5.0: 1.4.12-alt1
4.1: 1.4.12-alt1.M41.1
4.0: 1.4.5-alt1.1
3.0: 1.4-alt1

Group :: Monitoramento
RPM: nagios-plugins

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

#!/usr/bin/perl -w
#
# Author David Cox
# Created from various code examples found on the web
# Last Modified 08/06/2002
# Feel free to use or modify as needed to suit your needs
#######################################################
# MAXWAIT is used because the send message function didn't seem to
# like being called to fast. The message would be sent unless I waited a second
# or so. You can experiment with it but I just went with 2 seconds.
#######################################################

use strict;
use Net::Jabber qw(Client) ;
use Net::Jabber qw(Message) ;
use Net::Jabber qw(Protocol) ;
use Net::Jabber qw(Presence) ;

my $len = scalar @ARGV;

if ($len ne 2) {
die "Usage...\n notify [jabberid] [message]\n";
}

my @field=split(/,/,$ARGV[0]);

use constant RECIPIENT => $ARGV[0];
use constant SERVER => 'trap.skh';
use constant PORT => 5222;
use constant USER => 'nagios';
use constant PASSWORD => 'yfubjcyjnbab';
use constant RESOURCE => 'Nagios Notify';
use constant MESSAGE => $ARGV[1];
use constant MAXWAIT => 2 ;

my $connection = Net::Jabber::Client->new();
$connection->Connect( "hostname" => SERVER,"port" => PORT ) or die
"Cannot connect ($!)\n";

my @result = $connection->AuthSend( "username" => USER,"password" =>
PASSWORD,"resource" => RESOURCE );
if ($result[0] ne "ok") {
die "Ident/Auth with server failed: $result[0] - $result[1]\n";
}

foreach ( @field ) {
my $message = Net::Jabber::Message->new();
$message->SetMessage( "to" => $_,
"subject" => "Notification",
"type" => "chat",
"body" => MESSAGE);

$connection->Send($message);
sleep(MAXWAIT);
}
$connection->Disconnect();
exit;

 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009