This commit is contained in:
laf
2015-07-15 20:46:04 +01:00
1241 changed files with 114210 additions and 73282 deletions
+119 -115
View File
@@ -1,138 +1,142 @@
#!/usr/bin/env php
<?php
include('../includes/console_colour.php');
include('../includes/console_table.php');
include("../includes/defaults.inc.php");
include("../config.php");
include_once("../includes/definitions.inc.php");
include("../includes/functions.php");
include("../html/includes/functions.inc.php");
require '../includes/console_colour.php';
require '../includes/console_table.php';
require '../includes/defaults.inc.php';
require '../config.php';
require_once '../includes/definitions.inc.php';
require '../includes/functions.php';
require '../html/includes/functions.inc.php';
$console_color = new Console_Color2();
$long_opts = array('list::','device-stats');
$options = getopt("l:d:",$long_opts);
$long_opts = array(
'list::',
'device-stats',
);
$options = getopt('l:d:', $long_opts);
$end = 0;
while($end == 0)
{
passthru('clear');
$tbl = new Console_Table(CONSOLE_TABLE_ALIGN_RIGHT);
foreach (dbFetchRows("SELECT * FROM `devices` ORDER BY `hostname`") as $device)
{
if (get_dev_attrib($device,'override_sysLocation_bool'))
{
$device['real_location'] = $device['location'];
$device['location'] = get_dev_attrib($device,'override_sysLocation_string');
while ($end == 0) {
passthru('clear');
$tbl = new Console_Table(CONSOLE_TABLE_ALIGN_RIGHT);
foreach (dbFetchRows('SELECT * FROM `devices` ORDER BY `hostname`') as $device) {
if (get_dev_attrib($device, 'override_sysLocation_bool')) {
$device['real_location'] = $device['location'];
$device['location'] = get_dev_attrib($device, 'override_sysLocation_string');
}
$devices['count']++;
$cache['devices']['hostname'][$device['hostname']] = $device['device_id'];
$cache['devices']['id'][$device['device_id']] = $device;
$cache['device_types'][$device['type']]++;
}
$devices['count']++;
// Include the required SQL queries to get our data
include '../includes/db/status_count.inc.php';
$cache['devices']['hostname'][$device['hostname']] = $device['device_id'];
$cache['devices']['id'][$device['device_id']] = $device;
$tbl->addRow(array('Devices ('.$devices['count'].')', print $console_color->convert('%g'.$devices['up'].' Up%n'), print $console_color->convert('%r'.$devices['down'].' Down%n'), print $console_color->convert('%y'.$devices['ignored'].' Ignored%n'), print $console_color->convert('%p'.$devices['disabled'].' Disabled%n')));
$tbl->addRow(array('Ports ('.$ports['count'].')', print $console_color->convert('%g'.$ports['up'].' Up%n'), print $console_color->convert('%r'.$ports['down'].' Down%n'), print $console_color->convert('%y'.$ports['ignored'].' Ignored%n'), print $console_color->convert('%p'.$ports['shutdown'].' Shutdown%n')));
$tbl->addRow(array('Services ('.$services['count'].')', print $console_color->convert('%g'.$services['up'].' Up%n'), print $console_color->convert('%r'.$services['down'].' Down%n'), print $console_color->convert('%y'.$services['ignored'].' Ignored%n'), print $console_color->convert('%p'.$services['disabled'].' Shutdown%n')));
$cache['device_types'][$device['type']]++;
}
// Include the required SQL queries to get our data
require('../includes/db/status_count.inc.php');
$tbl->addRow(array('Devices ('.$devices['count'].')',print $console_color->convert("%g".$devices['up']." Up%n"),print $console_color->convert("%r".$devices['down']." Down%n"),print $console_color->convert("%y".$devices['ignored']." Ignored%n"),print $console_color->convert("%p".$devices['disabled']." Disabled%n")));
$tbl->addRow(array('Ports ('.$ports['count'].')',print $console_color->convert("%g".$ports['up']." Up%n"),print $console_color->convert("%r".$ports['down']." Down%n"),print $console_color->convert("%y".$ports['ignored']." Ignored%n"),print $console_color->convert("%p".$ports['shutdown']." Shutdown%n")));
$tbl->addRow(array('Services ('.$services['count'].')',print $console_color->convert("%g".$services['up']." Up%n"),print $console_color->convert("%r".$services['down']." Down%n"),print $console_color->convert("%y".$services['ignored']." Ignored%n"),print $console_color->convert("%p".$services['disabled']." Shutdown%n")));
echo $tbl->getTable();
if($options['l'] == 'eventlog')
{
$tbl = new Console_Table();
$tbl->setHeaders(array('Date time','Host','Message','Type','Reference'));
if(is_numeric($options['d']))
{
$sql = "WHERE host='".$options['d']."'";
}
$query = "SELECT *,DATE_FORMAT(datetime, '".$config['dateformat']['mysql']['compact']."') as humandate FROM `eventlog` AS E $sql ORDER BY `datetime` DESC LIMIT 20";
foreach (dbFetchRows($query, $param) as $entry)
{
$tbl->addRow(array($entry['datetime'],gethostbyid($entry['host']),$entry['message'],$entry['type'],$entry['reference']));
}
echo $tbl->getTable();
}
elseif($options['l'] == 'syslog')
{
$tbl = new Console_Table();
$tbl->setHeaders(array('Date time','Host','Program','Message','Level','Facility'));
if(is_numeric($options['d']))
{
$sql = "WHERE device_id='".$options['d']."'";
}
$query = "SELECT *, DATE_FORMAT(timestamp, '".$config['dateformat']['mysql']['compact']."') AS date from syslog AS S $sql_query ORDER BY `timestamp` DESC LIMIT 20";
foreach (dbFetchRows($query, $param) as $entry)
{
$tbl->addRow(array($entry['timestamp'],gethostbyid($entry['device_id']),$entry['program'],$entry['msg'],$entry['level'],$entry['facility']));
}
echo $tbl->getTable();
}
elseif($options['list'] == 'devices')
{
$tbl = new Console_Table();
$tbl->setHeaders(array('Device ID','Device Hostname'));
$query = "SELECT device_id,hostname FROM `devices` ORDER BY hostname";
foreach (dbFetchRows($query, $sql_param) as $device)
{
$tbl->addRow(array($device['device_id'],$device['hostname']));
}
echo $tbl->getTable();
exit;
}
elseif(isset($options['device-stats']))
{
$tbl = new Console_Table();
$tbl->setHeaders(array('Port name','Status','IPv4 Address','Speed In','Speed Out','Packets In','Packets Out','Speed','Duplex','Type','MAC Address','MTU'));
foreach (dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ?", array($options['d'])) as $port)
{
if($port['ifOperStatus'] == 'up')
{
$port['in_rate'] = $port['ifInOctets_rate'] * 8;
$port['out_rate'] = $port['ifOutOctets_rate'] * 8;
$in_perc = @round($port['in_rate']/$port['ifSpeed']*100);
$out_perc = @round($port['in_rate']/$port['ifSpeed']*100);
}
if ($port['ifSpeed']) { $port_speed = humanspeed($port['ifSpeed']); }
if ($port[ifDuplex] != "unknown") { $port_duplex = $port['ifDuplex']; }
if ($port['ifPhysAddress'] && $port['ifPhysAddress'] != "") { $port_mac = formatMac($port['ifPhysAddress']); }
if ($port['ifMtu'] && $port['ifMtu'] != "") { $port_mtu = $port['ifMtu']; }
$tbl->addRow(array($port['ifDescr'],$port['ifOperStatus'],'',formatRates($port['in_rate']),formatRates($port['out_rate']),format_bi($port['ifInUcastPkts_rate']).'pps',format_bi($port['ifOutUcastPkts_rate']).'pps',$port_speed,$port_duplex,'',$port_mac,$port_mtu));
}
echo $tbl->getTable();
}
else
{
echo $options['list'];
echo("Usage of console-ui.php:
if ($options['l'] == 'eventlog') {
$tbl = new Console_Table();
$tbl->setHeaders(array('Date time', 'Host', 'Message', 'Type', 'Reference'));
if (is_numeric($options['d'])) {
$sql = "WHERE host='".$options['d']."'";
}
-l What log type we want to see:
$query = "SELECT *,DATE_FORMAT(datetime, '".$config['dateformat']['mysql']['compact']."') as humandate FROM `eventlog` AS E $sql ORDER BY `datetime` DESC LIMIT 20";
foreach (dbFetchRows($query, $param) as $entry) {
$tbl->addRow(array($entry['datetime'], gethostbyid($entry['host']), $entry['message'], $entry['type'], $entry['reference']));
}
echo $tbl->getTable();
}
else if ($options['l'] == 'syslog') {
$tbl = new Console_Table();
$tbl->setHeaders(array('Date time', 'Host', 'Program', 'Message', 'Level', 'Facility'));
if (is_numeric($options['d'])) {
$sql = "WHERE device_id='".$options['d']."'";
}
$query = "SELECT *, DATE_FORMAT(timestamp, '".$config['dateformat']['mysql']['compact']."') AS date from syslog AS S $sql_query ORDER BY `timestamp` DESC LIMIT 20";
foreach (dbFetchRows($query, $param) as $entry) {
$tbl->addRow(array($entry['timestamp'], gethostbyid($entry['device_id']), $entry['program'], $entry['msg'], $entry['level'], $entry['facility']));
}
echo $tbl->getTable();
}
else if ($options['list'] == 'devices') {
$tbl = new Console_Table();
$tbl->setHeaders(array('Device ID', 'Device Hostname'));
$query = 'SELECT device_id,hostname FROM `devices` ORDER BY hostname';
foreach (dbFetchRows($query, $sql_param) as $device) {
$tbl->addRow(array($device['device_id'], $device['hostname']));
}
echo $tbl->getTable();
exit;
}
else if (isset($options['device-stats'])) {
$tbl = new Console_Table();
$tbl->setHeaders(array('Port name', 'Status', 'IPv4 Address', 'Speed In', 'Speed Out', 'Packets In', 'Packets Out', 'Speed', 'Duplex', 'Type', 'MAC Address', 'MTU'));
foreach (dbFetchRows('SELECT * FROM `ports` WHERE `device_id` = ?', array($options['d'])) as $port) {
if ($port['ifOperStatus'] == 'up') {
$port['in_rate'] = ($port['ifInOctets_rate'] * 8);
$port['out_rate'] = ($port['ifOutOctets_rate'] * 8);
$in_perc = @round(($port['in_rate'] / $port['ifSpeed'] * 100));
$out_perc = @round(($port['in_rate'] / $port['ifSpeed'] * 100));
}
if ($port['ifSpeed']) {
$port_speed = humanspeed($port['ifSpeed']);
}
if ($port[ifDuplex] != 'unknown') {
$port_duplex = $port['ifDuplex'];
}
if ($port['ifPhysAddress'] && $port['ifPhysAddress'] != '') {
$port_mac = formatMac($port['ifPhysAddress']);
}
if ($port['ifMtu'] && $port['ifMtu'] != '') {
$port_mtu = $port['ifMtu'];
}
$tbl->addRow(array($port['ifDescr'], $port['ifOperStatus'], '', formatRates($port['in_rate']), formatRates($port['out_rate']), format_bi($port['ifInUcastPkts_rate']).'pps', format_bi($port['ifOutUcastPkts_rate']).'pps', $port_speed, $port_duplex, '', $port_mac, $port_mtu));
}//end foreach
echo $tbl->getTable();
}
else {
echo $options['list'];
echo "Usage of console-ui.php:
-l What log type we want to see:
eventlog = Event log messages
syslog = Syslog messages
-d Specify the device id to filter results
-d Specify the device id to filter results
--list What to list
--list What to list
devices = list devices and device id's
--device-stats Lists the port statistics for a given device
--device-stats Lists the port statistics for a given device
Examples:
#1 php console-ui.php -l eventlog -d 1
#2 php console-ui.php --list=devices
Examples:
#1 php console-ui.php -l eventlog -d 1
#2 php console-ui.php --list=devices
");
exit;
}
echo(print $console_color->convert("%rLast update at ". date("Y-m-d h:i:s")."%n\n\n"));
sleep(5);
}
?>
";
exit;
}//end if
echo print $console_color->convert('%rLast update at '.date('Y-m-d h:i:s')."%n\n\n");
sleep(5);
}//end while
+117 -115
View File
@@ -1,171 +1,173 @@
<?php
$language_data = array (
$language_data = array(
'LANG_NAME' => 'IOS',
'LANG_NAME' => 'IOS',
'COMMENT_SINGLE' => array(1 => '!'),
'CASE_KEYWORDS' => GESHI_CAPS_LOWER,
'OOLANG' => false,
'NUMBERS' => GESHI_NUMBER_OCT_PREFIX | GESHI_NUMBER_HEX_PREFIX,
'KEYWORDS' => array(
'CASE_KEYWORDS' => GESHI_CAPS_LOWER,
'OOLANG' => false,
'NUMBERS' => GESHI_NUMBER_OCT_PREFIX | GESHI_NUMBER_HEX_PREFIX,
'KEYWORDS' => array(
1 => array(
'no', 'shutdown'
'no',
'shutdown',
),
# 2 => array(
# 'router', 'interface', 'service', 'config-register', 'upgrade', 'version', 'hostname', 'boot-start-marker', 'boot', 'boot-end-marker', 'enable', 'aaa', 'clock', 'ip',
# 'logging', 'access-list', 'route-map', 'snmp-server', 'mpls', 'speed', 'media-type', 'negotiation', 'timestamps', 'prefix-list', 'network', 'mask', 'unsuppress-map',
# 'neighbor', 'remote-as', 'ebgp-multihop', 'update-source', 'description', 'peer-group', 'policy-map', 'class-map', 'class', 'match', 'access-group', 'bandwidth', 'username',
# 'password', 'send-community', 'next-hop-self', 'route-reflector-client', 'ldp', 'discovery', 'advertise-labels', 'label', 'protocol', 'login', 'debug', 'log', 'duplex', 'router-id',
# 'authentication', 'mode', 'maximum-paths', 'address-family', 'set', 'local-preference', 'community', 'trap-source', 'location', 'host', 'tacacs-server', 'session-id',
# 'flow-export', 'destination', 'source', 'in', 'out', 'permit', 'deny', 'control-plane', 'line', 'con' ,'aux', 'vty', 'access-class', 'ntp', 'server', 'end', 'source-interface',
# 'key', 'chain', 'key-string', 'redundancy', 'match-any', 'queue-limit', 'encapsulation', 'pvc', 'vbr-nrt', 'address', 'bundle-enable', 'atm', 'sonet', 'clns', 'route-cache',
# 'default-information', 'redistribute', 'log-adjacency-changes', 'metric', 'spf-interval', 'prc-interval', 'lsp-refresh-interval', 'max-lsp-lifetime', 'set-overload-bit',
# 'on-startup', 'wait-for-bgp', 'system', 'flash', 'timezone', 'subnet-zero', 'cef', 'flow-cache', 'timeout', 'active', 'domain', 'lookup', 'dhcp', 'use', 'vrf', 'hello', 'interval',
# 'priority', 'ilmi-keepalive', 'buffered', 'debugging', 'fpd', 'secret', 'accounting', 'exec', 'group', 'local', 'recurring', 'source-route', 'call', 'rsvp-sync', 'scripting',
# 'mtu', 'passive-interface', 'area' , 'distribute-list', 'metric-style', 'is-type', 'originate', 'activate', 'both', 'auto-summary', 'synchronization', 'aggregate-address', 'le', 'ge',
# 'bgp-community', 'route', 'exit-address-family', 'standard', 'file', 'verify', 'domain-name', 'domain-lookup', 'route-target', 'export', 'import', 'map', 'rd', 'mfib', 'vtp', 'mls',
# 'hardware-switching', 'replication-mode', 'ingress', 'flow', 'error', 'action', 'slb', 'purge', 'share-global', 'routing', 'traffic-eng', 'tunnels', 'propagate-ttl', 'switchport', 'vlan',
# 'portfast', 'counters', 'max', 'age', 'ethernet', 'evc', 'uni', 'count', 'oam', 'lmi', 'gmt', 'netflow', 'pseudowire-class', 'spanning-tree', 'name', 'circuit-type'
# ),
# 3 => array(
# 'isis', 'ospf', 'eigrp', 'rip', 'igrp', 'bgp', 'ipv4', 'unicast', 'multicast', 'ipv6', 'connected', 'static', 'subnets', 'tcl'
# ),
# 4 => array(
# 'point-to-point', 'aal5snap', 'rj45', 'auto', 'full', 'half', 'precedence', 'percent', 'datetime', 'msec', 'locatime', 'summer-time', 'md5', 'wait-for-bgp', 'wide',
# 'level-1', 'level-2', 'log-neighbor-changes', 'directed-request', 'password-encryption', 'common', 'origin-as', 'bgp-nexthop', 'random-detect', 'localtime', 'sso', 'stm-1',
# 'dot1q', 'isl', 'new-model', 'always', 'summary-only', 'freeze', 'global', 'forwarded', 'access', 'trunk', 'edge', 'transparent'
# ),
// 2 => array(
// 'router', 'interface', 'service', 'config-register', 'upgrade', 'version', 'hostname', 'boot-start-marker', 'boot', 'boot-end-marker', 'enable', 'aaa', 'clock', 'ip',
// 'logging', 'access-list', 'route-map', 'snmp-server', 'mpls', 'speed', 'media-type', 'negotiation', 'timestamps', 'prefix-list', 'network', 'mask', 'unsuppress-map',
// 'neighbor', 'remote-as', 'ebgp-multihop', 'update-source', 'description', 'peer-group', 'policy-map', 'class-map', 'class', 'match', 'access-group', 'bandwidth', 'username',
// 'password', 'send-community', 'next-hop-self', 'route-reflector-client', 'ldp', 'discovery', 'advertise-labels', 'label', 'protocol', 'login', 'debug', 'log', 'duplex', 'router-id',
// 'authentication', 'mode', 'maximum-paths', 'address-family', 'set', 'local-preference', 'community', 'trap-source', 'location', 'host', 'tacacs-server', 'session-id',
// 'flow-export', 'destination', 'source', 'in', 'out', 'permit', 'deny', 'control-plane', 'line', 'con' ,'aux', 'vty', 'access-class', 'ntp', 'server', 'end', 'source-interface',
// 'key', 'chain', 'key-string', 'redundancy', 'match-any', 'queue-limit', 'encapsulation', 'pvc', 'vbr-nrt', 'address', 'bundle-enable', 'atm', 'sonet', 'clns', 'route-cache',
// 'default-information', 'redistribute', 'log-adjacency-changes', 'metric', 'spf-interval', 'prc-interval', 'lsp-refresh-interval', 'max-lsp-lifetime', 'set-overload-bit',
// 'on-startup', 'wait-for-bgp', 'system', 'flash', 'timezone', 'subnet-zero', 'cef', 'flow-cache', 'timeout', 'active', 'domain', 'lookup', 'dhcp', 'use', 'vrf', 'hello', 'interval',
// 'priority', 'ilmi-keepalive', 'buffered', 'debugging', 'fpd', 'secret', 'accounting', 'exec', 'group', 'local', 'recurring', 'source-route', 'call', 'rsvp-sync', 'scripting',
// 'mtu', 'passive-interface', 'area' , 'distribute-list', 'metric-style', 'is-type', 'originate', 'activate', 'both', 'auto-summary', 'synchronization', 'aggregate-address', 'le', 'ge',
// 'bgp-community', 'route', 'exit-address-family', 'standard', 'file', 'verify', 'domain-name', 'domain-lookup', 'route-target', 'export', 'import', 'map', 'rd', 'mfib', 'vtp', 'mls',
// 'hardware-switching', 'replication-mode', 'ingress', 'flow', 'error', 'action', 'slb', 'purge', 'share-global', 'routing', 'traffic-eng', 'tunnels', 'propagate-ttl', 'switchport', 'vlan',
// 'portfast', 'counters', 'max', 'age', 'ethernet', 'evc', 'uni', 'count', 'oam', 'lmi', 'gmt', 'netflow', 'pseudowire-class', 'spanning-tree', 'name', 'circuit-type'
// ),
// 3 => array(
// 'isis', 'ospf', 'eigrp', 'rip', 'igrp', 'bgp', 'ipv4', 'unicast', 'multicast', 'ipv6', 'connected', 'static', 'subnets', 'tcl'
// ),
// 4 => array(
// 'point-to-point', 'aal5snap', 'rj45', 'auto', 'full', 'half', 'precedence', 'percent', 'datetime', 'msec', 'locatime', 'summer-time', 'md5', 'wait-for-bgp', 'wide',
// 'level-1', 'level-2', 'log-neighbor-changes', 'directed-request', 'password-encryption', 'common', 'origin-as', 'bgp-nexthop', 'random-detect', 'localtime', 'sso', 'stm-1',
// 'dot1q', 'isl', 'new-model', 'always', 'summary-only', 'freeze', 'global', 'forwarded', 'access', 'trunk', 'edge', 'transparent'
// ),
),
'REGEXPS' => array (
1 => array(
GESHI_SEARCH => '(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})',
'REGEXPS' => array(
1 => array(
GESHI_SEARCH => '(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})',
GESHI_REPLACE => '\\1',
GESHI_BEFORE => '',
GESHI_BEFORE => '',
),
2 => array(
GESHI_SEARCH => '(255\.\d{1,3}\.\d{1,3}\.\d{1,3})',
2 => array(
GESHI_SEARCH => '(255\.\d{1,3}\.\d{1,3}\.\d{1,3})',
GESHI_REPLACE => '\\1',
GESHI_BEFORE => '',
GESHI_BEFORE => '',
),
3 => array(
GESHI_SEARCH => '(source|interface|update-source|router-id) ([A-Za-z0-9\/\:\-\.]+)',
3 => array(
GESHI_SEARCH => '(source|interface|update-source|router-id) ([A-Za-z0-9\/\:\-\.]+)',
GESHI_REPLACE => '\\2',
GESHI_BEFORE => '\\1 ',
GESHI_BEFORE => '\\1 ',
),
4 => array(
GESHI_SEARCH => '(neighbor) ([\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}]+|[a-zA-Z0-9\-\_]+)',
4 => array(
GESHI_SEARCH => '(neighbor) ([\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}]+|[a-zA-Z0-9\-\_]+)',
GESHI_REPLACE => '\\2',
GESHI_BEFORE => '\\1 ',
GESHI_BEFORE => '\\1 ',
),
5 => array(
GESHI_SEARCH => '(distribute-map|access-group|policy-map|class-map\ match-any|ip\ access-list\ extended|match\ community|community-list\ standard|community-list\ expanded|ip\ access-list\ standard|router\ bgp|remote-as|key\ chain|service-policy\ input|service-policy\ output|class|login\ authentication|authentication\ key-chain|username|import\ map|export\ map|domain-name|hostname|route-map|access-class|ip\ vrf\ forwarding|ip\ vrf|vtp\ domain|name|pseudowire-class|pw-class|prefix-list|vrf) ([A-Za-z0-9\-\_\.]+)',
5 => array(
GESHI_SEARCH => '(distribute-map|access-group|policy-map|class-map\ match-any|ip\ access-list\ extended|match\ community|community-list\ standard|community-list\ expanded|ip\ access-list\ standard|router\ bgp|remote-as|key\ chain|service-policy\ input|service-policy\ output|class|login\ authentication|authentication\ key-chain|username|import\ map|export\ map|domain-name|hostname|route-map|access-class|ip\ vrf\ forwarding|ip\ vrf|vtp\ domain|name|pseudowire-class|pw-class|prefix-list|vrf) ([A-Za-z0-9\-\_\.]+)',
GESHI_REPLACE => '\\2',
GESHI_BEFORE => '\\1 ',
GESHI_BEFORE => '\\1 ',
),
6 => array(
GESHI_SEARCH => '(password|key-string|key) ([0-9]) (.+)',
6 => array(
GESHI_SEARCH => '(password|key-string|key) ([0-9]) (.+)',
GESHI_REPLACE => '\\2 \\3',
GESHI_BEFORE => '\\1 ',
GESHI_BEFORE => '\\1 ',
),
7 => array(
GESHI_SEARCH => '(enable) ([a-z]+) ([0-9]) (.+)',
7 => array(
GESHI_SEARCH => '(enable) ([a-z]+) ([0-9]) (.+)',
GESHI_REPLACE => '\\3 \\4',
GESHI_BEFORE => '\\1 \\2 ',
GESHI_BEFORE => '\\1 \\2 ',
),
8 => array(
GESHI_SEARCH => '(description|location|contact|remark) (.+)',
8 => array(
GESHI_SEARCH => '(description|location|contact|remark) (.+)',
GESHI_REPLACE => '\\2',
GESHI_BEFORE => '\\1 ',
GESHI_BEFORE => '\\1 ',
),
9 => array(
GESHI_SEARCH => '([0-9\.\_\*]+\:[0-9\.\_\*]+)',
9 => array(
GESHI_SEARCH => '([0-9\.\_\*]+\:[0-9\.\_\*]+)',
GESHI_REPLACE => '\\1',
),
10 => array(
GESHI_SEARCH => '(boot) ([a-z]+) (.+)',
GESHI_SEARCH => '(boot) ([a-z]+) (.+)',
GESHI_REPLACE => '\\3',
GESHI_BEFORE => '\\1 \\2 '
GESHI_BEFORE => '\\1 \\2 ',
),
11 => array(
GESHI_SEARCH => '(net) ([0-9a-z\.]+)',
GESHI_SEARCH => '(net) ([0-9a-z\.]+)',
GESHI_REPLACE => '\\2',
GESHI_BEFORE => '\\1 '
GESHI_BEFORE => '\\1 ',
),
12 => array(
GESHI_SEARCH => '(access-list|RO|RW) ([0-9]+)',
GESHI_SEARCH => '(access-list|RO|RW) ([0-9]+)',
GESHI_REPLACE => '\\2',
GESHI_BEFORE => '\\1 '
GESHI_BEFORE => '\\1 ',
),
13 => array(
GESHI_SEARCH => '(vlan) ([0-9]+)',
GESHI_SEARCH => '(vlan) ([0-9]+)',
GESHI_REPLACE => '\\2',
GESHI_BEFORE => '\\1 '
GESHI_BEFORE => '\\1 ',
),
14 => array(
GESHI_SEARCH => '(encapsulation|speed|duplex|mtu|metric|media-type|negotiation|transport\ input|bgp-community|set\ as-path\ prepend|maximum-prefix|version|local-preference|continue|redistribute|cluster-id|vtp\ mode|label\ protocol|spanning-tree\ mode) (.+)',
GESHI_SEARCH => '(encapsulation|speed|duplex|mtu|metric|media-type|negotiation|transport\ input|bgp-community|set\ as-path\ prepend|maximum-prefix|version|local-preference|continue|redistribute|cluster-id|vtp\ mode|label\ protocol|spanning-tree\ mode) (.+)',
GESHI_REPLACE => '\\2',
GESHI_BEFORE => '\\1 '
GESHI_BEFORE => '\\1 ',
),
),
'STYLES' => array(
'REGEXPS' => array(
0 => 'color: #ff0000;',
1 => 'color: #0000cc;', # x.x.x.x
2 => 'color: #000099; font-style: italic', # 255.x.x.x
3 => 'color: #000000; font-weight: bold; font-style: italic;', # interface xxx
4 => 'color: #ff0000;', # neighbor x.x.x.x
5 => 'color: #000099;', # variable names
6 => 'color: #cc0000;',
7 => 'color: #cc0000;', # passwords
8 => 'color: #555555;', # description
9 => 'color: #990099;', # communities
10 => 'color: #cc0000; font-style: italic;', # no/shut
11 => 'color: #000099;', # net numbers
12 => 'color: #000099;', # acls
13 => 'color: #000099;', # acls
14 => 'color: #990099;', # warnings
0 => 'color: #ff0000;',
1 => 'color: #0000cc;',
// x.x.x.x
2 => 'color: #000099; font-style: italic',
// 255.x.x.x
3 => 'color: #000000; font-weight: bold; font-style: italic;',
// interface xxx
4 => 'color: #ff0000;',
// neighbor x.x.x.x
5 => 'color: #000099;',
// variable names
6 => 'color: #cc0000;',
7 => 'color: #cc0000;',
// passwords
8 => 'color: #555555;',
// description
9 => 'color: #990099;',
// communities
10 => 'color: #cc0000; font-style: italic;',
// no/shut
11 => 'color: #000099;',
// net numbers
12 => 'color: #000099;',
// acls
13 => 'color: #000099;',
// acls
14 => 'color: #990099;',
// warnings
),
'KEYWORDS' => array(
1 => 'color: #cc0000; font-weight: bold;', # no/shut
2 => 'color: #000000;', # commands
3 => 'color: #000000; font-weight: bold;', # proto/service
4 => 'color: #000000;', # options
5 => 'color: #ff0000;'
1 => 'color: #cc0000; font-weight: bold;',
// no/shut
2 => 'color: #000000;',
// commands
3 => 'color: #000000; font-weight: bold;',
// proto/service
4 => 'color: #000000;',
// options
5 => 'color: #ff0000;',
),
'COMMENTS' => array(
1 => 'color: #808080; font-style: italic;'
),
'ESCAPE_CHAR' => array(
0 => 'color: #000099; font-weight: bold;'
),
'BRACKETS' => array(
0 => 'color: #66cc66;'
),
'STRINGS' => array(
0 => 'color: #ff0000;'
),
'NUMBERS' => array(
0 => 'color: #cc0000;'
),
'METHODS' => array(
0 => 'color: #006600;'
),
'SYMBOLS' => array(
0 => 'color: #66cc66;'
),
'SCRIPT' => array(
'COMMENTS' => array(1 => 'color: #808080; font-style: italic;'),
'ESCAPE_CHAR' => array(0 => 'color: #000099; font-weight: bold;'),
'BRACKETS' => array(0 => 'color: #66cc66;'),
'STRINGS' => array(0 => 'color: #ff0000;'),
'NUMBERS' => array(0 => 'color: #cc0000;'),
'METHODS' => array(0 => 'color: #006600;'),
'SYMBOLS' => array(0 => 'color: #66cc66;'),
'SCRIPT' => array(
0 => '',
1 => '',
2 => '',
3 => ''
)
3 => '',
),
)
),
);
?>
+70 -73
View File
@@ -1,82 +1,79 @@
#!/usr/bin/env php
<?php
///////////////////////////////////////////////////////////////////////////////////////
///
// A small script to grab the NTP Client statistics from a NTPD server
// Needed commands: php, ntpd, ntpq
///
// Install:
// Add the following to your snmpd.conf file:
// extend ntpclient /opt/librenms/scripts/ntp-client.php
///
// Version 1.1 By:
// All In One - Dennis de Houx <info@all-in-one.be>
///
///////////////////////////////////////////////////////////////////////////////////////
// A small script to grab the NTP Client statistics from a NTPD server
// Needed commands: php, ntpd, ntpq
//
// Install:
// Add the following to your snmpd.conf file:
// extend ntpclient /opt/librenms/scripts/ntp-client.php
//
// Version 1.1 By:
// All In One - Dennis de Houx <info@all-in-one.be>
//
// START SETTINGS ///
$ntpq = '/usr/sbin/ntpq';
// Change this to true if you have clk_jitter, sys_jitter in the ntpq -c rv output
$newstats_style = false;
// END SETTINGS ///
// DO NOT EDIT UNDER THIS LINE
$cmd = shell_exec($ntpq." -c rv | grep '^offset'");
if ($newstats_style) {
$cmd2 = shell_exec($ntpq." -c rv | grep '^clk_wander'");
}
else {
$cmd2 = shell_exec($ntpq." -c rv | grep '^stability'");
}
$vars = array();
$vars2 = array();
$vars = explode(',', $cmd);
$vars2 = explode(',', $cmd2);
// START SETTINGS ///
function doSNMPv2($vars, $vars2, $newstats_style)
{
$ntp = array();
foreach ($vars as $item => $value) {
if (!empty($value)) {
$temp = explode('=', $value);
if (isset($temp[1])) {
$ntp[trim($temp[0])] = trim($temp[1]);
}
}
}
$ntpq = "/usr/sbin/ntpq";
# Change this to true if you have clk_jitter, sys_jitter in the ntpq -c rv output
$newstats_style = false;
foreach ($vars2 as $item => $value) {
if (!empty($value)) {
$temp = explode('=', $value);
if (isset($temp[1])) {
$ntp[trim($temp[0])] = trim($temp[1]);
}
}
}
// END SETTINGS ///
$var = array();
$var['offset'] = (isset($ntp['offset']) ? $ntp['offset'] : 'U');
$var['frequency'] = (isset($ntp['frequency']) ? $ntp['frequency'] : 'U');
if ($newstats_style) {
$var['jitter'] = (isset($ntp['clk_jitter']) ? $ntp['clk_jitter'] : 'U');
$var['noise'] = (isset($ntp['sys_jitter']) ? $ntp['sys_jitter'] : 'U');
$var['stability'] = (isset($ntp['clk_wander']) ? $ntp['clk_wander'] : 'U');
}
else {
$var['jitter'] = (isset($ntp['jitter']) ? $ntp['jitter'] : 'U');
$var['noise'] = (isset($ntp['noise']) ? $ntp['noise'] : 'U');
$var['stability'] = (isset($ntp['stability']) ? $ntp['stability'] : 'U');
}
foreach ($var as $item => $count) {
echo $count."\n";
}
}//end doSNMPv2()
///
// DO NOT EDIT BENETH THIS LINE
///
///////////////////////////////////////////////////////////////////////////////////////
$cmd = shell_exec($ntpq." -c rv | grep '^offset'");
if ($newstats_style) {
$cmd2 = shell_exec($ntpq." -c rv | grep '^clk_wander'");
} else {
$cmd2 = shell_exec($ntpq." -c rv | grep '^stability'");
}
$vars = array();
$vars2 = array();
$vars = explode(',', $cmd);
$vars2 = explode(',', $cmd2);
function doSNMPv2($vars, $vars2, $newstats_style) {
$ntp = array();
foreach ($vars as $item=>$value) {
if (!empty($value)) {
$temp = explode('=', $value);
if (isset($temp[1])) {
$ntp[trim($temp[0])] = trim($temp[1]);
}
}
}
foreach ($vars2 as $item=>$value) {
if (!empty($value)) {
$temp = explode('=', $value);
if (isset($temp[1])) {
$ntp[trim($temp[0])] = trim($temp[1]);
}
}
}
$var = array();
$var['offset'] = (isset($ntp['offset']) ? $ntp['offset'] : "U");
$var['frequency'] = (isset($ntp['frequency']) ? $ntp['frequency'] : "U");
if ($newstats_style) {
$var['jitter'] = (isset($ntp['clk_jitter']) ? $ntp['clk_jitter'] : "U");
$var['noise'] = (isset($ntp['sys_jitter']) ? $ntp['sys_jitter'] : "U");
$var['stability'] = (isset($ntp['clk_wander']) ? $ntp['clk_wander'] : "U");
} else {
$var['jitter'] = (isset($ntp['jitter']) ? $ntp['jitter'] : "U");
$var['noise'] = (isset($ntp['noise']) ? $ntp['noise'] : "U");
$var['stability'] = (isset($ntp['stability']) ? $ntp['stability'] : "U");
}
foreach ($var as $item=>$count) {
echo $count."\n";
}
}
doSNMPv2($vars, $vars2, $newstats_style);
?>
doSNMPv2($vars, $vars2, $newstats_style);
+74 -80
View File
@@ -1,89 +1,83 @@
#!/usr/bin/env php
<?php
///////////////////////////////////////////////////////////////////////////////////////
///
// A small script to grab the NTPD Server statistics from a NTPD server
// Needed commands: php, ntpd, ntpq, ntpdc
///
// Install:
// Add the following to your snmpd.conf file:
// extend ntpdserver /opt/librenms/scripts/ntpd-server.php
///
// Version 1.1 By:
// All In One - Dennis de Houx <info@all-in-one.be>
///
///////////////////////////////////////////////////////////////////////////////////////
// A small script to grab the NTPD Server statistics from a NTPD server
// Needed commands: php, ntpd, ntpq, ntpdc
//
// Install:
// Add the following to your snmpd.conf file:
// extend ntpdserver /opt/librenms/scripts/ntpd-server.php
//
// Version 1.1 By:
// All In One - Dennis de Houx <info@all-in-one.be>
// START SETTINGS ///
$ntpq = '/usr/sbin/ntpq';
$ntpdc = '/usr/sbin/ntpdc';
// Change this to true if you have clk_jitter, sys_jitter in the ntpq -c rv output
$newstats_style = false;
// END SETTINGS ///
// DO NOT EDIT UNDER THIS LINE
$cmd = shell_exec($ntpq.' -c rv');
$cmd2 = shell_exec($ntpdc.' -c iostats');
$vars = array();
$vars2 = array();
$vars = explode(',', $cmd);
$vars2 = eregi_replace(' ', '', $cmd2);
$vars2 = explode("\n", $vars2);
// START SETTINGS ///
function doSNMPv2($vars, $vars2, $newstats_style)
{
$ntpd = array();
foreach ($vars as $item => $value) {
if (!empty($value)) {
$temp = explode('=', $value);
if (isset($temp[1])) {
$ntpd[trim($temp[0])] = trim($temp[1]);
}
}
}
$ntpq = "/usr/sbin/ntpq";
$ntpdc = "/usr/sbin/ntpdc";
# Change this to true if you have clk_jitter, sys_jitter in the ntpq -c rv output
$newstats_style = false;
foreach ($vars2 as $item => $value) {
if (!empty($value)) {
$temp = explode(':', $value);
if (isset($temp[1])) {
$ntpd[trim($temp[0])] = trim($temp[1]);
}
}
}
// END SETTINGS ///
$var = array();
$var['stratum'] = (isset($ntpd['stratum']) ? $ntpd['stratum'] : 'U');
$var['offset'] = (isset($ntpd['offset']) ? $ntpd['offset'] : 'U');
$var['frequency'] = (isset($ntpd['frequency']) ? $ntpd['frequency'] : 'U');
if ($newstats_style) {
$var['jitter'] = (isset($ntpd['clk_jitter']) ? $ntpd['clk_jitter'] : 'U');
$var['noise'] = (isset($ntpd['sys_jitter']) ? $ntpd['sys_jitter'] : 'U');
$var['stability'] = (isset($ntpd['clk_wander']) ? $ntpd['clk_wander'] : 'U');
}
else {
$var['jitter'] = (isset($ntpd['jitter']) ? $ntpd['jitter'] : 'U');
$var['noise'] = (isset($ntpd['noise']) ? $ntpd['noise'] : 'U');
$var['stability'] = (isset($ntpd['stability']) ? $ntpd['stability'] : 'U');
}
$var['uptime'] = (isset($ntpd['timesincereset']) ? $ntpd['timesincereset'] : 'U');
$var['buffer_recv'] = (isset($ntpd['receivebuffers']) ? $ntpd['receivebuffers'] : 'U');
$var['buffer_free'] = (isset($ntpd['freereceivebuffers']) ? $ntpd['freereceivebuffers'] : 'U');
$var['buffer_used'] = (isset($ntpd['usedreceivebuffers']) ? $ntpd['usedreceivebuffers'] : 'U');
$var['packets_drop'] = (isset($ntpd['droppedpackets']) ? $ntpd['droppedpackets'] : 'U');
$var['packets_ignore'] = (isset($ntpd['ignoredpackets']) ? $ntpd['ignoredpackets'] : 'U');
$var['packets_recv'] = (isset($ntpd['receivedpackets']) ? $ntpd['receivedpackets'] : 'U');
$var['packets_sent'] = (isset($ntpd['packetssent']) ? $ntpd['packetssent'] : 'U');
foreach ($var as $item => $count) {
echo $count."\n";
}
}//end doSNMPv2()
///
// DO NOT EDIT BENETH THIS LINE
///
///////////////////////////////////////////////////////////////////////////////////////
$cmd = shell_exec($ntpq." -c rv");
$cmd2 = shell_exec($ntpdc." -c iostats");
$vars = array();
$vars2 = array();
$vars = explode(',', $cmd);
$vars2 = eregi_replace(' ', '', $cmd2);
$vars2 = explode("\n", $vars2);
function doSNMPv2($vars, $vars2, $newstats_style) {
$ntpd = array();
foreach ($vars as $item=>$value) {
if (!empty($value)) {
$temp = explode('=', $value);
if (isset($temp[1])) {
$ntpd[trim($temp[0])] = trim($temp[1]);
}
}
}
foreach ($vars2 as $item=>$value) {
if (!empty($value)) {
$temp = explode(':', $value);
if (isset($temp[1])) {
$ntpd[trim($temp[0])] = trim($temp[1]);
}
}
}
$var = array();
$var['stratum'] = (isset($ntpd['stratum']) ? $ntpd['stratum'] : "U");
$var['offset'] = (isset($ntpd['offset']) ? $ntpd['offset'] : "U");
$var['frequency'] = (isset($ntpd['frequency']) ? $ntpd['frequency'] : "U");
if ($newstats_style) {
$var['jitter'] = (isset($ntpd['clk_jitter']) ? $ntpd['clk_jitter'] : "U");
$var['noise'] = (isset($ntpd['sys_jitter']) ? $ntpd['sys_jitter'] : "U");
$var['stability'] = (isset($ntpd['clk_wander']) ? $ntpd['clk_wander'] : "U");
} else {
$var['jitter'] = (isset($ntpd['jitter']) ? $ntpd['jitter'] : "U");
$var['noise'] = (isset($ntpd['noise']) ? $ntpd['noise'] : "U");
$var['stability'] = (isset($ntpd['stability']) ? $ntpd['stability'] : "U");
}
$var['uptime'] = (isset($ntpd['timesincereset']) ? $ntpd['timesincereset'] : "U");
$var['buffer_recv'] = (isset($ntpd['receivebuffers']) ? $ntpd['receivebuffers'] : "U");
$var['buffer_free'] = (isset($ntpd['freereceivebuffers']) ? $ntpd['freereceivebuffers'] : "U");
$var['buffer_used'] = (isset($ntpd['usedreceivebuffers']) ? $ntpd['usedreceivebuffers'] : "U");
$var['packets_drop'] = (isset($ntpd['droppedpackets']) ? $ntpd['droppedpackets'] : "U");
$var['packets_ignore'] = (isset($ntpd['ignoredpackets']) ? $ntpd['ignoredpackets'] : "U");
$var['packets_recv'] = (isset($ntpd['receivedpackets']) ? $ntpd['receivedpackets'] : "U");
$var['packets_sent'] = (isset($ntpd['packetssent']) ? $ntpd['packetssent'] : "U");
foreach ($var as $item=>$count) {
echo $count."\n";
}
}
doSNMPv2($vars, $vars2, $newstats_style);
?>
doSNMPv2($vars, $vars2, $newstats_style);
+65 -73
View File
@@ -1,84 +1,76 @@
#!/usr/bin/env php
<?php
///////////////////////////////////////////////////////////////////////////////////////
///
// A small script to grab the DNS statistics from a PowerDNS server
// Needed commands: php, pdns_control
///
// Install:
// Add the following to your snmpd.conf file:
// extend powerdns /opt/librenms/scripts/powerdns.php
///
// Version 1.0 By:
// All In One - Dennis de Houx <info@all-in-one.be>
///
///////////////////////////////////////////////////////////////////////////////////////
// A small script to grab the DNS statistics from a PowerDNS server
// Needed commands: php, pdns_control
//
// Install:
// Add the following to your snmpd.conf file:
// extend powerdns /opt/librenms/scripts/powerdns.php
//
// Version 1.0 By:
// All In One - Dennis de Houx <info@all-in-one.be>
// START SETTINGS ///
$pdnscontrol = "/usr/bin/pdns_control";
$pdnscontrol = '/usr/bin/pdns_control';
// END SETTINGS ///
// DO NOT EDIT UNDER THIS LINE
//
$cmd = shell_exec($pdnscontrol.' show \*');
$vars = array();
$vars = explode(',', $cmd);
///
// DO NOT EDIT BENETH THIS LINE
///
///////////////////////////////////////////////////////////////////////////////////////
$cmd = shell_exec($pdnscontrol." show \*");
$vars = array();
$vars = explode(',', $cmd);
function doSNMP($vars) {
foreach ($vars as $item=>$value) {
$value = trim($value);
if (!empty($value)) {
echo $value."\n";
}
}
}
function doSNMPv2($vars) {
$pdns = array();
foreach ($vars as $item=>$value) {
if (!empty($value)) {
$temp = explode('=', $value);
if (isset($temp[1])) {
$pdns[$temp[0]] = $temp[1];
}
}
}
$var = array();
$var['corrupt-packets'] = (isset($pdns['corrupt-packets']) ? $pdns['corrupt-packets'] : "U");
$var['deferred-cache-inserts'] = (isset($pdns['deferred-cache-inserts']) ? $pdns['deferred-cache-inserts'] : "U");
$var['deferred-cache-lookup'] = (isset($pdns['deferred-cache-lookup']) ? $pdns['deferred-cache-lookup'] : "U");
$var['latency'] = (isset($pdns['latency']) ? $pdns['latency'] : "U");
$var['packetcache-hit'] = (isset($pdns['packetcache-hit']) ? $pdns['packetcache-hit'] : "U");
$var['packetcache-miss'] = (isset($pdns['packetcache-miss']) ? $pdns['packetcache-miss'] : "U");
$var['packetcache-size'] = (isset($pdns['packetcache-size']) ? $pdns['packetcache-size'] : "U");
$var['qsize-q'] = (isset($pdns['qsize-q']) ? $pdns['qsize-q'] : "U");
$var['query-cache-hit'] = (isset($pdns['query-cache-hit']) ? $pdns['query-cache-hit'] : "U");
$var['query-cache-miss'] = (isset($pdns['query-cache-miss']) ? $pdns['query-cache-miss'] : "U");
$var['recursing-answers'] = (isset($pdns['recursing-answers']) ? $pdns['recursing-answers'] : "U");
$var['recursing-questions'] = (isset($pdns['recursing-questions']) ? $pdns['recursing-questions'] : "U");
$var['servfail-packets'] = (isset($pdns['servfail-packets']) ? $pdns['servfail-packets'] : "U");
$var['tcp-answers'] = (isset($pdns['tcp-answers']) ? $pdns['tcp-answers'] : "U");
$var['tcp-queries'] = (isset($pdns['tcp-queries']) ? $pdns['tcp-queries'] : "U");
$var['timedout-packets'] = (isset($pdns['timedout-packets']) ? $pdns['timedout-packets'] : "U");
$var['udp-answers'] = (isset($pdns['udp-answers']) ? $pdns['udp-answers'] : "U");
$var['udp-queries'] = (isset($pdns['udp-queries']) ? $pdns['udp-queries'] : "U");
$var['udp4-answers'] = (isset($pdns['udp4-answers']) ? $pdns['udp4-answers'] : "U");
$var['udp4-queries'] = (isset($pdns['udp4-queries']) ? $pdns['udp4-queries'] : "U");
$var['udp6-answers'] = (isset($pdns['udp6-answers']) ? $pdns['udp6-answers'] : "U");
$var['udp6-queries'] = (isset($pdns['udp6-queries']) ? $pdns['udp6-queries'] : "U");
foreach ($var as $item=>$count) {
echo $count."\n";
}
}
function doSNMP($vars) {
foreach ($vars as $item => $value) {
$value = trim($value);
if (!empty($value)) {
echo $value."\n";
}
}
doSNMPv2($vars);
}//end doSNMP()
?>
function doSNMPv2($vars) {
$pdns = array();
foreach ($vars as $item => $value) {
if (!empty($value)) {
$temp = explode('=', $value);
if (isset($temp[1])) {
$pdns[$temp[0]] = $temp[1];
}
}
}
$var = array();
$var['corrupt-packets'] = (isset($pdns['corrupt-packets']) ? $pdns['corrupt-packets'] : 'U');
$var['deferred-cache-inserts'] = (isset($pdns['deferred-cache-inserts']) ? $pdns['deferred-cache-inserts'] : 'U');
$var['deferred-cache-lookup'] = (isset($pdns['deferred-cache-lookup']) ? $pdns['deferred-cache-lookup'] : 'U');
$var['latency'] = (isset($pdns['latency']) ? $pdns['latency'] : 'U');
$var['packetcache-hit'] = (isset($pdns['packetcache-hit']) ? $pdns['packetcache-hit'] : 'U');
$var['packetcache-miss'] = (isset($pdns['packetcache-miss']) ? $pdns['packetcache-miss'] : 'U');
$var['packetcache-size'] = (isset($pdns['packetcache-size']) ? $pdns['packetcache-size'] : 'U');
$var['qsize-q'] = (isset($pdns['qsize-q']) ? $pdns['qsize-q'] : 'U');
$var['query-cache-hit'] = (isset($pdns['query-cache-hit']) ? $pdns['query-cache-hit'] : 'U');
$var['query-cache-miss'] = (isset($pdns['query-cache-miss']) ? $pdns['query-cache-miss'] : 'U');
$var['recursing-answers'] = (isset($pdns['recursing-answers']) ? $pdns['recursing-answers'] : 'U');
$var['recursing-questions'] = (isset($pdns['recursing-questions']) ? $pdns['recursing-questions'] : 'U');
$var['servfail-packets'] = (isset($pdns['servfail-packets']) ? $pdns['servfail-packets'] : 'U');
$var['tcp-answers'] = (isset($pdns['tcp-answers']) ? $pdns['tcp-answers'] : 'U');
$var['tcp-queries'] = (isset($pdns['tcp-queries']) ? $pdns['tcp-queries'] : 'U');
$var['timedout-packets'] = (isset($pdns['timedout-packets']) ? $pdns['timedout-packets'] : 'U');
$var['udp-answers'] = (isset($pdns['udp-answers']) ? $pdns['udp-answers'] : 'U');
$var['udp-queries'] = (isset($pdns['udp-queries']) ? $pdns['udp-queries'] : 'U');
$var['udp4-answers'] = (isset($pdns['udp4-answers']) ? $pdns['udp4-answers'] : 'U');
$var['udp4-queries'] = (isset($pdns['udp4-queries']) ? $pdns['udp4-queries'] : 'U');
$var['udp6-answers'] = (isset($pdns['udp6-answers']) ? $pdns['udp6-answers'] : 'U');
$var['udp6-queries'] = (isset($pdns['udp6-queries']) ? $pdns['udp6-queries'] : 'U');
foreach ($var as $item => $count) {
echo $count."\n";
}
}//end doSNMPv2()
doSNMPv2($vars);
+14 -21
View File
@@ -3,28 +3,21 @@
// MYSQL Check - FIXME
// 1 UPDATE
require 'config.php';
require 'includes/functions.php';
include("config.php");
include("includes/functions.php");
if ($fd = @fopen($argv[1], 'r')) {
$data = fread($fd, 4096);
while (!feof($fd)) {
$data .= fread($fd, 4096);
}
if ($fd = @fopen($argv[1],'r'))
{
$data = fread($fd,4096);
while (!feof($fd))
{
$data .= fread($fd,4096);
}
foreach (explode("\n", $data) as $line)
{
$update = mysql_query($line);
// FIXME check query success?
echo("$line \n");
}
foreach (explode("\n", $data) as $line) {
$update = mysql_query($line);
// FIXME check query success?
echo "$line \n";
}
}
else
{
echo("ERROR: Could not open file \"$argv[1]\".\n");
else {
echo "ERROR: Could not open file \"$argv[1]\".\n";
}
?>