Skip to content

Commit

Permalink
Merge pull request #20 from slauger/development
Browse files Browse the repository at this point in the history
Release 1.2.0
  • Loading branch information
slauger authored Aug 12, 2017
2 parents c33a50f + 0b5c317 commit 78ea53b
Show file tree
Hide file tree
Showing 7 changed files with 1,000 additions and 242 deletions.
16 changes: 13 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 1.2.0 (2017-08-12)
- merged pull request from @bb-Ricardo
- added command server to check status of Load Balancing Servers
- added command hwinfo to just print information about the Netscaler itself
- added command interfaces to check state of all interfaces and add performance data for each interface
- added command to request performance data
- added command to check the state of a servicegroup and its members (set warning and critical values for member quorum)
- added Icinga2 config templates
- updated documentation and plugin_test.sh

## 1.1.1 (2017-06-10)
- bugfix for servicegroups in 12.0 (#12)
- new option to connect to an alternate port (for CPX instances)
Expand All @@ -14,16 +24,16 @@
- improved check for ssl certificates to only check for a specific certificate
- fixed a bug in check_state to support services and servicegroups again

## 0.2.0
## 0.2.0 2017-01-04
- patch for Nitro.pm to support ssl connections
- added check to test the validity and expiry of installed certificates

## 0.1.2
## 0.1.2 2016-12-02
- added performance data feature
- updated sub add_arg and added default values for parameters
- Bugfix in vserver checks loop by @macampo

## 0.1.1
## 0.1.1 2016-11-10
- documentation fixes by @Velociraptor85

## 0.1.0 (2015-12-17)
Expand Down
267 changes: 190 additions & 77 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,126 +4,227 @@ A Nagios Plugin written for the Citrix NetScaler Application Delivery Controller

Currently the plugin has the following subcommands:

- **state:** check the current service state of vservers (e.g. lb, vpn, gslb), services and service groups
- **string, string_not:** check if a string exists in the api response or not (e.g. HA or cluster status)
- **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
- **staserver:** check if configured STA servers are available
- **debug:** debug command, print all data for a endpoint

| command | description |
--- | --- |
**state** | check the current service state of vservers (e.g. lb, vpn, gslb), services and service groups
**string, string_not** | check if a string exists in the api response or not (e.g. HA or cluster status)
**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
**server** | check status of Load Balancing Servers
**staserver** | check if configured STA (secure ticket authority) servers are available
**servicegroup** | check the state of a servicegroup and its members
**hwinfo** | just print information about the Netscaler itself
**interfaces** | check state of all interfaces and add performance data for each interface
**performancedata** | gather performancedata from all sorts of API endpoints
**debug** | debug command, print all data for a endpoint

This plugin works with VPX, MPX, SDX and CPX NetScaler Appliances. The api responses may differ by build, appliance type and your installed license.

The plugin supports performance data for the commands state and the above or below threshold checks.
The plugin supports performance data for the commands state and the above or below threshold checks. Also there is a performancedata command to gather information from your NetScaler.

Example configurations for Nagios and Icinga 2 can be found in the examples directory of this repository.

Feedback and feature requests are appreciated.
Feedback and feature requests are appreciated. Just create an issue on GitHub or send me a pull request.

# Installation
## Installation

On a Enterprise Linux machine (CentOS, RHEL) execute the following commands to install all Perl dependencies (Nagios::Plugin, LWP, JSON):

yum install perl-libwww-perl perl-JSON perl-Nagios-Plugin
```
yum install perl-libwww-perl perl-JSON perl-Nagios-Plugin
```

If you want to connect to your NetScaler with SSL/HTTPS you should also install the LWP HTTPS package.

yum install perl-LWP-Protocol-https
```
yum install perl-LWP-Protocol-https
```

## Usage Examples

### Check status of vServers

```
# NetScaler::LBvServer
./check_netscaler.pl -H ${IPADDR} -s -C state -o lbvserver
# NetScaler::LBvServer::Website
./check_netscaler.pl -H ${IPADDR} -s -C state -o lbvserver -n vs_lb_http_webserver
# NetScaler::VPNvServer
./check_netscaler.pl -H ${IPADDR} -s -C state -o vpnvserver
# NetScaler::GSLBvServer
./check_netscaler.pl -H ${IPADDR} -s -C state -o gslbvserver
# NetScaler::AAAvServer
./check_netscaler.pl -H ${IPADDR} -s -C state -o authenticationvserver
# NetScaler::CSvServer
./check_netscaler.pl -H ${IPADDR} -s -C state -o csvserver
# NetScaler::SSLvServer (obsolet and replaced by lbvserver for newer builds)
./check_netscaler.pl -H ${IPADDR} -s -C state -o sslvserver
```

### Check status of services

# Usage Examples
```
# NetScaler::Services
./check_netscaler.pl -H ${IPADDR} -s -C state -o service
## Check status of vServers
# NetScaler::LBvServer
./check_netscaler.pl -H ${IPADDR} -s -C state -o lbvserver
# NetScaler::Services::Webserver
./check_netscaler.pl -H ${IPADDR} -s -C state -o service -n svc_webserver
```

# NetScaler::LBvServer::Website
./check_netscaler.pl -H ${IPADDR} -s -C state -o lbvserver -n vs_lb_http_webserver
### Check status of service groups

# NetScaler::VPNvServer
./check_netscaler.pl -H ${IPADDR} -s -C state -o vpnvserver
```
# NetScaler::Servicegroups
./check_netscaler.pl -H ${IPADDR} -s -C state -o servicegroup
# NetScaler::GSLBvServer
./check_netscaler.pl -H ${IPADDR} -s -C state -o gslbvserver
# NetScaler::Servicegroups::Webservers
./check_netscaler.pl -H ${IPADDR} -s -C state -o servicegroup -n sg_webservers
```

# NetScaler::AAAvServer
./check_netscaler.pl -H ${IPADDR} -s -C state -o authenticationvserver
### Check status and quorum of a service group

# NetScaler::CSvServer
./check_netscaler.pl -H ${IPADDR} -s -C state -o csvserver
define member quorum (in percent) with warning and critical values

# NetScaler::SSLvServer (obsolet and replaced by lbvserver for newer builds)
./check_netscaler.pl -H ${IPADDR} -s -C state -o sslvserver
```
# NetScaler::Servicegroup::Webservers
./check_netscaler.pl -H ${IPADDR} -s -C servicegroup -n sg_webservers -w 75 -c 50
```

## Check status of services
# NetScaler::Services
./check_netscaler.pl -H ${IPADDR} -s -C state -o service
### Check if Load Balancing servers are enabled

# NetScaler::Services::Webserver
./check_netscaler.pl -H ${IPADDR} -s -C state -o service -n svc_webserver
```
# NetScaler::Server
./check_netscaler.pl -H ${IPADDR} -s -C server
## Check status of servicegroups
# NetScaler::Servicegroups
./check_netscaler.pl -H ${IPADDR} -s -C state -o servicegroup
# NetScaler::Server
./check_netscaler.pl -H ${IPADDR} -s -C server -n web01.example.com
```

# NetScaler::Servicegroups::Webservers
./check_netscaler.pl -H ${IPADDR} -s -C state -o servicegroup -n sg_webservers
### Check system health

## Check system health
# NetScaler::Memory
./check_netscaler.pl -H ${IPADDR} -s -C above -o system -n memusagepcnt -w 75 -c 80
```
# NetScaler::Memory
./check_netscaler.pl -H ${IPADDR} -s -C above -o system -n memusagepcnt -w 75 -c 80
# NetScaler::CPU
./check_netscaler.pl -H ${IPADDR} -s -C above -o system -n cpuusagepcnt -w 75 -c 80
# NetScaler::CPU
./check_netscaler.pl -H ${IPADDR} -s -C above -o system -n cpuusagepcnt -w 75 -c 80
# NetScaler::CPUMGMT
./check_netscaler.pl -H ${IPADDR} -s -C above -o system -n mgmtcpuusagepcnt -w 75 -c 80
# NetScaler::CPUMGMT
./check_netscaler.pl -H ${IPADDR} -s -C above -o system -n mgmtcpuusagepcnt -w 75 -c 80
# NetScaler::Disk0
./check_netscaler.pl -H ${IPADDR} -s -C above -o system -n disk0perusage -w 75 -c 80
# NetScaler::Disk0
./check_netscaler.pl -H ${IPADDR} -s -C above -o system -n disk0perusage -w 75 -c 80
# NetScaler::Disk1
./check_netscaler.pl -H ${IPADDR} -s -C above -o system -n disk1perusage -w 75 -c 80
# NetScaler::Disk1
./check_netscaler.pl -H ${IPADDR} -s -C above -o system -n disk1perusage -w 75 -c 80
```

## Check high availability status
# NetScaler::HA::Status
./check_netscaler.pl -H ${IPADDR} -s -C string_not -o hanode -n hacurstatus -w YES -c YES
### Check high availability status

# NetScaler::HA::State
./check_netscaler.pl -H ${IPADDR} -s -C string_not -o hanode -n hacurstate -w UP -c UP
```
# NetScaler::HA::Status
./check_netscaler.pl -H ${IPADDR} -s -C string_not -o hanode -n hacurstatus -w YES -c YES
## Check expiration of installed ssl certificates
# NetScaler::Certs
./check_netscaler.pl -H ${IPADDR} -s -C sslcert -w 30 -c 10
# NetScaler::HA::State
./check_netscaler.pl -H ${IPADDR} -s -C string_not -o hanode -n hacurstate -w UP -c UP
```

# NetScaler::Certs::Wildcard
./check_netscaler.pl -H ${IPADDR} -s -C sslcert -n wildcard.example.com -w 30 -c 10
### Check expiration of installed ssl certificates

## Check for unsaved configuration changes
# NetScaler::Config
./check_netscaler.pl -H ${IPADDR} -s -C nsconfig
```
# NetScaler::Certs
./check_netscaler.pl -H ${IPADDR} -s -C sslcert -w 30 -c 10
## Check if STA servers are working
# NetScaler::Certs::Wildcard
./check_netscaler.pl -H ${IPADDR} -s -C sslcert -n wildcard.example.com -w 30 -c 10
```

# NetScaler::STA
./check_netscaler.pl -H ${IPADDR} -s -C staserver
### Check for unsaved configuration changes

# NetScaler::STA::vs_vpn_gateway
./check_netscaler.pl -H ${IPADDR} -s -C staserver -n vs_vpn_gateway
```
# 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 staserver
# NetScaler::STA::vs_vpn_gateway
./check_netscaler.pl -H ${IPADDR} -s -C staserver -n vs_vpn_gateway
```

### Get information about the netscaler

```
# NetScaler::HWInfo
./check_netscaler.pl -H ${IPADDR} -s -C hwinfo
```

### Check status of all network interfaces

```
# NetScaler::Interfaces
./check_netscaler.pl -H ${IPADDR} -s -C interfaces
```

### Request performance data

All fields must be defined via "-n" option and be seperated with a comma.

```
# NetScaler::Performancedata on Cache hit/misses
./check_netscaler.pl -H ${IPADDR} -s -C performancedata -o ns -n cachetothits,cachetotmisses
# NetScaler::Performancedata on tcp connections
./check_netscaler.pl -H ${IPADDR} -s -C performancedata -o ns -n tcpcurclientconn,tcpcurclientconnestablished,tcpcurserverconn,tcpcurserverconnestablished
# NetScaler::Performancedata on network interfaces
./check_netscaler.pl -H ${IPADDR} -s -C performancedata -o Interface -n id.totrxbytes
# NetScaler::Current user sessions
./check_netscaler.pl -H ${IPADDR} -s -C performancedata -o aaa -n aaacuricasessions,aaacuricaonlyconn
# find more object names to check out for object type "ns"
/check_netscaler.pl -H ${IPADDR} -s -C debug -o ns
```

For more interesting performance data object types see the following API methods.

- ns
- cache
- protocolhttp
- protocolip
- protocoltcp

## Debug command
# Print all LB vServers (stat endpoint)
./check_netscaler.pl -H ${IPADDR} -s -C debug -o lbvserver

# Print all LB vServers (config endpoint)
./check_netscaler.pl -H ${IPADDR} -s -C debug -o lbvserver -e config
```
# Print all LB vServers (stat endpoint)
./check_netscaler.pl -H ${IPADDR} -s -C debug -o lbvserver
# Print all LB vServers (config endpoint)
./check_netscaler.pl -H ${IPADDR} -s -C debug -o lbvserver -e config
```

## Configuration File

# Configuration File
The plugin uses the Nagios::Plugin Libary, so you can use --extra-opts and seperate the login crendetials from your nagios configuration.

e.g.

```
define command {
command_name check_netscaler_vserver
command_line $USER5$/3rdparty/check_netscaler/check_netscaler.pl -H $HOSTADDRESS$ --extra-opts=netscaler@$USER11$/plugins.ini -C check_vserver -I '$ARG1$'
command_line $USER5$/3rdparty/check_netscaler/check_netscaler.pl -H $HOSTADDRESS$ -s --extra-opts=netscaler@$USER11$/plugins.ini -C state -n '$ARG1$'
}
```

Expand All @@ -133,12 +234,24 @@ username=nagios
password=password
```

# NITRO API Documentation
## Authors
- [slauger](https://github.com/slauger)

## Contributors
- [macampo](https://github.com/macampo)
- [Velociraptor85](https://github.com/Velociraptor85)
- [bb-ricardo](https://github.com/bb-ricardo)

## NITRO API Documentation

You will find a full documentation about the NITRO API on your NetScaler Appliance in the "Download" area.

http://NSIP/nitro-rest.tgz (where NSIP is the IP address of your NetScaler appliance).

# Tested Firmware
## Tested Firmware

Tested with NetScaler 10.5, 11.0, 11.1 and 12.0. The plugin should work with all available firmware builds.

## Changelog

See [CHANGELOG](CHANGELOG.md)
Loading

0 comments on commit 78ea53b

Please sign in to comment.