1 # Copyright (C) 2003 Shawn Ferry
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17 # $Id: CompaqCIM.pm,v 1.1 2010-12-27 00:03:47 ivan Exp $
18 # Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
20 # Compaq Insight Manager
21 # MIB files available at
22 # http://h18023.www1.hp.com/support/files/server/us/download/19885.html
24 package Torrus::DevDiscover::CompaqCIM;
30 $Torrus::DevDiscover::registry{'CompaqCIM'} = {
32 'checkdevtype' => \&checkdevtype,
33 'discover' => \&discover,
34 'buildConfig' => \&buildConfig
39 # Compaq Insite Manager
40 'cpqcim' => '1.3.6.1.4.1.232',
43 'cpqHeTemperatureTable' => '1.3.6.1.4.1.232.6.2.6.8',
44 'cpqHeTemperatureChassis' => '1.3.6.1.4.1.232.6.2.6.8.1.1',
45 'cpqHeTemperatureIndex' => '1.3.6.1.4.1.232.6.2.6.8.1.2',
46 'cpqHeTemperatureLocale' => '1.3.6.1.4.1.232.6.2.6.8.1.3',
47 'cpqHeTemperatureCelsius' => '1.3.6.1.4.1.232.6.2.6.8.1.4',
48 'cpqHeTemperatureHwLocation' => '1.3.6.1.4.1.232.6.2.6.8.1.8',
50 'cpqHeCorrMemTotalErrs' => '1.3.6.1.4.1.232.6.2.3.3.0',
52 # This is not a complete implementation of the HLTH MIB
59 my $devdetails = shift;
61 return $dd->checkSnmpTable( 'cpqcim' );
73 9 => 'removableMedia',
84 my $devdetails = shift;
86 my $session = $dd->session();
87 my $data = $devdetails->data();
89 my @checkOids = ( 'cpqHeCorrMemTotalErrs' );
91 foreach my $oid ( @checkOids )
93 if( $dd->checkSnmpOID($oid) )
95 $devdetails->setCap( $oid );
99 my $TemperatureTable =
100 $session->get_table( -baseoid =>
101 $dd->oiddef('cpqHeTemperatureTable') );
103 if( defined( $TemperatureTable ) )
105 $devdetails->storeSnmpVars( $TemperatureTable );
106 $devdetails->setCap( 'cpqHeTemperatureTable' );
109 $ref->{'indices'} = [];
110 $data->{'TemperatureTable'} = $ref;
112 # Index is Chassis . Index
115 getSnmpIndices( $dd->oiddef('cpqHeTemperatureIndex') ) )
117 next if ( $devdetails->snmpVar
118 ( $dd->oiddef('cpqHeTemperatureCelsius') .
119 '.' . $INDEX ) < 0 );
121 push( @{$ref->{'indices'}}, $INDEX );
123 my $chassis = $devdetails->snmpVar
124 ( $dd->oiddef('cpqHeTemperatureChassis') . '.' . $INDEX );
126 my $sensorIdx = $devdetails->snmpVar
127 ( $dd->oiddef('cpqHeTemperatureIndex') . '.' . $INDEX );
129 my $locale = $devdetails->snmpVar
130 ( $dd->oiddef('cpqHeTemperatureLocale') . '.' . $INDEX );
131 $locale = $enumLocale->{$locale} if $enumLocale->{$locale};
133 my $location = $devdetails->snmpVar
134 ( $dd->oiddef('cpqHeTemperatureHwLocation') . '.' . $INDEX );
136 my $nick = sprintf('Chassis%d_%s_%d',
137 $chassis, $locale, $sensorIdx);
140 $ref->{$INDEX}->{'param'} = $param;
141 $param->{'cpq-cim-sensor-index'} = $INDEX;
142 $param->{'cpq-cim-sensor-nick'} = $nick;
143 $param->{'comment'} =
144 sprintf('Chassis: %s Location: %s Index: %s',
145 $chassis, $locale, $sensorIdx);
146 $param->{'precedence'} = 1000 - $sensorIdx;
156 my $devdetails = shift;
159 my $data = $devdetails->data();
162 'comment' => 'Compaq Insight Manager',
163 'precedence' => '-500',
166 my $cimNode = $cb->addSubtree( $devNode, 'CompaqCIM', $cimParam );
169 'comment' => 'Compaq CIM Health',
170 'precedence' => '-500'
174 if( $devdetails->hasCap('cpqHeCorrMemTotalErrs') )
176 push( @healthTemplates, 'CompaqCIM::cpq-cim-corr-mem-errs' );
179 my $Health = $cb->addSubtree( $cimNode, 'Health', $healthParam,
182 if( $devdetails->hasCap('cpqHeTemperatureTable') )
185 'precedence' => '-100',
186 'comment' => 'Compaq Temperature Sensors',
187 'rrd-create-dstype' => 'GAUGE',
191 $cb->addSubtree( $Health, 'Temperature_Sensors', $tempParam );
193 my $ref = $data->{'TemperatureTable'};
195 foreach my $INDEX ( @{ $ref->{'indices'} } )
197 my $param = $ref->{$INDEX}->{'param'};
198 $cb->addLeaf( $tempNode, $param->{'cpq-cim-sensor-nick'}, $param,
199 [ 'CompaqCIM::cpq-cim-temperature-sensor' ] );
210 # indent-tabs-mode: nil
211 # perl-indent-level: 4