From f8bc2b3e937d59cb93496de4bc652c41748e8b42 Mon Sep 17 00:00:00 2001 From: Kevin Duret Date: Tue, 10 Dec 2024 14:24:10 +0100 Subject: [PATCH] fix zoom --- .../plugin-packs/procedures/network-nokia-timos-snmp.md | 2 +- .../plugin-packs/procedures/network-nokia-timos-snmp.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/i18n/fr/docusaurus-plugin-content-docs-pp/current/integrations/plugin-packs/procedures/network-nokia-timos-snmp.md b/i18n/fr/docusaurus-plugin-content-docs-pp/current/integrations/plugin-packs/procedures/network-nokia-timos-snmp.md index ffdfe235ba84..623a9ae5bd90 100644 --- a/i18n/fr/docusaurus-plugin-content-docs-pp/current/integrations/plugin-packs/procedures/network-nokia-timos-snmp.md +++ b/i18n/fr/docusaurus-plugin-content-docs-pp/current/integrations/plugin-packs/procedures/network-nokia-timos-snmp.md @@ -670,7 +670,7 @@ Les options disponibles pour chaque modèle de services sont listées ci-dessous | --no-component | Define the expected status if no components are found (default: critical). | | --threshold-overload | Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,\[instance,\]status,regexp). Example: --threshold-overload='entity,fan..*,CRITICAL,booting' | | --warning | Set warning threshold (syntax: type,regexp,threshold) Example: --warning='temperature,.*,20' | -| --critical | Set critical threshold (syntax: type,regexp,threshold) Example: --critical='temperature,.*,30' package network::nokia::timos::snmp::mode::components::entity; use strict; use warnings; my %map\_class = ( 1 =\> 'other', 2 =\> 'unknown', 3 =\> 'physChassis', 4 =\> 'container', 5 =\> 'powerSupply', 6 =\> 'fan', 7 =\> 'sensor', 8 =\> 'ioModule', 9 =\> 'cpmModule', 10 =\> 'fabricModule', 11 =\> 'mdaModule', 12 =\> 'flashDiskModule', 13 =\> 'port', 14 =\> 'mcm', 15 =\> 'ccm', 16 =\> 'oesCard', 17 =\> 'oesControlCard', 18 =\> 'oesUserPanel', 19 =\> 'alarmInputModule', ); my %map\_truth = (1 =\> 'true', 2 =\> 'false'); my %map\_oper\_state = ( 1 =\> 'unknown', 2 =\> 'inService', 3 =\> 'outOfService', 4 =\> 'diagnosing', 5 =\> 'failed', 6 =\> 'booting', 7 =\> 'empty', 8 =\> 'provisioned', 9 =\> 'unprovisioned', 10 =\> 'upgrade', 11 =\> 'downgrade', 12 =\> 'inServiceUpgrade', 13 =\> 'inServiceDowngrade', 14 =\> 'resetPending', 15 =\> 'softReset', 16 =\> 'preExtension', ); my $mapping = \{ tmnxHwClass =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.7', map =\> \%map\_class \}, tmnxHwName =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.8' \}, tmnxHwOperState =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.16', map =\> \%map\_oper\_state \}, tmnxHwTempSensor =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.17', map =\> \%map\_truth \}, tmnxHwTemperature =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.18' \}, tmnxHwTempThreshold =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.19' \}, \}; sub load \{ my ($self) = @\_; push @\{$self-\>{request\}}, \{ oid =\> $mapping-\>\{tmnxHwClass\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwName\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwTempSensor\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwOperState\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwTemperature\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwTempThreshold\}-\>\{oid\} \}; \} sub check \{ my ($self) = @\_; $self-\>\{output\}-\>output\_add(long\_msg =\> "Checking entities"); $self-\>\{components\}-\>\{entity\} = \{name =\> 'entity', total =\> 0, skip =\> 0}; return if ($self-\>check\_filter(section =\> 'entity')); my ($exit, $warn, $crit, $checked); foreach my $oid ($self-\>\{snmp\}-\>oid\_lex\_sort(keys %{$self-\>\{results\}})) \{ next if ($oid !~ /^$mapping-\>\{tmnxHwName\}-\>\{oid\}\.(.*)$/); my $instance = $1; my $result = $self-\>\{snmp\}-\>map\_instance(mapping =\> $mapping, results =\> $self-\>\{results\}, instance =\> $instance); next if ($self-\>check\_filter(section =\> 'entity', instance =\> $result-\>\{tmnxHwClass\} . '.' . $instance)); $self-\>\{components\}-\>\{entity\}-\>\{total\}++; $self-\>\{output\}-\>output\_add( long\_msg =\> sprintf( "%s '%s' status is '%s' \[instance = %s, temperature = %s\]", $result-\>\{tmnxHwClass\}, $result-\>\{tmnxHwName\}, $result-\>\{tmnxHwOperState\}, $result-\>\{tmnxHwClass\} . '.' . $instance, $result-\>\{tmnxHwTempSensor\} eq 'true' ? $result-\>\{tmnxHwTemperature\} : '-' ) ); $exit = $self-\>get\_severity(label =\> 'default', section =\> 'entity', instance =\> $result-\>\{tmnxHwClass\} . '.' . $instance, value =\> $result-\>\{tmnxHwOperState\}); if (!$self-\>\{output\}-\>is\_status(value =\> $exit, compare =\> 'ok', litteral =\> 1)) \{ $self-\>\{output\}-\>output\_add( severity =\> $exit, short\_msg =\> sprintf("%s '%s' status is '%s'", $result-\>\{tmnxHwClass\}, $result-\>\{tmnxHwName\}, $result-\>\{tmnxHwOperState\})); \} next if ($result-\>\{tmnxHwTempSensor\} eq 'false'); ($exit, $warn, $crit, $checked) = $self-\>get\_severity\_numeric(section =\> 'temperature', instance =\> $result-\>\{tmnxHwClass\} . '.' . $instance, value =\> $result-\>\{tmnxHwTemperature\}); if ($checked == 0 && $result-\>\{tmnxHwTempThreshold\} != -1 ) \{ $self-\>\{perfdata\}-\>threshold\_validate(label =\> 'critical-temperature-instance-' . $result-\>\{tmnxHwClass\} . '.' . $instance, value =\> $result-\>\{tmnxHwTempThreshold\}); $exit = $self-\>\{perfdata\}-\>threshold\_check(value =\> $result-\>\{tmnxHwTemperature\}, threshold =\> \[ \{ label =\> 'critical-temperature-instance-' . $instance, exit\_litteral =\> 'critical' \}\]); $warn = undef; $crit = $self-\>\{perfdata\}-\>get\_perfdata\_for\_output(label =\> 'critical-temperature-instance-' . $result-\>\{tmnxHwClass\} . '.' . $instance); \} if (!$self-\>\{output\}-\>is\_status(value =\> $exit, compare =\> 'ok', litteral =\> 1)) \{ $self-\>\{output\}-\>output\_add( severity =\> $exit, short\_msg =\> sprintf( "%s '%s' temperature is '%s' C", $result-\>\{tmnxHwClass\}, $result-\>\{tmnxHwName\}, $result-\>\{tmnxHwTemperature\} ) ); \} $self-\>\{output\}-\>perfdata\_add( label =\> 'temperature', unit =\> 'C', nlabel =\> 'hardware.entity.temperature.celsius', instances =\> $result-\>\{tmnxHwName\}, value =\> $result-\>\{tmnxHwTemperature\}, warning =\> $warn, critical =\> $crit ); \} \} 1; | +| --critical | Set critical threshold (syntax: type,regexp,threshold) Example: --critical='temperature,.*,30' package network::nokia::timos::snmp::mode::components::entity; use strict; use warnings; my %map\_class = ( 1 =\> 'other', 2 =\> 'unknown', 3 =\> 'physChassis', 4 =\> 'container', 5 =\> 'powerSupply', 6 =\> 'fan', 7 =\> 'sensor', 8 =\> 'ioModule', 9 =\> 'cpmModule', 10 =\> 'fabricModule', 11 =\> 'mdaModule', 12 =\> 'flashDiskModule', 13 =\> 'port', 14 =\> 'mcm', 15 =\> 'ccm', 16 =\> 'oesCard', 17 =\> 'oesControlCard', 18 =\> 'oesUserPanel', 19 =\> 'alarmInputModule', ); my %map\_truth = (1 =\> 'true', 2 =\> 'false'); my %map\_oper\_state = ( 1 =\> 'unknown', 2 =\> 'inService', 3 =\> 'outOfService', 4 =\> 'diagnosing', 5 =\> 'failed', 6 =\> 'booting', 7 =\> 'empty', 8 =\> 'provisioned', 9 =\> 'unprovisioned', 10 =\> 'upgrade', 11 =\> 'downgrade', 12 =\> 'inServiceUpgrade', 13 =\> 'inServiceDowngrade', 14 =\> 'resetPending', 15 =\> 'softReset', 16 =\> 'preExtension', ); my $mapping = \{ tmnxHwClass =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.7', map =\> \%map\_class \}, tmnxHwName =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.8' \}, tmnxHwOperState =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.16', map =\> \%map\_oper\_state \}, tmnxHwTempSensor =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.17', map =\> \%map\_truth \}, tmnxHwTemperature =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.18' \}, tmnxHwTempThreshold =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.19' \}, \}; sub load \{ my ($self) = @\_; push @\{$self-\>{request\}\}, \{ oid =\> $mapping-\>\{tmnxHwClass\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwName\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwTempSensor\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwOperState\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwTemperature\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwTempThreshold\}-\>\{oid\} \}; \} sub check \{ my ($self) = @\_; $self-\>\{output\}-\>output\_add(long\_msg =\> "Checking entities"); $self-\>\{components\}-\>\{entity\} = \{name =\> 'entity', total =\> 0, skip =\> 0}; return if ($self-\>check\_filter(section =\> 'entity')); my ($exit, $warn, $crit, $checked); foreach my $oid ($self-\>\{snmp\}-\>oid\_lex\_sort(keys %{$self-\>\{results\}\})) \{ next if ($oid !~ /^$mapping-\>\{tmnxHwName\}-\>\{oid\}\.(.*)$/); my $instance = $1; my $result = $self-\>\{snmp\}-\>map\_instance(mapping =\> $mapping, results =\> $self-\>\{results\}, instance =\> $instance); next if ($self-\>check\_filter(section =\> 'entity', instance =\> $result-\>\{tmnxHwClass\} . '.' . $instance)); $self-\>\{components\}-\>\{entity\}-\>\{total\}++; $self-\>\{output\}-\>output\_add( long\_msg =\> sprintf( "%s '%s' status is '%s' \[instance = %s, temperature = %s\]", $result-\>\{tmnxHwClass\}, $result-\>\{tmnxHwName\}, $result-\>\{tmnxHwOperState\}, $result-\>\{tmnxHwClass\} . '.' . $instance, $result-\>\{tmnxHwTempSensor\} eq 'true' ? $result-\>\{tmnxHwTemperature\} : '-' ) ); $exit = $self-\>get\_severity(label =\> 'default', section =\> 'entity', instance =\> $result-\>\{tmnxHwClass\} . '.' . $instance, value =\> $result-\>\{tmnxHwOperState\}); if (!$self-\>\{output\}-\>is\_status(value =\> $exit, compare =\> 'ok', litteral =\> 1)) \{ $self-\>\{output\}-\>output\_add( severity =\> $exit, short\_msg =\> sprintf("%s '%s' status is '%s'", $result-\>\{tmnxHwClass\}, $result-\>\{tmnxHwName\}, $result-\>\{tmnxHwOperState\})); \} next if ($result-\>\{tmnxHwTempSensor\} eq 'false'); ($exit, $warn, $crit, $checked) = $self-\>get\_severity\_numeric(section =\> 'temperature', instance =\> $result-\>\{tmnxHwClass\} . '.' . $instance, value =\> $result-\>\{tmnxHwTemperature\}); if ($checked == 0 && $result-\>\{tmnxHwTempThreshold\} != -1 ) \{ $self-\>\{perfdata\}-\>threshold\_validate(label =\> 'critical-temperature-instance-' . $result-\>\{tmnxHwClass\} . '.' . $instance, value =\> $result-\>\{tmnxHwTempThreshold\}); $exit = $self-\>\{perfdata\}-\>threshold\_check(value =\> $result-\>\{tmnxHwTemperature\}, threshold =\> \[ \{ label =\> 'critical-temperature-instance-' . $instance, exit\_litteral =\> 'critical' \}\]); $warn = undef; $crit = $self-\>\{perfdata\}-\>get\_perfdata\_for\_output(label =\> 'critical-temperature-instance-' . $result-\>\{tmnxHwClass\} . '.' . $instance); \} if (!$self-\>\{output\}-\>is\_status(value =\> $exit, compare =\> 'ok', litteral =\> 1)) \{ $self-\>\{output\}-\>output\_add( severity =\> $exit, short\_msg =\> sprintf( "%s '%s' temperature is '%s' C", $result-\>\{tmnxHwClass\}, $result-\>\{tmnxHwName\}, $result-\>\{tmnxHwTemperature\} ) ); \} $self-\>\{output\}-\>perfdata\_add( label =\> 'temperature', unit =\> 'C', nlabel =\> 'hardware.entity.temperature.celsius', instances =\> $result-\>\{tmnxHwName\}, value =\> $result-\>\{tmnxHwTemperature\}, warning =\> $warn, critical =\> $crit ); \} \} 1; | | --warning-count-* | Define the warning threshold for the number of components of one type (replace '*' with the component type). | | --critical-count-* | Define the critical threshold for the number of components of one type (replace '*' with the component type). | diff --git a/pp/integrations/plugin-packs/procedures/network-nokia-timos-snmp.md b/pp/integrations/plugin-packs/procedures/network-nokia-timos-snmp.md index fad1c30cea1f..94867ae18885 100644 --- a/pp/integrations/plugin-packs/procedures/network-nokia-timos-snmp.md +++ b/pp/integrations/plugin-packs/procedures/network-nokia-timos-snmp.md @@ -669,7 +669,7 @@ All available options for each service template are listed below: | --no-component | Define the expected status if no components are found (default: critical). | | --threshold-overload | Use this option to override the status returned by the plugin when the status label matches a regular expression (syntax: section,\[instance,\]status,regexp). Example: --threshold-overload='entity,fan..*,CRITICAL,booting' | | --warning | Set warning threshold (syntax: type,regexp,threshold) Example: --warning='temperature,.*,20' | -| --critical | Set critical threshold (syntax: type,regexp,threshold) Example: --critical='temperature,.*,30' package network::nokia::timos::snmp::mode::components::entity; use strict; use warnings; my %map\_class = ( 1 =\> 'other', 2 =\> 'unknown', 3 =\> 'physChassis', 4 =\> 'container', 5 =\> 'powerSupply', 6 =\> 'fan', 7 =\> 'sensor', 8 =\> 'ioModule', 9 =\> 'cpmModule', 10 =\> 'fabricModule', 11 =\> 'mdaModule', 12 =\> 'flashDiskModule', 13 =\> 'port', 14 =\> 'mcm', 15 =\> 'ccm', 16 =\> 'oesCard', 17 =\> 'oesControlCard', 18 =\> 'oesUserPanel', 19 =\> 'alarmInputModule', ); my %map\_truth = (1 =\> 'true', 2 =\> 'false'); my %map\_oper\_state = ( 1 =\> 'unknown', 2 =\> 'inService', 3 =\> 'outOfService', 4 =\> 'diagnosing', 5 =\> 'failed', 6 =\> 'booting', 7 =\> 'empty', 8 =\> 'provisioned', 9 =\> 'unprovisioned', 10 =\> 'upgrade', 11 =\> 'downgrade', 12 =\> 'inServiceUpgrade', 13 =\> 'inServiceDowngrade', 14 =\> 'resetPending', 15 =\> 'softReset', 16 =\> 'preExtension', ); my $mapping = \{ tmnxHwClass =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.7', map =\> \%map\_class \}, tmnxHwName =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.8' \}, tmnxHwOperState =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.16', map =\> \%map\_oper\_state \}, tmnxHwTempSensor =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.17', map =\> \%map\_truth \}, tmnxHwTemperature =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.18' \}, tmnxHwTempThreshold =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.19' \}, \}; sub load \{ my ($self) = @\_; push @\{$self-\>{request\}}, \{ oid =\> $mapping-\>\{tmnxHwClass\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwName\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwTempSensor\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwOperState\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwTemperature\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwTempThreshold\}-\>\{oid\} \}; \} sub check \{ my ($self) = @\_; $self-\>\{output\}-\>output\_add(long\_msg =\> "Checking entities"); $self-\>\{components\}-\>\{entity\} = \{name =\> 'entity', total =\> 0, skip =\> 0}; return if ($self-\>check\_filter(section =\> 'entity')); my ($exit, $warn, $crit, $checked); foreach my $oid ($self-\>\{snmp\}-\>oid\_lex\_sort(keys %{$self-\>\{results\}})) \{ next if ($oid !~ /^$mapping-\>\{tmnxHwName\}-\>\{oid\}\.(.*)$/); my $instance = $1; my $result = $self-\>\{snmp\}-\>map\_instance(mapping =\> $mapping, results =\> $self-\>\{results\}, instance =\> $instance); next if ($self-\>check\_filter(section =\> 'entity', instance =\> $result-\>\{tmnxHwClass\} . '.' . $instance)); $self-\>\{components\}-\>\{entity\}-\>\{total\}++; $self-\>\{output\}-\>output\_add( long\_msg =\> sprintf( "%s '%s' status is '%s' \[instance = %s, temperature = %s\]", $result-\>\{tmnxHwClass\}, $result-\>\{tmnxHwName\}, $result-\>\{tmnxHwOperState\}, $result-\>\{tmnxHwClass\} . '.' . $instance, $result-\>\{tmnxHwTempSensor\} eq 'true' ? $result-\>\{tmnxHwTemperature\} : '-' ) ); $exit = $self-\>get\_severity(label =\> 'default', section =\> 'entity', instance =\> $result-\>\{tmnxHwClass\} . '.' . $instance, value =\> $result-\>\{tmnxHwOperState\}); if (!$self-\>\{output\}-\>is\_status(value =\> $exit, compare =\> 'ok', litteral =\> 1)) \{ $self-\>\{output\}-\>output\_add( severity =\> $exit, short\_msg =\> sprintf("%s '%s' status is '%s'", $result-\>\{tmnxHwClass\}, $result-\>\{tmnxHwName\}, $result-\>\{tmnxHwOperState\})); \} next if ($result-\>\{tmnxHwTempSensor\} eq 'false'); ($exit, $warn, $crit, $checked) = $self-\>get\_severity\_numeric(section =\> 'temperature', instance =\> $result-\>\{tmnxHwClass\} . '.' . $instance, value =\> $result-\>\{tmnxHwTemperature\}); if ($checked == 0 && $result-\>\{tmnxHwTempThreshold\} != -1 ) \{ $self-\>\{perfdata\}-\>threshold\_validate(label =\> 'critical-temperature-instance-' . $result-\>\{tmnxHwClass\} . '.' . $instance, value =\> $result-\>\{tmnxHwTempThreshold\}); $exit = $self-\>\{perfdata\}-\>threshold\_check(value =\> $result-\>\{tmnxHwTemperature\}, threshold =\> \[ \{ label =\> 'critical-temperature-instance-' . $instance, exit\_litteral =\> 'critical' \}\]); $warn = undef; $crit = $self-\>\{perfdata\}-\>get\_perfdata\_for\_output(label =\> 'critical-temperature-instance-' . $result-\>\{tmnxHwClass\} . '.' . $instance); \} if (!$self-\>\{output\}-\>is\_status(value =\> $exit, compare =\> 'ok', litteral =\> 1)) \{ $self-\>\{output\}-\>output\_add( severity =\> $exit, short\_msg =\> sprintf( "%s '%s' temperature is '%s' C", $result-\>\{tmnxHwClass\}, $result-\>\{tmnxHwName\}, $result-\>\{tmnxHwTemperature\} ) ); \} $self-\>\{output\}-\>perfdata\_add( label =\> 'temperature', unit =\> 'C', nlabel =\> 'hardware.entity.temperature.celsius', instances =\> $result-\>\{tmnxHwName\}, value =\> $result-\>\{tmnxHwTemperature\}, warning =\> $warn, critical =\> $crit ); \} \} 1; | +| --critical | Set critical threshold (syntax: type,regexp,threshold) Example: --critical='temperature,.*,30' package network::nokia::timos::snmp::mode::components::entity; use strict; use warnings; my %map\_class = ( 1 =\> 'other', 2 =\> 'unknown', 3 =\> 'physChassis', 4 =\> 'container', 5 =\> 'powerSupply', 6 =\> 'fan', 7 =\> 'sensor', 8 =\> 'ioModule', 9 =\> 'cpmModule', 10 =\> 'fabricModule', 11 =\> 'mdaModule', 12 =\> 'flashDiskModule', 13 =\> 'port', 14 =\> 'mcm', 15 =\> 'ccm', 16 =\> 'oesCard', 17 =\> 'oesControlCard', 18 =\> 'oesUserPanel', 19 =\> 'alarmInputModule', ); my %map\_truth = (1 =\> 'true', 2 =\> 'false'); my %map\_oper\_state = ( 1 =\> 'unknown', 2 =\> 'inService', 3 =\> 'outOfService', 4 =\> 'diagnosing', 5 =\> 'failed', 6 =\> 'booting', 7 =\> 'empty', 8 =\> 'provisioned', 9 =\> 'unprovisioned', 10 =\> 'upgrade', 11 =\> 'downgrade', 12 =\> 'inServiceUpgrade', 13 =\> 'inServiceDowngrade', 14 =\> 'resetPending', 15 =\> 'softReset', 16 =\> 'preExtension', ); my $mapping = \{ tmnxHwClass =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.7', map =\> \%map\_class \}, tmnxHwName =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.8' \}, tmnxHwOperState =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.16', map =\> \%map\_oper\_state \}, tmnxHwTempSensor =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.17', map =\> \%map\_truth \}, tmnxHwTemperature =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.18' \}, tmnxHwTempThreshold =\> \{ oid =\> '.1.3.6.1.4.1.6527.3.1.2.2.1.8.1.19' \}, \}; sub load \{ my ($self) = @\_; push @\{$self-\>{request\}\}, \{ oid =\> $mapping-\>\{tmnxHwClass\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwName\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwTempSensor\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwOperState\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwTemperature\}-\>\{oid\} \}, \{ oid =\> $mapping-\>\{tmnxHwTempThreshold\}-\>\{oid\} \}; \} sub check \{ my ($self) = @\_; $self-\>\{output\}-\>output\_add(long\_msg =\> "Checking entities"); $self-\>\{components\}-\>\{entity\} = \{name =\> 'entity', total =\> 0, skip =\> 0}; return if ($self-\>check\_filter(section =\> 'entity')); my ($exit, $warn, $crit, $checked); foreach my $oid ($self-\>\{snmp\}-\>oid\_lex\_sort(keys %{$self-\>\{results\}\})) \{ next if ($oid !~ /^$mapping-\>\{tmnxHwName\}-\>\{oid\}\.(.*)$/); my $instance = $1; my $result = $self-\>\{snmp\}-\>map\_instance(mapping =\> $mapping, results =\> $self-\>\{results\}, instance =\> $instance); next if ($self-\>check\_filter(section =\> 'entity', instance =\> $result-\>\{tmnxHwClass\} . '.' . $instance)); $self-\>\{components\}-\>\{entity\}-\>\{total\}++; $self-\>\{output\}-\>output\_add( long\_msg =\> sprintf( "%s '%s' status is '%s' \[instance = %s, temperature = %s\]", $result-\>\{tmnxHwClass\}, $result-\>\{tmnxHwName\}, $result-\>\{tmnxHwOperState\}, $result-\>\{tmnxHwClass\} . '.' . $instance, $result-\>\{tmnxHwTempSensor\} eq 'true' ? $result-\>\{tmnxHwTemperature\} : '-' ) ); $exit = $self-\>get\_severity(label =\> 'default', section =\> 'entity', instance =\> $result-\>\{tmnxHwClass\} . '.' . $instance, value =\> $result-\>\{tmnxHwOperState\}); if (!$self-\>\{output\}-\>is\_status(value =\> $exit, compare =\> 'ok', litteral =\> 1)) \{ $self-\>\{output\}-\>output\_add( severity =\> $exit, short\_msg =\> sprintf("%s '%s' status is '%s'", $result-\>\{tmnxHwClass\}, $result-\>\{tmnxHwName\}, $result-\>\{tmnxHwOperState\})); \} next if ($result-\>\{tmnxHwTempSensor\} eq 'false'); ($exit, $warn, $crit, $checked) = $self-\>get\_severity\_numeric(section =\> 'temperature', instance =\> $result-\>\{tmnxHwClass\} . '.' . $instance, value =\> $result-\>\{tmnxHwTemperature\}); if ($checked == 0 && $result-\>\{tmnxHwTempThreshold\} != -1 ) \{ $self-\>\{perfdata\}-\>threshold\_validate(label =\> 'critical-temperature-instance-' . $result-\>\{tmnxHwClass\} . '.' . $instance, value =\> $result-\>\{tmnxHwTempThreshold\}); $exit = $self-\>\{perfdata\}-\>threshold\_check(value =\> $result-\>\{tmnxHwTemperature\}, threshold =\> \[ \{ label =\> 'critical-temperature-instance-' . $instance, exit\_litteral =\> 'critical' \}\]); $warn = undef; $crit = $self-\>\{perfdata\}-\>get\_perfdata\_for\_output(label =\> 'critical-temperature-instance-' . $result-\>\{tmnxHwClass\} . '.' . $instance); \} if (!$self-\>\{output\}-\>is\_status(value =\> $exit, compare =\> 'ok', litteral =\> 1)) \{ $self-\>\{output\}-\>output\_add( severity =\> $exit, short\_msg =\> sprintf( "%s '%s' temperature is '%s' C", $result-\>\{tmnxHwClass\}, $result-\>\{tmnxHwName\}, $result-\>\{tmnxHwTemperature\} ) ); \} $self-\>\{output\}-\>perfdata\_add( label =\> 'temperature', unit =\> 'C', nlabel =\> 'hardware.entity.temperature.celsius', instances =\> $result-\>\{tmnxHwName\}, value =\> $result-\>\{tmnxHwTemperature\}, warning =\> $warn, critical =\> $crit ); \} \} 1; | | --warning-count-* | Define the warning threshold for the number of components of one type (replace '*' with the component type). | | --critical-count-* | Define the critical threshold for the number of components of one type (replace '*' with the component type). |