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

PHP influx_update函数代码示例

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

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



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

示例1: data_update

/**
 * Datastore-independent function which should be used for all polled metrics.
 *
 * RRD Tags:
 *   rrd_def     array|string: (required) an array of rrd field definitions example: "DS:dataName:COUNTER:600:U:100000000000"
 *   rrd_name    array|string: the rrd filename, will be processed with rrd_name()
 *   rrd_oldname array|string: old rrd filename to rename, will be processed with rrd_name()
 *   rrd_step             int: rrd step, defaults to 300
 *
 * @param array $device
 * @param string $measurement Name of this measurement
 * @param array $tags tags for the data (or to control rrdtool)
 * @param array $fields
 */
function data_update($device, $measurement, $tags, $fields)
{
    // convenience conversion to allow calling with a single value, so, e.g., these are equivalent:
    // data_update($device, 'mymeasurement', $tags, 1234);
    //     AND
    // data_update($device, 'mymeasurement', $tags, array('mymeasurement' => 1234));
    if (!is_array($fields)) {
        $fields = array($measurement => $fields);
    }
    // rrdtool_data_update() will only use the tags it deems relevant, so we pass all of them.
    // However, influxdb saves all tags, so we filter out the ones beginning with 'rrd_'.
    rrdtool_data_update($device, $measurement, $tags, $fields);
    influx_update($device, $measurement, rrd_array_filter($tags), $fields);
}
开发者ID:szatam,项目名称:librenms,代码行数:28,代码来源:datastore.inc.php


示例2: array

            $entPhysical_state[$index][$subindex][$group][$key] = $value;
        }
        $fields = array('inutil' => $entry['cc6kxbarStatisticsInUtil'], 'oututil' => $entry['cc6kxbarStatisticsOutUtil'], 'outdropped' => $entry['cc6kxbarStatisticsOutDropped'], 'outerrors' => $entry['cc6kxbarStatisticsOutErrors'], 'inerrors' => $entry['cc6kxbarStatisticsInErrors']);
        $rrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('c6kxbar-' . $index . '-' . $subindex . '.rrd');
        d_echo("{$rrd} ");
        if (!is_file($rrd)) {
            rrdtool_create($rrd, '--step 300 
     DS:inutil:GAUGE:600:0:100 
     DS:oututil:GAUGE:600:0:100 
     DS:outdropped:DERIVE:600:0:125000000000 
     DS:outerrors:DERIVE:600:0:125000000000 
     DS:inerrors:DERIVE:600:0:125000000000 ' . $config['rrd_rra']);
        }
        rrdtool_update($rrd, $fields);
        $tags = array('index' => $index, 'subindex' => $subindex);
        influx_update($device, 'c6kxbar', $tags, $fields);
    }
    //end foreach
    // print_r($entPhysical_state);
}
//end if
// Set Entity state
foreach (dbFetch('SELECT * FROM `entPhysical_state` WHERE `device_id` = ?', array($device['device_id'])) as $entity) {
    if (!isset($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']])) {
        dbDelete('entPhysical_state', '`device_id` = ? AND `entPhysicalIndex` = ? AND `subindex` = ? AND `group` = ? AND `key` = ?', array($device['device_id'], $entity['entPhysicalIndex'], $entity['subindex'], $entity['group'], $entity['key']));
    } else {
        if ($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']] != $entity['value']) {
            echo 'no match!';
        }
        unset($entPhysical_state[$entity['entPhysicalIndex']][$entity['subindex']][$entity['group']][$entity['key']]);
    }
开发者ID:pblasquez,项目名称:librenms,代码行数:31,代码来源:entity-physical.inc.php


示例3: dbUpdate

                     $cef_stat['cefSwitchingPunt2Host'] = $cef_stat['cefSwitchingHCPunt2Host'];
                 }
                 // FIXME -- memcached
                 $cef_stat['update']['drop'] = $cef_stat['cefSwitchingDrop'];
                 $cef_stat['update']['punt'] = $cef_stat['cefSwitchingPunt'];
                 $cef_stat['update']['punt2host'] = $cef_stat['cefSwitchingPunt2Host'];
                 $cef_stat['update']['drop_prev'] = $cef_entry['drop'];
                 $cef_stat['update']['punt_prev'] = $cef_entry['punt'];
                 $cef_stat['update']['punt2host_prev'] = $cef_entry['punt2host'];
                 $cef_stat['update']['updated'] = $polled;
                 $cef_stat['update']['updated_prev'] = $cef_entry['updated'];
                 dbUpdate($cef_stat['update'], 'cef_switching', '`device_id` = ? AND `entPhysicalIndex` = ? AND `afi` = ? AND `cef_index` = ?', array($device['device_id'], $entity, $afi, $path));
                 $fields = array('drop' => $cef_stat['cefSwitchingDrop'], 'punt' => $cef_stat['cefSwitchingPunt'], 'hostpunt' => $cef_stat['cefSwitchingPunt2Host']);
                 $ret = rrdtool_update("{$filename}", $fields);
                 $tags = array('entity' => $entity, 'afi' => $afi, 'index' => $path);
                 influx_update($device, 'cefswitching', $tags, $fields);
                 echo "\n";
             }
             //end foreach
         }
         //end foreach
     }
     //end foreach
 }
 //end if
 // FIXME - need to delete old ones. FIXME REALLY.
 print_r($cefs_db);
 foreach ($cefs_db as $cef_switching_id) {
     dbDelete('cef_switching', '`cef_switching_id` =  ?', array($cef_switching_id));
     echo '-';
 }
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:cisco-cef.inc.php


示例4: poll_mib_def

function poll_mib_def($device, $mib_name_table, $mib_subdir, $mib_oids, $mib_graphs, &$graphs)
{
    global $config;
    echo "This is poll_mib_def Processing\n";
    $mib = null;
    if (stristr($mib_name_table, 'UBNT')) {
        list($mib, ) = explode(':', $mib_name_table, 2);
        // $mib_dirs = mib_dirs($mib_subdir);
        $rrd_file = strtolower(safename($mib)) . '.rrd';
        $influx_name = strtolower(safename($mib));
    } else {
        list($mib, $file) = explode(':', $mib_name_table, 2);
        $rrd_file = strtolower(safename($file)) . '.rrd';
        $influx_name = strtolower(safename($file));
    }
    $rrdcreate = '--step 300 ';
    $oidglist = array();
    $oidnamelist = array();
    foreach ($mib_oids as $oid => $param) {
        $oidindex = $param[0];
        $oiddsname = $param[1];
        $oiddsdesc = $param[2];
        $oiddstype = $param[3];
        $oiddsopts = $param[4];
        if (strlen($oiddsname) > 19) {
            $oiddsname = truncate($oiddsname, 19, '');
        }
        if (empty($oiddsopts)) {
            $oiddsopts = '600:U:100000000000';
        }
        $rrdcreate .= ' DS:' . $oiddsname . ':' . $oiddstype . ':' . $oiddsopts;
        if ($oidindex != '') {
            $fulloid = $oid . '.' . $oidindex;
        } else {
            $fulloid = $oid;
        }
        // Add to oid GET list
        $oidglist[] = $fulloid;
        $oidnamelist[] = $oiddsname;
    }
    //end foreach
    // Implde for LibreNMS Version
    $oidilist = implode(' ', $oidglist);
    $snmpdata = snmp_get_multi($device, $oidilist, '-OQUs', $mib);
    if (isset($GLOBALS['exec_status']['exitcode']) && $GLOBALS['exec_status']['exitcode'] !== 0) {
        print_debug('  ERROR, bad snmp response');
        return false;
    }
    $oid_count = 0;
    $fields = array();
    foreach ($oidglist as $fulloid) {
        list($splitoid, $splitindex) = explode('.', $fulloid, 2);
        $val = $snmpdata[$splitindex][$splitoid];
        if (is_numeric($val)) {
            $fields[$oidnamelist[$oid_count]] = $val;
        } elseif (preg_match("/^\"(.*)\"\$/", $val, $number) && is_numeric($number[1])) {
            $fields[$oidnamelist[$oid_count]] = $number[1];
        } else {
            $fields[$oidnamelist[$oid_count]] = 'U';
        }
        $oid_count++;
    }
    $rrdfilename = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . $rrd_file;
    if (!is_file($rrdfilename)) {
        rrdtool_create($rrdfilename, $rrdcreate . ' ' . $config['rrd_rra']);
    }
    rrdtool_update($rrdfilename, $fields);
    $tags = array();
    influx_update($device, $influx_name, $tags, $fields);
    foreach ($mib_graphs as $graphtoenable) {
        $graphs[$graphtoenable] = true;
    }
    return true;
}
开发者ID:vpsman,项目名称:librenms,代码行数:74,代码来源:functions.inc.php


示例5: unset

        if (isset($stats['ipSystemStatsHCOutForwDatagrams'])) {
            $stats['ipSystemStatsOutForwDatagrams'] = $stats['ipSystemStatsHCOutForwDatagrams'];
        }
        unset($snmpstring, $files, $snmpdata, $snmpdata_cmd, $rrd_create);
        $rrdfile = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('ipSystemStats-' . $af . '.rrd');
        $rrd_create = $config['rrd_rra'];
        $fields = array();
        foreach ($oids as $oid) {
            $oid_ds = str_replace('ipSystemStats', '', $oid);
            $oid_ds = truncate($oid_ds, 19, '');
            $rrd_create .= " DS:{$oid_ds}:COUNTER:600:U:100000000000";
            if (strstr($stats[$oid], 'No') || strstr($stats[$oid], 'd') || strstr($stats[$oid], 's')) {
                $stats[$oid] = '0';
            }
            $fields[$oid] = $stats[$oid];
        }
        if (!file_exists($rrdfile)) {
            rrdtool_create($rrdfile, $rrd_create);
        }
        rrdtool_update($rrdfile, $fields);
        $tags = array('af' => $af);
        influx_update($device, 'ipSystemStats', $tags, $fields);
        unset($fields, $rrd_create);
        // FIXME per-AF?
        $graphs['ipsystemstats_' . $af] = true;
        $graphs['ipsystemstats_' . $af . '_frag'] = true;
    }
    //end foreach
}
//end if
echo "\n";
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:ipSystemStats.inc.php


