Skip to content

Commit 4105e37

Browse files
Add option to connect via ssl
1 parent 5ee80d2 commit 4105e37

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

tibco_ems/datadog_checks/tibco_ems/tibco_ems.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
from typing import Any # noqa: F401
77

88
from datadog_checks.base import AgentCheck
9+
from datadog_checks.base.utils.common import is_affirmative
10+
911

1012
from .constants import SHOW_METRIC_DATA, UNIT_PATTERN
1113

1214
DEFAULT_HOST = 'localhost'
1315
DEFAULT_PORT = 7222
1416
TO_BYTES = {'b': 1, 'kb': 1e3, 'mb': 1e6, 'gb': 1e9, 'tb': 1e12}
15-
CONNECTION_STRING = 'tcp://{}:{}'
17+
TCP_CONNECTION_STRING = 'tcp://{}:{}'
18+
SSL_CONNECTION_STRING = 'ssl://{}:{}'
1619

1720

1821
class TibcoEMSCheck(AgentCheck):
@@ -29,7 +32,11 @@ def __init__(self, name, init_config, instances):
2932
username = self.instance.get('username')
3033
password = self.instance.get('password')
3134
script_path = self.instance.get('script_path')
32-
server_string = CONNECTION_STRING.format(host, port)
35+
use_ssl = is_affirmative(self.instance.get('use_ssl', False))
36+
if not use_ssl:
37+
server_string = TCP_CONNECTION_STRING.format(host, port)
38+
else:
39+
server_string = SSL_CONNECTION_STRING.format(host, port)
3340
self.tags = self.instance.get('tags', [])
3441

3542
self.cmd = tibemsadmin_cmd + [

0 commit comments

Comments
 (0)