1
1
<?php
2
2
3
- class WeatherMapPostProcessorZabbix extends WeatherMapPostProcessor
3
+ class WeatherMapPostProcessorZabbix extends WeatherMapPostProcessor
4
4
{
5
5
function run (&$ map )
6
6
{
@@ -17,11 +17,11 @@ function run(&$map)
17
17
$ graphPeriod = $ map ->get_hint ('post_zabbix_graph_period ' );
18
18
19
19
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
21
21
$ graph = $ item ->overliburl [$ k ];
22
22
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 ))
25
25
{
26
26
$ keyname = $ matches [1 ];
27
27
$ host = $ matches [2 ];
@@ -31,10 +31,10 @@ function run(&$map)
31
31
32
32
$ graphId = $ this ->zabbixApi ->getGraphId ($ host , $ keyname , $ key );
33
33
if (isset ($ graphId )) {
34
- if ($ addGraphLink ) {
34
+ if ($ addGraphLink ) {
35
35
$ item ->infourl [$ k ] = $ baseUrl .'/charts.php?form_refresh=1&fullscreen=0&graphid= ' .$ graphId ;
36
36
}
37
- $ item ->overliburl [$ k ][0 ] = $ baseUrl .'/chart2.php?width= ' .$ graphWidth .'&height= ' .
37
+ $ item ->overliburl [$ k ][$ index ] = $ baseUrl .'/chart2.php?width= ' .$ graphWidth .'&height= ' .
38
38
$ graphHeight .'&period= ' .$ graphPeriod .'&stime=now&graphid= ' .$ graphId ;
39
39
}
40
40
}
0 commit comments