mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
syntaxer run
git-svn-id: http://www.observium.org/svn/observer/trunk@3185 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+8
-8
@@ -47,7 +47,7 @@ if (!empty($argv[1]))
|
||||
{
|
||||
$v3['authlevel'] = "noAuthNoPriv";
|
||||
$v3args = array_slice($argv, 4);
|
||||
|
||||
|
||||
while ($arg = array_shift($v3args))
|
||||
{
|
||||
// parse all remaining args
|
||||
@@ -71,7 +71,7 @@ if (!empty($argv[1]))
|
||||
{ array_push($config['snmp']['v3'], $v3); }
|
||||
|
||||
$device_id = addHost($host, $snmpver, $port, $transport);
|
||||
|
||||
|
||||
}
|
||||
elseif ($seclevel === "anp" or $seclevel === "authNoPriv")
|
||||
{
|
||||
@@ -97,10 +97,10 @@ if (!empty($argv[1]))
|
||||
$v3['authalgo'] = $arg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
array_push($config['snmp']['v3'], $v3);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport);
|
||||
|
||||
|
||||
}
|
||||
elseif ($seclevel === "ap" or $seclevel === "authPriv")
|
||||
{
|
||||
@@ -130,10 +130,10 @@ if (!empty($argv[1]))
|
||||
$v3['cryptoalgo'] = $arg;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
array_push($config['snmp']['v3'], $v3);
|
||||
$device_id = addHost($host, $snmpver, $port, $transport);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -165,7 +165,7 @@ if (!empty($argv[1]))
|
||||
{
|
||||
$config['snmp']['community'] = array($community);
|
||||
}
|
||||
|
||||
|
||||
$device_id = addHost($host, $snmpver, $port, $transport);
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ Usage (SNMPv1/2c): ./addhost.php <%Whostname%n> [community] [v1|v2c] [port] [" .
|
||||
Usage (SNMPv3) : Config Defaults : ./addhost.php <%Whostname%n> any v3 [user] [port] [" . implode("|",$config['snmp']['transports']) . "]
|
||||
No Auth, No Priv : ./addhost.php <%Whostname%n> nanp v3 [user] [port] [" . implode("|",$config['snmp']['transports']) . "]
|
||||
Auth, No Priv : ./addhost.php <%Whostname%n> anp v3 <user> <password> [md5|sha1] [port] [" . implode("|",$config['snmp']['transports']) . "]
|
||||
Auth, Priv : ./addhost.php <%Whostname%n> ap v3 <user> <password> <enckey> [md5|sha1] [aes|dsa] [port] [" . implode("|",$config['snmp']['transports']) . "]
|
||||
Auth, Priv : ./addhost.php <%Whostname%n> ap v3 <user> <password> <enckey> [md5|sha1] [aes|dsa] [port] [" . implode("|",$config['snmp']['transports']) . "]
|
||||
%rRemember to run discovery for the host afterwards.%n
|
||||
|
||||
");
|
||||
|
||||
@@ -52,7 +52,6 @@ echo('
|
||||
$graph_array['width'] = "150";
|
||||
$graph_array['bg'] = "FFFFFF00";
|
||||
|
||||
|
||||
foreach ($graphs as $entry)
|
||||
{
|
||||
$graph_array['type'] = $entry['graph'];
|
||||
|
||||
@@ -177,7 +177,7 @@ function generate_graph_popup($graph_array)
|
||||
$graph_array['from'] = $config['time']['year'];
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
$content .= "</div>";
|
||||
|
||||
|
||||
$graph_array['from'] = $original_from;
|
||||
|
||||
$graph_array['link'] = generate_url($graph_array, array('page' => 'graphs', 'height' => NULL, 'width' => NULL, 'bg' => NULL));
|
||||
|
||||
@@ -22,7 +22,7 @@ if (is_file($rrd_filename))
|
||||
$rrd_list[$i]['descr'] = $vars['descr'];
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$rrd_list[$i]['colour'] = $vars['colour'];
|
||||
if(!empty($vars['areacolour'])) { $rrd_list[$i]['areacolour'] = $vars['areacolour']; }
|
||||
if (!empty($vars['areacolour'])) { $rrd_list[$i]['areacolour'] = $vars['areacolour']; }
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -21,7 +21,7 @@ if (is_file($rrd_filename))
|
||||
$rrd_list[$i]['descr'] = $vars['descr'];
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$rrd_list[$i]['colour'] = $vars['colour'];
|
||||
if(!empty($vars['areacolour'])) { $rrd_list[$i]['areacolour'] = $vars['areacolour']; }
|
||||
if (!empty($vars['areacolour'])) { $rrd_list[$i]['areacolour'] = $vars['areacolour']; }
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
include("memcached.inc.php");
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
$device = device_by_id_cache($vars['id']);
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
@@ -18,6 +18,4 @@ $unit_text = "Processes";
|
||||
|
||||
include("includes/graphs/generic_simplex.inc.php");
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -18,6 +18,4 @@ $unit_text = "Processes";
|
||||
|
||||
include("includes/graphs/generic_simplex.inc.php");
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-icmp.rrd";
|
||||
|
||||
$stats = array('icmpInMsgs' => '00cc00',
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-icmp.rrd";
|
||||
|
||||
$stats = array('icmpInSrcQuenchs' => array(),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-ip.rrd";
|
||||
|
||||
$stats = array('ipForwDatagrams' => array(),
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-ip.rrd";
|
||||
|
||||
$rrd_options .= " DEF:ipInDelivers=$rrd_filename:ipInDelivers:AVERAGE";
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-snmp.rrd";
|
||||
|
||||
$stats = array('snmpInTraps',
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-tcp.rrd";
|
||||
|
||||
$stats = array('tcpInSegs','tcpOutSegs','tcpActiveOpens','tcpPassiveOpens','tcpAttemptFails','tcpEstabResets','tcpRetransSegs');
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-udp.rrd";
|
||||
|
||||
$stats = array('udpInDatagrams','udpOutDatagrams','udpInErrors','udpNoPorts');
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
|
||||
$file = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("screenos_sessions.rrd");
|
||||
|
||||
$rrd_list[0]['filename'] = $file;
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
|
||||
if ($_GET['width'] > "300") { $descr_len = "40"; } else { $descr_len = "22"; }
|
||||
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
|
||||
$iter = "1";
|
||||
|
||||
@@ -4,7 +4,6 @@ $scale_min = "0";
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/uptime.rrd";
|
||||
|
||||
$rrd_options .= " DEF:uptime=".$rrd_filename.":uptime:AVERAGE";
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/vpdn-l2tp.rrd";
|
||||
|
||||
$stats = array('sessions');
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/vpdn-l2tp.rrd";
|
||||
|
||||
$stats = array('tunnels');
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
include("includes/graphs/common.inc.php");
|
||||
|
||||
|
||||
$rrd_options .= " -l 0 -E ";
|
||||
|
||||
$radio1 = $config['rrd_dir'] . "/".$device['hostname']."/wificlients-radio1.rrd";
|
||||
|
||||
@@ -96,7 +96,7 @@ if(!$nototal)
|
||||
$rrd_options .= " CDEF:inbits=inoctets,8,*";
|
||||
$rrd_options .= " CDEF:outbits=outoctets,8,*";
|
||||
$rrd_options .= " CDEF:doutbits=doutoctets,8,*";
|
||||
|
||||
|
||||
$rrd_options .= " VDEF:95thin=inbits,95,PERCENT";
|
||||
$rrd_options .= " VDEF:95thout=outbits,95,PERCENT";
|
||||
$rrd_options .= " VDEF:d95thout=doutbits,5,PERCENT";
|
||||
@@ -110,10 +110,8 @@ if(!$nototal)
|
||||
# $rrd_options .= " GPRINT:totin:AVERAGE:%6.2lf%s$units";
|
||||
# $rrd_options .= " GPRINT:totin:MAX:%6.2lf%s$units\l";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
$rrd_options .= $rrd_optionsb;
|
||||
$rrd_options .= " HRULE:0#999999";
|
||||
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
<?php
|
||||
|
||||
|
||||
if($config['old_graphs'])
|
||||
{
|
||||
include("includes/graphs/old_generic_simplex.inc.php");
|
||||
} else {
|
||||
|
||||
|
||||
|
||||
/// Draw generic bits graph
|
||||
/// args: ds_in, ds_out, rrd_filename, bg, legend, from, to, width, height, inverse, percentile
|
||||
|
||||
@@ -19,7 +16,6 @@ $line_text = str_pad(truncate($line_text,12,''),12);
|
||||
if ($multiplier)
|
||||
{
|
||||
$rrd_options .= " DEF:".$ds."_o=".$rrd_filename.":".$ds.":AVERAGE";
|
||||
if($config['oldrrd']) {}
|
||||
$rrd_options .= " DEF:".$ds."_max_o=".$rrd_filename.":".$ds.":MAX";
|
||||
$rrd_options .= " DEF:".$ds."_min_o=".$rrd_filename.":".$ds.":MIN";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
if ($_SESSION['userlevel'] >= "5")
|
||||
{
|
||||
$auth = 1;
|
||||
$auth = 1;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -51,7 +51,6 @@ $colours_out = 'blues';
|
||||
|
||||
$nototal = 1;
|
||||
|
||||
|
||||
$ds_in = "INOCTETS";
|
||||
$ds_out = "OUTOCTETS";
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ $subtype = $graphtype['subtype'];
|
||||
if (is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.php"))
|
||||
{
|
||||
|
||||
if (isset($config['allow_unauth_graphs']) && $config['allow_unauth_graphs'])
|
||||
if (isset($config['allow_unauth_graphs']) && $config['allow_unauth_graphs'])
|
||||
{
|
||||
$auth = "1"; ## hardcode auth for all with config function
|
||||
}
|
||||
@@ -52,8 +52,8 @@ if (is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.p
|
||||
{
|
||||
if (Net_IPv4::ipInNetwork($_SERVER['REMOTE_ADDR'], $range))
|
||||
{
|
||||
$auth = "1";
|
||||
if($debug) { echo("matched $range"); }
|
||||
$auth = "1";
|
||||
if ($debug) { echo("matched $range"); }
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if(is_numeric($vars['plugin']))
|
||||
if (is_numeric($vars['plugin']))
|
||||
{
|
||||
$mplug = dbFetchRow("SELECT * FROM `munin_plugins` AS M, `devices` AS D WHERE `mplug_id` = ? AND D.device_id = M.device_id ", array($vars['plugin']));
|
||||
} else {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
if(empty($graph_array['type'])) { $graph_array['type'] = $graph_type; }
|
||||
if(empty($graph_array['device'])) { $graph_array['device'] = $device['device_id']; }
|
||||
|
||||
|
||||
# FIXME not css alternating yet
|
||||
if (!is_integer($g_i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ if ($_POST['hostname'])
|
||||
);
|
||||
|
||||
array_push($config['snmp']['v3'], $v3);
|
||||
|
||||
|
||||
$snmpver = "v3";
|
||||
|
||||
if ($_POST['port']) { $port = mres($_POST['port']); } else { $port = "161"; }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$graph_array['height'] = "100";
|
||||
$graph_array['width'] = "218";
|
||||
$graph_array['width'] = "218";
|
||||
$graph_array['to'] = $config['time']['now'];
|
||||
$graph_array['from'] = $config['time']['day'];
|
||||
$graph_array_zoom = $graph_array;
|
||||
@@ -14,9 +14,9 @@ foreach ($app_list as $app)
|
||||
echo('<div style="clear: both;">');
|
||||
echo('<h2>'.generate_link(nicecase($app['app_type']),array('page'=>'apps','app'=>$app['app_type'])).'</h2>');
|
||||
$app_devices = dbFetchRows("SELECT * FROM `devices` AS D, `applications` AS A WHERE D.device_id = A.device_id AND A.app_type = ?", array($app['app_type']));
|
||||
|
||||
foreach ($app_devices as $app_device)
|
||||
{
|
||||
|
||||
$graph_type = $graphs[$app['app_type']][0];
|
||||
|
||||
$graph_array['type'] = "application_".$app['app_type']."_".$graph_type;
|
||||
@@ -33,7 +33,7 @@ foreach ($app_list as $app)
|
||||
$overlib_url = generate_url($link_array);
|
||||
|
||||
$overlib_link = '<span style="float:left; margin-left: 10px; font-weight: bold;">'.shorthost($app_device['hostname'])."</span>";
|
||||
if(!empty($app_device['app_instance']))
|
||||
if (!empty($app_device['app_instance']))
|
||||
{
|
||||
$overlib_link .= '<span style="float:right; margin-right: 10px; font-weight: bold;">'.$app_device['app_instance']."</span>";
|
||||
$app_device['content_add'] = '('.$app_device['app_instance'].')';
|
||||
|
||||
@@ -100,7 +100,6 @@ if (device_permitted($vars['device']) || $check_device == $vars['device'])
|
||||
</li>');
|
||||
}
|
||||
|
||||
|
||||
if (@dbFetchCell("SELECT COUNT(interface_id) FROM ports WHERE device_id = '" . $device['device_id'] . "'") > '0')
|
||||
{
|
||||
echo('<li class="' . $select['ports'] . $select['port'] . '">
|
||||
|
||||
@@ -20,16 +20,16 @@ if ($_POST['editing'])
|
||||
|
||||
#FIXME needs better feedback
|
||||
$update = array(
|
||||
'community' => $community,
|
||||
'snmpver' => $snmpver,
|
||||
'community' => $community,
|
||||
'snmpver' => $snmpver,
|
||||
'port' => $port
|
||||
);
|
||||
|
||||
if ($_POST['timeout']) { $update['timeout'] = $timeout; }
|
||||
if ($_POST['timeout']) { $update['timeout'] = $timeout; }
|
||||
else { $update['timeout'] = array('NULL'); }
|
||||
if ($_POST['retries']) { $update['retries'] = $retries; }
|
||||
if ($_POST['retries']) { $update['retries'] = $retries; }
|
||||
else { $update['retries'] = array('NULL'); }
|
||||
|
||||
|
||||
$update = array_merge($update, $v3);
|
||||
|
||||
$rows_updated = dbUpdate($update, 'devices', '`device_id` = ?',array($device['device_id']));
|
||||
|
||||
@@ -57,6 +57,7 @@ foreach ($graph_enable as $graph => $entry)
|
||||
{
|
||||
$graph_title = $config['graph_types']['device'][$graph]['descr'];
|
||||
$graph_array['type'] = "device_" . $graph;
|
||||
|
||||
include("includes/print-device-graph.php");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,23 +11,23 @@
|
||||
data.addRows([
|
||||
<?php
|
||||
|
||||
foreach(getlocations() as $location)
|
||||
foreach (getlocations() as $location)
|
||||
{
|
||||
|
||||
$devices = array();
|
||||
$devices_down = array();
|
||||
$count = 0;
|
||||
$down = 0;
|
||||
foreach(dbFetchRows("SELECT * FROM devices WHERE location = ?", array($location)) as $device)
|
||||
foreach (dbFetchRows("SELECT * FROM devices WHERE location = ?", array($location)) as $device)
|
||||
{
|
||||
$devices[] = $device['hostname'];
|
||||
$count++;
|
||||
if($device['status'] == "0") { $down++; $devices_down[] = $device['hostname']; }
|
||||
if ($device['status'] == "0") { $down++; $devices_down[] = $device['hostname']; }
|
||||
}
|
||||
|
||||
if(empty($devices_down)) { $devices_down[] = "No Problems"; }
|
||||
if (empty($devices_down)) { $devices_down[] = "No Problems"; }
|
||||
|
||||
if($down > 0) { $state = 0; } else { $state = 100; }
|
||||
if ($down > 0) { $state = 0; } else { $state = 100; }
|
||||
|
||||
$locations[] = "['".$location."',".$state.", '".implode(", ", $devices_down)."']";
|
||||
|
||||
@@ -55,11 +55,8 @@ echo(implode(",\n", $locations));
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<div style="margin:0 auto;" id='chart_div'></div>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
function generate_front_box ($background, $content)
|
||||
|
||||
@@ -45,7 +45,7 @@ foreach (dbFetchRows("SELECT * FROM `packages` WHERE 1 $where GROUP BY `name`",
|
||||
$content .= "</div>";
|
||||
}
|
||||
$content .= "</div>";
|
||||
if(empty($vars['name']))
|
||||
if (empty($vars['name']))
|
||||
{
|
||||
echo("<span style='margin:5px;'>".overlib_link("", $version, $content, NULL)."</span>");
|
||||
} else {
|
||||
|
||||
@@ -273,7 +273,6 @@ $config['nfsen_enable'] = 0;
|
||||
### Use this feature to map ugly locations to pretty locations
|
||||
#config['location_map']['Under the Sink'] = "Under The Sink, The Office, London, UK";
|
||||
|
||||
|
||||
### Ignores & Allows
|
||||
# Has to be lowercase
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ if ($debug) { print_r($port_stats); }
|
||||
## -- i can make it a function, so that you don't know what it's doing.
|
||||
## -- $ports_db = adamasMagicFunction($ports_db); ?
|
||||
|
||||
foreach(dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ?", array($device['device_id'])) as $port)
|
||||
foreach (dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ?", array($device['device_id'])) as $port)
|
||||
{
|
||||
$ports_db[$port['ifIndex']] = $port;
|
||||
$ports_db_l[$port['ifIndex']] = $port['interface_id'];
|
||||
@@ -146,7 +146,7 @@ foreach ($port_stats as $ifIndex => $port)
|
||||
$ports_db[$ifIndex]['deleted'] = "0";
|
||||
echo("U");
|
||||
} else {
|
||||
echo (".");
|
||||
echo(".");
|
||||
}
|
||||
/// We've seen it. Remove it from the cache.
|
||||
unset($ports_l[$ifIndex]);
|
||||
@@ -166,9 +166,9 @@ foreach ($port_stats as $ifIndex => $port)
|
||||
|
||||
/// Interface Deletion
|
||||
/// If it's in our $ports_l list, that means it's not been seen. Mark it deleted.
|
||||
foreach($ports_l as $ifIndex => $port_id)
|
||||
foreach ($ports_l as $ifIndex => $port_id)
|
||||
{
|
||||
if($ports_db[$ifIndex]['deleted'] == "0")
|
||||
if ($ports_db[$ifIndex]['deleted'] == "0")
|
||||
{
|
||||
dbUpdate(array('deleted' => '1'), 'ports', '`interface_id` = ?', array($port_id));
|
||||
echo("-".$ifIndex);
|
||||
|
||||
@@ -289,7 +289,7 @@ function addHost($host, $snmpver, $port = '161', $transport = 'udp')
|
||||
print_error("Could not resolve $host"); }
|
||||
} else {
|
||||
/// found in database
|
||||
print_error("Already got host $host");
|
||||
print_error("Already got host $host");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@ rrdtool_update($nginx_rrd, "N:$req:$active:$reading:$writing:$waiting");
|
||||
|
||||
/// Unset the variables we set here
|
||||
|
||||
unset($nginx);
|
||||
unset($nginx_rrd);
|
||||
unset($active);
|
||||
unset($reading);
|
||||
unset($writing);
|
||||
unset($nginx);
|
||||
unset($nginx_rrd);
|
||||
unset($active);
|
||||
unset($reading);
|
||||
unset($writing);
|
||||
unset($req);
|
||||
|
||||
?>
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
$poll_device['sysLocation'] = str_replace("\"","", $poll_device['sysLocation']);
|
||||
|
||||
/// Rewrite sysLocation if there is a mapping array (database too?)
|
||||
if(!empty($poll_device['sysLocation']) && is_array($config['location_map']))
|
||||
if (!empty($poll_device['sysLocation']) && is_array($config['location_map']))
|
||||
{
|
||||
$poll_device['sysLocation'] = rewrite_location($poll_device['sysLocation']);
|
||||
}
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
<?php
|
||||
|
||||
|
||||
function rewrite_location($location){
|
||||
|
||||
function rewrite_location($location)
|
||||
{
|
||||
// FIXME -- also check the database for rewrites?
|
||||
global $config, $debug;
|
||||
|
||||
global $config;
|
||||
global $debug;
|
||||
|
||||
if(isset($config['location_map'][$location]))
|
||||
if (isset($config['location_map'][$location]))
|
||||
{
|
||||
$location = $config['location_map'][$location];
|
||||
}
|
||||
return $location;
|
||||
|
||||
return $location;
|
||||
}
|
||||
|
||||
function formatMac($mac)
|
||||
{
|
||||
$mac = preg_replace("/(..)(..)(..)(..)(..)(..)/", "\\1:\\2:\\3:\\4:\\5:\\6", $mac);
|
||||
|
||||
return $mac;
|
||||
}
|
||||
|
||||
|
||||
@@ -207,12 +207,12 @@ function rrdtool_create($filename, $options)
|
||||
function rrdtool_update($filename, $options)
|
||||
{
|
||||
/// Do some sanitisation on the data if passed as an array.
|
||||
if(is_array($options))
|
||||
if (is_array($options))
|
||||
{
|
||||
$values[] = "N";
|
||||
foreach($options as $value)
|
||||
foreach ($options as $value)
|
||||
{
|
||||
if(!is_numeric($value)) { $value = U; }
|
||||
if (!is_numeric($value)) { $value = U; }
|
||||
$values[] = $value;
|
||||
}
|
||||
$options = implode(':', $values);
|
||||
|
||||
+11
-11
@@ -36,7 +36,7 @@ function snmp_get_multi($device, $oids, $options = "-OQUs", $mib = NULL, $mibdir
|
||||
$device['transport'] = "udp";
|
||||
}
|
||||
|
||||
$cmd = $config['snmpget'];
|
||||
$cmd = $config['snmpget'];
|
||||
$cmd .= snmp_gen_auth ($device);
|
||||
|
||||
if ($options) { $cmd .= " " . $options; }
|
||||
@@ -94,18 +94,18 @@ function snmp_get($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
|
||||
echo("Please report this to the Observium team.");
|
||||
}
|
||||
|
||||
$cmd = $config['snmpget'];
|
||||
$cmd = $config['snmpget'];
|
||||
$cmd .= snmp_gen_auth ($device);
|
||||
|
||||
if ($options) { $cmd .= " " . $options; }
|
||||
if ($mib) { $cmd .= " -m " . $mib; }
|
||||
if ($mibdir) { $cmd .= " -M " . $mibdir; }
|
||||
if ($mibdir) { $cmd .= " -M " . $mibdir; }
|
||||
else { $cmd .= " -M ".$config['mibdir']; }
|
||||
if (isset($timeout)) { $cmd .= " -t " . $timeout; }
|
||||
if (isset($retries)) { $cmd .= " -r " . $retries; }
|
||||
$cmd .= " " . $device['transport'].":".$device['hostname'].":".$device['port'];
|
||||
$cmd .= " " . $oid;
|
||||
|
||||
|
||||
if (!$debug) { $cmd .= " 2>/dev/null"; }
|
||||
$data = trim(external_exec($cmd));
|
||||
|
||||
@@ -150,7 +150,7 @@ function snmp_walk($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
|
||||
{
|
||||
$snmpcommand = $config['snmpbulkwalk'];
|
||||
}
|
||||
|
||||
|
||||
$cmd = $snmpcommand;
|
||||
|
||||
$cmd .= snmp_gen_auth ($device);
|
||||
@@ -217,7 +217,7 @@ function snmpwalk_cache_cip($device, $oid, $array, $mib = 0)
|
||||
$cmd = $snmpcommand;
|
||||
$cmd .= snmp_gen_auth ($device);
|
||||
|
||||
$cmd .= " -O snQ";
|
||||
$cmd .= " -O snQ";
|
||||
if ($mib) { $cmd .= " -m $mib"; }
|
||||
$cmd .= " -M ".$config['install_dir']."/mibs";
|
||||
if (isset($timeout)) { $cmd .= " -t " . $timeout; }
|
||||
@@ -286,7 +286,7 @@ function snmp_cache_ifIndex($device)
|
||||
$cmd = $snmpcommand;
|
||||
$cmd .= snmp_gen_auth ($device);
|
||||
|
||||
$cmd .= " -O Qs";
|
||||
$cmd .= " -O Qs";
|
||||
$cmd .= " -M " . $config['install_dir']."/mibs";
|
||||
$cmd .= " -m IF-MIB ifIndex";
|
||||
|
||||
@@ -552,7 +552,7 @@ function snmp_cache_slotport_oid($oid, $device, $array, $mib = 0)
|
||||
$cmd = $snmpcommand;
|
||||
$cmd .= snmp_gen_auth ($device);
|
||||
|
||||
$cmd .= " -O QUs";
|
||||
$cmd .= " -O QUs";
|
||||
if ($mib) { $cmd .= " -m $mib"; }
|
||||
$cmd .= " -M ".$config['install_dir']."/mibs";
|
||||
if (isset($timeout)) { $cmd .= " -t " . $timeout; }
|
||||
@@ -614,7 +614,7 @@ function snmp_cache_port_oids($oids, $port, $device, $array, $mib=0)
|
||||
$cmd = $config['snmpget'];
|
||||
$cmd .= snmp_gen_auth ($device);
|
||||
|
||||
$cmd .= " -O vq";
|
||||
$cmd .= " -O vq";
|
||||
if (isset($timeout)) { $cmd .= " -t " . $timeout; }
|
||||
if (isset($retries)) { $cmd .= " -r " . $retries; }
|
||||
$cmd .= " -M ".$config['install_dir']."/mibs";
|
||||
@@ -663,7 +663,7 @@ function snmp_cache_portIfIndex($device, $array)
|
||||
$cmd = $config['snmpwalk'];
|
||||
$cmd .= snmp_gen_auth ($device);
|
||||
|
||||
$cmd .= " -CI -m CISCO-STACK-MIB -O q";
|
||||
$cmd .= " -CI -m CISCO-STACK-MIB -O q";
|
||||
$cmd .= " -M ".$config['install_dir']."/mibs";
|
||||
if (isset($timeout)) { $cmd .= " -t " . $timeout; }
|
||||
if (isset($retries)) { $cmd .= " -r " . $retries; }
|
||||
@@ -710,7 +710,7 @@ function snmp_cache_portName($device, $array)
|
||||
$cmd = $config['snmpwalk'];
|
||||
$cmd .= snmp_gen_auth ($device);
|
||||
|
||||
$cmd .= " -CI -m CISCO-STACK-MIB -O Qs";
|
||||
$cmd .= " -CI -m CISCO-STACK-MIB -O Qs";
|
||||
$cmd .= " -M ".$config['install_dir']."/mibs";
|
||||
if (isset($timeout)) { $cmd .= " -t " . $timeout; }
|
||||
if (isset($retries)) { $cmd .= " -r " . $retries; }
|
||||
|
||||
Reference in New Issue
Block a user