slauger / check_netscaler

A Nagios Plugin written in Perl for the Citrix ADC (formerly Citrix NetScaler). It uses the NetScaler NITRO API.
35 stars 18 forks source link

Incorrect status of load balancing server with configured backup load balancing server #133

Open Tunu-de opened 1 week ago

Tunu-de commented 1 week ago

Description

Hello,

I have the following problem. I have configured a primary load balancer (LB) on my NetScaler at LB level, which switches to a backup LB if the primary LB fails. However, the switchover does not happen automatically, this is intentional and I would like to monitor this. I do not want to create a separate test for this, but would rather have it included in the standard test:

./check_netscaler.pl -H ${IPADDR} -s -C state -o lbvserver -n vs_lb_http_webserver

I have checked the API endpoint, but unfortunately, the /stats endpoint does not have an entry to indicate if a backup server is configured or not. This information is only available in the /config endpoint, similar to service groups. To see if a backup server is configured, you need to check the /config/lbvserver/lb_http_webserver endpoint for the backupvserverstatus entry with the value (Backup Active). If the backup LB is not in use, this entry will not exist. To verify if a backup LB is configured, the backupvserver entry can be checked at the same endpoint.

API Outpuut

Entpoint: https://${IPADDR}/nitro/v1/config/lbvserver/vs_lb_http_webserver

With Backup Configure and Backup active

{
    "errorcode": 0,
    "message": "Done",
    "severity": "NONE",
    "lbvserver": [
        {
            "name": "vs_lb_http_webserver",
            "insertvserveripport": "OFF",
            "ipv46": "0.0.0.0",
            "ippattern": "0.0.0.0",
            "ipmask": "*",
            "listenpolicy": "NONE",
            "ipmapping": "0.0.0.0",
            "port": 0,
            "range": "1",
            "servicetype": "HTTP",
            "type": "ADDRESS",
            "curstate": "UP",
            "effectivestate": "UP",
            "status": 6,
            "lbrrreason": 3,
            "cachetype": "SERVER",
            "authentication": "OFF",
            "authn401": "OFF",
            "dynamicweight": "0",
            "backupvserver": "vs_lb_http_webserver_backup",
            "priority": "0",
            "clttimeout": "180",
            "somethod": "NONE",
            "sopersistence": "DISABLED",
            "sopersistencetimeout": "2",
            "healththreshold": "0",
            "lbmethod": "LEASTCONNECTION",
            "backuplbmethod": "ROUNDROBIN",
            "dataoffset": "0",
            "health": "100",
            "datalength": "0",
            "ruletype": "0",
            "m": "IP",
            "persistencetype": "NONE",
            "timeout": 2,
            "persistmask": "255.255.255.255",
            "v6persistmasklen": "128",
            "persistencebackup": "NONE",
            "backuppersistencetimeout": 2,
            "cacheable": "NO",
            "rtspnat": "OFF",
            "sessionless": "DISABLED",
            "trofspersistence": "ENABLED",
            "map": "OFF",
            "connfailover": "DISABLED",
            "redirectportrewrite": "DISABLED",
            "downstateflush": "ENABLED",
            "disableprimaryondown": "ENABLED",
            "gt2gb": "DISABLED",
            "consolidatedlconn": "GLOBAL",
            "consolidatedlconngbl": "YES",
            "thresholdvalue": 0,
            "invoke": false,
            "version": 0,
            "totalservices": "1",
            "activeservices": "1",
            "statechangetimesec": "Sun Nov 17 19:30:42 2024",
            "statechangetimeseconds": "1731871842",
            "statechangetimemsec": "530",
            "tickssincelaststatechange": "5112776",
            "hits": "0",
            "pipolicyhits": "0",
            "push": "DISABLED",
            "pushlabel": "none",
            "pushmulticlients": "NO",
            "policysubtype": "0",
            "l2conn": "OFF",
            "appflowlog": "ENABLED",
            "isgslb": false,
            "icmpvsrresponse": "PASSIVE",
            "rhistate": "PASSIVE",
            "newservicerequestunit": "PER_SECOND",
            "vsvrbindsvcip": "0.0.0.0",
            "vsvrbindsvcport": 0,
            "skippersistency": "None",
            "td": "0",
            "minautoscalemembers": "0",
            "maxautoscalemembers": "0",
            "macmoderetainvlan": "DISABLED",
            "dns64": "DISABLED",
            "bypassaaaa": "NO",
            "processlocal": "DISABLED",
            "vsvrdynconnsothreshold": "0",
            "backupvserverstatus": "(Backup Active)",
            "retainconnectionsoncluster": "NO",
            "nodefaultbindings": "NO",
            "toggleorder": "ASCENDING",
            "orderthreshold": "0",
            "currentactiveorder": "None"
        }
    ]
}

