| 2 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 3 |  | # | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 4 |  | # i-scream central monitoring system | 
 
 
 
 
 
 
 
 | 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 $hex_rbracket | 
 
 
 
 
 | 50 | > | $hex_lbracket $hex_plus | 
 
 
 
 
 
 
 
 
 
 
 | 51 |  | $rrdstep $retry_wait | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 52 |  | $verbose $quiet | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 53 |  | }; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 257 |  | ); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 258 |  | &updaterrd($machine, "cpu", $date, $rrdstep, \%xmlhash, @data); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 259 |  |  | 
 
 
 
 
 
 
 
 | 260 | + | # uptime | 
 
 
 
 
 
 
 
 | 261 | + | @data = ( "packet.os.uptime:uptime:GAUGE" ); | 
 
 
 
 
 
 
 
 | 262 | + | &updaterrd($machine, "uptime", $date, $rrdstep, \%xmlhash, @data); | 
 
 
 
 
 
 
 
 | 263 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 264 |  | # mem | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 265 |  | @data = ( "packet.memory.free:free:GAUGE", | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 266 |  | "packet.memory.total:total:GAUGE", | 
 
 
 
 
 
 
 
 | 267 | + | "packet.memory.cache:cache:GAUGE", | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 268 |  | ); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 269 |  | &updaterrd($machine, "mem", $date, $rrdstep, \%xmlhash, @data); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 270 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 294 |  | @data = ( "packet.users.count:count:GAUGE", | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 295 |  | ); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 296 |  | &updaterrd($machine, "users", $date, $rrdstep, \%xmlhash, @data); | 
 
 
 
 
 
 
 
 
 
 
 | 297 | < |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 297 | > |  | 
 
 
 
 
 | 298 | > | # paging | 
 
 
 
 
 | 299 | > | @data = ( "packet.pages.pageins:pageins:GAUGE", | 
 
 
 
 
 | 300 | > | "packet.pages.pageouts:pageouts:GAUGE", | 
 
 
 
 
 | 301 | > | ); | 
 
 
 
 
 | 302 | > | &updaterrd($machine, "paging", $date, $rrdstep, \%xmlhash, @data); | 
 
 
 
 
 | 303 | > |  | 
 
 
 
 
 
 
 
 
 
 
 | 304 |  | # disk | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 305 |  | my($i) = 0; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 306 |  | while(defined $xmlhash{"packet.disk.p$i.attributes.mount"}) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 307 |  | my($mount) = $xmlhash{"packet.disk.p$i.attributes.mount"}; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 308 |  | $mount =~ s/_/$hex_underscore/g; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 309 |  | $mount =~ s/\//$hex_slash/g; | 
 
 
 
 
 
 
 
 
 
 
 | 310 | < | @data = ( "packet.disk.p$i.attributes.kbytes:kbytes:GAUGE", | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 310 | > | $mount =~ s/\\/$hex_bslash/g; | 
 
 
 
 
 | 311 | > | $mount =~ s/ /$hex_space/g; | 
 
 
 
 
 | 312 | > | $mount =~ s/:/$hex_colon/g; | 
 
 
 
 
 | 313 | > | @data = ( "packet.disk.p$i.attributes.total:total:GAUGE", | 
 
 
 
 
 
 
 
 
 
 
 | 314 |  | "packet.disk.p$i.attributes.used:used:GAUGE", | 
 
 
 
 
 
 
 
 | 315 | + | "packet.disk.p$i.attributes.totalinodes:totalinodes:GAUGE", | 
 
 
 
 
 
 
 
 | 316 | + | "packet.disk.p$i.attributes.freeinodes:freeinodes:GAUGE", | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 317 |  | ); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 318 |  | &updaterrd($machine, "disk-$mount", $date, $rrdstep, \%xmlhash, @data); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 319 |  | ++$i; | 
 
 
 
 
 
 
 
 | 320 | + | } | 
 
 
 
 
 
 
 
 | 321 | + |  | 
 
 
 
 
 
 
 
 | 322 | + | # diskio | 
 
 
 
 
 
 
 
 | 323 | + | $i = 0; | 
 
 
 
 
 
 
 
 | 324 | + | while(defined $xmlhash{"packet.diskio.p$i.attributes.name"}) { | 
 
 
 
 
 
 
 
 | 325 | + | my($name) = $xmlhash{"packet.diskio.p$i.attributes.name"}; | 
 
 
 
 
 
 
 
 | 326 | + | $name =~ s/_/$hex_underscore/g; | 
 
 
 
 
 
 
 
 | 327 | + | $name =~ s/\//$hex_slash/g; | 
 
 
 
 
 
 
 
 | 328 | + | $name =~ s/\\/$hex_bslash/g; | 
 
 
 
 
 
 
 
 | 329 | + | $name =~ s/ /$hex_space/g; | 
 
 
 
 
 
 
 
 | 330 | + | $name =~ s/:/$hex_colon/g; | 
 
 
 
 
 
 
 
 | 331 | + | @data = ( "packet.diskio.p$i.attributes.rbytes:rbytes:GAUGE", | 
 
 
 
 
 
 
 
 | 332 | + | "packet.diskio.p$i.attributes.wbytes:wbytes:GAUGE", | 
 
 
 
 
 
 
 
 | 333 | + | ); | 
 
 
 
 
 
 
 
 | 334 | + | &updaterrd($machine, "diskio-$name", $date, $rrdstep, \%xmlhash, @data); | 
 
 
 
 
 
 
 
 | 335 | + | ++$i | 
 
 
 
 
 
 
 
 | 336 | + | } | 
 
 
 
 
 
 
 
 | 337 | + |  | 
 
 
 
 
 
 
 
 | 338 | + | # net | 
 
 
 
 
 
 
 
 | 339 | + | $i = 0; | 
 
 
 
 
 
 
 
 | 340 | + | while(defined $xmlhash{"packet.net.p$i.attributes.name"}) { | 
 
 
 
 
 
 
 
 | 341 | + | my($name) = $xmlhash{"packet.net.p$i.attributes.name"}; | 
 
 
 
 
 
 
 
 | 342 | + | $name =~ s/_/$hex_underscore/g; | 
 
 
 
 
 
 
 
 | 343 | + | $name =~ s/\//$hex_slash/g; | 
 
 
 
 
 
 
 
 | 344 | + | $name =~ s/\\/$hex_bslash/g; | 
 
 
 
 
 
 
 
 | 345 | + | $name =~ s/ /$hex_space/g; | 
 
 
 
 
 
 
 
 | 346 | + | $name =~ s/:/$hex_colon/g; | 
 
 
 
 
 
 
 
 | 347 | + | $name =~ s/\(/$hex_rbracket/g; | 
 
 
 
 
 
 
 
 | 348 | + | $name =~ s/\)/$hex_lbracket/g; | 
 
 
 
 
 
 
 
 | 349 | + | $name =~ s/\+/$hex_plus/g; | 
 
 
 
 
 
 
 
 | 350 | + | @data = ( "packet.net.p$i.attributes.rx:rx:GAUGE", | 
 
 
 
 
 
 
 
 | 351 | + | "packet.net.p$i.attributes.tx:tx:GAUGE", | 
 
 
 
 
 
 
 
 | 352 | + | ); | 
 
 
 
 
 
 
 
 | 353 | + | &updaterrd($machine, "net-$name", $date, $rrdstep, \%xmlhash, @data); | 
 
 
 
 
 
 
 
 | 354 | + | ++$i | 
 
 
 
 
 
 
 
 | 355 | + | } | 
 
 
 
 
 
 
 
 | 356 | + |  | 
 
 
 
 
 
 
 
 | 357 | + | # mailq | 
 
 
 
 
 
 
 
 | 358 | + | $i = 0; | 
 
 
 
 
 
 
 
 | 359 | + | while(defined $xmlhash{"packet.mailq.p$i.attributes.name"}) { | 
 
 
 
 
 
 
 
 | 360 | + | my($name) = $xmlhash{"packet.mailq.p$i.attributes.name"}; | 
 
 
 
 
 
 
 
 | 361 | + | $name =~ s/\s+//g; | 
 
 
 
 
 
 
 
 | 362 | + | @data = ( "packet.mailq.p$i.attributes.size:size:GAUGE", | 
 
 
 
 
 
 
 
 | 363 | + | ); | 
 
 
 
 
 
 
 
 | 364 | + | &updaterrd($machine, "mailq-$name", $date, $rrdstep, \%xmlhash, @data); | 
 
 
 
 
 
 
 
 | 365 | + | ++$i | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 366 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 367 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 368 |  |  |