mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-03 08:01:38 +02:00
syntaxer run
git-svn-id: http://www.observium.org/svn/observer/trunk@2967 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -3,16 +3,17 @@
|
||||
function format_bytes_billing($value)
|
||||
{
|
||||
global $config;
|
||||
|
||||
return format_number($value, $config['billing']['base'])."B";
|
||||
}
|
||||
|
||||
function format_bytes_billing_short($value)
|
||||
{
|
||||
global $config;
|
||||
|
||||
return format_number($value, $config['billing']['base'], 2, 3);
|
||||
}
|
||||
|
||||
|
||||
function getDates($dayofmonth, $months=0)
|
||||
{
|
||||
$dayofmonth = zeropad($dayofmonth);
|
||||
@@ -36,7 +37,6 @@ function getDates($dayofmonth, $months=0)
|
||||
date_sub($date_end, date_interval_create_from_date_string($months.' month'));
|
||||
}
|
||||
|
||||
|
||||
# date_sub($date_start, date_interval_create_from_date_string('1 month'));
|
||||
date_sub($date_end, date_interval_create_from_date_string('1 day'));
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ $config['unflatten'] = "/usr/bin/unflatten";
|
||||
$config['neato'] = "/usr/bin/neato";
|
||||
$config['sfdp'] = "/usr/bin/sfdp";
|
||||
|
||||
|
||||
### Memcached - Keep immediate statistics
|
||||
|
||||
$config['memcached']['enable'] = FALSE;
|
||||
@@ -46,7 +45,6 @@ $config['memcached']['port'] = 11211;
|
||||
|
||||
$config['slow_statistics'] = TRUE; ### THIS WILL CHANGE TO FALSE IN FUTURE
|
||||
|
||||
|
||||
### RRDCacheD - Make sure it can write to your RRD dir!
|
||||
|
||||
#$config['rrdcached'] = "unix:/var/run/rrdcached.sock";
|
||||
@@ -57,7 +55,7 @@ if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["SERVER_PORT"]))
|
||||
{
|
||||
if (strpos($_SERVER["SERVER_NAME"] , ":"))
|
||||
{
|
||||
# Litteral IPv6
|
||||
# Literal IPv6
|
||||
$config['base_url'] = "http://[" . $_SERVER["SERVER_NAME"] ."]:".$_SERVER["SERVER_PORT"]."/";
|
||||
}
|
||||
else
|
||||
@@ -98,12 +96,12 @@ $config['snmp']['transports'] = array('udp', 'udp6', 'tcp', 'tcp6');
|
||||
|
||||
### Autodiscovery Settings
|
||||
|
||||
$config['autodiscovery']['xdp'] = true; ## Autodiscover hosts via discovery protocols
|
||||
$config['autodiscovery']['ospf'] = true; ## Autodiscover hosts via OSPF
|
||||
$config['autodiscovery']['bgp'] = true; ## Autodiscover hosts via BGP
|
||||
$config['autodiscovery']['snmpscan'] = true; ## autodiscover hosts via SNMP scanning
|
||||
$config['autodiscovery']['xdp'] = TRUE; ## Autodiscover hosts via discovery protocols
|
||||
$config['autodiscovery']['ospf'] = TRUE; ## Autodiscover hosts via OSPF
|
||||
$config['autodiscovery']['bgp'] = TRUE; ## Autodiscover hosts via BGP
|
||||
$config['autodiscovery']['snmpscan'] = TRUE; ## autodiscover hosts via SNMP scanning
|
||||
|
||||
$config['discover_services'] = false; ## Autodiscover services via SNMP on devices of type "server"
|
||||
$config['discover_services'] = FALSE; ## Autodiscover services via SNMP on devices of type "server"
|
||||
|
||||
### Alerting Settings
|
||||
|
||||
@@ -160,11 +158,11 @@ $config['graph_colours']['default'] = $config['graph_colours']['blues'];
|
||||
|
||||
### Device page options
|
||||
|
||||
$config['show_overview_tab'] = true;
|
||||
$config['show_overview_tab'] = TRUE;
|
||||
|
||||
### The device overview page options
|
||||
|
||||
$config['overview_show_sysDescr'] = true;
|
||||
$config['overview_show_sysDescr'] = TRUE;
|
||||
|
||||
### Enable version checker & stats
|
||||
|
||||
@@ -296,7 +294,7 @@ $config['irc_chan'][] = "#observium";
|
||||
|
||||
### Authentication
|
||||
|
||||
$config['allow_unauth_graphs'] = 0; ## Allow graphs to be viewed by anyone
|
||||
$config['allow_unauth_graphs'] = 0; # Allow graphs to be viewed by anyone
|
||||
$config['allow_unauth_graphs_cidr'] = array(); # Allow graphs to be viewed without authorisation from certain IP ranges
|
||||
$config['auth_mechanism'] = "mysql"; # Available mechanisms: mysql (default), ldap, http-auth
|
||||
|
||||
@@ -372,7 +370,6 @@ $config['astext'][65333] = "Cymru Bogon Feed";
|
||||
### Warnings on front page
|
||||
$config['warn']['ifdown'] = TRUE; ## Show down interfaces
|
||||
|
||||
|
||||
## List of poller modules. Need to be in the array to be
|
||||
## considered for execution.
|
||||
|
||||
@@ -434,7 +431,6 @@ $config['discovery_modules']['toner'] = 1;
|
||||
$config['discovery_modules']['ucd-diskio'] = 1;
|
||||
$config['discovery_modules']['services'] = 1;
|
||||
|
||||
|
||||
$config['modules_compat']['rfc1628']['liebert'] = 1;
|
||||
$config['modules_compat']['rfc1628']['netmanplus'] = 1;
|
||||
$config['modules_compat']['rfc1628']['deltaups'] = 1;
|
||||
|
||||
@@ -575,6 +575,7 @@ function include_dir($dir, $regex = "")
|
||||
if (filetype($config['install_dir'] . '/' . $dir . '/' . $file) == 'file' && preg_match($regex, $file))
|
||||
{
|
||||
if ($debug) { echo("Including: " . $config['install_dir'] . '/' . $dir . '/' . $file . "\n"); }
|
||||
|
||||
include($config['install_dir'] . '/' . $dir . '/' . $file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
if (filetype($config['install_dir'] . '/' . $include_dir . '/' . $file) == 'file' && preg_match($include_dir_regexp, $file))
|
||||
{
|
||||
if ($debug) { echo("Including: " . $config['install_dir'] . '/' . $include_dir . '/' . $file . "\n"); }
|
||||
|
||||
include($config['install_dir'] . '/' . $include_dir . '/' . $file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ function rrdtool_pipe_open(&$rrd_process, &$rrd_pipes)
|
||||
|
||||
function rrdtool_pipe_close(&$rrd_process, &$rrd_pipes)
|
||||
{
|
||||
|
||||
global $debug;
|
||||
|
||||
if ($debug)
|
||||
{
|
||||
echo stream_get_contents($rrd_pipes[1]);
|
||||
|
||||
@@ -33,7 +33,6 @@ $config['os'][$os]['over'][1]['text'] = "Processor Usage";
|
||||
$config['os'][$os]['over'][2]['graph'] = "device_mempool";
|
||||
$config['os'][$os]['over'][2]['text'] = "Memory Usage";
|
||||
|
||||
|
||||
### Linux-based OSes here please.
|
||||
|
||||
$os = "linux";
|
||||
@@ -389,7 +388,6 @@ $config['os'][$os]['icon'] = "brocade";
|
||||
$config['os'][$os]['over'][0]['graph'] = "device_bits";
|
||||
$config['os'][$os]['over'][0]['text'] = "Device Traffic";
|
||||
|
||||
|
||||
$os = "extremeware";
|
||||
$config['os'][$os]['text'] = "Extremeware";
|
||||
$config['os'][$os]['type'] = "network";
|
||||
@@ -457,7 +455,6 @@ $config['os'][$os]['over'][0]['text'] = "Device Traffic";
|
||||
$config['os'][$os]['over'][1]['graph'] = "device_processor";
|
||||
$config['os'][$os]['over'][1]['text'] = "CPU Usage";
|
||||
|
||||
|
||||
$os = "proxim";
|
||||
$config['os'][$os]['text'] = "Proxim";
|
||||
$config['os'][$os]['type'] = "network";
|
||||
|
||||
+26
-14
@@ -6,16 +6,20 @@
|
||||
|
||||
# $device_id_ip = @dbFetchCell("SELECT device_id FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = '" . $entry['host']."' AND I.interface_id = A.interface_id");
|
||||
|
||||
function get_cache($host, $value) {
|
||||
function get_cache($host, $value)
|
||||
{
|
||||
global $dev_cache;
|
||||
|
||||
if (!isset($dev_cache[$host][$value])) {
|
||||
switch($value) {
|
||||
if (!isset($dev_cache[$host][$value]))
|
||||
{
|
||||
switch($value)
|
||||
{
|
||||
case 'device_id':
|
||||
// Try by hostname
|
||||
$dev_cache[$host]['device_id'] = dbFetchCell('SELECT `device_id` FROM devices WHERE `hostname` = ? OR `sysName` = ?', array($host, $host));
|
||||
// If failed, try by IP
|
||||
if (!is_numeric($dev_cache[$host]['device_id'])) {
|
||||
if (!is_numeric($dev_cache[$host]['device_id']))
|
||||
{
|
||||
$dev_cache[$host]['device_id'] = dbFetchCell('SELECT `device_id` FROM `ipv4_addresses` AS A, `ports` AS I WHERE A.ipv4_address = ? AND I.interface_id = A.interface_id', array($host));
|
||||
}
|
||||
break;
|
||||
@@ -32,9 +36,9 @@ function get_cache($host, $value) {
|
||||
return $dev_cache[$host][$value];
|
||||
}
|
||||
|
||||
function process_syslog ($entry, $update) {
|
||||
global $config;
|
||||
global $dev_cache;
|
||||
function process_syslog($entry, $update)
|
||||
{
|
||||
global $config, $dev_cache;
|
||||
|
||||
foreach ($config['syslog_filter'] as $bi)
|
||||
{
|
||||
@@ -47,10 +51,12 @@ function process_syslog ($entry, $update) {
|
||||
}
|
||||
|
||||
$entry['device_id'] = get_cache($entry['host'], 'device_id');
|
||||
if ($entry['device_id']) {
|
||||
if ($entry['device_id'])
|
||||
{
|
||||
$os = get_cache($entry['host'], 'os');
|
||||
|
||||
if (in_array($os, array('ios', 'iosxe', 'catos'))) {
|
||||
if (in_array($os, array('ios', 'iosxe', 'catos')))
|
||||
{
|
||||
$matches = array();
|
||||
# if (preg_match('#%(?P<program>.*):( ?)(?P<msg>.*)#', $entry['msg'], $matches)) {
|
||||
# $entry['msg'] = $matches['msg'];
|
||||
@@ -98,17 +104,20 @@ function process_syslog ($entry, $update) {
|
||||
} elseif($os == 'linux') {
|
||||
$matches = array();
|
||||
// User_CommonName/123.213.132.231:39872 VERIFY OK: depth=1, /C=PL/ST=Malopolska/O=VLO/CN=v-lo.krakow.pl/emailAddress=root@v-lo.krakow.pl
|
||||
if ($entry['facility'] == 'daemon' and preg_match('#/([0-9]{1,3}\.) {3}[0-9]{1,3}:[0-9]{4,} ([A-Z]([A-Za-z])+( ?)) {2,}:#', $entry['msg'])) {
|
||||
if ($entry['facility'] == 'daemon' and preg_match('#/([0-9]{1,3}\.) {3}[0-9]{1,3}:[0-9]{4,} ([A-Z]([A-Za-z])+( ?)) {2,}:#', $entry['msg']))
|
||||
{
|
||||
$entry['program'] = 'OpenVPN';
|
||||
}
|
||||
// pop3-login: Login: user=<username>, method=PLAIN, rip=123.213.132.231, lip=123.213.132.231, TLS
|
||||
// POP3(username): Disconnected: Logged out top=0/0, retr=0/0, del=0/1, size=2802
|
||||
elseif($entry['facility'] == 'mail' and preg_match('#^(((pop3|imap)\-login)|((POP3|IMAP)\(.*\))):', $entry['msg'])) {
|
||||
elseif($entry['facility'] == 'mail' and preg_match('#^(((pop3|imap)\-login)|((POP3|IMAP)\(.*\))):', $entry['msg']))
|
||||
{
|
||||
$entry['program'] = 'Dovecot';
|
||||
}
|
||||
// pam_krb5(sshd:auth): authentication failure; logname=root uid=0 euid=0 tty=ssh ruser= rhost=123.213.132.231
|
||||
// pam_krb5[sshd:auth]: authentication failure; logname=root uid=0 euid=0 tty=ssh ruser= rhost=123.213.132.231
|
||||
elseif(preg_match('#^(?P<program>(.*((\(|\[).*(\)|\])))):(?P<msg>.*)$#', $entry['msg'], $matches)) {
|
||||
elseif(preg_match('#^(?P<program>(.*((\(|\[).*(\)|\])))):(?P<msg>.*)$#', $entry['msg'], $matches))
|
||||
{
|
||||
$entry['msg'] = $matches['msg'];
|
||||
$entry['program'] = $matches['program'];
|
||||
}
|
||||
@@ -122,16 +131,19 @@ function process_syslog ($entry, $update) {
|
||||
# $entry['msg'] = substr($entry['msg'], $pos+1);
|
||||
#}
|
||||
// fallback, better than nothing...
|
||||
elseif(empty($entry['program']) and !empty($entry['facility'])) {
|
||||
elseif(empty($entry['program']) and !empty($entry['facility']))
|
||||
{
|
||||
$entry['program'] = $entry['facility'];
|
||||
}
|
||||
unset($matches);
|
||||
}
|
||||
|
||||
if (!isset($entry['program'])) {
|
||||
if (!isset($entry['program']))
|
||||
{
|
||||
$entry['program'] = $entry['msg'];
|
||||
unset($entry['msg']);
|
||||
}
|
||||
|
||||
$entry['program'] = strtoupper($entry['program']);
|
||||
array_walk($entry, 'trim');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user