Debian Codegraph @

check_hpasm/src/plugins-scripts/HP/Proliant/Component/NicSubsystem/SNMP.pm

raw
1 package HP::Proliant::Component::NicSubsystem::SNMP;
2 our @ISA = qw(HP::Proliant::Component::NicSubsystem
3 HP::Proliant::Component::SNMP);
4
5 use strict;
6 use constant { OK => 0, WARNING => 1, CRITICAL => 2, UNKNOWN => 3 };
7
8 sub new {
9 my $class = shift;
10 my %params = @_;
11 my $self = {
12 runtime => $params{runtime},
13 rawdata => $params{rawdata},
14 blacklisted => 0,
15 info => undef,
16 extendedinfo => undef,
17 logical_nics => [],
18 physical_nics => [],
19 };
20 bless $self, $class;
21 $self->overall_init(%params);
22 $self->init();
23 return $self;
24 }
25
26 sub overall_init {
27 my $self = shift;
28 my %params = @_;
29 my $snmpwalk = $self->{rawdata};
30 # overall
31 my $cpqNicIfLogMapOverallCondition = '1.3.6.1.4.1.232.18.2.2.2.0';
32 my $cpqNicIfLogMapOverallConditionValue = {
33 1 => 'other',
34 2 => 'ok',
35 3 => 'degraded',
36 4 => 'failed',
37 };
38 $self->{lognicstatus} = SNMP::Utils::get_object_value(
39 $snmpwalk, $cpqNicIfLogMapOverallCondition,
40 $cpqNicIfLogMapOverallConditionValue);
41 }
42
43 sub init {
44 my $self = shift;
45 my $snmpwalk = $self->{rawdata};
46 my $ifconnect = {};
47 # CPQNIC-MIB
48 my $oids = {
49 cpqNicIfLogMapEntry => '1.3.6.1.4.1.232.18.2.2.1.1',
50 cpqNicIfLogMapIndex => '1.3.6.1.4.1.232.18.2.2.1.1.1',
51 cpqNicIfLogMapIfNumber => '1.3.6.1.4.1.232.18.2.2.1.1.2',
52 cpqNicIfLogMapDescription => '1.3.6.1.4.1.232.18.2.2.1.1.3',
53 cpqNicIfLogMapGroupType => '1.3.6.1.4.1.232.18.2.2.1.1.4',
54 cpqNicIfLogMapAdapterCount => '1.3.6.1.4.1.232.18.2.2.1.1.5',
55 cpqNicIfLogMapAdapterOKCount => '1.3.6.1.4.1.232.18.2.2.1.1.6',
56 cpqNicIfLogMapPhysicalAdapters => '1.3.6.1.4.1.232.18.2.2.1.1.7',
57 cpqNicIfLogMapMACAddress => '1.3.6.1.4.1.232.18.2.2.1.1.8',
58 cpqNicIfLogMapSwitchoverMode => '1.3.6.1.4.1.232.18.2.2.1.1.9',
59 cpqNicIfLogMapCondition => '1.3.6.1.4.1.232.18.2.2.1.1.10',
60 cpqNicIfLogMapStatus => '1.3.6.1.4.1.232.18.2.2.1.1.11',
61 cpqNicIfLogMapNumSwitchovers => '1.3.6.1.4.1.232.18.2.2.1.1.12',
62 cpqNicIfLogMapHwLocation => '1.3.6.1.4.1.232.18.2.2.1.1.13',
63 cpqNicIfLogMapSpeed => '1.3.6.1.4.1.232.18.2.2.1.1.14',
64 cpqNicIfLogMapVlanCount => '1.3.6.1.4.1.232.18.2.2.1.1.15',
65 cpqNicIfLogMapVlans => '1.3.6.1.4.1.232.18.2.2.1.1.16',
66
67 cpqNicIfLogMapGroupTypeValue => {
68 1 => "unknown",
69 2 => "none",
70 3 => "redundantPair",
71 4 => "nft",
72 5 => "alb",
73 6 => "fec",
74 7 => "gec",
75 8 => "ad",
76 9 => "slb",
77 10 => "tlb",
78 11 => "redundancySet",
79 },
80 cpqNicIfLogMapConditionValue => {
81 1 => "other",
82 2 => "ok",
83 3 => "degraded",
84 4 => "failed",
85 },
86 cpqNicIfLogMapStatusValue => {
87 1 => "unknown",
88 2 => "ok",
89 3 => "primaryFailed",
90 4 => "standbyFailed",
91 5 => "groupFailed",
92 6 => "redundancyReduced",
93 7 => "redundancyLost",
94 },
95 cpqNicIfLogMapSwitchoverModeValue => {
96 1 => "unknown",
97 2 => "none",
98 3 => "manual",
99 4 => "switchOnFail",
100 5 => "preferredPrimary",
101 },
102 };
103
104 # INDEX { cpqNicIfLogMapIndex }
105 foreach ($self->get_entries($oids, 'cpqNicIfLogMapEntry')) {
106 push(@{$self->{logical_nics}},
107 HP::Proliant::Component::NicSubsystem::LogicalNic->new(%{$_})
108 );
109 }
110
111 $oids = {
112 cpqNicIfPhysAdapterEntry => '1.3.6.1.4.1.232.18.2.3.1.1',
113 cpqNicIfPhysAdapterIndex => '1.3.6.1.4.1.232.18.2.3.1.1.1',
114 cpqNicIfPhysAdapterIfNumber => '1.3.6.1.4.1.232.18.2.3.1.1.2',
115 cpqNicIfPhysAdapterRole => '1.3.6.1.4.1.232.18.2.3.1.1.3',
116 cpqNicIfPhysAdapterMACAddress => '1.3.6.1.4.1.232.18.2.3.1.1.4',
117 cpqNicIfPhysAdapterSlot => '1.3.6.1.4.1.232.18.2.3.1.1.5',
118 cpqNicIfPhysAdapterIoAddr => '1.3.6.1.4.1.232.18.2.3.1.1.6',
119 cpqNicIfPhysAdapterIrq => '1.3.6.1.4.1.232.18.2.3.1.1.7',
120 cpqNicIfPhysAdapterDma => '1.3.6.1.4.1.232.18.2.3.1.1.8',
121 cpqNicIfPhysAdapterMemAddr => '1.3.6.1.4.1.232.18.2.3.1.1.9',
122 cpqNicIfPhysAdapterPort => '1.3.6.1.4.1.232.18.2.3.1.1.10',
123 cpqNicIfPhysAdapterDuplexState => '1.3.6.1.4.1.232.18.2.3.1.1.11',
124 cpqNicIfPhysAdapterCondition => '1.3.6.1.4.1.232.18.2.3.1.1.12',
125 cpqNicIfPhysAdapterState => '1.3.6.1.4.1.232.18.2.3.1.1.13',
126 cpqNicIfPhysAdapterStatus => '1.3.6.1.4.1.232.18.2.3.1.1.14',
127 cpqNicIfPhysAdapterStatsValid => '1.3.6.1.4.1.232.18.2.3.1.1.15',
128 cpqNicIfPhysAdapterGoodTransmits => '1.3.6.1.4.1.232.18.2.3.1.1.16',
129 cpqNicIfPhysAdapterGoodReceives => '1.3.6.1.4.1.232.18.2.3.1.1.17',
130 cpqNicIfPhysAdapterBadTransmits => '1.3.6.1.4.1.232.18.2.3.1.1.18',
131 cpqNicIfPhysAdapterBadReceives => '1.3.6.1.4.1.232.18.2.3.1.1.19',
132 cpqNicIfPhysAdapterAlignmentErrors => '1.3.6.1.4.1.232.18.2.3.1.1.20',
133 cpqNicIfPhysAdapterFCSErrors => '1.3.6.1.4.1.232.18.2.3.1.1.21',
134 cpqNicIfPhysAdapterSingleCollisionFrames => '1.3.6.1.4.1.232.18.2.3.1.1.22',
135 cpqNicIfPhysAdapterMultipleCollisionFrames => '1.3.6.1.4.1.232.18.2.3.1.1.23',
136 cpqNicIfPhysAdapterDeferredTransmissions => '1.3.6.1.4.1.232.18.2.3.1.1.24',
137 cpqNicIfPhysAdapterLateCollisions => '1.3.6.1.4.1.232.18.2.3.1.1.25',
138 cpqNicIfPhysAdapterExcessiveCollisions => '1.3.6.1.4.1.232.18.2.3.1.1.26',
139 cpqNicIfPhysAdapterInternalMacTransmitErrors => '1.3.6.1.4.1.232.18.2.3.1.1.27',
140 cpqNicIfPhysAdapterCarrierSenseErrors => '1.3.6.1.4.1.232.18.2.3.1.1.28',
141 cpqNicIfPhysAdapterFrameTooLongs => '1.3.6.1.4.1.232.18.2.3.1.1.29',
142 cpqNicIfPhysAdapterInternalMacReceiveErrors => '1.3.6.1.4.1.232.18.2.3.1.1.30',
143 cpqNicIfPhysAdapterHwLocation => '1.3.6.1.4.1.232.18.2.3.1.1.31',
144 cpqNicIfPhysAdapterPartNumber => '1.3.6.1.4.1.232.18.2.3.1.1.32',
145 cpqNicIfPhysAdapterRoleValue => {
146 1 => "unknown",
147 2 => "primary",
148 3 => "secondary",
149 4 => "member",
150 5 => "txRx",
151 6 => "tx",
152 7 => "standby",
153 8 => "none",
154 255 => "notApplicable",
155 },
156 cpqNicIfPhysAdapterDuplexStateValue => {
157 1 => "unknown",
158 2 => "half",
159 3 => "full",
160 },
161 cpqNicIfPhysAdapterConditionValue => {
162 1 => "other",
163 2 => "ok",
164 3 => "degraded",
165 4 => "failed",
166 },
167 cpqNicIfPhysAdapterStateValue => {
168 1 => "unknown",
169 2 => "ok",
170 3 => "standby",
171 4 => "failed",
172 },
173 cpqNicIfPhysAdapterStatusValue => {
174 1 => "unknown",
175 2 => "ok",
176 3 => "generalFailure",
177 4 => "linkFailure",
178 },
179
180 };
181 # INDEX { cpqNicIfPhysAdapterIndex }
182 foreach ($self->get_entries($oids, 'cpqNicIfPhysAdapterEntry')) {
183 push(@{$self->{physical_nics}},
184 HP::Proliant::Component::NicSubsystem::PhysicalNic->new(%{$_}));
185 }
186
187 }
188
189 1;