Skip to content

Commit ad21861

Browse files
authored
Merge pull request #12 from NETWAYS/feature/extend-perfdata
Extend perfdata
2 parents aa4d1d6 + 5806c07 commit ad21861

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

check_vmware_nsxt.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ def build_output(self):
263263

264264
for state, value in states.items():
265265
self.summary.append("%d %s" % (value, state.lower()))
266+
self.perfdata.append("alarms.%s=%d;;;0" % (state.lower(), value))
267+
266268

267269
def build_status(self):
268270
states = []
@@ -395,11 +397,11 @@ def commandline(args):
395397
parser.add_argument('--password', '-p',
396398
help='Password for Basic Auth', required=True)
397399
parser.add_argument('--mode', '-m', choices=['cluster-status', 'alarms', 'capacity-usage'],
398-
help='Check mode to exectue', required=True)
400+
help='Check mode to exectue. Hint: alarms will only include open alarms.', required=True)
399401
parser.add_argument('--max-age', '-M', type=int,
400402
help='Max age in minutes for capacity usage updates. Defaults to 5', default=5, required=False)
401403
parser.add_argument('--insecure',
402-
help='Do not verify TLS certificate. Be careful with this option, please', action='store_true', required=False)
404+
help='Do not verify TLS certificate', action='store_true', required=False)
403405
parser.add_argument('--version', '-V',
404406
help='Print version', action='store_true')
405407

test_check_vmware_nsxt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def test_alarms_ok(self, mock_req, mock_print):
151151
expected = 1
152152

153153
self.assertEqual(actual, expected)
154-
mock_print.assert_called_with('[WARNING] 1 alarms - 1 medium\n\n[MEDIUM] (2021-04-26 15:25:18) (node1) Intelligence Health/Storage Latency High - Intelligence node storage latency is high.\n| alarms=1;;;0')
154+
mock_print.assert_called_with('[WARNING] 1 alarms - 1 medium\n\n[MEDIUM] (2021-04-26 15:25:18) (node1) Intelligence Health/Storage Latency High - Intelligence node storage latency is high.\n| alarms=1;;;0 alarms.medium=1;;;0')
155155

156156
@mock.patch('builtins.print')
157157
@mock.patch('requests.request')

0 commit comments

Comments
 (0)