mirror of
https://github.com/drewkerrigan/nagios-http-json.git
synced 2025-07-14 18:13:31 +02:00
Compare commits
No commits in common. "master" and "v2.3.0" have entirely different histories.
9
.github/workflows/unittest.yml
vendored
9
.github/workflows/unittest.yml
vendored
@ -1,11 +1,6 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, master]
|
||||
tags:
|
||||
- v*
|
||||
pull_request:
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
gitHubActionForPytest:
|
||||
@ -16,7 +11,7 @@ jobs:
|
||||
name: GitHub Action
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install -r requirements-dev.txt
|
||||
|
@ -8,7 +8,7 @@ This is a generic plugin for Nagios which checks json values from a given HTTP e
|
||||
|
||||
Requirements:
|
||||
|
||||
* Python 3.8+
|
||||
* Python 3.6+
|
||||
|
||||
### Nagios
|
||||
|
||||
|
@ -551,21 +551,19 @@ def parseArgs(args):
|
||||
parser.add_argument('-e', '--key_exists', dest='key_list', nargs='*',
|
||||
help='''Checks existence of these keys to determine
|
||||
status. Return warning if key is not present.''')
|
||||
parser.add_argument('-E', '--key_exists_critical', dest='key_list_critical',
|
||||
parser.add_argument('-E', '--key_exists_critical',
|
||||
dest='key_list_critical',
|
||||
nargs='*',
|
||||
help='''Same as -e but return critical if key is
|
||||
not present.''')
|
||||
parser.add_argument('-q', '--key_equals', dest='key_value_list',
|
||||
action='extend',
|
||||
nargs='*',
|
||||
parser.add_argument('-q', '--key_equals', dest='key_value_list', nargs='*',
|
||||
help='''Checks equality of these keys and values
|
||||
(key[>alias],value key2,value2) to determine status.
|
||||
Multiple key values can be delimited with colon
|
||||
(key,value1:value2). Return warning if equality
|
||||
check fails''')
|
||||
parser.add_argument('-Q', '--key_equals_critical', dest='key_value_list_critical',
|
||||
action='extend',
|
||||
nargs='*',
|
||||
parser.add_argument('-Q', '--key_equals_critical',
|
||||
dest='key_value_list_critical', nargs='*',
|
||||
help='''Same as -q but return critical if
|
||||
equality check fails.''')
|
||||
parser.add_argument('--key_time', dest='key_time_list', nargs='*',
|
||||
@ -596,9 +594,7 @@ def parseArgs(args):
|
||||
dest='key_value_list_not_critical', nargs='*',
|
||||
help='''Same as -q but return critical if equality
|
||||
check succeeds.''')
|
||||
parser.add_argument('-m', '--key_metric', dest='metric_list',
|
||||
action='extend',
|
||||
nargs='*',
|
||||
parser.add_argument('-m', '--key_metric', dest='metric_list', nargs='*',
|
||||
help='''Gathers the values of these keys (key[>alias],
|
||||
UnitOfMeasure,WarnRange,CriticalRange,Min,Max) for
|
||||
Nagios performance data. More information about Range
|
||||
|
@ -1,6 +1,4 @@
|
||||
object CheckCommand "http_json" {
|
||||
// Example configuration for Icinga
|
||||
|
||||
import "plugin-check-command"
|
||||
|
||||
command = [ PluginDir + "/check_http_json.py" ]
|
||||
@ -55,13 +53,6 @@ object CheckCommand "http_json" {
|
||||
value = "$http_json_headers$"
|
||||
description = "additional http headers in JSON format to send with the request"
|
||||
}
|
||||
"--unreachable-state" = {
|
||||
value = "$http_json_unreachable_state$"
|
||||
description = "Exit with specified code when the URL is unreachable."
|
||||
}
|
||||
"--invalid-json-state" = {
|
||||
value = "$http_json_invalid_json_state$"
|
||||
description = "Exit with specified code when no valid JSON is returned."
|
||||
"--field_separator" = {
|
||||
value = "$http_json_field_separator$"
|
||||
description = "JSON Field separator, defaults to '.'; Select element in an array with '(' ')'"
|
||||
@ -73,62 +64,46 @@ object CheckCommand "http_json" {
|
||||
"--warning" = {
|
||||
value = "$http_json_warning$"
|
||||
description = "Warning threshold for these values, WarningRange is in the format [@]start:end"
|
||||
repeat_key = true
|
||||
}
|
||||
"--critical" = {
|
||||
value = "$http_json_critical$"
|
||||
description = "Critical threshold for these values, CriticalRange is in the format [@]start:end"
|
||||
repeat_key = true
|
||||
}
|
||||
"--key_exists" = {
|
||||
value = "$http_json_key_exists$"
|
||||
description = "Checks existence of these keys to determine status. Return warning if key is not present."
|
||||
repeat_key = true
|
||||
}
|
||||
"--key_exists_critical" = {
|
||||
value = "$http_json_key_exists_critical$"
|
||||
description = "Checks existence of these keys to determine status. Return critical if key is not present."
|
||||
repeat_key = true
|
||||
}
|
||||
"--key_equals" = {
|
||||
value = "$http_json_key_equals$"
|
||||
description = "Checks equality of these keys and values. Return warning if equality check fails"
|
||||
repeat_key = true
|
||||
}
|
||||
"--key_equals_critical" = {
|
||||
value = "$http_json_key_equals_critical$"
|
||||
description = "Checks equality of these keys and values. Return critical if equality check fails"
|
||||
repeat_key = true
|
||||
}
|
||||
"--key_equals_unknown" = {
|
||||
value = "$http_json_key_equals_unknown$"
|
||||
description = "Checks equality of these keys and values. Return unknown if equality check fails"
|
||||
repeat_key = true
|
||||
}
|
||||
"--unreachable-state" = {
|
||||
value = "$http_json_unreachable_state$"
|
||||
description = "Exit with specified code if URL unreachable. Examples: 1 for Warning, 2 for Critical, 3 for Unknown (default: 3)"
|
||||
}
|
||||
"--key_not_equals" = {
|
||||
value = "$http_json_key_not_equals$"
|
||||
description = "Checks equality of these keys and values (key[>alias],value key2,value2) to determine status. Multiple key values can be delimited with colon (key,value1:value2). Return warning if equality check succeeds."
|
||||
repeat_key = true
|
||||
}
|
||||
"--key_not_equals_critical" = {
|
||||
value = "$http_json_key_not_equals_critical$"
|
||||
description = "Checks equality of these keys and values (key[>alias],value key2,value2) to determine status. Multiple key values can be delimited with colon (key,value1:value2). Return critical if equality check succeeds."
|
||||
repeat_key = true
|
||||
}
|
||||
"--key_metric" = {
|
||||
value = "$http_json_key_metric$"
|
||||
description = "Gathers the values of these keys"
|
||||
repeat_key = true
|
||||
}
|
||||
"--key_time" = {
|
||||
value = "$http_json_key_time$"
|
||||
description = " Checks a Timestamp of these keys and values (key[>alias],value key2,value2) to determine status."
|
||||
repeat_key = true
|
||||
}
|
||||
"--key_time_critical" = {
|
||||
value = "$http_json_key_time_critical$"
|
||||
description = "Same as --key_time but return critical if Timestamp age fails."
|
||||
repeat_key = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
coverage==7.8.0
|
||||
pylint==3.3.6
|
||||
coverage==6.5.0
|
||||
pylint==2.17.7
|
||||
|
Loading…
Reference in New Issue
Block a user