XML tophosts

Unanswered Question
Apr 27th, 2007
User Badges:

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

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
jaigill Fri, 04/27/2007 - 21:54
User Badges:
  • Cisco Employee,

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 <To:user1\@domain.com
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;
}
}

Rayman_Jr Wed, 05/02/2007 - 11:36
User Badges:

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 :(

Actions

This Discussion