Cacti on Weathermap

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
Aliii
Posts: 1
Joined: Sat Dec 03, 2005 11:23 am
Contact:

Cacti on Weathermap

Post by Aliii »

hello everyone
i creat this file cacti2weathermap.pl
with this code :
#!/usr/local/bin/php
<?php
# PHP Weathermap 0.6 - Pre-release software. For testing
# Copyright Howard Jones, 2005 howie@thingy.com
# http://wotsit.thingy.com/haj/cacti/
# Released under the GNU Public License
# require_once 'Console/Getopt.php';
require_once "Weathermap.class.php";
if (!extension_loaded('gd')) {
if (!dl('gd.so') && !dl('gd.dll')) {
die("\n\nNo image (gd) extension was found, or could be loaded. This is required by weathermap.\n\n");
}
}
$map = new Weathermap;
$output = "html";
$configfile = "weathermap.conf";
$imagefile = "weathermap.png";
$htmlfile = '';
$DEBUG = 0;
$dumpafter = 0;

// *****************************************************************************
// THIS IS THE ONE LINE IN HERE YOU MIGHT HAVE TO CHANGE!
$map->rrdtool = "/usr/bin/rrdtool";
# $map->rrdtool = "/usr/local/rrdtool-1.0.49/bin/rrdtool";
// *****************************************************************************

// initialize object
$cg = new Console_Getopt();
$short_opts = '';
$long_opts = array("image-uri=", "config=", "output=", "version", "help", "debug", "htmloutput=", "dumpafter","bulge","sizedebug");
$args = $cg->readPHPArgv();

$ret = $cg->getopt($args, $short_opts, $long_opts);
$gopts = $ret[0];
if (sizeof($gopts) >0) {
foreach($gopts as $o) {
switch ($o[0]) {
case '--config':
$configfile = $o[1];
break;
case '--htmloutput':
$htmlfile = $o[1];
break;
case '--dumpafter':
$dumpafter = 1;
break;
case '--image-uri':
$map->imageuri = $o[1];
break;
case '--debug':
$DEBUG = 1;
$map->debugging = TRUE;
break;
case '--sizedebug':
$map->sizedebug = TRUE;
break;
case '--bulge':
$map->widthmod = TRUE;
break;
break;
case '--output':
$imagefile = $o[1];
break;
}
}
}

if($DEBUG)
{
print "\n------------------------------------\n";
print "Starting PHP-Weathermap run, with config: $configfile\n";
}

$map->ReadConfig($configfile);
// fill in some random data for now
// $map->RandomData();
$map->ReadData();
if ($imagefile != '') {
$map->DrawMap($imagefile);
$map->imagefile = $imagefile;
}
if ($htmlfile != '') {
$fd = fopen($htmlfile, 'w');
fwrite($fd,'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1- ... dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="refresh" content="300" /><title>'.$map->title.'</title></head><body>');
fwrite($fd, $map->MakeHTML());
fwrite($fd, '<hr />Network Map created with <a href=\"http://wotsit.thingy.com/haj/cacti/php- ... map/\">PHP Network Weathermap</a></body></html>');
fclose($fd);
}
if ($dumpafter == 1) {
print_r($map);
}
?>
affter i use this command but i did not saw any HTML in DATAK Folder
Cacti# perl cacti2weathermap.pl
please help me
tnx for your reply
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Re: Cacti on Weathermap

Post by Howie »

Aliii wrote:hello everyone
i creat this file cacti2weathermap.pl
with this code :
#!/usr/local/bin/php
<?php
[snippped]

?>
affter i use this command but i did not saw any HTML in DATAK Folder
Cacti# perl cacti2weathermap.pl
please help me
tnx for your reply
That's not perl, it's php, which is why you would have gotten a lot of errors. It's also not cacti2weathermap in any language, but an older version of my Weathermap program in PHP. If you are trying to get the PHP Weathermap to work, you should probably read the manual for it (and not for the perl version!)...
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
freddy
Posts: 2
Joined: Tue Mar 14, 2006 8:32 am

Re: Cacti on Weathermap

Post by freddy »

[quote="Howie"][quote="Aliii"]hello everyone
i creat this file cacti2weathermap.pl
with this code :
#!/usr/local/bin/php
<?php
[snippped]

?>
affter i use this command but i did not saw any HTML in DATAK Folder
Cacti# perl cacti2weathermap.pl
please help me
tnx for your reply[/quote]

That's not perl, it's php, which is why you would have gotten a lot of errors. It's also not cacti2weathermap in any language, but an older version of my Weathermap program in PHP. If you are trying to get the PHP Weathermap to work, you should probably read the manual for it (and not for the perl version!)...[/quote]

haha! :lol:
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests