04-27-2007 10:38 AM
There is nice XML Status monitoring Perl script on support site under 'Appliance Documentation -> Tools' to monitor some system parameters.
Have anyone created/modified the Perl script to monitor http://servername/xml/tophosts to get alerted when the "active_recip" queue exceed specified limit ?
Such a Perl code would be highly appreciated
04-27-2007 09:54 PM
Hope this helps!!
-bash-3.00$ more monitor_active_recips.pl
#!/usr/bin/perl
##### Perl script to monitor log usage on 2 hosts ######
use CGI;
open STDERR, ">/dev/null";
######### Set threshold for active recipients ########
$exp_active_recips =1000;
######### Add hosts that need to be monitored ########
@host = ( "iron1.com", "iron2.com" );
for ($i = 0; $i < @host; $i++) {
##################### Get Stats for hosts #########################
$val = `curl -k https://$host[$i]/xml/status -u admin:ironport`;
$trigger = 0;
if ($val =~ /active_recips\" current=\"(\d+)\"/s) {
$active_recips = $1;
}
if ($active_recips > $exp_active_recips) {
$trigger += 1;
}
if ( $trigger == 1) {
open(MAIL, "| /usr/lib/sendmail -oi -n -t");
print MAIL <
From:LOG_MONITOR\@ironport.com
Subject: Critical Resource Utilization Values Exceeded
STATUS SUMMARY OF $host[$i]
active_recips = $active_recips
EMAIL_TO_USER
close MAIL;
}
}
05-02-2007 11:36 AM
Thanks ! This works great !
Do you know if it's somehow possible to get a list of hostnames with the queue lenght when the pending message queue exceed a specified limit ?
The info is available via https://$host[$i]/xml/tophosts but unfortunately my very poor Perl skills doesn't allow me to write such a code :(
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: