diff --git a/README.md b/README.md index 1151b02..ee60a55 100644 --- a/README.md +++ b/README.md @@ -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. ``` diff --git a/check_http_json.py b/check_http_json.py index 2db2fd1..61096f7 100755 --- a/check_http_json.py +++ b/check_http_json.py @@ -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) \ No newline at end of file + exit(nagios.code)