correction of tests

This commit is contained in:
sfarouq-ext 2024-09-05 16:26:10 +02:00
parent 59d430c4a0
commit cd8d0413b0
7 changed files with 63 additions and 38 deletions

View File

@ -16,7 +16,7 @@
# 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 hardware::ups::standard::rfc1628::snmp::plugin;

View File

@ -301,7 +301,7 @@ __END__
=head1 MODE
Check udp connections.
Check UDP connections.
=over 8
@ -315,7 +315,7 @@ Critical threshold for total connections.
=item B<--service>
Check udp connections following rules:
Check UDP connections following rules:
tag,[type],[port],[filter-ip],[threshold-warning],[threshold-critical]
Example to test NTP connections on the server: --service="ntp,,123,1,2"
@ -342,7 +342,7 @@ nagios-perfdata - number of connections.
=item B<--application>
Check udp connections of mutiple services:
Check UDP connections of multiple services:
tag,[services],[threshold-warning],[threshold-critical]
Example:

View File

@ -21,14 +21,13 @@ load ${tc}
... --snmp-port=${SNMPPORT}
... --snmp-community=os/linux/snmp/linux
... --snmp-timeout=1
... ${extra_options}
... --critical=${critical}
... --warning=${warning}
... --average=${average}
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc extra_options expected_result --
... 1 --critical=15 OK: Load average: 0.87, 0.63, 0.47 | 'load1'=0.87;;0:15;0; 'load5'=0.63;;;0; 'load15'=0.47;;;0;
... 2 --critical='2' OK: Load average: 0.87, 0.63, 0.47 | 'load1'=0.87;;0:2;0; 'load5'=0.63;;;0; 'load15'=0.47;;;0;
... 3 --warning='1' OK: Load average: 0.87, 0.63, 0.47 | 'load1'=0.87;0:1;;0; 'load5'=0.63;;;0; 'load15'=0.47;;;0;
... 4 --critical='0' CRITICAL: Load average: 0.87, 0.63, 0.47 | 'load1'=0.87;;0:0;0; 'load5'=0.63;;;0; 'load15'=0.47;;;0;
... 5 --warning='3' OK: Load average: 0.87, 0.63, 0.47 | 'load1'=0.87;0:3;;0; 'load5'=0.63;;;0; 'load15'=0.47;;;0;
... 6 --average='0.87' OK: Load average: 0.43 [0.87/2 CPUs], 0.32 [0.63/2 CPUs], 0.23 [0.47/2 CPUs] | 'avg_load1'=0.43;;;0; 'avg_load5'=0.32;;;0; 'avg_load15'=0.23;;;0; 'load1'=0.87;;;0; 'load5'=0.63;;;0; 'load15'=0.47;;;0;
Examples: tc critical warning average expected_result --
... 1 '6,5,4' '4,3,2' ${EMPTY} OK: Load average: 0.43 [0.87/2 CPUs], 0.32 [0.63/2 CPUs], 0.23 [0.47/2 CPUs] | 'avg_load1'=0.43;0:4;0:6;0; 'avg_load5'=0.32;0:3;0:5;0; 'avg_load15'=0.23;0:2;0:4;0; 'load1'=0.87;0:8;0:12;0; 'load5'=0.63;0:6;0:10;0; 'load15'=0.47;0:4;0:8;0;
... 2 '0,0,0' '4,3,2' ${EMPTY} CRITICAL: Load average: 0.43 [0.87/2 CPUs], 0.32 [0.63/2 CPUs], 0.23 [0.47/2 CPUs] | 'avg_load1'=0.43;0:4;0:0;0; 'avg_load5'=0.32;0:3;0:0;0; 'avg_load15'=0.23;0:2;0:0;0; 'load1'=0.87;0:8;0:0;0; 'load5'=0.63;0:6;0:0;0; 'load15'=0.47;0:4;0:0;0;
... 3 '600,500,100' '0,0,0' ${EMPTY} WARNING: Load average: 0.43 [0.87/2 CPUs], 0.32 [0.63/2 CPUs], 0.23 [0.47/2 CPUs] | 'avg_load1'=0.43;0:0;0:600;0; 'avg_load5'=0.32;0:0;0:500;0; 'avg_load15'=0.23;0:0;0:100;0; 'load1'=0.87;0:0;0:1200;0; 'load5'=0.63;0:0;0:1000;0; 'load15'=0.47;0:0;0:200;0;

View File

