From dc0ebc7343ff7701727191cd71ffe0ac6c5ff776 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Tue, 20 Sep 2011 14:22:34 +0000 Subject: [PATCH] more code cleanup git-svn-id: http://www.observium.org/svn/observer/trunk@2517 61d68cd4-352d-0410-923a-c4978735b2b8 --- includes/cisco-entities.php | 36 +- includes/common.php | 6 +- includes/dbFacile.php | 463 ++++++++--------- includes/defaults.inc.php | 46 +- includes/discovery/cisco-cef.inc.php | 6 +- .../discovery/cisco-entity-sensor.inc.php | 8 +- includes/discovery/cisco-pw.inc.php | 22 +- includes/discovery/current/apc.inc.php | 42 +- includes/discovery/current/sentry3.inc.php | 4 +- .../discovery/discovery-protocols.inc.php | 44 +- includes/discovery/entity-physical.inc.php | 28 +- includes/discovery/functions.inc.php | 10 +- includes/discovery/os/linux.inc.php | 4 +- includes/discovery/ports-stack.inc.php | 10 +- .../discovery/processors/hrdevice.inc.php | 2 +- includes/discovery/processors/ios.inc.php | 14 +- .../discovery/processors/ironware.inc.php | 2 +- .../temperatures/cometsystem-p85xx.inc.php | 18 +- .../discovery/voltages/supermicro.inc.php | 2 +- includes/functions.php | 10 +- includes/polling/applications/mysql.inc.php | 182 +++---- includes/polling/applications/nginx.inc.php | 34 +- includes/polling/cipsec-tunnels.inc.php | 2 +- includes/polling/cisco-cef.inc.php | 6 +- includes/polling/functions.inc.php | 4 +- includes/polling/os/sentry3.inc.php | 6 +- includes/polling/os/unix.inc.php | 4 +- includes/polling/ospf.inc.php | 2 +- includes/polling/ports.inc.php | 6 +- includes/rewrites.php | 4 +- includes/snom-graphing.php | 5 +- includes/static-config.php | 476 +++++++++--------- includes/syslog.php | 22 +- includes/versioncheck.inc.php | 8 +- 34 files changed, 775 insertions(+), 763 deletions(-) diff --git a/includes/cisco-entities.php b/includes/cisco-entities.php index 4d8cb64d2e..c3aa33b472 100755 --- a/includes/cisco-entities.php +++ b/includes/cisco-entities.php @@ -3,23 +3,23 @@ ## List of real names for cisco entities $entPhysicalVendorTypes = array ( - 'cevC7xxxIo1feTxIsl' => 'C7200-IO-FE-MII', - 'cevChassis7140Dualfe' => 'C7140-2FE', - 'cevChassis7204' => "C7204", - 'cevChassis7204Vxr' => 'C7204VXR', - 'cevChassis7206' => 'C7206', - 'cevChassis7206Vxr' => 'C7206VXR', - 'cevCpu7200Npe200' => 'NPE-200', - 'cevCpu7200Npe225' => 'NPE-225', - 'cevCpu7200Npe300' => 'NPE-300', - 'cevCpu7200Npe400' => 'NPE-400', - 'cevCpu7200Npeg1' => 'NPE-G1', - 'cevCpu7200Npeg2' => 'NPE-G2', - 'cevPa1feTxIsl' => 'PA-FE-TX-ISL', - 'cevPa2feTxI82543' => 'PA-2FE-TX', - 'cevPa8e' => 'PA-8E', - 'cevPaA8tX21' => 'PA-8T-X21', - 'cevMGBIC1000BaseLX' => '1000BaseLX GBIC', - 'cevPort10GigBaseLR' => '10GigBaseLR'); + 'cevC7xxxIo1feTxIsl' => 'C7200-IO-FE-MII', + 'cevChassis7140Dualfe' => 'C7140-2FE', + 'cevChassis7204' => "C7204", + 'cevChassis7204Vxr' => 'C7204VXR', + 'cevChassis7206' => 'C7206', + 'cevChassis7206Vxr' => 'C7206VXR', + 'cevCpu7200Npe200' => 'NPE-200', + 'cevCpu7200Npe225' => 'NPE-225', + 'cevCpu7200Npe300' => 'NPE-300', + 'cevCpu7200Npe400' => 'NPE-400', + 'cevCpu7200Npeg1' => 'NPE-G1', + 'cevCpu7200Npeg2' => 'NPE-G2', + 'cevPa1feTxIsl' => 'PA-FE-TX-ISL', + 'cevPa2feTxI82543' => 'PA-2FE-TX', + 'cevPa8e' => 'PA-8E', + 'cevPaA8tX21' => 'PA-8T-X21', + 'cevMGBIC1000BaseLX' => '1000BaseLX GBIC', + 'cevPort10GigBaseLR' => '10GigBaseLR'); ?> diff --git a/includes/common.php b/includes/common.php index dcfeed252e..18b213f73c 100644 --- a/includes/common.php +++ b/includes/common.php @@ -4,7 +4,7 @@ function isCli() { - if(php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) { + if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) { return true; } else { return false; @@ -13,7 +13,7 @@ function isCli() { function print_error($text) { - if(isCli()) { + if (isCli()) { print Console_Color::convert("%r".$text."%n\n", false); } else { echo('
'.$text.'
'); @@ -22,7 +22,7 @@ function print_error($text) function print_message($text) { - if(isCli()) { + if (isCli()) { print Console_Color::convert("%g".$text."%n\n", false); } else { echo('
'.$text.'
'); diff --git a/includes/dbFacile.php b/includes/dbFacile.php index 2c1d7e791b..a0acba9976 100644 --- a/includes/dbFacile.php +++ b/includes/dbFacile.php @@ -22,29 +22,30 @@ Usage * Used by the other _query functions. * */ function dbQuery($sql, $parameters = array()) { - global $fullSql, $debug; - $fullSql = dbMakeQuery($sql, $parameters); - if($debug) { echo(" SQL[".$fullSql."] "); } - /* - if($this->logFile) - $time_start = microtime(true); - */ + global $fullSql, $debug; -# echo($fullSql); + $fullSql = dbMakeQuery($sql, $parameters); + if ($debug) { echo(" SQL[".$fullSql."] "); } + /* + if($this->logFile) + $time_start = microtime(true); + */ - $result = mysql_query($fullSql); // sets $this->result - /* - if($this->logFile) { - $time_end = microtime(true); - fwrite($this->logFile, date('Y-m-d H:i:s') . "\n" . $fullSql . "\n" . number_format($time_end - $time_start, 8) . " seconds\n\n"); - } - */ +# echo($fullSql); - if($result === false && (error_reporting() & 1)) { - // aye. this gets triggers on duplicate Contact insert - //trigger_error('QDB - Error in query: ' . $fullSql . ' : ' . mysql_error(), E_USER_WARNING); - } - return $result; + $result = mysql_query($fullSql); // sets $this->result + /* + if($this->logFile) { + $time_end = microtime(true); + fwrite($this->logFile, date('Y-m-d H:i:s') . "\n" . $fullSql . "\n" . number_format($time_end - $time_start, 8) . " seconds\n\n"); + } + */ + + if($result === false && (error_reporting() & 1)) { + // aye. this gets triggers on duplicate Contact insert + //trigger_error('QDB - Error in query: ' . $fullSql . ' : ' . mysql_error(), E_USER_WARNING); + } + return $result; } /* @@ -52,37 +53,39 @@ function dbQuery($sql, $parameters = array()) { * Check for boolean false to determine whether insert failed * */ function dbInsert($data, $table) { - global $fullSql; - global $db_stats; - // the following block swaps the parameters if they were given in the wrong order. - // it allows the method to work for those that would rather it (or expect it to) - // follow closer with SQL convention: - // insert into the TABLE this DATA - if(is_string($data) && is_array($table)) { - $tmp = $data; - $data = $table; - $table = $tmp; - //trigger_error('QDB - Parameters passed to insert() were in reverse order, but it has been allowed', E_USER_NOTICE); - } + global $fullSql; - $sql = 'INSERT INTO `' . $table . '` (`' . implode('`,`', array_keys($data)) . '`) VALUES (' . implode(',', dbPlaceHolders($data)) . ')'; + global $db_stats; + + // the following block swaps the parameters if they were given in the wrong order. + // it allows the method to work for those that would rather it (or expect it to) + // follow closer with SQL convention: + // insert into the TABLE this DATA + if(is_string($data) && is_array($table)) { + $tmp = $data; + $data = $table; + $table = $tmp; + //trigger_error('QDB - Parameters passed to insert() were in reverse order, but it has been allowed', E_USER_NOTICE); + } + + $sql = 'INSERT INTO `' . $table . '` (`' . implode('`,`', array_keys($data)) . '`) VALUES (' . implode(',', dbPlaceHolders($data)) . ')'; $time_start = microtime(true); - dbBeginTransaction(); - $result = dbQuery($sql, $data); - if($result) { - $id = mysql_insert_id(); - dbCommitTransaction(); - #return $id; - } else { - if($table != 'Contact') { - trigger_error('QDB - Insert failed.', E_USER_WARNING); - } - dbRollbackTransaction(); - #$id = false; - } + dbBeginTransaction(); + $result = dbQuery($sql, $data); + if($result) { + $id = mysql_insert_id(); + dbCommitTransaction(); + #return $id; + } else { + if($table != 'Contact') { + trigger_error('QDB - Insert failed.', E_USER_WARNING); + } + dbRollbackTransaction(); + #$id = false; + } - #logfile($fullSql); + #logfile($fullSql); $time_end = microtime(true); $db_stats['insert_sec'] += number_format($time_end - $time_start, 8); @@ -97,40 +100,42 @@ function dbInsert($data, $table) { * Returns the number of affected rows * */ function dbUpdate($data, $table, $where = null, $parameters = array()) { - global $fullSql; + global $fullSql; + global $db_stats; - // the following block swaps the parameters if they were given in the wrong order. - // it allows the method to work for those that would rather it (or expect it to) - // follow closer with SQL convention: - // update the TABLE with this DATA - if(is_string($data) && is_array($table)) { - $tmp = $data; - $data = $table; - $table = $tmp; - //trigger_error('QDB - The first two parameters passed to update() were in reverse order, but it has been allowed', E_USER_NOTICE); - } - // need field name and placeholder value - // but how merge these field placeholders with actual $parameters array for the WHERE clause - $sql = 'UPDATE `' . $table . '` set '; - foreach($data as $key => $value) { + // the following block swaps the parameters if they were given in the wrong order. + // it allows the method to work for those that would rather it (or expect it to) + // follow closer with SQL convention: + // update the TABLE with this DATA + if(is_string($data) && is_array($table)) { + $tmp = $data; + $data = $table; + $table = $tmp; + //trigger_error('QDB - The first two parameters passed to update() were in reverse order, but it has been allowed', E_USER_NOTICE); + } + + // need field name and placeholder value + // but how merge these field placeholders with actual $parameters array for the WHERE clause + $sql = 'UPDATE `' . $table . '` set '; + foreach($data as $key => $value) { $sql .= "`".$key."` ". '=:' . $key . ','; - } - $sql = substr($sql, 0, -1); // strip off last comma + } + $sql = substr($sql, 0, -1); // strip off last comma - if($where) { - $sql .= ' WHERE ' . $where; - $data = array_merge($data, $parameters); - } + if($where) { + $sql .= ' WHERE ' . $where; + $data = array_merge($data, $parameters); + } $time_start = microtime(true); - if(dbQuery($sql, $data)) { - $return = mysql_affected_rows(); - } else { + if(dbQuery($sql, $data)) { + $return = mysql_affected_rows(); + } else { #echo("$fullSql"); - trigger_error('QDB - Update failed.', E_USER_WARNING); - $return = false; - } + trigger_error('QDB - Update failed.', E_USER_WARNING); + $return = false; + } $time_end = microtime(true); $db_stats['update_sec'] += number_format($time_end - $time_start, 8); $db_stats['update']++; @@ -140,15 +145,15 @@ function dbUpdate($data, $table, $where = null, $parameters = array()) { } function dbDelete($table, $where = null, $parameters = array()) { - $sql = 'DELETE FROM `' . $table.'`'; - if($where) { - $sql .= ' WHERE ' . $where; - } - if(dbQuery($sql, $parameters)) { - return mysql_affected_rows(); - } else { - return false; - } + $sql = 'DELETE FROM `' . $table.'`'; + if($where) { + $sql .= ' WHERE ' . $where; + } + if(dbQuery($sql, $parameters)) { + return mysql_affected_rows(); + } else { + return false; + } } /* @@ -159,16 +164,16 @@ function dbFetchRows($sql, $parameters = array()) { global $db_stats; $time_start = microtime(true); - $result = dbQuery($sql, $parameters); + $result = dbQuery($sql, $parameters); - if(mysql_num_rows($result) > 0) { - $rows = array(); - while($row = mysql_fetch_assoc($result)) { - $rows[] = $row; - } - mysql_free_result($result); - return $rows; - } + if(mysql_num_rows($result) > 0) { + $rows = array(); + while ($row = mysql_fetch_assoc($result)) { + $rows[] = $row; + } + mysql_free_result($result); + return $rows; + } mysql_free_result($result); @@ -176,26 +181,26 @@ function dbFetchRows($sql, $parameters = array()) { $db_stats['fetchrows_sec'] += number_format($time_end - $time_start, 8); $db_stats['fetchrows']++; - // no records, thus return empty array - // which should evaluate to false, and will prevent foreach notices/warnings - return array(); + // no records, thus return empty array + // which should evaluate to false, and will prevent foreach notices/warnings + return array(); } /* * This is intended to be the method used for large result sets. * It is intended to return an iterator, and act upon buffered data. * */ function dbFetch($sql, $parameters = array()) { - return dbFetchRows($sql, $parameters); - /* - // for now, don't do the iterator thing - $result = dbQuery($sql, $parameters); - if($result) { - // return new iterator - return new dbIterator($result); - } else { - return null; // ?? - } - */ + return dbFetchRows($sql, $parameters); + /* + // for now, don't do the iterator thing + $result = dbQuery($sql, $parameters); + if($result) { + // return new iterator + return new dbIterator($result); + } else { + return null; // ?? + } + */ } /* @@ -206,19 +211,19 @@ function dbFetchRow($sql = null, $parameters = array()) { global $db_stats; $time_start = microtime(true); - $result = dbQuery($sql, $parameters); - if($result) { - $row = mysql_fetch_assoc($result); - mysql_free_result($result); + $result = dbQuery($sql, $parameters); + if($result) { + $row = mysql_fetch_assoc($result); + mysql_free_result($result); $time_end = microtime(true); $db_stats['fetchrow_sec'] += number_format($time_end - $time_start, 8); $db_stats['fetchrow']++; - return $row; - } else { - return null; - } + return $row; + } else { + return null; + } $time_start = microtime(true); } @@ -228,17 +233,18 @@ function dbFetchRow($sql = null, $parameters = array()) { * */ function dbFetchCell($sql, $parameters = array()) { global $db_stats; + $time_start = microtime(true); - $row = dbFetchRow($sql, $parameters); - if($row) { - return array_shift($row); // shift first field off first row - } + $row = dbFetchRow($sql, $parameters); + if($row) { + return array_shift($row); // shift first field off first row + } $time_end = microtime(true); $db_stats['fetchcell_sec'] += number_format($time_end - $time_start, 8); $db_stats['fetchcell']++; - return null; + return null; } /* @@ -247,17 +253,18 @@ function dbFetchCell($sql, $parameters = array()) { * */ function dbFetchColumn($sql, $parameters = array()) { global $db_stats; + $time_start = microtime(true); - $cells = array(); - foreach(dbFetch($sql, $parameters) as $row) { - $cells[] = array_shift($row); - } + $cells = array(); + foreach(dbFetch($sql, $parameters) as $row) { + $cells[] = array_shift($row); + } $time_end = microtime(true); $db_stats['fetchcol_sec'] += number_format($time_end - $time_start, 8); $db_stats['fetchcol']++; - return $cells; + return $cells; } /* @@ -266,18 +273,18 @@ function dbFetchColumn($sql, $parameters = array()) { * The second the key's value */ function dbFetchKeyValue($sql, $parameters = array()) { - $data = array(); - foreach(dbFetch($sql, $parameters) as $row) { - $key = array_shift($row); - if(sizeof($row) == 1) { // if there were only 2 fields in the result - // use the second for the value - $data[ $key ] = array_shift($row); - } else { // if more than 2 fields were fetched - // use the array of the rest as the value - $data[ $key ] = $row; - } - } - return $data; + $data = array(); + foreach(dbFetch($sql, $parameters) as $row) { + $key = array_shift($row); + if(sizeof($row) == 1) { // if there were only 2 fields in the result + // use the second for the value + $data[ $key ] = array_shift($row); + } else { // if more than 2 fields were fetched + // use the array of the rest as the value + $data[ $key ] = $row; + } + } + return $data; } /* @@ -286,69 +293,69 @@ function dbFetchKeyValue($sql, $parameters = array()) { */ function dbMakeQuery($sql, $parameters) { // bypass extra logic if we have no parameters - if(sizeof($parameters) == 0) - return $sql; + if (sizeof($parameters) == 0) + return $sql; - $parameters = dbPrepareData($parameters); - // separate the two types of parameters for easier handling - $questionParams = array(); - $namedParams = array(); - foreach($parameters as $key => $value) { - if(is_numeric($key)) { - $questionParams[] = $value; - } else { - $namedParams[ ':' . $key ] = $value; - } - } - // sort namedParams in reverse to stop substring squashing - krsort($namedParams); + $parameters = dbPrepareData($parameters); + // separate the two types of parameters for easier handling + $questionParams = array(); + $namedParams = array(); + foreach($parameters as $key => $value) { + if(is_numeric($key)) { + $questionParams[] = $value; + } else { + $namedParams[ ':' . $key ] = $value; + } + } + // sort namedParams in reverse to stop substring squashing + krsort($namedParams); - // split on question-mark and named placeholders - $result = preg_split('/(\?|:[a-zA-Z0-9_-]+)/', $sql, -1, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE); + // split on question-mark and named placeholders + $result = preg_split('/(\?|:[a-zA-Z0-9_-]+)/', $sql, -1, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE); - // every-other item in $result will be the placeholder that was found + // every-other item in $result will be the placeholder that was found - $query = ''; - for($i = 0; $i < sizeof($result); $i+=2) { - $query .= $result[ $i ]; + $query = ''; + for($i = 0; $i < sizeof($result); $i+=2) { + $query .= $result[ $i ]; - $j = $i+1; - if(array_key_exists($j, $result)) { - $test = $result[ $j ]; - if($test == '?') { - $query .= array_shift($questionParams); - } else { - $query .= $namedParams[ $test ]; - } - } - } - return $query; + $j = $i+1; + if(array_key_exists($j, $result)) { + $test = $result[ $j ]; + if($test == '?') { + $query .= array_shift($questionParams); + } else { + $query .= $namedParams[ $test ]; + } + } + } + return $query; } function dbPrepareData($data) { - $values = array(); + $values = array(); - foreach($data as $key=>$value) { - $escape = true; - // don't quote or esc if value is an array, we treat it - // as a "decorator" that tells us not to escape the - // value contained in the array - if(is_array($value) && !is_object($value)) { - $escape = false; - $value = array_shift($value); - } - // it's not right to worry about invalid fields in this method because we may be operating on fields - // that are aliases, or part of other tables through joins - //if(!in_array($key, $columns)) // skip invalid fields - // continue; - if($escape) { - $values[$key] = "'" . mysql_real_escape_string($value) . "'"; - } else - $values[$key] = $value; - } - return $values; - } + foreach($data as $key=>$value) { + $escape = true; + // don't quote or esc if value is an array, we treat it + // as a "decorator" that tells us not to escape the + // value contained in the array + if(is_array($value) && !is_object($value)) { + $escape = false; + $value = array_shift($value); + } + // it's not right to worry about invalid fields in this method because we may be operating on fields + // that are aliases, or part of other tables through joins + //if(!in_array($key, $columns)) // skip invalid fields + // continue; + if($escape) { + $values[$key] = "'" . mysql_real_escape_string($value) . "'"; + } else + $values[$key] = $value; + } + return $values; + } /* @@ -356,61 +363,61 @@ function dbPrepareData($data) { * These may be question marks, or ":email" type */ function dbPlaceHolders($values) { - $data = array(); - foreach($values as $key => $value) { - if(is_numeric($key)) - $data[] = '?'; - else - $data[] = ':' . $key; - } - return $data; + $data = array(); + foreach($values as $key => $value) { + if(is_numeric($key)) + $data[] = '?'; + else + $data[] = ':' . $key; + } + return $data; } function dbBeginTransaction() { - mysql_query('begin'); + mysql_query('begin'); } function dbCommitTransaction() { - mysql_query('commit'); + mysql_query('commit'); } function dbRollbackTransaction() { - mysql_query('rollback'); + mysql_query('rollback'); } /* class dbIterator implements Iterator { - private $result; - private $i; + private $result; + private $i; - public function __construct($r) { - $this->result = $r; - $this->i = 0; - } - public function rewind() { - mysql_data_seek($this->result, 0); - $this->i = 0; - } - public function current() { - $a = mysql_fetch_assoc($this->result); - return $a; - } - public function key() { - return $this->i; - } - public function next() { - $this->i++; - $a = mysql_data_seek($this->result, $this->i); - if($a === false) { - $this->i = 0; - } - return $a; - } - public function valid() { - return ($this->current() !== false); - } + public function __construct($r) { + $this->result = $r; + $this->i = 0; + } + public function rewind() { + mysql_data_seek($this->result, 0); + $this->i = 0; + } + public function current() { + $a = mysql_fetch_assoc($this->result); + return $a; + } + public function key() { + return $this->i; + } + public function next() { + $this->i++; + $a = mysql_data_seek($this->result, $this->i); + if($a === false) { + $this->i = 0; + } + return $a; + } + public function valid() { + return ($this->current() !== false); + } } */ diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 1fdba781b6..bf07a927f2 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -34,13 +34,13 @@ $config['virsh'] = "/usr/bin/virsh"; if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["SERVER_PORT"])) { - $config['base_url'] = "http://" . $_SERVER["SERVER_NAME"] .":".$_SERVER["SERVER_PORT"]."/"; + $config['base_url'] = "http://" . $_SERVER["SERVER_NAME"] .":".$_SERVER["SERVER_PORT"]."/"; } $config['title_image'] = "images/observium-logo.png"; $config['stylesheet'] = "css/styles.css"; $config['mono_font'] = "DejaVuSansMono"; -#$config['mono_font'] = "LiberationMono"; +#$config['mono_font'] = "LiberationMono"; $config['favicon'] = "images/observium-icon.png"; $config['header_color'] = "#1F334E"; $config['page_refresh'] = "300"; ## Refresh the page every xx seconds @@ -48,7 +48,7 @@ $config['front_page'] = "pages/front/default.php"; $config['page_title'] = "Observium :: Network Observation and Monitoring"; $config['timestamp_format'] = 'd-m-Y H:i:s'; $config['page_gen'] = 1; -$config['web_header'] = "header.inc.php"; # in html/includes +$config['web_header'] = "header.inc.php"; # in html/includes $config['login_message'] = "Unauthorised access or use shall render the user liable to criminal and/or civil prosecution."; $config['int_customers'] = 1; # Enable Customer Port Parsing @@ -66,23 +66,23 @@ $config['ports_page_default'] = "details"; ## eg "details" "graphs/bits" ## #$config['snmp']['timeout'] = 1; # timeout in seconds #$config['snmp']['retries'] = 5; # how many times to retry the query $config['snmp']['community'][0] = "public"; # Communities to try during adding hosts and discovery -$config['snmp']['internal'] = false; # Enable php_snmp functions to make gets faster +$config['snmp']['internal'] = false; # Enable php_snmp functions to make gets faster $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']['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']['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 $config['alerts']['email']['default'] = NULL; ## Default alert recipient $config['alerts']['email']['default_only'] = FALSE; ## Only use default recipient -$config['alerts']['email']['enable'] = TRUE; ## Enable email alerts +$config['alerts']['email']['enable'] = TRUE; ## Enable email alerts $config['uptime_warning'] = "84600"; ## Time in seconds to display a "Device Rebooted" Alert. 0 to disable warnings. ### Cosmetics @@ -139,16 +139,16 @@ $config['version_check'] = 1; # Enable checking of version in dis ### Poller/Discovery Modules -$config['enable_bgp'] = 1; # Enable BGP session collection and display +$config['enable_bgp'] = 1; # Enable BGP session collection and display $config['enable_rip'] = 1; # Enable RIP session collection and display $config['enable_ospf'] = 1; # Enable OSPF session collection and display $config['enable_isis'] = 1; # Enable ISIS session collection and display $config['enable_eigrp'] = 1; # Enable EIGRP session collection and display -$config['enable_syslog'] = 0; # Enable Syslog -$config['enable_inventory'] = 1; # Enable Inventory -$config['enable_pseudowires'] = 1; # Enable Pseudowires -$config['enable_vrfs'] = 1; # Enable VRFs -$config['enable_printers'] = 0; # Enable Printer support +$config['enable_syslog'] = 0; # Enable Syslog +$config['enable_inventory'] = 1; # Enable Inventory +$config['enable_pseudowires'] = 1; # Enable Pseudowires +$config['enable_vrfs'] = 1; # Enable VRFs +$config['enable_printers'] = 0; # Enable Printer support ### Ports extension modules @@ -162,15 +162,15 @@ $config['enable_ports_poe'] = 0; # Enable PoE stats collection ### Billing System Configuration $config['enable_billing'] = 0; # Enable Billing -$config['billing']['customer_autoadd'] = 0; # Enable Auto-add bill per customer -$config['billing']['circuit_autoadd'] = 0; # Enable Auto-add bill per circuit_id -$config['billing']['bill_autoadd'] = 0; # Enable Auto-add bill per bill_id +$config['billing']['customer_autoadd'] = 0; # Enable Auto-add bill per customer +$config['billing']['circuit_autoadd'] = 0; # Enable Auto-add bill per circuit_id +$config['billing']['bill_autoadd'] = 0; # Enable Auto-add bill per bill_id ### External Integration -#$config['rancid_configs'][] = '/var/lib/rancid/network/configs/'; -$config['rancid_ignorecomments'] = 0; # Ignore lines starting with # -#$config['collectd_dir'] = '/var/lib/collectd/rrd'; +#$config['rancid_configs'][] = '/var/lib/rancid/network/configs/'; +$config['rancid_ignorecomments'] = 0; # Ignore lines starting with # +#$config['collectd_dir'] = '/var/lib/collectd/rrd'; # NFSen RRD dir. $config['nfsen_enable'] = 0; @@ -245,7 +245,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 @@ -342,7 +342,7 @@ $config['poller_modules']['cisco-ipsec-flow-monitor'] = 1; $config['poller_modules']['cisco-remote-access-monitor'] = 1; $config['poller_modules']['cisco-cef'] = 1; $config['poller_modules']['cisco-mac-accounting'] = 1; -$config['poller_modules']['cipsec-tunnels'] = 1; +$config['poller_modules']['cipsec-tunnels'] = 1; #include("includes/polling/altiga-ssl.inc.php"); diff --git a/includes/discovery/cisco-cef.inc.php b/includes/discovery/cisco-cef.inc.php index d2bd51bb87..0dad72a996 100755 --- a/includes/discovery/cisco-cef.inc.php +++ b/includes/discovery/cisco-cef.inc.php @@ -31,12 +31,12 @@ if (is_array($cefs)) echo(" | |-".$path.": ".$path_name['cefSwitchingPath']."\n"); - if(mysql_result(mysql_query("SELECT COUNT(*) FROM `cef` WHERE `device_id` = '".$device['device_id']."' AND `entPhysicalIndex` = '".$entity."' + if (mysql_result(mysql_query("SELECT COUNT(*) FROM `cef` WHERE `device_id` = '".$device['device_id']."' AND `entPhysicalIndex` = '".$entity."' AND `afi` = '".$afi."' AND `cef_index` = '".$path."'"),0) != "1") { - $sql = "INSERT INTO `cef` (`device_id`, `entPhysicalIndex`, `afi`, `cef_index`, `cef_path`) + $sql = "INSERT INTO `cef` (`device_id`, `entPhysicalIndex`, `afi`, `cef_index`, `cef_path`) VALUES ('".$device['device_id']."', '".$entity."', '".$afi."', '".$path."', '".$path_name['cefSwitchingPath']."')"; - mysql_query($sql); + mysql_query($sql); echo("+"); } diff --git a/includes/discovery/cisco-entity-sensor.inc.php b/includes/discovery/cisco-entity-sensor.inc.php index 396db2ed3f..cd319fb43d 100644 --- a/includes/discovery/cisco-entity-sensor.inc.php +++ b/includes/discovery/cisco-entity-sensor.inc.php @@ -77,7 +77,7 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios") } ### Bit dirty also, clean later - $descr = str_replace("Temp: ", "", $descr); + $descr = str_replace("Temp: ", "", $descr); $descr = str_ireplace("temperature ", "", $descr); $oid = ".1.3.6.1.4.1.9.9.91.1.1.1.1.4.".$index; @@ -132,9 +132,9 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios") $ok = TRUE; - if ($current == "-127") { $ok = FALSE; } ## False reading -# if ($type == "temperature" && $current < 1) { $ok = FALSE; } ## False reading. Temperature <1 :) - if ($descr == "") { $ok = FALSE; } ## Invalid description. Lots of these on Nexus + if ($current == "-127") { $ok = FALSE; } ## False reading +# if ($type == "temperature" && $current < 1) { $ok = FALSE; } ## False reading. Temperature <1 :) + if ($descr == "") { $ok = FALSE; } ## Invalid description. Lots of these on Nexus if ($ok) { # echo("\n".$valid['sensor'].", $type, $device, $oid, $index, 'cisco-entity-sensor', $descr, $divisor, $multiplier, $limit_low, $warn_limit_low, $limit, $warn_limit, $current"); diff --git a/includes/discovery/cisco-pw.inc.php b/includes/discovery/cisco-pw.inc.php index 1c5bac417f..abbd8ffad9 100755 --- a/includes/discovery/cisco-pw.inc.php +++ b/includes/discovery/cisco-pw.inc.php @@ -21,19 +21,19 @@ if ($config['enable_pseudowires'] && $device['os_group'] == "ios") if ($cpwOid) { - list($cpw_remote_id) = explode(":", shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MPLS-MIB -Ln -Osqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcMplsPeerLdpID." . $cpwOid)); - $interface_descr = trim(shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MIB -Oqvn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcName." . $cpwOid)); - $cpw_remote_device = @mysql_result(mysql_query("SELECT device_id FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = '".$cpw_remote_id."' AND A.interface_id = I.interface_id"),0); - $if_id = @mysql_result(mysql_query("SELECT `interface_id` FROM `ports` WHERE `ifDescr` = '$interface_descr' AND `device_id` = '".$device['device_id']."'"),0); + list($cpw_remote_id) = explode(":", shell_exec($config['snmpget'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MPLS-MIB -Ln -Osqnv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcMplsPeerLdpID." . $cpwOid)); + $interface_descr = trim(shell_exec($config['snmpwalk'] . " -M " . $config['mibdir'] . " -m CISCO-IETF-PW-MIB -Oqvn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'] . " cpwVcName." . $cpwOid)); + $cpw_remote_device = @mysql_result(mysql_query("SELECT device_id FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = '".$cpw_remote_id."' AND A.interface_id = I.interface_id"),0); + $if_id = @mysql_result(mysql_query("SELECT `interface_id` FROM `ports` WHERE `ifDescr` = '$interface_descr' AND `device_id` = '".$device['device_id']."'"),0); - if ($cpw_remote_device && $if_id) - { - $hostname = gethostbyid($cpw_remote_device); + if ($cpw_remote_device && $if_id) + { + $hostname = gethostbyid($cpw_remote_device); #echo("\nOid: " . $cpwOid . " cpwVcID: " . $cpwVcID . " Remote Id: " . $cpw_remote_id . "($hostname(".$cpw_remote_device.") -> $interface_descr($if_id))"); - if (mysql_result(mysql_query("SELECT count(*) FROM pseudowires WHERE `interface_id` = '$if_id' - AND `cpwVcID`='".$cpwVcID."'"),0)) + if (mysql_result(mysql_query("SELECT count(*) FROM pseudowires WHERE `interface_id` = '$if_id' + AND `cpwVcID`='".$cpwVcID."'"),0)) { - echo("."); + echo("."); } else { @@ -44,7 +44,7 @@ if ($config['enable_pseudowires'] && $device['os_group'] == "ios") #echo($device['device_id'] . " $cpwOid $cpw_remote_device $if_id $cpwVcID\n"); } $cpw_exists[] = $device['device_id'] . " $cpwOid $cpw_remote_device $if_id $cpwVcID"; - } + } } } } diff --git a/includes/discovery/current/apc.inc.php b/includes/discovery/current/apc.inc.php index 14ce03a7d6..4f639c6bc5 100644 --- a/includes/discovery/current/apc.inc.php +++ b/includes/discovery/current/apc.inc.php @@ -21,17 +21,17 @@ if ($device['os'] == "apc") $split_oid = explode('.',$oid); $index = $split_oid[count($split_oid)-1]; - $current_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.".$index; #rPDULoadStatusLoad - $phase_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.4.".$index; #rPDULoadStatusPhaseNumber - $limit_oid = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.4.".$index; #rPDULoadPhaseConfigOverloadThreshold - $lowlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.2.".$index; #rPDULoadPhaseConfigLowLoadThreshold - $warnlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.3.".$index; #rPDULoadPhaseConfigNearOverloadThreshold + $current_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.".$index; #rPDULoadStatusLoad + $phase_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.4.".$index; #rPDULoadStatusPhaseNumber + $limit_oid = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.4.".$index; #rPDULoadPhaseConfigOverloadThreshold + $lowlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.2.".$index; #rPDULoadPhaseConfigLowLoadThreshold + $warnlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.2.1.1.3.".$index; #rPDULoadPhaseConfigNearOverloadThreshold $phase = snmp_get($device, $phase_oid, "-Oqv", ""); $current = snmp_get($device, $current_oid, "-Oqv", "") / $precision; - $limit = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! - $lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! - $warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! + $limit = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! + $lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! + $warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! if (count(explode("\n",$oids)) != 1) { $descr = "Phase $phase"; @@ -48,7 +48,7 @@ if ($device['os'] == "apc") unset($oids); #v2 firmware- first bank is total, v3 firmware, 3rd bank is total - $oids = snmp_walk($device, "rPDULoadBankConfigIndex", "-OsqnU", "PowerNet-MIB"); # should work with firmware v2 and v3 + $oids = snmp_walk($device, "rPDULoadBankConfigIndex", "-OsqnU", "PowerNet-MIB"); # should work with firmware v2 and v3 if ($oids) { echo("APC PowerNet-MIB Banks "); @@ -83,11 +83,11 @@ if ($device['os'] == "apc") if ($index == "1") { $descr = "Bank Total"; } } - $current_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.".$index; #rPDULoadStatusLoad - $bank_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.5.".$index; #rPDULoadStatusBankNumber - $limit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.4.".$index; #rPDULoadBankConfigOverloadThreshold - $lowlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.2.".$index; #rPDULoadBankConfigLowLoadThreshold - $warnlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.3.".$index; #rPDULoadBankConfigNearOverloadThreshold + $current_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.".$index; #rPDULoadStatusLoad + $bank_oid = "1.3.6.1.4.1.318.1.1.12.2.3.1.1.5.".$index; #rPDULoadStatusBankNumber + $limit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.4.".$index; #rPDULoadBankConfigOverloadThreshold + $lowlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.2.".$index; #rPDULoadBankConfigLowLoadThreshold + $warnlimit_oid = "1.3.6.1.4.1.318.1.1.12.2.4.1.1.3.".$index; #rPDULoadBankConfigNearOverloadThreshold $bank = snmp_get($device, $bank_oid, "-Oqv", ""); $current = snmp_get($device, $current_oid, "-Oqv", "") / $precision; @@ -112,16 +112,16 @@ if ($device['os'] == "apc") if ($debug) { print_r($oids); } $oids = trim($oids); if ($oids) echo("APC PowerNet-MIB ATS "); - $current_oid = "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1"; #atsOutputCurrent - $limit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.5.1"; #atsConfigPhaseOverLoadThreshold - $lowlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.3.1"; #atsConfigPhaseLowLoadThreshold - $warnlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.4.1"; #atsConfigPhaseNearOverLoadThreshold + $current_oid = "1.3.6.1.4.1.318.1.1.8.5.4.3.1.4.1.1.1"; #atsOutputCurrent + $limit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.5.1"; #atsConfigPhaseOverLoadThreshold + $lowlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.3.1"; #atsConfigPhaseLowLoadThreshold + $warnlimit_oid = "1.3.6.1.4.1.318.1.1.8.4.16.1.4.1"; #atsConfigPhaseNearOverLoadThreshold $index = 1; $current = snmp_get($device, $current_oid, "-Oqv", "") / $precision; - $limit = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! - $lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! - $warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! + $limit = snmp_get($device, $limit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! + $lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! + $warnlimit = snmp_get($device, $warnlimit_oid, "-Oqv", ""); # No / $precision here! Nice, APC! $descr = "Output Feed"; discover_sensor($valid['sensor'], 'current', $device, $current_oid, $index, $type, $descr, '10', '1', $lowlimit, NULL, $warnlimit, $limit, $current); diff --git a/includes/discovery/current/sentry3.inc.php b/includes/discovery/current/sentry3.inc.php index 3a08a7721b..c1d1284592 100644 --- a/includes/discovery/current/sentry3.inc.php +++ b/includes/discovery/current/sentry3.inc.php @@ -11,7 +11,7 @@ if ($device['os'] == 'sentry3') # These PDUs may have > 1 "tower" accessible via a single management interface $tower_count = snmp_get($device,"systemTowerCount.0", "-Ovq", "Sentry3-MIB"); $towers=1; - while($towers <= $tower_count) { + while ($towers <= $tower_count) { ################################# # Check for Infeeds @@ -107,7 +107,7 @@ if ($device['os'] == 'sentry3') $towers++; - } // while($towers <= $tower_count) + } // while ($towers <= $tower_count) unset($towers); } diff --git a/includes/discovery/discovery-protocols.inc.php b/includes/discovery/discovery-protocols.inc.php index 02f5561aa4..4038727e16 100755 --- a/includes/discovery/discovery-protocols.inc.php +++ b/includes/discovery/discovery-protocols.inc.php @@ -19,21 +19,21 @@ if ($device['os'] == "ironware") $fdp_if_array = $fdp_array[$key]; foreach (array_keys($fdp_if_array) as $entry_key) { - $fdp = $fdp_if_array[$entry_key]; - $remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$fdp['snFdpCacheDeviceId']."' OR `hostname`='".$fdp['snFdpCacheDeviceId']."'"), 0); + $fdp = $fdp_if_array[$entry_key]; + $remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$fdp['snFdpCacheDeviceId']."' OR `hostname`='".$fdp['snFdpCacheDeviceId']."'"), 0); - if(!$remote_device_id) + if (!$remote_device_id) { $remote_device_id = discover_new_device($fdp['snFdpCacheDeviceId']); } - if ($remote_device_id) - { - $if = $fdp['snFdpCacheDevicePort']; - $remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '$if' OR `ifName`='$if') AND `device_id` = '".$remote_device_id."'"),0); - } else { $remote_interface_id = "0"; } + if ($remote_device_id) + { + $if = $fdp['snFdpCacheDevicePort']; + $remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '$if' OR `ifName`='$if') AND `device_id` = '".$remote_device_id."'"),0); + } else { $remote_interface_id = "0"; } - discover_link($interface['interface_id'], $fdp['snFdpCacheVendorId'], $remote_interface_id, $fdp['snFdpCacheDeviceId'], $fdp['snFdpCacheDevicePort'], $fdp['snFdpCachePlatform'], $fdp['snFdpCacheVersion']); + discover_link($interface['interface_id'], $fdp['snFdpCacheVendorId'], $remote_interface_id, $fdp['snFdpCacheDeviceId'], $fdp['snFdpCacheDevicePort'], $fdp['snFdpCachePlatform'], $fdp['snFdpCacheVersion']); } } } @@ -54,7 +54,7 @@ if ($cdp_array) $cdp = $cdp_if_array[$entry_key]; $remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$cdp['cdpCacheDeviceId']."' OR `hostname`='".$cdp['cdpCacheDeviceId']."'"), 0); - if(!$remote_device_id) + if (!$remote_device_id) { $remote_device_id = discover_new_device($cdp['cdpCacheDeviceId']); } @@ -98,26 +98,26 @@ if ($lldp_array) $lldp_instance = $lldp_if_array[$entry_key]; foreach (array_keys($lldp_instance) as $entry_instance) { - $lldp = $lldp_instance[$entry_instance]; - $remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$lldp['lldpRemSysName']."' OR `hostname`='".$lldp['lldpRemSysName']."'"), 0); + $lldp = $lldp_instance[$entry_instance]; + $remote_device_id = @mysql_result(mysql_query("SELECT `device_id` FROM `devices` WHERE `sysName` = '".$lldp['lldpRemSysName']."' OR `hostname`='".$lldp['lldpRemSysName']."'"), 0); - if(!$remote_device_id) + if (!$remote_device_id) { $remote_device_id = discover_new_device($lldp['lldpRemSysName']); } - if ($remote_device_id) - { - $if = $lldp['lldpRemPortDesc']; $id = $lldp['lldpRemPortId']; - $remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '$if' OR `ifName`='$if' OR `ifDescr`= '$id' OR `ifName`='$id') AND `device_id` = '".$remote_device_id."'"),0); - } else { + if ($remote_device_id) + { + $if = $lldp['lldpRemPortDesc']; $id = $lldp['lldpRemPortId']; + $remote_interface_id = @mysql_result(mysql_query("SELECT interface_id FROM `ports` WHERE (`ifDescr` = '$if' OR `ifName`='$if' OR `ifDescr`= '$id' OR `ifName`='$id') AND `device_id` = '".$remote_device_id."'"),0); + } else { $remote_interface_id = "0"; } - if (is_numeric($interface['interface_id']) && isset($lldp['lldpRemSysName']) && isset($lldp['lldpRemPortId'])) - { - discover_link($interface['interface_id'], 'lldp', $remote_interface_id, $lldp['lldpRemSysName'], $lldp['lldpRemPortId'], NULL, $lldp['lldpRemSysDesc']); - } + if (is_numeric($interface['interface_id']) && isset($lldp['lldpRemSysName']) && isset($lldp['lldpRemPortId'])) + { + discover_link($interface['interface_id'], 'lldp', $remote_interface_id, $lldp['lldpRemSysName'], $lldp['lldpRemPortId'], NULL, $lldp['lldpRemSysDesc']); + } } } } diff --git a/includes/discovery/entity-physical.inc.php b/includes/discovery/entity-physical.inc.php index 14b649d5a0..0d54c9ddcf 100755 --- a/includes/discovery/entity-physical.inc.php +++ b/includes/discovery/entity-physical.inc.php @@ -15,20 +15,20 @@ foreach ($entity_array as $entPhysicalIndex => $entry) { - $entPhysicalDescr = $entry['entPhysicalDescr']; - $entPhysicalContainedIn = $entry['entPhysicalContainedIn']; - $entPhysicalClass = $entry['entPhysicalClass']; - $entPhysicalName = $entry['entPhysicalName']; - $entPhysicalSerialNum = $entry['entPhysicalSerialNum']; - $entPhysicalModelName = $entry['entPhysicalModelName']; - $entPhysicalMfgName = $entry['entPhysicalMfgName']; - $entPhysicalVendorType = $entry['entPhysicalVendorType']; - $entPhysicalParentRelPos = $entry['entPhysicalParentRelPos']; - $entPhysicalHardwareRev = $entry['entPhysicalHardwareRev']; - $entPhysicalFirmwareRev = $entry['entPhysicalFirmwareRev']; - $entPhysicalSoftwareRev = $entry['entPhysicalSoftwareRev']; - $entPhysicalIsFRU = $entry['entPhysicalIsFRU']; - $entPhysicalAlias = $entry['entPhysicalAlias']; + $entPhysicalDescr = $entry['entPhysicalDescr']; + $entPhysicalContainedIn = $entry['entPhysicalContainedIn']; + $entPhysicalClass = $entry['entPhysicalClass']; + $entPhysicalName = $entry['entPhysicalName']; + $entPhysicalSerialNum = $entry['entPhysicalSerialNum']; + $entPhysicalModelName = $entry['entPhysicalModelName']; + $entPhysicalMfgName = $entry['entPhysicalMfgName']; + $entPhysicalVendorType = $entry['entPhysicalVendorType']; + $entPhysicalParentRelPos = $entry['entPhysicalParentRelPos']; + $entPhysicalHardwareRev = $entry['entPhysicalHardwareRev']; + $entPhysicalFirmwareRev = $entry['entPhysicalFirmwareRev']; + $entPhysicalSoftwareRev = $entry['entPhysicalSoftwareRev']; + $entPhysicalIsFRU = $entry['entPhysicalIsFRU']; + $entPhysicalAlias = $entry['entPhysicalAlias']; $entPhysicalAssetID = $entry['entPhysicalAssetID']; if (isset($entity_array['$entPhysicalIndex']['0']['entAliasMappingIdentifier'])) { $ifIndex = $entity_array['$entPhysicalIndex']['0']['entAliasMappingIdentifier']; } diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 85d2db532b..183fdc00ee 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -15,7 +15,7 @@ function discover_new_device($hostname) { global $config; - if($config['autodiscovery']['xdp']) { + if ($config['autodiscovery']['xdp']) { if ( isDomainResolves($hostname . "." . $config['mydomain']) ) { $dst_host = $hostname . "." . $config['mydomain']; } else { @@ -26,7 +26,7 @@ function discover_new_device($hostname) if ( match_network($config['nets'], $ip) ) { $remote_device_id = addHost ($dst_host, NULL, "v2c"); - if($remote_device_id) { + if ($remote_device_id) { $remote_device = device_by_id_cache($remote_device_id, 1); echo("+[".$remote_device['hostname']."(".$remote_device['device_id'].")]"); discover_device($remote_device); @@ -51,10 +51,10 @@ function discover_device($device, $options = NULL) echo($device['hostname'] . " ".$device['device_id']." ".$device['os']." "); - if($device['os'] == 'generic') // verify if OS has changed from generic + if ($device['os'] == 'generic') // verify if OS has changed from generic { $device['os']= getHostOS($device); - if($device['os'] != 'generic') + if ($device['os'] != 'generic') { echo "Device os was updated to".$device['os']."!"; dbUpdate(array('os' => $device['os']), 'devices', '`device_id` = ?', array($device['device_id'])); @@ -343,7 +343,7 @@ function discover_storage(&$valid, $device, $index, $type, $mib, $descr, $size, else { $updated = dbUpdate(array('storage_descr' => $descr, 'storage_type' => $type, 'storage_units' => $units, 'storage_size' => $size), 'storage', '`device_id` = ? AND `storage_index` = ? AND `storage_mib` = ?', array($device['device_id'], $index, $mib)); - if($updated) { echo("U"); } else { echo("."); } + if ($updated) { echo("U"); } else { echo("."); } } $valid[$mib][$index] = 1; } diff --git a/includes/discovery/os/linux.inc.php b/includes/discovery/os/linux.inc.php index 3dac41d94d..8b15db35ab 100755 --- a/includes/discovery/os/linux.inc.php +++ b/includes/discovery/os/linux.inc.php @@ -7,12 +7,12 @@ if (!$os) ## Specific Linux-derivatives - if($os == "linux") { + if ($os == "linux") { ## Check for QNAP Systems TurboNAS $entPhysicalMfgName = snmp_get($device, "ENTITY-MIB::entPhysicalMfgName.1", "-Osqnv"); - if(strpos($entPhysicalMfgName, "QNAP") !== FALSE) { $os = "qnap";} + if (strpos($entPhysicalMfgName, "QNAP") !== FALSE) { $os = "qnap";} elseif(strstr($sysObjectId, ".1.3.6.1.4.1.5528.100.20.10.2014")) { $os = "netbotz"; } } diff --git a/includes/discovery/ports-stack.inc.php b/includes/discovery/ports-stack.inc.php index 1708c949a5..5d4ac1e271 100644 --- a/includes/discovery/ports-stack.inc.php +++ b/includes/discovery/ports-stack.inc.php @@ -4,7 +4,7 @@ echo("Port Stack: "); $sql = "SELECT * FROM `ports_stack` WHERE `device_id` = '".$device['device_id']."'"; $query = mysql_query($sql); -while($entry = mysql_fetch_assoc($query)) +while ($entry = mysql_fetch_assoc($query)) { $stack_db_array[$entry['interface_id_high']][$entry['interface_id_low']]['ifStackStatus'] = $entry['ifStackStatus']; } @@ -16,21 +16,21 @@ foreach($stack_poll_array as $interface_id_high => $entry_high) foreach($entry_high as $interface_id_low => $entry_low) { $ifStackStatus = $entry_low['ifStackStatus']; - if(isset($stack_db_array[$interface_id_high][$interface_id_low])) + if (isset($stack_db_array[$interface_id_high][$interface_id_low])) { - if($stack_db_array[$interface_id_high][$interface_id_low]['ifStackStatus'] == $ifStackStatus) + if ($stack_db_array[$interface_id_high][$interface_id_low]['ifStackStatus'] == $ifStackStatus) { echo("."); } else { mysql_query("UPDATE `ports_stack` SET `ifStackStatus` = '".$ifStackStatus."' WHERE `device_id` = '".$device['device_id']."' AND `interface_id_high` = '".$interface_id_high."' AND `interface_id_low` = '".$interface_id_low."'"); echo("U"); - if($debug) { echo(mysql_error()); } + if ($debug) { echo(mysql_error()); } } unset($stack_db_array[$interface_id_high][$interface_id_low]); } else { mysql_query("INSERT INTO `ports_stack` (`device_id`,`interface_id_high`,`interface_id_low`,`ifStackStatus`) VALUES ('".$device['device_id']."','".$interface_id_high."','".$interface_id_low."','".$ifStackStatus."')"); echo("+"); - if($debug) { echo(mysql_error()); } + if ($debug) { echo(mysql_error()); } } } } diff --git a/includes/discovery/processors/hrdevice.inc.php b/includes/discovery/processors/hrdevice.inc.php index 1d7d911bf7..704925ce6b 100755 --- a/includes/discovery/processors/hrdevice.inc.php +++ b/includes/discovery/processors/hrdevice.inc.php @@ -37,7 +37,7 @@ if (is_array($hrDevice_array)) echo("Moved RRD "); } - if($device['os'] == "arista-eos" && $index == "1") { unset($descr); } + if ($device['os'] == "arista-eos" && $index == "1") { unset($descr); } if (isset($descr) && $descr != "An electronic chip that makes the computer work.") { diff --git a/includes/discovery/processors/ios.inc.php b/includes/discovery/processors/ios.inc.php index a153ccfe15..7dbfc9f355 100755 --- a/includes/discovery/processors/ios.inc.php +++ b/includes/discovery/processors/ios.inc.php @@ -14,11 +14,11 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios") if (isset($entry['cpmCPUTotal5minRev'])) { - $usage_oid = ".1.3.6.1.4.1.9.9.109.1.1.1.1.8." . $index; - $usage = $entry['cpmCPUTotal5minRev']; + $usage_oid = ".1.3.6.1.4.1.9.9.109.1.1.1.1.8." . $index; + $usage = $entry['cpmCPUTotal5minRev']; } elseif (isset($entry['cpmCPUTotal5min'])) { - $usage_oid = ".1.3.6.1.4.1.9.9.109.1.1.1.1.5." . $index; - $usage = $entry['cpmCPUTotal5min']; + $usage_oid = ".1.3.6.1.4.1.9.9.109.1.1.1.1.5." . $index; + $usage = $entry['cpmCPUTotal5min']; } if ($entPhysicalIndex) { @@ -32,16 +32,16 @@ if ($device['os'] == "ios" || $device['os_group'] == "ios") if (is_file($old_rrd)) { - rename($old_rrd,$new_rrd); + rename($old_rrd,$new_rrd); if ($debug) { echo("$old_rrd $new_rrd"); } - echo("Moved RRD "); + echo("Moved RRD "); } #echo("|".$descr."|"); if (!strstr($descr, "No") && !strstr($usage, "No") && $descr != "") { - discover_processor($valid['processor'], $device, $usage_oid, $index, "cpm", $descr, "1", $entry['juniSystemModuleCpuUtilPct'], $entPhysicalIndex, NULL); + discover_processor($valid['processor'], $device, $usage_oid, $index, "cpm", $descr, "1", $entry['juniSystemModuleCpuUtilPct'], $entPhysicalIndex, NULL); } } } diff --git a/includes/discovery/processors/ironware.inc.php b/includes/discovery/processors/ironware.inc.php index 1789cbaf84..c3f40d4f66 100755 --- a/includes/discovery/processors/ironware.inc.php +++ b/includes/discovery/processors/ironware.inc.php @@ -15,7 +15,7 @@ if ($device['os'] == "ironware" || $device['os_group'] == "ironware") { $usage_oid = ".1.3.6.1.4.1.1991.1.1.2.11.1.1.6." . $index; $usage = $entry['snAgentCpuUtil100thPercent']; - $precision = 100; + $precision = 100; } elseif ($entry['snAgentCpuUtilValue']) { $usage_oid = ".1.3.6.1.4.1.1991.1.1.2.11.1.1.4." . $index; $usage = $entry['snAgentCpuUtilValue']; diff --git a/includes/discovery/temperatures/cometsystem-p85xx.inc.php b/includes/discovery/temperatures/cometsystem-p85xx.inc.php index 0d29921179..105d516ba6 100644 --- a/includes/discovery/temperatures/cometsystem-p85xx.inc.php +++ b/includes/discovery/temperatures/cometsystem-p85xx.inc.php @@ -3,15 +3,15 @@ if ($device['os'] == "cometsystem-p85xx") { $regexp = '/ - \.1\.3\.6\.1\.4\.1\.22626\.1\.5\.2\. - (?P\d+) - \. - (?: - 1\.0 (?P.*)| - 3\.0 (?P.*)| - 5\.0 (?P.*)| - 6\.0 (?P.*)| - ) + \.1\.3\.6\.1\.4\.1\.22626\.1\.5\.2\. + (?P\d+) + \. + (?: + 1\.0 (?P.*)| + 3\.0 (?P.*)| + 5\.0 (?P.*)| + 6\.0 (?P.*)| + ) /x'; $oids = snmp_walk($device, ".1.3.6.1.4.1.22626.1.5.2", "-OsqnU", ""); diff --git a/includes/discovery/voltages/supermicro.inc.php b/includes/discovery/voltages/supermicro.inc.php index ef556e109d..e358d5e83c 100644 --- a/includes/discovery/voltages/supermicro.inc.php +++ b/includes/discovery/voltages/supermicro.inc.php @@ -30,7 +30,7 @@ if ($device['os'] == "linux") $descr = snmp_get($device, $descr_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB"); $current = snmp_get($device, $volt_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") / $divisor; $limit = snmp_get($device, $limit_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") / $divisor; - $lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") / $divisor; + $lowlimit = snmp_get($device, $lowlimit_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB") / $divisor; $monitor = snmp_get($device, $monitor_oid, "-Oqv", "SUPERMICRO-HEALTH-MIB"); $descr = trim(str_ireplace("Voltage", "", $descr)); diff --git a/includes/functions.php b/includes/functions.php index 2f4ac1e746..a0ad8486b3 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -22,9 +22,9 @@ function external_exec($command) { global $debug; - if($debug) { echo($command."\n"); } + if ($debug) { echo($command."\n"); } $output = shell_exec($command); - if($debug) { echo($output."\n"); } + if ($debug) { echo($output."\n"); } return $output; } @@ -325,6 +325,7 @@ function isSNMPable($device) function isPingable($hostname) { global $config; + $status = shell_exec($config['fping'] . " $hostname 2>/dev/null"); if (strstr($status, "alive")) { @@ -348,6 +349,7 @@ function is_odd($number) function isValidInterface($if) { global $config; + $if = strtolower($if); $nullintf = 0; foreach ($config['bad_if'] as $bi) @@ -644,7 +646,7 @@ function is_port_valid($port, $device) if (strstr($if, $bi)) { $valid = 0; - if($debug) { echo("ignored : $bi : $if"); } + if ($debug) { echo("ignored : $bi : $if"); } } } if (is_array($config['bad_if_regexp'])) @@ -654,7 +656,7 @@ function is_port_valid($port, $device) if (preg_match($bi ."i", $if)) { $valid = 0; - if($debug) { echo("ignored : $bi : ".$if); } + if ($debug) { echo("ignored : $bi : ".$if); } } } } diff --git a/includes/polling/applications/mysql.inc.php b/includes/polling/applications/mysql.inc.php index bc8999077c..5da2a05fa3 100644 --- a/includes/polling/applications/mysql.inc.php +++ b/includes/polling/applications/mysql.inc.php @@ -25,97 +25,97 @@ for ($a=0,$n=count($data);$a<$n;$a++) if (!is_file($mysql_rrd)) { rrdtool_create ($mysql_rrd, "--step 300 \ - DS:IDBLBSe:GAUGE:600:0:125000000000 \ - DS:IBLFh:DERIVE:600:0:125000000000 \ - DS:IBLWn:DERIVE:600:0:125000000000 \ - DS:SRows:DERIVE:600:0:125000000000 \ - DS:SRange:DERIVE:600:0:125000000000 \ - DS:SMPs:DERIVE:600:0:125000000000 \ - DS:SScan:DERIVE:600:0:125000000000 \ - DS:IBIRd:DERIVE:600:0:125000000000 \ - DS:IBIWr:DERIVE:600:0:125000000000 \ - DS:IBILg:DERIVE:600:0:125000000000 \ - DS:IBIFSc:DERIVE:600:0:125000000000 \ - DS:IDBRDd:DERIVE:600:0:125000000000 \ - DS:IDBRId:DERIVE:600:0:125000000000 \ - DS:IDBRRd:DERIVE:600:0:125000000000 \ - DS:IDBRUd:DERIVE:600:0:125000000000 \ - DS:IBRd:DERIVE:600:0:125000000000 \ - DS:IBCd:DERIVE:600:0:125000000000 \ - DS:IBWr:DERIVE:600:0:125000000000 \ - DS:TLIe:DERIVE:600:0:125000000000 \ - DS:TLWd:DERIVE:600:0:125000000000 \ - DS:IBPse:GAUGE:600:0:125000000000 \ - DS:IBPDBp:GAUGE:600:0:125000000000 \ - DS:IBPFe:GAUGE:600:0:125000000000 \ - DS:IBPMps:GAUGE:600:0:125000000000 \ - DS:TOC:GAUGE:600:0:125000000000 \ - DS:OFs:GAUGE:600:0:125000000000 \ - DS:OTs:GAUGE:600:0:125000000000 \ - DS:OdTs:GAUGE:600:0:125000000000 \ - DS:IBSRs:DERIVE:600:0:125000000000 \ - DS:IBSWs:DERIVE:600:0:125000000000 \ - DS:IBOWs:DERIVE:600:0:125000000000 \ - DS:QCs:GAUGE:600:0:125000000000 \ - DS:QCeFy:GAUGE:600:0:125000000000 \ - DS:MaCs:GAUGE:600:0:125000000000 \ - DS:MUCs:GAUGE:600:0:125000000000 \ - DS:ACs:DERIVE:600:0:125000000000 \ - DS:AdCs:DERIVE:600:0:125000000000 \ - DS:TCd:GAUGE:600:0:125000000000 \ - DS:Cs:DERIVE:600:0:125000000000 \ - DS:IBTNx:DERIVE:600:0:125000000000 \ - DS:KRRs:DERIVE:600:0:125000000000 \ - DS:KRs:DERIVE:600:0:125000000000 \ - DS:KWR:DERIVE:600:0:125000000000 \ - DS:KWs:DERIVE:600:0:125000000000 \ - DS:QCQICe:DERIVE:600:0:125000000000 \ - DS:QCHs:DERIVE:600:0:125000000000 \ - DS:QCIs:DERIVE:600:0:125000000000 \ - DS:QCNCd:DERIVE:600:0:125000000000 \ - DS:QCLMPs:DERIVE:600:0:125000000000 \ - DS:CTMPDTs:DERIVE:600:0:125000000000 \ - DS:CTMPTs:DERIVE:600:0:125000000000 \ - DS:CTMPFs:DERIVE:600:0:125000000000 \ - DS:IBIIs:DERIVE:600:0:125000000000 \ - DS:IBIMRd:DERIVE:600:0:125000000000 \ - DS:IBIMs:DERIVE:600:0:125000000000 \ - DS:IBILog:DERIVE:602:0:125000000000 \ - DS:IBISc:DERIVE:602:0:125000000000 \ - DS:IBIFLg:DERIVE:600:0:125000000000 \ - DS:IBFBl:DERIVE:600:0:125000000000 \ - DS:IBIIAo:DERIVE:600:0:125000000000 \ - DS:IBIAd:DERIVE:600:0:125000000000 \ - DS:IBIAe:DERIVE:600:0:125000000000 \ - DS:SFJn:DERIVE:600:0:125000000000 \ - DS:SFRJn:DERIVE:600:0:125000000000 \ - DS:SRe:DERIVE:600:0:125000000000 \ - DS:SRCk:DERIVE:600:0:125000000000 \ - DS:SSn:DERIVE:600:0:125000000000 \ - DS:SQs:DERIVE:600:0:125000000000 \ - DS:BRd:DERIVE:600:0:125000000000 \ - DS:BSt:DERIVE:600:0:125000000000 \ - DS:CDe:DERIVE:600:0:125000000000 \ - DS:CIt:DERIVE:600:0:125000000000 \ - DS:CISt:DERIVE:600:0:125000000000 \ - DS:CLd:DERIVE:600:0:125000000000 \ - DS:CRe:DERIVE:600:0:125000000000 \ - DS:CRSt:DERIVE:600:0:125000000000 \ - DS:CSt:DERIVE:600:0:125000000000 \ - DS:CUe:DERIVE:600:0:125000000000 \ - DS:CUMi:DERIVE:600:0:125000000000 \ - RRA:AVERAGE:0.5:1:600 \ - RRA:AVERAGE:0.5:6:700 \ - RRA:AVERAGE:0.5:24:775 \ - RRA:AVERAGE:0.5:288:797 \ - RRA:MIN:0.5:1:600 \ - RRA:MIN:0.5:6:700 \ - RRA:MIN:0.5:24:775 \ - RRA:MIN:0.5:3:600 \ - RRA:MAX:0.5:1:600 \ - RRA:MAX:0.5:6:700 \ - RRA:MAX:0.5:24:775 \ - RRA:MAX:0.5:288:797"); + DS:IDBLBSe:GAUGE:600:0:125000000000 \ + DS:IBLFh:DERIVE:600:0:125000000000 \ + DS:IBLWn:DERIVE:600:0:125000000000 \ + DS:SRows:DERIVE:600:0:125000000000 \ + DS:SRange:DERIVE:600:0:125000000000 \ + DS:SMPs:DERIVE:600:0:125000000000 \ + DS:SScan:DERIVE:600:0:125000000000 \ + DS:IBIRd:DERIVE:600:0:125000000000 \ + DS:IBIWr:DERIVE:600:0:125000000000 \ + DS:IBILg:DERIVE:600:0:125000000000 \ + DS:IBIFSc:DERIVE:600:0:125000000000 \ + DS:IDBRDd:DERIVE:600:0:125000000000 \ + DS:IDBRId:DERIVE:600:0:125000000000 \ + DS:IDBRRd:DERIVE:600:0:125000000000 \ + DS:IDBRUd:DERIVE:600:0:125000000000 \ + DS:IBRd:DERIVE:600:0:125000000000 \ + DS:IBCd:DERIVE:600:0:125000000000 \ + DS:IBWr:DERIVE:600:0:125000000000 \ + DS:TLIe:DERIVE:600:0:125000000000 \ + DS:TLWd:DERIVE:600:0:125000000000 \ + DS:IBPse:GAUGE:600:0:125000000000 \ + DS:IBPDBp:GAUGE:600:0:125000000000 \ + DS:IBPFe:GAUGE:600:0:125000000000 \ + DS:IBPMps:GAUGE:600:0:125000000000 \ + DS:TOC:GAUGE:600:0:125000000000 \ + DS:OFs:GAUGE:600:0:125000000000 \ + DS:OTs:GAUGE:600:0:125000000000 \ + DS:OdTs:GAUGE:600:0:125000000000 \ + DS:IBSRs:DERIVE:600:0:125000000000 \ + DS:IBSWs:DERIVE:600:0:125000000000 \ + DS:IBOWs:DERIVE:600:0:125000000000 \ + DS:QCs:GAUGE:600:0:125000000000 \ + DS:QCeFy:GAUGE:600:0:125000000000 \ + DS:MaCs:GAUGE:600:0:125000000000 \ + DS:MUCs:GAUGE:600:0:125000000000 \ + DS:ACs:DERIVE:600:0:125000000000 \ + DS:AdCs:DERIVE:600:0:125000000000 \ + DS:TCd:GAUGE:600:0:125000000000 \ + DS:Cs:DERIVE:600:0:125000000000 \ + DS:IBTNx:DERIVE:600:0:125000000000 \ + DS:KRRs:DERIVE:600:0:125000000000 \ + DS:KRs:DERIVE:600:0:125000000000 \ + DS:KWR:DERIVE:600:0:125000000000 \ + DS:KWs:DERIVE:600:0:125000000000 \ + DS:QCQICe:DERIVE:600:0:125000000000 \ + DS:QCHs:DERIVE:600:0:125000000000 \ + DS:QCIs:DERIVE:600:0:125000000000 \ + DS:QCNCd:DERIVE:600:0:125000000000 \ + DS:QCLMPs:DERIVE:600:0:125000000000 \ + DS:CTMPDTs:DERIVE:600:0:125000000000 \ + DS:CTMPTs:DERIVE:600:0:125000000000 \ + DS:CTMPFs:DERIVE:600:0:125000000000 \ + DS:IBIIs:DERIVE:600:0:125000000000 \ + DS:IBIMRd:DERIVE:600:0:125000000000 \ + DS:IBIMs:DERIVE:600:0:125000000000 \ + DS:IBILog:DERIVE:602:0:125000000000 \ + DS:IBISc:DERIVE:602:0:125000000000 \ + DS:IBIFLg:DERIVE:600:0:125000000000 \ + DS:IBFBl:DERIVE:600:0:125000000000 \ + DS:IBIIAo:DERIVE:600:0:125000000000 \ + DS:IBIAd:DERIVE:600:0:125000000000 \ + DS:IBIAe:DERIVE:600:0:125000000000 \ + DS:SFJn:DERIVE:600:0:125000000000 \ + DS:SFRJn:DERIVE:600:0:125000000000 \ + DS:SRe:DERIVE:600:0:125000000000 \ + DS:SRCk:DERIVE:600:0:125000000000 \ + DS:SSn:DERIVE:600:0:125000000000 \ + DS:SQs:DERIVE:600:0:125000000000 \ + DS:BRd:DERIVE:600:0:125000000000 \ + DS:BSt:DERIVE:600:0:125000000000 \ + DS:CDe:DERIVE:600:0:125000000000 \ + DS:CIt:DERIVE:600:0:125000000000 \ + DS:CISt:DERIVE:600:0:125000000000 \ + DS:CLd:DERIVE:600:0:125000000000 \ + DS:CRe:DERIVE:600:0:125000000000 \ + DS:CRSt:DERIVE:600:0:125000000000 \ + DS:CSt:DERIVE:600:0:125000000000 \ + DS:CUe:DERIVE:600:0:125000000000 \ + DS:CUMi:DERIVE:600:0:125000000000 \ + RRA:AVERAGE:0.5:1:600 \ + RRA:AVERAGE:0.5:6:700 \ + RRA:AVERAGE:0.5:24:775 \ + RRA:AVERAGE:0.5:288:797 \ + RRA:MIN:0.5:1:600 \ + RRA:MIN:0.5:6:700 \ + RRA:MIN:0.5:24:775 \ + RRA:MIN:0.5:3:600 \ + RRA:MAX:0.5:1:600 \ + RRA:MAX:0.5:6:700 \ + RRA:MAX:0.5:24:775 \ + RRA:MAX:0.5:288:797"); } rrdtool_update($mysql_rrd, "N:$nstring"); diff --git a/includes/polling/applications/nginx.inc.php b/includes/polling/applications/nginx.inc.php index b0895932cf..921e934209 100644 --- a/includes/polling/applications/nginx.inc.php +++ b/includes/polling/applications/nginx.inc.php @@ -13,23 +13,23 @@ echo(" nginx statistics\n"); list($active, $reading, $writing, $waiting, $req) = explode("\n", $nginx); if (!is_file($nginx_rrd)) { rrdtool_create ($nginx_rrd, "--step 300 \ - DS:Requests:DERIVE:600:0:125000000000 \ - DS:Active:GAUGE:600:0:125000000000 \ - DS:Reading:GAUGE:600:0:125000000000 \ - DS:Writing:GAUGE:600:0:125000000000 \ - DS:Waiting:GAUGE:600:0:125000000000 \ - RRA:AVERAGE:0.5:1:600 \ - RRA:AVERAGE:0.5:6:700 \ - RRA:AVERAGE:0.5:24:775 \ - RRA:AVERAGE:0.5:288:797 \ - RRA:MIN:0.5:1:600 \ - RRA:MIN:0.5:6:700 \ - RRA:MIN:0.5:24:775 \ - RRA:MIN:0.5:3:600 \ - RRA:MAX:0.5:1:600 \ - RRA:MAX:0.5:6:700 \ - RRA:MAX:0.5:24:775 \ - RRA:MAX:0.5:288:797"); + DS:Requests:DERIVE:600:0:125000000000 \ + DS:Active:GAUGE:600:0:125000000000 \ + DS:Reading:GAUGE:600:0:125000000000 \ + DS:Writing:GAUGE:600:0:125000000000 \ + DS:Waiting:GAUGE:600:0:125000000000 \ + RRA:AVERAGE:0.5:1:600 \ + RRA:AVERAGE:0.5:6:700 \ + RRA:AVERAGE:0.5:24:775 \ + RRA:AVERAGE:0.5:288:797 \ + RRA:MIN:0.5:1:600 \ + RRA:MIN:0.5:6:700 \ + RRA:MIN:0.5:24:775 \ + RRA:MIN:0.5:3:600 \ + RRA:MAX:0.5:1:600 \ + RRA:MAX:0.5:6:700 \ + RRA:MAX:0.5:24:775 \ + RRA:MAX:0.5:288:797"); } print "active: $active reading: $reading writing: $writing waiting: $waiting Requests: $req"; rrdtool_update($nginx_rrd, "N:$req:$active:$reading:$writing:$waiting"); diff --git a/includes/polling/cipsec-tunnels.inc.php b/includes/polling/cipsec-tunnels.inc.php index 6bbe48a86e..2612978253 100644 --- a/includes/polling/cipsec-tunnels.inc.php +++ b/includes/polling/cipsec-tunnels.inc.php @@ -42,7 +42,7 @@ foreach($ipsec_array as $index => $tunnel) - if(!is_array($tunnels[$tunnel['cikeTunRemoteValue']])) + if (!is_array($tunnels[$tunnel['cikeTunRemoteValue']])) { $tunnel_id = dbInsert(array('device_id' => $device['device_id'], 'peer_addr' => $tunnel['cikeTunRemoteValue'], 'local_addr' => $tunnel['cikeTunLocalValue'], 'tunnel_name' => $tunnel['cikeTunLocalName']), 'ipsec_tunnels'); } else { diff --git a/includes/polling/cisco-cef.inc.php b/includes/polling/cisco-cef.inc.php index ac28571283..1cf6d71522 100755 --- a/includes/polling/cisco-cef.inc.php +++ b/includes/polling/cisco-cef.inc.php @@ -33,13 +33,13 @@ if (is_array($cefs)) echo(" | |-".$path.": ".$cef_stat['cefSwitchingPath']); - if(dbFetchCell("SELECT COUNT(*) FROM `cef_switching` WHERE `device_id` = ? AND `entPhysicalIndex` = ? AND `afi` = ? AND `cef_index` = ?", array($device['device_id'], $entity, $afi, $path)) != "1") + if (dbFetchCell("SELECT COUNT(*) FROM `cef_switching` WHERE `device_id` = ? AND `entPhysicalIndex` = ? AND `afi` = ? AND `cef_index` = ?", array($device['device_id'], $entity, $afi, $path)) != "1") { dbInsert(array('device_id' => $device['device_id'], 'entPhysicalIndex' => $entity, 'afi' => $afi, 'cef_index' => $path, 'cef_path' => $cef_stat['cefSwitchingPath']), 'cef_switching'); echo("+"); } - $cef_entry = dbFetchRow("SELECT * FROM `cef_switching` WHERE `device_id` = ? AND `entPhysicalIndex = ? AND `afi` = ? AND `cef_index` = ?", array($device['device_id'], $entity, $afi, $path)); + $cef_entry = dbFetchRow("SELECT * FROM `cef_switching` WHERE `device_id` = ? AND `entPhysicalIndex = ? AND `afi` = ? AND `cef_index` = ?", array($device['device_id'], $entity, $afi, $path)); $filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("cefswitching-".$entity."-".$afi."-".$path.".rrd"); @@ -74,7 +74,7 @@ if (is_array($cefs)) $rrd_update = "N:".$cef_stat['cefSwitchingDrop'].":".$cef_stat['cefSwitchingPunt'].":".$cef_stat['cefSwitchingPunt2Host']; $ret = rrdtool_update("$filename", $rrd_update); - if($debug) { echo(" Values: ".$cef_stat['cefSwitchingDrop'].":".$cef_stat['cefSwitchingPunt'].":".$cef_stat['cefSwitchingPunt2Host']); } + if ($debug) { echo(" Values: ".$cef_stat['cefSwitchingDrop'].":".$cef_stat['cefSwitchingPunt'].":".$cef_stat['cefSwitchingPunt2Host']); } echo("\n"); diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php index 71b42ba9c2..d5deea0dad 100644 --- a/includes/polling/functions.inc.php +++ b/includes/polling/functions.inc.php @@ -8,7 +8,7 @@ function poll_sensor($device, $class, $unit) { echo("Checking $class " . $sensor['sensor_descr'] . "... "); - if($class == "temperature") + if ($class == "temperature") { for ($i = 0;$i < 5;$i++) # Try 5 times to get a valid temp reading { @@ -23,7 +23,7 @@ function poll_sensor($device, $class, $unit) $sensor_value = snmp_get($device, $sensor['sensor_oid'], "-OUqnv", "SNMPv2-MIB"); } - if($sensor_value == -32768) { echo("Invalid (-32768) "); $sensor_value = 0; } + if ($sensor_value == -32768) { echo("Invalid (-32768) "); $sensor_value = 0; } if ($sensor['sensor_divisor']) { $sensor_value = $sensor_value / $sensor['sensor_divisor']; } if ($sensor['sensor_multiplier']) { $sensor_value = $sensor_value * $sensor['sensor_multiplier']; } diff --git a/includes/polling/os/sentry3.inc.php b/includes/polling/os/sentry3.inc.php index ec8bc5779a..2a0b24826a 100644 --- a/includes/polling/os/sentry3.inc.php +++ b/includes/polling/os/sentry3.inc.php @@ -1,8 +1,8 @@ $ospf_nbr_poll['interface_id']); } else { $ospf_nbr_update = array('interface_id' => array('NULL')); diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php index 69f9a545ff..6518ebbd9c 100755 --- a/includes/polling/ports.inc.php +++ b/includes/polling/ports.inc.php @@ -293,7 +293,7 @@ foreach ($ports as $port) { // If data has changed, build a query $port['update'][$oid] = $this_port[$oid]; echo("PAgP "); - log_event("$oid -> ".$this_port[$oid], $device, 'interface', $port['interface_id']); + log_event("$oid -> ".$this_port[$oid], $device, 'interface', $port['interface_id']); } } } @@ -309,14 +309,14 @@ foreach ($ports as $port) if ($config['enable_ports_poe']) { include("port-poe.inc.php"); } /// Do Alcatel Detailed Stats - if($device['os'] == "aos") { include("port-alcatel.inc.php"); } + if ($device['os'] == "aos") { include("port-alcatel.inc.php"); } // Update Database if (count($port['update'])) { $updated = dbUpdate($port['update'], 'ports', '`interface_id` = ?', array($port['interface_id'])); - if($debug) { echo("$updated updated"); } + if ($debug) { echo("$updated updated"); } } // End Update Database diff --git a/includes/rewrites.php b/includes/rewrites.php index a2cb215766..27f62112df 100644 --- a/includes/rewrites.php +++ b/includes/rewrites.php @@ -45,7 +45,7 @@ function ifLabel ($interface, $device = NULL) { $interface['label'] = $interface['ifName']; - if($interface['ifName'] == "") + if ($interface['ifName'] == "") { $interface['label'] = $interface['ifDescr']; } else { @@ -977,7 +977,7 @@ function rewrite_adslLineType($adslLineType) foreach($adslLineTypes as $type => $text) { - if($adslLineType == $type) + if ($adslLineType == $type) { $adslLineType = $text; } diff --git a/includes/snom-graphing.php b/includes/snom-graphing.php index ee3b0a99b6..1057c3feb4 100644 --- a/includes/snom-graphing.php +++ b/includes/snom-graphing.php @@ -4,6 +4,7 @@ function callsgraphSNOM ($rrd, $graph, $from, $to, $width, $height, $title, $vertical) { global $config; + $database = $config['rrd_dir'] . "/" . $rrd; $imgfile = "graphs/" . "$graph"; $optsa = array( "--start", $from, "--end", $to, "--width", $width, "--height", $height, "--vertical-label", $vertical ,"--alt-autoscale-max", @@ -16,7 +17,7 @@ function callsgraphSNOM ($rrd, $graph, $from, $to, $width, $height, $title, $ver "GPRINT:calls:LAST:Cu\: %2.0lf/min", "GPRINT:calls:AVERAGE:Av\: %2.0lf/min", "GPRINT:calls:MAX:Mx\: %2.0lf/min\\n"); - if($width <= "300") {$optsb = array("--font", "LEGEND:7:".$config['mono_font']."", + if ($width <= "300") {$optsb = array("--font", "LEGEND:7:".$config['mono_font']."", "--font", "AXIS:6:".$config['mono_font']."", "--font-render-mode", "normal");} @@ -24,7 +25,7 @@ function callsgraphSNOM ($rrd, $graph, $from, $to, $width, $height, $title, $ver $ret = rrd_graph("$imgfile", $opts, count($opts)); - if( !is_array($ret) ) { + if ( !is_array($ret) ) { $err = rrd_error(); echo("rrd_graph() ERROR: $err\n"); return FALSE; diff --git a/includes/static-config.php b/includes/static-config.php index 58cd18f4c9..caddf85a51 100644 --- a/includes/static-config.php +++ b/includes/static-config.php @@ -6,13 +6,13 @@ # YES, THAT MEANS YOU # ######################################################### -$config['os']['default']['over'][0]['graph'] = "device_processor"; -$config['os']['default']['over'][0]['text'] = "Processor Usage"; -$config['os']['default']['over'][1]['graph'] = "device_mempool"; -$config['os']['default']['over'][1]['text'] = "Memory Usage"; +$config['os']['default']['over'][0]['graph'] = "device_processor"; +$config['os']['default']['over'][0]['text'] = "Processor Usage"; +$config['os']['default']['over'][1]['graph'] = "device_mempool"; +$config['os']['default']['over'][1]['text'] = "Memory Usage"; $os_group = "unix"; -$config['os_group'][$os_group]['type'] = "server"; +$config['os_group'][$os_group]['type'] = "server"; $config['os_group'][$os_group]['processor_stacked'] = 1; $config['os_group'][$os_group]['over'][0]['graph'] = "device_processor"; $config['os_group'][$os_group]['over'][0]['text'] = "Processor Usage"; @@ -21,7 +21,7 @@ $config['os_group'][$os_group]['over'][1]['text'] = "Memory Usage"; $os = "generic"; -$config['os'][$os]['text'] = "Generic Device"; +$config['os'][$os]['text'] = "Generic Device"; $os = "vyatta"; $config['os'][$os]['text'] = "Vyatta"; @@ -32,9 +32,9 @@ $config['os'][$os]['ifname'] = 1; $os = "linux"; $config['os'][$os]['type'] = "server"; -$config['os'][$os]['group'] = "unix"; -$config['os'][$os]['text'] = "Linux"; -$config['os'][$os]['ifXmcbc'] = 1; +$config['os'][$os]['group'] = "unix"; +$config['os'][$os]['text'] = "Linux"; +$config['os'][$os]['ifXmcbc'] = 1; $config['os'][$os]['over'][0]['graph'] = "device_processor"; $config['os'][$os]['over'][0]['text'] = "Processor Usage"; $config['os'][$os]['over'][1]['graph'] = "device_ucd_memory"; @@ -54,54 +54,54 @@ $config['os'][$os]['ifXmcbc'] = 1; $os = "freebsd"; $config['os'][$os]['type'] = "server"; -$config['os'][$os]['group'] = "unix"; -$config['os'][$os]['text'] = "FreeBSD"; +$config['os'][$os]['group'] = "unix"; +$config['os'][$os]['text'] = "FreeBSD"; $os = "openbsd"; $config['os'][$os]['type'] = "server"; -$config['os'][$os]['group'] = "unix"; -$config['os'][$os]['text'] = "OpenBSD"; +$config['os'][$os]['group'] = "unix"; +$config['os'][$os]['text'] = "OpenBSD"; $os = "netbsd"; $config['os'][$os]['type'] = "server"; -$config['os'][$os]['group'] = "unix"; -$config['os'][$os]['text'] = "NetBSD"; +$config['os'][$os]['group'] = "unix"; +$config['os'][$os]['text'] = "NetBSD"; $os = "dragonfly"; $config['os'][$os]['type'] = "server"; -$config['os'][$os]['group'] = "unix"; -$config['os'][$os]['text'] = "DragonflyBSD"; +$config['os'][$os]['group'] = "unix"; +$config['os'][$os]['text'] = "DragonflyBSD"; $os = "netware"; $config['os'][$os]['type'] = "server"; -$config['os'][$os]['text'] = "Novell Netware"; -$config['os'][$os]['icon'] = "novell"; +$config['os'][$os]['text'] = "Novell Netware"; +$config['os'][$os]['icon'] = "novell"; $os = "monowall"; -$config['os'][$os]['group'] = "unix"; -$config['os'][$os]['text'] = "m0n0wall"; -$config['os'][$os]['type'] = "firewall"; +$config['os'][$os]['group'] = "unix"; +$config['os'][$os]['text'] = "m0n0wall"; +$config['os'][$os]['type'] = "firewall"; $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'] = "CPU Usage"; $os = "solaris"; -$config['os'][$os]['group'] = "unix"; -$config['os'][$os]['text'] = "Sun Solaris"; +$config['os'][$os]['group'] = "unix"; +$config['os'][$os]['text'] = "Sun Solaris"; $config['os'][$os]['type'] = "server"; $os = "adva"; $config['os'][$os]['type'] = "network"; -$config['os'][$os]['text'] = "Adva Optical"; +$config['os'][$os]['text'] = "Adva Optical"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; $os = "opensolaris"; $config['os'][$os]['type'] = "server"; -$config['os'][$os]['group'] = "unix"; -$config['os'][$os]['text'] = "Sun OpenSolaris"; +$config['os'][$os]['group'] = "unix"; +$config['os'][$os]['text'] = "Sun OpenSolaris"; $os = "openindiana"; $config['os'][$os]['type'] = "server"; @@ -132,23 +132,23 @@ $config['os'][$os]['icon'] = "alcatellucent"; ## Cisco OSes $os = "ios"; -$config['os'][$os]['group'] = "ios"; -$config['os'][$os]['text'] = "Cisco IOS"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['ifXmcbc'] = 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'] = "CPU Usage"; -$config['os'][$os]['over'][2]['graph'] = "device_mempool"; -$config['os'][$os]['over'][2]['text'] = "Memory Usage"; +$config['os'][$os]['group'] = "ios"; +$config['os'][$os]['text'] = "Cisco IOS"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['ifXmcbc'] = 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'] = "CPU Usage"; +$config['os'][$os]['over'][2]['graph'] = "device_mempool"; +$config['os'][$os]['over'][2]['text'] = "Memory Usage"; $config['os'][$os]['icon'] = "cisco"; $os = "cat1900"; -$config['os'][$os]['group'] = "cat1900"; -$config['os'][$os]['text'] = "Cisco Catalyst 1900"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['icon'] = "cisco-old"; +$config['os'][$os]['group'] = "cat1900"; +$config['os'][$os]['text'] = "Cisco Catalyst 1900"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['icon'] = "cisco-old"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; $config['os'][$os]['over'][1]['graph'] = "device_processor"; @@ -157,24 +157,24 @@ $config['os'][$os]['over'][2]['graph'] = "device_mempool"; $config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "iosxe"; -$config['os'][$os]['group'] = "ios"; -$config['os'][$os]['text'] = "Cisco IOS-XE"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['ifXmcbc'] = 1; +$config['os'][$os]['group'] = "ios"; +$config['os'][$os]['text'] = "Cisco IOS-XE"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['ifXmcbc'] = 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'] = "CPU Usage"; $config['os'][$os]['over'][2]['graph'] = "device_mempool"; $config['os'][$os]['over'][2]['text'] = "Memory Usage"; -$config['os'][$os]['icon'] = "cisco"; +$config['os'][$os]['icon'] = "cisco"; $os = "iosxr"; -$config['os'][$os]['group'] = "ios"; -$config['os'][$os]['text'] = "Cisco IOS-XR"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['ifXmcbc'] = 1; -$config['os'][$os]['icon'] = "cisco"; +$config['os'][$os]['group'] = "ios"; +$config['os'][$os]['text'] = "Cisco IOS-XR"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['ifXmcbc'] = 1; +$config['os'][$os]['icon'] = "cisco"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; $config['os'][$os]['over'][1]['graph'] = "device_processor"; @@ -183,21 +183,21 @@ $config['os'][$os]['over'][2]['graph'] = "device_mempool"; $config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "asa"; -$config['os'][$os]['group'] = "ios"; -$config['os'][$os]['text'] = "Cisco ASA"; -$config['os'][$os]['ifname'] = 1; -$config['os'][$os]['type'] = "firewall"; -$config['os'][$os]['icon'] = "cisco"; +$config['os'][$os]['group'] = "ios"; +$config['os'][$os]['text'] = "Cisco ASA"; +$config['os'][$os]['ifname'] = 1; +$config['os'][$os]['type'] = "firewall"; +$config['os'][$os]['icon'] = "cisco"; $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'] = "CPU Usage"; $os = "pix"; -$config['os'][$os]['group'] = "ios"; -$config['os'][$os]['text'] = "Cisco PIX-OS"; -$config['os'][$os]['ifname'] = 1; -$config['os'][$os]['type'] = "firewall"; +$config['os'][$os]['group'] = "ios"; +$config['os'][$os]['text'] = "Cisco PIX-OS"; +$config['os'][$os]['ifname'] = 1; +$config['os'][$os]['type'] = "firewall"; $config['os'][$os]['icon'] = "cisco"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; @@ -207,9 +207,9 @@ $config['os'][$os]['over'][2]['graph'] = "device_mempool"; $config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "nxos"; -$config['os'][$os]['group'] = "ios"; -$config['os'][$os]['text'] = "Cisco NX-OS"; -$config['os'][$os]['type'] = "network"; +$config['os'][$os]['group'] = "ios"; +$config['os'][$os]['text'] = "Cisco NX-OS"; +$config['os'][$os]['type'] = "network"; $config['os'][$os]['icon'] = "cisco"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; @@ -231,10 +231,10 @@ $config['os'][$os]['over'][2]['graph'] = "device_mempool"; $config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "catos"; -$config['os'][$os]['group'] = "ios"; -$config['os'][$os]['text'] = "Cisco CatOS"; -$config['os'][$os]['ifname'] = 1; -$config['os'][$os]['type'] = "network"; +$config['os'][$os]['group'] = "ios"; +$config['os'][$os]['text'] = "Cisco CatOS"; +$config['os'][$os]['ifname'] = 1; +$config['os'][$os]['type'] = "network"; $config['os'][$os]['icon'] = "cisco-old"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; @@ -246,16 +246,16 @@ $config['os'][$os]['over'][2]['text'] = "Memory Usage"; ## Huawei $os = "vrp"; -$config['os'][$os]['group'] = "vrp"; -$config['os'][$os]['text'] = "Huawei VRP"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['icon'] = "huawei"; +$config['os'][$os]['group'] = "vrp"; +$config['os'][$os]['text'] = "Huawei VRP"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['icon'] = "huawei"; # Juniper $os = "junos"; -$config['os'][$os]['text'] = "Juniper JunOS"; -$config['os'][$os]['type'] = "network"; +$config['os'][$os]['text'] = "Juniper JunOS"; +$config['os'][$os]['type'] = "network"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; $config['os'][$os]['over'][1]['graph'] = "device_processor"; @@ -275,13 +275,13 @@ $config['os'][$os]['over'][2]['graph'] = "device_mempool"; $config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "jwos"; -$config['os'][$os]['text'] = "Juniper JWOS"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['icon'] = "junos"; +$config['os'][$os]['text'] = "Juniper JWOS"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['icon'] = "junos"; $os = "screenos"; -$config['os'][$os]['text'] = "Juniper ScreenOS"; -$config['os'][$os]['type'] = "firewall"; +$config['os'][$os]['text'] = "Juniper ScreenOS"; +$config['os'][$os]['type'] = "firewall"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; $config['os'][$os]['over'][1]['graph'] = "device_processor"; @@ -292,7 +292,7 @@ $config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "fortigate"; $config['os'][$os]['text'] = "Fortinet Fortigate"; $config['os'][$os]['type'] = "firewall"; -$config['os'][$os]['icon'] = "fortinet"; +$config['os'][$os]['icon'] = "fortinet"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; #$config['os'][$os]['over'][1]['graph'] = "device_processor"; @@ -301,9 +301,9 @@ $config['os'][$os]['over'][0]['text'] = "Device Traffic"; #$config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "routeros"; -$config['os'][$os]['text'] = "Mikrotik RouterOS"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['nobulk'] = 1; +$config['os'][$os]['text'] = "Mikrotik RouterOS"; +$config['os'][$os]['type'] = "network"; +$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"; @@ -312,8 +312,8 @@ $config['os'][$os]['over'][2]['graph'] = "device_mempool"; $config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "ironware"; -$config['os'][$os]['text'] = "Brocade IronWare"; -$config['os'][$os]['type'] = "network"; +$config['os'][$os]['text'] = "Brocade IronWare"; +$config['os'][$os]['type'] = "network"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; $config['os'][$os]['over'][1]['graph'] = "device_processor"; @@ -322,10 +322,10 @@ $config['os'][$os]['over'][2]['graph'] = "device_mempool"; $config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "extremeware"; -$config['os'][$os]['text'] = "Extremeware"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['ifname'] = 1; -$config['os'][$os]['icon'] = "extreme"; +$config['os'][$os]['text'] = "Extremeware"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['ifname'] = 1; +$config['os'][$os]['icon'] = "extreme"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; $config['os'][$os]['over'][1]['graph'] = "device_processor"; @@ -334,15 +334,15 @@ $config['os'][$os]['over'][2]['graph'] = "device_mempool"; $config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "packetshaper"; -$config['os'][$os]['text'] = "Blue Coat Packetshaper"; -$config['os'][$os]['type'] = "network"; +$config['os'][$os]['text'] = "Blue Coat Packetshaper"; +$config['os'][$os]['type'] = "network"; $os = "xos"; -$config['os'][$os]['text'] = "Extreme XOS"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['ifname'] = 1; -$config['os'][$os]['group'] = "extremeware"; -$config['os'][$os]['icon'] = "extreme"; +$config['os'][$os]['text'] = "Extreme XOS"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['ifname'] = 1; +$config['os'][$os]['group'] = "extremeware"; +$config['os'][$os]['icon'] = "extreme"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; $config['os'][$os]['over'][1]['graph'] = "device_processor"; @@ -351,9 +351,9 @@ $config['os'][$os]['over'][2]['graph'] = "device_mempool"; $config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "ftos"; -$config['os'][$os]['text'] = "Force10 FTOS"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['icon'] = "force10"; +$config['os'][$os]['text'] = "Force10 FTOS"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['icon'] = "force10"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; $config['os'][$os]['over'][1]['graph'] = "device_processor"; @@ -388,15 +388,15 @@ $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; $os = "powerconnect"; -$config['os'][$os]['text'] = "Dell PowerConnect"; -$config['os'][$os]['ifname'] = 1; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['icon'] = "dell"; +$config['os'][$os]['text'] = "Dell PowerConnect"; +$config['os'][$os]['ifname'] = 1; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['icon'] = "dell"; $os = "radlan"; -$config['os'][$os]['text'] = "Radlan"; -$config['os'][$os]['ifname'] = 1; -$config['os'][$os]['type'] = "network"; +$config['os'][$os]['text'] = "Radlan"; +$config['os'][$os]['ifname'] = 1; +$config['os'][$os]['type'] = "network"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; $config['os'][$os]['over'][1]['graph'] = "device_processor"; @@ -405,22 +405,22 @@ $config['os'][$os]['over'][1]['text'] = "CPU Usage"; #$config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "powervault"; -$config['os'][$os]['text'] = "Dell PowerVault"; -$config['os'][$os]['icon'] = "dell"; +$config['os'][$os]['text'] = "Dell PowerVault"; +$config['os'][$os]['icon'] = "dell"; $os = "drac"; -$config['os'][$os]['text'] = "Dell DRAC"; -$config['os'][$os]['icon'] = "dell"; +$config['os'][$os]['text'] = "Dell DRAC"; +$config['os'][$os]['icon'] = "dell"; $os = "bcm963"; -$config['os'][$os]['text'] = "Broadcom BCM963xx"; -$config['os'][$os]['icon'] = "broadcom"; +$config['os'][$os]['text'] = "Broadcom BCM963xx"; +$config['os'][$os]['icon'] = "broadcom"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; $os = "netopia"; -$config['os'][$os]['text'] = "Motorola Netopia"; -$config['os'][$os]['type'] = "network"; +$config['os'][$os]['text'] = "Motorola Netopia"; +$config['os'][$os]['type'] = "network"; $os = "tranzeo"; $config['os'][$os]['text'] = "Tranzeo"; @@ -428,31 +428,31 @@ $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; $os = "dlink"; -$config['os'][$os]['text'] = "D-Link Switch"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['icon'] = "dlink"; +$config['os'][$os]['text'] = "D-Link Switch"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['icon'] = "dlink"; $os = "dlinkap"; -$config['os'][$os]['text'] = "D-Link Access Point"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['icon'] = "dlink"; +$config['os'][$os]['text'] = "D-Link Access Point"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['icon'] = "dlink"; $os = "axiscam"; -$config['os'][$os]['text'] = "AXIS Network Camera"; -$config['os'][$os]['icon'] = "axis"; +$config['os'][$os]['text'] = "AXIS Network Camera"; +$config['os'][$os]['icon'] = "axis"; $os = "axisdocserver"; -$config['os'][$os]['text'] = "AXIS Network Document Server"; -$config['os'][$os]['icon'] = "axis"; +$config['os'][$os]['text'] = "AXIS Network Document Server"; +$config['os'][$os]['icon'] = "axis"; $os = "gamatronicups"; -$config['os'][$os]['text'] = "Gamatronic UPS Stack"; -$config['os'][$os]['type'] = "power"; +$config['os'][$os]['text'] = "Gamatronic UPS Stack"; +$config['os'][$os]['type'] = "power"; $os = "powerware"; -$config['os'][$os]['text'] = "Powerware UPS"; -$config['os'][$os]['type'] = "power"; -$config['os'][$os]['icon'] = "eaton"; +$config['os'][$os]['text'] = "Powerware UPS"; +$config['os'][$os]['type'] = "power"; +$config['os'][$os]['icon'] = "eaton"; $config['os'][$os]['over'][0]['graph'] = "device_voltages"; $config['os'][$os]['over'][0]['text'] = "Voltages"; $config['os'][$os]['over'][1]['graph'] = "device_current"; @@ -461,9 +461,9 @@ $config['os'][$os]['over'][2]['graph'] = "device_frequencies"; $config['os'][$os]['over'][2]['text'] = "Frequencies"; $os = "deltaups"; -$config['os'][$os]['text'] = "Delta UPS"; -$config['os'][$os]['type'] = "power"; -$config['os'][$os]['icon'] = "delta"; +$config['os'][$os]['text'] = "Delta UPS"; +$config['os'][$os]['type'] = "power"; +$config['os'][$os]['icon'] = "delta"; $os = "liebert"; $config['os'][$os]['text'] = "Liebert"; @@ -472,18 +472,18 @@ $config['os'][$os]['icon'] = "liebert"; $os = "engenius"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['text'] = "EnGenius Access Point"; -$config['os'][$os]['icon'] = "engenius"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['text'] = "EnGenius Access Point"; +$config['os'][$os]['icon'] = "engenius"; $os = "airport"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['text'] = "Apple AirPort"; -$config['os'][$os]['icon'] = "apple"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['text'] = "Apple AirPort"; +$config['os'][$os]['icon'] = "apple"; $os = "windows"; -$config['os'][$os]['text'] = "Microsoft Windows"; -$config['os'][$os]['ifname'] = 1; +$config['os'][$os]['text'] = "Microsoft Windows"; +$config['os'][$os]['ifname'] = 1; $config['os'][$os]['processor_stacked'] = 1; @@ -493,9 +493,9 @@ $config['os'][$os]['type'] = "network"; $config['os'][$os]['icon'] = "bnt"; $os = "procurve"; -$config['os'][$os]['text'] = "HP ProCurve"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['icon'] = "hp"; +$config['os'][$os]['text'] = "HP ProCurve"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['icon'] = "hp"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Traffic"; $config['os'][$os]['over'][1]['graph'] = "device_processor"; @@ -504,68 +504,68 @@ $config['os'][$os]['over'][2]['graph'] = "device_mempool"; $config['os'][$os]['over'][2]['text'] = "Memory Usage"; $os = "speedtouch"; -$config['os'][$os]['text'] = "Thomson Speedtouch"; -$config['os'][$os]['ifname'] = 1; -$config['os'][$os]['type'] = "network"; +$config['os'][$os]['text'] = "Thomson Speedtouch"; +$config['os'][$os]['ifname'] = 1; +$config['os'][$os]['type'] = "network"; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Traffic"; $os = "sonicwall"; -$config['os'][$os]['text'] = "SonicWALL"; -$config['os'][$os]['type'] = "firewall"; -$config['os'][$os]['over'][0]['graph'] = "device_bits"; -$config['os'][$os]['over'][0]['text'] = "Traffic"; +$config['os'][$os]['text'] = "SonicWALL"; +$config['os'][$os]['type'] = "firewall"; +$config['os'][$os]['over'][0]['graph'] = "device_bits"; +$config['os'][$os]['over'][0]['text'] = "Traffic"; $os = "zywall"; -$config['os'][$os]['text'] = "ZyXEL ZyWALL"; -$config['os'][$os]['type'] = "firewall"; -$config['os'][$os]['over'][0]['graph'] = "device_bits"; -$config['os'][$os]['over'][0]['text'] = "Traffic"; -$config['os'][$os]['icon'] = "zyxel"; +$config['os'][$os]['text'] = "ZyXEL ZyWALL"; +$config['os'][$os]['type'] = "firewall"; +$config['os'][$os]['over'][0]['graph'] = "device_bits"; +$config['os'][$os]['over'][0]['text'] = "Traffic"; +$config['os'][$os]['icon'] = "zyxel"; $os = "prestige"; -$config['os'][$os]['text'] = "ZyXEL Prestige"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['icon'] = "zyxel"; +$config['os'][$os]['text'] = "ZyXEL Prestige"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['icon'] = "zyxel"; $os = "zyxeles"; -$config['os'][$os]['text'] = "ZyXEL Ethernet Switch"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['icon'] = "zyxel"; +$config['os'][$os]['text'] = "ZyXEL Ethernet Switch"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['icon'] = "zyxel"; $os = "zyxelnwa"; -$config['os'][$os]['text'] = "ZyXEL NWA"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['icon'] = "zyxel"; +$config['os'][$os]['text'] = "ZyXEL NWA"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['icon'] = "zyxel"; $os = "ies"; -$config['os'][$os]['text'] = "ZyXEL DSLAM"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['icon'] = "zyxel"; +$config['os'][$os]['text'] = "ZyXEL DSLAM"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['icon'] = "zyxel"; $os = "allied"; -$config['os'][$os]['text'] = "AlliedWare"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['ifname'] = 1; +$config['os'][$os]['text'] = "AlliedWare"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['ifname'] = 1; $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Traffic"; $os = "mgeups"; -$config['os'][$os]['text'] = "MGE UPS"; -$config['os'][$os]['group'] = "ups"; -$config['os'][$os]['type'] = "power"; -$config['os'][$os]['icon'] = "mge"; +$config['os'][$os]['text'] = "MGE UPS"; +$config['os'][$os]['group'] = "ups"; +$config['os'][$os]['type'] = "power"; +$config['os'][$os]['icon'] = "mge"; $config['os'][$os]['over'][0]['graph'] = "device_current"; $config['os'][$os]['over'][0]['text'] = "Current"; $os = "mgepdu"; -$config['os'][$os]['text'] = "MGE PDU"; -$config['os'][$os]['type'] = "power"; -$config['os'][$os]['icon'] = "mge"; +$config['os'][$os]['text'] = "MGE PDU"; +$config['os'][$os]['type'] = "power"; +$config['os'][$os]['icon'] = "mge"; $os = "apc"; -$config['os'][$os]['text'] = "APC Management Module"; -$config['os'][$os]['type'] = "power"; +$config['os'][$os]['text'] = "APC Management Module"; +$config['os'][$os]['type'] = "power"; $config['os'][$os]['over'][0]['graph'] = "device_current"; $config['os'][$os]['over'][0]['text'] = "Current"; @@ -584,15 +584,15 @@ $config['os'][$os]['over'][0]['graph'] = "device_current"; $config['os'][$os]['over'][0]['text'] = "Current"; $os = "areca"; -$config['os'][$os]['text'] = "Areca RAID Subsystem"; +$config['os'][$os]['text'] = "Areca RAID Subsystem"; $config['os'][$os]['over'][0]['graph'] = ""; $config['os'][$os]['over'][0]['text'] = ""; $os = "netmanplus"; -$config['os'][$os]['text'] = "NetMan Plus"; -$config['os'][$os]['group'] = "ups"; -$config['os'][$os]['nobulk'] = 1; -$config['os'][$os]['type'] = "power"; +$config['os'][$os]['text'] = "NetMan Plus"; +$config['os'][$os]['group'] = "ups"; +$config['os'][$os]['nobulk'] = 1; +$config['os'][$os]['type'] = "power"; $config['os'][$os]['over'][0]['graph'] = "device_current"; $config['os'][$os]['over'][0]['text'] = "Current"; @@ -603,8 +603,8 @@ $config['os'][$os]['over'][0]['graph'] = "device_temperature"; $config['os'][$os]['over'][0]['text'] = "temperature"; $os = "minkelsrms"; -$config['os'][$os]['text'] = "Minkels RMS"; -$config['os'][$os]['type'] = "environment"; +$config['os'][$os]['text'] = "Minkels RMS"; +$config['os'][$os]['type'] = "environment"; $config['os'][$os]['over'][0]['graph'] = "device_temperature"; $config['os'][$os]['over'][0]['text'] = "temperature"; @@ -622,88 +622,88 @@ $config['os'][$os]['over'][0]['graph'] = "device_temperature"; $config['os'][$os]['over'][0]['text'] = "temperature"; $os = "papouch-tme"; -$config['os'][$os]['text'] = "Papouch TME"; -$config['os'][$os]['type'] = "environment"; +$config['os'][$os]['text'] = "Papouch TME"; +$config['os'][$os]['type'] = "environment"; $config['os'][$os]['over'][0]['graph'] = "device_temperature"; $config['os'][$os]['over'][0]['text'] = "temperature"; $os = "cometsystem-p85xx"; -$config['os'][$os]['text'] = "Comet System P85xx"; -$config['os'][$os]['type'] = "environment"; -$config['os'][$os]['icon'] = "comet"; +$config['os'][$os]['text'] = "Comet System P85xx"; +$config['os'][$os]['type'] = "environment"; +$config['os'][$os]['icon'] = "comet"; $config['os'][$os]['over'][0]['graph'] = "device_temperature"; $config['os'][$os]['over'][0]['text'] = "temperature"; $os = "dell-laser"; -$config['os'][$os]['group'] = "printer"; -$config['os'][$os]['text'] = "Dell Laser"; -$config['os'][$os]['ifname'] = 1; -$config['os'][$os]['type'] = "printer"; -$config['os'][$os]['icon'] = "dell"; +$config['os'][$os]['group'] = "printer"; +$config['os'][$os]['text'] = "Dell Laser"; +$config['os'][$os]['ifname'] = 1; +$config['os'][$os]['type'] = "printer"; +$config['os'][$os]['icon'] = "dell"; $config['os'][$os]['over'][0]['graph'] = "device_toner"; $config['os'][$os]['over'][0]['text'] = "Toner"; $os = "ricoh"; -$config['os'][$os]['group'] = "printer"; -$config['os'][$os]['text'] = "Ricoh Printer"; -$config['os'][$os]['type'] = "printer"; -$config['os'][$os]['icon'] = "ricoh"; +$config['os'][$os]['group'] = "printer"; +$config['os'][$os]['text'] = "Ricoh Printer"; +$config['os'][$os]['type'] = "printer"; +$config['os'][$os]['icon'] = "ricoh"; $config['os'][$os]['over'][0]['graph'] = "device_toner"; $config['os'][$os]['over'][0]['text'] = "Toner"; $os = "xerox"; -$config['os'][$os]['group'] = "printer"; -$config['os'][$os]['text'] = "Xerox Printer"; -$config['os'][$os]['ifname'] = 1; -$config['os'][$os]['type'] = "printer"; +$config['os'][$os]['group'] = "printer"; +$config['os'][$os]['text'] = "Xerox Printer"; +$config['os'][$os]['ifname'] = 1; +$config['os'][$os]['type'] = "printer"; $config['os'][$os]['over'][0]['graph'] = "device_toner"; $config['os'][$os]['over'][0]['text'] = "Toner"; $os = "jetdirect"; -$config['os'][$os]['group'] = "printer"; -$config['os'][$os]['text'] = "HP Print server"; -$config['os'][$os]['ifname'] = 1; -$config['os'][$os]['type'] = "printer"; -$config['os'][$os]['icon'] = "hp"; +$config['os'][$os]['group'] = "printer"; +$config['os'][$os]['text'] = "HP Print server"; +$config['os'][$os]['ifname'] = 1; +$config['os'][$os]['type'] = "printer"; +$config['os'][$os]['icon'] = "hp"; $config['os'][$os]['over'][0]['graph'] = "device_toner"; $config['os'][$os]['over'][0]['text'] = "Toner"; $os = "richoh"; -$config['os'][$os]['group'] = "printer"; -$config['os'][$os]['text'] = "Ricoh Printer"; -$config['os'][$os]['type'] = "printer"; +$config['os'][$os]['group'] = "printer"; +$config['os'][$os]['text'] = "Ricoh Printer"; +$config['os'][$os]['type'] = "printer"; $config['os'][$os]['over'][0]['graph'] = "device_toner"; $config['os'][$os]['over'][0]['text'] = "Toner"; $os = "okilan"; -$config['os'][$os]['group'] = "printer"; -$config['os'][$os]['text'] = "OKI Printer"; +$config['os'][$os]['group'] = "printer"; +$config['os'][$os]['text'] = "OKI Printer"; $config['os'][$os]['overgraph'][] = "device_toner"; $config['os'][$os]['overtext'] = "Toner"; $config['os'][$os]['type'] = "printer"; $config['os'][$os]['icon'] = "oki"; $os = "brother"; -$config['os'][$os]['group'] = "printer"; -$config['os'][$os]['text'] = "Brother Printer"; -$config['os'][$os]['type'] = "printer"; +$config['os'][$os]['group'] = "printer"; +$config['os'][$os]['text'] = "Brother Printer"; +$config['os'][$os]['type'] = "printer"; $config['os'][$os]['over'][0]['graph'] = "device_toner"; $config['os'][$os]['over'][0]['text'] = "Toner"; $os = "konica"; -$config['os'][$os]['group'] = "printer"; -$config['os'][$os]['text'] = "Konica-Minolta Printer"; -$config['os'][$os]['type'] = "printer"; +$config['os'][$os]['group'] = "printer"; +$config['os'][$os]['text'] = "Konica-Minolta Printer"; +$config['os'][$os]['type'] = "printer"; $config['os'][$os]['over'][0]['graph'] = "device_toner"; $config['os'][$os]['over'][0]['text'] = "Toner"; $os = "kyocera"; -$config['os'][$os]['group'] = "printer"; -$config['os'][$os]['text'] = "Kyocera Mita Printer"; -$config['os'][$os]['over'][0]['graph'] = "device_toner"; -$config['os'][$os]['over'][0]['text'] = "Toner"; -$config['os'][$os]['ifname'] = 1; -$config['os'][$os]['type'] = "printer"; +$config['os'][$os]['group'] = "printer"; +$config['os'][$os]['text'] = "Kyocera Mita Printer"; +$config['os'][$os]['over'][0]['graph'] = "device_toner"; +$config['os'][$os]['over'][0]['text'] = "Toner"; +$config['os'][$os]['ifname'] = 1; +$config['os'][$os]['type'] = "printer"; $os = "3com"; $config['os'][$os]['text'] = "3Com"; @@ -712,11 +712,11 @@ $config['os'][$os]['over'][0]['text'] = "Traffic"; $config['os'][$os]['type'] = "network"; $os = "sentry3"; -$config['os'][$os]['text'] = "ServerTech Sentry3"; -$config['os'][$os]['type'] = "power"; +$config['os'][$os]['text'] = "ServerTech Sentry3"; +$config['os'][$os]['type'] = "power"; $config['os'][$os]['over'][0]['graph'] = "device_current"; $config['os'][$os]['over'][0]['text'] = "Current"; -$config['os'][$os]['icon'] = "servertech"; +$config['os'][$os]['icon'] = "servertech"; $os = "raritan"; $config['os'][$os]['text'] = "Raritan PDU"; @@ -733,22 +733,22 @@ $config['os'][$os]['over'][0]['graph'] = "device_bits"; $config['os'][$os]['over'][0]['text'] = "Device Traffic"; $os = "mrvld"; -$config['os'][$os]['group'] = "mrv"; -$config['os'][$os]['text'] = "MRV LambdaDriver"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['icon'] = "mrv"; +$config['os'][$os]['group'] = "mrv"; +$config['os'][$os]['text'] = "MRV LambdaDriver"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['icon'] = "mrv"; $os = "poweralert"; -$config['os'][$os]['text'] = "Tripp Lite PowerAlert"; -$config['os'][$os]['type'] = "power"; +$config['os'][$os]['text'] = "Tripp Lite PowerAlert"; +$config['os'][$os]['type'] = "power"; $config['os'][$os]['over'][0]['graph'] = "device_current"; $config['os'][$os]['over'][0]['text'] = "Current"; -$config['os'][$os]['icon'] = "tripplite"; +$config['os'][$os]['icon'] = "tripplite"; $os = "symbol"; -$config['os'][$os]['type'] = "network"; -$config['os'][$os]['text'] = "Symbol AP"; -$config['os'][$os]['icon'] = "symbol"; +$config['os'][$os]['type'] = "network"; +$config['os'][$os]['text'] = "Symbol AP"; +$config['os'][$os]['icon'] = "symbol"; foreach($config['os'] as $this_os => $blah) { diff --git a/includes/syslog.php b/includes/syslog.php index c1ece78735..d129e4cf39 100755 --- a/includes/syslog.php +++ b/includes/syslog.php @@ -8,13 +8,14 @@ function get_cache($host, $value){ global $dev_cache; - if(!isset($dev_cache[$host][$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; @@ -34,22 +35,23 @@ function get_cache($host, $value){ function process_syslog ($entry, $update) { global $config; + global $dev_cache; foreach($config['syslog_filter'] as $bi) - if(strpos($entry['msg'], $bi) !== FALSE){ + if (strpos($entry['msg'], $bi) !== FALSE){ print_r($entry); echo('D-'.$bi); return $entry; } $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.*):( ?)(?P.*)#', $entry['msg'], $matches)){ +# if (preg_match('#%(?P.*):( ?)(?P.*)#', $entry['msg'], $matches)){ # $entry['msg'] = $matches['msg']; # $entry['program'] = $matches['program']; # } @@ -87,7 +89,7 @@ function process_syslog ($entry, $update) { } elseif($os == 'linux' and get_cache($entry['host'], 'version') == 'Point'){ //Cisco WAP200 and similar $matches = array(); - if(preg_match('#Log: \[(?P.*)\] - (?P.*)#', $entry['msg'], $matches)){ + if (preg_match('#Log: \[(?P.*)\] - (?P.*)#', $entry['msg'], $matches)){ $entry['msg'] = $matches['msg']; $entry['program'] = $matches['program']; } @@ -96,7 +98,7 @@ 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=, method=PLAIN, rip=123.213.132.231, lip=123.213.132.231, TLS @@ -126,14 +128,14 @@ function process_syslog ($entry, $update) { 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'); - if($update) + if ($update) dbInsert( array( 'device_id' => $entry['device_id'], diff --git a/includes/versioncheck.inc.php b/includes/versioncheck.inc.php index b09308cacd..e16d1191ee 100644 --- a/includes/versioncheck.inc.php +++ b/includes/versioncheck.inc.php @@ -24,13 +24,13 @@ if($dataHandle) { $data.= fread($dataHandle, 4096); } - if($data) + if ($data) { list($omnipotence, $year, $month, $revision) = explode(".", $data); list($cur, $tag) = explode("-", $config['version']); list($cur_omnipotence, $cur_year, $cur_month, $cur_revision) = explode(".", $cur); - if($argv[1] == "--cron" || isset($options['q'])) { + if ($argv[1] == "--cron" || isset($options['q'])) { $fd = fopen($config['log_file'],'a'); fputs($fd,$string . "\n"); @@ -40,10 +40,10 @@ if($dataHandle) } else { - if($cur != $data) { + if ($cur != $data) { echo("Current Version : $cur_omnipotence.$cur_year.$cur_month.$cur_revision \n"); - if($omnipotence > $cur_omnipotence) { + if ($omnipotence > $cur_omnipotence) { echo("New version : $omnipotence.$year.$month.$revision\n"); } elseif ($year > $cur_year) { echo("New version : $omnipotence.$year.$month.$revision\n");