Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Script to update Weathermap graphs (for Boost users)

 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
jale



Joined: 18 Apr 2007
Posts: 3

PostPosted: Wed May 16, 2007 4:30 am    Post subject: Script to update Weathermap graphs (for Boost users) Reply with quote

Here's little script for Boost users who also want to use Weathermap plugin.

This script accesses graphs in Weathermap configs, so Boost will update those.
It uses url in OVERLIBGRAPH statement in links, every link MUST have OVERLIBGRAPH for this script to work.

This Script needs:
Perl
Perl LWP::Simple package
Guest access to graphs

Copy script to server, run it from crontab 5 min interval:
*/5 * * * * root perl <path_to_script>/script.pl >> /dev/null 2>&1

Modify config lines and perl path in script.

Code:

#!/usr/bin/perl

### <CONFIG> ###
my $config_path = '/var/www/html/cacti/plugins/weathermap/configs'; # Path to config files
my @config_files = ('config1.conf','config2.conf'); # Array of config files
### </CONFIG> ###

use LWP::Simple;

foreach (@config_files) {
        open CMD, "grep OVERLIBGRAPH $config_path/$_|";
        while (<CMD>) {
                my $content = get($1) if /OVERLIBGRAPH\s+(.*)$/;
                if (defined $content) { print "Graph access OK\n"; }
                else { print "Graph access FAILED\n"; }
        }
}
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group