-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(freebsd-snmp): add storage mode with default ZFS support (#5296)
Refs: CTOR-1176
- Loading branch information
Showing
8 changed files
with
243 additions
and
7 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
packaging/centreon-plugin-Operatingsystems-Freebsd-Snmp/deb.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"dependencies": [ | ||
"libsnmp-perl", | ||
"libdatetime-perl" | ||
"libdatetime-perl", | ||
"libnet-ntp-perl" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
packaging/centreon-plugin-Operatingsystems-Freebsd-Snmp/rpm.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"dependencies": [ | ||
"perl(SNMP)", | ||
"perl(DateTime)" | ||
"perl(DateTime)", | ||
"perl(Net::NTP)" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# | ||
# Copyright 2024 Centreon (http://www.centreon.com/) | ||
# | ||
# Centreon is a full-fledged industry-strength solution that meets | ||
# the needs in IT infrastructure and application monitoring for | ||
# service performance. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
package os::freebsd::snmp::mode::storage; | ||
|
||
use base qw(snmp_standard::mode::storage); | ||
|
||
use strict; | ||
use warnings; | ||
|
||
sub default_storage_type { | ||
my ($self, %options) = @_; | ||
|
||
return '^(hrStorageFixedDisk|hrStorageNetworkDisk|hrFSBerkeleyFFS|hrFSOther)$'; | ||
} | ||
|
||
1; | ||
|
||
__END__ | ||
=head1 MODE | ||
Check storage system. | ||
=over 8 | ||
=item B<--warning-usage> | ||
Warning threshold. | ||
=item B<--critical-usage> | ||
Critical threshold. | ||
=item B<--warning-access> | ||
Warning threshold. | ||
=item B<--critical-access> | ||
Critical threshold. | ||
Check if storage is C<readOnly>: C<--critical-access=readOnly> | ||
=item B<--add-access> | ||
Check storage access (C<readOnly>, C<readWrite>). | ||
=item B<--units> | ||
Units of thresholds (default: '%') ('%', 'B'). | ||
=item B<--free> | ||
Thresholds are on free space left. | ||
=item B<--storage> | ||
Define the storage filter on IDs (OID indexes, e.g.: 1,2,...). If empty, all storage systems will be monitored. | ||
To filter on storage names, see C<--name>. | ||
=item B<--name> | ||
Allows to use storage name with option C<--storage> instead of storage OID index. | ||
=item B<--regexp> | ||
Allows to use regexp to filter storage (with option C<--name>). | ||
=item B<--regexp-insensitive> | ||
Allows to use regexp non case-sensitive (with C<--regexp>). | ||
=item B<--path-best-match> | ||
Allows to select best path mount point (with C<--name>). | ||
=item B<--reload-cache-time> | ||
Time in minutes before reloading cache file (default: 180). | ||
=item B<--oid-filter> | ||
Choose OID used to filter storage (default: C<hrStorageDescr>) (values: C<hrStorageDescr>, C<hrFSMountPoint>). | ||
=item B<--oid-display> | ||
Choose OID used to display storage (default: C<hrStorageDescr>) (values: C<hrStorageDescr>, C<hrFSMountPoint>). | ||
=item B<--display-transform-src> B<--display-transform-dst> | ||
Modify the storage name displayed by using a regular expression. | ||
Example: adding C<--display-transform-src='dev' --display-transform-dst='run'> will replace all occurrences of C<dev> with C<run>. | ||
=item B<--show-cache> | ||
Display cache storage data. | ||
=item B<--space-reservation> | ||
Some filesystem has space reserved (like ext4 for root). | ||
The value is in percent of total (default: none) (results like 'df' command). | ||
=item B<--filter-duplicate> | ||
Filter duplicate storages (in used size and total size). | ||
=item B<--filter-storage-type> | ||
Filter storage types with a regexp (default: C<'^(hrStorageFixedDisk|hrStorageNetworkDisk|hrFSBerkeleyFFS|hrFSOther)$'>). | ||
C<hrFSOther> is needed when the default file system is ZFS. | ||
=back | ||
=cut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
.1.3.6.1.2.1.25.2.3.1.2.1 = OID: .1.3.6.1.2.1.25.2.1.2 | ||
.1.3.6.1.2.1.25.2.3.1.2.2 = OID: .1.3.6.1.2.1.25.2.1.2 | ||
.1.3.6.1.2.1.25.2.3.1.2.3 = OID: .1.3.6.1.2.1.25.2.1.3 | ||
.1.3.6.1.2.1.25.2.3.1.2.6 = OID: .1.3.6.1.2.1.25.2.1.1 | ||
.1.3.6.1.2.1.25.2.3.1.2.7 = OID: .1.3.6.1.2.1.25.2.1.1 | ||
.1.3.6.1.2.1.25.2.3.1.2.8 = OID: .1.3.6.1.2.1.25.2.1.1 | ||
.1.3.6.1.2.1.25.2.3.1.2.9 = OID: .1.3.6.1.2.1.25.2.1.1 | ||
.1.3.6.1.2.1.25.2.3.1.2.10 = OID: .1.3.6.1.2.1.25.2.1.3 | ||
.1.3.6.1.2.1.25.2.3.1.2.31 = OID: .1.3.6.1.2.1.25.2.1.4 | ||
.1.3.6.1.2.1.25.2.3.1.2.33 = OID: .1.3.6.1.2.1.25.2.1.10 | ||
.1.3.6.1.2.1.25.2.3.1.2.34 = OID: .1.3.6.1.2.1.25.2.1.4 | ||
.1.3.6.1.2.1.25.2.3.1.3.1 = STRING: Physical memory | ||
.1.3.6.1.2.1.25.2.3.1.3.2 = STRING: Real memory | ||
.1.3.6.1.2.1.25.2.3.1.3.3 = STRING: Virtual memory | ||
.1.3.6.1.2.1.25.2.3.1.3.6 = STRING: Memory buffers | ||
.1.3.6.1.2.1.25.2.3.1.3.7 = STRING: Cached memory | ||
.1.3.6.1.2.1.25.2.3.1.3.8 = STRING: Shared virtual memory | ||
.1.3.6.1.2.1.25.2.3.1.3.9 = STRING: Shared real memory | ||
.1.3.6.1.2.1.25.2.3.1.3.10 = STRING: Swap space | ||
.1.3.6.1.2.1.25.2.3.1.3.31 = STRING: / | ||
.1.3.6.1.2.1.25.2.3.1.3.33 = STRING: /dev | ||
.1.3.6.1.2.1.25.2.3.1.3.34 = STRING: /boot/efi | ||
.1.3.6.1.2.1.25.2.3.1.4.1 = INTEGER: 4096 | ||
.1.3.6.1.2.1.25.2.3.1.4.2 = INTEGER: 4096 | ||
.1.3.6.1.2.1.25.2.3.1.4.3 = INTEGER: 4096 | ||
.1.3.6.1.2.1.25.2.3.1.4.6 = INTEGER: 1024 | ||
.1.3.6.1.2.1.25.2.3.1.4.7 = INTEGER: 4096 | ||
.1.3.6.1.2.1.25.2.3.1.4.8 = INTEGER: 4096 | ||
.1.3.6.1.2.1.25.2.3.1.4.9 = INTEGER: 4096 | ||
.1.3.6.1.2.1.25.2.3.1.4.10 = INTEGER: 4096 | ||
.1.3.6.1.2.1.25.2.3.1.4.31 = INTEGER: 4096 | ||
.1.3.6.1.2.1.25.2.3.1.4.33 = INTEGER: 512 | ||
.1.3.6.1.2.1.25.2.3.1.4.34 = INTEGER: 512 | ||
.1.3.6.1.2.1.25.2.3.1.5.1 = INTEGER: 241144 | ||
.1.3.6.1.2.1.25.2.3.1.5.2 = INTEGER: 13053 | ||
.1.3.6.1.2.1.25.2.3.1.5.3 = INTEGER: 134610087 | ||
.1.3.6.1.2.1.25.2.3.1.5.6 = INTEGER: 107088 | ||
.1.3.6.1.2.1.25.2.3.1.5.7 = INTEGER: 164113 | ||
.1.3.6.1.2.1.25.2.3.1.5.8 = INTEGER: 27008 | ||
.1.3.6.1.2.1.25.2.3.1.5.9 = INTEGER: 6541 | ||
.1.3.6.1.2.1.25.2.3.1.5.10 = INTEGER: 0 | ||
.1.3.6.1.2.1.25.2.3.1.5.31 = INTEGER: 2527523 | ||
.1.3.6.1.2.1.25.2.3.1.5.33 = INTEGER: 2 | ||
.1.3.6.1.2.1.25.2.3.1.5.34 = INTEGER: 65528 | ||
.1.3.6.1.2.1.25.2.3.1.6.1 = INTEGER: 230842 | ||
.1.3.6.1.2.1.25.2.3.1.6.2 = INTEGER: 12140 | ||
.1.3.6.1.2.1.25.2.3.1.6.3 = INTEGER: 134587035 | ||
.1.3.6.1.2.1.25.2.3.1.6.6 = INTEGER: 101096 | ||
.1.3.6.1.2.1.25.2.3.1.6.7 = INTEGER: 164113 | ||
.1.3.6.1.2.1.25.2.3.1.6.8 = INTEGER: 6711 | ||
.1.3.6.1.2.1.25.2.3.1.6.9 = INTEGER: 5668 | ||
.1.3.6.1.2.1.25.2.3.1.6.10 = INTEGER: 0 | ||
.1.3.6.1.2.1.25.2.3.1.6.31 = INTEGER: 1106944 | ||
.1.3.6.1.2.1.25.2.3.1.6.33 = INTEGER: 0 | ||
.1.3.6.1.2.1.25.2.3.1.6.34 = INTEGER: 1294 | ||
.1.3.6.1.2.1.25.3.8.1.2.1 = STRING: "/" | ||
.1.3.6.1.2.1.25.3.8.1.2.3 = STRING: "/dev" | ||
.1.3.6.1.2.1.25.3.8.1.2.4 = STRING: "/boot/efi" | ||
.1.3.6.1.2.1.25.3.8.1.5.1 = INTEGER: 1 | ||
.1.3.6.1.2.1.25.3.8.1.5.3 = INTEGER: 1 | ||
.1.3.6.1.2.1.25.3.8.1.5.4 = INTEGER: 1 | ||
.1.3.6.1.2.1.25.3.8.1.7.1 = INTEGER: 31 | ||
.1.3.6.1.2.1.25.3.8.1.7.3 = INTEGER: 33 | ||
.1.3.6.1.2.1.25.3.8.1.7.4 = INTEGER: 34 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
*** Settings *** | ||
Documentation Check storage table | ||
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource | ||
|
||
Test Timeout 120s | ||
|
||
|
||
*** Variables *** | ||
${CMD} ${CENTREON_PLUGINS} --plugin=os::freebsd::snmp::plugin | ||
|
||
|
||
*** Test Cases *** | ||
storage ${tc} | ||
[Tags] os freebsd | ||
${command} Catenate | ||
... ${CMD} | ||
... --mode=storage | ||
... --hostname=${HOSTNAME} | ||
... --snmp-version=${SNMPVERSION} | ||
... --snmp-port=${SNMPPORT} | ||
... --snmp-community=os/freebsd/snmp/freebsd | ||
... --snmp-version=2c | ||
... --snmp-timeout=1 | ||
... ${extra_options} | ||
|
||
Ctn Run Command And Check Result As Strings ${command} ${expected_result} | ||
|
||
Examples: tc extra_options expected_result -- | ||
... 1 ${EMPTY} OK: All storages are ok | 'count'=3;;;0; 'used_/'=4534042624B;;;0;10352734208 'used_/dev'=0B;;;0;1024 'used_/boot/efi'=662528B;;;0;33550336 | ||
... 2 --verbose OK: All storages are ok | 'count'=3;;;0; 'used_/'=4534042624B;;;0;10352734208 'used_/dev'=0B;;;0;1024 'used_/boot/efi'=662528B;;;0;33550336 Storage '/' Usage Total: 9.64 GB Used: 4.22 GB (43.80%) Free: 5.42 GB (56.20%) Storage '/dev' Usage Total: 1.00 KB Used: 0.00 B (0.00%) Free: 1.00 KB (100.00%) Storage '/boot/efi' Usage Total: 32.00 MB Used: 647.00 KB (1.97%) Free: 31.36 MB (98.03%) | ||
... 3 --warning-usage=30 WARNING: Storage '/' Usage Total: 9.64 GB Used: 4.22 GB (43.80%) Free: 5.42 GB (56.20%) | 'count'=3;;;0; 'used_/'=4534042624B;0:3105820262;;0;10352734208 'used_/dev'=0B;0:307;;0;1024 'used_/boot/efi'=662528B;0:10065100;;0;33550336 | ||
... 4 --critical-usage=30 CRITICAL: Storage '/' Usage Total: 9.64 GB Used: 4.22 GB (43.80%) Free: 5.42 GB (56.20%) | 'count'=3;;;0; 'used_/'=4534042624B;;0:3105820262;0;10352734208 'used_/dev'=0B;;0:307;0;1024 'used_/boot/efi'=662528B;;0:10065100;0;33550336 | ||
... 5 --name --storage='/' OK: Storage '/' Usage Total: 9.64 GB Used: 4.22 GB (43.80%) Free: 5.42 GB (56.20%) | 'count'=1;;;0; 'used'=4534042624B;;;0;10352734208 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters