diff options
Diffstat (limited to 'plugins/tests')
-rw-r--r-- | plugins/tests/certs/expired-cert.pem | 41 | ||||
-rw-r--r-- | plugins/tests/certs/expired-key.pem | 43 | ||||
-rw-r--r-- | plugins/tests/certs/server-cert.pem | 41 | ||||
-rw-r--r-- | plugins/tests/certs/server-key.pem | 43 | ||||
-rwxr-xr-x | plugins/tests/check_curl.t | 509 | ||||
-rwxr-xr-x | plugins/tests/check_http.t | 87 | ||||
-rwxr-xr-x | plugins/tests/check_procs.t | 26 | ||||
-rwxr-xr-x | plugins/tests/check_snmp.t | 127 | ||||
-rw-r--r-- | plugins/tests/var/ps-axwo.debian | 219 | ||||
-rw-r--r-- | plugins/tests/var/ps_axwo.debian | 84 |
10 files changed, 986 insertions, 234 deletions
diff --git a/plugins/tests/certs/expired-cert.pem b/plugins/tests/certs/expired-cert.pem index 40324cf8..77a9166e 100644 --- a/plugins/tests/certs/expired-cert.pem +++ b/plugins/tests/certs/expired-cert.pem | |||
@@ -1,21 +1,24 @@ | |||
1 | -----BEGIN CERTIFICATE----- | 1 | -----BEGIN CERTIFICATE----- |
2 | MIIDYzCCAsygAwIBAgIJAJISzcX71f5pMA0GCSqGSIb3DQEBBAUAMH8xCzAJBgNV | 2 | MIIEETCCAvmgAwIBAgIUFDsP6WnV/uqeQMpD/DYSqouE13kwDQYJKoZIhvcNAQEL |
3 | BAYTAlVLMRMwEQYDVQQIEwpEZXJieXNoaXJlMQ8wDQYDVQQHEwZCZWxwZXIxFzAV | 3 | BQAwgZcxCzAJBgNVBAYTAkRFMRAwDgYDVQQIDAdCYXZhcmlhMQ8wDQYDVQQHDAZN |
4 | BgNVBAoTDk5hZ2lvcyBQbHVnaW5zMREwDwYDVQQDEwhUb24gVm9vbjEeMBwGCSqG | 4 | dW5pY2gxGzAZBgNVBAoMEk1vbml0b3JpbmcgUGx1Z2luczEbMBkGA1UEAwwSTW9u |
5 | SIb3DQEJARYPdG9udm9vbkBtYWMuY29tMB4XDTA5MDMwNjAwMTMxNVoXDTA5MDMw | 5 | aXRvcmluZyBQbHVnaW5zMSswKQYJKoZIhvcNAQkBFhxkZXZlbEBtb25pdG9yaW5n |
6 | NTAwMTMxNlowfzELMAkGA1UEBhMCVUsxEzARBgNVBAgTCkRlcmJ5c2hpcmUxDzAN | 6 | LXBsdWdpbnMub3JnMB4XDTA4MDEwMTExMDAyNloXDTA4MDEwMjExMDAyNlowgZcx |
7 | BgNVBAcTBkJlbHBlcjEXMBUGA1UEChMOTmFnaW9zIFBsdWdpbnMxETAPBgNVBAMT | 7 | CzAJBgNVBAYTAkRFMRAwDgYDVQQIDAdCYXZhcmlhMQ8wDQYDVQQHDAZNdW5pY2gx |
8 | CFRvbiBWb29uMR4wHAYJKoZIhvcNAQkBFg90b252b29uQG1hYy5jb20wgZ8wDQYJ | 8 | GzAZBgNVBAoMEk1vbml0b3JpbmcgUGx1Z2luczEbMBkGA1UEAwwSTW9uaXRvcmlu |
9 | KoZIhvcNAQEBBQADgY0AMIGJAoGBAOQHP4JnzACi4q6quXAiK+gTSffG6yyjEV+K | 9 | ZyBQbHVnaW5zMSswKQYJKoZIhvcNAQkBFhxkZXZlbEBtb25pdG9yaW5nLXBsdWdp |
10 | iyutRgBF2MdF03X5ls0wENw/5fnMTrHynl4XoGoV/rD4CR2hGT0m7dv7Vu0MRLlP | 10 | bnMub3JnMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyeHKwKFjJWUX |
11 | J1SCiFeMuQS30zzLMJr0A7IW869qRlKQmzxs1JT6XDbSoNQuF154zoxwNsKlMjoX | 11 | YHKsisypUf9dHlIPQAISyGP1BX6UL26ZLvE6kKbx3LFQ9W2POGoQWlzFiB1soGeV |
12 | tJSHN2YpAgMBAAGjgeYwgeMwHQYDVR0OBBYEFHWjM9OQldrDLMcAfPnUVfGxlzOp | 12 | WDd0U0JtWdCKmOXWdcXpupQlTSUtRCMDQkfqLN8GR5TBTd73rezp5mz08nMfLwu0 |
13 | MIGzBgNVHSMEgaswgaiAFHWjM9OQldrDLMcAfPnUVfGxlzOpoYGEpIGBMH8xCzAJ | 13 | p5VQ191Ui8JHFgrAOalAn8Uw5De8vj4VmTXmU5NJ2UFoC0ddU/Th/lwRCayHc1cn |
14 | BgNVBAYTAlVLMRMwEQYDVQQIEwpEZXJieXNoaXJlMQ8wDQYDVQQHEwZCZWxwZXIx | 14 | MVq2F7c/uhMUUQYNBmJy0pxoHawp+j9NKl/xIYsjgQNgahQyNuswuGHjaEwhPu+7 |
15 | FzAVBgNVBAoTDk5hZ2lvcyBQbHVnaW5zMREwDwYDVQQDEwhUb24gVm9vbjEeMBwG | 15 | G03XsW4ehu+H1898M/MkSln6LQAU1syoJ8ypPM8tV+zgx4uwj7udnZ2hceN95uW7 |
16 | CSqGSIb3DQEJARYPdG9udm9vbkBtYWMuY29tggkAkhLNxfvV/mkwDAYDVR0TBAUw | 16 | 0PWg5DQyUwIDAQABo1MwUTAdBgNVHQ4EFgQUt9ps3KJ1XiMuy/ijFBjMzf6jgwkw |
17 | AwEB/zANBgkqhkiG9w0BAQQFAAOBgQDHjoXoGwBamCiNplTt93jH/TO08RATdZP5 | 17 | HwYDVR0jBBgwFoAUt9ps3KJ1XiMuy/ijFBjMzf6jgwkwDwYDVR0TAQH/BAUwAwEB |
18 | 45hlxv2+PKCjjTiFa2mjAvopFiqmYsr40XYEmpeYMiaOzOW5rBjtqBAT/JJWyfda | 18 | /zANBgkqhkiG9w0BAQsFAAOCAQEAVPBZwMHbrnHFbmhbcPuvYd5cxk0uSVNAUzsl |
19 | SCmj3swqyKus63rv/iuokIhZzBdhbB+eOJJrmwT2SEc5KdRaipH0QAGF1nZAAGzo | 19 | 2biCq5P+ZHo10VHGygXtdV4utqk/IrAt2u5qSxycWPStCtAgTd3Q8ncfjOkaHM4z |
20 | 6xW7hkzYog== | 20 | 2bxTkhLyQeU8NWPuDBqDszo2GOaFTv+lm36LEKiAfqB1tjQVePSkycdrWIhkamBV |
21 | EgMe6uHLdU7QQk1ajQfrBdakN1beqki/dKieA6gm+XF/QS4SSYINmsHB/2X5cT9U | ||
22 | b/KMB8xurCnuJQuk1P4VsSkJCOSeHjWZgK9pKNdsIJZr4wDVfhjQgU0XT6xakSf7 | ||
23 | eCaHtO0VKsbLZoiTmpxidjsdYiXyeKYIQNtUpTjyJ5V/cZsq9w== | ||
21 | -----END CERTIFICATE----- | 24 | -----END CERTIFICATE----- |
diff --git a/plugins/tests/certs/expired-key.pem b/plugins/tests/certs/expired-key.pem index af0e24da..c1510b2d 100644 --- a/plugins/tests/certs/expired-key.pem +++ b/plugins/tests/certs/expired-key.pem | |||
@@ -1,15 +1,28 @@ | |||
1 | -----BEGIN RSA PRIVATE KEY----- | 1 | -----BEGIN PRIVATE KEY----- |
2 | MIICXAIBAAKBgQDkBz+CZ8wAouKuqrlwIivoE0n3xussoxFfiosrrUYARdjHRdN1 | 2 | MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDJ4crAoWMlZRdg |
3 | +ZbNMBDcP+X5zE6x8p5eF6BqFf6w+AkdoRk9Ju3b+1btDES5TydUgohXjLkEt9M8 | 3 | cqyKzKlR/10eUg9AAhLIY/UFfpQvbpku8TqQpvHcsVD1bY84ahBaXMWIHWygZ5VY |
4 | yzCa9AOyFvOvakZSkJs8bNSU+lw20qDULhdeeM6McDbCpTI6F7SUhzdmKQIDAQAB | 4 | N3RTQm1Z0IqY5dZ1xem6lCVNJS1EIwNCR+os3wZHlMFN3vet7OnmbPTycx8vC7Sn |
5 | AoGARgI3rHjjuDpKMGg4IMZNBqaNaiZHY9/44IVvrww21rSbFqtIfgsQEpU0R/rS | 5 | lVDX3VSLwkcWCsA5qUCfxTDkN7y+PhWZNeZTk0nZQWgLR11T9OH+XBEJrIdzVycx |
6 | R7xDWPztRGQqmwd/t6OfYNpqHbjO1MWzasVBVnzue5P59Y1xy1h0LZF8+a9GY++0 | 6 | WrYXtz+6ExRRBg0GYnLSnGgdrCn6P00qX/EhiyOBA2BqFDI26zC4YeNoTCE+77sb |
7 | uAGUC24jsXSmypNVzoX+ZKyinA3oYV/etdPYx1W8Ms5XIzUCQQD7xwhMuLok6Kbq | 7 | Tdexbh6G74fXz3wz8yRKWfotABTWzKgnzKk8zy1X7ODHi7CPu52dnaFx433m5bvQ |
8 | UEgiSfBTbx+haP3IiqqMF14z8QoEyD3jchydNaXEYdQxN8jEl2aPrMqTc6x8Jq4/ | 8 | 9aDkNDJTAgMBAAECggEACrLFfNnQmD24NGs/S4e2/VpsA9xTZI/3kNkDNgxULANP |
9 | ai0OkB+fAkEA59pAmN81HylV7+CsVjLOSbJqzau7NDxSs2uutxhHZRwz0e25wVer | 9 | aNZtxRajwI9A/BCXQ2UTgsZhzWnJxOJYXrlpl7PweY78mUesysb3MOUC6QisUm0M |
10 | fA03l08u0ebC/TDHkmHV6ikCryM5HU2FNwJAVZJFzd2S1myEHmr+uTisB49jDrbi | 10 | kimfdktHWOnAKLFFLNleN9DUVjjVkTeslijqhNX80f80py1grG2UuCLKCX4OqYIm |
11 | WkBWypo+mCS6JPnxntXvx7auClq9haTSBY73eqldiFPuMZvr6P2rJqHxPQJBAOTM | 11 | qACE8TMmSZLz42AO96TndNtKplQ8LuGLEmByW95wEfhx3Gm4ckkL7qII/U3DnQXr |
12 | quaxjti7kATy8N73sD9mBKQGju1TgkFxSK+DFCGhnTnToXY9MAtxd6SoDYoyccYu | 12 | 0T+3xLaj+eNJzYDpIFZiw4sNzOuAyCz+4Cc4sPDuMnzquXF+enpkemoycC1RmEpG |
13 | dyPrzJAR/IYc+mYCdC0CQDKlZuMPVXEgvGaQapzMQ++5yJRvMZF4tWvONBs0OCE9 | 13 | KIDTwmFsc8TrbGV0qifC6fsCrDivdYLqL7R/q3IBQQKBgQDmfvO3VYTEKY8NA+AT |
14 | QYarsTi5M20cymMBXHOLZIjqwsni4G/C9kqJSvC75Vg= | 14 | 5s6+7NTxRsXxJUCEhCNBWimSH3EzmBAvrodLY6A0oYg8i81bgNX1I9GPVXJZ/QA7 |
15 | -----END RSA PRIVATE KEY----- | 15 | ukd84HUIQoGS5Usmo4rp+kz4P6KkLXDemZtWPU5GXxicfajHRQlkbW6St6SpV7IS |
16 | ibJcDADeoiaPL1xvue1ToP/LoQKBgQDgOFHjYpep00gabvjXfYW7vhrg1vVwaKUM | ||
17 | rf0+UW8Exk4nbBw0eEC2YjxIwzdktlkdbzGaXYULnhg8GnfxYesMOpCLPw1JdB8o | ||
18 | ixETAFpW5bKrUsjEFRUGhzWnsCSFIQ4smpmtGLTxOQ8AkoDdORY5Z+Wv7JtFF6Do | ||
19 | PSoblckZcwKBgB3TD3YJesRnHDty5OuuUdIikuslXTd2uoJrFqS+JeLibqNeabnB | ||
20 | u3/lxDULMbWj4U6VvRmbKOKDC+jY887Gq7lc0cff0yROxwqY3sCnwo3crg7QUmp7 | ||
21 | Nb5S8G3qoCSfndcq96wm/Me/O28uCbycVJfUdchY8uRUHIHYbP0FOBQBAoGBAMgh | ||
22 | fPX4imaKr1DovDObVkK87EDDnU84GBm5MtDs3qrkVd3aIVK0Aw7HoAdSN58tI12i | ||
23 | YiPmVVqJQhhjh6tsOuAvZdTj8ngdrbICbrsHFZt6an+A5LIgHyQ0iy+hiPdLCdvG | ||
24 | ImTeKKMmyr04Bs1upueWVO0xw2VoMbcY4Py+NUEBAoGASQqedfCSKGLT+5lLZrhP | ||
25 | CbFVMmswEPjBcRb1trcuA09vfExn9FfUNFnnw3i9miprED5kufvAjb+6nduXizKg | ||
26 | 7HQYHCwVvakgtXgbiDMaNgYZcjWm+MdnfiwLJjJTO3DfI1JF2PJ8y9R95DPlAkDm | ||
27 | xH3OV8KV4UiTEVxS7ksmGzY= | ||
28 | -----END PRIVATE KEY----- | ||
diff --git a/plugins/tests/certs/server-cert.pem b/plugins/tests/certs/server-cert.pem index 549e4f7e..b84b91d2 100644 --- a/plugins/tests/certs/server-cert.pem +++ b/plugins/tests/certs/server-cert.pem | |||
@@ -1,21 +1,24 @@ | |||
1 | -----BEGIN CERTIFICATE----- | 1 | -----BEGIN CERTIFICATE----- |
2 | MIIDYzCCAsygAwIBAgIJAL8LkpNwzYdxMA0GCSqGSIb3DQEBBAUAMH8xCzAJBgNV | 2 | MIIEBjCCAu6gAwIBAgIJANbQ5QQrKhUGMA0GCSqGSIb3DQEBCwUAMIGXMQswCQYD |
3 | BAYTAlVLMRMwEQYDVQQIEwpEZXJieXNoaXJlMQ8wDQYDVQQHEwZCZWxwZXIxFzAV | 3 | VQQGEwJERTEQMA4GA1UECAwHQmF2YXJpYTEPMA0GA1UEBwwGTXVuaWNoMRswGQYD |
4 | BgNVBAoTDk5hZ2lvcyBQbHVnaW5zMREwDwYDVQQDEwhUb24gVm9vbjEeMBwGCSqG | 4 | VQQKDBJNb25pdG9yaW5nIFBsdWdpbnMxGzAZBgNVBAMMEk1vbml0b3JpbmcgUGx1 |
5 | SIb3DQEJARYPdG9udm9vbkBtYWMuY29tMB4XDTA5MDMwNTIxNDEyOFoXDTE5MDMw | 5 | Z2luczErMCkGCSqGSIb3DQEJARYcZGV2ZWxAbW9uaXRvcmluZy1wbHVnaW5zLm9y |
6 | MzIxNDEyOFowfzELMAkGA1UEBhMCVUsxEzARBgNVBAgTCkRlcmJ5c2hpcmUxDzAN | 6 | ZzAeFw0xOTAyMTkxNTMxNDRaFw0yOTAyMTYxNTMxNDRaMIGXMQswCQYDVQQGEwJE |
7 | BgNVBAcTBkJlbHBlcjEXMBUGA1UEChMOTmFnaW9zIFBsdWdpbnMxETAPBgNVBAMT | 7 | RTEQMA4GA1UECAwHQmF2YXJpYTEPMA0GA1UEBwwGTXVuaWNoMRswGQYDVQQKDBJN |
8 | CFRvbiBWb29uMR4wHAYJKoZIhvcNAQkBFg90b252b29uQG1hYy5jb20wgZ8wDQYJ | 8 | b25pdG9yaW5nIFBsdWdpbnMxGzAZBgNVBAMMEk1vbml0b3JpbmcgUGx1Z2luczEr |
9 | KoZIhvcNAQEBBQADgY0AMIGJAoGBAKcWMBtNtfY8vZXk0SN6/EYTVN/LOvaOSegy | 9 | MCkGCSqGSIb3DQEJARYcZGV2ZWxAbW9uaXRvcmluZy1wbHVnaW5zLm9yZzCCASIw |
10 | oVdLoGwuwjagk+XmCzvCqHZRp8lnCLay7AO8AQI7TSN02ihCcSrgGA9OT+HciIJ1 | 10 | DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKgV2yp8pQvJuN+aJGdAe6Hd0tja |
11 | l5/kEYUAuA1PR6YKK/T713zUAlMzy2tsugx5+xSsSEwsXkmne52jJiG/wuE5CLT0 | 11 | uteCPcNIcM92WLOF69TLTSYon1XDon4tHTh4Z5d4lD8bfsGzFVBmDSgWidhAUf+v |
12 | 9pF8HQqHAgMBAAGjgeYwgeMwHQYDVR0OBBYEFGioSPQ/rdE19+zaeY2YvHTXlUDI | 12 | EqEXwbp293ej/Frc0pXCvmrz6kI1tWrLtQhL/VdbxFYxhV7JjKb+PY3SxGFpSLPe |
13 | MIGzBgNVHSMEgaswgaiAFGioSPQ/rdE19+zaeY2YvHTXlUDIoYGEpIGBMH8xCzAJ | 13 | PQ/5SwVndv7rZIwcjseL22K5Uy2TIrkgzzm2pRs/IvoxRybYr/+LGoHyrtJC6AO8 |
14 | BgNVBAYTAlVLMRMwEQYDVQQIEwpEZXJieXNoaXJlMQ8wDQYDVQQHEwZCZWxwZXIx | 14 | ylp8A/etL0gwtUvRnrnZeTQ2pA1uZ5QN3anTL8JP/ZRZYNegIkaawqMtTKbhM6pi |
15 | FzAVBgNVBAoTDk5hZ2lvcyBQbHVnaW5zMREwDwYDVQQDEwhUb24gVm9vbjEeMBwG | 15 | u3/4a3Uppvt0y7vmGfQlYejxCpICnMrvHMpw8L58zv/98AbCGjDU3UwCt6MCAwEA |
16 | CSqGSIb3DQEJARYPdG9udm9vbkBtYWMuY29tggkAvwuSk3DNh3EwDAYDVR0TBAUw | 16 | AaNTMFEwHQYDVR0OBBYEFG/UH6nGYPlVcM75UXzXBF5GZyrcMB8GA1UdIwQYMBaA |
17 | AwEB/zANBgkqhkiG9w0BAQQFAAOBgQCdqasaIO6JiV5ONFG6Tr1++85UfEdZKMUX | 17 | FG/UH6nGYPlVcM75UXzXBF5GZyrcMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcN |
18 | N2NHiNNUunolIZEYR+dW99ezKmHlDiQ/tMgoLVYpl2Ubho2pAkLGQR+W0ZASgWQ1 | 18 | AQELBQADggEBAGwitJPOnlIKLndNf+iCLMIs0dxsl8kAaejFcjoT0n4ja7Y6Zrqz |
19 | NjfV27Rv0y6lYQMTA0lVAU93L1x9reo3FMedmL5+H+lIEpLCxEPtAJNISrJOneZB | 19 | VSIidzz9vQWvy24xKJpAOdj/iLRHCUOG+Pf5fA6+/FiuqXr6gE2/lm0eC58BNONr |
20 | W5jDadwkoQ== | 20 | E5OzjQ/VoQ8RX4hDntgu6FYbaVa/vhwn16igt9qmdNGGZXf2/+DM3JADwyaA4EK8 |
21 | vm7KdofX9zkxXecHPNvf3jiVLPiDDt6tkGpHPEsyP/yc+RUdltUeZvHfliV0cCuC | ||
22 | jJX+Fm9ysjSpHIFFr+jUMuMHibWoOD8iy3eYxfCDoWsH488pCbj8MNuAq6vd6DBk | ||
23 | bOZxDz43vjWuYMkwXJTxJQh7Pne6kK0vE1g= | ||
21 | -----END CERTIFICATE----- | 24 | -----END CERTIFICATE----- |
diff --git a/plugins/tests/certs/server-key.pem b/plugins/tests/certs/server-key.pem index eacaeaa3..11947555 100644 --- a/plugins/tests/certs/server-key.pem +++ b/plugins/tests/certs/server-key.pem | |||
@@ -1,15 +1,28 @@ | |||
1 | -----BEGIN RSA PRIVATE KEY----- | 1 | -----BEGIN PRIVATE KEY----- |
2 | MIICWwIBAAKBgQCnFjAbTbX2PL2V5NEjevxGE1Tfyzr2jknoMqFXS6BsLsI2oJPl | 2 | MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCoFdsqfKULybjf |
3 | 5gs7wqh2UafJZwi2suwDvAECO00jdNooQnEq4BgPTk/h3IiCdZef5BGFALgNT0em | 3 | miRnQHuh3dLY2rrXgj3DSHDPdlizhevUy00mKJ9Vw6J+LR04eGeXeJQ/G37BsxVQ |
4 | Civ0+9d81AJTM8trbLoMefsUrEhMLF5Jp3udoyYhv8LhOQi09PaRfB0KhwIDAQAB | 4 | Zg0oFonYQFH/rxKhF8G6dvd3o/xa3NKVwr5q8+pCNbVqy7UIS/1XW8RWMYVeyYym |
5 | AoGAfpxclcP8N3vteXErXURrd7pcXT0GECDgNjhvc9PV20RPXM+vYs1AA+fMeeQE | 5 | /j2N0sRhaUiz3j0P+UsFZ3b+62SMHI7Hi9tiuVMtkyK5IM85tqUbPyL6MUcm2K// |
6 | TaRqwO6x016aMRO4rz5ztYArecTBznkds1k59pkN/Ne/nsueU4tvGK8MNyS2o986 | 6 | ixqB8q7SQugDvMpafAP3rS9IMLVL0Z652Xk0NqQNbmeUDd2p0y/CT/2UWWDXoCJG |
7 | Voohqkaq4Lcy1bcHJb9su1ELjegEr1R76Mz452Hsy+uTbAECQQDcg/tZWKVeh5CQ | 7 | msKjLUym4TOqYrt/+Gt1Kab7dMu75hn0JWHo8QqSApzK7xzKcPC+fM7//fAGwhow |
8 | dOEB3YWHwfn0NDgfPm/X2i2kAZ7n7URaUy/ffdlfsrr1mBtHCfedLoOxmmlNfEpM | 8 | 1N1MArejAgMBAAECggEANuvdTwanTzC8jaNqHaq+OuemS2E9B8nwsGxtH/zFgvNR |
9 | hXAAurSHAkEAwfk7fEb0iN0Sj9gTozO7c6Ky10KwePZyjVzqSQIiJq3NX8BEaIeb | 9 | WZiMPtmrJnTkFWJcV+VPw/iMSAqN4nDHmBugVOb4Z4asxGTKK4T9shXJSnh0rqPU |
10 | 51TXxE5VxaLjjMLRkA0hWTYXClgERFZ6AQJAN7ChPqwzf08PRFwwIw911JY5cOHr | 10 | 00ZsvbmxY6z0+E5TesCJqQ+9GYTY1V357V7JchvaOxIRxWPqg9urHbru8OCtW/I5 |
11 | NoDHMCUql5vNLNdwBruxgGjBB/kUXEfgw60RusFvgt/zLh1wiii844JDawJAGQBF | 11 | Fh5HPUZlgCvlMpjlhyjydIf/oXyVA3RNsXlwe8+2cKuGIrjEzm2j9o3VF0sctTX0 |
12 | sYP3urg7zzx7c3qUe5gJ0wLuefjR1PSX4ecbfb7DDMdcSdjIuG1QDiZGmd2f1KG7 | 12 | ItP8A9qDmDQN7GIWX0MW6gncojpS1omC2wcFsdjj/xfPyiDal1X4aq/2YqG8351c |
13 | nwSCOtxk5dloW2KGAQJAQh/iBn0QhfKLFAP5eZBVk8E8XlZuw+S2DLy5SnBlIiYJ | 13 | YlM/+6Va0u9WWE/i64gASTAVqpMV4Yg8y0gGycuA0QKBgQDbgI2QeLd3FvMcURiU |
14 | GB5I2OClgtudXMv1labFrcST8O9eFrtsrhU1iUGUOw== | 14 | l3w9qJgw/Jp3jaNC/9LkVGGz4f4lKKB67lPZvI4noMK8GqO/LcXgqP/RY1oJojoA |
15 | -----END RSA PRIVATE KEY----- | 15 | /6JKVvzYGASZ7VgMoG9bk1AneP1PGdibuTUEwimGlcObxnDFIC/yjwPFu3jIdqdS |
16 | zZi1RZzyqAogN5y3SBEypSmn9wKBgQDECKsqqlcizmCl8v5aVk875AzGN+DOHZqx | ||
17 | bkmztlnLO/2e2Fmk3G5Vvnui0FYisf8Eq19tUTQCF6lSfJlGQeFAT119wkFZhLu+ | ||
18 | FfLGqoEMH0ijJg/8PpdpFRK3I94YcISoTNN6yxMvE6xdDGfKCt5a+IX5bwQi9Zdc | ||
19 | B242gEc6tQKBgA6tM8n7KFlAIZU9HuWgk2AUC8kKutFPmSD7tgAqXDYI4FNfugs+ | ||
20 | MEEYyHCB4UNujJBV4Ss6YZCAkh6eyD4U2aca1eElCfm40vBVMdzvpqZdAqLtWXxg | ||
21 | D9l3mgszrFaYGCY2Fr6jLV9lP5g3xsxUjudf9jSLY9HvpfzjRrMaNATVAoGBALTl | ||
22 | /vYfPMucwKlC5B7++J0e4/7iv6vUu9SyHocdZh1anb9AjPDKjXLIlZT4RhQ8R0XK | ||
23 | 0wOw5JpttU2uN08TKkbLNk3/vYhbKVjPLjrQSseh8sjDLgsqw1QwIxYnniLVakVY | ||
24 | p+rvjSNrNyqicQCMKQavwgocvSd5lJRTMwxOMezlAoGBAKWj71BX+0CK00/2S6lC | ||
25 | TcNcuUPG0d8y1czZ4q6tUlG4htwq1FMOpaghATXjkdsOGTLS+H1aA0Kt7Ai9zDhc | ||
26 | /bzOJEJ+jvBXV4Gcs7jl1r/HTKv0tT9ZSI5Vzkida0rfqxDGzcMVlLuCdH0cb8Iu | ||
27 | N0wdmCAqlQwHR13+F1zrAD7V | ||
28 | -----END PRIVATE KEY----- | ||
diff --git a/plugins/tests/check_curl.t b/plugins/tests/check_curl.t new file mode 100755 index 00000000..29cb03f2 --- /dev/null +++ b/plugins/tests/check_curl.t | |||
@@ -0,0 +1,509 @@ | |||
1 | #! /usr/bin/perl -w -I .. | ||
2 | # | ||
3 | # Test check_http by having an actual HTTP server running | ||
4 | # | ||
5 | # To create the https server certificate: | ||
6 | # openssl req -new -x509 -keyout server-key.pem -out server-cert.pem -days 3650 -nodes | ||
7 | # to create a new expired certificate: | ||
8 | # faketime '2008-01-01 12:00:00' openssl req -new -x509 -keyout expired-key.pem -out expired-cert.pem -days 1 -nodes | ||
9 | # Country Name (2 letter code) [AU]:DE | ||
10 | # State or Province Name (full name) [Some-State]:Bavaria | ||
11 | # Locality Name (eg, city) []:Munich | ||
12 | # Organization Name (eg, company) [Internet Widgits Pty Ltd]:Monitoring Plugins | ||
13 | # Organizational Unit Name (eg, section) []: | ||
14 | # Common Name (e.g. server FQDN or YOUR name) []:Monitoring Plugins | ||
15 | # Email Address []:devel@monitoring-plugins.org | ||
16 | |||
17 | use strict; | ||
18 | use Test::More; | ||
19 | use NPTest; | ||
20 | use FindBin qw($Bin); | ||
21 | |||
22 | $ENV{'LC_TIME'} = "C"; | ||
23 | |||
24 | my $common_tests = 72; | ||
25 | my $ssl_only_tests = 8; | ||
26 | # Check that all dependent modules are available | ||
27 | eval "use HTTP::Daemon 6.01;"; | ||
28 | plan skip_all => 'HTTP::Daemon >= 6.01 required' if $@; | ||
29 | eval { | ||
30 | require HTTP::Status; | ||
31 | require HTTP::Response; | ||
32 | }; | ||
33 | |||
34 | my $plugin = 'check_http'; | ||
35 | $plugin = 'check_curl' if $0 =~ m/check_curl/mx; | ||
36 | |||
37 | # look for libcurl version to see if some advanced checks are possible (>= 7.49.0) | ||
38 | my $advanced_checks = 12; | ||
39 | my $use_advanced_checks = 0; | ||
40 | my $required_version = '7.49.0'; | ||
41 | my $virtual_host = 'www.somefunnyhost.com'; | ||
42 | my $virtual_port = 42; | ||
43 | my $curl_version = ''; | ||
44 | open (my $fh, '-|', "./$plugin --version") or die; | ||
45 | while (<$fh>) { | ||
46 | if (m{libcurl/([\d.]+)\s}) { | ||
47 | $curl_version = $1; | ||
48 | last; | ||
49 | } | ||
50 | } | ||
51 | close ($fh); | ||
52 | if ($curl_version) { | ||
53 | my ($major, $minor, $release) = split (/\./, $curl_version); | ||
54 | my ($req_major, $req_minor, $req_release) = split (/\./, $required_version); | ||
55 | my $check = ($major <=> $req_major or $minor <=> $req_minor or $release <=> $req_release); | ||
56 | if ($check >= 0) { | ||
57 | $use_advanced_checks = 1; | ||
58 | print "Found libcurl $major.$minor.$release. Using advanced checks\n"; | ||
59 | } | ||
60 | } | ||
61 | |||
62 | if ($@) { | ||
63 | plan skip_all => "Missing required module for test: $@"; | ||
64 | } else { | ||
65 | if (-x "./$plugin") { | ||
66 | plan tests => $common_tests * 2 + $ssl_only_tests + $advanced_checks; | ||
67 | } else { | ||
68 | plan skip_all => "No $plugin compiled"; | ||
69 | } | ||
70 | } | ||
71 | |||
72 | my $servers = { http => 0 }; # HTTP::Daemon should always be available | ||
73 | eval { require HTTP::Daemon::SSL }; | ||
74 | if ($@) { | ||
75 | diag "Cannot load HTTP::Daemon::SSL: $@"; | ||
76 | } else { | ||
77 | $servers->{https} = 0; | ||
78 | } | ||
79 | |||
80 | # set a fixed version, so the header size doesn't vary | ||
81 | $HTTP::Daemon::VERSION = "1.00"; | ||
82 | |||
83 | my $port_http = 50000 + int(rand(1000)); | ||
84 | my $port_https = $port_http + 1; | ||
85 | my $port_https_expired = $port_http + 2; | ||
86 | |||
87 | # This array keeps sockets around for implementing timeouts | ||
88 | my @persist; | ||
89 | |||
90 | # Start up all servers | ||
91 | my @pids; | ||
92 | my $pid = fork(); | ||
93 | if ($pid) { | ||
94 | # Parent | ||
95 | push @pids, $pid; | ||
96 | if (exists $servers->{https}) { | ||
97 | # Fork a normal HTTPS server | ||
98 | $pid = fork(); | ||
99 | if ($pid) { | ||
100 | # Parent | ||
101 | push @pids, $pid; | ||
102 | # Fork an expired cert server | ||
103 | $pid = fork(); | ||
104 | if ($pid) { | ||
105 | push @pids, $pid; | ||
106 | } else { | ||
107 | my $d = HTTP::Daemon::SSL->new( | ||
108 | LocalPort => $port_https_expired, | ||
109 | LocalAddr => "127.0.0.1", | ||
110 | SSL_cert_file => "$Bin/certs/expired-cert.pem", | ||
111 | SSL_key_file => "$Bin/certs/expired-key.pem", | ||
112 | ) || die; | ||
113 | print "Please contact https expired at: <URL:", $d->url, ">\n"; | ||
114 | run_server( $d ); | ||
115 | exit; | ||
116 | } | ||
117 | } else { | ||
118 | my $d = HTTP::Daemon::SSL->new( | ||
119 | LocalPort => $port_https, | ||
120 | LocalAddr => "127.0.0.1", | ||
121 | SSL_cert_file => "$Bin/certs/server-cert.pem", | ||
122 | SSL_key_file => "$Bin/certs/server-key.pem", | ||
123 | ) || die; | ||
124 | print "Please contact https at: <URL:", $d->url, ">\n"; | ||
125 | run_server( $d ); | ||
126 | exit; | ||
127 | } | ||
128 | } | ||
129 | } else { | ||
130 | # Child | ||
131 | #print "child\n"; | ||
132 | my $d = HTTP::Daemon->new( | ||
133 | LocalPort => $port_http, | ||
134 | LocalAddr => "127.0.0.1", | ||
135 | ) || die; | ||
136 | print "Please contact http at: <URL:", $d->url, ">\n"; | ||
137 | run_server( $d ); | ||
138 | exit; | ||
139 | } | ||
140 | |||
141 | # give our webservers some time to startup | ||
142 | sleep(3); | ||
143 | |||
144 | # Run the same server on http and https | ||
145 | sub run_server { | ||
146 | my $d = shift; | ||
147 | MAINLOOP: while (my $c = $d->accept ) { | ||
148 | while (my $r = $c->get_request) { | ||
149 | if ($r->method eq "GET" and $r->url->path =~ m^/statuscode/(\d+)^) { | ||
150 | $c->send_basic_header($1); | ||
151 | $c->send_crlf; | ||
152 | } elsif ($r->method eq "GET" and $r->url->path =~ m^/file/(.*)^) { | ||
153 | $c->send_basic_header; | ||
154 | $c->send_crlf; | ||
155 | $c->send_file_response("$Bin/var/$1"); | ||
156 | } elsif ($r->method eq "GET" and $r->url->path eq "/slow") { | ||
157 | $c->send_basic_header; | ||
158 | $c->send_crlf; | ||
159 | sleep 1; | ||
160 | $c->send_response("slow"); | ||
161 | } elsif ($r->url->path eq "/method") { | ||
162 | if ($r->method eq "DELETE") { | ||
163 | $c->send_error(HTTP::Status->RC_METHOD_NOT_ALLOWED); | ||
164 | } elsif ($r->method eq "foo") { | ||
165 | $c->send_error(HTTP::Status->RC_NOT_IMPLEMENTED); | ||
166 | } else { | ||
167 | $c->send_status_line(200, $r->method); | ||
168 | } | ||
169 | } elsif ($r->url->path eq "/postdata") { | ||
170 | $c->send_basic_header; | ||
171 | $c->send_crlf; | ||
172 | $c->send_response($r->method.":".$r->content); | ||
173 | } elsif ($r->url->path eq "/redirect") { | ||
174 | $c->send_redirect( "/redirect2" ); | ||
175 | } elsif ($r->url->path eq "/redir_external") { | ||
176 | $c->send_redirect(($d->isa('HTTP::Daemon::SSL') ? "https" : "http") . "://169.254.169.254/redirect2" ); | ||
177 | } elsif ($r->url->path eq "/redirect2") { | ||
178 | $c->send_basic_header; | ||
179 | $c->send_crlf; | ||
180 | $c->send_response(HTTP::Response->new( 200, 'OK', undef, 'redirected' )); | ||
181 | } elsif ($r->url->path eq "/redir_timeout") { | ||
182 | $c->send_redirect( "/timeout" ); | ||
183 | } elsif ($r->url->path eq "/timeout") { | ||
184 | # Keep $c from being destroyed, but prevent severe leaks | ||
185 | unshift @persist, $c; | ||
186 | delete($persist[1000]); | ||
187 | next MAINLOOP; | ||
188 | } elsif ($r->url->path eq "/header_check") { | ||
189 | $c->send_basic_header; | ||
190 | $c->send_header('foo'); | ||
191 | $c->send_crlf; | ||
192 | } elsif ($r->url->path eq "/header_broken_check") { | ||
193 | $c->send_basic_header; | ||
194 | $c->send_header('foo'); | ||
195 | print $c "Test1:: broken\n"; | ||
196 | print $c " Test2: leading whitespace\n"; | ||
197 | $c->send_crlf; | ||
198 | } elsif ($r->url->path eq "/virtual_port") { | ||
199 | # return sent Host header | ||
200 | $c->send_basic_header; | ||
201 | $c->send_crlf; | ||
202 | $c->send_response(HTTP::Response->new( 200, 'OK', undef, $r->header ('Host'))); | ||
203 | } else { | ||
204 | $c->send_error(HTTP::Status->RC_FORBIDDEN); | ||
205 | } | ||
206 | $c->close; | ||
207 | } | ||
208 | } | ||
209 | } | ||
210 | |||
211 | END { | ||
212 | foreach my $pid (@pids) { | ||
213 | if ($pid) { print "Killing $pid\n"; kill "INT", $pid } | ||
214 | } | ||
215 | }; | ||
216 | |||
217 | if ($ARGV[0] && $ARGV[0] eq "-d") { | ||
218 | while (1) { | ||
219 | sleep 100; | ||
220 | } | ||
221 | } | ||
222 | |||
223 | my $result; | ||
224 | my $command = "./$plugin -H 127.0.0.1"; | ||
225 | |||
226 | run_common_tests( { command => "$command -p $port_http" } ); | ||
227 | SKIP: { | ||
228 | skip "HTTP::Daemon::SSL not installed", $common_tests + $ssl_only_tests if ! exists $servers->{https}; | ||
229 | run_common_tests( { command => "$command -p $port_https", ssl => 1 } ); | ||
230 | |||
231 | $result = NPTest->testCmd( "$command -p $port_https -S -C 14" ); | ||
232 | is( $result->return_code, 0, "$command -p $port_https -S -C 14" ); | ||
233 | is( $result->output, "OK - Certificate 'Monitoring Plugins' will expire on Fri Feb 16 15:31:44 2029 +0000.", "output ok" ); | ||
234 | |||
235 | $result = NPTest->testCmd( "$command -p $port_https -S -C 14000" ); | ||
236 | is( $result->return_code, 1, "$command -p $port_https -S -C 14000" ); | ||
237 | like( $result->output, '/WARNING - Certificate \'Monitoring Plugins\' expires in \d+ day\(s\) \(Fri Feb 16 15:31:44 2029 \+0000\)./', "output ok" ); | ||
238 | |||
239 | # Expired cert tests | ||
240 | $result = NPTest->testCmd( "$command -p $port_https -S -C 13960,14000" ); | ||
241 | is( $result->return_code, 2, "$command -p $port_https -S -C 13960,14000" ); | ||
242 | like( $result->output, '/CRITICAL - Certificate \'Monitoring Plugins\' expires in \d+ day\(s\) \(Fri Feb 16 15:31:44 2029 \+0000\)./', "output ok" ); | ||
243 | |||
244 | $result = NPTest->testCmd( "$command -p $port_https_expired -S -C 7" ); | ||
245 | is( $result->return_code, 2, "$command -p $port_https_expired -S -C 7" ); | ||
246 | is( $result->output, | ||
247 | 'CRITICAL - Certificate \'Monitoring Plugins\' expired on Wed Jan 2 11:00:26 2008 +0000.', | ||
248 | "output ok" ); | ||
249 | |||
250 | } | ||
251 | |||
252 | my $cmd; | ||
253 | |||
254 | # advanced checks with virtual hostname and virtual port | ||
255 | SKIP: { | ||
256 | skip "libcurl version is smaller than $required_version", 6 unless $use_advanced_checks; | ||
257 | |||
258 | # http without virtual port | ||
259 | $cmd = "./$plugin -H $virtual_host -I 127.0.0.1 -p $port_http -u /virtual_port -r ^$virtual_host:$port_http\$"; | ||
260 | $result = NPTest->testCmd( $cmd ); | ||
261 | is( $result->return_code, 0, $cmd); | ||
262 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
263 | |||
264 | # http with virtual port (!= 80) | ||
265 | $cmd = "./$plugin -H $virtual_host:$virtual_port -I 127.0.0.1 -p $port_http -u /virtual_port -r ^$virtual_host:$virtual_port\$"; | ||
266 | $result = NPTest->testCmd( $cmd ); | ||
267 | is( $result->return_code, 0, $cmd); | ||
268 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
269 | |||
270 | # http with virtual port (80) | ||
271 | $cmd = "./$plugin -H $virtual_host:80 -I 127.0.0.1 -p $port_http -u /virtual_port -r ^$virtual_host\$"; | ||
272 | $result = NPTest->testCmd( $cmd ); | ||
273 | is( $result->return_code, 0, $cmd); | ||
274 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
275 | } | ||
276 | |||
277 | # and the same for SSL | ||
278 | SKIP: { | ||
279 | skip "libcurl version is smaller than $required_version and/or HTTP::Daemon::SSL not installed", 6 if ! exists $servers->{https} or not $use_advanced_checks; | ||
280 | # https without virtual port | ||
281 | $cmd = "./$plugin -H $virtual_host -I 127.0.0.1 -p $port_https --ssl -u /virtual_port -r ^$virtual_host:$port_https\$"; | ||
282 | $result = NPTest->testCmd( $cmd ); | ||
283 | is( $result->return_code, 0, $cmd); | ||
284 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
285 | |||
286 | # https with virtual port (!= 443) | ||
287 | $cmd = "./$plugin -H $virtual_host:$virtual_port -I 127.0.0.1 -p $port_https --ssl -u /virtual_port -r ^$virtual_host:$virtual_port\$"; | ||
288 | $result = NPTest->testCmd( $cmd ); | ||
289 | is( $result->return_code, 0, $cmd); | ||
290 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
291 | |||
292 | # https with virtual port (443) | ||
293 | $cmd = "./$plugin -H $virtual_host:443 -I 127.0.0.1 -p $port_https --ssl -u /virtual_port -r ^$virtual_host\$"; | ||
294 | $result = NPTest->testCmd( $cmd ); | ||
295 | is( $result->return_code, 0, $cmd); | ||
296 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
297 | } | ||
298 | |||
299 | |||
300 | sub run_common_tests { | ||
301 | my ($opts) = @_; | ||
302 | my $command = $opts->{command}; | ||
303 | if ($opts->{ssl}) { | ||
304 | $command .= " --ssl"; | ||
305 | } | ||
306 | |||
307 | $result = NPTest->testCmd( "$command -u /file/root" ); | ||
308 | is( $result->return_code, 0, "/file/root"); | ||
309 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - 274 bytes in [\d\.]+ second/', "Output correct" ); | ||
310 | |||
311 | $result = NPTest->testCmd( "$command -u /file/root -s Root" ); | ||
312 | is( $result->return_code, 0, "/file/root search for string"); | ||
313 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - 274 bytes in [\d\.]+ second/', "Output correct" ); | ||
314 | |||
315 | $result = NPTest->testCmd( "$command -u /file/root -s NonRoot" ); | ||
316 | is( $result->return_code, 2, "Missing string check"); | ||
317 | like( $result->output, qr%^HTTP CRITICAL: HTTP/1\.1 200 OK - string 'NonRoot' not found on 'https?://127\.0\.0\.1:\d+/file/root'%, "Shows search string and location"); | ||
318 | |||
319 | $result = NPTest->testCmd( "$command -u /file/root -s NonRootWithOver30charsAndMoreFunThanAWetFish" ); | ||
320 | is( $result->return_code, 2, "Missing string check"); | ||
321 | like( $result->output, qr%HTTP CRITICAL: HTTP/1\.1 200 OK - string 'NonRootWithOver30charsAndM...' not found on 'https?://127\.0\.0\.1:\d+/file/root'%, "Shows search string and location"); | ||
322 | |||
323 | $result = NPTest->testCmd( "$command -u /header_check -d foo" ); | ||
324 | is( $result->return_code, 0, "header_check search for string"); | ||
325 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - 96 bytes in [\d\.]+ second/', "Output correct" ); | ||
326 | |||
327 | $result = NPTest->testCmd( "$command -u /header_check -d bar" ); | ||
328 | is( $result->return_code, 2, "Missing header string check"); | ||
329 | like( $result->output, qr%^HTTP CRITICAL: HTTP/1\.1 200 OK - header 'bar' not found on 'https?://127\.0\.0\.1:\d+/header_check'%, "Shows search string and location"); | ||
330 | |||
331 | $result = NPTest->testCmd( "$command -u /header_broken_check" ); | ||
332 | is( $result->return_code, 0, "header_check search for string"); | ||
333 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - 138 bytes in [\d\.]+ second/', "Output correct" ); | ||
334 | |||
335 | my $cmd; | ||
336 | $cmd = "$command -u /slow"; | ||
337 | $result = NPTest->testCmd( $cmd ); | ||
338 | is( $result->return_code, 0, "$cmd"); | ||
339 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
340 | $result->output =~ /in ([\d\.]+) second/; | ||
341 | cmp_ok( $1, ">", 1, "Time is > 1 second" ); | ||
342 | |||
343 | $cmd = "$command -u /statuscode/200"; | ||
344 | $result = NPTest->testCmd( $cmd ); | ||
345 | is( $result->return_code, 0, $cmd); | ||
346 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
347 | |||
348 | $cmd = "$command -u /statuscode/200 -e 200"; | ||
349 | $result = NPTest->testCmd( $cmd ); | ||
350 | is( $result->return_code, 0, $cmd); | ||
351 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - Status line output matched "200" - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
352 | |||
353 | $cmd = "$command -u /statuscode/201"; | ||
354 | $result = NPTest->testCmd( $cmd ); | ||
355 | is( $result->return_code, 0, $cmd); | ||
356 | like( $result->output, '/^HTTP OK: HTTP/1.1 201 Created - \d+ bytes in [\d\.]+ second /', "Output correct: ".$result->output ); | ||
357 | |||
358 | $cmd = "$command -u /statuscode/201 -e 201"; | ||
359 | $result = NPTest->testCmd( $cmd ); | ||
360 | is( $result->return_code, 0, $cmd); | ||
361 | like( $result->output, '/^HTTP OK: HTTP/1.1 201 Created - Status line output matched "201" - \d+ bytes in [\d\.]+ second /', "Output correct: ".$result->output ); | ||
362 | |||
363 | $cmd = "$command -u /statuscode/201 -e 200"; | ||
364 | $result = NPTest->testCmd( $cmd ); | ||
365 | is( $result->return_code, 2, $cmd); | ||
366 | like( $result->output, '/^HTTP CRITICAL - Invalid HTTP response received from host on port \d+: HTTP/1.1 201 Created/', "Output correct: ".$result->output ); | ||
367 | |||
368 | $cmd = "$command -u /statuscode/200 -e 200,201,202"; | ||
369 | $result = NPTest->testCmd( $cmd ); | ||
370 | is( $result->return_code, 0, $cmd); | ||
371 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - Status line output matched "200,201,202" - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
372 | |||
373 | $cmd = "$command -u /statuscode/201 -e 200,201,202"; | ||
374 | $result = NPTest->testCmd( $cmd ); | ||
375 | is( $result->return_code, 0, $cmd); | ||
376 | like( $result->output, '/^HTTP OK: HTTP/1.1 201 Created - Status line output matched "200,201,202" - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
377 | |||
378 | $cmd = "$command -u /statuscode/203 -e 200,201,202"; | ||
379 | $result = NPTest->testCmd( $cmd ); | ||
380 | is( $result->return_code, 2, $cmd); | ||
381 | like( $result->output, '/^HTTP CRITICAL - Invalid HTTP response received from host on port (\d+): HTTP/1.1 203 Non-Authoritative Information/', "Output correct: ".$result->output ); | ||
382 | |||
383 | $cmd = "$command -j HEAD -u /method"; | ||
384 | $result = NPTest->testCmd( $cmd ); | ||
385 | is( $result->return_code, 0, $cmd); | ||
386 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 HEAD - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
387 | |||
388 | $cmd = "$command -j POST -u /method"; | ||
389 | $result = NPTest->testCmd( $cmd ); | ||
390 | is( $result->return_code, 0, $cmd); | ||
391 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 POST - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
392 | |||
393 | $cmd = "$command -j GET -u /method"; | ||
394 | $result = NPTest->testCmd( $cmd ); | ||
395 | is( $result->return_code, 0, $cmd); | ||
396 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 GET - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
397 | |||
398 | $cmd = "$command -u /method"; | ||
399 | $result = NPTest->testCmd( $cmd ); | ||
400 | is( $result->return_code, 0, $cmd); | ||
401 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 GET - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
402 | |||
403 | $cmd = "$command -P foo -u /method"; | ||
404 | $result = NPTest->testCmd( $cmd ); | ||
405 | is( $result->return_code, 0, $cmd); | ||
406 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 POST - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
407 | |||
408 | $cmd = "$command -j DELETE -u /method"; | ||
409 | $result = NPTest->testCmd( $cmd ); | ||
410 | is( $result->return_code, 1, $cmd); | ||
411 | like( $result->output, '/^HTTP WARNING: HTTP/1.1 405 Method Not Allowed/', "Output correct: ".$result->output ); | ||
412 | |||
413 | $cmd = "$command -j foo -u /method"; | ||
414 | $result = NPTest->testCmd( $cmd ); | ||
415 | is( $result->return_code, 2, $cmd); | ||
416 | like( $result->output, '/^HTTP CRITICAL: HTTP/1.1 501 Not Implemented/', "Output correct: ".$result->output ); | ||
417 | |||
418 | $cmd = "$command -P stufftoinclude -u /postdata -s POST:stufftoinclude"; | ||
419 | $result = NPTest->testCmd( $cmd ); | ||
420 | is( $result->return_code, 0, $cmd); | ||
421 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
422 | |||
423 | $cmd = "$command -j PUT -P stufftoinclude -u /postdata -s PUT:stufftoinclude"; | ||
424 | $result = NPTest->testCmd( $cmd ); | ||
425 | is( $result->return_code, 0, $cmd); | ||
426 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
427 | |||
428 | # To confirm that the free doesn't segfault | ||
429 | $cmd = "$command -P stufftoinclude -j PUT -u /postdata -s PUT:stufftoinclude"; | ||
430 | $result = NPTest->testCmd( $cmd ); | ||
431 | is( $result->return_code, 0, $cmd); | ||
432 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
433 | |||
434 | $cmd = "$command -u /redirect"; | ||
435 | $result = NPTest->testCmd( $cmd ); | ||
436 | is( $result->return_code, 0, $cmd); | ||
437 | like( $result->output, '/^HTTP OK: HTTP/1.1 301 Moved Permanently - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
438 | |||
439 | $cmd = "$command -f follow -u /redirect"; | ||
440 | $result = NPTest->testCmd( $cmd ); | ||
441 | is( $result->return_code, 0, $cmd); | ||
442 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
443 | |||
444 | $cmd = "$command -u /redirect -k 'follow: me'"; | ||
445 | $result = NPTest->testCmd( $cmd ); | ||
446 | is( $result->return_code, 0, $cmd); | ||
447 | like( $result->output, '/^HTTP OK: HTTP/1.1 301 Moved Permanently - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
448 | |||
449 | $cmd = "$command -f follow -u /redirect -k 'follow: me'"; | ||
450 | $result = NPTest->testCmd( $cmd ); | ||
451 | is( $result->return_code, 0, $cmd); | ||
452 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
453 | |||
454 | $cmd = "$command -f sticky -u /redirect -k 'follow: me'"; | ||
455 | $result = NPTest->testCmd( $cmd ); | ||
456 | is( $result->return_code, 0, $cmd); | ||
457 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
458 | |||
459 | $cmd = "$command -f stickyport -u /redirect -k 'follow: me'"; | ||
460 | $result = NPTest->testCmd( $cmd ); | ||
461 | is( $result->return_code, 0, $cmd); | ||
462 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
463 | |||
464 | # These tests may block | ||
465 | print "ALRM\n"; | ||
466 | |||
467 | # stickyport - on full urlS port is set back to 80 otherwise | ||
468 | $cmd = "$command -f stickyport -u /redir_external -t 5 -s redirected"; | ||
469 | eval { | ||
470 | local $SIG{ALRM} = sub { die "alarm\n" }; | ||
471 | alarm(2); | ||
472 | $result = NPTest->testCmd( $cmd ); | ||
473 | alarm(0); }; | ||
474 | isnt( $@, "alarm\n", $cmd ); | ||
475 | is( $result->return_code, 0, $cmd ); | ||
476 | |||
477 | # Let's hope there won't be any web server on :80 returning "redirected"! | ||
478 | $cmd = "$command -f sticky -u /redir_external -t 5 -s redirected"; | ||
479 | eval { | ||
480 | local $SIG{ALRM} = sub { die "alarm\n" }; | ||
481 | alarm(2); | ||
482 | $result = NPTest->testCmd( $cmd ); | ||
483 | alarm(0); }; | ||
484 | isnt( $@, "alarm\n", $cmd ); | ||
485 | isnt( $result->return_code, 0, $cmd ); | ||
486 | |||
487 | # Test an external address - timeout | ||
488 | SKIP: { | ||
489 | skip "This doesn't seem to work all the time", 1 unless ($ENV{HTTP_EXTERNAL}); | ||
490 | $cmd = "$command -f follow -u /redir_external -t 5"; | ||
491 | eval { | ||
492 | $result = NPTest->testCmd( $cmd, 2 ); | ||
493 | }; | ||
494 | like( $@, "/timeout in command: $cmd/", $cmd ); | ||
495 | } | ||
496 | |||
497 | $cmd = "$command -u /timeout -t 5"; | ||
498 | eval { | ||
499 | $result = NPTest->testCmd( $cmd, 2 ); | ||
500 | }; | ||
501 | like( $@, "/timeout in command: $cmd/", $cmd ); | ||
502 | |||
503 | $cmd = "$command -f follow -u /redir_timeout -t 2"; | ||
504 | eval { | ||
505 | $result = NPTest->testCmd( $cmd, 5 ); | ||
506 | }; | ||
507 | is( $@, "", $cmd ); | ||
508 | |||
509 | } | ||
diff --git a/plugins/tests/check_http.t b/plugins/tests/check_http.t index 1bc0ecb7..188f5e75 100755 --- a/plugins/tests/check_http.t +++ b/plugins/tests/check_http.t | |||
@@ -4,13 +4,15 @@ | |||
4 | # | 4 | # |
5 | # To create the https server certificate: | 5 | # To create the https server certificate: |
6 | # openssl req -new -x509 -keyout server-key.pem -out server-cert.pem -days 3650 -nodes | 6 | # openssl req -new -x509 -keyout server-key.pem -out server-cert.pem -days 3650 -nodes |
7 | # Country Name (2 letter code) [AU]:UK | 7 | # to create a new expired certificate: |
8 | # State or Province Name (full name) [Some-State]:Derbyshire | 8 | # faketime '2008-01-01 12:00:00' openssl req -new -x509 -keyout expired-key.pem -out expired-cert.pem -days 1 -nodes |
9 | # Locality Name (eg, city) []:Belper | 9 | # Country Name (2 letter code) [AU]:DE |
10 | # State or Province Name (full name) [Some-State]:Bavaria | ||
11 | # Locality Name (eg, city) []:Munich | ||
10 | # Organization Name (eg, company) [Internet Widgits Pty Ltd]:Monitoring Plugins | 12 | # Organization Name (eg, company) [Internet Widgits Pty Ltd]:Monitoring Plugins |
11 | # Organizational Unit Name (eg, section) []: | 13 | # Organizational Unit Name (eg, section) []: |
12 | # Common Name (eg, YOUR name) []:Ton Voon | 14 | # Common Name (e.g. server FQDN or YOUR name) []:Monitoring Plugins |
13 | # Email Address []:tonvoon@mac.com | 15 | # Email Address []:devel@monitoring-plugins.org |
14 | 16 | ||
15 | use strict; | 17 | use strict; |
16 | use Test::More; | 18 | use Test::More; |
@@ -20,6 +22,7 @@ use FindBin qw($Bin); | |||
20 | $ENV{'LC_TIME'} = "C"; | 22 | $ENV{'LC_TIME'} = "C"; |
21 | 23 | ||
22 | my $common_tests = 70; | 24 | my $common_tests = 70; |
25 | my $virtual_port_tests = 8; | ||
23 | my $ssl_only_tests = 8; | 26 | my $ssl_only_tests = 8; |
24 | # Check that all dependent modules are available | 27 | # Check that all dependent modules are available |
25 | eval "use HTTP::Daemon 6.01;"; | 28 | eval "use HTTP::Daemon 6.01;"; |
@@ -29,13 +32,16 @@ eval { | |||
29 | require HTTP::Response; | 32 | require HTTP::Response; |
30 | }; | 33 | }; |
31 | 34 | ||
35 | my $plugin = 'check_http'; | ||
36 | $plugin = 'check_curl' if $0 =~ m/check_curl/mx; | ||
37 | |||
32 | if ($@) { | 38 | if ($@) { |
33 | plan skip_all => "Missing required module for test: $@"; | 39 | plan skip_all => "Missing required module for test: $@"; |
34 | } else { | 40 | } else { |
35 | if (-x "./check_http") { | 41 | if (-x "./$plugin") { |
36 | plan tests => $common_tests * 2 + $ssl_only_tests; | 42 | plan tests => $common_tests * 2 + $ssl_only_tests + $virtual_port_tests; |
37 | } else { | 43 | } else { |
38 | plan skip_all => "No check_http compiled"; | 44 | plan skip_all => "No $plugin compiled"; |
39 | } | 45 | } |
40 | } | 46 | } |
41 | 47 | ||
@@ -85,6 +91,8 @@ if ($pid) { | |||
85 | exit; | 91 | exit; |
86 | } | 92 | } |
87 | } else { | 93 | } else { |
94 | # closing the connection after -C cert checks make the daemon exit with a sigpipe otherwise | ||
95 | local $SIG{'PIPE'} = 'IGNORE'; | ||
88 | my $d = HTTP::Daemon::SSL->new( | 96 | my $d = HTTP::Daemon::SSL->new( |
89 | LocalPort => $port_https, | 97 | LocalPort => $port_https, |
90 | LocalAddr => "127.0.0.1", | 98 | LocalAddr => "127.0.0.1", |
@@ -96,8 +104,6 @@ if ($pid) { | |||
96 | exit; | 104 | exit; |
97 | } | 105 | } |
98 | } | 106 | } |
99 | # give our webservers some time to startup | ||
100 | sleep(1); | ||
101 | } else { | 107 | } else { |
102 | # Child | 108 | # Child |
103 | #print "child\n"; | 109 | #print "child\n"; |
@@ -110,6 +116,9 @@ if ($pid) { | |||
110 | exit; | 116 | exit; |
111 | } | 117 | } |
112 | 118 | ||
119 | # give our webservers some time to startup | ||
120 | sleep(3); | ||
121 | |||
113 | # Run the same server on http and https | 122 | # Run the same server on http and https |
114 | sub run_server { | 123 | sub run_server { |
115 | my $d = shift; | 124 | my $d = shift; |
@@ -158,6 +167,11 @@ sub run_server { | |||
158 | $c->send_basic_header; | 167 | $c->send_basic_header; |
159 | $c->send_header('foo'); | 168 | $c->send_header('foo'); |
160 | $c->send_crlf; | 169 | $c->send_crlf; |
170 | } elsif ($r->url->path eq "/virtual_port") { | ||
171 | # return sent Host header | ||
172 | $c->send_basic_header; | ||
173 | $c->send_crlf; | ||
174 | $c->send_response(HTTP::Response->new( 200, 'OK', undef, $r->header ('Host'))); | ||
161 | } else { | 175 | } else { |
162 | $c->send_error(HTTP::Status->RC_FORBIDDEN); | 176 | $c->send_error(HTTP::Status->RC_FORBIDDEN); |
163 | } | 177 | } |
@@ -179,7 +193,7 @@ if ($ARGV[0] && $ARGV[0] eq "-d") { | |||
179 | } | 193 | } |
180 | 194 | ||
181 | my $result; | 195 | my $result; |
182 | my $command = "./check_http -H 127.0.0.1"; | 196 | my $command = "./$plugin -H 127.0.0.1"; |
183 | 197 | ||
184 | run_common_tests( { command => "$command -p $port_http" } ); | 198 | run_common_tests( { command => "$command -p $port_http" } ); |
185 | SKIP: { | 199 | SKIP: { |
@@ -188,25 +202,56 @@ SKIP: { | |||
188 | 202 | ||
189 | $result = NPTest->testCmd( "$command -p $port_https -S -C 14" ); | 203 | $result = NPTest->testCmd( "$command -p $port_https -S -C 14" ); |
190 | is( $result->return_code, 0, "$command -p $port_https -S -C 14" ); | 204 | is( $result->return_code, 0, "$command -p $port_https -S -C 14" ); |
191 | is( $result->output, 'OK - Certificate \'Ton Voon\' will expire on Sun Mar 3 21:41:28 2019 +0000.', "output ok" ); | 205 | is( $result->output, "OK - Certificate 'Monitoring Plugins' will expire on Fri Feb 16 15:31:44 2029 +0000.", "output ok" ); |
192 | 206 | ||
193 | $result = NPTest->testCmd( "$command -p $port_https -S -C 14000" ); | 207 | $result = NPTest->testCmd( "$command -p $port_https -S -C 14000" ); |
194 | is( $result->return_code, 1, "$command -p $port_https -S -C 14000" ); | 208 | is( $result->return_code, 1, "$command -p $port_https -S -C 14000" ); |
195 | like( $result->output, '/WARNING - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(Sun Mar 3 21:41:28 2019 \+0000\)./', "output ok" ); | 209 | like( $result->output, '/WARNING - Certificate \'Monitoring Plugins\' expires in \d+ day\(s\) \(Fri Feb 16 15:31:44 2029 \+0000\)./', "output ok" ); |
196 | 210 | ||
197 | # Expired cert tests | 211 | # Expired cert tests |
198 | $result = NPTest->testCmd( "$command -p $port_https -S -C 13960,14000" ); | 212 | $result = NPTest->testCmd( "$command -p $port_https -S -C 13960,14000" ); |
199 | is( $result->return_code, 2, "$command -p $port_https -S -C 13960,14000" ); | 213 | is( $result->return_code, 2, "$command -p $port_https -S -C 13960,14000" ); |
200 | like( $result->output, '/CRITICAL - Certificate \'Ton Voon\' expires in \d+ day\(s\) \(Sun Mar 3 21:41:28 2019 \+0000\)./', "output ok" ); | 214 | like( $result->output, '/CRITICAL - Certificate \'Monitoring Plugins\' expires in \d+ day\(s\) \(Fri Feb 16 15:31:44 2029 \+0000\)./', "output ok" ); |
201 | 215 | ||
202 | $result = NPTest->testCmd( "$command -p $port_https_expired -S -C 7" ); | 216 | $result = NPTest->testCmd( "$command -p $port_https_expired -S -C 7" ); |
203 | is( $result->return_code, 2, "$command -p $port_https_expired -S -C 7" ); | 217 | is( $result->return_code, 2, "$command -p $port_https_expired -S -C 7" ); |
204 | is( $result->output, | 218 | is( $result->output, |
205 | 'CRITICAL - Certificate \'Ton Voon\' expired on Thu Mar 5 00:13:16 2009 +0000.', | 219 | 'CRITICAL - Certificate \'Monitoring Plugins\' expired on Wed Jan 2 11:00:26 2008 +0000.', |
206 | "output ok" ); | 220 | "output ok" ); |
207 | 221 | ||
208 | } | 222 | } |
209 | 223 | ||
224 | my $cmd; | ||
225 | # check virtual port behaviour | ||
226 | # | ||
227 | # http without virtual port | ||
228 | $cmd = "$command -p $port_http -u /virtual_port -r ^127.0.0.1:$port_http\$"; | ||
229 | $result = NPTest->testCmd( $cmd ); | ||
230 | is( $result->return_code, 0, $cmd); | ||
231 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
232 | |||
233 | # http with virtual port | ||
234 | $cmd = "$command:80 -p $port_http -u /virtual_port -r ^127.0.0.1\$"; | ||
235 | $result = NPTest->testCmd( $cmd ); | ||
236 | is( $result->return_code, 0, $cmd); | ||
237 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
238 | |||
239 | SKIP: { | ||
240 | skip "HTTP::Daemon::SSL not installed", 4 if ! exists $servers->{https}; | ||
241 | # https without virtual port | ||
242 | $cmd = "$command -p $port_https --ssl -u /virtual_port -r ^127.0.0.1:$port_https\$"; | ||
243 | $result = NPTest->testCmd( $cmd ); | ||
244 | is( $result->return_code, 0, $cmd); | ||
245 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
246 | |||
247 | # https with virtual port | ||
248 | $cmd = "$command:443 -p $port_https --ssl -u /virtual_port -r ^127.0.0.1\$"; | ||
249 | $result = NPTest->testCmd( $cmd ); | ||
250 | is( $result->return_code, 0, $cmd); | ||
251 | like( $result->output, '/^HTTP OK: HTTP/1.1 200 OK - \d+ bytes in [\d\.]+ second/', "Output correct: ".$result->output ); | ||
252 | } | ||
253 | |||
254 | |||
210 | sub run_common_tests { | 255 | sub run_common_tests { |
211 | my ($opts) = @_; | 256 | my ($opts) = @_; |
212 | my $command = $opts->{command}; | 257 | my $command = $opts->{command}; |
@@ -372,27 +417,29 @@ sub run_common_tests { | |||
372 | 417 | ||
373 | # stickyport - on full urlS port is set back to 80 otherwise | 418 | # stickyport - on full urlS port is set back to 80 otherwise |
374 | $cmd = "$command -f stickyport -u /redir_external -t 5 -s redirected"; | 419 | $cmd = "$command -f stickyport -u /redir_external -t 5 -s redirected"; |
420 | alarm(2); | ||
375 | eval { | 421 | eval { |
376 | local $SIG{ALRM} = sub { die "alarm\n" }; | 422 | local $SIG{ALRM} = sub { die "alarm\n" }; |
377 | alarm(2); | ||
378 | $result = NPTest->testCmd( $cmd ); | 423 | $result = NPTest->testCmd( $cmd ); |
379 | alarm(0); }; | 424 | }; |
380 | isnt( $@, "alarm\n", $cmd ); | 425 | isnt( $@, "alarm\n", $cmd ); |
426 | alarm(0); | ||
381 | is( $result->return_code, 0, $cmd ); | 427 | is( $result->return_code, 0, $cmd ); |
382 | 428 | ||
383 | # Let's hope there won't be any web server on :80 returning "redirected"! | 429 | # Let's hope there won't be any web server on :80 returning "redirected"! |
384 | $cmd = "$command -f sticky -u /redir_external -t 5 -s redirected"; | 430 | $cmd = "$command -f sticky -u /redir_external -t 5 -s redirected"; |
431 | alarm(2); | ||
385 | eval { | 432 | eval { |
386 | local $SIG{ALRM} = sub { die "alarm\n" }; | 433 | local $SIG{ALRM} = sub { die "alarm\n" }; |
387 | alarm(2); | ||
388 | $result = NPTest->testCmd( $cmd ); | 434 | $result = NPTest->testCmd( $cmd ); |
389 | alarm(0); }; | 435 | }; |
390 | isnt( $@, "alarm\n", $cmd ); | 436 | isnt( $@, "alarm\n", $cmd ); |
437 | alarm(0); | ||
391 | isnt( $result->return_code, 0, $cmd ); | 438 | isnt( $result->return_code, 0, $cmd ); |
392 | 439 | ||
393 | # Test an external address - timeout | 440 | # Test an external address - timeout |
394 | SKIP: { | 441 | SKIP: { |
395 | skip "This doesn't seems to work all the time", 1 unless ($ENV{HTTP_EXTERNAL}); | 442 | skip "This doesn't seem to work all the time", 1 unless ($ENV{HTTP_EXTERNAL}); |
396 | $cmd = "$command -f follow -u /redir_external -t 5"; | 443 | $cmd = "$command -f follow -u /redir_external -t 5"; |
397 | eval { | 444 | eval { |
398 | $result = NPTest->testCmd( $cmd, 2 ); | 445 | $result = NPTest->testCmd( $cmd, 2 ); |
diff --git a/plugins/tests/check_procs.t b/plugins/tests/check_procs.t index 54d43d9b..3af218f5 100755 --- a/plugins/tests/check_procs.t +++ b/plugins/tests/check_procs.t | |||
@@ -8,13 +8,14 @@ use Test::More; | |||
8 | use NPTest; | 8 | use NPTest; |
9 | 9 | ||
10 | if (-x "./check_procs") { | 10 | if (-x "./check_procs") { |
11 | plan tests => 50; | 11 | plan tests => 52; |
12 | } else { | 12 | } else { |
13 | plan skip_all => "No check_procs compiled"; | 13 | plan skip_all => "No check_procs compiled"; |
14 | } | 14 | } |
15 | 15 | ||
16 | my $result; | 16 | my $result; |
17 | my $command = "./check_procs --input-file=tests/var/ps-axwo.darwin"; | 17 | my $command = "./check_procs --input-file=tests/var/ps-axwo.darwin"; |
18 | my $cmd_etime = "./check_procs --input-file=tests/var/ps-axwo.debian"; | ||
18 | 19 | ||
19 | $result = NPTest->testCmd( "$command" ); | 20 | $result = NPTest->testCmd( "$command" ); |
20 | is( $result->return_code, 0, "Run with no options" ); | 21 | is( $result->return_code, 0, "Run with no options" ); |
@@ -69,9 +70,21 @@ SKIP: { | |||
69 | like( $result->output, '/^PROCS OK: 0 processes with UID = -2 \(nobody\), args \'UsB\'/', "Output correct" ); | 70 | like( $result->output, '/^PROCS OK: 0 processes with UID = -2 \(nobody\), args \'UsB\'/', "Output correct" ); |
70 | }; | 71 | }; |
71 | 72 | ||
72 | $result = NPTest->testCmd( "$command --ereg-argument-array='mdworker.*501'" ); | 73 | SKIP: { |
73 | is( $result->return_code, 0, "Checking regexp search of arguments" ); | 74 | skip 'check_procs is compiled with etime format support', 2 if `$command -vvv` =~ m/etime/mx; |
74 | is( $result->output, "PROCS OK: 1 process with regex args 'mdworker.*501' | procs=1;;;0;", "Output correct" ); | 75 | |
76 | $result = NPTest->testCmd( "$command --ereg-argument-array='mdworker.*501'" ); | ||
77 | is( $result->return_code, 0, "Checking regexp search of arguments" ); | ||
78 | is( $result->output, "PROCS OK: 1 process with regex args 'mdworker.*501' | procs=1;;;0;", "Output correct" ); | ||
79 | } | ||
80 | |||
81 | SKIP: { | ||
82 | skip 'check_procs is compiled without etime format support', 2 if `$cmd_etime -vvv` !~ m/etime/mx; | ||
83 | |||
84 | $result = NPTest->testCmd( "$cmd_etime -m ELAPSED -C apache2 -w 1000 -c 2000" ); | ||
85 | is( $result->return_code, 2, "Checking elapsed time threshold" ); | ||
86 | is( $result->output, "ELAPSED CRITICAL: 10 crit, 0 warn out of 10 processes with command name 'apache2' | procs=10;;;0; procs_warn=0;;;0; procs_crit=10;;;0;", "Output correct" ); | ||
87 | } | ||
75 | 88 | ||
76 | $result = NPTest->testCmd( "$command --vsz 1000000" ); | 89 | $result = NPTest->testCmd( "$command --vsz 1000000" ); |
77 | is( $result->return_code, 0, "Checking filter by VSZ" ); | 90 | is( $result->return_code, 0, "Checking filter by VSZ" ); |
@@ -83,7 +96,7 @@ is( $result->output, 'PROCS OK: 3 processes with RSS >= 100000 | procs=3;;;0;', | |||
83 | 96 | ||
84 | $result = NPTest->testCmd( "$command -s S" ); | 97 | $result = NPTest->testCmd( "$command -s S" ); |
85 | is( $result->return_code, 0, "Checking filter for sleeping processes" ); | 98 | is( $result->return_code, 0, "Checking filter for sleeping processes" ); |
86 | like( $result->output, '/^PROCS OK: 44 processes with STATE = S/', "Output correct" ); | 99 | like( $result->output, '/^PROCS OK: 88 processes with STATE = S/', "Output correct" ); |
87 | 100 | ||
88 | $result = NPTest->testCmd( "$command -s Z" ); | 101 | $result = NPTest->testCmd( "$command -s Z" ); |
89 | is( $result->return_code, 0, "Checking filter for zombies" ); | 102 | is( $result->return_code, 0, "Checking filter for zombies" ); |
@@ -129,4 +142,3 @@ is( $result->output, 'RSS CRITICAL: 5 crit, 0 warn out of 95 processes [WindowSe | |||
129 | $result = NPTest->testCmd( "$command --ereg-argument-array='(nosuchname|nosuch2name)'" ); | 142 | $result = NPTest->testCmd( "$command --ereg-argument-array='(nosuchname|nosuch2name)'" ); |
130 | is( $result->return_code, 0, "Checking no pipe symbol in output" ); | 143 | is( $result->return_code, 0, "Checking no pipe symbol in output" ); |
131 | is( $result->output, "PROCS OK: 0 processes with regex args '(nosuchname,nosuch2name)' | procs=0;;;0;", "Output correct" ); | 144 | is( $result->output, "PROCS OK: 0 processes with regex args '(nosuchname,nosuch2name)' | procs=0;;;0;", "Output correct" ); |
132 | |||
diff --git a/plugins/tests/check_snmp.t b/plugins/tests/check_snmp.t index 73a68b20..0a77fa8a 100755 --- a/plugins/tests/check_snmp.t +++ b/plugins/tests/check_snmp.t | |||
@@ -7,8 +7,9 @@ use strict; | |||
7 | use Test::More; | 7 | use Test::More; |
8 | use NPTest; | 8 | use NPTest; |
9 | use FindBin qw($Bin); | 9 | use FindBin qw($Bin); |
10 | use POSIX qw/strftime/; | ||
10 | 11 | ||
11 | my $tests = 67; | 12 | my $tests = 73; |
12 | # Check that all dependent modules are available | 13 | # Check that all dependent modules are available |
13 | eval { | 14 | eval { |
14 | require NetSNMP::OID; | 15 | require NetSNMP::OID; |
@@ -37,6 +38,7 @@ if ($@) { | |||
37 | 38 | ||
38 | my $port_snmp = 16100 + int(rand(100)); | 39 | my $port_snmp = 16100 + int(rand(100)); |
39 | 40 | ||
41 | my $faketime = -x '/usr/bin/faketime' ? 1 : 0; | ||
40 | 42 | ||
41 | # Start up server | 43 | # Start up server |
42 | my @pids; | 44 | my @pids; |
@@ -118,77 +120,81 @@ like($res->output, '/'.quotemeta('SNMP OK - And now have fun with with this: \"C | |||
118 | "And now have fun with with this: \"C:\\\\\" | 120 | "And now have fun with with this: \"C:\\\\\" |
119 | because we\'re not done yet!"').'/m', "Attempt to confuse parser No.3"); | 121 | because we\'re not done yet!"').'/m', "Attempt to confuse parser No.3"); |
120 | 122 | ||
121 | system("rm -f ".$ENV{'MP_STATE_PATH'}."/check_snmp/*"); | 123 | system("rm -f ".$ENV{'MP_STATE_PATH'}."/*/check_snmp/*"); |
122 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -w 600" ); | ||
123 | is($res->return_code, 0, "Returns OK"); | ||
124 | is($res->output, "No previous data to calculate rate - assume okay"); | ||
125 | 124 | ||
126 | # Need to sleep, otherwise duration=0 | 125 | # run rate checks with faketime. rate checks depend on the exact amount of time spend between the |
127 | sleep 1; | 126 | # plugin runs which may fail on busy machines. |
127 | # using faketime removes this race condition and also saves all the sleeps in between. | ||
128 | SKIP: { | ||
129 | skip "No faketime binary found", 28 if !$faketime; | ||
128 | 130 | ||
129 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -w 600" ); | 131 | my $ts = time(); |
130 | is($res->return_code, 1, "WARNING - due to going above rate calculation" ); | 132 | $res = NPTest->testCmd("LC_TIME=C TZ=UTC faketime -f '".strftime("%Y-%m-%d %H:%M:%S", localtime($ts))."' ./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -w 600" ); |
131 | is($res->output, "SNMP RATE WARNING - *666* | iso.3.6.1.4.1.8072.3.2.67.10=666;600 "); | 133 | is($res->return_code, 0, "Returns OK"); |
134 | is($res->output, "No previous data to calculate rate - assume okay"); | ||
132 | 135 | ||
133 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -w 600" ); | 136 | # test rate 1 second later |
134 | is($res->return_code, 3, "UNKNOWN - basically the divide by zero error" ); | 137 | $res = NPTest->testCmd("LC_TIME=C TZ=UTC faketime -f '".strftime("%Y-%m-%d %H:%M:%S", localtime($ts+1))."' ./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -w 600" ); |
135 | is($res->output, "Time duration between plugin calls is invalid"); | 138 | is($res->return_code, 1, "WARNING - due to going above rate calculation" ); |
139 | is($res->output, "SNMP RATE WARNING - *666* | iso.3.6.1.4.1.8072.3.2.67.10=666;600 "); | ||
136 | 140 | ||
141 | # test rate with same time | ||
142 | $res = NPTest->testCmd("LC_TIME=C TZ=UTC faketime -f '".strftime("%Y-%m-%d %H:%M:%S", localtime($ts+1))."' ./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -w 600" ); | ||
143 | is($res->return_code, 3, "UNKNOWN - basically the divide by zero error" ); | ||
144 | is($res->output, "Time duration between plugin calls is invalid"); | ||
137 | 145 | ||
138 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets" ); | ||
139 | is($res->return_code, 0, "OK for first call" ); | ||
140 | is($res->output, "No previous data to calculate rate - assume okay" ); | ||
141 | 146 | ||
142 | # Need to sleep, otherwise duration=0 | 147 | $res = NPTest->testCmd("LC_TIME=C TZ=UTC faketime -f '".strftime("%Y-%m-%d %H:%M:%S", localtime($ts))."' ./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets" ); |
143 | sleep 1; | 148 | is($res->return_code, 0, "OK for first call" ); |
149 | is($res->output, "No previous data to calculate rate - assume okay" ); | ||
144 | 150 | ||
145 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets" ); | 151 | # test rate 1 second later |
146 | is($res->return_code, 0, "OK as no thresholds" ); | 152 | $res = NPTest->testCmd("LC_TIME=C TZ=UTC faketime -f '".strftime("%Y-%m-%d %H:%M:%S", localtime($ts+1))."' ./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets" ); |
147 | is($res->output, "SNMP RATE OK - inoctets 666 | inoctets=666 ", "Check label"); | 153 | is($res->return_code, 0, "OK as no thresholds" ); |
154 | is($res->output, "SNMP RATE OK - inoctets 666 | inoctets=666 ", "Check label"); | ||
148 | 155 | ||
149 | sleep 2; | 156 | # test rate 3 seconds later |
157 | $res = NPTest->testCmd("LC_TIME=C TZ=UTC faketime -f '".strftime("%Y-%m-%d %H:%M:%S", localtime($ts+3))."' ./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets" ); | ||
158 | is($res->return_code, 0, "OK as no thresholds" ); | ||
159 | is($res->output, "SNMP RATE OK - inoctets 333 | inoctets=333 ", "Check rate decreases due to longer interval"); | ||
150 | 160 | ||
151 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets" ); | ||
152 | is($res->return_code, 0, "OK as no thresholds" ); | ||
153 | is($res->output, "SNMP RATE OK - inoctets 333 | inoctets=333 ", "Check rate decreases due to longer interval"); | ||
154 | 161 | ||
162 | # label performance data check | ||
163 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l test" ); | ||
164 | is($res->return_code, 0, "OK as no thresholds" ); | ||
165 | is($res->output, "SNMP OK - test 67996 | test=67996c ", "Check label"); | ||
155 | 166 | ||
156 | # label performance data check | 167 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l \"test'test\"" ); |
157 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l test" ); | 168 | is($res->return_code, 0, "OK as no thresholds" ); |
158 | is($res->return_code, 0, "OK as no thresholds" ); | 169 | is($res->output, "SNMP OK - test'test 68662 | \"test'test\"=68662c ", "Check label"); |
159 | is($res->output, "SNMP OK - test 67996 | test=67996c ", "Check label"); | ||
160 | 170 | ||
161 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l \"test'test\"" ); | 171 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l 'test\"test'" ); |
162 | is($res->return_code, 0, "OK as no thresholds" ); | 172 | is($res->return_code, 0, "OK as no thresholds" ); |
163 | is($res->output, "SNMP OK - test'test 68662 | \"test'test\"=68662c ", "Check label"); | 173 | is($res->output, "SNMP OK - test\"test 69328 | 'test\"test'=69328c ", "Check label"); |
164 | 174 | ||
165 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l 'test\"test'" ); | 175 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l test -O" ); |
166 | is($res->return_code, 0, "OK as no thresholds" ); | 176 | is($res->return_code, 0, "OK as no thresholds" ); |
167 | is($res->output, "SNMP OK - test\"test 69328 | 'test\"test'=69328c ", "Check label"); | 177 | is($res->output, "SNMP OK - test 69994 | iso.3.6.1.4.1.8072.3.2.67.10=69994c ", "Check label"); |
168 | 178 | ||
169 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l test -O" ); | 179 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10" ); |
170 | is($res->return_code, 0, "OK as no thresholds" ); | 180 | is($res->return_code, 0, "OK as no thresholds" ); |
171 | is($res->output, "SNMP OK - test 69994 | iso.3.6.1.4.1.8072.3.2.67.10=69994c ", "Check label"); | 181 | is($res->output, "SNMP OK - 70660 | iso.3.6.1.4.1.8072.3.2.67.10=70660c ", "Check label"); |
172 | 182 | ||
173 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10" ); | 183 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l 'test test'" ); |
174 | is($res->return_code, 0, "OK as no thresholds" ); | 184 | is($res->return_code, 0, "OK as no thresholds" ); |
175 | is($res->output, "SNMP OK - 70660 | iso.3.6.1.4.1.8072.3.2.67.10=70660c ", "Check label"); | 185 | is($res->output, "SNMP OK - test test 71326 | 'test test'=71326c ", "Check label"); |
176 | 186 | ||
177 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 -l 'test test'" ); | ||
178 | is($res->return_code, 0, "OK as no thresholds" ); | ||
179 | is($res->output, "SNMP OK - test test 71326 | 'test test'=71326c ", "Check label"); | ||
180 | 187 | ||
188 | $res = NPTest->testCmd("LC_TIME=C TZ=UTC faketime -f '".strftime("%Y-%m-%d %H:%M:%S", localtime($ts))."' ./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets_per_minute --rate-multiplier=60" ); | ||
189 | is($res->return_code, 0, "OK for first call" ); | ||
190 | is($res->output, "No previous data to calculate rate - assume okay" ); | ||
181 | 191 | ||
182 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets_per_minute --rate-multiplier=60" ); | 192 | # test 1 second later |
183 | is($res->return_code, 0, "OK for first call" ); | 193 | $res = NPTest->testCmd("LC_TIME=C TZ=UTC faketime -f '".strftime("%Y-%m-%d %H:%M:%S", localtime($ts+1))."' ./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets_per_minute --rate-multiplier=60" ); |
184 | is($res->output, "No previous data to calculate rate - assume okay" ); | 194 | is($res->return_code, 0, "OK as no thresholds" ); |
185 | 195 | is($res->output, "SNMP RATE OK - inoctets_per_minute 39960 | inoctets_per_minute=39960 ", "Checking multiplier"); | |
186 | # Need to sleep, otherwise duration=0 | 196 | }; |
187 | sleep 1; | ||
188 | 197 | ||
189 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10 --rate -l inoctets_per_minute --rate-multiplier=60" ); | ||
190 | is($res->return_code, 0, "OK as no thresholds" ); | ||
191 | is($res->output, "SNMP RATE OK - inoctets_per_minute 39960 | inoctets_per_minute=39960 ", "Checking multiplier"); | ||
192 | 198 | ||
193 | 199 | ||
194 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.11 -s '\"stringtests\"'" ); | 200 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.11 -s '\"stringtests\"'" ); |
@@ -245,9 +251,20 @@ is($res->output, 'SNMP CRITICAL - *-4* | iso.3.6.1.4.1.8072.3.2.67.17=-4;-2:;-3: | |||
245 | 251 | ||
246 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.18 -c '~:-6.5'" ); | 252 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.18 -c '~:-6.5'" ); |
247 | is($res->return_code, 0, "Negative float OK" ); | 253 | is($res->return_code, 0, "Negative float OK" ); |
248 | is($res->output, 'SNMP OK - -6.6 | iso.3.6.1.4.1.8072.3.2.67.18=-6.6;;~:-6.5 ', "Negative float OK output" ); | 254 | is($res->output, 'SNMP OK - -6.6 | iso.3.6.1.4.1.8072.3.2.67.18=-6.6;;@-6.5:~ ', "Negative float OK output" ); |
249 | 255 | ||
250 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.18 -w '~:-6.65' -c '~:-6.55'" ); | 256 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.18 -w '~:-6.65' -c '~:-6.55'" ); |
251 | is($res->return_code, 1, "Negative float WARNING" ); | 257 | is($res->return_code, 1, "Negative float WARNING" ); |
252 | is($res->output, 'SNMP WARNING - *-6.6* | iso.3.6.1.4.1.8072.3.2.67.18=-6.6;~:-6.65;~:-6.55 ', "Negative float WARNING output" ); | 258 | is($res->output, 'SNMP WARNING - *-6.6* | iso.3.6.1.4.1.8072.3.2.67.18=-6.6;@-6.65:~;@-6.55:~ ', "Negative float WARNING output" ); |
259 | |||
260 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10,.1.3.6.1.4.1.8072.3.2.67.17 -w '1:100000,-10:20' -c '2:200000,-20:30'" ); | ||
261 | is($res->return_code, 0, "Multiple OIDs with thresholds" ); | ||
262 | like($res->output, '/SNMP OK - \d+ -4 | iso.3.6.1.4.1.8072.3.2.67.10=\d+c;1:100000;2:200000 iso.3.6.1.4.1.8072.3.2.67.17=-4;-10:20;-20:30/', "Multiple OIDs with thresholds output" ); | ||
263 | |||
264 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10,.1.3.6.1.4.1.8072.3.2.67.17 -w '1:100000,-1:2' -c '2:200000,-20:30'" ); | ||
265 | is($res->return_code, 1, "Multiple OIDs with thresholds" ); | ||
266 | like($res->output, '/SNMP WARNING - \d+ \*-4\* | iso.3.6.1.4.1.8072.3.2.67.10=\d+c;1:100000;2:200000 iso.3.6.1.4.1.8072.3.2.67.17=-4;-10:20;-20:30/', "Multiple OIDs with thresholds output" ); | ||
253 | 267 | ||
268 | $res = NPTest->testCmd( "./check_snmp -H 127.0.0.1 -C public -p $port_snmp -o .1.3.6.1.4.1.8072.3.2.67.10,.1.3.6.1.4.1.8072.3.2.67.17 -w 1,2 -c 1" ); | ||
269 | is($res->return_code, 2, "Multiple OIDs with some thresholds" ); | ||
270 | like($res->output, '/SNMP CRITICAL - \*\d+\* \*-4\* | iso.3.6.1.4.1.8072.3.2.67.10=\d+c;1;2 iso.3.6.1.4.1.8072.3.2.67.17=-4;;/', "Multiple OIDs with thresholds output" ); | ||
diff --git a/plugins/tests/var/ps-axwo.debian b/plugins/tests/var/ps-axwo.debian new file mode 100644 index 00000000..5889e9a4 --- /dev/null +++ b/plugins/tests/var/ps-axwo.debian | |||
@@ -0,0 +1,219 @@ | |||
1 | STAT UID PID PPID VSZ RSS %CPU ELAPSED COMMAND COMMAND | ||
2 | Ss 0 1 0 167244 7144 0.1 26-03:07:26 systemd /lib/systemd/systemd --system --deserialize 17 | ||
3 | S 0 2 0 0 0 0.0 26-03:07:26 kthreadd [kthreadd] | ||
4 | I< 0 3 2 0 0 0.0 26-03:07:26 rcu_gp [rcu_gp] | ||
5 | I< 0 4 2 0 0 0.0 26-03:07:26 rcu_par_gp [rcu_par_gp] | ||
6 | I< 0 6 2 0 0 0.0 26-03:07:26 kworker/0:0H-ev [kworker/0:0H-events_highpri] | ||
7 | I< 0 9 2 0 0 0.0 26-03:07:26 mm_percpu_wq [mm_percpu_wq] | ||
8 | S 0 10 2 0 0 0.0 26-03:07:26 rcu_tasks_rude_ [rcu_tasks_rude_] | ||
9 | S 0 11 2 0 0 0.0 26-03:07:26 rcu_tasks_trace [rcu_tasks_trace] | ||
10 | S 0 12 2 0 0 0.0 26-03:07:26 ksoftirqd/0 [ksoftirqd/0] | ||
11 | I 0 13 2 0 0 0.0 26-03:07:26 rcu_sched [rcu_sched] | ||
12 | S 0 14 2 0 0 0.0 26-03:07:26 migration/0 [migration/0] | ||
13 | S 0 15 2 0 0 0.0 26-03:07:26 cpuhp/0 [cpuhp/0] | ||
14 | S 0 16 2 0 0 0.0 26-03:07:26 cpuhp/1 [cpuhp/1] | ||
15 | S 0 17 2 0 0 0.0 26-03:07:26 migration/1 [migration/1] | ||
16 | S 0 18 2 0 0 0.0 26-03:07:26 ksoftirqd/1 [ksoftirqd/1] | ||
17 | I< 0 20 2 0 0 0.0 26-03:07:26 kworker/1:0H-ev [kworker/1:0H-events_highpri] | ||
18 | S 0 21 2 0 0 0.0 26-03:07:26 cpuhp/2 [cpuhp/2] | ||
19 | S 0 22 2 0 0 0.0 26-03:07:26 migration/2 [migration/2] | ||
20 | S 0 23 2 0 0 0.0 26-03:07:26 ksoftirqd/2 [ksoftirqd/2] | ||
21 | I< 0 25 2 0 0 0.0 26-03:07:26 kworker/2:0H-ev [kworker/2:0H-events_highpri] | ||
22 | S 0 26 2 0 0 0.0 26-03:07:26 cpuhp/3 [cpuhp/3] | ||
23 | S 0 27 2 0 0 0.0 26-03:07:26 migration/3 [migration/3] | ||
24 | S 0 28 2 0 0 0.0 26-03:07:26 ksoftirqd/3 [ksoftirqd/3] | ||
25 | I< 0 30 2 0 0 0.0 26-03:07:26 kworker/3:0H-ev [kworker/3:0H-events_highpri] | ||
26 | S 0 35 2 0 0 0.0 26-03:07:26 kdevtmpfs [kdevtmpfs] | ||
27 | I< 0 36 2 0 0 0.0 26-03:07:26 netns [netns] | ||
28 | S 0 37 2 0 0 0.0 26-03:07:26 kauditd [kauditd] | ||
29 | S 0 38 2 0 0 0.0 26-03:07:26 khungtaskd [khungtaskd] | ||
30 | S 0 39 2 0 0 0.0 26-03:07:26 oom_reaper [oom_reaper] | ||
31 | I< 0 40 2 0 0 0.0 26-03:07:26 writeback [writeback] | ||
32 | S 0 41 2 0 0 0.0 26-03:07:26 kcompactd0 [kcompactd0] | ||
33 | SN 0 42 2 0 0 0.0 26-03:07:26 ksmd [ksmd] | ||
34 | SN 0 43 2 0 0 0.0 26-03:07:26 khugepaged [khugepaged] | ||
35 | I< 0 62 2 0 0 0.0 26-03:07:26 kintegrityd [kintegrityd] | ||
36 | I< 0 63 2 0 0 0.0 26-03:07:26 kblockd [kblockd] | ||
37 | I< 0 64 2 0 0 0.0 26-03:07:26 blkcg_punt_bio [blkcg_punt_bio] | ||
38 | I< 0 65 2 0 0 0.0 26-03:07:26 edac-poller [edac-poller] | ||
39 | I< 0 66 2 0 0 0.0 26-03:07:26 devfreq_wq [devfreq_wq] | ||
40 | I< 0 67 2 0 0 0.0 26-03:07:26 kworker/2:1H-ev [kworker/2:1H-events_highpri] | ||
41 | S 0 70 2 0 0 0.3 26-03:07:25 kswapd0 [kswapd0] | ||
42 | I< 0 71 2 0 0 0.0 26-03:07:25 kthrotld [kthrotld] | ||
43 | I< 0 72 2 0 0 0.0 26-03:07:25 acpi_thermal_pm [acpi_thermal_pm] | ||
44 | I< 0 74 2 0 0 0.0 26-03:07:25 ipv6_addrconf [ipv6_addrconf] | ||
45 | I< 0 80 2 0 0 0.0 26-03:07:25 kworker/3:1H-ev [kworker/3:1H-events_highpri] | ||
46 | I< 0 84 2 0 0 0.0 26-03:07:25 kstrp [kstrp] | ||
47 | I< 0 87 2 0 0 0.0 26-03:07:25 zswap-shrink [zswap-shrink] | ||
48 | I< 0 110 2 0 0 0.0 26-03:07:25 kworker/0:1H-ev [kworker/0:1H-events_highpri] | ||
49 | I< 0 141 2 0 0 0.0 26-03:07:25 ata_sff [ata_sff] | ||
50 | S 0 143 2 0 0 0.0 26-03:07:25 scsi_eh_0 [scsi_eh_0] | ||
51 | I< 0 144 2 0 0 0.0 26-03:07:25 scsi_tmf_0 [scsi_tmf_0] | ||
52 | S 0 145 2 0 0 0.0 26-03:07:25 scsi_eh_1 [scsi_eh_1] | ||
53 | I< 0 146 2 0 0 0.0 26-03:07:25 scsi_tmf_1 [scsi_tmf_1] | ||
54 | S 0 147 2 0 0 0.0 26-03:07:25 scsi_eh_2 [scsi_eh_2] | ||
55 | I< 0 148 2 0 0 0.0 26-03:07:25 scsi_tmf_2 [scsi_tmf_2] | ||
56 | S 0 149 2 0 0 0.0 26-03:07:25 scsi_eh_3 [scsi_eh_3] | ||
57 | I< 0 150 2 0 0 0.0 26-03:07:25 scsi_tmf_3 [scsi_tmf_3] | ||
58 | S 0 151 2 0 0 0.0 26-03:07:25 scsi_eh_4 [scsi_eh_4] | ||
59 | I< 0 152 2 0 0 0.0 26-03:07:25 scsi_tmf_4 [scsi_tmf_4] | ||
60 | S 0 153 2 0 0 0.0 26-03:07:25 scsi_eh_5 [scsi_eh_5] | ||
61 | I< 0 154 2 0 0 0.0 26-03:07:25 scsi_tmf_5 [scsi_tmf_5] | ||
62 | S 0 158 2 0 0 0.0 26-03:07:25 card0-crtc0 [card0-crtc0] | ||
63 | S 0 159 2 0 0 0.0 26-03:07:25 card0-crtc1 [card0-crtc1] | ||
64 | S 0 160 2 0 0 0.0 26-03:07:25 card0-crtc2 [card0-crtc2] | ||
65 | I< 0 162 2 0 0 0.0 26-03:07:25 kworker/1:1H-ev [kworker/1:1H-events_highpri] | ||
66 | S 0 163 2 0 0 0.0 26-03:07:25 scsi_eh_6 [scsi_eh_6] | ||
67 | I< 0 164 2 0 0 0.0 26-03:07:25 scsi_tmf_6 [scsi_tmf_6] | ||
68 | S 0 165 2 0 0 0.0 26-03:07:25 usb-storage [usb-storage] | ||
69 | I< 0 167 2 0 0 0.0 26-03:07:25 uas [uas] | ||
70 | I< 0 176 2 0 0 0.0 26-03:07:25 kdmflush [kdmflush] | ||
71 | I< 0 177 2 0 0 0.0 26-03:07:25 kdmflush [kdmflush] | ||
72 | S 0 202 2 0 0 0.0 26-03:07:24 scsi_eh_7 [scsi_eh_7] | ||
73 | I< 0 203 2 0 0 0.0 26-03:07:24 scsi_tmf_7 [scsi_tmf_7] | ||
74 | S 0 204 2 0 0 0.0 26-03:07:24 usb-storage [usb-storage] | ||
75 | I< 0 232 2 0 0 0.0 26-03:07:23 btrfs-worker [btrfs-worker] | ||
76 | I< 0 233 2 0 0 0.0 26-03:07:23 btrfs-worker-hi [btrfs-worker-hi] | ||
77 | I< 0 234 2 0 0 0.0 26-03:07:23 btrfs-delalloc [btrfs-delalloc] | ||
78 | I< 0 235 2 0 0 0.0 26-03:07:23 btrfs-flush_del [btrfs-flush_del] | ||
79 | I< 0 236 2 0 0 0.0 26-03:07:23 btrfs-cache [btrfs-cache] | ||
80 | I< 0 237 2 0 0 0.0 26-03:07:23 btrfs-fixup [btrfs-fixup] | ||
81 | I< 0 238 2 0 0 0.0 26-03:07:23 btrfs-endio [btrfs-endio] | ||
82 | I< 0 239 2 0 0 0.0 26-03:07:23 btrfs-endio-met [btrfs-endio-met] | ||
83 | I< 0 240 2 0 0 0.0 26-03:07:23 btrfs-endio-met [btrfs-endio-met] | ||
84 | I< 0 241 2 0 0 0.0 26-03:07:23 btrfs-endio-rai [btrfs-endio-rai] | ||
85 | I< 0 242 2 0 0 0.0 26-03:07:23 btrfs-rmw [btrfs-rmw] | ||
86 | I< 0 243 2 0 0 0.0 26-03:07:23 btrfs-endio-wri [btrfs-endio-wri] | ||
87 | I< 0 244 2 0 0 0.0 26-03:07:23 btrfs-freespace [btrfs-freespace] | ||
88 | I< 0 245 2 0 0 0.0 26-03:07:23 btrfs-delayed-m [btrfs-delayed-m] | ||
89 | I< 0 246 2 0 0 0.0 26-03:07:23 btrfs-readahead [btrfs-readahead] | ||
90 | I< 0 247 2 0 0 0.0 26-03:07:23 btrfs-qgroup-re [btrfs-qgroup-re] | ||
91 | S 0 248 2 0 0 0.0 26-03:07:23 btrfs-cleaner [btrfs-cleaner] | ||
92 | S 0 249 2 0 0 0.2 26-03:07:23 btrfs-transacti [btrfs-transacti] | ||
93 | I< 0 317 2 0 0 0.0 26-03:07:22 rpciod [rpciod] | ||
94 | I< 0 322 2 0 0 0.0 26-03:07:22 xprtiod [xprtiod] | ||
95 | S 0 381 2 0 0 0.0 26-03:07:22 irq/133-mei_me [irq/133-mei_me] | ||
96 | S 0 422 2 0 0 0.0 26-03:07:22 watchdogd [watchdogd] | ||
97 | I< 0 523 2 0 0 0.0 26-03:07:22 led_workqueue [led_workqueue] | ||
98 | I< 0 583 2 0 0 0.0 26-03:07:22 cryptd [cryptd] | ||
99 | I< 0 590 2 0 0 0.0 26-03:07:22 ext4-rsv-conver [ext4-rsv-conver] | ||
100 | Ss 104 693 1 12324 4292 0.5 26-03:07:21 dbus-daemon /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only | ||
101 | Ss 0 731 1 575120 1368 0.0 26-03:07:21 systemd-logind /lib/systemd/systemd-logind | ||
102 | Ssl 0 1111 1 121248 732 0.0 26-03:07:18 unattended-upgr /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signal | ||
103 | S 0 1141 2 0 0 0.0 26-03:07:18 lockd [lockd] | ||
104 | I< 0 1459 2 0 0 0.0 26-03:07:16 nfsiod [nfsiod] | ||
105 | S 0 1621 2 0 0 0.0 26-03:07:15 NFSv4 callback [NFSv4 callback] | ||
106 | Ssl 0 1771 1 1548340 676 0.0 26-03:07:13 libvirtd /usr/sbin/libvirtd | ||
107 | I< 0 24315 2 0 0 0.0 26-02:49:02 cifsiod [cifsiod] | ||
108 | I< 0 24316 2 0 0 0.0 26-02:49:02 smb3decryptd [smb3decryptd] | ||
109 | I< 0 24317 2 0 0 0.0 26-02:49:02 cifsfileinfoput [cifsfileinfoput] | ||
110 | I< 0 24318 2 0 0 0.0 26-02:49:02 cifsoplockd [cifsoplockd] | ||
111 | I< 0 24319 2 0 0 0.0 26-02:49:02 cifs-dfscache [cifs-dfscache] | ||
112 | S 0 24322 2 0 0 0.0 26-02:49:02 cifsd [cifsd] | ||
113 | I< 0 24413 2 0 0 0.0 26-02:48:57 btrfs-worker [btrfs-worker] | ||
114 | I< 0 24414 2 0 0 0.0 26-02:48:57 btrfs-worker-hi [btrfs-worker-hi] | ||
115 | I< 0 24415 2 0 0 0.0 26-02:48:57 btrfs-delalloc [btrfs-delalloc] | ||
116 | I< 0 24416 2 0 0 0.0 26-02:48:57 btrfs-flush_del [btrfs-flush_del] | ||
117 | I< 0 24418 2 0 0 0.0 26-02:48:57 btrfs-cache [btrfs-cache] | ||
118 | I< 0 24419 2 0 0 0.0 26-02:48:57 btrfs-fixup [btrfs-fixup] | ||
119 | I< 0 24420 2 0 0 0.0 26-02:48:57 btrfs-endio [btrfs-endio] | ||
120 | I< 0 24421 2 0 0 0.0 26-02:48:57 btrfs-endio-met [btrfs-endio-met] | ||
121 | I< 0 24422 2 0 0 0.0 26-02:48:57 btrfs-endio-met [btrfs-endio-met] | ||
122 | I< 0 24423 2 0 0 0.0 26-02:48:57 btrfs-endio-rai [btrfs-endio-rai] | ||
123 | I< 0 24424 2 0 0 0.0 26-02:48:57 btrfs-rmw [btrfs-rmw] | ||
124 | I< 0 24425 2 0 0 0.0 26-02:48:57 btrfs-endio-wri [btrfs-endio-wri] | ||
125 | I< 0 24426 2 0 0 0.0 26-02:48:57 btrfs-freespace [btrfs-freespace] | ||
126 | I< 0 24427 2 0 0 0.0 26-02:48:57 btrfs-delayed-m [btrfs-delayed-m] | ||
127 | I< 0 24428 2 0 0 0.0 26-02:48:57 btrfs-readahead [btrfs-readahead] | ||
128 | I< 0 24429 2 0 0 0.0 26-02:48:57 btrfs-qgroup-re [btrfs-qgroup-re] | ||
129 | S 0 24450 2 0 0 0.0 26-02:48:53 btrfs-cleaner [btrfs-cleaner] | ||
130 | S 0 24451 2 0 0 0.0 26-02:48:53 btrfs-transacti [btrfs-transacti] | ||
131 | I< 0 747708 2 0 0 0.0 16-21:06:20 xfsalloc [xfsalloc] | ||
132 | I< 0 747709 2 0 0 0.0 16-21:06:20 xfs_mru_cache [xfs_mru_cache] | ||
133 | S 0 747713 2 0 0 0.0 16-21:06:20 jfsIO [jfsIO] | ||
134 | S 0 747714 2 0 0 0.0 16-21:06:20 jfsCommit [jfsCommit] | ||
135 | S 0 747715 2 0 0 0.0 16-21:06:20 jfsCommit [jfsCommit] | ||
136 | S 0 747716 2 0 0 0.0 16-21:06:20 jfsCommit [jfsCommit] | ||
137 | S 0 747717 2 0 0 0.0 16-21:06:20 jfsCommit [jfsCommit] | ||
138 | S 0 747718 2 0 0 0.0 16-21:06:20 jfsSync [jfsSync] | ||
139 | Ss 0 1071687 1 105976 28304 0.0 3-03:12:31 systemd-journal /lib/systemd/systemd-journald | ||
140 | Ss 0 1934146 1 25672 4704 0.0 11:19:31 cupsd /usr/sbin/cupsd -l | ||
141 | Ssl 0 1934148 1 182868 8540 0.0 11:19:31 cups-browsed /usr/sbin/cups-browsed | ||
142 | S 13 1934155 3392655 5752 88 0.0 11:19:31 pinger (pinger) | ||
143 | S< 33 1934166 3393034 57996 5460 0.0 11:19:31 apache2 /usr/sbin/apache2 -k start | ||
144 | S< 33 1934167 3393034 216944 13892 0.0 11:19:30 apache2 /usr/sbin/apache2 -k start | ||
145 | S< 33 1934168 3393034 216944 13756 0.0 11:19:30 apache2 /usr/sbin/apache2 -k start | ||
146 | S< 33 1934169 3393034 216936 13732 0.0 11:19:30 apache2 /usr/sbin/apache2 -k start | ||
147 | S< 33 1934170 3393034 216944 13888 0.0 11:19:30 apache2 /usr/sbin/apache2 -k start | ||
148 | S< 33 1934172 3393034 216944 15388 0.0 11:19:30 apache2 /usr/sbin/apache2 -k start | ||
149 | S< 33 1934701 3393034 216936 13736 0.0 11:19:29 apache2 /usr/sbin/apache2 -k start | ||
150 | S< 33 1935056 3393034 216920 13724 0.0 11:19:28 apache2 /usr/sbin/apache2 -k start | ||
151 | S 7 1936834 1934146 16652 832 0.0 11:18:12 dbus /usr/lib/cups/notifier/dbus dbus:// | ||
152 | S< 33 1955909 3393034 216928 13792 0.0 11:00:25 apache2 /usr/sbin/apache2 -k start | ||
153 | I< 0 2531464 2 0 0 0.0 06:35:47 kworker/u9:0-i9 [kworker/u9:0-i915_flip] | ||
154 | I 0 2570506 2 0 0 0.0 06:27:41 kworker/1:0-cgr [kworker/1:0-cgroup_destroy] | ||
155 | I 0 2596195 2 0 0 0.0 06:21:52 kworker/1:1-eve [kworker/1:1-events] | ||
156 | I 0 2785341 2 0 0 0.0 03:34:16 kworker/u8:8-bt [kworker/u8:8-btrfs-endio-write] | ||
157 | I 0 2785520 2 0 0 0.0 03:33:50 kworker/3:0-eve [kworker/3:0-events] | ||
158 | I 0 2798669 2 0 0 0.0 03:21:09 kworker/u8:5-bt [kworker/u8:5-btrfs-endio-write] | ||
159 | Ss 0 2803015 1 5616 3108 0.0 03:17:54 cron /usr/sbin/cron -f | ||
160 | I 0 2845483 2 0 0 0.0 02:38:11 kworker/0:3-eve [kworker/0:3-events] | ||
161 | I 0 2939490 2 0 0 0.1 01:10:32 kworker/0:0-eve [kworker/0:0-events] | ||
162 | I 0 2939754 2 0 0 0.0 01:10:26 kworker/u8:1-i9 [kworker/u8:1-i915] | ||
163 | I 0 2942040 2 0 0 0.0 01:08:02 kworker/u8:7-bt [kworker/u8:7-btrfs-endio-meta] | ||
164 | S 117 2954268 3392551 40044 5772 0.0 56:37 pickup pickup -l -t unix -u -c | ||
165 | I 0 2965195 2 0 0 0.0 46:00 kworker/u8:0-bt [kworker/u8:0-btrfs-worker] | ||
166 | I 0 2977972 2 0 0 0.0 33:54 kworker/u8:2-bt [kworker/u8:2-btrfs-endio-write] | ||
167 | I 0 2985488 2 0 0 0.0 27:02 kworker/u8:3-bl [kworker/u8:3-blkcg_punt_bio] | ||
168 | I 0 2987519 2 0 0 1.0 25:15 kworker/2:1-eve [kworker/2:1-events] | ||
169 | I 0 2987601 2 0 0 0.0 25:03 kworker/u8:9-i9 [kworker/u8:9-i915] | ||
170 | I< 0 2995218 2 0 0 0.0 18:41 kworker/u9:2-xp [kworker/u9:2-xprtiod] | ||
171 | I 0 2997170 2 0 0 0.0 16:41 kworker/3:1-rcu [kworker/3:1-rcu_gp] | ||
172 | I 0 3001264 2 0 0 0.0 13:01 kworker/u8:4-bt [kworker/u8:4-btrfs-endio-write] | ||
173 | I 0 3004697 2 0 0 0.7 09:41 kworker/2:0-eve [kworker/2:0-events] | ||
174 | I 0 3010619 2 0 0 1.0 04:29 kworker/2:2-eve [kworker/2:2-events] | ||
175 | I 0 3014612 2 0 0 0.0 00:41 kworker/3:2-eve [kworker/3:2-events] | ||
176 | S 0 3015082 2803015 6716 3028 0.0 00:30 cron /usr/sbin/CRON -f | ||
177 | I 0 3015382 2 0 0 0.0 00:00 kworker/u8:6-bt [kworker/u8:6-btrfs-endio-meta] | ||
178 | Ss 1 3392068 1 5592 504 0.0 15-02:34:39 atd /usr/sbin/atd -f | ||
179 | Ssl 0 3392072 1 235796 1740 0.0 15-02:34:39 accounts-daemon /usr/libexec/accounts-daemon | ||
180 | Ssl 106 3392076 1 315708 6128 0.0 15-02:34:39 colord /usr/libexec/colord | ||
181 | Ss 0 3392083 1 8120 720 0.0 15-02:34:39 haveged /usr/sbin/haveged --Foreground --verbose=1 | ||
182 | Ss 0 3392090 1 5168 132 0.0 15-02:34:39 blkmapd /usr/sbin/blkmapd | ||
183 | SNsl 111 3392094 1 155648 440 0.0 15-02:34:39 rtkit-daemon /usr/libexec/rtkit-daemon | ||
184 | Ssl 0 3392097 1 290168 1352 0.0 15-02:34:39 packagekitd /usr/libexec/packagekitd | ||
185 | Ss 128 3392100 1 7960 448 0.0 15-02:34:39 rpcbind /sbin/rpcbind -f -w | ||
186 | Ss 0 3392114 1 13432 616 0.0 15-02:34:39 systemd-machine /lib/systemd/systemd-machined | ||
187 | Ss 0 3392118 1 13316 848 0.0 15-02:34:39 sshd sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups | ||
188 | Ssl 0 3392124 1 244072 2456 0.0 15-02:34:39 upowerd /usr/libexec/upowerd | ||
189 | Ssl 0 3392138 1 1634748 10684 0.0 15-02:34:39 containerd /usr/bin/containerd | ||
190 | Ssl 0 3392139 1 222768 1784 0.0 15-02:34:39 rsyslogd /usr/sbin/rsyslogd -n -iNONE | ||
191 | Ss 13 3392140 1 3344 152 0.0 15-02:34:39 polipo /usr/bin/polipo -c /etc/polipo/config pidFile=/var/run/polipo/polipo.pid daemonise=true | ||
192 | Ssl 119 3392156 1 76472 1688 0.0 15-02:34:39 ntpd /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 119:126 | ||
193 | Ss 120 3392168 1 4656 276 0.0 15-02:34:39 rpc.statd /sbin/rpc.statd --no-notify | ||
194 | Ss 0 3392171 1 5072 432 0.0 15-02:34:39 rpc.mountd /usr/sbin/rpc.mountd --manage-gids | ||
195 | Ss 0 3392176 1 5008 288 0.0 15-02:34:39 rpc.idmapd /usr/sbin/rpc.idmapd | ||
196 | Ss 105 3392184 1 15544 6816 3.5 15-02:34:39 avahi-daemon avahi-daemon: running [tsui.local] | ||
197 | Ss 0 3392186 1 25288 3860 0.0 15-02:34:39 systemd-udevd /lib/systemd/systemd-udevd | ||
198 | S 105 3392190 3392184 8788 52 0.0 15-02:34:39 avahi-daemon avahi-daemon: chroot helper | ||
199 | Ssl 0 3392197 1 396120 4188 0.0 15-02:34:39 udisksd /usr/libexec/udisks2/udisksd | ||
200 | Ssl 0 3392214 1 237504 6632 0.0 15-02:34:39 polkitd /usr/libexec/polkitd --no-debug | ||
201 | Ss 0 3392284 1 9684 560 0.0 15-02:34:38 xinetd /usr/sbin/xinetd -pidfile /run/xinetd.pid -stayalive -inetd_compat -inetd_ipv6 | ||
202 | Ssl 0 3392285 1 314840 1352 0.0 15-02:34:38 ModemManager /usr/sbin/ModemManager | ||
203 | Ss 0 3392317 1 2352 140 0.0 15-02:34:38 acpid /usr/sbin/acpid | ||
204 | S 0 3392400 2 0 0 0.0 15-02:34:38 nfsd [nfsd] | ||
205 | S 0 3392401 2 0 0 0.0 15-02:34:38 nfsd [nfsd] | ||
206 | S 0 3392402 2 0 0 0.0 15-02:34:38 nfsd [nfsd] | ||
207 | S 0 3392403 2 0 0 0.0 15-02:34:38 nfsd [nfsd] | ||
208 | S 0 3392404 2 0 0 0.0 15-02:34:38 nfsd [nfsd] | ||
209 | S 0 3392405 2 0 0 0.0 15-02:34:38 nfsd [nfsd] | ||
210 | S 0 3392407 2 0 0 0.0 15-02:34:38 nfsd [nfsd] | ||
211 | S 0 3392410 2 0 0 0.0 15-02:34:38 nfsd [nfsd] | ||
212 | Ss 0 3392551 1 40092 1304 0.0 15-02:34:37 master /usr/lib/postfix/sbin/master -w | ||
213 | S 117 3392553 3392551 40156 568 0.0 15-02:34:37 qmgr qmgr -l -t unix -u | ||
214 | Ss 0 3392650 1 63652 4 0.0 15-02:34:36 squid /usr/sbin/squid --foreground -sYC | ||
215 | Ssl 116 3392652 1 1675196 93848 0.0 15-02:34:36 mariadbd /usr/sbin/mariadbd | ||
216 | S 13 3392655 3392650 81776 21232 0.0 15-02:34:36 squid (squid-1) --kid squid-1 --foreground -sYC | ||
217 | S 13 3392657 3392655 5572 68 0.0 15-02:34:36 log_file_daemon (logfile-daemon) /var/log/squid/access.log | ||
218 | S<s 0 3393034 1 216648 7560 0.0 15-02:34:34 apache2 /usr/sbin/apache2 -k start | ||
219 | Ss 33 3393037 1 3432 180 0.0 15-02:34:34 htcacheclean /usr/bin/htcacheclean -d 120 -p /var/cache/apache2/mod_cache_disk -l 300M -n | ||
diff --git a/plugins/tests/var/ps_axwo.debian b/plugins/tests/var/ps_axwo.debian deleted file mode 100644 index 37a2d35e..00000000 --- a/plugins/tests/var/ps_axwo.debian +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | STAT UID PID PPID VSZ RSS %CPU COMMAND COMMAND | ||
2 | S 0 1 0 1504 428 0.0 init init [2] | ||
3 | SN 0 2 1 0 0 0.0 ksoftirqd/0 [ksoftirqd/0] | ||
4 | S< 0 3 1 0 0 0.0 events/0 [events/0] | ||
5 | S< 0 4 3 0 0 0.0 khelper [khelper] | ||
6 | S< 0 5 3 0 0 0.0 kacpid [kacpid] | ||
7 | S< 0 38 3 0 0 0.0 kblockd/0 [kblockd/0] | ||
8 | S 0 48 3 0 0 0.0 pdflush [pdflush] | ||
9 | S< 0 51 3 0 0 0.0 aio/0 [aio/0] | ||
10 | S 0 50 1 0 0 0.0 kswapd0 [kswapd0] | ||
11 | S 0 193 1 0 0 0.0 kseriod [kseriod] | ||
12 | S 0 214 1 0 0 0.0 scsi_eh_0 [scsi_eh_0] | ||
13 | S 0 221 1 0 0 0.0 khubd [khubd] | ||
14 | S 0 299 1 0 0 0.3 kjournald [kjournald] | ||
15 | S 0 1148 1 0 0 0.0 pciehpd_event [pciehpd_event] | ||
16 | S 0 1168 1 0 0 0.0 shpchpd_event [shpchpd_event] | ||
17 | Ss 1 1795 1 1612 276 0.0 portmap /sbin/portmap | ||
18 | Ss 0 2200 1 1652 568 0.0 vmware-guestd /usr/sbin/vmware-guestd --background /var/run/vmware-guestd.pid | ||
19 | Ss 0 2209 1 2240 532 0.0 inetd /usr/sbin/inetd | ||
20 | Ss 0 2319 1 3468 792 0.0 sshd /usr/sbin/sshd | ||
21 | Ss 0 2323 1 2468 676 0.0 rpc.statd /sbin/rpc.statd | ||
22 | Ss 1 2332 1 1684 488 0.0 atd /usr/sbin/atd | ||
23 | Ss 0 2335 1 1764 636 0.0 cron /usr/sbin/cron | ||
24 | Ss+ 0 2350 1 1500 348 0.0 getty /sbin/getty 38400 tty1 | ||
25 | Ss+ 0 2351 1 1500 348 0.0 getty /sbin/getty 38400 tty2 | ||
26 | Ss+ 0 2352 1 1500 348 0.0 getty /sbin/getty 38400 tty3 | ||
27 | Ss+ 0 2353 1 1500 348 0.0 getty /sbin/getty 38400 tty4 | ||
28 | Ss+ 0 2354 1 1500 348 0.0 getty /sbin/getty 38400 tty5 | ||
29 | Ss+ 0 2355 1 1500 348 0.0 getty /sbin/getty 38400 tty6 | ||
30 | S 0 6907 1 2308 892 0.0 mysqld_safe /bin/sh /usr/bin/mysqld_safe | ||
31 | S 103 6944 6907 123220 27724 0.0 mysqld /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock | ||
32 | S 0 6945 6907 1488 420 0.0 logger logger -p daemon.err -t mysqld_safe -i -t mysqld | ||
33 | S 1001 17778 1 6436 1588 0.0 snmpd /usr/sbin/snmpd -u nagios -Lsd -Lf /dev/null -p/var/run/snmpd.pid | ||
34 | Ss 0 17789 1 9496 5556 0.0 snmptrapd /usr/sbin/snmptrapd -t -m ALL -M /usr/share/snmp/mibs:/usr/local/monitoring/snmp/load -p /var/run/snmptrapd.pid | ||
35 | Ss 0 847 2319 14452 1752 0.0 sshd sshd: tonvoon [priv] | ||
36 | S 1000 857 847 14616 1832 0.0 sshd sshd: tonvoon@pts/3 | ||
37 | Ss 1000 860 857 2984 1620 0.0 bash -bash | ||
38 | S 0 868 860 2588 1428 0.0 bash -su | ||
39 | S+ 1001 877 868 2652 1568 0.0 bash -su | ||
40 | S 0 6086 3 0 0 0.0 pdflush [pdflush] | ||
41 | Ss 0 17832 2319 14452 1752 0.0 sshd sshd: tonvoon [priv] | ||
42 | S 1000 18155 17832 14620 1840 0.0 sshd sshd: tonvoon@pts/0 | ||
43 | Ss 1000 18156 18155 2984 1620 0.0 bash -bash | ||
44 | S 0 18518 18156 2588 1428 0.0 bash -su | ||
45 | S 1001 18955 18518 2672 1600 0.0 bash -su | ||
46 | Ss 0 21683 2319 14452 1756 0.0 sshd sshd: tonvoon [priv] | ||
47 | S 1000 21742 21683 14620 1896 0.0 sshd sshd: tonvoon@pts/1 | ||
48 | Ss 1000 21743 21742 2984 1620 0.0 bash -bash | ||
49 | S 0 21748 21743 2592 1432 0.0 bash -su | ||
50 | S 1001 21757 21748 2620 1540 0.0 bash -su | ||
51 | Ss 0 2334 2319 14452 1756 0.0 sshd sshd: tonvoon [priv] | ||
52 | S 1000 2343 2334 14620 1840 0.0 sshd sshd: tonvoon@pts/2 | ||
53 | Ss 1000 2344 2343 2984 1620 0.0 bash -bash | ||
54 | S 0 2349 2344 2592 1432 0.0 bash -su | ||
55 | S+ 1001 2364 2349 2620 1520 0.0 bash -su | ||
56 | T 1001 2454 2364 2096 1032 0.0 vi vi configure.in.rej | ||
57 | S+ 1001 8500 21757 69604 52576 0.0 opsview_web_ser /usr/bin/perl -w ./script/opsview_web_server.pl -f -d | ||
58 | Ss 0 7609 2319 14452 1756 0.0 sshd sshd: tonvoon [priv] | ||
59 | S 1000 7617 7609 14460 1828 0.0 sshd sshd: tonvoon@pts/4 | ||
60 | Ss 1000 7618 7617 2984 1620 0.0 bash -bash | ||
61 | S 0 7623 7618 2592 1432 0.0 bash -su | ||
62 | S+ 1001 7632 7623 2620 1528 0.0 bash -su | ||
63 | Ss 1001 12678 1 20784 17728 0.0 opsviewd opsviewd | ||
64 | Ss 0 832 1 14512 6360 0.0 apache2 /usr/sbin/apache2 -k start -DSSL | ||
65 | S 33 842 832 14648 6596 0.0 apache2 /usr/sbin/apache2 -k start -DSSL | ||
66 | S 33 843 832 14512 6504 0.0 apache2 /usr/sbin/apache2 -k start -DSSL | ||
67 | S 33 844 832 14512 6476 0.0 apache2 /usr/sbin/apache2 -k start -DSSL | ||
68 | S 33 845 832 14512 6476 0.0 apache2 /usr/sbin/apache2 -k start -DSSL | ||
69 | S 33 846 832 14512 6476 0.0 apache2 /usr/sbin/apache2 -k start -DSSL | ||
70 | Ss 7 4081 1 2464 884 0.0 lpd /usr/sbin/lpd -s | ||
71 | S 33 26484 832 14512 6476 0.0 apache2 /usr/sbin/apache2 -k start -DSSL | ||
72 | Ss 1001 22324 1 20252 1612 0.1 nagios ../../bin/nagios -d /usr/local/nagios/etc/nagios.cfg | ||
73 | Ss 0 23336 2319 14452 1756 0.0 sshd sshd: tonvoon [priv] | ||
74 | S 1000 23339 23336 14620 1840 0.0 sshd sshd: tonvoon@pts/5 | ||
75 | Ss 1000 23340 23339 2996 1636 0.0 bash -bash | ||
76 | S 0 23367 23340 3020 1628 0.0 bash bash | ||
77 | S 1001 23370 23367 3064 1748 0.0 bash bash | ||
78 | Ss 1001 23783 1 3220 764 0.0 ndo2db /usr/local/nagios/bin/ndo2db -c /usr/local/nagios/etc/ndo2db.cfg | ||
79 | Ss 1001 23784 1 6428 4948 0.0 import_ndologsd import_ndologsd | ||
80 | S+ 1001 9803 18955 4132 1936 0.0 ssh ssh altinity@cube02.lei.altinity | ||
81 | S 1001 22505 22324 20256 1616 0.0 nagios ../../bin/nagios -d /usr/local/nagios/etc/nagios.cfg | ||
82 | S 1001 22506 22505 1676 608 0.0 check_ping /usr/local/libexec/check_ping -H 192.168.10.23 -w 3000.0,80% -c 5000.0,100% -p 1 | ||
83 | S 1001 22507 22506 1660 492 0.0 ping /bin/ping -n -U -w 10 -c 1 192.168.10.23 | ||
84 | R+ 1001 22508 23370 2308 680 0.0 ps ps axwo stat uid pid ppid vsz rss pcpu comm args | ||