| 2 |
|
|
| 3 |
|
# |
| 4 |
|
# i-scream central monitoring system |
| 5 |
< |
# http://www.i-scream.org.uk |
| 5 |
> |
# http://www.i-scream.org |
| 6 |
|
# Copyright (C) 2000-2002 i-scream |
| 7 |
|
# |
| 8 |
|
# This program is free software; you can redistribute it and/or |
| 22 |
|
|
| 23 |
|
# ----------------------------------------------------------- |
| 24 |
|
# i-scream graph generation scripts |
| 25 |
< |
# http://www.i-scream.org.uk |
| 25 |
> |
# http://www.i-scream.org |
| 26 |
|
# |
| 27 |
|
# Generates rrd databases for i-scream data by connecting to |
| 28 |
|
# the i-scream server and collecting data. |
| 43 |
|
|
| 44 |
|
# define variables that will be read from the config |
| 45 |
|
# nb. keep this insync with the config file! |
| 46 |
< |
use vars qw{ |
| 47 |
< |
$imgdir $rrddir |
| 46 |
> |
use vars qw{ |
| 47 |
> |
$imgdir $rrddir |
| 48 |
|
$maxrrdage $maximgage $deleterrds $deleteimgs |
| 49 |
< |
$hex_slash $hex_underscore |
| 49 |
> |
$hex_slash $hex_underscore $hex_space $hex_colon $hex_bslash |
| 50 |
|
$rrdstep $retry_wait |
| 51 |
|
$verbose $quiet |
| 52 |
|
}; |
| 256 |
|
); |
| 257 |
|
&updaterrd($machine, "cpu", $date, $rrdstep, \%xmlhash, @data); |
| 258 |
|
|
| 259 |
+ |
# uptime |
| 260 |
+ |
@data = ( "packet.os.uptime:uptime:GAUGE" ); |
| 261 |
+ |
&updaterrd($machine, "uptime", $date, $rrdstep, \%xmlhash, @data); |
| 262 |
+ |
|
| 263 |
|
# mem |
| 264 |
|
@data = ( "packet.memory.free:free:GAUGE", |
| 265 |
|
"packet.memory.total:total:GAUGE", |
| 266 |
+ |
"packet.memory.cache:cache:GAUGE", |
| 267 |
|
); |
| 268 |
|
&updaterrd($machine, "mem", $date, $rrdstep, \%xmlhash, @data); |
| 269 |
|
|
| 295 |
|
&updaterrd($machine, "users", $date, $rrdstep, \%xmlhash, @data); |
| 296 |
|
|
| 297 |
|
# paging |
| 298 |
< |
@data = ( "packet.pages.swapins:swapins:GAUGE", |
| 299 |
< |
"packet.pages.swapouts:swapouts:GAUGE", |
| 298 |
> |
@data = ( "packet.pages.pageins:pageins:GAUGE", |
| 299 |
> |
"packet.pages.pageouts:pageouts:GAUGE", |
| 300 |
|
); |
| 301 |
|
&updaterrd($machine, "paging", $date, $rrdstep, \%xmlhash, @data); |
| 302 |
|
|
| 306 |
|
my($mount) = $xmlhash{"packet.disk.p$i.attributes.mount"}; |
| 307 |
|
$mount =~ s/_/$hex_underscore/g; |
| 308 |
|
$mount =~ s/\//$hex_slash/g; |
| 309 |
< |
@data = ( "packet.disk.p$i.attributes.kbytes:kbytes:GAUGE", |
| 309 |
> |
$mount =~ s/\\/$hex_bslash/g; |
| 310 |
> |
$mount =~ s/ /$hex_space/g; |
| 311 |
> |
$mount =~ s/:/$hex_colon/g; |
| 312 |
> |
@data = ( "packet.disk.p$i.attributes.total:total:GAUGE", |
| 313 |
|
"packet.disk.p$i.attributes.used:used:GAUGE", |
| 314 |
|
"packet.disk.p$i.attributes.totalinodes:totalinodes:GAUGE", |
| 315 |
|
"packet.disk.p$i.attributes.freeinodes:freeinodes:GAUGE", |
| 316 |
|
); |
| 317 |
|
&updaterrd($machine, "disk-$mount", $date, $rrdstep, \%xmlhash, @data); |
| 318 |
|
++$i; |
| 319 |
+ |
} |
| 320 |
+ |
|
| 321 |
+ |
# diskio |
| 322 |
+ |
$i = 0; |
| 323 |
+ |
while(defined $xmlhash{"packet.diskio.p$i.attributes.name"}) { |
| 324 |
+ |
my($name) = $xmlhash{"packet.diskio.p$i.attributes.name"}; |
| 325 |
+ |
$name =~ s/_/$hex_underscore/g; |
| 326 |
+ |
$name =~ s/\//$hex_slash/g; |
| 327 |
+ |
$name =~ s/\\/$hex_bslash/g; |
| 328 |
+ |
$name =~ s/ /$hex_space/g; |
| 329 |
+ |
$name =~ s/:/$hex_colon/g; |
| 330 |
+ |
@data = ( "packet.diskio.p$i.attributes.rbytes:rbytes:GAUGE", |
| 331 |
+ |
"packet.diskio.p$i.attributes.wbytes:wbytes:GAUGE", |
| 332 |
+ |
); |
| 333 |
+ |
&updaterrd($machine, "diskio-$name", $date, $rrdstep, \%xmlhash, @data); |
| 334 |
+ |
++$i |
| 335 |
+ |
} |
| 336 |
+ |
|
| 337 |
+ |
# net |
| 338 |
+ |
$i = 0; |
| 339 |
+ |
while(defined $xmlhash{"packet.net.p$i.attributes.name"}) { |
| 340 |
+ |
my($name) = $xmlhash{"packet.net.p$i.attributes.name"}; |
| 341 |
+ |
$name =~ s/_/$hex_underscore/g; |
| 342 |
+ |
$name =~ s/\//$hex_slash/g; |
| 343 |
+ |
$name =~ s/\\/$hex_bslash/g; |
| 344 |
+ |
$name =~ s/ /$hex_space/g; |
| 345 |
+ |
$name =~ s/:/$hex_colon/g; |
| 346 |
+ |
@data = ( "packet.net.p$i.attributes.rx:rx:GAUGE", |
| 347 |
+ |
"packet.net.p$i.attributes.tx:tx:GAUGE", |
| 348 |
+ |
); |
| 349 |
+ |
&updaterrd($machine, "net-$name", $date, $rrdstep, \%xmlhash, @data); |
| 350 |
+ |
++$i |
| 351 |
+ |
} |
| 352 |
+ |
|
| 353 |
+ |
# mailq |
| 354 |
+ |
$i = 0; |
| 355 |
+ |
while(defined $xmlhash{"packet.mailq.p$i.attributes.name"}) { |
| 356 |
+ |
my($name) = $xmlhash{"packet.mailq.p$i.attributes.name"}; |
| 357 |
+ |
$name =~ s/\s+//g; |
| 358 |
+ |
@data = ( "packet.mailq.p$i.attributes.size:size:GAUGE", |
| 359 |
+ |
); |
| 360 |
+ |
&updaterrd($machine, "mailq-$name", $date, $rrdstep, \%xmlhash, @data); |
| 361 |
+ |
++$i |
| 362 |
|
} |
| 363 |
|
} |
| 364 |
|
|