Skip to content

Commit

Permalink
updated check_blue_talon_version.py
Browse files Browse the repository at this point in the history
  • Loading branch information
HariSekhon committed Dec 6, 2016
1 parent e7be8f6 commit 5e4eb28
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions check_blue_talon_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
try:
# pylint: disable=wrong-import-position
from harisekhon.utils import log, qquit, support_msg_api, isVersion, isList, isDict
from harisekhon.utils import validate_host, validate_port, validate_user, validate_password, validate_regex
from harisekhon.utils import validate_host, validate_port, validate_user, validate_password
from harisekhon import VersionNagiosPlugin
except ImportError as _:
print(traceback.format_exc(), end='')
Expand All @@ -70,6 +70,7 @@ def __init__(self):
self.user = self.default_user
self.password = None
self.expected = None
self.protocol = 'http'
self.api_version = '1.0'
self.msg = '{0} version unknown - no message defined'.format(self.software)
self.ok()
Expand All @@ -88,6 +89,7 @@ def process_options(self):
validate_port(self.port)
validate_user(self.user)
validate_password(self.password)
self.add_opt('-S', '--ssl', action='store_true', help='Use SSL')
self.process_expected_version_option()

def run(self):
Expand All @@ -103,9 +105,8 @@ def run(self):

def get_version(self):
log.info('querying %s', self.software)
url = 'http://{host}:{port}/PolicyManagement/{api_version}/version'.format(host=self.host,
port=self.port,
api_version=self.api_version)
url = '{protocol}://{host}:{port}/PolicyManagement/{api_version}/version'\
.format(host=self.host, port=self.port, api_version=self.api_version, protocol=self.protocol)
log.debug('GET %s', url)
try:
req = requests.get(url, auth=HTTPBasicAuth(self.user, self.password))
Expand Down

0 comments on commit 5e4eb28

Please sign in to comment.