From 821c28f4dae5acacd38edc79b04d7b2f0b3b83ad Mon Sep 17 00:00:00 2001 From: Simon Lauger Date: Sun, 26 Feb 2017 15:32:52 +0100 Subject: [PATCH 1/2] #11 checks for secure ticket authority --- check_netscaler.pl | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/check_netscaler.pl b/check_netscaler.pl index a578aed..77830eb 100755 --- a/check_netscaler.pl +++ b/check_netscaler.pl @@ -142,6 +142,9 @@ } elsif ($plugin->opts->command eq 'nsconfig') { # check for unsaved configuration changes check_nsconfig($plugin); +} elsif ($plugin->opts->command eq 'staserver') { + # check the state of the staservers + check_staserver($plugin); } elsif ($plugin->opts->command eq 'debug') { # dump the full response of the nitro api check_debug($plugin); @@ -532,6 +535,46 @@ sub check_sslcert } } +sub check_staserver +{ + my $plugin = shift; + + my %params; + $params{'endpoint'} = $plugin->opts->endpoint || 'config'; + $params{'objectname'} = $plugin->opts->objectname || ''; + $params{'options'} = undef; + + if ($params{'objectname'} eq '') { + $params{'objecttype'} = $plugin->opts->objecttype || 'vpnglobal_staserver_binding'; + } else { + $params{'objecttype'} = $plugin->opts->objecttype || 'vpnvserver_staserver_binding'; + } + + my $response = nitro_client($plugin, \%params); + $response = $response->{$params{'objecttype'}}; + + # return critical if all staservers are down at once + my $critical = 1; + + # check if any stas are in down state + foreach $response (@{$response}) { + if ($response->{'staauthid'} eq '') { + $plugin->add_message(WARNING, $response->{'staserver'} . ' unavailable;'); + } else { + $plugin->add_message(OK, $response->{'staserver'} . ' OK (' . $response->{'staauthid'}.');'); + $critical = 0; + } + } + + my ($code, $message) = $plugin->check_messages; + + if ($critical) { + $plugin->nagios_exit(CRITICAL, 'staservice ' . $message); + } else { + $plugin->nagios_exit($code, 'staservice ' . $message); + } +} + sub check_nsconfig { my $plugin = shift; From f97faba50f09773aeb2a284bf73c0df2ca8ec18d Mon Sep 17 00:00:00 2001 From: Simon Lauger Date: Sun, 26 Feb 2017 16:56:38 +0100 Subject: [PATCH 2/2] #11 checks for secure ticket authority --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 82e9182..c71d91e 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Currently the plugin has the following subcommands: - **above, below:** check if a value is above/below a threshold (e.g. traffic limits, concurrent connections) - **sslcert:**: check the lifetime for installed ssl certificates - **nsconfig:** check for configuration changes which are not saved to disk +- **staservers:** check if configured STA servers are available - **debug:** debug command, print all data for a endpoint This plugin works with VPX, MPX and SDX NetScaler Appliances. The api responses may differ by build, appliance type and your installed license. @@ -99,6 +100,14 @@ If you want to connect to your NetScaler with SSL/HTTPS you should also install # NetScaler::Config ./check_netscaler.pl -H ${IPADDR} -s -C nsconfig +## Check if STA servers are working + + # NetScaler::STA + ./check_netscaler.pl -H ${IPADDR} -s -C staservers + + # NetScaler::STA + ./check_netscaler.pl -H ${IPADDR} -s -C staservers -n vs_vpn_gateway + ## Debug command # Print all LB vServers (stat endpoint) ./check_netscaler.pl -H ${IPADDR} -s -C debug -o lbvserver