• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wm_debug函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wm_debug函数的典型用法代码示例。如果您正苦于以下问题:PHP wm_debug函数的具体用法?PHP wm_debug怎么用?PHP wm_debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wm_debug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: ReadData

 /**
  * @param string $targetString The string from the config file
  * @param the $map A reference to the map object (redundant)
  * @param the $mapItem A reference to the object this target is attached to
  * @return array invalue, outvalue, unix timestamp that the data was valid
  */
 function ReadData($targetString, &$map, &$mapItem)
 {
     $data[IN] = null;
     $data[OUT] = null;
     $data_time = 0;
     $matches = 0;
     if (preg_match("/^time:(.*)\$/", $targetString, $matches)) {
         $timezone = $matches[1];
         $offset = "now";
         if (preg_match("/^([^:]+):(.*)\$/", $timezone, $matches2)) {
             $timezone = $matches2[1];
             $offset = $matches2[2];
             // test that the offset is valid
             $timestamp = strtotime($offset);
             if ($timestamp === false || $timestamp === -1) {
                 warn("Time ReadData: Offset String ({$offset}) is bogus - ignoring [WMTIME03]\n");
                 $offset = "now";
             }
         }
         $timezone_l = strtolower($timezone);
         if (array_key_exists($timezone_l, $this->timezones)) {
             $tz = $this->timezones[$timezone_l];
             wm_debug("Time ReadData: Timezone exists: {$tz}\n");
             $dateTime = new DateTime($offset, new DateTimeZone($tz));
             $mapItem->add_note("time_time12", $dateTime->format("h:i"));
             $mapItem->add_note("time_time12ap", $dateTime->format("h:i A"));
             $mapItem->add_note("time_time24", $dateTime->format("H:i"));
             $mapItem->add_note("time_timet", $dateTime->format("U"));
             $mapItem->add_note("time_timezone", $tz);
             $data[IN] = $dateTime->format("H");
             $data[OUT] = $dateTime->format("i");
             $data_time = time();
             $matches++;
         }
         if ($matches == 0) {
             wm_warn("Time ReadData: Couldn't recognize {$timezone} as a valid timezone name [WMTIME02]\n");
         }
     } else {
         // some error code to go in here
         wm_warn("Time ReadData: Couldn't recognize {$targetString} \n");
     }
     wm_debug("Time ReadData: Returning (" . WMUtility::valueOrNull($data[IN]) . "," . WMUtility::valueOrNull($data[OUT]) . ",{$data_time})\n");
     return array($data[IN], $data[OUT], $data_time);
 }
开发者ID:hdecreis,项目名称:network-weathermap,代码行数:50,代码来源:WeatherMapDataSource_time.php


