get_hint('mrtg_value'); $matchperiod = $item->get_hint('mrtg_period'); $swap = intval($item->get_hint('mrtg_swap')); $negate = intval($item->get_hint('mrtg_negate')); if($matchvalue =='') $matchvalue = "cu"; if($matchperiod =='') $matchperiod = "d"; $fd=fopen($targetstring, "r"); if ($fd) { while (!feof($fd)) { $buffer=fgets($fd, 4096); debug("MRTG ReadData: Matching on '${matchvalue}in $matchperiod' and '${matchvalue}out $matchperiod'\n"); if (preg_match("/<\!-- ${matchvalue}in $matchperiod ([-+]?\d+\.?\d*) -->/", $buffer, $matches)) { $data[IN] = $matches[1] * 8; } if (preg_match("/<\!-- ${matchvalue}out $matchperiod ([-+]?\d+\.?\d*) -->/", $buffer, $matches)) { $data[OUT] = $matches[1] * 8; } } fclose($fd); # don't bother with the modified time if the target is a URL if(! preg_match('/^[a-z]+:\/\//',$targetstring) ) { $data_time = filemtime($targetstring); } } else { // some error code to go in here debug ("MRTG ReadData: Couldn't open ($targetstring). \n"); } if($swap==1) { debug("MRTG ReadData: Swapping IN and OUT\n"); $t = $data[OUT]; $data[OUT] = $data[IN]; $data[IN] = $t; } if($negate) { debug("MRTG ReadData: Negating values\n"); $data[OUT] = -$data[OUT]; $data[IN] = -$data[IN]; } debug ("MRTG ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[OUT]).",$data_time)\n"); return( array($data[IN], $data[OUT], $data_time) ); } } // vim:ts=4:sw=4: ?> WebSVN - weathermap - Blame - Rev 134 - /lib/datasources/WeatherMapDataSource_mrtg.php
  jablonka.czprosek.czf

weathermap

Subversion Repositories:
[/] [lib/] [datasources/] [WeatherMapDataSource_mrtg.php] - Blame information for rev 134

 

Line No. Rev Author Line

Powered by WebSVN 2.2.1