mirror of
https://github.com/drewkerrigan/nagios-http-json.git
synced 2024-11-22 02:13:47 +01:00
add https option
This commit is contained in:
parent
a322e17c63
commit
c50f0c2e74
@ -52,7 +52,8 @@ usage: check_http_json.py [-h] -H HOST [-p PATH]
|
||||
[-q [KEY_VALUE_LIST [KEY_VALUE_LIST ...]]]
|
||||
[-l [KEY_LTE_LIST [KEY_LTE_LIST ...]]]
|
||||
[-g [KEY_GTE_LIST [KEY_GTE_LIST ...]]]
|
||||
[-m [METRIC_LIST [METRIC_LIST ...]]] [-d]
|
||||
[-m [METRIC_LIST [METRIC_LIST ...]]] [-s] [-d]
|
||||
|
||||
|
||||
Nagios plugin which checks json values from a given endpoint against argument
|
||||
specified rules and determines the status and performance data for that
|
||||
@ -84,6 +85,7 @@ optional arguments:
|
||||
plugins.org/doc/guidelines.html Additional formats for
|
||||
this parameter are: (key), (key,UnitOfMeasure),
|
||||
(key,UnitOfMeasure,Min,Max).
|
||||
-s, --ssl HTTPS mode.
|
||||
-d, --debug Debug mode.
|
||||
```
|
||||
|
||||
|
@ -157,6 +157,7 @@ def parseArgs():
|
||||
help='Gathers the values of these keys (key,UnitOfMeasure,Min,Max,WarnRange,CriticalRange) for Nagios performance data.\
|
||||
More information about Range format and units of measure for nagios can be found at https://nagios-plugins.org/doc/guidelines.html\
|
||||
Additional formats for this parameter are: (key), (key,UnitOfMeasure), (key,UnitOfMeasure,Min,Max).')
|
||||
parser.add_argument('-s', '--ssl', action='store_true', help='HTTPS mode.')
|
||||
parser.add_argument('-d', '--debug', action='store_true', help='Debug mode.')
|
||||
|
||||
return parser.parse_args()
|
||||
@ -173,7 +174,11 @@ if __name__ == "__main__":
|
||||
args = parseArgs()
|
||||
nagios = NagiosHelper()
|
||||
|
||||
url = "http://%s" % args.host
|
||||
if args.ssl:
|
||||
url = "https://%s" % args.host
|
||||
else:
|
||||
url = "http://%s" % args.host
|
||||
|
||||
if args.path: url += "/%s" % args.path
|
||||
debugPrint(args.debug, "url:%s" % url)
|
||||
|
||||
@ -205,4 +210,4 @@ if __name__ == "__main__":
|
||||
|
||||
# Print Nagios specific string and exit appropriately
|
||||
print nagios.getMessage()
|
||||
exit(nagios.code)
|
||||
exit(nagios.code)
|
||||
|
Loading…
Reference in New Issue
Block a user