ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/experimental/reports/queuegraphing/watch.pl
(Generate patch)

Comparing experimental/reports/queuegraphing/watch.pl (file contents):
Revision 1.1 by tdb, Sun Oct 21 16:52:41 2001 UTC vs.
Revision 1.4 by tdb, Mon Oct 22 22:21:33 2001 UTC

# Line 85 | Line 85 | while(1) {
85      if($err) {
86          print "SKIPPED (bad xml): $response";
87      }
88 <    #foreach my $key (keys %xmlhash) {
89 <    #    print "$key == $xmlhash{$key}\n";
90 <    #}
88 >    ## -- mental note, think about ordering checks for optimal speed ;)
89 >    # take a look to see if we have a shutdown packet...
90 >    if(defined($xmlhash{"packet.attributes.shutdown"}) && $xmlhash{"packet.attributes.shutdown"} eq "true") {
91 >        my($hash) = $xmlhash{"packet.attributes.hashCode"};
92 >        my($cmd) = "rm -f $hash\_*.rrd $hash*.png $hash.def";
93 >        print `$cmd`;
94 >        print "$cmd\n";
95 >        next;
96 >    }
97      if($xmlhash{"packet.attributes.type"} eq "queueStat") {
98          my($hash) = $xmlhash{"packet.attributes.hashCode"};
99          my($date) = $xmlhash{"packet.attributes.date"};
# Line 100 | Line 106 | while(1) {
106                  &makerrd($hash, $i, $date, $name);
107              }
108              my($size) = $xmlhash{"packet.queue.attributes.queue$i"};
109 <            my($cmd) = "rrdtool update $hash\_$i.rrd $date:$size:$total";
109 >            my($cmd);
110 >            # see if the queue has been removed
111 >            if($size eq "[deleted]") {
112 >                $cmd = "rm -f $hash\_$i.rrd";
113 >                # are there any other rrd's left? if not, cleanup!
114 >                my($rrdcount) = `ls | grep $hash\_\\*.rrd | wc -l`;
115 >                if($rrdcount == 0) {
116 >                    $cmd = $cmd . " && rm -f $hash.def $hash*.png";
117 >                }
118 >            }
119 >            else {
120 >                $cmd = "rrdtool update $hash\_$i.rrd $date:$size:$total";
121 >            }
122              print `$cmd`;
123              print "$cmd\n";
124              ++$i;
# Line 109 | Line 127 | while(1) {
127      else {
128          print "SKIPPED: valid xml, but not a queueStat packet";
129      }
112    #if($response =~ /^<packet type="queueStat" date="(\d+)" name="(.*)" hashCode="(\d+)"><queue queue0="(\d+)" total="(\d+)" maxSize="(\d+)"><\/queue><\/packet>$/) {
113    #    print "DATE: $1  HASH: $3  SIZE0: $4  TOTAL: $5  MAX: $6\n";
114    #    if( ! -f "$3.rrd" ) {
115    #        print "making new database for $3\n";
116    #        &makerrd($3, $1, $2);
117    #    }
118    #    my($cmd) = "rrdtool update $3.rrd $1:$4:$5";
119    #    print `$cmd`;
120    #}
121    #else {
122    #    print "SKIPPED: $response";
123    #}
130   }
131  
132   exit 0;
127
128 #<packet type="queueStat" date="1003332749" name="net3filter Filter" hashCode="2905137"><queue queue0="0" total="783170" maxSize="1000"></queue></packet>
129
130 #packet.attributes.name == realtimeclients TCPHandler:myrtle.ukc.ac.uk
131 #packet.queue.attributes.total == 13
132 #packet.queue.attributes.maxSize == 1000
133 #packet.queue.attributes.queue0 == 0
134 #packet.queue.attributes.queue1 == 0
135 #packet.attributes.hashCode == 4575504
136 #packet.attributes.date == 1003614252
137 #packet.attributes.type == queueStat
133  
134   sub makerrd() {
135      my($name, $queuenum, $start, $comment) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines