Zkus treba tenhle perl skript (jen zajistit ze se spusti po startu+predat mu aktualni IP pc a to ostatni co chces...).
http://www.mail-archive.com/nagios-users@lists.sourceforge.net/msg01616.html
Díky, to by možná šlo, ty IP adresy by se neměnily, takže by mi stačilo jí tam ručně vložit do textu zprávy.
Frederik #!/usr/bin/perl # # Author David Cox # Created from various code examples found on the web # Last Modified 2006-01-19 # History # HTML-changes based on 08/06/2002 # adapted d.d. 2006-01-19 by Dieter Demerre to allow html encoded messages # # 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 too 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) ; use HTML::Parse ; require HTML::FormatText; my $len = scalar @ARGV; my $htmlmessage = my $mymessage = ""; if ((2 ne $len) && (($len ne 3) || ($ARGV[1] ne "--html"))) { die "Usage...\n notify <jabberid>[,<jabberid>]* [--html] <message>\n"; } my @field=split(/,/,$ARGV[0]); use constant RECIPIENT => $ARGV[0]; use constant SERVER => 'your-jabber-server'; use constant PORT => 5222; use constant USER => 'your-jabber-id'; use constant PASSWORD => 'your-jabber-password'; use constant RESOURCE => ' '; use constant MAXWAIT => 2 ; if ("$ARGV[1]" eq "--html") { $htmlmessage = $ARGV[2]; # printf("pre de-html-ize: htmlmessage = \"$htmlmessage\".\n"); $mymessage = HTML::FormatText->new->format(HTML::Parse::parse_html("$htmlmessage\n")); } else { $htmlmessage = $ARGV[1]; $mymessage = "$htmlmessage"; } # printf("htmlmessage = \"$htmlmessage\".\n"); # printf("message = \"$mymessage\".\n"); 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->SetTo($_); $message->SetSubject('Notification'); $message->SetType('chat'); $message->SetBody($mymessage); # printf("Will send text \"%s\".\n",$message->GetBody()); if ("$ARGV[1]" eq "--html") { $message->InsertRawXML("<html xmlns='http://jabber.org/protocol/xhtml-im'><body xmlns='http://www.w3.org/1999/xhtml'>$htmlmessage</body></html>"); } $connection->Send($message); sleep(MAXWAIT); } $connection->Disconnect(); exit;
Co všechno v tom skriptu nastavit?
use constant SERVER => 'gmail.com'; use constant PORT => 5222; use constant USER => 'jmenopc@gmail.com'; use constant PASSWORD => 'nejakeheslo';
Jak napíšu příjemce? V poli recipient to vypadá složitější....
use constant RECIPIENT => $ARGV[0];