示例6: str_pad

            echo str_pad($vsvr['vsvrName'], 25) . ' | ' . str_pad($vsvr['vsvrType'], 5) . ' | ' . str_pad($vsvr['vsvrState'], 6) . ' | ' . str_pad($vsvr['vsvrIpAddress'], 16) . ' | ' . str_pad($vsvr['vsvrPort'], 5);
            echo ' | ' . str_pad($vsvr['vsvrRequestRate'], 8) . ' | ' . str_pad($vsvr['vsvrRxBytesRate'] . 'B/s', 8) . ' | ' . str_pad($vsvr['vsvrTxBytesRate'] . 'B/s', 8);
            $db_update = array('vsvr_ip' => $vsvr['vsvrIpAddress'], 'vsvr_port' => $vsvr['vsvrPort'], 'vsvr_state' => $vsvr['vsvrState'], 'vsvr_type' => $vsvr['vsvrType'], 'vsvr_req_rate' => $vsvr['RequestRate'], 'vsvr_bps_in' => $vsvr['vsvrRxBytesRate'], 'vsvr_bps_out' => $vsvr['vsvrTxBytesRate']);
            if (!is_array($vsvrs[$vsvr['vsvrName']])) {
                $db_insert = array_merge(array('device_id' => $device['device_id'], 'vsvr_name' => $vsvr['vsvrName']), $db_update);
                $vsvr_id = dbInsert($db_insert, 'netscaler_vservers');
                echo ' +';
            } else {
                $updated = dbUpdate($db_update, 'netscaler_vservers', '`vsvr_id` = ?', array($vsvrs[$vsvr['vsvrName']]['vsvr_id']));
                echo ' U';
            }
            if (!file_exists($rrd_file)) {
                rrdtool_create($rrd_file, $rrd_create);
            }
            rrdtool_update($rrd_file, $fields);
            $tags = array('vsvrName' => $vsvr['vsvrName']);
            influx_update($device, 'netscaler-vsvr', $tags, $fields);
            echo "\n";
        }
        //end if
    }
    //end foreach
    d_echo($vsvr_exist);
    foreach ($vsvrs as $db_name => $db_id) {
        if (!$vsvr_exist[$db_name]) {
            echo '-' . $db_name;
            dbDelete('netscaler_vservers', '`vsvr_id` =  ?', array($db_id));
        }
    }
}
//end if
开发者ID:pblasquez,项目名称:librenms,代码行数:31,代码来源:netscaler-vsvr.inc.php


示例7: safename

<?php

if ($this_port['dot3StatsIndex'] and $port['ifType'] == 'ethernetCsmacd') {
    // TODO: remove legacy check?
    $old_rrdfile = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('etherlike-' . $port['ifIndex'] . '.rrd');
    $rrd_file = get_port_rrdfile_path($device['hostname'], $port_id, 'dot3');
    $rrd_create = $config['rrd_rra'];
    if (!file_exists($rrdfile)) {
        if (file_exists($old_rrdfile)) {
            rename($old_rrdfile, $rrd_file);
        } else {
            foreach ($etherlike_oids as $oid) {
                $oid = truncate(str_replace('dot3Stats', '', $oid), 19, '');
                $rrd_create .= " DS:{$oid}:COUNTER:600:U:100000000000";
            }
            rrdtool_create($rrdfile, $rrd_create);
        }
    }
    $fields = array();
    foreach ($etherlike_oids as $oid) {
        $data = $this_port[$oid] + 0;
        $fields[$oid] = $data;
    }
    rrdtool_update($rrdfile, $fields);
    $tags = array('ifName' => $port['ifName']);
    influx_update($device, 'dot3', $tags, $fields);
    echo 'EtherLike ';
}
开发者ID:greggcz,项目名称:librenms,代码行数:28,代码来源:port-etherlike.inc.php


示例8: array

    $oids = array('ipCidrRouteNumber');
    unset($snmpstring, $fields, $snmpdata, $snmpdata_cmd, $rrd_create);
    $rrd_file = $config['rrd_dir'] . '/' . $device['hostname'] . '/netstats-ip_forward.rrd';
    $rrd_create = $config['rrd_rra'];
    foreach ($oids as $oid) {
        $oid_ds = truncate($oid, 19, '');
        $rrd_create .= " DS:{$oid_ds}:GAUGE:600:U:1000000";
        // Limit to 1MPPS?
        $snmpstring .= ' IP-FORWARD-MIB::' . $oid . '.0';
    }
    $data = snmp_get_multi($device, $snmpstring, '-OQUs', 'IP-FORWARD-MIB');
    $fields = array();
    foreach ($oids as $oid) {
        if (is_numeric($data[0][$oid])) {
            $value = $data[0][$oid];
        } else {
            $value = 'U';
        }
        $fields[$oid] = $value;
    }
    if (isset($data[0]['ipCidrRouteNumber'])) {
        if (!file_exists($rrd_file)) {
            rrdtool_create($rrd_file, $rrd_create);
        }
        rrdtool_update($rrd_file, $fields);
        $tags = array();
        influx_update($device, 'netstats-ip_forward', $tags, $fields);
        $graphs['netstat_ip_forward'] = true;
    }
}
unset($oids, $data, $data_array, $oid, $protos, $snmpstring);
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:netstats-ip_forward.inc.php


示例9: snmp_gen_auth

// FIXME - This needs a good cleanup...
$cmd = 'snmpget -O qv ' . snmp_gen_auth($device) . ' ' . $device['hostname'] . ':' . $device['port'] . ' 1.3.6.1.2.1.7526.2.4';
$poll_device['sysDescr'] = `{$cmd}`;
$poll_device['sysDescr'] = str_replace('-', ' ', $poll_device['sysDescr']);
$poll_device['sysDescr'] = str_replace('"', '', $poll_device['sysDescr']);
list($hardware, $features, $version) = explode(' ', $poll_device['sysDescr']);
// Get data for calls and network from SNOM specific SNMP OIDs.
$cmda = 'snmpget -O qv ' . snmp_gen_auth($device) . ' ' . $device['hostname'] . ':' . $device['port'] . ' 1.3.6.1.2.1.7526.2.1.1 1.3.6.1.2.1.7526.2.1.2 1.3.6.1.2.1.7526.2.2.1 1.3.6.1.2.1.7526.2.2.2';
$cmdb = 'snmpget -O qv ' . snmp_gen_auth($device) . ' ' . $device['hostname'] . ':' . $device['port'] . ' 1.3.6.1.2.1.7526.2.5 1.3.6.1.2.1.7526.2.6';
// echo($cmda);
$snmpdata = `{$cmda}`;
$snmpdatab = `{$cmdb}`;
list($rxbytes, $rxpkts, $txbytes, $txpkts) = explode("\n", $snmpdata);
list($calls, $registrations) = explode("\n", $snmpdatab);
$txbytes = 0 - $txbytes * 8;
$rxbytes = 0 - $rxbytes * 8;
echo "{$rxbytes}, {$rxpkts}, {$txbytes}, {$txpkts}, {$calls}, {$registrations}";
$rrdfile = $config['rrd_dir'] . '/' . $device['hostname'] . '/data.rrd';
if (!is_file($rrdfile)) {
    rrdtool_create($rrdfile, 'DS:INOCTETS:COUNTER:600:U:100000000000 
        DS:OUTOCTETS:COUNTER:600:U:10000000000 
        DS:INPKTS:COUNTER:600:U:10000000000 
        DS:OUTPKTS:COUNTER:600:U:10000000000 
        DS:CALLS:COUNTER:600:U:10000000000 
        DS:REGISTRATIONS:COUNTER:600:U:10000000000 ' . $config['rrd_rra']);
}
$fields = array('INOCTETS' => $rxbytes, 'OUTOCTETS' => $txbytes, 'INPKTS' => $rxpkts, 'OUTPKTS' => $rxbytes, 'CALLS' => $calls, 'REGISTRATIONS' => $registrations);
rrdtool_update("{$rrdfile}", $fields);
$tags = array();
influx_update($device, 'snom-data', $tags, $fields);
开发者ID:greggcz,项目名称:librenms,代码行数:30,代码来源:snom.inc.php


示例10: intval

    $id = intval($prop_id[1]);
    $sla_table[$id][$property] = trim($value);
}
// Update timestamps
foreach ($sla_table as &$sla) {
    $sla['UnixTime'] = intval($sla['Time'] / 100 + $time_offset);
    $sla['TimeStr'] = strftime('%Y-%m-%d %H:%M:%S', $sla['UnixTime']);
}
unset($sla);
foreach (dbFetchRows('SELECT * FROM `slas` WHERE `device_id` = ? AND `deleted` = 0 AND `status` = 1', array($device['device_id'])) as $sla) {
    echo 'SLA ' . $sla['sla_nr'] . ': ' . $sla['rtt_type'] . ' ' . $sla['owner'] . ' ' . $sla['tag'] . '... ';
    $slarrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('sla-' . $sla['sla_nr'] . '.rrd');
    if (!is_file($slarrd)) {
        rrdtool_create($slarrd, '--step 300 
     DS:rtt:GAUGE:600:0:300000 ' . $config['rrd_rra']);
    }
    if (isset($sla_table[$sla['sla_nr']])) {
        $slaval = $sla_table[$sla['sla_nr']];
        echo $slaval['CompletionTime'] . 'ms at ' . $slaval['TimeStr'];
        $val = $slaval['CompletionTime'];
    } else {
        echo 'NaN';
        $val = 'U';
    }
    $fields = array('rtt' => $val);
    rrdtool_update($slarrd, $fields);
    $tags = array('sla_nr' => $sla['sla_nr']);
    influx_update($device, 'sla', $tags, $fields);
    echo "\n";
}
//end foreach
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:cisco-sla.inc.php


示例11: snmpwalk_cache_oid

<?php

// CISCO-VPDN-MGMT-MIB::cvpdnTunnelTotal.0 = Gauge32: 0 tunnels
// CISCO-VPDN-MGMT-MIB::cvpdnSessionTotal.0 = Gauge32: 0 users
// CISCO-VPDN-MGMT-MIB::cvpdnDeniedUsersTotal.0 = Counter32: 0 attempts
// CISCO-VPDN-MGMT-MIB::cvpdnSystemTunnelTotal.l2tp = Gauge32: 437 tunnels
// CISCO-VPDN-MGMT-MIB::cvpdnSystemSessionTotal.l2tp = Gauge32: 1029 sessions
// CISCO-VPDN-MGMT-MIB::cvpdnSystemDeniedUsersTotal.l2tp = Counter32: 0 attempts
// CISCO-VPDN-MGMT-MIB::cvpdnSystemClearSessions.0 = INTEGER: none(1)
if ($device['os_group'] == 'cisco') {
    $data = snmpwalk_cache_oid($device, 'cvpdnSystemEntry', null, 'CISCO-VPDN-MGMT-MIB');
    foreach ($data as $type => $vpdn) {
        $rrd_filename = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('vpdn-' . $type . '.rrd');
        if (is_file($rrd_filename) || $vpdn['cvpdnSystemTunnelTotal'] || $vpdn['cvpdnSystemSessionTotal']) {
            if (!file_exists($rrd_filename)) {
                rrdtool_create($rrd_filename, ' DS:tunnels:GAUGE:600:0:U DS:sessions:GAUGE:600:0:U DS:denied:COUNTER:600:0:100000' . $config['rrd_rra']);
            }
            $fields = array('tunnels' => $vpdn['cvpdnSystemTunnelTotal'], 'sessions' => $vpdn['cvpdnSystemSessionTotal'], 'denied' => $vpdn['cvpdnSystemDeniedUsersTotal']);
            rrdtool_update($rrd_filename, $fields);
            $tags = array('type' => $type);
            influx_update($device, 'vpdn', $tags, $fields);
            $graphs['vpdn_sessions_' . $type] = true;
            $graphs['vpdn_tunnels_' . $type] = true;
            echo " Cisco VPDN ({$type}) ";
        }
    }
    unset($data, $vpdn, $type, $rrd_filename);
}
//end if
开发者ID:greggcz,项目名称:librenms,代码行数:29,代码来源:cisco-vpdn.inc.php


示例12: substr

    $hardware = substr($hardware, 24);
}
$altversion = trim(snmp_get($device, 'hpSwitchOsVersion.0', '-Oqv', 'NETSWITCH-MIB'), '"');
if ($altversion) {
    $version = $altversion;
}
$altversion = trim(snmp_get($device, '.1.3.6.1.4.1.11.2.3.7.11.12.1.2.1.11.0', '-Oqv'), '"');
if ($altversion) {
    $version = $altversion;
}
if (preg_match('/^PROCURVE (.*) - (.*)/', $poll_device['sysDescr'], $regexp_result)) {
    $hardware = 'ProCurve ' . $regexp_result[1];
    $version = $regexp_result[2];
}
$serial = snmp_get($device, '.1.3.6.1.4.1.11.2.36.1.1.2.9.0', '-Oqv', 'SEMI-MIB');
$serial = trim(str_replace('"', '', $serial));
// FIXME maybe genericise? or do away with it if we ever walk the full dot1qTpFdbTable as we can count ourselves then ;)
$fdb_rrd_file = $config['rrd_dir'] . '/' . $device['hostname'] . '/fdb_count.rrd';
$FdbAddressCount = snmp_get($device, 'hpSwitchFdbAddressCount.0', '-Ovqn', 'STATISTICS-MIB');
if (is_numeric($FdbAddressCount)) {
    if (!is_file($fdb_rrd_file)) {
        rrdtool_create($fdb_rrd_file, ' --step 300 
                    DS:value:GAUGE:600:-1:100000 ' . $config['rrd_rra']);
    }
    $fields = array('value' => $FdbAddressCount);
    rrdtool_update($fdb_rrd_file, $fields);
    $tags = array();
    influx_update($device, 'fdb_count', $tags, $fields);
    $graphs['fdb_count'] = true;
    echo 'FDB Count ';
}
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:procurve.inc.php


示例13: snmp_get

    $hardware = $rewrite_fortinet_hardware[$poll_device['sysObjectID']];
}
if (empty($hardware)) {
    $hardware = snmp_get($device, 'ENTITY-MIB::entPhysicalModelName.1', '-Ovq');
}
$sessrrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/fortigate_sessions.rrd';
$sessions = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysSesCount.0', '-Ovq');
if (is_numeric($sessions)) {
    if (!is_file($sessrrd)) {
        rrdtool_create($sessrrd, ' --step 300 DS:sessions:GAUGE:600:0:3000000 ' . $config['rrd_rra']);
    }
    print "Sessions: {$sessions}\n";
    $fields = array('sessions' => $sessions);
    rrdtool_update($sessrrd, $fields);
    $tags = array();
    influx_update($device, 'fortigate_sessions', $tags, $fields);
    $graphs['fortigate_sessions'] = true;
}
$cpurrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/fortigate_cpu.rrd';
$cpu_usage = snmp_get($device, 'FORTINET-FORTIGATE-MIB::fgSysCpuUsage.0', '-Ovq');
if (is_numeric($cpu_usage)) {
    if (!is_file($cpurrd)) {
        rrdtool_create($cpurrd, ' --step 300 DS:LOAD:GAUGE:600:-1:100 ' . $config['rrd_rra']);
    }
    echo "CPU: {$cpu_usage}%\n";
    $fields = array('LOAD' => $cpu_usage);
    rrdtool_update($cpurrd, $fields);
    $tags = array();
    influx_update($device, 'fortigate_cpu', $tags, $fields);
    $graphs['fortigate_cpu'] = true;
}
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:fortigate.inc.php


示例14: foreach

        $tunnel['cipSecTunInDecompOctets'] = $tunnel['cipSecTunHcInDecompOctets'];
        $tunnel['cipSecTunOutOctets'] = $tunnel['cipSecTunHcOutOctets'];
        $tunnel['cipSecTunOutUncompOctets'] = $tunnel['cipSecTunHcOutUncompOctets'];
    }
    $rrd_file = $config['rrd_dir'] . '/' . $device['hostname'] . '/ipsectunnel-' . $address . '.rrd';
    $rrd_create = $config['rrd_rra'];
    foreach ($oids as $oid) {
        $oid_ds = truncate(str_replace('cipSec', '', $oid), 19, '');
        $rrd_create .= " DS:{$oid_ds}:COUNTER:600:U:1000000000";
    }
    $fields = array();
    foreach ($oids as $oid) {
        if (is_numeric($tunnel[$oid])) {
            $value = $tunnel[$oid];
        } else {
            $value = '0';
        }
        $fields[$oid] = $value;
    }
    if (isset($tunnel['cikeTunRemoteValue'])) {
        if (!file_exists($rrd_file)) {
            rrdtool_create($rrd_file, $rrd_create);
        }
        rrdtool_update($rrd_file, $fields);
        $tags = array('address' => $address);
        influx_update($device, 'ipsectunnel', $tags, $fields);
        // $graphs['ipsec_tunnels'] = TRUE;
    }
}
//end foreach
unset($rrd_file, $rrd_create, $fields, $oids, $data, $data_array, $oid, $tunnel);
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:cipsec-tunnels.inc.php


示例15: snmp_get_multi

// HOST-RESOURCES-MIB
// Generic System Statistics
$oid_list = 'hrSystemProcesses.0 hrSystemNumUsers.0';
$hrSystem = snmp_get_multi($device, $oid_list, '-OUQs', 'HOST-RESOURCES-MIB');
if (is_numeric($hrSystem[0]['hrSystemProcesses'])) {
    $rrd_file = $config['rrd_dir'] . '/' . $device['hostname'] . '/hr_processes.rrd';
    if (!is_file($rrd_file)) {
        rrdtool_create($rrd_file, '--step 300 
            DS:procs:GAUGE:600:0:U ' . $config['rrd_rra']);
    }
    $fields = array('procs' => $hrSystem[0]['hrSystemProcesses']);
    rrdtool_update($rrd_file, $fields);
    $tags = array();
    influx_update($device, 'hr_processes', $tags, $fields);
    $graphs['hr_processes'] = true;
    echo ' Processes';
}
if (is_numeric($hrSystem[0]['hrSystemNumUsers'])) {
    $rrd_file = $config['rrd_dir'] . '/' . $device['hostname'] . '/hr_users.rrd';
    if (!is_file($rrd_file)) {
        rrdtool_create($rrd_file, '--step 300 
            DS:users:GAUGE:600:0:U ' . $config['rrd_rra']);
    }
    $fields = array('users' => $hrSystem[0]['hrSystemNumUsers']);
    rrdtool_update($rrd_file, $fields);
    $tags = array();
    influx_update($device, 'hr_users', $tags, $fields);
    $graphs['hr_users'] = true;
    echo ' Users';
}
echo "\n";
开发者ID:pblasquez,项目名称:librenms,代码行数:31,代码来源:hr-mib.inc.php


示例16: array

<?php

$storage_cache = array();
foreach (dbFetchRows('SELECT * FROM storage WHERE device_id = ?', array($device['device_id'])) as $storage) {
    echo 'Storage ' . $storage['storage_descr'] . ': ';
    $storage_rrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename('storage-' . $storage['storage_mib'] . '-' . safename($storage['storage_descr']) . '.rrd');
    if (!is_file($storage_rrd)) {
        rrdtool_create($storage_rrd, '--step 300 DS:used:GAUGE:600:0:U DS:free:GAUGE:600:0:U ' . $config['rrd_rra']);
    }
    $file = $config['install_dir'] . '/includes/polling/storage/' . $storage['storage_mib'] . '.inc.php';
    if (is_file($file)) {
        include $file;
    } else {
        // FIXME Generic poller goes here if we ever have a discovery module which uses it.
    }
    d_echo($storage);
    if ($storage['size']) {
        $percent = round($storage['used'] / $storage['size'] * 100);
    } else {
        $percent = 0;
    }
    echo $percent . '% ';
    $fields = array('used' => $storage['used'], 'free' => $storage['free']);
    rrdtool_update($storage_rrd, $fields);
    $tags = array('mib' => $storage['storage_mib'], 'descr' => $storage['storage_descr']);
    influx_update($device, 'storage', $tags, $fields);
    $update = dbUpdate(array('storage_used' => $storage['used'], 'storage_free' => $storage['free'], 'storage_size' => $storage['size'], 'storage_units' => $storage['units'], 'storage_perc' => $percent), 'storage', '`storage_id` = ?', array($storage['storage_id']));
    echo "\n";
}
//end foreach
unset($storage);
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:storage.inc.php


示例17: array

    echo ' TCP';
    $oids = array('tcpActiveOpens', 'tcpPassiveOpens', 'tcpAttemptFails', 'tcpEstabResets', 'tcpCurrEstab', 'tcpInSegs', 'tcpOutSegs', 'tcpRetransSegs', 'tcpInErrs', 'tcpOutRsts');
    // $oids['tcp_collect'] = $oids['tcp'];
    // $oids['tcp_collect'][] = 'tcpHCInSegs';
    // $oids['tcp_collect'][] = 'tcpHCOutSegs';
    unset($snmpstring, $fields, $snmpdata, $snmpdata_cmd, $rrd_create);
    $rrd_file = $config['rrd_dir'] . '/' . $device['hostname'] . '/netstats-tcp.rrd';
    $rrd_create = $config['rrd_rra'];
    foreach ($oids as $oid) {
        $oid_ds = truncate($oid, 19, '');
        $rrd_create .= " DS:{$oid_ds}:COUNTER:600:U:10000000";
        // Limit to 10MPPS
        $snmpstring .= ' TCP-MIB::' . $oid . '.0';
    }
    $snmpstring .= ' tcpHCInSegs.0';
    $snmpstring .= ' tcpHCOutSegs.0';
    $data = snmp_get_multi($device, $snmpstring, '-OQUs', 'TCP-MIB');
    $fields = $data[0];
    unset($snmpstring);
    if (isset($data[0]['tcpInSegs']) && isset($data[0]['tcpOutSegs'])) {
        if (!file_exists($rrd_file)) {
            rrdtool_create($rrd_file, $rrd_create);
        }
        rrdtool_update($rrd_file, $fields);
        $tags = array();
        influx_update($device, 'netstats-tcp', $tags, $fields);
        $graphs['netstat_tcp'] = true;
    }
    unset($oids, $data, $data_array, $oid, $protos);
}
//end if
开发者ID:wiad,项目名称:librenms,代码行数:31,代码来源:netstats-tcp.inc.php


示例18: safename

 if (is_numeric($channel)) {
     $rrd_file = $config['rrd_dir'] . '/' . $device['hostname'] . '/' . safename("arubaap-{$name}.{$radionum}.rrd");
     if (!is_file($rrd_file)) {
         $dslist = 'DS:channel:GAUGE:600:0:200 ';
         $dslist .= 'DS:txpow:GAUGE:600:0:200 ';
         $dslist .= 'DS:radioutil:GAUGE:600:0:100 ';
         $dslist .= 'DS:nummonclients:GAUGE:600:0:500 ';
         $dslist .= 'DS:nummonbssid:GAUGE:600:0:200 ';
         $dslist .= 'DS:numasoclients:GAUGE:600:0:500 ';
         $dslist .= 'DS:interference:GAUGE:600:0:2000 ';
         rrdtool_create($rrd_file, "--step 300 {$dslist} " . $config['rrd_rra']);
     }
     $fields = array('channel' => $channel, 'txpow' => $txpow, 'radioutil' => $radioutil, 'nummonclients' => $nummonclients, 'nummonbssid' => $nummonbssid, 'numasoclients' => $numasoclients, 'interference' => $interference);
     rrdtool_update($rrd_file, $fields);
     $tags = array('name' => $name, 'radionum' => $radionum);
     influx_update($device, 'aruba', $tags, $fields);
 }
 // generate the mac address
 $macparts = explode('.', $radioid, -1);
 $mac = '';
 foreach ($macparts as $part) {
     $mac .= sprintf('%02x', $part) . ':';
 }
 $mac = rtrim($mac, ':');
 $foundid = 0;
 for ($z = 0; $z < sizeof($ap_db); $z++) {
     if ($ap_db[$z]['name'] == $name && $ap_db[$z]['radio_number'] == $radionum) {
         $foundid = $ap_db[$z]['accesspoint_id'];
         $ap_db[$z]['seen'] = 1;
         continue;
     }
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:aruba-controller.inc.php


示例19: array

 $rrd_def = array('DS:INOCTETS:DERIVE:600:0:12500000000', 'DS:OUTOCTETS:DERIVE:600:0:12500000000', 'DS:INERRORS:DERIVE:600:0:12500000000', 'DS:OUTERRORS:DERIVE:600:0:12500000000', 'DS:INUCASTPKTS:DERIVE:600:0:12500000000', 'DS:OUTUCASTPKTS:DERIVE:600:0:12500000000', 'DS:INNUCASTPKTS:DERIVE:600:0:12500000000', 'DS:OUTNUCASTPKTS:DERIVE:600:0:12500000000', 'DS:INDISCARDS:DERIVE:600:0:12500000000', 'DS:OUTDISCARDS:DERIVE:600:0:12500000000', 'DS:INUNKNOWNPROTOS:DERIVE:600:0:12500000000', 'DS:INBROADCASTPKTS:DERIVE:600:0:12500000000', 'DS:OUTBROADCASTPKTS:DERIVE:600:0:12500000000', 'DS:INMULTICASTPKTS:DERIVE:600:0:12500000000', 'DS:OUTMULTICASTPKTS:DERIVE:600:0:12500000000');
 $fields = array('INOCTETS' => $this_port['ifInOctets'], 'OUTOCTETS' => $this_port['ifOutOctets'], 'INERRORS' => $this_port['ifInErrors'], 'OUTERRORS' => $this_port['ifOutErrors'], 'INUCASTPKTS' => $this_port['ifInUcastPkts'], 'OUTUCASTPKTS' => $this_port['ifOutUcastPkts'], 'INNUCASTPKTS' => $this_port['ifInNUcastPkts'], 'OUTNUCASTPKTS' => $this_port['ifOutNUcastPkts'], 'INDISCARDS' => $this_port['ifInDiscards'], 'OUTDISCARDS' => $this_port['ifOutDiscards'], 'INUNKNOWNPROTOS' => $this_port['ifInUnknownProtos'], 'INBROADCASTPKTS' => $this_port['ifInBroadcastPkts'], 'OUTBROADCASTPKTS' => $this_port['ifOutBroadcastPkts'], 'INMULTICASTPKTS' => $this_port['ifInMulticastPkts'], 'OUTMULTICASTPKTS' => $this_port['ifOutMulticastPkts']);
 if ($tune_port === true) {
     rrdtool_tune('port', $rrdfile, $this_port['ifSpeed']);
 }
 $port_descr_type = $port['port_descr_type'];
 $ifName = $port['ifName'];
 $tags = compact('ifName', 'port_descr_type', 'rrd_name', 'rrd_def');
 rrdtool_data_update($device, 'ports', $tags, $fields);
 $fields['ifInUcastPkts_rate'] = $port['ifInUcastPkts_rate'];
 $fields['ifOutUcastPkts_rate'] = $port['ifOutUcastPkts_rate'];
 $fields['ifInErrors_rate'] = $port['ifInErrors_rate'];
 $fields['ifOutErrors_rate'] = $port['ifOutErrors_rate'];
 $fields['ifInOctets_rate'] = $port['ifInOctets_rate'];
 $fields['ifOutOctets_rate'] = $port['ifOutOctets_rate'];
 influx_update($device, 'ports', rrd_array_filter($tags), $fields);
 // End Update IF-MIB
 // Update PAgP
 if ($this_port['pagpOperationMode'] || $port['pagpOperationMode']) {
     foreach ($pagp_oids as $oid) {
         // Loop the OIDs
         if ($this_port[$oid] != $port[$oid]) {
             // If data has changed, build a query
             $port['update'][$oid] = $this_port[$oid];
             echo 'PAgP ';
             log_event("{$oid} -> " . $this_port[$oid], $device, 'interface', $port['port_id']);
         }
     }
 }
 // End Update PAgP
 // Do EtherLike-MIB
开发者ID:Tatermen,项目名称:librenms,代码行数:31,代码来源:ports.inc.php


示例20: trim

<?php

$hardware = trim(snmp_get($device, '1.3.6.1.4.1.25461.2.1.2.2.1.0', '-OQv', '', ''), '" ');
$version = trim(snmp_get($device, '1.3.6.1.4.1.25461.2.1.2.1.1.0', '-OQv', '', ''), '" ');
$serial = trim(snmp_get($device, '1.3.6.1.4.1.25461.2.1.2.1.3.0', '-OQv', '', ''), '" ');
// list(,,,$hardware) = explode (" ", $poll_device['sysDescr']);
$sessrrd = $config['rrd_dir'] . '/' . $device['hostname'] . '/panos-sessions.rrd';
$sessions = snmp_get($device, '1.3.6.1.4.1.25461.2.1.2.3.3.0', '-Ovq');
if (is_numeric($sessions)) {
    if (!is_file($sessrrd)) {
        rrdtool_create($sessrrd, ' --step 300 DS:sessions:GAUGE:600:0:3000000 ' . $config['rrd_rra']);
    }
    $fields = array('sessions' => $sessions);
    rrdtool_update($sessrrd, $fields);
    $tags = array();
    influx_update($device, 'panos-sessions', $tags, $fields);
    $graphs['panos_sessions'] = true;
}
开发者ID:greggcz,项目名称:librenms,代码行数:18,代码来源:panos.inc.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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