Skip to content
Permalink
Browse files

10464 FIX netscaler_vserver: output health information

Since version 1.6.0 the check netscaler_vserver did not output
any health information. This is fixed.

SUP-198

Change-Id: Ide8cd5d8aa24b355bf73f722aecab7d84e93ce7a
  • Loading branch information
7omb committed Nov 29, 2019
1 parent 5bd0a3f commit d5afba6ad7d3cb01b5b72d1d135ff6a5710ef7f3
Showing with 107 additions and 38 deletions.
  1. +15 −0 .werks/10464
  2. +10 −10 checks/netscaler_vserver
  3. +82 −28 tests/unit/checks/generictests/datasets/netscaler_vserver.py
@@ -0,0 +1,15 @@
Title: netscaler_vserver: output health information
Class: fix
Compatible: compat
Component: checks
Date: 1575039628
Edition: cre
Knowledge: undoc
Level: 1
State: unknown
Version: 1.7.0i1

Since version 1.6.0 the check netscaler_vserver did not output
any health information. This is fixed.

SUP-198
@@ -95,17 +95,13 @@ def parse_netscaler_vserver(info):
server_name = full_name if full_name else name
svr_state, svr_state_readable = netscaler_vserver_states.get(svr_state, (1, "unknown"))

entity_service_type = "Type: %s, Protocol: %s, Socket: %s:%s" % (
netscaler_vserver_entitytypes.get(svr_entitytype, "unknown (%s)" % svr_entitytype),
netscaler_vserver_types.get(svr_type, "service unknown (%s)" % svr_type),
ip,
port,
)

tmp_dict = {
'node': node,
'service_state': (svr_state, svr_state_readable),
'entity_service_type': entity_service_type,
'entity_service_type': netscaler_vserver_entitytypes.get(
svr_entitytype, "unknown (%s)" % svr_entitytype),
'protocol': netscaler_vserver_types.get(svr_type, "service unknown (%s)" % svr_type),
'socket': '%s:%s' % (ip, port),
'request_rate': int(request_rate),
'rx_bytes': int(rx_bytes),
'tx_bytes': int(tx_bytes),
@@ -143,7 +139,7 @@ def check_netscaler_vserver(item, params, data):
else:
yield node['service_state'][0], txt

if params.get('entity_service_type') in ["1", "2"]:
if data[0].get('entity_service_type') in ['loadbalancing', 'loadbalancing group']:
warn, crit = params.get("health_levels", (None, None))
health_perc = data[0]['health']
info_txt = "Health: %s" % get_percent_human_readable(health_perc)
@@ -158,7 +154,11 @@ def check_netscaler_vserver(item, params, data):
get_percent_human_readable(crit))
yield health_state, info_txt, [("health_perc", health_perc, warn, crit, 0, 100)]

yield 0, data[0]["entity_service_type"]
yield 0, "Type: %s, Protocol: %s, Socket: %s" % (
data[0]['entity_service_type'],
data[0]['protocol'],
data[0]['socket'],
)

info_txt = "Request rate: %s/s, In: %s/s, Out: %s/s" % (max(req_rate_list),
get_bytes_human_readable(max(rx_list)),
@@ -1,35 +1,89 @@
# -*- encoding: utf-8
# yapf: disable


checkname = 'netscaler_vserver'

info = [
[
None,
'verser0',
'123.456.78.9',
'80',
'0',
'7',
'1',
'5',
'200',
'100',
'300',
'Full VServer Name',
],
[
None,
u'vserver1',
u'0.0.0.0',
u'0',
u'14',
u'1',
u'0',
u'1',
u'0',
u'0',
u'0',
u'Full VServer1 Name',
],
]

info = [[None,
'verser0',
'123.456.78.9',
'80',
'0',
'7',
'1',
'5',
'200',
'100',
'300',
'Full VServer Name']]


discovery = {'': [('Full VServer Name', {})]}

discovery = {'': [('Full VServer Name', {}), ('Full VServer1 Name', {})]}

checks = {'': [('Full VServer Name',
{'cluster_status': 'best', 'health_levels': (100.0, 0.1)},
[(0, 'Status: up', []),
(0,
'Type: cache redirection, Protocol: http, Socket: 123.456.78.9:80',
[]),
(0,
'Request rate: 200/s, In: 100.00 B/s, Out: 300.00 B/s',
[('request_rate', 200, None, None, None, None),
('if_in_octets', 100, None, None, None, None),
('if_out_octets', 300, None, None, None, None)])])]}
checks = {
'': [
(
'Full VServer Name',
{
'cluster_status': 'best',
'health_levels': (100.0, 0.1)
},
[
(0, 'Status: up', []),
(0, 'Type: cache redirection, Protocol: http, Socket: 123.456.78.9:80', []),
(
0,
'Request rate: 200/s, In: 100.00 B/s, Out: 300.00 B/s',
[
('request_rate', 200, None, None, None, None),
('if_in_octets', 100, None, None, None, None),
('if_out_octets', 300, None, None, None, None),
],
),
],
),
(
'Full VServer1 Name',
{
'cluster_status': 'best',
'health_levels': (100.0, 0.1)
},
[
(2, 'Status: down', []),
(
2,
'Health: 0% (warn/crit below 100%/0.1%)',
[
('health_perc', 0, 100, 0.1, 0, 100),
],
),
(0, 'Type: loadbalancing, Protocol: ssl, Socket: 0.0.0.0:0', []),
(
0,
'Request rate: 0/s, In: 0.00 B/s, Out: 0.00 B/s',
[
('request_rate', 0, None, None, None, None),
('if_in_octets', 0, None, None, None, None),
('if_out_octets', 0, None, None, None, None),
],
),
],
),
]
}

0 comments on commit d5afba6

Please sign in to comment.
You can’t perform that action at this time.