| 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 application 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.apache.org/licenses/LICENSE-2.0 |
| 13 |
# |
| 14 |
# Unless required by applicable 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 hardware::devices::camera::mobotix::snmp::mode::system; |
| 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 => 'system', type => 0, message_separator => ' - ', skipped_code => { -10 => 1 } } |
| 33 |
]; |
| 34 |
|
| 35 |
$self->{maps_counters}->{system} = [ |
| 36 |
{ label => 'sdcard-usage', nlabel => 'system.sdcard.usage.percent', set => { |
| 37 |
key_values => [ { name => 'storageArchiveBufferFillLevel', no_value => -1 } ], |
| 38 |
output_template => 'sd card usage: %.2f %%', |
| 39 |
perfdatas => [ |
| 40 |
{ value => 'storageArchiveBufferFillLevel', template => '%d', min => 0, max => 100, |
| 41 |
unit => '%' }, |
| 42 |
], |
| 43 |
} |
| 44 |
}, |
| 45 |
{ label => 'temperature-internal', nlabel => 'system.temperature.internal.celsius', set => { |
| 46 |
key_values => [ { name => 'statusTemperatureCameraC', no_value => -1000 } ], |
| 47 |
output_template => 'internal temperature: %s C', |
| 48 |
perfdatas => [ |
| 49 |
{ value => 'statusTemperatureCameraC', template => '%s', unit => 'C' }, |
| 50 |
], |
| 51 |
} |
| 52 |
}, |
| 53 |
{ label => 'temperature-external', nlabel => 'system.temperature.external.celsius', set => { |
| 54 |
key_values => [ { name => 'statusTemperatureOutsideC', no_value => -1000 } ], |
| 55 |
output_template => 'external temperature: %s C', |
| 56 |
perfdatas => [ |
| 57 |
{ value => 'statusTemperatureOutsideC', template => '%s', unit => 'C' }, |
| 58 |
], |
| 59 |
} |
| 60 |
}, |
| 61 |
{ label => 'temperature-gps', nlabel => 'system.temperature.gps.celsius', set => { |
| 62 |
key_values => [ { name => 'statusTemperatureGpsC', no_value => -1000 } ], |
| 63 |
output_template => 'gps temperature: %s C', |
| 64 |
perfdatas => [ |
| 65 |
{ value => 'statusTemperatureGpsC', template => '%s', unit => 'C' }, |
| 66 |
], |
| 67 |
} |
| 68 |
}, |
| 69 |
{ label => 'illumination-right', nlabel => 'system.illumination.right.lux', set => { |
| 70 |
key_values => [ { name => 'statusSensorIlluminationR', no_value => -1000 } ], |
| 71 |
output_template => 'illumination right: %s lx', |
| 72 |
perfdatas => [ |
| 73 |
{ value => 'statusSensorIlluminationR', template => '%s', unit => 'lx' }, |
| 74 |
], |
| 75 |
} |
| 76 |
}, |
| 77 |
{ label => 'illumination-left', nlabel => 'system.illumination.left.lux', set => { |
| 78 |
key_values => [ { name => 'statusSensorIlluminationL', no_value => -1000 } ], |
| 79 |
output_template => 'illumination left: %s lx', |
| 80 |
perfdatas => [ |
| 81 |
{ value => 'statusSensorIlluminationL', template => '%s', unit => 'lx' }, |
| 82 |
], |
| 83 |
} |
| 84 |
}, |
| 85 |
{ label => 'video-framerate', nlabel => 'system.video.framerate.persecond', set => { |
| 86 |
key_values => [ { name => 'videoMainCurrentFrameRate', no_value => -1000 } ], |
| 87 |
output_template => 'video framerate: %s fps', |
| 88 |
perfdatas => [ |
| 89 |
{ value => 'videoMainCurrentFrameRate', template => '%s', unit => 'fps' }, |
| 90 |
], |
| 91 |
} |
| 92 |
} |
| 93 |
]; |
| 94 |
} |
| 95 |
|
| 96 |
sub new { |
| 97 |
my ($class, %options) = @_; |
| 98 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); |
| 99 |
bless $self, $class; |
| 100 |
|
| 101 |
$options{options}->add_options(arguments => { |
| 102 |
}); |
| 103 |
|
| 104 |
return $self; |
| 105 |
} |
| 106 |
|
| 107 |
sub manage_selection { |
| 108 |
my ($self, %options) = @_; |
| 109 |
|
| 110 |
my $mapping = { |
| 111 |
storageArchiveBufferFillLevel => { oid => '.1.3.6.1.4.1.21701.2.3.8' }, |
| 112 |
statusTemperatureCameraC => { oid => '.1.3.6.1.4.1.21701.2.7.2.1.1' }, |
| 113 |
statusTemperatureOutsideC => { oid => '.1.3.6.1.4.1.21701.2.7.2.2.1' }, |
| 114 |
statusTemperatureGpsC => { oid => '.1.3.6.1.4.1.21701.2.7.2.4.1' }, |
| 115 |
statusSensorIlluminationR => { oid => '.1.3.6.1.4.1.21701.2.7.3.1' }, |
| 116 |
statusSensorIlluminationL => { oid => '.1.3.6.1.4.1.21701.2.7.3.2' }, |
| 117 |
videoMainCurrentFrameRate => { oid => '.1.3.6.1.4.1.21701.2.7.5.1.2' } |
| 118 |
}; |
| 119 |
|
| 120 |
my $snmp_result = $options{snmp}->get_leef( |
| 121 |
oids => [ map($_->{oid} . '.0', values(%$mapping)) ], |
| 122 |
nothing_quit => 1 |
| 123 |
); |
| 124 |
$self->{system} = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => '0'); |
| 125 |
} |
| 126 |
|
| 127 |
1; |
| 128 |
|
| 129 |
__END__ |
| 130 |
|
| 131 |
=head1 MODE |
| 132 |
|
| 133 |
Check system. |
| 134 |
|
| 135 |
=over 8 |
| 136 |
|
| 137 |
=item B<--warning-*> B<--critical-*> |
| 138 |
|
| 139 |
Thresholds. |
| 140 |
Can be: 'sdcard-usage', 'temperature-internal', 'temperature-external', |
| 141 |
'temperature-gps', 'illumination-right', 'illumination-left', 'video-framerate'. |
| 142 |
|
| 143 |
=back |
| 144 |
|
| 145 |
=cut |