示例2: ReadData

 function ReadData($targetstring, &$map, &$item)
 {
     $data[IN] = NULL;
     $data[OUT] = NULL;
     $data_time = 0;
     $itemname = $item->name;
     $matches = 0;
     $fd = fopen($targetstring, "r");
     if ($fd) {
         while (!feof($fd)) {
             $buffer = fgets($fd, 4096);
             # strip out any Windows line-endings that have gotten in here
             $buffer = str_replace("\r", "", $buffer);
             if (preg_match("/^{$itemname}\t(\\d+\\.?\\d*[KMGT]*)\t(\\d+\\.?\\d*[KMGT]*)/", $buffer, $matches)) {
                 $data[IN] = unformat_number($matches[1]);
                 $data[OUT] = unformat_number($matches[2]);
             }
         }
         $stats = stat($targetstring);
         $data_time = $stats['mtime'];
     } else {
         // some error code to go in here
         wm_debug("TabText ReadData: Couldn't open ({$targetstring}). \n");
     }
     wm_debug("TabText 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);
 }
开发者ID:stapler2025,项目名称:Weathermap-librenms,代码行数:27,代码来源:WeatherMapDataSource_tabfile.php


示例3: run

 function run(&$map)
 {
     $enable = $map->get_hint('post_zabbix_graphs');
     if ($enable) {
         $this->zabbixApi = new SimpleZabbixApi($map->get_hint('zabbix_url'), $map->get_hint('zabbix_user'), $map->get_hint('zabbix_password'));
         if ($this->zabbixApi->isConnected()) {
             $baseUrl = $map->get_hint('post_zabbix_graph_base_url');
             $addGraphLink = $map->get_hint('post_zabbix_graph_link');
             $graphWidth = $map->get_hint('post_zabbix_graph_width');
             $graphHeight = $map->get_hint('post_zabbix_graph_height');
             $graphPeriod = $map->get_hint('post_zabbix_graph_period');
             foreach (array_merge($map->links, $map->nodes) as $item) {
                 foreach (range(0, 1) as $k) {
                     // IN and OUT, if necessary
                     $graph = $item->overliburl[$k];
                     foreach ($graph as $index => $graphItem) {
                         if (preg_match('/^zabbix:([-a-zA-Z0-9_\\.\\/\\[\\]]+):([-a-zA-Z0-9_\\.\\/\\[\\]]+):([-a-zA-Z0-9_\\.\\/\\[\\]]+)$/', $graphItem, $matches)) {
                             $keyname = $matches[1];
                             $host = $matches[2];
                             $key = $matches[3];
                             wm_debug("Zabbix ReadData: Found (" . $host . "," . $key . ")\n");
                             $graphId = $this->zabbixApi->getGraphId($host, $keyname, $key);
                             if (isset($graphId)) {
                                 if ($addGraphLink) {
                                     $item->infourl[$k] = $baseUrl . '/charts.php?form_refresh=1&fullscreen=0&graphid=' . $graphId;
                                 }
                                 $item->overliburl[$k][$index] = $baseUrl . '/chart2.php?width=' . $graphWidth . '&height=' . $graphHeight . '&period=' . $graphPeriod . '&stime=now&graphid=' . $graphId;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:kvc0769,项目名称:php-weathermap-zabbix-plugin,代码行数:35,代码来源:WeatherMapPostProcessorZabbix.php


示例4: ReadData

 function ReadData($targetString, &$map, &$mapItem)
 {
     $data[IN] = null;
     $data[OUT] = null;
     $data_time = 0;
     if (preg_match("/^dbplug:([^:]+)\$/", $targetString, $matches)) {
         $database_user = $map->get_hint('dbplug_dbuser');
         $database_pass = $map->get_hint('dbplug_dbpass');
         $database_name = $map->get_hint('dbplug_dbname');
         $database_host = $map->get_hint('dbplug_dbhost');
         $key = mysql_real_escape_string($matches[1]);
         // This is the one line you will certainly need to change
         $SQL = "select in,out from table where host={$key} LIMIT 1";
         if (mysql_connect($database_host, $database_user, $database_pass)) {
             if (mysql_select_db($database_name)) {
                 $result = mysql_query($SQL);
                 if (!$result) {
                     wm_warn("dbplug ReadData: Invalid query: " . mysql_error() . "\n");
                 } else {
                     $row = mysql_fetch_assoc($result);
                     $data[IN] = $row['in'];
                     $data[OUT] = $row['out'];
                 }
             } else {
                 wm_warn("dbplug ReadData: failed to select database: " . mysql_error() . "\n");
             }
         } else {
             wm_warn("dbplug ReadData: failed to connect to database server: " . mysql_error() . "\n");
         }
         $data_time = now();
     }
     wm_debug("RRD ReadData dbplug: Returning (" . ($data[IN] === null ? 'null' : $data[IN]) . "," . ($data[OUT] === null ? 'null' : $data[IN]) . ", {$data_time})\n");
     return array($data[IN], $data[OUT], $data_time);
 }
开发者ID:jiangxilong,项目名称:network-weathermap,代码行数:34,代码来源:WeatherMapDataSource_dbplug.php


示例5: ReadData

 function ReadData($targetString, &$map, &$mapItem)
 {
     $data[IN] = null;
     $data[OUT] = null;
     $data_time = 0;
     $matches = 0;
     if (preg_match($this->regexpsHandled[0], $targetString, $matches)) {
         $dataFileName = $matches[1];
         $dataItemName = $matches[2];
     }
     if (!file_exists($dataFileName)) {
         wm_warn("WMData ReadData: {$dataFileName} doesn't exist [WMWMDATA01]");
         return array(null, null, 0);
     }
     $fileHandle = fopen($targetString, "r");
     if (!$fileHandle) {
         wm_warn("WMData ReadData: Couldn't open ({$dataFileName}). [WMWMDATA02]\n");
         return array(null, null, 0);
     }
     list($found, $data) = $this->findDataItem($fileHandle, $dataItemName, $data);
     if ($found === true) {
         $stats = stat($dataFileName);
         $data_time = $stats['mtime'];
     } else {
         wm_warn("WMData ReadData: Data name '{$dataItemName}' didn't exist in '{$dataFileName}'. [WMWMDATA03]\n");
     }
     wm_debug(sprintf("WMData ReadData: Returning (%s, %s, %s)\n", string_or_null($data[IN]), string_or_null($data[OUT]), $data_time));
     return array($data[IN], $data[OUT], $data_time);
 }
开发者ID:jiangxilong,项目名称:network-weathermap,代码行数:29,代码来源:WeatherMapDataSource_wmdata.php


示例6: ReadData

 function ReadData($targetstring, &$map, &$item)
 {
     $data[IN] = null;
     $data[OUT] = null;
     $data_time = 0;
     if (preg_match("/^zabbix:([-a-zA-Z0-9_\\.\\/\\[\\]]+):([-a-zA-Z0-9_\\.\\/\\[\\]]+):([-a-zA-Z0-9_\\.\\/\\[\\]]+):([-a-zA-Z0-9_\\.\\/\\[\\]]+)\$/", $targetstring, $matches)) {
         $zabbix_uri = $map->get_hint('zabbix_uri');
         $zabbix_key = $matches[1];
         $host = $matches[2];
         $in = $matches[3];
         $out = $matches[4];
         wm_debug("Zabbix ReadData: Found (" . $host . "," . $in . "," . $out . ")\n");
         $raw_out_value = $this->zabbixApi->getItemLastValue($host, $zabbix_key, $out);
         $raw_in_value = $this->zabbixApi->getItemLastValue($host, $zabbix_key, $in);
         $in_value = $raw_in_value["lastvalue"];
         $out_value = $raw_out_value["lastvalue"];
         $data_time = $raw_out_value["lastclock"];
         if (isset($in_value)) {
             $data[IN] = $in_value;
         }
         if (isset($out_value)) {
             $data[OUT] = $out_value;
         }
     }
     wm_debug("Zabbix ReadData: Returning (" . ($data[IN] === null ? 'null' : $data[IN]) . "," . ($data[OUT] === null ? 'null' : $data[IN]) . ",{$data_time})\n");
     return array($data[IN], $data[OUT], $data_time);
 }
开发者ID:kvc0769,项目名称:php-weathermap-zabbix-plugin,代码行数:27,代码来源:WeatherMapDataSource_zabbix.php


示例7: ReadData

 function ReadData($targetstring, &$map, &$item)
 {
     $data[IN] = NULL;
     $data[OUT] = NULL;
     $data_time = 0;
     $itemname = $item->name;
     $matches = 0;
     if (preg_match("/^time:(.*)\$/", $targetstring, $matches)) {
         $timezone = $matches[1];
         $timezone_l = strtolower($timezone);
         $timezone_identifiers = DateTimeZone::listIdentifiers();
         foreach ($timezone_identifiers as $tz) {
             if (strtolower($tz) == $timezone_l) {
                 wm_debug("Time ReadData: Timezone exists: {$tz}\n");
                 $dateTime = new DateTime("now", new DateTimeZone($tz));
                 $item->add_note("time_time12", $dateTime->format("h:i"));
                 $item->add_note("time_time12ap", $dateTime->format("h:i A"));
                 $item->add_note("time_time24", $dateTime->format("H:i"));
                 $item->add_note("time_timezone", $tz);
                 $data[IN] = $dateTime->format("H");
                 $data_time = time();
                 $data[OUT] = $dateTime->format("i");
                 $matches++;
             }
         }
         if ($matches == 0) {
             wm_warn("Time ReadData: Couldn't recognize {$timezone} as a valid timezone name [WMTIME02]\n");
         }
     } else {
         // some error code to go in here
         wm_warn("Time ReadData: Couldn't recognize {$targetstring} \n");
     }
     wm_debug("Time 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);
 }
开发者ID:stapler2025,项目名称:Weathermap-librenms,代码行数:35,代码来源:WeatherMapDataSource_time.php


示例8: getSlope

 public function getSlope()
 {
     if ($this->dx == 0) {
         // special case - if slope is infinite, fudge it to be REALLY BIG instead. Close enough for TV.
         wm_debug("Slope is infinite.\n");
         return 10000000000.0;
     }
     return $this->dy / $this->dx;
 }
开发者ID:jiangxilong,项目名称:network-weathermap,代码行数:9,代码来源:WMVector.class.php


示例9: ReadData

 function ReadData($targetString, &$map, &$mapItem)
 {
     $data[IN] = null;
     $data[OUT] = null;
     $data_time = 0;
     if (preg_match("/^cactihost:(\\d+)\$/", $targetString, $matches)) {
         $cacti_id = intval($matches[1]);
         $SQL = "select * from host where id={$cacti_id}";
         // 0=disabled
         // 1=down
         // 2=recovering
         // 3=up
         // (4 is tholdbreached in cactimonitor, so skipped here for compatibility)
         // 5=unknown
         $state = -1;
         $result = db_fetch_row($SQL);
         if (isset($result)) {
             // create a note, which can be used in icon filenames or labels more nicely
             if ($result['status'] == 5) {
                 $state = 5;
                 $statename = 'unknown';
             }
             if ($result['status'] == 1) {
                 $state = 1;
                 $statename = 'down';
             }
             if ($result['status'] == 2) {
                 $state = 2;
                 $statename = 'recovering';
             }
             if ($result['status'] == 3) {
                 $state = 3;
                 $statename = 'up';
             }
             if ($result['disabled']) {
                 $state = 0;
                 $statename = 'disabled';
             }
             $data[IN] = $state;
             $data[OUT] = $state;
             $mapItem->add_note("state", $statename);
             $mapItem->add_note("cacti_description", $result['description']);
             $mapItem->add_note("cacti_hostname", $result['hostname']);
             $mapItem->add_note("cacti_curtime", $result['cur_time']);
             $mapItem->add_note("cacti_avgtime", $result['avg_time']);
             $mapItem->add_note("cacti_mintime", $result['min_time']);
             $mapItem->add_note("cacti_maxtime", $result['max_time']);
             $mapItem->add_note("cacti_availability", $result['availability']);
             $mapItem->add_note("cacti_faildate", $result['status_fail_date']);
             $mapItem->add_note("cacti_recdate", $result['status_rec_date']);
         }
     }
     wm_debug("CactiHost 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);
 }
开发者ID:hdecreis,项目名称:network-weathermap,代码行数:55,代码来源:WeatherMapDataSource_cactihost.php


示例10: run

 public function run()
 {
     $enable = $this->owner->get_hint("post_test_enable");
     if ($enable) {
         wm_debug(__CLASS__ . " is here\n");
         // do your work in here...
         $orig = $this->owner->get_note("test");
         $this->owner->add_note("test", $orig . " TESTYTEST");
     } else {
         wm_debug(__CLASS__ . " Not Enabled\n");
     }
 }
开发者ID:jiangxilong,项目名称:network-weathermap,代码行数:12,代码来源:WeatherMapPostProcessorExample.php


示例11: getTimeForTimeZone

 /**
  * @param $timezone
  * @param $offset
  * @return array
  * @internal param $mapItem
  * @internal param $data
  * @internal param $matches
  * @internal param $timezone_l
  */
 private function getTimeForTimeZone($timezone, $offset)
 {
     $timezone_l = strtolower($timezone);
     if (array_key_exists($timezone_l, $this->timezones)) {
         $timezone_name = $this->timezones[$timezone_l];
         wm_debug("Time ReadData: Timezone exists: {$timezone_name}\n");
         $dateTime = new DateTime($offset, new DateTimeZone($timezone_name));
         return array($dateTime, $timezone_name);
     }
     wm_warn("Time ReadData: Couldn't recognize {$timezone} as a valid timezone name [WMTIME02]\n");
     return null;
 }
开发者ID:jiangxilong,项目名称:network-weathermap,代码行数:21,代码来源:WeatherMapDataSource_time.php


示例12: ReadData

 function ReadData($targetString, &$map, &$mapItem)
 {
     $data[IN] = null;
     $data[OUT] = null;
     $data_time = 0;
     if (preg_match('/^cactihost:(\\d+)$/', $targetString, $matches)) {
         $cacti_id = intval($matches[1]);
         $data = $this->readDataFromCacti($mapItem, $cacti_id, $data);
     }
     wm_debug("CactiHost 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);
 }
开发者ID:jiangxilong,项目名称:network-weathermap,代码行数:12,代码来源:WeatherMapDataSource_cactihost.php


示例13: run

 function run(&$map)
 {
     $enable = $map->get_hint("post_test_enable");
     if ($enable) {
         wm_debug(__CLASS__ . " is here\n");
         // do your work in here...
         $orig = $map->get_note("test");
         $map->add_note("test", $orig . " TESTYTEST");
         // -------------------------
     } else {
         wm_debug(__CLASS__ . " Not Enabled\n");
     }
 }
开发者ID:tobzsc,项目名称:weathermap-for-observium,代码行数:13,代码来源:WeatherMapPostProcessorExample.php


示例14: ReadData

 function ReadData($targetString, &$map, &$mapItem)
 {
     $data[IN] = null;
     $data[OUT] = null;
     $data_time = 0;
     if (1 === preg_match('/^cacti:(\\d+)$/', $targetString, $matches)) {
         $local_data_id = intval($matches[1]);
         $SQL = 'select * from weathermap_data where local_data_id=' . $local_data_id;
         $result = db_fetch_row($SQL);
     }
     wm_debug(sprintf("cacti ReadData: Returning (%s, %s, %s)\n", string_or_null($data[IN]), string_or_null($data[OUT]), $data_time));
     return array($data[IN], $data[OUT], $data_time);
 }
开发者ID:jiangxilong,项目名称:network-weathermap,代码行数:13,代码来源:WeatherMapDataSource_cacti.php


示例15: UpdateCactiData

function UpdateCactiData(&$item, $local_data_id)
{
    $map = $item->owner;
    wm_debug("fetching for {$local_data_id}\n");
    if (isset($map->dsinfocache[$local_data_id])) {
        $to_set = $map->dsinfocache[$local_data_id];
    } else {
        $to_set = array();
        $set_speed = intval($item->get_hint("cacti_use_ifspeed"));
        $r3 = db_fetch_assoc(sprintf("select data_local.host_id, field_name,field_value from data_local,host_snmp_cache  USE INDEX (host_id) where data_local.id=%d and data_local.host_id=host_snmp_cache.host_id and data_local.snmp_index=host_snmp_cache.snmp_index and data_local.snmp_query_id=host_snmp_cache.snmp_query_id", $local_data_id));
        foreach ($r3 as $vv) {
            $vname = "cacti_" . $vv['field_name'];
            $to_set[$vname] = $vv['field_value'];
        }
        if ($set_speed != 0) {
            $ifSpeed = intval($to_set['cacti_ifSpeed']);
            $ifHighSpeed = intval($to_set['cacti_ifHighSpeed']);
            $speed = 0;
            if ($ifSpeed > 0) {
                $speed = $ifSpeed;
            }
            # see https://lists.oetiker.ch/pipermail/mrtg/2004-November/029312.html
            if ($ifHighSpeed > 20) {
                $speed = $ifHighSpeed . "M";
            }
            if ($speed > 0) {
                // might need to dust these off for php4...
                if ($item->my_type() == 'NODE') {
                    $map->nodes[$item->name]->max_bandwidth_in = $speed;
                    $map->nodes[$item->name]->max_bandwidth_out = $speed;
                }
                if ($item->my_type() == 'LINK') {
                    $map->links[$item->name]->max_bandwidth_in = $speed;
                    $map->links[$item->name]->max_bandwidth_out = $speed;
                }
            }
        }
        if (isset($vv['host_id'])) {
            $to_set['cacti_host_id'] = intval($vv['host_id']);
        }
        $r4 = db_fetch_row(sprintf("SELECT DISTINCT graph_templates_item.local_graph_id,title_cache FROM graph_templates_item,graph_templates_graph,data_template_rrd WHERE data_template_rrd.id=task_item_id and graph_templates_graph.local_graph_id = graph_templates_item.local_graph_id and local_data_id=%d LIMIT 1", $local_data_id));
        if (isset($r4['local_graph_id'])) {
            $to_set["cacti_graph_id"] = intval($r4['local_graph_id']);
        }
        $map->dsinfocache[$local_data_id] = $to_set;
    }
    # By now, we have the values, one way or another.
    foreach ($to_set as $k => $v) {
        $item->add_note($k, $v);
    }
}
开发者ID:stapler2025,项目名称:Weathermap-librenms,代码行数:51,代码来源:ds-common.php


示例16: validateAndOpenFile

 /**
  * @param $fullpath
  * @return resource
  */
 protected function validateAndOpenFile($fullpath)
 {
     wm_debug("Opening {$fullpath}\n");
     if (!file_exists($fullpath)) {
         wm_warn("File '{$fullpath}' doesn't exist.");
         return null;
     }
     if (!is_readable($fullpath)) {
         wm_warn("File '{$fullpath}' isn't readable.");
         return null;
     }
     $fileHandle = fopen($fullpath, "r");
     return $fileHandle;
 }
开发者ID:jiangxilong,项目名称:network-weathermap,代码行数:18,代码来源:WeatherMapDataSource_tabfile.php


示例17: ReadData

 function ReadData($targetString, &$map, &$mapItem)
 {
     $data[IN] = null;
     $data[OUT] = null;
     $data_time = 0;
     $matchvalue = $mapItem->get_hint('mrtg_value');
     $matchperiod = $mapItem->get_hint('mrtg_period');
     $swap = intval($mapItem->get_hint('mrtg_swap'));
     $negate = intval($mapItem->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);
             wm_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
         wm_debug("MRTG ReadData: Couldn't open ({$targetString}). \n");
     }
     if ($swap == 1) {
         wm_debug("MRTG ReadData: Swapping IN and OUT\n");
         $t = $data[OUT];
         $data[OUT] = $data[IN];
         $data[IN] = $t;
     }
     if ($negate) {
         wm_debug("MRTG ReadData: Negating values\n");
         $data[OUT] = -$data[OUT];
         $data[IN] = -$data[IN];
     }
     wm_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);
 }
开发者ID:jiangxilong,项目名称:network-weathermap,代码行数:50,代码来源:WeatherMapDataSource_mrtg.php


示例18: UpdateCactiData

function UpdateCactiData(&$item, $local_data_id)
{
    $map = $item->owner;
    wm_debug("fetching for {$local_data_id}\n");
    if (isset($map->dsinfocache[$local_data_id])) {
        $to_set = $map->dsinfocache[$local_data_id];
    } else {
        $to_set = array();
        $set_speed = intval($item->get_hint("cacti_use_ifspeed"));
        $r3 = db_fetch_assoc(sprintf("select data_local.host_id, field_name,field_value\n                     from data_local,host_snmp_cache  USE INDEX (host_id)\n                     where data_local.id=%d\n                       and data_local.host_id=host_snmp_cache.host_id\n                       and data_local.snmp_index=host_snmp_cache.snmp_index\n                       and data_local.snmp_query_id=host_snmp_cache.snmp_query_id", $local_data_id));
        foreach ($r3 as $vv) {
            $vname = "cacti_" . $vv['field_name'];
            $to_set[$vname] = $vv['field_value'];
        }
        if ($set_speed != 0) {
            $ifSpeed = intval($to_set['cacti_ifSpeed']);
            $ifHighSpeed = intval($to_set['cacti_ifHighSpeed']);
            $speed = 0;
            if ($ifSpeed > 0) {
                $speed = $ifSpeed;
            }
            # see https://lists.oetiker.ch/pipermail/mrtg/2004-November/029312.html
            if ($ifHighSpeed > 20) {
                // NOTE: this is NOT using $kilo - it's always 1000000 bits/sec according to the MIB
                $speed = $ifHighSpeed * 1000000;
            }
            if ($speed > 0) {
                $item->max_bandwidth_in = $speed;
                $item->max_bandwidth_out = $speed;
            }
        }
        if (isset($vv['host_id'])) {
            $to_set['cacti_host_id'] = intval($vv['host_id']);
        }
        $r4 = db_fetch_row(sprintf("SELECT DISTINCT graph_templates_item.local_graph_id,title_cache\n                      FROM graph_templates_item,graph_templates_graph,data_template_rrd\n                      WHERE data_template_rrd.id=task_item_id\n                        and graph_templates_graph.local_graph_id = graph_templates_item.local_graph_id\n                        and local_data_id=%d\n                      LIMIT 1", $local_data_id));
        if (isset($r4['local_graph_id'])) {
            $to_set["cacti_graph_id"] = intval($r4['local_graph_id']);
        }
        $map->dsinfocache[$local_data_id] = $to_set;
    }
    # By now, we have the values, one way or another.
    foreach ($to_set as $k => $v) {
        $item->add_note($k, $v);
    }
}
开发者ID:jiangxilong,项目名称:network-weathermap,代码行数:45,代码来源:ds-common.php


示例19: ReadData

 function ReadData($targetString, &$map, &$mapItem)
 {
     $inbw = null;
     $outbw = null;
     $data_time = 0;
     if (preg_match($this->regexpsHandled[0], $targetString, $matches)) {
         $inbw = WMUtility::interpretNumberWithMetricPrefix($matches[1], $map->kilo);
         $outbw = WMUtility::interpretNumberWithMetricPrefix($matches[2], $map->kilo);
         $data_time = time();
     }
     if (preg_match($this->regexpsHandled[1], $targetString, $matches)) {
         $inbw = WMUtility::interpretNumberWithMetricPrefix($matches[1], $map->kilo);
         $outbw = $inbw;
         $data_time = time();
     }
     wm_debug("Static ReadData: Returning ({$inbw}, {$outbw}, {$data_time})\n");
     return array($inbw, $outbw, $data_time);
 }
开发者ID:jiangxilong,项目名称:network-weathermap,代码行数:18,代码来源:WeatherMapDataSource_static.php


示例20: ReadData

 function ReadData($targetstring, &$map, &$item)
 {
     $inbw = NULL;
     $outbw = NULL;
     $data_time = 0;
     if (preg_match("/^static:(\\-?\\d+\\.?\\d*[KMGT]*):(\\-?\\d+\\.?\\d*[KMGT]*)\$/", $targetstring, $matches)) {
         $inbw = unformat_number($matches[1], $map->kilo);
         $outbw = unformat_number($matches[2], $map->kilo);
         $data_time = time();
     }
     if (preg_match("/^static:(\\-?\\d+\\.?\\d*[KMGT]*)\$/", $targetstring, $matches)) {
         $inbw = unformat_number($matches[1], $map->kilo);
         $outbw = $inbw;
         $data_time = time();
     }
     wm_debug("Static ReadData: Returning ({$inbw},{$outbw},{$data_time})\n");
     return array($inbw, $outbw, $data_time);
 }
开发者ID:stapler2025,项目名称:Weathermap-librenms,代码行数:18,代码来源:WeatherMapDataSource_static.php



注:本文中的wm_debug函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wm_option函数代码示例发布时间:2022-05-23
下一篇:
PHP wlog函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap