From 646b91783520cd8beea5b2b36af58fab17ae0668 Mon Sep 17 00:00:00 2001 From: James Tate II Date: Thu, 9 Apr 2020 14:26:13 -0400 Subject: [PATCH 1/2] fixed schema in WeatherMapDataSource_cactithold.php to use new fields. rra_id -> local_data_id data_id -> data_template_rrd_id --- lib/datasources/WeatherMapDataSource_cactithold.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/datasources/WeatherMapDataSource_cactithold.php b/lib/datasources/WeatherMapDataSource_cactithold.php index 764e03a..22977e5 100644 --- a/lib/datasources/WeatherMapDataSource_cactithold.php +++ b/lib/datasources/WeatherMapDataSource_cactithold.php @@ -106,10 +106,10 @@ function ReadData($targetstring, &$map, &$item) // use target aggregation to build these up into a 'badness' percentage // takes the same two values that are visible in thold's own URLs (the actual thold ID isn't shown anywhere) - $rra_id = intval($matches[1]); - $data_id = intval($matches[2]); + $local_data_id = intval($matches[1]); + $data_template_rrd_id = intval($matches[2]); - $SQL2 = "select thold_alert from thold_data where rra_id=$rra_id and data_id=$data_id and thold_enabled='on'"; + $SQL2 = "select thold_alert from thold_data where local_data_id=$local_data_id and data_template_rrd_id=$data_template_rrd_id and thold_enabled='on'"; $result = db_fetch_row($SQL2); if(isset($result)) { @@ -179,13 +179,13 @@ function ReadData($targetstring, &$map, &$item) wm_debug("CactiTHold ReadData: Checking threshold states for host $id\n"); $numthresh = 0; $numfailing = 0; - $SQL2 = "select rra_id, data_id, thold_alert from thold_data,data_local where thold_data.rra_id=data_local.id and data_local.host_id=$id and thold_enabled='on'"; + $SQL2 = "select local_data_id, data_template_rrd_id, thold_alert from thold_data,data_local where thold_data.local_data_id=data_local.id and data_local.host_id=$id and thold_enabled='on'"; # $result = db_fetch_row($SQL2); $queryrows = db_fetch_assoc($SQL2); if( is_array($queryrows) ) { foreach ($queryrows as $th) { - $desc = $th['rra_id']."/".$th['data_id']; + $desc = $th['local_data_id']."/".$th['data_template_rrd_id']; $v = $th['thold_alert']; $numthresh++; if(intval($th['thold_alert']) > 0) From e2ad9f8689139bc5e972d8e8f3bc5c0b93f684c9 Mon Sep 17 00:00:00 2001 From: James Tate II Date: Tue, 14 Apr 2020 15:01:45 -0400 Subject: [PATCH 2/2] added printf arguments to the -f CLI argument of rrdtool to resolve bug in rrdtool version 1.4.8. rrdtool-1.4.8 is the version on RHEL7. This version enforces the three printf arguments being present in the fromat string. See: https://forum.network-weathermap.com/t/rrdtool-aggregate-target-has-no-valid-data-after-move-to-github-version/76/5 https://oss.oetiker.ch/rrdtool/doc/rrdgraph.en.html --- lib/datasources/WeatherMapDataSource_rrd.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/datasources/WeatherMapDataSource_rrd.php b/lib/datasources/WeatherMapDataSource_rrd.php index 9d6327d..8208e99 100644 --- a/lib/datasources/WeatherMapDataSource_rrd.php +++ b/lib/datasources/WeatherMapDataSource_rrd.php @@ -244,7 +244,7 @@ function wmrrd_read_from_real_rrdtool_aggregate($rrdfile,$cf,$aggregatefn,$start $args[] = "graph"; $args[] = "/dev/null"; $args[] = "-f"; - $args[] = "''"; + $args[] = "'%s %lu %lu'"; $args[] = "--start"; $args[] = $start; $args[] = "--end";