Merge remote-tracking branch 'origin/master' into thecityofguanyu/add-calix-e5-support

This commit is contained in:
thecityofguanyu
2016-07-23 16:09:47 -05:00
18 changed files with 736 additions and 54 deletions
+3
View File
@@ -67,6 +67,9 @@ function nicecase($item) {
case 'nfs-stats':
return 'NFS Stats';
case 'nfs-v3-stats':
return 'NFS v3 Stats';
default:
return ucfirst($item);
}
@@ -0,0 +1,37 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'Operations';
$unitlen = 10;
$bigdescrlen = 15;
$smalldescrlen = 15;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$array = array(
'fh_lookup' => array('descr' => 'lookup','colour' => '136421',),
'fh_anon' => array('descr' => 'anon','colour' => 'B2C945',),
'fh_ncachedir' => array('descr' => 'ncachedir','colour' => '778D0D',),
'fh_ncachenondir' => array('descr' => 'ncachenondir','colour' => '536400',),
'fh_stale' => array('descr' => 'stale','colour' => '832119',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
}
else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_multi_line_exact_numbers.inc.php';
@@ -0,0 +1,34 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'Operations';
$unitlen = 10;
$bigdescrlen = 15;
$smalldescrlen = 15;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$array = array(
'io_read' => array('descr' => 'read','colour' => '2B9220',),
'io_write' => array('descr' => 'write','colour' => 'B0262D',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
}
else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_multi_line_exact_numbers.inc.php';
@@ -0,0 +1,36 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'net stats';
$unitlen = 15;
$bigdescrlen = 15;
$smalldescrlen = 15;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$array = array(
'net_all' => array('descr' => 'total','colour' => '000000',),
'net_udp' => array('descr' => 'udp','colour' => 'AA3F39',),
'net_tcp' => array('descr' => 'tcp','colour' => '2C8437',),
'net_tcpconn' => array('descr' => 'tcp conn','colour' => '576996',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
}
else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_multi_line_exact_numbers.inc.php';
@@ -0,0 +1,44 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'Cached seconds';
$unitlen = 15;
$bigdescrlen = 15;
$smalldescrlen = 15;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$array = array(
'ra_size' => array('descr' => 'size','colour' => '091B40',),
'ra_range01' => array('descr' => '0-10','colour' => '8293B3',),
'ra_range02' => array('descr' => '10-20','colour' => '566B95',),
'ra_range03' => array('descr' => '20-30','colour' => '1B315D',),
'ra_range04' => array('descr' => '30-40','colour' => '091B40',),
'ra_range05' => array('descr' => '40-50','colour' => '296F6A',),
'ra_range06' => array('descr' => '50-60','colour' => '498984',),
'ra_range07' => array('descr' => '60-70','colour' => '125651',),
'ra_range08' => array('descr' => '70-80','colour' => '023B37',),
'ra_range09' => array('descr' => '80-90','colour' => '14623A',),
'ra_range10' => array('descr' => '90-100','colour' => '034423',),
'ra_notfound' => array('descr' => 'not found','colour' => '590315',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
}
else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_multi_line_exact_numbers.inc.php';
@@ -0,0 +1,35 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'Reply cache';
$unitlen = 15;
$bigdescrlen = 15;
$smalldescrlen = 15;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$array = array(
'rc_hits' => array('descr' => 'hits','colour' => '2B9220',),
'rc_misses' => array('descr' => 'misses','colour' => 'B36326',),
'rc_nocache' => array('descr' => 'nocache','colour' => 'B0262D',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
}
else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_multi_line_exact_numbers.inc.php';
@@ -0,0 +1,37 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'RPC Stats';
$unitlen = 15;
$bigdescrlen = 15;
$smalldescrlen = 15;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$array = array(
'rpc_calls' => array('descr' => 'calls','colour' => '000000',),
'rpc_badcalls' => array('descr' => 'bad calls','colour' => '600604',),
'rpc_badfmt' => array('descr' => 'bad fmt','colour' => '8C201D',),
'rpc_badauth' => array('descr' => 'bad auth','colour' => 'DF7A77',),
'rpc_badclnt' => array('descr' => 'bad clnt','colour' => 'FFB3B1',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
}
else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_multi_line_exact_numbers.inc.php';
@@ -0,0 +1,54 @@
<?php
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'Operations';
$unitlen = 10;
$bigdescrlen = 15;
$smalldescrlen = 15;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$array = array(
'proc3_null' => array('descr' => 'Null','colour' => '630606',),
'proc3_getattr' => array('descr' => 'Get attributes','colour' => '50C150',),
'proc3_setattr' => array('descr' => 'Set attributes','colour' => '4D65A2',),
'proc3_lookup' => array('descr' => 'Lookup','colour' => '8B64A1',),
'proc3_access' => array('descr' => 'Access','colour' => 'AAAA39',),
'proc3_read' => array('descr' => 'Read','colour' => '308A30',),
'proc3_write' => array('descr' => 'Write','colour' => '457A9A',),
'proc3_create' => array('descr' => 'Create','colour' => '690D87',),
'proc3_mkdir' => array('descr' => 'Make dir','colour' => '3A3478',),
'proc3_mknod' => array('descr' => 'Make nod','colour' => '512E74',),
'proc3_link' => array('descr' => 'Link','colour' => '072A3F',),
'proc3_remove' => array('descr' => 'Remove','colour' => 'F16464',),
'proc3_rmdir' => array('descr' => 'Remove dir','colour' => '57162D',),
'proc3_rename' => array('descr' => 'Rename','colour' => 'A40B62',),
'proc3_readlink' => array('descr' => 'Read link','colour' => '557917',),
'proc3_readdir' => array('descr' => 'Read dir','colour' => 'A3C666',),
'proc3_symlink' => array('descr' => 'Symlink','colour' => '85C490',),
'proc3_readdirplus' => array('descr' => 'Read dir plus','colour' => 'F1F164',),
'proc3_fsstat' => array('descr' => 'FS stat','colour' => 'F1F191',),
'proc3_fsinfo' => array('descr' => 'FS info','colour' => '6E2770',),
'proc3_pathconf' => array('descr' => 'Pathconf','colour' => '993555',),
'proc3_commit' => array('descr' => 'Commit','colour' => '463176',),
);
$i = 0;
if (is_file($rrd_filename)) {
foreach ($array as $ds => $vars) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $vars['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $vars['colour'];
$i++;
}
}
else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_multi_line_exact_numbers.inc.php';
@@ -0,0 +1,121 @@
<?php
require 'includes/graphs/common.inc.php';
if ($width > '500') {
$descr_len = $bigdescrlen;
} else {
$descr_len = $smalldescrlen;
}
if ($printtotal === 1) {
$descr_len += '2';
$unitlen += '2';
}
$unit_text = str_pad(truncate($unit_text, $unitlen), $unitlen);
if ($width > '500') {
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 10)), 0, ($descr_len + 10))."Now Min Max Avg\l'";
if($printtotal === 1) {
$rrd_options .= " COMMENT:'Total '";
}
$rrd_options .= " COMMENT:'\l'";
} else {
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, ($descr_len + 10)), 0, ($descr_len + 10))."Now Min Max Avg\l'";
}
foreach ($rrd_list as $rrd) {
if ($rrd['colour']) {
$colour = $rrd['colour'];
}
else {
if (!$config['graph_colours'][$colours][$colour_iter]) {
$colour_iter = 0;
}
$colour = $config['graph_colours'][$colours][$colour_iter];
$colour_iter++;
}
$ds = $rrd['ds'];
$filename = $rrd['filename'];
$descr = rrdtool_escape($rrd['descr'], $descr_len);
$id = 'ds'.$i;
$rrd_options .= ' DEF:'.$rrd['ds'].$i.'='.$rrd['filename'].':'.$rrd['ds'].':AVERAGE ';
if ($simple_rrd) {
$rrd_options .= ' CDEF:'.$rrd['ds'].$i.'min='.$rrd['ds'].$i.' ';
$rrd_options .= ' CDEF:'.$rrd['ds'].$i.'max='.$rrd['ds'].$i.' ';
}
else {
$rrd_options .= ' DEF:'.$rrd['ds'].$i.'min='.$rrd['filename'].':'.$rrd['ds'].':MIN ';
$rrd_options .= ' DEF:'.$rrd['ds'].$i.'max='.$rrd['filename'].':'.$rrd['ds'].':MAX ';
}
if ($_GET['previous']) {
$rrd_options .= ' DEF:'.$i.'X='.$rrd['filename'].':'.$rrd['ds'].':AVERAGE:start='.$prev_from.':end='.$from;
$rrd_options .= ' SHIFT:'.$i."X:$period";
$thingX .= $seperatorX.$i.'X,UN,0,'.$i.'X,IF';
$plusesX .= $plusX;
$seperatorX = ',';
$plusX = ',+';
}
if ($printtotal === 1) {
$rrd_options .= ' VDEF:tot'.$rrd['ds'].$i.'='.$rrd['ds'].$i.',TOTAL';
}
$g_defname = $rrd['ds'];
if (is_numeric($multiplier)) {
$g_defname = $rrd['ds'].'_cdef';
$rrd_options .= ' CDEF:'.$g_defname.$i.'='.$rrd['ds'].$i.','.$multiplier.',*';
$rrd_options .= ' CDEF:'.$g_defname.$i.'min='.$rrd['ds'].$i.'min,'.$multiplier.',*';
$rrd_options .= ' CDEF:'.$g_defname.$i.'max='.$rrd['ds'].$i.'max,'.$multiplier.',*';
} else if (is_numeric($divider)) {
$g_defname = $rrd['ds'].'_cdef';
$rrd_options .= ' CDEF:'.$g_defname.$i.'='.$rrd['ds'].$i.','.$divider.',/';
$rrd_options .= ' CDEF:'.$g_defname.$i.'min='.$rrd['ds'].$i.'min,'.$divider.',/';
$rrd_options .= ' CDEF:'.$g_defname.$i.'max='.$rrd['ds'].$i.'max,'.$divider.',/';
}
if (isset($text_orig) && $text_orig) {
$t_defname = $rrd['ds'];
} else {
$t_defname = $g_defname;
}
if ($i && ($dostack === 1)) {
$stack = ':STACK';
}
$rrd_options .= ' LINE2:'.$g_defname.$i.'#'.$colour.":'".$descr."'$stack";
if ($addarea === 1)
{
$descr = ":";
$rrd_options .= ' AREA:'.$g_defname.$i.'#'.$colour.$transparency.":'".$descr."'$stack";
}
$rrd_options .= ' GPRINT:'.$t_defname.$i.':LAST:%8.0lf%s GPRINT:'.$t_defname.$i.'min:MIN:%8.0lf%s';
$rrd_options .= ' GPRINT:'.$t_defname.$i.'max:MAX:%8.0lf%s GPRINT:'.$t_defname.$i.":AVERAGE:'%8.0lf%s\\n'";
if ($printtotal === 1) {
$rrd_options .= ' GPRINT:tot'.$rrd['ds'].$i.":%6.2lf%s'".rrdtool_escape($total_units)."'";
}
$rrd_options .= " COMMENT:'\\n'";
}//end foreach
if ($_GET['previous'] == 'yes') {
if (is_numeric($multiplier)) {
$rrd_options .= ' CDEF:X='.$thingX.$plusesX.','.$multiplier.',*';
}
else if (is_numeric($divider)) {
$rrd_options .= ' CDEF:X='.$thingX.$plusesX.','.$divider.',/';
}
else {
$rrd_options .= ' CDEF:X='.$thingX.$plusesX;
}
$rrd_options .= ' HRULE:0#555555';
}
@@ -0,0 +1,35 @@
<?php
global $config;
$graphs = array(
'nfs-v3-stats' => 'NFS v3 Statistics',
'nfs-io' => 'IO',
'nfs-fh' => 'File handler',
'nfs-rc' => 'Reply cache',
'nfs-ra' => 'Read ahead cache',
'nfs-net' => 'Network stats',
'nfs-rpc' => 'RPC Stats',
);
foreach ($graphs as $key => $text) {
$graph_type = $key;
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $app['app_id'];
$graph_array['type'] = 'application_'.$key;
echo '<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">'.$text.'</h3>
</div>
<div class="panel-body">
<div class="row">';
include 'includes/print-graphrow.inc.php';
echo '</div>';
echo '</div>';
echo '</div>';
}
@@ -2,7 +2,7 @@
if ($sensor_class == 'state') {
$sensors = dbFetchRows('SELECT * FROM `sensors` LEFT JOIN `sensors_to_state_indexes` ON sensors_to_state_indexes.sensor_id = sensors.sensor_id LEFT JOIN state_indexes ON state_indexes.state_index_id = sensors_to_state_indexes.state_index_id WHERE `sensor_class` = ? AND device_id = ? ORDER BY `poller_type`, `sensor_index`+0, `sensor_oid`', array($sensor_class, $device['device_id']));
$sensors = dbFetchRows('SELECT * FROM `sensors` LEFT JOIN `sensors_to_state_indexes` ON sensors_to_state_indexes.sensor_id = sensors.sensor_id LEFT JOIN state_indexes ON state_indexes.state_index_id = sensors_to_state_indexes.state_index_id WHERE `sensor_class` = ? AND device_id = ? ORDER BY `sensor_type`, `sensor_index`+0, `sensor_oid`', array($sensor_class, $device['device_id']));
}
else {
$sensors = dbFetchRows('SELECT * FROM `sensors` WHERE `sensor_class` = ? AND device_id = ? ORDER BY `poller_type`, `sensor_oid`, `sensor_index`', array($sensor_class, $device['device_id']));
+7 -7
View File
@@ -103,6 +103,13 @@ function discover_device($device, $options = null) {
}
}
// Set type to a predefined type for the OS if it's not already set
if ($device['type'] == 'unknown' || $device['type'] == '') {
if ($config['os'][$device['os']]['type']) {
$device['type'] = $config['os'][$device['os']]['type'];
}
}
if ($config['os'][$device['os']]['group']) {
$device['os_group'] = $config['os'][$device['os']]['group'];
echo ' (' . $device['os_group'] . ')';
@@ -142,13 +149,6 @@ function discover_device($device, $options = null) {
register_mibs($device, $devicemib, "includes/discovery/functions.inc.php");
}
// Set type to a predefined type for the OS if it's not already set
if ($device['type'] == 'unknown' || $device['type'] == '') {
if ($config['os'][$device['os']]['type']) {
$device['type'] = $config['os'][$device['os']]['type'];
}
}
$device_end = microtime(true);
$device_run = ($device_end - $device_start);
$device_time = substr($device_run, 0, 5);
@@ -12,26 +12,22 @@
if ($device['os'] == 'ibm-amm') {
$oids = array('blower1speedRPM', 'blower2speedRPM', 'blower3speedRPM', 'blower4speedRPM');
d_echo($oids."\n");
if (!empty($oids)) {
$descr_prefix = 'Blower ';
$oids = array(
'.1.3.6.1.4.1.2.3.51.2.2.3.20.0', // BLADE-MIB:blower1speedRPM
'.1.3.6.1.4.1.2.3.51.2.2.3.21.0', // BLADE-MIB:blower2speedRPM
'.1.3.6.1.4.1.2.3.51.2.2.3.22.0', // BLADE-MIB:blower3speedRPM
'.1.3.6.1.4.1.2.3.51.2.2.3.23.0', // BLADE-MIB:blower4speedRPM
);
echo 'BLADE-MIB ';
foreach ($oids as $index => $data) {
if (!empty($data)) {
$value = trim(snmp_get($device, $data.'.0', '-Oqv', 'BLADE-MIB'), '"');
if (is_numeric($value)) {
$oid = 'BLADE-MIB::' . $data . '.0';
$descr = $data;
discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'snmp', $descr, 1, 1, null, null, null, null, $value);
}
}
echo 'BLADE-MIB ';
foreach ($oids as $index => $oid) {
$value = trim(snmp_get($device, $oid, '-Oqv'), '"');
if (is_numeric($value)) {
$descr = $descr_prefix . ($index + 1);
discover_sensor($valid['sensor'], 'fanspeed', $device, $oid, $index, 'snmp', $descr, 1, 1, null, null, null, null, $value);
}
}
}
@@ -13,16 +13,25 @@
if ($device['os'] == 'ibm-amm') {
$index = 1;
$state_name = 'ibm-amm_BlowerState';
$state_descr = 'Blower ';
$oids = array(
'blower1State' => '.1.3.6.1.4.1.2.3.51.2.2.3.10.0',
'blower2State' => '.1.3.6.1.4.1.2.3.51.2.2.3.11.0',
'blower3State' => '.1.3.6.1.4.1.2.3.51.2.2.3.12.0',
'blower4State' => '.1.3.6.1.4.1.2.3.51.2.2.3.13.0'
'.1.3.6.1.4.1.2.3.51.2.2.3.10.0', // BLADE-MIB::blower1State.0
'.1.3.6.1.4.1.2.3.51.2.2.3.11.0', // BLADE-MIB::blower2State.0
'.1.3.6.1.4.1.2.3.51.2.2.3.12.0', // BLADE-MIB::blower3State.0
'.1.3.6.1.4.1.2.3.51.2.2.3.13.0', // BLADE-MIB::blower4State.0
);
/* BLADE-MIB: blower1State
* unknown(0),
* good(1),
* warning(2),
* bad(3)
*/
foreach ($oids as $state_name => $oid) {
foreach ($oids as $oid) {
$state = snmp_get($device, $oid, '-Oqv');
$descr = $state_descr . $index;
if (!empty($state)) {
$state_index_id = create_state_index($state_name);
@@ -30,10 +39,10 @@ if ($device['os'] == 'ibm-amm') {
if ($state_index_id) {
$states = array(
array($state_index_id,'unknown',0,0,3) ,
array($state_index_id,'good',1,1,0) ,
array($state_index_id,'warning',1,2,1) ,
array($state_index_id,'bad',1,3,2) ,
array($state_index_id, 'unknown', 0, 0, 3),
array($state_index_id, 'good', 1, 1, 0),
array($state_index_id, 'warning', 1, 2, 1),
array($state_index_id, 'bad', 1, 3, 2),
);
foreach($states as $value) {
@@ -49,7 +58,7 @@ if ($device['os'] == 'ibm-amm') {
}//end if
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $state_name, '1', '1', null, null, null, null, $state, 'snmp', $index);
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $state, 'snmp', $index);
//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, $index);
$index++;
@@ -59,15 +68,25 @@ if ($device['os'] == 'ibm-amm') {
}//end foreach
$index = 1;
$state_name = 'ibm-amm_BlowerControllerState';
$state_descr = 'Blower Controller ';
$oids = array(
'blower1ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.30.0',
'blower2ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.31.0',
'blower3ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.32.0',
'blower4ControllerState' => '.1.3.6.1.4.1.2.3.51.2.2.3.33.0');
foreach ($oids as $state_name => $oid) {
'.1.3.6.1.4.1.2.3.51.2.2.3.30.0', // BLADE-MIB::blower1ControllerState.0
'.1.3.6.1.4.1.2.3.51.2.2.3.31.0', // BLADE-MIB::blower2ControllerState.0
'.1.3.6.1.4.1.2.3.51.2.2.3.32.0', // BLADE-MIB::blower3ControllerState.0
'.1.3.6.1.4.1.2.3.51.2.2.3.33.0', // BLADE-MIB::blower4ControllerState.0
);
/* BLADE-MIB: blower1ControllerState
* operational(0),
* flashing(1),
* notPresent(2),
* communicationError(3),
* unknown(255)
*/
foreach ($oids as $oid) {
$state = snmp_get($device, $oid, '-Oqv');
$descr = $state_descr . $index;
if (is_numeric($state) && $state != 2) {
@@ -76,11 +95,11 @@ if ($device['os'] == 'ibm-amm') {
if ($state_index_id) {
$states = array(
array($state_index_id,'operational',0,0,0),
array($state_index_id,'flashing',1,1,1),
array($state_index_id,'notPresent',1,2,2),
array($state_index_id,'communicationError',1,3,2),
array($state_index_id,'unknown',1,4,2),
array($state_index_id, 'operational', 1, 0, 0),
array($state_index_id, 'flashing', 1, 1, 1),
array($state_index_id, 'notPresent', 1, 2, -1),
array($state_index_id, 'communicationError', 1, 3, 2),
array($state_index_id, 'unknown', 0, 255, 3),
);
foreach($states as $value) {
@@ -96,7 +115,7 @@ if ($device['os'] == 'ibm-amm') {
}//end if
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $state_name, '1', '1', null, null, null, null, $state, 'snmp', $index);
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null, null, null, $state, 'snmp', $index);
//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, $index);
$index++;
@@ -105,4 +124,57 @@ if ($device['os'] == 'ibm-amm') {
}//end foreach
$index = 1;
$state_name = 'ibm-amm_PowerModuleState';
$state_descr = 'Power Module ';
$powerModuleStateOid= '.1.3.6.1.4.1.2.3.51.2.2.4.1.1.3'; // BLADE-MIB::powerModuleState
$data = snmpwalk_cache_oid_num($device, $powerModuleStateOid, array());
/* BLADE-MIB: powerModuleState
* unknown(0),
* good(1),
* warning(2),
* notAvailable(3),
* critical(4)
*/
foreach ($data as $oid => $array) {
$state = current($array); // get the first (and only) item from the array
$descr = $state_descr . $index;
if (is_numeric($state) && $state != 3) {
$state_index_id = create_state_index($state_name);
if ($state_index_id) {
$states = array(
array($state_index_id, 'unknown', 0, 0, 3),
array($state_index_id, 'good', 1, 1, 0),
array($state_index_id, 'warning', 1, 2, 1),
array($state_index_id, 'notAvailable', 1, 3, -1),
array($state_index_id, 'critical', 1, 4, 2),
);
foreach ($states as $value) {
$insert = array(
'state_index_id' => $value[0],
'state_descr' => $value[1],
'state_draw_graph' => $value[2],
'state_value' => $value[3],
'state_generic_value' => $value[4]
);
dbInsert($insert, 'state_translations');
}//end foreach
}//end if
discover_sensor($valid['sensor'], 'state', $device, $oid, $index, $state_name, $descr, '1', '1', null, null,
null, null, $state, 'snmp', $index);
//Create Sensor To State Index
create_sensor_to_state_index($device, $state_name, $index);
$index++;
}//end if
}//end foreach
}//end if
@@ -11,8 +11,8 @@
*/
if ($device['os'] == 'ibm-amm') {
$oid = 'BLADE-MIB::mmTemp.0';
$mmtemp = snmp_get($device, $oid, '-OsqnU');
$oid = '.1.3.6.1.4.1.2.3.51.2.2.1.1.2.0'; // BLADE-MIB::mmTemp.0
$mmtemp = snmp_get($device, $oid, '-Oqv');
preg_match('/[\d\.]+/', $mmtemp, $temp_response);
if (!empty($temp_response[0])) {
@@ -28,8 +28,8 @@ if ($device['os'] == 'ibm-amm') {
discover_sensor($valid['sensor'], 'temperature', $device, $oid, $oid, 'ibm-amm', $descr, $divisor, '1', null, null, null, null, $current);
}
$oid = 'BLADE-MIB::frontPanelTemp.0';
$fptemp = snmp_get($device, $oid, '-OsqnU');
$oid = '.1.3.6.1.4.1.2.3.51.2.2.1.5.1.0'; // BLADE-MIB::frontPanelTemp.0
$fptemp = snmp_get($device, $oid, '-Oqv');
preg_match('/[\d\.]+/', $fptemp, $temp_response);
if (!empty($temp_response[0])) {
@@ -0,0 +1,132 @@
<?php
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/app-nfs-stats-'.$app['app_id'].'.rrd';
$options = '-O qv';
$mib = 'NET-SNMP-EXTEND-MIB';
$oid = '.1.3.6.1.4.1.8072.1.3.2.4.1.2.7.110.102.115.115.116.97.116';
echo 'nfs-v3-stats';
$nfsstats = snmp_walk($device, $oid, $options, $mib);
list($ra_size,$rc_hits,$rc_misses,$rc_nocache,$fh_lookup,$fh_anon,$fh_ncachedir,$fh_ncachenondir,$fh_stale,$io_read,$io_write,$ra_range01,$ra_range02,$ra_range03,$ra_range04,$ra_range05,$ra_range06,$ra_range07,$ra_range08,$ra_range09,$ra_range10,$ra_notfound,$net_all,$net_udp,$net_tcp,$net_tcpconn,$rpc_calls,$rpc_badcalls,$rpc_badfmt,$rpc_badauth,$rpc_badclnt,$proc3_null,$proc3_getattr,$proc3_setattr,$proc3_lookup,$proc3_access,$proc3_readlink,$proc3_read,$proc3_write,$proc3_create,$proc3_mkdir,$proc3_symlink,$proc3_mknod,$proc3_remove,$proc3_rmdir,$proc3_rename,$proc3_link,$proc3_readdir,$proc3_readdirplus,$proc3_fsstat,$proc3_fsinfo,$proc3_pathconf,$proc3_commit) = explode("\n",$nfsstats);
if(!is_file($rrd_filename))
{
rrdtool_create(
$rrd_filename,
'--step 300
DS:rc_hits:GAUGE:600:0:U
DS:rc_misses:GAUGE:600:0:U
DS:rc_nocache:GAUGE:600:0:U
DS:fh_lookup:GAUGE:600:0:U
DS:fh_anon:GAUGE:600:0:U
DS:fh_ncachedir:GAUGE:600:0:U
DS:fh_ncachenondir:GAUGE:600:0:U
DS:fh_stale:GAUGE:600:0:U
DS:io_read:GAUGE:600:0:U
DS:io_write:GAUGE:600:0:U
DS:ra_size:GAUGE:600:0:U
DS:ra_range01:GAUGE:600:0:U
DS:ra_range02:GAUGE:600:0:U
DS:ra_range03:GAUGE:600:0:U
DS:ra_range04:GAUGE:600:0:U
DS:ra_range05:GAUGE:600:0:U
DS:ra_range06:GAUGE:600:0:U
DS:ra_range07:GAUGE:600:0:U
DS:ra_range08:GAUGE:600:0:U
DS:ra_range09:GAUGE:600:0:U
DS:ra_range10:GAUGE:600:0:U
DS:ra_notfound:GAUGE:600:0:U
DS:net_all:GAUGE:600:0:U
DS:net_udp:GAUGE:600:0:U
DS:net_tcp:GAUGE:600:0:U
DS:net_tcpconn:GAUGE:600:0:U
DS:rpc_calls:GAUGE:600:0:U
DS:rpc_badcalls:GAUGE:600:0:U
DS:rpc_badfmt:GAUGE:600:0:U
DS:rpc_badauth:GAUGE:600:0:U
DS:rpc_badclnt:GAUGE:600:0:U
DS:proc3_null:GAUGE:600:0:U
DS:proc3_getattr:GAUGE:600:0:U
DS:proc3_setattr:GAUGE:600:0:U
DS:proc3_lookup:GAUGE:600:0:U
DS:proc3_access:GAUGE:600:0:U
DS:proc3_readlink:GAUGE:600:0:U
DS:proc3_read:GAUGE:600:0:U
DS:proc3_write:GAUGE:600:0:U
DS:proc3_create:GAUGE:600:0:U
DS:proc3_mkdir:GAUGE:600:0:U
DS:proc3_symlink:GAUGE:600:0:U
DS:proc3_mknod:GAUGE:600:0:U
DS:proc3_remove:GAUGE:600:0:U
DS:proc3_rmdir:GAUGE:600:0:U
DS:proc3_rename:GAUGE:600:0:U
DS:proc3_link:GAUGE:600:0:U
DS:proc3_readdir:GAUGE:600:0:U
DS:proc3_readdirplus:GAUGE:600:0:U
DS:proc3_fsstat:GAUGE:600:0:U
DS:proc3_fsinfo:GAUGE:600:0:U
DS:proc3_pathconf:GAUGE:600:0:U
DS:proc3_commit:GAUGE:600:0:U
'.$config['rrd_rra']
);
}
$fields = array(
'rc_hits' => $rc_hits,
'rc_misses' => $rc_misses,
'rc_nocache' => $rc_nocache,
'fh_lookup' => $fh_lookup,
'fh_anon' => $fh_anon,
'fh_ncachedir' => $fh_ncachedir,
'fh_ncachenondir' => $fh_ncachenondir,
'fh_stale' => $fh_stale,
'io_read' => $io_read,
'io_write' => $io_write,
'ra_size' => $ra_size,
'ra_range01' => $ra_range01,
'ra_range02' => $ra_range02,
'ra_range03' => $ra_range03,
'ra_range04' => $ra_range04,
'ra_range05' => $ra_range05,
'ra_range06' => $ra_range06,
'ra_range07' => $ra_range07,
'ra_range08' => $ra_range08,
'ra_range09' => $ra_range09,
'ra_range10' => $ra_range10,
'ra_notfound'=> $ra_notfound,
'net_all' => $net_all,
'net_udp' => $net_udp,
'net_tcp' => $net_tcp,
'net_tcpconn' => $net_tcpconn,
'rpc_calls' => $rpc_calls,
'rpc_badcalls' => $rpc_badcalls,
'rpc_badfmt' => $rpc_badfmt,
'rpc_badauth' => $rpc_badauth,
'rpc_badclnt' => $rpc_badclnt,
'proc3_null' => $proc3_null,
'proc3_getattr' => $proc3_getattr,
'proc3_setattr' => $proc3_setattr,
'proc3_lookup' => $proc3_lookup,
'proc3_access' => $proc3_access,
'proc3_readlink' => $proc3_readlink,
'proc3_read' => $proc3_read,
'proc3_write' => $proc3_write,
'proc3_create' => $proc3_create,
'proc3_mkdir' => $proc3_mkdir,
'proc3_symlink' => $proc3_symlink,
'proc3_mknod' => $proc3_mknod,
'proc3_remove' => $proc3_remove,
'proc3_rmdir' => $proc3_rmdir,
'proc3_rename' => $proc3_rename,
'proc3_link' => $proc3_link,
'proc3_readdir' => $proc3_readdir,
'proc3_readdirplus' => $proc3_readdirplus,
'proc3_fsstat' => $proc3_fsstat,
'proc3_fsinfo' => $proc3_fsinfo,
'proc3_pathconf' => $proc3_pathconf,
'proc3_commit' => $proc3_commit,
);
rrdtool_update($rrd_filename, $fields);
$tags = array('name' => 'nfs-v3-stats', 'app_id' => $app['app_id']);
influx_update($device,'app',$tags,$fields);
+47
View File
@@ -0,0 +1,47 @@
#!/bin/bash
############################################################
# copy this file somewhere like /opt and chmod +x it #
# edit your snmpd.conf and add the below line and restart: #
# extend nfs-stats /opt/nfs-stats.sh #
############################################################
CFG_NFSFILE='/proc/net/rpc/nfsd'
BIN_CAT='/usr/bin/cat'
BIN_SED='/usr/bin/sed'
BIN_AWK='/usr/bin/awk'
BIN_TR='/usr/bin/tr'
BIN_PASTE='/usr/bin/paste'
BIN_RM='/usr/bin/rm'
BIN_MV='/usr/bin/mv'
LOG_OLD='/tmp/nfsio_old'
LOG_NEW='/tmp/nfsio_new'
LOG_FIX='/tmp/nfsio_fix'
#get reply cache (rc - values: hits, misses, nocache)
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 1p | $BIN_AWK '{print $2,$3,$4}' | $BIN_TR " " "\n" > $LOG_NEW
#get server file handle (fh - values: lookup, anon, ncachedir, ncachenondir, stale)
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 2p | $BIN_AWK '{print $2,$3,$4,$5,$6}' | $BIN_TR " " "\n" >> $LOG_NEW
#get io bytes (io - values: read, write)
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 3p | $BIN_AWK '{print $2,$3}' | $BIN_TR " " "\n" >> $LOG_NEW
#get read ahead cache (ra - values: cache_size, 0-10%, 10-20%, 20-30%, 30-40%, 40-50%, 50-60%, 60-70%, 70-80%, 80-90%, 90-100%, not-found)
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 5p | $BIN_AWK '{print $3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13}' | $BIN_TR " " "\n" >> $LOG_NEW
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 5p | $BIN_AWK '{print $2}' > $LOG_FIX
#get server packet stats (net - values: all reads, udp packets, tcp packets, tcp conn)
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 6p | $BIN_AWK '{print $2,$3,$4,$5}' | $BIN_TR " " "\n" >> $LOG_NEW
#get server rpc operations (rpc - values: calls, badcalls, badfmt, badauth, badclnt)
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 7p | $BIN_AWK '{print $2,$3,$4,$5,$6}' | $BIN_TR " " "\n" >> $LOG_NEW
#get nfs v3 stats (proc3 - values: null, getattr, setattr, lookup, access, readlink, read, write, create, mkdir, symlink, mknod, remove, rmdir, rename, link, readdir, readdirplus, fsstat, fsinfo, pathconf, commit)
$BIN_CAT $CFG_NFSFILE | $BIN_SED -n 8p | $BIN_AWK '{print $3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24}' | $BIN_TR " " "\n" >> $LOG_NEW
$BIN_PASTE $LOG_FIX
$BIN_PASTE $LOG_NEW $LOG_OLD | while read a b ; do
echo $(($a-$b))
done
$BIN_RM $LOG_OLD 2>&1
$BIN_MV $LOG_NEW $LOG_OLD 2>&1
+1 -2
View File
@@ -76,8 +76,7 @@ $versions = version_info();
echo "Version info:\n";
$cur_sha = $versions['local_sha'];
if ($config['update_channel'] == 'master' && $cur_sha != $versions['github']['sha']) {
$commit_date = new DateTime($versions['local_date']);
$commit_date->setTimezone(new DateTimeZone(date_default_timezone_get()));
$commit_date = new DateTime($versions['local_date'], new DateTimeZone(date_default_timezone_get()));
print_warn("Your install is out of date: $cur_sha " . $commit_date->format('(r)'));
}
else {