Skip to content

Commit c4a881a

Browse files
committed
Ability to display several graphs on the same item (#2)
1 parent dc3d523 commit c4a881a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/post/WeatherMapPostProcessorZabbix.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
class WeatherMapPostProcessorZabbix extends WeatherMapPostProcessor
3+
class WeatherMapPostProcessorZabbix extends WeatherMapPostProcessor
44
{
55
function run(&$map)
66
{
@@ -17,11 +17,11 @@ function run(&$map)
1717
$graphPeriod = $map->get_hint('post_zabbix_graph_period');
1818

1919
foreach (array_merge($map->links, $map->nodes) as $item) {
20-
foreach (range(0, 1) as $k) {
20+
foreach (range(0, 1) as $k) { // IN and OUT, if necessary
2121
$graph = $item->overliburl[$k];
2222

23-
if (count($graph) == 1) {
24-
if(preg_match('/^zabbix:([-a-zA-Z0-9_\.\/\[\]]+):([-a-zA-Z0-9_\.\/\[\]]+):([-a-zA-Z0-9_\.\/\[\]]+)$/', $graph[0], $matches))
23+
foreach ($graph as $index=>$graphItem) {
24+
if(preg_match('/^zabbix:([-a-zA-Z0-9_\.\/\[\]]+):([-a-zA-Z0-9_\.\/\[\]]+):([-a-zA-Z0-9_\.\/\[\]]+)$/', $graphItem, $matches))
2525
{
2626
$keyname = $matches[1];
2727
$host = $matches[2];
@@ -31,10 +31,10 @@ function run(&$map)
3131

3232
$graphId = $this->zabbixApi->getGraphId($host, $keyname, $key);
3333
if (isset($graphId)) {
34-
if ($addGraphLink) {
34+
if ($addGraphLink) {
3535
$item->infourl[$k] = $baseUrl.'/charts.php?form_refresh=1&fullscreen=0&graphid='.$graphId;
3636
}
37-
$item->overliburl[$k][0] = $baseUrl.'/chart2.php?width='.$graphWidth.'&height='.
37+
$item->overliburl[$k][$index] = $baseUrl.'/chart2.php?width='.$graphWidth.'&height='.
3838
$graphHeight.'&period='.$graphPeriod.'&stime=now&graphid='.$graphId;
3939
}
4040
}

0 commit comments

Comments
 (0)