cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1739
Views
0
Helpful
2
Replies

XML tophosts

Rayman_Jr
Level 1
Level 1

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

2 Replies 2

jaigill
Cisco Employee
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
Level 1
Level 1

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

Getting Started

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: