Merge pull request #4 from roobert/master

add https option
This commit is contained in:
Drew Kerrigan 2015-04-24 10:35:01 -04:00
commit 23ffc5e8a2
2 changed files with 9 additions and 2 deletions

View File

@ -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.
```

View File

@ -160,6 +160,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()
@ -176,7 +177,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)