Skip to content

Commit

Permalink
Merge pull request #21 from slauger/development
Browse files Browse the repository at this point in the history
Merge branch development for release v1.3.0
  • Loading branch information
slauger authored Aug 13, 2017
2 parents 78ea53b + 9f0aa8e commit ec6fa2a
Show file tree
Hide file tree
Showing 6 changed files with 383 additions and 285 deletions.
32 changes: 24 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
## 1.2.0 (2017-08-12)
## v1.3.0 (2017-08-13)
- added command license to check the status of a local license file (#17)
- added perl-Time-Piece as new dependency (Time::Piece for license check)
- added perl-Data-Dumper to the install instructions in the README.md
- added switch for selecting a different version of the NITRO API (fixes #16)
- allow the usage of urlopts everywhere (fixes #13)
- check_threshold and check_string accept arrays (seperated by colon) (fixes #7)
- renamed checks 'string' and 'string_not' to 'matches' and 'matches_not' (backwards compatibility given)
- renamed check 'performancedata' to 'perfdata' (backwards compatibility given);
- backwards compatibility will be removed in a future release, please update your nagios configuration
- harmonized plugin output for all subcommands
- refactored sub check_state (cleanup and simplified code)
- added support for testing the status of server objects
- added a new warning level for DISABLED and PARTIAL-UP objects
- removed command server (as it might be confusing for users to have two checks with the same function)

## v1.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
Expand All @@ -8,33 +24,33 @@
- added Icinga2 config templates
- updated documentation and plugin_test.sh

## 1.1.1 (2017-06-10)
## v1.1.1 (2017-06-10)
- bugfix for servicegroups in 12.0 (#12)
- new option to connect to an alternate port (for CPX instances)

## 1.1.0 (2017-05-13)
## v1.1.0 (2017-05-13)
- new check command for STA services
- small documentation fixes

## 1.0.0 (2017-02-01)
## v1.0.0 (2017-02-01)
- huge rewrite of the Plugin, changed nearly every parameters
- upgrading from versions prior to 1.0.0 require to change your monitoring configuration
- added own nitro implementation and dropped the dependency to Nitro.pm by Citrix
- added check for unsaved configuration changes (changes in nsconfig not written to disk)
- 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 2017-01-04
## v0.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 2016-12-02
## v0.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 2016-11-10
## v0.1.1 2016-11-10
- documentation fixes by @Velociraptor85

## 0.1.0 (2015-12-17)
## v0.1.0 (2015-12-17)
- First release based on Nitro.pm
151 changes: 108 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,37 @@ A Nagios Plugin written for the Citrix NetScaler Application Delivery Controller
Currently the plugin has the following subcommands:


| 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
| command | description |
--- | --- |
**state** | check the current service state of vservers (e.g. lb, vpn, gslb), services and service groups and servers
**matches, matches_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
**license** | check the expiry date of a local installed license file
**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
**perfdata** | 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. Also there is a performancedata command to gather information from your NetScaler.
The plugin supports performance data for the commands state and the above or below threshold checks. Also there is a perfdata 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. Just create an issue on GitHub or send me a pull request.

If you looking for a plugin to test your NetScaler Gateway vServer and Storefront see also [check_netscaler_gateway](https://github.com/slauger/check_netscaler_gateway).

## Installation

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

```
yum install perl-libwww-perl perl-JSON perl-Nagios-Plugin
yum install perl-libwww-perl perl-JSON perl-Nagios-Plugin perl-Time-Piece perl-Data-Dumper
```

If you want to connect to your NetScaler with SSL/HTTPS you should also install the LWP HTTPS package.
Expand All @@ -42,6 +44,57 @@ If you want to connect to your NetScaler with SSL/HTTPS you should also install
yum install perl-LWP-Protocol-https
```

## Usage
```
Usage: check_netscaler
-H|--hostname=<hostname> -C|--command=<command>
[ -o|--objecttype=<objecttype> ] [ -n|--objectname=<objectname> ]
[ -u|--username=<username> ] [ -p|--password=<password> ]
[ -s|--ssl ] [ -a|--api=<version> ] [ -P|--port=<port> ]
[ -e|--endpoint=<endpoint> ] [ -w|--warning=<warning> ] [ -c|--critical=<critical> ]
[ -v|--verbose ] [ -t|--timeout=<timeout> ] [ -x|--urlopts=<urlopts> ]
-?, --usage
Print usage information
-h, --help
Print detailed help screen
-V, --version
Print version information
--extra-opts=[section][@file]
Read options from an ini file. See http://nagiosplugins.org/extra-opts
for usage and examples.
-H, --hostname=STRING
Hostname of the NetScaler appliance to connect to
-u, --username=STRING
Username to log into box as (default: nsroot)
-p, --password=STRING
Password for login username (default: nsroot)
-s, --ssl
Establish connection to NetScaler using SSL
-P, --port=INTEGER
Establish connection to a alternate TCP Port
-C, --command=STRING
Check to be executed on the appliance
-o, --objecttype=STRING
Objecttype (target) to for the check command
-n, --objectname=STRING
Filter request to a specific objectname
-e, --endpoint=STRING
Override option for the API endpoint (stat or config)
-w, --warning=STRING
Value for warning
-c, --critical=STRING
Value for critical
-x, --urlopts=STRING
add additional url options
-a, --api=STRING
version of the NITRO API to use (default: v1)
-t, --timeout=INTEGER
Seconds before plugin times out (default: 15)
-v, --verbose
Show details for command-line debugging (can repeat up to 3 times)
```

## Usage Examples

### Check status of vServers
Expand Down Expand Up @@ -91,50 +144,42 @@ yum install perl-LWP-Protocol-https

### Check status and quorum of a service group

define member quorum (in percent) with warning and critical values
Define member quorum (in percent) with warning and critical values.

```
# NetScaler::Servicegroup::Webservers
./check_netscaler.pl -H ${IPADDR} -s -C servicegroup -n sg_webservers -w 75 -c 50
```

### Check if Load Balancing servers are enabled
### Check status of server objects

```
# NetScaler::Server
./check_netscaler.pl -H ${IPADDR} -s -C server
# NetScaler::Servers
./check_netscaler.pl -H ${IPADDR} -s -C state -o server
# NetScaler::Server
./check_netscaler.pl -H ${IPADDR} -s -C server -n web01.example.com
# NetScaler::Servers::web01.example.com
./check_netscaler.pl -H ${IPADDR} -s -C state -o server -n web01.example.com
```

### Check system health
### Check for thresholds or matching strings

Multiple fields need to be seperated by a colon.

```
# 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::CPUMGMT
./check_netscaler.pl -H ${IPADDR} -s -C above -o system -n mgmtcpuusagepcnt -w 75 -c 80
./check_netscaler.pl -H ${IPADDR} -s -C above -o system -n cpuusagepcnt,mgmtcpuusagepcnt -w 75 -c 80
# NetScaler::Disk0
./check_netscaler.pl -H ${IPADDR} -s -C above -o system -n disk0perusage -w 75 -c 80
# NetScaler::Disk
./check_netscaler.pl -H ${IPADDR} -s -C above -o system -n disk0perusage,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_netscaler.pl -H ${IPADDR} -s -C matches_not -o hanode -n hacurstatus -w YES -c YES
# NetScaler::HA::State
./check_netscaler.pl -H ${IPADDR} -s -C string_not -o hanode -n hacurstate -w UP -c UP
./check_netscaler.pl -H ${IPADDR} -s -C matches_not -o hanode -n hacurstate -w UP -c UP
```

### Check expiration of installed ssl certificates
Expand All @@ -154,6 +199,18 @@ define member quorum (in percent) with warning and critical values
./check_netscaler.pl -H ${IPADDR} -s -C nsconfig
```

### Check the expiry date of a local license file

The license file must be placed in `/nsconfig/license` and the filename must be given as objectname.
Also the NITRO user needs permissions to access the filesystem directly (NITRO command systemfile).

Multiple license files can be passed, separated with a colon.

```
# NetScaler::License
./check_netscaler.pl -H ${IPADDR} -s -C license -n FID_4c9a2c7e_14292ea2df2_2a97.lic,FID_2b9a2c7e_14212ef2d27_4b87.lic -w 30 -c 10
```

### Check if STA servers are working

```
Expand Down Expand Up @@ -184,21 +241,27 @@ 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
./check_netscaler.pl -H ${IPADDR} -s -C perfdata -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
./check_netscaler.pl -H ${IPADDR} -s -C perfdata -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
./check_netscaler.pl -H ${IPADDR} -s -C perfdata -o Interface -n id.totrxbytes
# NetScaler::Current user sessions
./check_netscaler.pl -H ${IPADDR} -s -C performancedata -o aaa -n aaacuricasessions,aaacuricaonlyconn
./check_netscaler.pl -H ${IPADDR} -s -C perfdata -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
```

[Global counters](https://docs.citrix.com/en-us/netscaler/12/nitro-api/nitro-rest/nitro-rest-usage-scenarios/view-individual-counter-info.html) can be accessed as follows (NetScaler 12.0 and newer).

```
./check_netscaler.pl -H ${IPADDR} -s -C perfdata -o nsglobalcntr -n http_tot_Requests,http_tot_Responses -x 'args=counters:http_tot_Requests;http_tot_Responses'
```

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

- ns
Expand Down Expand Up @@ -230,8 +293,10 @@ define command {

```
[netscaler]
hostname=netscaler01
username=nagios
password=password
ssl=true
```

## Authors
Expand Down
Loading

0 comments on commit ec6fa2a

Please sign in to comment.