With Backup Configured and Backup not Aktive

{
    "errorcode": 0,
    "message": "Done",
    "severity": "NONE",
    "lbvserver": [
        {
            "name": "vs_lb_http_webserver",
            "insertvserveripport": "OFF",
            "ipv46": "0.0.0.0",
            "ippattern": "0.0.0.0",
            "ipmask": "*",
            "listenpolicy": "NONE",
            "ipmapping": "0.0.0.0",
            "port": 0,
            "range": "1",
            "servicetype": "HTTP",
            "type": "ADDRESS",
            "curstate": "UP",
            "effectivestate": "UP",
            "status": 2,
            "lbrrreason": 8,
            "cachetype": "SERVER",
            "authentication": "OFF",
            "authn401": "OFF",
            "dynamicweight": "0",
            "backupvserver": "vs_lb_http_webserver_backup",
            "priority": "0",
            "clttimeout": "180",
            "somethod": "NONE",
            "sopersistence": "DISABLED",
            "sopersistencetimeout": "2",
            "healththreshold": "0",
            "lbmethod": "LEASTCONNECTION",
            "backuplbmethod": "ROUNDROBIN",
            "dataoffset": "0",
            "health": "100",
            "datalength": "0",
            "ruletype": "0",
            "m": "IP",
            "persistencetype": "NONE",
            "timeout": 2,
            "persistmask": "255.255.255.255",
            "v6persistmasklen": "128",
            "persistencebackup": "NONE",
            "backuppersistencetimeout": 2,
            "cacheable": "NO",
            "rtspnat": "OFF",
            "sessionless": "DISABLED",
            "trofspersistence": "ENABLED",
            "map": "OFF",
            "connfailover": "DISABLED",
            "redirectportrewrite": "DISABLED",
            "downstateflush": "ENABLED",
            "disableprimaryondown": "ENABLED",
            "gt2gb": "DISABLED",
            "consolidatedlconn": "GLOBAL",
            "consolidatedlconngbl": "YES",
            "thresholdvalue": 0,
            "invoke": false,
            "version": 0,
            "totalservices": "1",
            "activeservices": "1",
            "statechangetimesec": "Mon Nov 18 09:06:49 2024",
            "statechangetimeseconds": "1731920809",
            "statechangetimemsec": "780",
            "tickssincelaststatechange": "5466",
            "hits": "0",
            "pipolicyhits": "0",
            "push": "DISABLED",
            "pushlabel": "none",
            "pushmulticlients": "NO",
            "policysubtype": "0",
            "l2conn": "OFF",
            "appflowlog": "ENABLED",
            "isgslb": false,
            "icmpvsrresponse": "PASSIVE",
            "rhistate": "PASSIVE",
            "newservicerequestunit": "PER_SECOND",
            "vsvrbindsvcip": "0.0.0.0",
            "vsvrbindsvcport": 0,
            "skippersistency": "None",
            "td": "0",
            "minautoscalemembers": "0",
            "maxautoscalemembers": "0",
            "macmoderetainvlan": "DISABLED",
            "dns64": "DISABLED",
            "bypassaaaa": "NO",
            "processlocal": "DISABLED",
            "vsvrdynconnsothreshold": "0",
            "retainconnectionsoncluster": "NO",
            "nodefaultbindings": "NO",
            "toggleorder": "ASCENDING",
            "orderthreshold": "0",
            "currentactiveorder": "None"
        }
    ]
}

Important entries

Expected Outcome

Integrate the monitoring of backup LB status into the standard check to avoid additional separate checks.

Thank you for your support!