Merge branch 'master' of linz:/srv/git/git-kairo
authorRobert Kaiser <kairo@kairo.at>
Sat, 5 Sep 2015 02:21:00 +0000 (04:21 +0200)
committerRobert Kaiser <kairo@kairo.at>
Sat, 5 Sep 2015 02:21:00 +0000 (04:21 +0200)
include/classes/rrdstat.php-class

index 7532f00bfc637d649eea5599543b89e7b372c159..deb8cdaef81250a998a00f18cbc6c1391c5854b0 100644 (file)
@@ -366,8 +366,13 @@ class rrdstat {
             $evalcode = 'function { return trim('.substr($ds['update'], 4).')); }';
           }
           elseif (substr($ds['update'], 0, 8) == 'snmp-if:') {
-            $snmphost = 'localhost'; $snmpcomm = 'public';
-            list($nix, $ifname, $valtype) = explode(':', $ds['update'], 3);
+            if (substr_count($ds['update'], ':') >= 4) {
+              list($nix, $snmphost, $snmpcomm, $ifname, $valtype) = explode(':', $ds['update'], 5);
+            }
+            else {
+              $snmphost = 'localhost'; $snmpcomm = 'public';
+              list($nix, $ifname, $valtype) = explode(':', $ds['update'], 3);
+            }
             $iflist = explode("\n", `snmpwalk -v2c -c $snmpcomm $snmphost interfaces.ifTable.ifEntry.ifDescr`);
             $ifnr = null;
             foreach ($iflist as $ifdesc) {