@ -19,18 +19,21 @@ swap ${tc}
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=os/linux/snmp/linux
... --snmp-community=os/linux/snmp/swap
... --snmp-timeout=1
... ${extra_options}
... --no-swap=${no-swap}
... --warning-usage=${warning-usage}
... --warning-usage-free=${warning-usage-free}
... --warning-usage-prct=${warning-usage-prct}
... --critical-usage=${critical-usage}
... --critical-usage-free=${critical-usage-free}
... --critical-usage-prct=${critical-usage-prct}
Ctn Run Command And Check Result As Strings ${command} ${expected_result}
Examples: tc extra_options expected_result --
... 1 --verbose CRITICAL: No active swap
... 2 --no-swap CRITICAL: No active swap
... 3 --warning-usage='2' CRITICAL: No active swap
... 4 --warning-usage-free='' CRITICAL: No active swap
... 5 --warning-usage-prct='' CRITICAL: No active swap
... 6 --critical-usage='' CRITICAL: No active swap
... 7 --critical-usage-free='' CRITICAL: No active swap
... 8 --critical-usage-prct='' CRITICAL: No active swap
Examples: tc no-swap warning-usage warning-usage-free warning-usage-prct critical-usage critical-usage-free critical-usage-prct expected_result --
... 1 ${EMPTY} ${EMPTY} ${EMPTY} '10' ${EMPTY} ${EMPTY} '30' OK: Swap Total: 976.00 MB Used: 0.00 B (0.00%) Free: 976.00 MB (100.00%) | 'used'=0B;;;0;1023406080 'free'=1023406080B;;;0;1023406080 'used_prct'=0.00%;0:10;0:30;0;100
... 2 '' ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} OK: Swap Total: 976.00 MB Used: 0.00 B (0.00%) Free: 976.00 MB (100.00%) | 'used'=0B;;;0;1023406080 'free'=1023406080B;;;0;1023406080 'used_prct'=0.00%;;;0;100
... 3 ${EMPTY} ${EMPTY} '10' ${EMPTY} ${EMPTY} '30' ${EMPTY} CRITICAL: Swap Total: 976.00 MB Used: 0.00 B (0.00%) Free: 976.00 MB (100.00%) | 'used'=0B;;;0;1023406080 'free'=1023406080B;0:10;0:30;0;1023406080 'used_prct'=0.00%;;;0;100
... 4 ${EMPTY} '100' ${EMPTY} ${EMPTY} '100' ${EMPTY} ${EMPTY} OK: Swap Total: 976.00 MB Used: 0.00 B (0.00%) Free: 976.00 MB (100.00%) | 'used'=0B;0:100;0:100;0;1023406080 'free'=1023406080B;;;0;1023406080 'used_prct'=0.00%;;;0;100
... 5 ${EMPTY} ${EMPTY} '100' ${EMPTY} ${EMPTY} ${EMPTY} ${EMPTY} WARNING: Swap Total: 976.00 MB Used: 0.00 B (0.00%) Free: 976.00 MB (100.00%) | 'used'=0B;;;0;1023406080 'free'=1023406080B;0:100;;0;1023406080 'used_prct'=0.00%;;;0;100

View File

@ -0,0 +1,23 @@
.1.3.6.1.4.1.2021.4.1.0 = INTEGER: 0
.1.3.6.1.4.1.2021.4.2.0 = STRING: swap
.1.3.6.1.4.1.2021.4.3.0 = INTEGER: 999420
.1.3.6.1.4.1.2021.4.4.0 = INTEGER: 999420
.1.3.6.1.4.1.2021.4.5.0 = INTEGER: 15221360
.1.3.6.1.4.1.2021.4.6.0 = INTEGER: 6752940
.1.3.6.1.4.1.2021.4.11.0 = INTEGER: 7752360
.1.3.6.1.4.1.2021.4.12.0 = INTEGER: 16000
.1.3.6.1.4.1.2021.4.13.0 = INTEGER: 314012
.1.3.6.1.4.1.2021.4.14.0 = INTEGER: 259672
.1.3.6.1.4.1.2021.4.15.0 = INTEGER: 3703232
.1.3.6.1.4.1.2021.4.18.0 = Counter64: 999420
.1.3.6.1.4.1.2021.4.19.0 = Counter64: 999420
.1.3.6.1.4.1.2021.4.20.0 = Counter64: 15221360
.1.3.6.1.4.1.2021.4.21.0 = Counter64: 6752940
.1.3.6.1.4.1.2021.4.22.0 = Counter64: 7752360
.1.3.6.1.4.1.2021.4.23.0 = Counter64: 16000
.1.3.6.1.4.1.2021.4.24.0 = Counter64: 314012
.1.3.6.1.4.1.2021.4.25.0 = Counter64: 259672
.1.3.6.1.4.1.2021.4.26.0 = Counter64: 3703232
.1.3.6.1.4.1.2021.4.27.0 = Counter64: 10068492
.1.3.6.1.4.1.2021.4.100.0 = INTEGER: 0
.1.3.6.1.4.1.2021.4.101.0 = STRING:

View File

@ -1,6 +1,5 @@
*** Settings ***
Documentation Check time table
Resource ${CURDIR}${/}..${/}..${/}..${/}resources/import.resource
Test Timeout 120s
@ -22,14 +21,14 @@ time ${tc}
... --snmp-community=os/linux/snmp/linux
... --snmp-timeout=1
... ${extra_options}
${output} Run ${command}
${output} Strip String ${output}
Should Match Regexp ${output} ${expected_result}
Examples: tc extra_options expected_result --
... 1 --oid='' ^(OK|WARNING|CRITICAL): Time offset (-?\\\\d+) second\\\\(s\\\\): Local Time : (\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}) \\\\(\\\\+\\\\d{4}\\\\) \\\\| 'offset'=(-?\\\\d+)s;.*$
... 2 --warning-offset='0' ^(OK|WARNING|CRITICAL): Time offset (-?\\\\d+) second\\\\(s\\\\): Local Time : (\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}) \\\\(\\\\+\\\\d{4}\\\\) \\\\| 'offset'=(-?\\\\d+)s;.*$
... 3 --critical-offset='125' ^(OK|WARNING|CRITICAL): Time offset (-?\\\\d+) second\\\\(s\\\\): Local Time : (\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}) \\\\(\\\\+\\\\d{4}\\\\) \\\\| 'offset'=(-?\\\\d+)s;.*$
... 4 --ntp-port=123 ^(OK|WARNING|CRITICAL): Time offset (-?\\\\d+) second\\\\(s\\\\): Local Time : (\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}) \\\\(\\\\+\\\\d{4}\\\\) \\\\| 'offset'=(-?\\\\d+)s;.*$
... 5 --timezone='+0100' ^(OK|WARNING|CRITICAL): Time offset (-?\\\\d+) second\\\\(s\\\\): Local Time : (\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}) \\\\(\\\\+\\\\d{4}\\\\) \\\\| 'offset'=(-?\\\\d+)s;.*$
... 1 --oid='' OK: Time offset (-?\\\\d+) second\\\\(s\\\\): Local Time : (\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}) \\\\(\\\\+\\\\d{4}\\\\) \\\\| 'offset'=(-?\\\\d+)s;.*$
... 2 --warning-offset='0' WARNING: Time offset (-?\\\\d+) second\\\\(s\\\\): Local Time : (\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}) \\\\(\\\\+\\\\d{4}\\\\) \\\\| 'offset'=(-?\\\\d+)s;.*$
... 3 --critical-offset='125' CRITICAL: Time offset (-?\\\\d+) second\\\\(s\\\\): Local Time : (\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}) \\\\(\\\\+\\\\d{4}\\\\) \\\\| 'offset'=(-?\\\\d+)s;.*$
... 4 --ntp-port=123 OK: Time offset (-?\\\\d+) second\\\\(s\\\\): Local Time : (\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}) \\\\(\\\\+\\\\d{4}\\\\) \\\\| 'offset'=(-?\\\\d+)s;.*$
... 5 --timezone='+0100' OK: Time offset (-?\\\\d+) second\\\\(s\\\\): Local Time : (\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}) \\\\(\\\\+\\\\d{4}\\\\) \\\\| 'offset'=(-?\\\\d+)s;.*$

View File

@ -43,6 +43,7 @@
--noeventlog
--nomachineaccount
--ntlmv2
--oid
--oid-display
--oid-extra-display
--oid-filter
@ -139,11 +140,17 @@ in-bcast
in-mcast
in-ucast
interface-dsl-name
ipv4
ipv6
jobqueue
jobqueues
keepass
Kubernetes
ldap
license-instances-usage-prct
multiple
NTP
nagios
okta
oneaccess-sys-mib
out-bcast
@ -168,6 +175,7 @@ total-online-prct
total-oper-down
total-oper-up
tower-cli
UDP
uptime
usage-prct
userpass
@ -178,11 +186,4 @@ Veeam
VeloCloud
VMware
WSMAN
Kubernetes
NTP
ipv4
ipv6
mutiple
nagios
udp
oid