Weathermap Max Trafic View

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
Bloubli1
Posts: 2
Joined: Tue Jul 09, 2024 3:52 am

Weathermap Max Trafic View

Post by Bloubli1 »

Hello,

I have an old Weathermap Cacti version 0.97a and in this version when I go to the weathermap liste and choose one map, I can select to show the max trafic value for last 24h, 7d and 30d.

I am trying to add this fonction for the 1.3 Weathermap version but this doesn't works. When I select the maximum value for last 24H this gives me the maximum value of the hour following the last 24 hours.

For example at 11:00 a.m. if I choose the maximum flow rate for the last 24 hours it will show me the maximum flow rate between 11 a.m.-12 p.m. the day before.


There is the code that i have paste on the new weathermap-cacti-plugin.php

case 'liveviewimage':
$id = -1;

if( isset($_REQUEST['id']) && (!is_numeric($_REQUEST['id']) || strlen($_REQUEST['id'])==20) )
{
$id = weathermap_translate_id($_REQUEST['id']);
}

if( isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) )
{
$id = intval($_REQUEST['id']);
}

if($id >=0)
{
$userid = (isset($_SESSION["sess_user_id"]) ? intval($_SESSION["sess_user_id"]) : 1);
$map = db_fetch_assoc("select weathermap_maps.* from weathermap_auth,weathermap_maps where weathermap_maps.id=weathermap_auth.mapid and active='on' and (userid=".$userid." or userid=0) and weathermap_maps.id=".$id);

if(sizeof($map))
{
ob_start();
$mapfile = dirname(__FILE__).'/configs/'.'/'.$map[0]['configfile'];
$orig_cwd = getcwd();
chdir(dirname(__FILE__));

header('Content-type: image/png');

$map = new WeatherMap;
$map->context = '';
// $map->context = "cacti";
$map->rrdtool = read_config_option("path_rrdtool");
$map->ReadConfig($mapfile);
//$map->ReadData();
//$map->DrawMap('','',250,TRUE,FALSE);
if($_GET['peak'] == 'true') {
if(empty($_GET['interval'])) $start = 'now-30d';
else {
switch($_GET['interval']) {
case "month": $start = 'now-30d'; break;
case "week": $start = 'now-7d'; break;
case "day": $start = 'now-24h'; break;
default : $start = 'now-30d';
}
}
$end = 'now';
$cfname = 'MAX';
$map->add_hint('rrd_cf', 'MAX');
$map->add_hint('rrd_period', '3600');
$map->add_hint('rrd_start', $start);
$map->add_hint('rrd_end', $end);
$map->add_hint('week_max', true);
}
$map->ReadData();
ob_end_clean();
if($_GET['peak'] == 'true') { $map->DrawMap(null); }
else { $map->DrawMap('','',250,TRUE,FALSE); }
dir($orig_cwd);
}

}

break;

Anyone have an idea to resolve this?

Thank you in advance to anyone who will answer me
Bloubli1
Posts: 2
Joined: Tue Jul 09, 2024 3:52 am

Re: Weathermap Max Trafic View

Post by Bloubli1 »

I fixed it, I needed to add the week_max option in the WeatherMapDataSource_rrd.php
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: Weathermap Max Trafic View

Post by TheWitness »

Can you please post your code change to the WeatherMap plugin repository on GitHub here?

https://github.com/Cacti/plugin_weathermap
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest