当前位置: 首页>>代码示例>>PHP>>正文


PHP influx_update函数代码示例

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


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


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