Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend perfdata #12

Merged
merged 2 commits into from Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions check_vmware_nsxt.py
Expand Up @@ -263,6 +263,8 @@ def build_output(self):

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


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

Expand Down
2 changes: 1 addition & 1 deletion test_check_vmware_nsxt.py
Expand Up @@ -151,7 +151,7 @@ def test_alarms_ok(self, mock_req, mock_print):
expected = 1

self.assertEqual(actual, expected)
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')
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')

@mock.patch('builtins.print')
@mock.patch('requests.request')
Expand Down