| 100 |
|
&makerrd($hash, $i, $date, $name); |
| 101 |
|
} |
| 102 |
|
my($size) = $xmlhash{"packet.queue.attributes.queue$i"}; |
| 103 |
< |
my($cmd) = "rrdtool update $hash\_$i.rrd $date:$size:$total"; |
| 103 |
> |
my($cmd); |
| 104 |
> |
# see if the queue has been removed |
| 105 |
> |
if($size eq "[deleted]") { |
| 106 |
> |
$cmd = "rm -f $hash\_$i.rrd"; |
| 107 |
> |
# are there any other rrd's left? if not, cleanup! |
| 108 |
> |
my($rrdcount) = `ls | grep $hash\_\\*.rrd | wc -l`; |
| 109 |
> |
if($rrdcount == 0) { |
| 110 |
> |
$cmd = $cmd . " && rm -f $hash.def $hash*.png"; |
| 111 |
> |
} |
| 112 |
> |
} |
| 113 |
> |
else { |
| 114 |
> |
$cmd = "rrdtool update $hash\_$i.rrd $date:$size:$total"; |
| 115 |
> |
} |
| 116 |
|
print `$cmd`; |
| 117 |
|
print "$cmd\n"; |
| 118 |
|
++$i; |
| 121 |
|
else { |
| 122 |
|
print "SKIPPED: valid xml, but not a queueStat packet"; |
| 123 |
|
} |
| 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 |
– |
#} |
| 124 |
|
} |
| 125 |
|
|
| 126 |
|
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 |
| 127 |
|
|
| 128 |
|
sub makerrd() { |
| 129 |
|
my($name, $queuenum, $start, $comment) = @_; |