mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 16:04:35 +02:00
Rebased from upstream
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
/* Copyright (C) 2015 Daniel Preussker <f0o@librenms.org>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/**
|
||||
* Clickatell REST-API Transport
|
||||
* @author f0o <f0o@librenms.org>
|
||||
* @copyright 2015 f0o, LibreNMS
|
||||
* @license GPL
|
||||
* @package LibreNMS
|
||||
* @subpackage Alerts
|
||||
*/
|
||||
|
||||
$data = array("api_id" => $opts['api_id'], "user" => $opts['user'], "password" => $opts['password'], "to" => implode(',',$opts['to']), "text" => $obj['title']);
|
||||
if (!empty($opts['from'])) {
|
||||
$data['from'] = $opts['from'];
|
||||
}
|
||||
$url = 'https://api.clickatell.com/http/sendmsg?'.http_build_query($data);
|
||||
$curl = curl_init($url);
|
||||
|
||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$ret = curl_exec($curl);
|
||||
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
if( $code > 200 ) {
|
||||
if( $debug ) {
|
||||
var_dump($ret);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -0,0 +1,42 @@
|
||||
/* Copyright (C) 2015 Daniel Preussker <f0o@librenms.org>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/**
|
||||
* PlaySMS API Transport
|
||||
* @author f0o <f0o@librenms.org>
|
||||
* @copyright 2015 f0o, LibreNMS
|
||||
* @license GPL
|
||||
* @package LibreNMS
|
||||
* @subpackage Alerts
|
||||
*/
|
||||
|
||||
$data = array("u" => $opts['user'], "h" => $opts['token'], "to" => implode(',',$opts['to']), "msg" => $obj['title']);
|
||||
if (!empty($opts['from'])) {
|
||||
$data["from"] = $opts['from'];
|
||||
}
|
||||
$url = $opts['url'].'&op=pv&'.http_build_query($data);
|
||||
$curl = curl_init($url);
|
||||
|
||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
|
||||
$ret = curl_exec($curl);
|
||||
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
if( $code > 202 ) {
|
||||
if( $debug ) {
|
||||
var_dump($ret);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -0,0 +1,57 @@
|
||||
/* Copyright (C) 2015 Daniel Preussker <f0o@devilcode.org>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/**
|
||||
* VictorOps Generic-API Transport - Based on PagerDuty transport
|
||||
* @author f0o <f0o@devilcode.org>
|
||||
* @author laf <neil@librenms.org>
|
||||
* @copyright 2015 f0o, laf, LibreNMS
|
||||
* @license GPL
|
||||
* @package LibreNMS
|
||||
* @subpackage Alerts
|
||||
*/
|
||||
|
||||
$url = $opts['url'];
|
||||
|
||||
$protocol = array(
|
||||
'entity_id' => ($obj['id'] ? $obj['id'] : $obj['uid']),
|
||||
'state_start_time' => strtotime($obj['timestamp']),
|
||||
'monitoring_tool' => 'librenms',
|
||||
);
|
||||
if( $obj['state'] == 0 ) {
|
||||
$protocol['message_type'] = 'recovery';
|
||||
}
|
||||
elseif( $obj['state'] == 2 ) {
|
||||
$protocol['message_type'] = 'acknowledgement';
|
||||
}
|
||||
elseif ($obj['state'] == 1) {
|
||||
$protocol['message_type'] = 'critical';
|
||||
}
|
||||
|
||||
foreach( $obj['faults'] as $fault=>$data ) {
|
||||
$protocol['state_message'] .= $data['string'];
|
||||
}
|
||||
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, $url );
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-type'=> 'application/json'));
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($protocol));
|
||||
$ret = curl_exec($curl);
|
||||
$code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
if( $code != 200 ) {
|
||||
var_dump("VictorOps returned Error, retry later"); //FIXME: propper debuging
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/* Copyright (C) 2015 Daniel Preussker, QuxLabs UG <preussker@quxlabs.com>
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/**
|
||||
* Notification Cache
|
||||
* @author Daniel Preussker
|
||||
* @copyright 2015 Daniel Preussker, QuxLabs UG
|
||||
* @license GPL
|
||||
* @package LibreNMS
|
||||
* @subpackage Notifications
|
||||
*/
|
||||
|
||||
$data['count'] = array(
|
||||
'query' => 'select count(notifications.notifications_id) from notifications where not exists( select 1 from notifications_attribs where notifications.notifications_id = notifications_attribs.notifications_id and notifications_attribs.user_id = ?)',
|
||||
'params' => array( $_SESSION['user_id'] )
|
||||
);
|
||||
|
||||
$data['unread'] = array(
|
||||
'query' => 'select notifications.* from notifications where not exists( select 1 from notifications_attribs where notifications.notifications_id = notifications_attribs.notifications_id and notifications_attribs.user_id = ?) order by notifications.notifications_id desc',
|
||||
'params' => array( $_SESSION['user_id'] )
|
||||
);
|
||||
|
||||
$data['sticky'] = array(
|
||||
'query' => 'select notifications.*,notifications_attribs.user_id from notifications inner join notifications_attribs on notifications.notifications_id = notifications_attribs.notifications_id where notifications_attribs.key = "sticky" && notifications_attribs.value = 1 order by notifications_attribs.attrib_id desc',
|
||||
);
|
||||
|
||||
$data['sticky_count'] = array(
|
||||
'query' => 'select count(notifications.notifications_id) from notifications inner join notifications_attribs on notifications.notifications_id = notifications_attribs.notifications_id where notifications_attribs.key = "sticky" && notifications_attribs.value = 1',
|
||||
);
|
||||
|
||||
$data['read'] = array(
|
||||
'query' => 'select notifications.* from notifications inner join notifications_attribs on notifications.notifications_id = notifications_attribs.notifications_id where notifications_attribs.user_id = ? && ( notifications_attribs.key = "read" && notifications_attribs.value = 1) && not exists( select 1 from notifications_attribs where notifications.notifications_id = notifications_attribs.notifications_id and notifications_attribs.key = "sticky" && notifications_attribs.value = "1") order by notifications_attribs.attrib_id desc',
|
||||
'params' => array( $_SESSION['user_id'] )
|
||||
);
|
||||
|
||||
@@ -795,3 +795,15 @@ function ceph_rrd($gtype) {
|
||||
$rrd = join('-', array('app', 'ceph', $vars['id'], $gtype, $var)).'.rrd';
|
||||
return join('/', array($config['rrd_dir'], $device['hostname'], $rrd));
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse location field for coordinates
|
||||
* @param string location The location field to look for coords in.
|
||||
* @return array Containing the lat and lng coords
|
||||
**/
|
||||
function parse_location($location) {
|
||||
preg_match('/(\[)(-?[0-9\. ]+),[ ]*(-?[0-9\. ]+)(\])/', $location, $tmp_loc);
|
||||
if (!empty($tmp_loc[2]) && !empty($tmp_loc[3])) {
|
||||
return array('lat' => $tmp_loc[2], 'lng' => $tmp_loc[3]);
|
||||
}
|
||||
}//end parse_location()
|
||||
|
||||
@@ -408,6 +408,8 @@ $config['network_map_vis_options'] = '{
|
||||
// Device page options
|
||||
$config['show_overview_tab'] = true;
|
||||
|
||||
$config['cpu_details_overview'] = false; //By default show only average cpu in device overview
|
||||
|
||||
// The device overview page options
|
||||
$config['overview_show_sysDescr'] = true;
|
||||
|
||||
@@ -825,3 +827,6 @@ $config['summary_errors'] = 0;
|
||||
|
||||
// Default width of the availability map's tiles
|
||||
$config['availability-map-width'] = 25;
|
||||
|
||||
// Default notifications Feed
|
||||
$config['notifications']['LibreNMS'] = 'http://www.librenms.org/notifications.rss';
|
||||
|
||||
@@ -107,6 +107,17 @@ $config['os'][$os]['over'][1]['text'] = 'Processor Usage';
|
||||
$config['os'][$os]['over'][2]['graph'] = 'device_ucd_memory';
|
||||
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
|
||||
|
||||
$os = 'infinity';
|
||||
$config['os'][$os]['text'] = 'LigoWave Infinity';
|
||||
$config['os'][$os]['type'] = 'wireless';
|
||||
$config['os'][$os]['nobulk'] = 1;
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
|
||||
$config['os'][$os]['over'][1]['graph'] = 'device_processor';
|
||||
$config['os'][$os]['over'][1]['text'] = 'Processor Usage';
|
||||
$config['os'][$os]['over'][2]['graph'] = 'device_mempool';
|
||||
$config['os'][$os]['over'][2]['text'] = 'Memory Usage';
|
||||
|
||||
// Ubiquiti
|
||||
$os = 'unifi';
|
||||
$config['os'][$os]['text'] = 'Ubiquiti UniFi';
|
||||
@@ -517,6 +528,14 @@ $config['os'][$os]['bad_if'][] = 'cpu';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
|
||||
|
||||
//Quanta switches
|
||||
$os = 'quanta';
|
||||
$config['os'][$os]['text'] = 'Quanta';
|
||||
$config['os'][$os]['type'] = 'network';
|
||||
$config['os'][$os]['icon'] = 'quanta';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
|
||||
|
||||
$os = 'netonix';
|
||||
$config['os'][$os]['text'] = 'Netonix';
|
||||
$config['os'][$os]['type'] = 'network';
|
||||
@@ -1229,6 +1248,8 @@ $os = 'canopy';
|
||||
$config['os'][$os]['text'] = 'Cambium';
|
||||
$config['os'][$os]['type'] = 'wireless';
|
||||
$config['os'][$os]['icon'] = 'cambium';
|
||||
$config['os'][$os]['over'][0]['graph'] = 'device_bits';
|
||||
$config['os'][$os]['over'][0]['text'] = 'Device Traffic';
|
||||
|
||||
$os = 'datacom';
|
||||
$config['os'][$os]['text'] = 'Datacom';
|
||||
|
||||
@@ -47,6 +47,9 @@ function GenGroupSQL($pattern, $search='') {
|
||||
}
|
||||
}
|
||||
|
||||
$pattern = rtrim($pattern, '&&');
|
||||
$pattern = rtrim($pattern, '||');
|
||||
|
||||
$tables = array_keys(array_flip($tables));
|
||||
$x = sizeof($tables);
|
||||
$i = 0;
|
||||
|
||||
@@ -37,6 +37,9 @@ if ($config['enable_inventory']) {
|
||||
$entPhysicalIsFRU = $entry['jnxFruType'];
|
||||
$entPhysicalAlias = $entry['entPhysicalAlias'];
|
||||
$entPhysicalAssetID = $entry['entPhysicalAssetID'];
|
||||
// fix for issue 1865, $entPhysicalIndex, as it contains a quad dotted number on newer Junipers
|
||||
// using str_replace to remove all dots should fix this even if it changes in future
|
||||
$entPhysicalIndex = str_replace('.','',$entPhysicalIndex);
|
||||
}
|
||||
else {
|
||||
$entPhysicalDescr = $entry['entPhysicalDescr'];
|
||||
@@ -127,18 +130,7 @@ if ($config['enable_inventory']) {
|
||||
echo '+';
|
||||
}//end if
|
||||
|
||||
if ($device['os'] == 'junos') {
|
||||
// $entPhysicalIndex appears as a numeric OID fragment
|
||||
// (string), so convert it to an "integer" for the
|
||||
// validation step below since it is stored in the DB as
|
||||
// an integer. This should be fixed.
|
||||
list($first,$second) = explode('.', $entPhysicalIndex);
|
||||
$entPhysicalIndexNoDots = $first.$second;
|
||||
$valid[$entPhysicalIndexNoDots] = 1;
|
||||
}
|
||||
else {
|
||||
$valid[$entPhysicalIndex] = 1;
|
||||
}
|
||||
$valid[$entPhysicalIndex] = 1;
|
||||
}//end if
|
||||
}//end foreach
|
||||
}
|
||||
|
||||
@@ -34,7 +34,8 @@ function discover_new_device($hostname, $device='', $method='', $interface='') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
elseif (filter_var($dst_host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) === true || filter_var($dst_host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === true){
|
||||
// gethostbyname returned a valid $ip, was $dst_host an IP?
|
||||
if ($config['discovery_by_ip'] === false) {
|
||||
d_echo('Discovery by IP disabled, skipping ' . $dst_host);
|
||||
return false;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS LigoWave Inifinity memory information module
|
||||
*
|
||||
* Copyright (c) 2015 Mike Rostermund <mike@kollegienet.dk>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'infinity') {
|
||||
echo 'INFINITY-MEMORY-POOL: ';
|
||||
|
||||
$total = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.1.0', '-OvQ');
|
||||
$free = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.2.0', '-OvQ');
|
||||
|
||||
if (is_numeric($total) && is_numeric($free)) {
|
||||
discover_mempool($valid_mempool, $device, 0, 'infinity', 'Memory', '1', null, null);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
if (!$os) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.4413')) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.4413') && !stristr($sysDescr, 'vxworks')) {
|
||||
$os = 'edgeswitch';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS LigoWave os detection module
|
||||
*
|
||||
* Copyright (c) 2015 Mike Rostermund <mike@kollegienet.dk>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if (!$os) {
|
||||
if (preg_match('/^NFT 2N/', $sysDescr)) {
|
||||
$os = 'infinity';
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
$version = snmp_get($device, 'firmwareVersion.0', '-Osqnv', 'NETONIX-SWITCH-MIB', 'mibs:mibs/netonix/');
|
||||
list(,$version) = explode(': ', $version);
|
||||
if (is_numeric($version)) {
|
||||
$os = 'netonix';
|
||||
if (!$os) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.46242')) {
|
||||
$os = 'netonix';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
if (!$os) {
|
||||
if (preg_match('/^Cisco\ PIX/', $sysDescr)) {
|
||||
if (preg_match('/Cisco\ PIX/', $sysDescr)) {
|
||||
$os = 'pixos';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
if (!$os) {
|
||||
if (strstr($sysObjectId, '.1.3.6.1.4.1.4413') && stristr($sysDescr, 'vxworks')) {
|
||||
$os = 'quanta';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS LigoWave Infinity CPU information module
|
||||
*
|
||||
* Copyright (c) 2015 Mike Rostermund <mike@kollegienet.dk>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
if ($device['os'] == 'infinity') {
|
||||
echo 'LigoWave Infinity: ';
|
||||
|
||||
$descr = 'CPU';
|
||||
$usage = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.4.2.1.3.2', '-Ovqn');
|
||||
|
||||
if (is_numeric($usage)) {
|
||||
discover_processor($valid['processor'], $device, '.1.3.6.1.4.1.10002.1.1.1.4.2.1.3.2', '0', 'infinity', $descr, '1', $usage, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
unset($processors_array);
|
||||
@@ -1278,3 +1278,31 @@ function host_exists($hostname) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the innodb buffer size
|
||||
*
|
||||
* @return array including the current set size and the currently used buffer
|
||||
**/
|
||||
function innodb_buffer_check() {
|
||||
$pool['size'] = dbFetchCell('SELECT @@innodb_buffer_pool_size');
|
||||
// The following query is from the excellent mysqltuner.pl by Major Hayden https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl
|
||||
$pool['used'] = dbFetchCell('SELECT SUM(DATA_LENGTH+INDEX_LENGTH) FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ("information_schema", "performance_schema", "mysql") AND ENGINE = "InnoDB" GROUP BY ENGINE ORDER BY ENGINE ASC');
|
||||
return $pool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print warning about InnoDB buffer size
|
||||
*
|
||||
* @param array $innodb_buffer An array that contains the used and current size
|
||||
*
|
||||
* @return string $output
|
||||
**/
|
||||
function warn_innodb_buffer($innodb_buffer) {
|
||||
$output = 'InnoDB Buffersize too small.'.PHP_EOL;
|
||||
$output .= 'Current size: '.($innodb_buffer['size'] / 1024 / 1024).' MiB'.PHP_EOL;
|
||||
$output .= 'Minimum Required: '.($innodb_buffer['used'] / 1024 / 1024).' MiB'.PHP_EOL;
|
||||
$output .= 'To ensure integrity, we\'re not going to pull any updates until the buffersize has been adjusted.'.PHP_EOL;
|
||||
$output .= 'Config proposal: "innodb_buffer_pool_size = '.pow(2,ceil(log(($innodb_buffer['used'] / 1024 / 1024),2))).'M"'.PHP_EOL;
|
||||
return $output;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,10 @@ class ObjCache implements ArrayAccess {
|
||||
return $GLOBALS['_ObjCache'][$this->obj][$obj]['value'];
|
||||
}
|
||||
else {
|
||||
$GLOBALS['_ObjCache'][$this->obj][$obj]['value'] = dbFetchCell($this->data[$obj]['query'], $this->data[$obj]['params']);
|
||||
$GLOBALS['_ObjCache'][$this->obj][$obj]['value'] = dbFetchRows($this->data[$obj]['query'], $this->data[$obj]['params']);
|
||||
if (sizeof($GLOBALS['_ObjCache'][$this->obj][$obj]['value']) == 1 && sizeof($GLOBALS['_ObjCache'][$this->obj][$obj]['value'][0]) == 1) {
|
||||
$GLOBALS['_ObjCache'][$this->obj][$obj]['value'] = current($GLOBALS['_ObjCache'][$this->obj][$obj]['value'][0]);
|
||||
}
|
||||
return $GLOBALS['_ObjCache'][$this->obj][$obj]['value'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,12 @@ $options = '-O qv';
|
||||
$mib = 'NET-SNMP-EXTEND-MIB';
|
||||
$oid = 'nsExtendOutputFull.8.112.111.119.101.114.100.110.115';
|
||||
|
||||
$powerdns = snmp_get($device, $oid, $options, $mib);
|
||||
if ($agent_data['app']['powerdns']) {
|
||||
$powerdns = $agent_data['app']['powerdns'];
|
||||
}
|
||||
else {
|
||||
$powerdns = snmp_get($device, $oid, $options, $mib);
|
||||
}
|
||||
|
||||
echo ' powerdns';
|
||||
|
||||
|
||||
@@ -41,16 +41,16 @@ function proxmox_vm_exists($i, $c, &$pmxcache) {
|
||||
|
||||
$pmxlines = explode("\n", $proxmox);
|
||||
|
||||
if (count($pmxlines) > 2) {
|
||||
$pmxcluster = array_shift($pmxlines);
|
||||
$pmxcluster = array_shift($pmxlines);
|
||||
|
||||
$pmxcdir = join('/', array($config['rrd_dir'],'proxmox',$pmxcluster));
|
||||
if (!is_dir($pmxcdir)) {
|
||||
mkdir($pmxcdir, 0775, true);
|
||||
}
|
||||
$pmxcdir = join('/', array($config['rrd_dir'],'proxmox',$pmxcluster));
|
||||
if (!is_dir($pmxcdir)) {
|
||||
mkdir($pmxcdir, 0775, true);
|
||||
}
|
||||
|
||||
dbUpdate(array('device_id' => $device['device_id'], 'app_type' => 'proxmox', 'app_instance' => $pmxcluster), 'applications', '`device_id` = ? AND `app_type` = ?', array($device['device_id'], 'proxmox'));
|
||||
dbUpdate(array('device_id' => $device['device_id'], 'app_type' => 'proxmox', 'app_instance' => $pmxcluster), 'applications', '`device_id` = ? AND `app_type` = ?', array($device['device_id'], 'proxmox'));
|
||||
|
||||
if (count($pmxlines) > 0) {
|
||||
$pmxcache = [];
|
||||
|
||||
foreach ($pmxlines as $vm) {
|
||||
|
||||
@@ -445,7 +445,10 @@ function location_to_latlng($device) {
|
||||
if (!empty($device_location)) {
|
||||
$new_device_location = preg_replace("/ /","+",$device_location);
|
||||
// We have a location string for the device.
|
||||
$loc = dbFetchRow("SELECT `lat`,`lng` FROM `locations` WHERE `location`=? LIMIT 1", array($device_location));
|
||||
$loc = parse_location($device_location);
|
||||
if (!is_array($loc)) {
|
||||
$loc = dbFetchRow("SELECT `lat`,`lng` FROM `locations` WHERE `location`=? LIMIT 1", array($device_location));
|
||||
}
|
||||
if (is_array($loc) === false) {
|
||||
// Grab data from which ever Geocode service we use.
|
||||
switch ($config['geoloc']['engine']) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS LigoWave Infinity memory information module
|
||||
*
|
||||
* Copyright (c) 2015 Mike Rostermund <mike@kollegienet.dk>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
$total = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.1.0', '-OvQ');
|
||||
$free = snmp_get($device, '.1.3.6.1.4.1.10002.1.1.1.1.2.0', '-OvQ');
|
||||
$mempool['total'] = $total * 1024;
|
||||
$mempool['free'] = $free * 1024;
|
||||
$mempool['used'] = ($mempool['total'] - $mempool['free']);
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/*
|
||||
* LibreNMS LigoWave Infinity OS information module
|
||||
*
|
||||
* Copyright (c) 2015 Mike Rostermund <mike@kollegienet.dk>
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version. Please see LICENSE.txt at the top level of
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
$version = snmp_get($device, 'SNMPv2-MIB::sysDescr.0', '-Ovq');
|
||||
$version = explode(' ', $version)[2];
|
||||
$hardware = snmp_get($device, 'IEEE802dot11-MIB::dot11manufacturerProductName.5', '-Ovq');
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
list($hardware, $features, $version) = explode(',', $poll_device['sysDescr']);
|
||||
@@ -63,6 +63,7 @@ if ($device['os_group'] == 'unix') {
|
||||
"mysql",
|
||||
"nginx",
|
||||
"bind",
|
||||
"powerdns",
|
||||
"proxmox",
|
||||
"tinydns");
|
||||
|
||||
@@ -113,7 +114,7 @@ if ($device['os_group'] == 'unix') {
|
||||
if (file_exists("includes/polling/applications/$key.inc.php")) {
|
||||
d_echo("Enabling $key for ".$device['hostname']." if not yet enabled\n");
|
||||
|
||||
if (in_array($key, array('apache', 'mysql', 'nginx', 'proxmox', 'ceph'))) {
|
||||
if (in_array($key, array('apache', 'mysql', 'nginx', 'proxmox', 'ceph', 'powerdns'))) {
|
||||
if (dbFetchCell('SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ?', array($device['device_id'], $key)) == '0') {
|
||||
echo "Found new application '$key'\n";
|
||||
dbInsert(array('device_id' => $device['device_id'], 'app_type' => $key, 'app_status' => '', 'app_instance' => ''), 'applications');
|
||||
|
||||
Reference in New Issue
Block a user