Perl - Zabbix SMS Allert

Un netmonitor, non è un vero netmonitor se non fa squillare il telefono del sysadmin con un sms almeno 3 volte a notte, ecco qui uno script in perl per interfacciare zabbix con il servizio fornito da Mobyt tramite un POST http su un loro gateway, con qualche aggiustatina può essere usato anche con altri servizi analoghi. #!/usr/bin/perl # Leonardo Rizzi # Version 0.3 # SMS sent throuth Mobyt gateway # Designed for use without ip autentication only MD5 Hash # Attention: there aren't any check but message limit is of 160 charaters. use Digest::MD5 qw(md5_hex); use strict; use LWP::UserAgent; use HTTP::Request::Common qw(POST); my ($operation, $qty, $rcpt, $query, $out, $ua, $ok, $ko, $data, $from); my ($code, $id, $password); $id="username"; $password="password"; $ok='SMS Sent Correctly'; $ko='SMS Not Sent'; $from= $ARGV[1]; $operation="TEXT"; $qty = 'h'; #attention this fuking provider don't accept 00 for international area code only + if you use 00 you get sent error $rcpt = $ARGV[0]; $data = $ARGV[2]; $code = join '', $id,$operation,$rcpt,$from,$data,$password; my $ticket=md5_hex($code); $ua = new LWP::UserAgent; $ua->agent("SMS_MD5_Relay/0.2 " . $ua->agent); my $req = POST 'http://smsweb.mobyt.it/sms-gw/sendsmart', [ id =$id, operation ='TEXT', rcpt =$rcpt, from =$from, data =$data, qty =$qty, ticket=$ticket ]; my $res=$ua->request($req); if ($res->content =~ /^OK/) { fine_ok (); } else { fine_ko (); } exit; sub fine_ko () { my $msg=shift; print "$ko\n"; exit (1); } sub fine_ok () { my $msg=shift; print "$ok\n"; exit (1); }

21 November 2008 @ 00:56 · Updated: 30 June 2026 @ 03:28 · leo

Linux - Zabbix Build 1.6.1 (MySql)

Una breve guida sull’implementazione di questo giovane netmonitor che a mio avviso a differenza di soluzioni più conosciute e consolidate come nagios, introduce una gestione molto più web oriented semplificando moldo le operazioni in ambienti che necessitano di rapida scalabilità. L’installazione è stata effettuato con successo usando Debian Etch 4.0r5 e CentOS 5.2 inutile dire che tutte le operazio che seguiranno dovranno essere fatte da utente ‘root’ Prepariamo quello che ci serve per la compilazione: tardis:~# aptitude -y install build-essential libmysqlclient-dev libssl-dev libsnmp-dev libiksemel-dev libcurl3-dev ...

8 November 2008 @ 18:00 · Updated: 30 June 2026 @ 03:28 · leo