|
|
| Author |
Message |
mac77
Joined: 30 May 2007 Posts: 2 Location: France
|
Posted: Wed May 30, 2007 4:47 am Post subject: Weathermap plugin in cacti: This map hasn't been created yet |
|
|
Hello, I'm French so sorry for my bad english.
I am using Weathemap 0.9 plugin with cacti
When I do php poller.php, it works but I have this :
| Code: |
cat: /proc/meminfo: No such file or directory
cat: /proc/meminfo: No such file or directory
OK u:0.00 s:0.01 r:0.02
OK u:0.00 s:0.01 r:0.02
OK u:0.00 s:0.01 r:0.02
OK u:0.00 s:0.01 r:0.02
OK u:0.00 s:0.01 r:0.03
Timeout: No Response from 192.168.33.3:161.
OK u:0.00 s:0.01 r:3.06
OK u:0.00 s:0.01 r:3.07
OK u:0.00 s:0.01 r:3.07
OK u:0.00 s:0.01 r:3.07
OK u:0.00 s:0.01 r:3.07
OK u:0.00 s:0.01 r:3.07
OK u:0.00 s:0.01 r:4.12
OK u:0.00 s:0.01 r:4.12
OK u:0.00 s:0.01 r:4.12
OK u:0.00 s:0.01 r:4.12
OK u:0.00 s:0.01 r:4.12
OK u:0.00 s:0.01 r:4.12
OK u:0.00 s:0.02 r:4.13
OK u:0.00 s:0.02 r:4.13
OK u:0.00 s:0.02 r:6.15
OK u:0.00 s:0.02 r:6.15
OK u:0.00 s:0.02 r:6.16
OK u:0.00 s:0.02 r:6.16
05/30/2007 11:44:08 AM - SYSTEM STATS: Time:7.2019 Method:cmd.php Processes:1 Threads:N/A Hosts:6 HostsPerProcess:6 DataSources:42 RRDsProcessed:23
<?
// common code used by the poller, the manual-run from the Cacti UI, and from the command-line manual-run.
// this is the easiest way to keep it all consistent!
function weathermap_run_maps($mydir) {
global $config;
global $weathermap_debugging, $WEATHERMAP_VERSION;
include_once($mydir.DIRECTORY_SEPARATOR."HTML_ImageMap.class.php");
include_once($mydir.DIRECTORY_SEPARATOR."Weathermap.class.php");
$outdir = $mydir.DIRECTORY_SEPARATOR.'output';
$confdir = $mydir.DIRECTORY_SEPARATOR.'configs';
$mapcount = 0;
// take our debugging cue from the poller - turn on Poller debugging to get weathermap debugging
if (read_config_option("log_verbosity") >= POLLER_VERBOSITY_DEBUG)
{
$weathermap_debugging = TRUE;
$mode_message = "DEBUG mode is on";
}
else
{
$mode_message = "Normal logging mode. Turn on DEBUG in Cacti for more information";
}
// moved this outside the module_checks, so there should always be something in the logs!
cacti_log("Weathermap $WEATHERMAP_VERSION starting - $mode_message",true,"WEATHERMAP");
if(module_checks())
{
// move to the weathermap folder so all those relatives paths don't *have* to be absolute
$orig_cwd = getcwd();
chdir($mydir);
// first, see if the output directory even exists
if(is_dir($outdir))
{
// next, make sure that we stand a chance of writing files
//// $testfile = realpath($outdir."weathermap.permissions.test");
$testfile = $outdir.DIRECTORY_SEPARATOR."weathermap.permissions.test";
$testfd = fopen($testfile, 'w');
if($testfd)
{
fclose($testfd);
unlink($testfile);
$queryrows = db_fetch_assoc("select * from weathermap_maps where active='on' order by sortorder,id");
if( is_array($queryrows) )
{
debug("Iterating all maps.");
$imageformat = strtolower(read_config_option("weathermap_output_format"));
foreach ($queryrows as $map) {
$mapfile = $confdir.DIRECTORY_SEPARATOR.$map['configfile'];
$htmlfile = $outdir.DIRECTORY_SEPARATOR."weathermap_".$map['id'].".html";
$imagefile = $outdir.DIRECTORY_SEPARATOR."weathermap_".$map['id'].".".$imageformat;
$thumbimagefile = $outdir.DIRECTORY_SEPARATOR."weathermap_thumb_".$map['id'].".".$imageformat;
if(file_exists($mapfile))
{
warn("Map: $mapfile -> $htmlfile & $imagefile");
$wmap = new Weathermap;
$wmap->context = "cacti";
// we can grab the rrdtool path from Cacti's config, in this case
$wmap->rrdtool = read_config_option("path_rrdtool");
$wmap->ReadConfig($mapfile);
$wmap->ReadData();
// $wmap->imageuri = $config['url_path'].'/plugins/weathermap/output/weathermap_'.$map['id'].".".$imageformat;
$wmap->imageuri = 'output/weathermap_'.$map['id'].".".$imageformat;
warn("About to write image file. If this is the last message in your log, increase memory_limit in php.ini");
if(function_exists("memory_get_usage"))
{
$mem_used = nice_bandwidth(memory_get_usage());
$mem_allowed = ini_get("memory_limit");
debug("memory_get_usage() says ".$mem_used."Bytes used. Limit is ".$mem_allowed."\n");
}
$wmap->DrawMap($imagefile,$thumbimagefile,read_config_option("weathermap_thumbsize"));
warn("Wrote map to $imagefile and $thumbimagefile");
$fd = @fopen($htmlfile, 'w');
if($fd != FALSE)
{
fwrite($fd, $wmap->MakeHTML('weathermap_'.$map['id'].'_imap'));
fclose($fd);
debug("Wrote HTML to $htmlfile");
}
else
{
if(file_exists($htmlfile))
{
warn("Failed to overwrite $htmlfile - permissions of existing file are wrong?\n");
}
else
{
warn("Failed to create $htmlfile - permissions of output directory are wrong?\n");
}
}
db_execute("update weathermap_maps set titlecache='".mysql_real_escape_string($wmap->title)."' where id=".$map['id']);
$mapcount++;
}
else
{
warn("Mapfile $mapfile is not readable or doesn't exist");
}
}
debug("Iterated all $mapcount maps.");
}
else
{
warn("No activated maps found.");
}
}
else
{
warn("Output directory ($outdir) isn't writable (tried to create '$testfile'). No maps created. You probably need to make it writable by the poller process (like you did with the RRA directory)");
}
}
else
{
warn("Output directory ($outdir) doesn't exist!. No maps created. You probably need to create that directory, and make it writable by the poller process (like you did with the RRA directory)");
}
chdir($orig_cwd);
warn("Weathermap $WEATHERMAP_VERSION run complete - $mapcount maps were run");
}
else
{
warn("Required modules for PHP Weathermap $WEATHERMAP_VERSION were not present. Not running.");
}
}
// vim:ts=4:sw=4:
?>
PHP Fatal error: Call to undefined function weathermap_run_maps() in /usr/local/www/apache22/data/plugins/weathermap/setup.php on line 301
|
I don't undestand why ...
and I don't have map in weathermap plugin :
"This map hasn't been created yet"
Thanks for your help !! |
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2167 Location: United Kingdom
|
Posted: Wed May 30, 2007 5:08 am Post subject: |
|
|
In lib/poller-common.php, try changing the very first line from <? to <?php
I've never seen it fail the way you have it, but I do know that is the one file that doesn't have a "full" <?php tag (this is fixed in the next release). |
|
| Back to top |
|
 |
mac77
Joined: 30 May 2007 Posts: 2 Location: France
|
Posted: Wed May 30, 2007 6:56 am Post subject: |
|
|
thank you, but now, when I start it, I have this message :
| Quote: |
PHP Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 2400 bytes) in /usr/local/www/apache22/data/plugins/weathermap/Weathermap.class.php on line 4377
|
But when I go on line 4377 of this file, I have this.
| Quote: |
elseif(function_exists('imagepng') && preg_match("/\.png/i",$filename))
{
debug("Writing PNG file\n");
$result = imagepng($image, $filename)
}
|
So I don't undestand where I can allocate 2400 bytes |
|
| Back to top |
|
 |
tommyj
Joined: 23 Jun 2005 Posts: 32 Location: Stockholm, Sweden
|
Posted: Wed May 30, 2007 2:07 pm Post subject: |
|
|
It might be the default limit of 8MB in /etc/php.ini. Try to increase the row
memory_limit = 8M
to 64M or something. |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|