here is a different way that i'm calling zrtg. it produces a directory of images and related html files to link it all together somewhat like mrtg does. obfiously replace USERNAME, PASSWORD, HOSTNAME, and PORT. then you run it in the directory you want the output to appear in and pass it a file name (or stdin) of pairs of data that are the output names for the graphs and the base64 blob that zenoss uses for that target. just like the previous program, you can easily get this by looking at the properties of the images and just extract the blob between gopts and width.
the program produces hourly, daily, weekly, monthly, and yearly graphs using the same timespans that zenoss does. note that the renderserver will returned cached info if it has recently drawn the graph, so if you are looking at zenoss graphs and this job runs, you may not really get what you ask for, but something that is close. i think it may just check the rrd files, so the graph would be the same anyway, but the labeling might be a bit off. i doubt it will matter much. oh, you can also change the width parameter to make bigger graphs. i imagine that height can be specified as well, but i haven't played with that yet. input example (this should all be one line): Code: chaparral eNq9kltvgjAUgP8KifFlsVBInNqEJWSiI_GyMLfswcTUUrRLAdPWyxZ-_EA3uSzq2_rSc8rXcw58gEEK3BSANWWrtbJNCLOEJ3sqAGcRU3aeC7ZiQbbvqFCMYA44XlJuL5mShqQkffJfRy6yOjBfOmx0jwFioRdPiaJKtjQWTrfqlGgPmqV34Hj-kfbdQYkCAu9tYyuFwZOsi_FF40TK321DRWj06Y4RmnXdMEHBJjgAUz_GipK1TpLISKTBYpWxOOec2dhaQN2E1n0bYMzbGsefVBhF00UR6kIEKJAQOW-u7wzd9LE-3ya2q-O2uq27OmZXb6SO7zq1Kg0ICYEwDJEXL5NtHGinlQ6ffW8yq9Fo5LzMENmKOWq2dYuHTXkBHHsTFLH4JvfzggjvVrdrOu8owoeCO3s7G_1Xceeui1J8SV1pxKO7yshleecHdu1SOvImrlkv1ch_8DDs9VB2XDJYfMMKftVglbyisArecFir-lfiN99WXEk= and here is the program: Code: #!/usr/bin/perl $user = 'USERNAME'; $password = 'PASSWORD'; $RenderServer = 'http://HOSTNAME:PORT/zport/RenderServer/render'; $width = 500; $day = 24*60*60; @ranges = ( { 'label' => 'hourly', 'seconds' => => 1.5*$day, }, { 'label' => 'daily', 'seconds' => => 10*$day, }, { 'label' => 'weekly', 'seconds' => => 42*$day, }, { 'label' => 'monthly', 'seconds' => => 480*$day, }, { 'label' => 'yearly', 'seconds' => => 720*$day, }, ); sub encode($) { my($str) = shift; $str =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; return ($str); } open(INDEX, '>', 'index.html'); print INDEX <<'EOF'; <html> <head> <title> Graph Index </title> </head> <body> EOF while (<>) { chomp(); s/#.*//; # remove comments next if (/^\s+$/); # ignore blank lines ($host, $key) = split(' '); print INDEX "<a href=\"$host.html\"><img src=\"$host-hourly.png\"></a><br>\n"; open(HOST, '>', "$host.html"); print HOST <<"EOF"; <html> <head> <title> $host Index </title> </head> <body> EOF foreach $range (@ranges) { $label = $range->{'label'}; $seconds = $range->{'seconds'}; chomp($start = `date -d 'now -$seconds seconds' '+%Y-%m-%d %H:%M:%S'`); chomp($end = `date -d 'now' '+%Y-%m-%d %H:%M:%S'`); $start =~ s/:/\\:/g; $end =~ s/:/\\:/g; $args = "__ac_name=$user&__ac_password=$password&submit=Submit&gopts=$key&width=$width&drange=$seconds&start=end-${seconds}s&end=now&comment=" . encode("$start\\t\\t\\t\\t to \\t\\t\\t$end"); system("wget -q --output-document=$host-$label.png --post-data='$args' $RenderServer"); print HOST ucfirst($label)."<br>\n"; print HOST "<img src=\"$host-$label.png\"><br>\n"; } print HOST <<'EOF'; </body> </html> EOF close(HOST); } print INDEX <<'EOF'; </body> </html> EOF -------------------- m2f -------------------- Read this topic online here: http://forums.zenoss.com/viewtopic.php?p=36896#36896 -------------------- m2f -------------------- _______________________________________________ zenoss-users mailing list [email protected] http://lists.zenoss.org/mailman/listinfo/zenoss-users
