Debian Codegraph @

src/network/digi/sarian/snmp/mode/temperature.pm

raw
1 #
2 # Copyright 2024 Centreon (http://www.centreon.com/)
3 #
4 # Centreon is a full-fledged industry-strength solution that meets
5 # the needs in IT infrastructure and temperatureplication monitoring for
6 # service performance.
7 #
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
11 #
12 # http://www.temperatureache.org/licenses/LICENSE-2.0
13 #
14 # Unless required by temperatureplicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 #
20
21 package network::digi::sarian::snmp::mode::temperature;
22
23 use base qw(centreon::plugins::templates::counter);
24
25 use strict;
26 use warnings;
27
28 sub set_counters {
29 my ($self, %options) = @_;
30
31 $self->{maps_counters_type} = [
32 { name => 'temperature', type => 0, skipped_code => { -10 => 1 } },
33 ];
34 $self->{maps_counters}->{temperature} = [
35 { label => 'device', set => {
36 key_values => [ { name => 'device' } ],
37 output_template => 'Temp Device : %d °C',
38 perfdatas => [
39 { label => 'tempDevice', value => 'device', template => '%d',
40 unit => 'C' },
41 ],
42 }
43 },
44 { label => 'processor', set => {
45 key_values => [ { name => 'processor' } ],
46 output_template => 'Temp Processor : %d °C',
47 perfdatas => [
48 { label => 'tempProcessor', value => 'processor', template => '%d',
49 unit => 'C' },
50 ],
51 }
52 },
53 { label => 'modem', set => {
54 key_values => [ { name => 'modem' } ],
55 output_template => 'Temp Modem : %d °C',
56 perfdatas => [
57 { label => 'tempModem', value => 'modem', template => '%d',
58 unit => 'C' },
59 ],
60 }
61 },
62 ];
63 }
64
65 sub new {
66 my ($class, %options) = @_;
67 my $self = $class->SUPER::new(package => __PACKAGE__, %options);
68 bless $self, $class;
69
70 $options{options}->add_options(arguments =>
71 {
72 });
73
74 return $self;
75 }
76
77 my $oid_temperature = '.1.3.6.1.4.1.16378.10000.3.11.0';
78 my $oid_processorTemperature = '.1.3.6.1.4.1.16378.10000.3.12.0';
79 my $oid_modemTemperature = '.1.3.6.1.4.1.16378.10000.3.13.0';
80
81 sub manage_selection {
82 my ($self, %options) = @_;
83
84 $self->{snmp} = $options{snmp};
85
86 $self->{temperature} = {};
87 $self->{results} = $self->{snmp}->get_leef(oids => [ $oid_temperature, $oid_processorTemperature, $oid_modemTemperature ],
88 nothing_quit => 1);
89
90 $self->{temperature} = { device => $self->{results}->{$oid_temperature} > -20 ? $self->{results}->{$oid_temperature} : undef,
91 processor => $self->{results}->{$oid_processorTemperature},
92 modem => $self->{results}->{$oid_modemTemperature} };
93
94 }
95
96 1;
97
98 __END__
99
100 =head1 MODE
101
102 Check Digi equipment temperature (sarian-monitor.mib)
103
104 =over 8
105
106 =item B<--filter-counters>
107
108 Only display some counters (regexp can be used).
109 Example: --filter-counters='processor|modem'
110
111 =item B<--warning-*>
112
113 Warning threshold.
114 Can be: 'device', 'modem', 'processor' (C).
115
116 =item B<--critical-*>
117
118 Critical threshold.
119 Can be: 'device', 'modem', 'processor' (C).
120
121 =back
122
123 =cut