| 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 storage::emc::datadomain::snmp::mode::process; |
| 22 |
|
| 23 |
use base qw(centreon::plugins::templates::counter); |
| 24 |
|
| 25 |
use strict; |
| 26 |
use warnings; |
| 27 |
use centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng); |
| 28 |
|
| 29 |
sub custom_vtl_status_output { |
| 30 |
my ($self, %options) = @_; |
| 31 |
|
| 32 |
return sprintf( |
| 33 |
"VTL process state: %s [admin state: %s]", |
| 34 |
$self->{result_values}->{vtlProcessState}, |
| 35 |
$self->{result_values}->{vtlAdminState} |
| 36 |
); |
| 37 |
} |
| 38 |
|
| 39 |
sub set_counters { |
| 40 |
my ($self, %options) = @_; |
| 41 |
|
| 42 |
$self->{maps_counters_type} = [ |
| 43 |
{ name => 'global', type => 0, message_separator => ' - ' } |
| 44 |
]; |
| 45 |
|
| 46 |
$self->{maps_counters}->{global} = [ |
| 47 |
{ label => 'nfs-status', type => 2, set => { |
| 48 |
key_values => [ |
| 49 |
{ name => 'nfsStatus' } |
| 50 |
], |
| 51 |
output_template => 'NFS status: %s', |
| 52 |
closure_custom_perfdata => sub { return 0; }, |
| 53 |
closure_custom_threshold_check => \&catalog_status_threshold_ng |
| 54 |
} |
| 55 |
}, |
| 56 |
{ label => 'cifs-status', type => 2, critical_default => '%{cifsStatus} =~ /enabledNotRunning/', set => { |
| 57 |
key_values => [ |
| 58 |
{ name => 'cifsStatus' } |
| 59 |
], |
| 60 |
output_template => 'CIFS status: %s', |
| 61 |
closure_custom_perfdata => sub { return 0; }, |
| 62 |
closure_custom_threshold_check => \&catalog_status_threshold_ng |
| 63 |
} |
| 64 |
}, |
| 65 |
{ label => 'ddboost-status', type => 2, set => { |
| 66 |
key_values => [ |
| 67 |
{ name => 'ddboostStatus' } |
| 68 |
], |
| 69 |
output_template => 'DDBoost status: %s', |
| 70 |
closure_custom_perfdata => sub { return 0; }, |
| 71 |
closure_custom_threshold_check => \&catalog_status_threshold_ng |
| 72 |
} |
| 73 |
}, |
| 74 |
{ label => 'vtl-status', type => 2, critical_default => '%{vtlAdminState} =~ /failed/', set => { |
| 75 |
key_values => [ |
| 76 |
{ name => 'vtlAdminState' }, { name => 'vtlProcessState' } |
| 77 |
], |
| 78 |
closure_custom_output => $self->can('custom_vtl_status_output'), |
| 79 |
closure_custom_perfdata => sub { return 0; }, |
| 80 |
closure_custom_threshold_check => \&catalog_status_threshold_ng |
| 81 |
} |
| 82 |
} |
| 83 |
]; |
| 84 |
} |
| 85 |
|
| 86 |
sub new { |
| 87 |
my ($class, %options) = @_; |
| 88 |
my $self = $class->SUPER::new(package => __PACKAGE__, %options, force_new_perfdata => 1); |
| 89 |
bless $self, $class; |
| 90 |
|
| 91 |
$options{options}->add_options(arguments => { |
| 92 |
}); |
| 93 |
|
| 94 |
return $self; |
| 95 |
} |
| 96 |
|
| 97 |
my $map_nfs_status = { 1 => 'enabled', 2 => 'disabled' }; |
| 98 |
my $map_ddboost_status = { 1 => 'enabled', 2 => 'disabled' }; |
| 99 |
my $map_vtl_admin_state = { |
| 100 |
0 => 'unknown', |
| 101 |
1 => 'enabled', |
| 102 |
2 => 'disabled', |
| 103 |
3 => 'failed' |
| 104 |
}; |
| 105 |
my $map_vtl_process_state = { |
| 106 |
0 => 'unknown', |
| 107 |
1 => 'stopped', |
| 108 |
2 => 'starting', |
| 109 |
3 => 'running', |
| 110 |
4 => 'timingout', |
| 111 |
5 => 'stopping', |
| 112 |
6 => 'stuck' |
| 113 |
}; |
| 114 |
my $map_cifs_status = { |
| 115 |
1 => 'enabled', |
| 116 |
2 => 'enabledRunning', |
| 117 |
3 => 'enabledNotRunning', |
| 118 |
4 => 'enabledWindbindNotRun', |
| 119 |
5 => 'disabled' |
| 120 |
}; |
| 121 |
|
| 122 |
my $mapping = { |
| 123 |
nfsStatus => { oid => '.1.3.6.1.4.1.19746.1.9.1.1', map => $map_nfs_status }, |
| 124 |
cifsStatus => { oid => '.1.3.6.1.4.1.19746.1.10.1.1', map => $map_cifs_status }, |
| 125 |
vtlAdminState => { oid => '.1.3.6.1.4.1.19746.1.11.1.1', map => $map_vtl_admin_state }, |
| 126 |
vtlProcessState => { oid => '.1.3.6.1.4.1.19746.1.11.1.2', map => $map_vtl_process_state }, |
| 127 |
ddboostStatus => { oid => '.1.3.6.1.4.1.19746.1.12.1.1', map => $map_ddboost_status } |
| 128 |
}; |
| 129 |
|
| 130 |
sub manage_selection { |
| 131 |
my ($self, %options) = @_; |
| 132 |
|
| 133 |
my $snmp_result = $options{snmp}->get_leef( |
| 134 |
oids => [ map($_->{oid} . '.0', values(%$mapping)) ], |
| 135 |
nothing_quit => 1 |
| 136 |
); |
| 137 |
|
| 138 |
$self->{global} = $options{snmp}->map_instance(mapping => $mapping, results => $snmp_result, instance => 0); |
| 139 |
} |
| 140 |
|
| 141 |
1; |
| 142 |
|
| 143 |
__END__ |
| 144 |
|
| 145 |
=head1 MODE |
| 146 |
|
| 147 |
Check process status |
| 148 |
|
| 149 |
=over 8 |
| 150 |
|
| 151 |
=item B<--unknown-cifs-status> |
| 152 |
|
| 153 |
Define the conditions to match for the status to be UNKNOWN. |
| 154 |
You can use the following variables: %{cifsStatus} |
| 155 |
|
| 156 |
=item B<--warning-cifs-status> |
| 157 |
|
| 158 |
Define the conditions to match for the status to be WARNING. |
| 159 |
You can use the following variables: %{cifsStatus} |
| 160 |
|
| 161 |
=item B<--critical-cifs-status> |
| 162 |
|
| 163 |
Define the conditions to match for the status to be CRITICAL (default: '%{cifsStatus} =~ /enabledNotRunning/'). |
| 164 |
You can use the following variables: %{cifsStatus} |
| 165 |
|
| 166 |
=item B<--unknown-ddboost-status> |
| 167 |
|
| 168 |
Define the conditions to match for the status to be UNKNOWN. |
| 169 |
You can use the following variables: %{ddboostStatus} |
| 170 |
|
| 171 |
=item B<--warning-ddboost-status> |
| 172 |
|
| 173 |
Define the conditions to match for the status to be WARNING. |
| 174 |
You can use the following variables: %{ddboostStatus} |
| 175 |
|
| 176 |
=item B<--critical-ddboost-status> |
| 177 |
|
| 178 |
Define the conditions to match for the status to be CRITICAL. |
| 179 |
You can use the following variables: %{ddboostStatus} |
| 180 |
|
| 181 |
=item B<--unknown-nfs-status> |
| 182 |
|
| 183 |
Define the conditions to match for the status to be UNKNOWN. |
| 184 |
You can use the following variables: %{nfsStatus} |
| 185 |
|
| 186 |
=item B<--warning-nfs-status> |
| 187 |
|
| 188 |
Define the conditions to match for the status to be WARNING. |
| 189 |
You can use the following variables: %{nfsStatus} |
| 190 |
|
| 191 |
=item B<--critical-nfs-status> |
| 192 |
|
| 193 |
Define the conditions to match for the status to be CRITICAL. |
| 194 |
You can use the following variables: %{nfsStatus} |
| 195 |
|
| 196 |
=item B<--unknown-vtl-status> |
| 197 |
|
| 198 |
Define the conditions to match for the status to be UNKNOWN. |
| 199 |
You can use the following variables: %{vtlAdminState}, %{vtlProcessState} |
| 200 |
|
| 201 |
=item B<--warning-vtl-status> |
| 202 |
|
| 203 |
Define the conditions to match for the status to be WARNING. |
| 204 |
You can use the following variables: %{vtlAdminState}, %{vtlProcessState} |
| 205 |
|
| 206 |
=item B<--critical-vtl-status> |
| 207 |
|
| 208 |
Define the conditions to match for the status to be CRITICAL (default: '%{vtlAdminState} =~ /failed/'). |
| 209 |
You can use the following variables: %{vtlAdminState}, %{vtlProcessState} |
| 210 |
|
| 211 |
=back |
| 212 |
|
| 213 |
=cut |