This seems like something that ought to at least end up on the wiki, if 
not in trac somehow...

Matt Ray: Any idea on whether these Zenoss compliments (while not a 
zenpack) might eventually find homes in your source control system?
--
James Pulver
Information Technology Area Supervisor
LEPP Computer Group
Cornell University



WebGuyInternet wrote, On 4/21/2009 9:34 PM:
> This small PERL script will pull an image from Zenoss given the ID of the 
> graph.  I suggest you run it as a system cron every 10 - 15 minutes.  This 
> script requires the UNIX command WGET to pull the images.  Thanks to all 
> those that posted before me because they really did all of the hard work, I 
> just put everything together in a script!
> 
> Note: this script can be made SO MUCH BETTER, I just have other projects that 
> I have to move onto and my perl knowledge isn't all that great.  Please make 
> better and more exciting.  Maybe dancing penguins on the screen as it 
> processes????
> 
> Instructions
>   - Save the below code into a file called "pullImage.pl" and make it system 
> executable.
>   - Modify the top of the file with the settings appropriate for your Zenoss 
> config.
>   - "BaseDir" is where the images will be exported to, usually under your 
> webserver root.
>   - Create a file under $basedir called images.txt and insert the "ID" of 
> each of your graphs. (See above discussion on how to do it with Firefox)
>   - The images.txt file can have comments (prefixed with a # char) so that 
> you know which graph is what since the Zenoss "IDs" aren't very self 
> explainatory.  Below is also an example images.txt file.
>   - There is also a log file for troubleshooting and seeing progress.
> 
> 
> Code:
> 
> #!/usr/bin/perl
> 
> $wget = '/usr/bin/wget';
> $user = 'kiosk';
> $password = 'password';
> $RenderServer = 'http://zenoss.yourdomain.com:8080/zport/RenderServer/render';
> $basedir = '/users/home/public_html/graph';
> $logfile = 'last_output.log';
> 
> # First let's get to the correct place to start.
> # This is the directory where you want the images to be dumped to.
> chdir($basedir);
> 
> use Getopt::Std;
> # use Fcntl;
> 
> sub usage() {
> print STDERR << "EOF";
>         
> Usage: pullImage.cgi -q
>                 
> Command Line Arguments
>   -q    Keep the script quiet! eg. no output.
>          
> EOF
> exit(0);
> }
> 
> # Start the Main Program
> # ---------------------------------------------------
> 
> # Let's get our arguments if there are any.
> # like the shell getopt, "d:" means d takes an argument
> getopts("q",\%options) or usage();
>    
> # Let's remove the old logfile.
> unlink($logfile);
> 
> # Add a seperator in the Log file for readability.
> open LOGFILE, ">>$logfile" or die "cannot open logfile $logfile for append: 
> $!";
> print LOGFILE "-" x 50 ."\n";
>  
> #Load all graph ID's into an array.
> @pix = `cat $basedir/images.txt`;
> $i=0;
> 
> 
> foreach $pix (@pix) {
>         chomp $pix;
>         if ($pix =~ m/\s*#/i) { # ignore comment lines
>                 $pix =~ tr/#//d; # Remove the Hash mark
>                 print LOGFILE "Next graph is for: ". $pix . "\n";
>                 print LOGFILE "-" x 50 ."\n";
>                 next;
>         }
> 
>    # Let's build our command line first.
>         $cmdline = "-r --output-document=graph$i.png -a $logfile 
> --post-data=\"__ac_name=$user&__ac_password=$password&submit=Submi$
> 
>    #Use system command to get images from Zenoss.
>         `$wget $cmdline`;
> 
>    # Add a seperator in the Log file for readability.
>         print LOGFILE "-" x 50 ."\n";
> }
> close LOGFILE;
> 
> if(!($options{q})){
>         print "$i images were fetched successfully.\n";
> }
> 
> 
> 
> 
> Below is an example images.txt file:
> 
> 
> Code:
> 
> # Qwest ATM Throughput
> eNq1kl1rwjAUhv9KQbwZtomTiQY6KLO6gh-jc2MXgrRpUrPFVpJU58iPn3ZbbcucVzs3OYc8J-flvDGH2nS1aa4Ii1fKbkN4KHi6I8LkbM2UfawFi1l0OLdEKIYDbvIgJNwOmZJAEqzv_aexizpdmIcFG708QYx6yQwromTLYHSWqa_CuDU6XQvCyeJVD9xhCTNFsLNBJgXg6WEO-CBJKuXPsSGCggHZMkwkeCOc760dCeNszxJFREKUhdM1SCXIaxocMWc-aS8hOI1YnlJLiAhFEiLn2fWdkavv6mo2iV0V1-q1ruqYXe3Qju86tVcaEGIMIaXosIQwzZLIyEOPHnxvOq_RaOw8zhHOxAI1b6xrTpvyDPgtHAXb-CI7cV7QOng_ccX2C2P-cf3FjGUpP2dASVDuQEVg2YLiwq416bE3ddv1pxrHX0lpv4-8pORCyYYK_qcPVfKCEVX4Fyc-AYU_OEI=&drange=129600&width=500&start=end-129600s&end=now-0s&comment=2009-01-18%2022%5C%3A25%5C%3A31%5Ct%5Ct%5Ct%5Ct%20to%20%5Ct%5Ct%5Ct2009-01-20%2010%5C%3A25%5C%3A31
> # Server Room Temperature
> eNqFjl1rwjAUhv9KQLyMiUJBDnYQZqKCDum64UVhZPVUK1FH0lYZ-fGroNgVx87N-eA5vA9VnkpP6RbzzbYI-5zXS4W2yFNtqNGfaELlp9HbXELAO0rxuiDG_RdaXZQWyYgEPNldkeFD5IkML8hYquaZWn0KWeksM8c6jH3j4ejcrdVUxsZY5Sk6Jhd91vj8aMw9a9ewdhzEu4zERPrnVkzYivQikqLt0bk4K5Vlv7wJ8ZNlNHuJ2zjMxWsMaWkT6Aa9gcm67i_yqgW62vwPL8QK9vp8B5PdD5HWjoo=&drange=129600&width=500&start=end-129600s&end=now-0s&comment=2009-01-18%2022%5C%3A26%5C%3A33%5Ct%5Ct%5Ct%5Ct%20to%20%5Ct%5Ct%5Ct2009-01-20%2010%5C%3A26%5C%3A33
> # T1 Bandwidth
> eNq1kl1vgjAUhv8KifFmEVrYTLQJS8hER-LHgm7ZhYmB0mI3BNMW3Zb--InbEMicV-tNe9KnPW_6VB8q3VW6viYsXkvbhPBQJNmecD1hGybtouYsZtFh3hEuGQ4SPQlCktghkwIIgtW9_zh2kWlddy0IDdjqwWIgRr10hiWRoqMxOsvlV6HdaqZh3UyWL2rgDiuUzoO9DXLBQZIduoAPkmZC_ExbwikYkB3DRIDXQDJi7EkY5-8slYSnRBo424BMgGNNgwKbE86CBK4gOHVZnZYG5xGKBETOk-s7I1fdNQNtU7uer9PrXDUxu35COb7rNG5pQYgxhJSiwzOEWZ5G2nGo0YPvTRcNGo2d-QLhnC9Ru2tYCW2LM-B3cBTs4ovsxHlGm-DtxJUCSjX_a6Bss6qszzmoZDpKqGWsWig37MYhNfamrtm8qlV8TUr7feSlFREVEzX8TxV18oKLOvyLjE_jETq4&drange=129600&width=500&start=end-129600s&end=now-0s&comment=2009-01-20%204%5C%3A39%5C%3A11%5Ct%5Ct%5Ct%5Ct%20to%20%5Ct%5Ct%5Ct2009-01-21%2016%5C%3A39%5C%3A11
> # Cisco CPU Load over 1 Month
> eNp9jt1LwzAUxf-VwdhjmqsguECF4LIpTJH6gQ8FybLbLjP9IGk7J_njjdjOPoj35XDP_XHPIUtPhCdkhzrfNfEZQFg6tI1W0hAjN2jiGq3CspE5hltbh5UYXeiBNtXh5IC_SZ7Xgs1hegnfw1TdXhS6nFxN5pDu_UIsB4tYeYhp6yw1VQijn1hWzg0SUjK6wE4rdPQdjTlGB9zk7VGXDdoSm0hVBe1fvfUaWbtlWweMv4iEr4S_HuXFo1zPE8HHRaYASgFk2anwz_jVQ3J7_zRG2Zo_BqO1KZtBdG6ymfuL6isw2eX_g3f8lRXy4xdK91_tt4ls&drange=3628800&width=500&start=end-3628800s&end=now-0s&comment=2008-12-09%2017%5C%3A09%5C%3A23%5Ct%5Ct%5Ct%5Ct%20to%20%5Ct%5Ct%5Ct2009-01-20%2017%5C%3A09%5C%3A23
> # Mailserver CPU Load
> eNqtkV1vgjAYhf-KifGyUG-bcNEommUfWcB9XJiYWgt2KWDaAnPhx6_NBoIyx4VXzXnf856cPAWLCvgVAHvG4732phAaUTCpOSUCCLJlwjswSVmqSczMLj8YCQRPeO0WWdlMYDX3F0ip2SEPSBkelWYJkKT03FxJV2Qm1P1iaaZU_Zi0yJ2zglOm3IRw4ZRsG-dHnmomU6YdmiVuN3DTlY6UO7RTEOFXP8BLv5pddvAuK1U48HFP1TGElEIYRWc7FK7w7L5aPgd3T6ueO_SAwxWiuVyjCXSmIppMrph_uyJSxIP8j_gdJeTz5F1_dFC_KPMHtwNt4zZtcR2ydXjnVbqA66nBa-G28NrNaNSPt74aALexDkLbuP8D-0a4viFYG7dpi-tgrcM7r9IFW0_HP1hbYO3mL7D11QCwjXUQ2MbdA_YbaEqQ2g==&drange=129600&width=500&start=end-129600s&end=now-0s&comment=2009-01-19%205%5C%3A46%5C%3A43%5Ct%5Ct%5Ct%5Ct%20to%20%5Ct%5Ct%5Ct2009-01-20%2017%5C%3A46%5C%3A43
> 
> 
> 
> 
> Hope thia all helps.  Hope this all works!  : )
> 
> 
> 
> 
> -------------------- m2f --------------------
> 
> Read this topic online here:
> http://forums.zenoss.com/viewtopic.php?p=33652#33652
> 
> -------------------- m2f --------------------
> 
> 
> 
> _______________________________________________
> zenoss-users mailing list
> zenoss-users@zenoss.org
> http://lists.zenoss.org/mailman/listinfo/zenoss-users
_______________________________________________
zenoss-users mailing list
zenoss-users@zenoss.org
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to