mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
add support for redback and services discovery (thanks klaver) perhaps need to make services discovery one-time only, triggered, or disableable :>
git-svn-id: http://www.observium.org/svn/observer/trunk@1276 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -129,6 +129,7 @@ while ($device = mysql_fetch_array($device_query))
|
||||
include("includes/discovery/toner.inc.php");
|
||||
include("includes/discovery/ups.inc.php");
|
||||
include("includes/discovery/ucd-diskio.inc.php");
|
||||
include("includes/discovery/services.inc.php");
|
||||
|
||||
if ($device['type'] == "unknown")
|
||||
{
|
||||
|
10
html/pages/device/graphs/os-redback.inc.php
Normal file
10
html/pages/device/graphs/os-redback.inc.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
#include("cpu.inc.php");
|
||||
#include("memory.inc.php");
|
||||
include("temperatures.inc.php");
|
||||
include("netstats.inc.php");
|
||||
include("uptime.inc.php");
|
||||
|
||||
|
||||
?>
|
42
includes/discovery/services.inc.php
Normal file
42
includes/discovery/services.inc.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
$id = $device['device_id'];
|
||||
$hostname = $device['hostname'];
|
||||
$community = $device['community'];
|
||||
$snmpver = $device['snmpver'];
|
||||
$port = $device['port'];
|
||||
|
||||
echo("Services: ");
|
||||
|
||||
$known_services = array(22 => "ssh", 25 => "smtp", 53 => "dns", 80 => "http", 110 => "pop", 143 => "imap");
|
||||
|
||||
function add_service($service) {
|
||||
global $id;
|
||||
global $hostname;
|
||||
echo "$service ";
|
||||
$sql = "INSERT INTO `services` (`device_id`,`service_ip`,`service_type`,`service_desc`,`service_param`,`service_ignore`)
|
||||
VALUES ('" . mres($id). "','" . mres($hostname) . "','" . mres($service) . "',
|
||||
'" . mres("auto discovered: $service") . "','" . mres("") . "','0')";
|
||||
|
||||
$query = mysql_query($sql);
|
||||
}
|
||||
|
||||
## Services
|
||||
if($device['type'] == "server") {
|
||||
$oids = shell_exec($config['snmpwalk'] . " -".$device['snmpver']." -CI -Osqn -c ".$community." ".$hostname.":".$port." .1.3.6.1.2.1.6.13.1.1.0.0.0.0");
|
||||
$oids = trim($oids);
|
||||
foreach(explode("\n", $oids) as $data) {
|
||||
$data = trim($data);
|
||||
if($data) {
|
||||
list($oid, $tcpstatus) = explode(" ", $data);
|
||||
if (trim($tcpstatus)=="listen") {
|
||||
$split_oid = explode('.',$oid);
|
||||
$tcp_port = $split_oid[count($split_oid)-6];
|
||||
if($known_services[$tcp_port]) { add_service($known_services[$tcp_port]); };
|
||||
}
|
||||
}
|
||||
}
|
||||
} ## End Services
|
||||
|
||||
echo("\n");
|
||||
|
||||
?>
|
7
includes/osdiscovery/discover-redback.php
Normal file
7
includes/osdiscovery/discover-redback.php
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
if(!$os) {
|
||||
if(preg_match("/Redback/", $sysDescr)) { $os = "redback"; }
|
||||
}
|
||||
|
||||
?>
|
6
includes/polling/device-redback.inc.php
Normal file
6
includes/polling/device-redback.inc.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
include("ucd-mib.inc.php");
|
||||
include("hr-mib.inc.php");
|
||||
|
||||
?>
|
Reference in New Issue
Block a user