BlueFrog Cacti/rra monitor script

Submitted by Falken on

If you are looking to track your BlueFrog spam fighting, you may find this useful to parse information out of their web pages while they rustle up an RSS or web service. I'll try and update it as needs be.

#!/usr/bin/perl
use LWP; my $browser = LWP::UserAgent->new; $browser->cookie_jar({}); push @{ $browser->requests_redirectable }, 'POST'; $response = $browser->get( "http://members.bluesecurity.com/cwa/users/welcome.do"); die "$url error: ", $response->status_line unless $response->is_success; die "Weird content type at $url -- ", $response->content_type unless $response->content_type eq 'text/html'; $response = $browser->post( "https://members.bluesecurity.com/cwa/users/j_security_check", [ j_username => "yourname", j_password => "yourpass" ], ); die "$url error: ", $response->status_line unless $response->is_success; die "Weird content type at $url -- ", $response->content_type unless $response->content_type eq 'text/html'; #print $response->content; open FILE,">/tmp/b"; print FILE $response->content; close FILE;
$rank=`grep myBlueRank /tmp/b|cut -d'(' -f4|cut -d')' -f1`;
chomp $rank;
$reports=`grep mySpamReport /tmp/b|cut -d'(' -f4|cut -d')' -f1`;
chomp $reports;
$response = $browser->get( "http://members.bluesecurity.com/cwa/users/spamReview.do"); open FILE,">/tmp/b"; print FILE $response->content; close FILE; $waiting= `grep 'email messages waiting' /tmp/b|cut -d' ' -f3`; chomp $waiting; print "rank:$rank reports:$reports waiting:$waiting\n";

Sections