check-netscaler 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. check_netscaler-2.0.0/LICENSE +21 -0
  2. check_netscaler-2.0.0/PKG-INFO +211 -0
  3. check_netscaler-2.0.0/README.md +177 -0
  4. check_netscaler-2.0.0/check_netscaler/__init__.py +10 -0
  5. check_netscaler-2.0.0/check_netscaler/__main__.py +10 -0
  6. check_netscaler-2.0.0/check_netscaler/cli.py +314 -0
  7. check_netscaler-2.0.0/check_netscaler/client/__init__.py +25 -0
  8. check_netscaler-2.0.0/check_netscaler/client/exceptions.py +48 -0
  9. check_netscaler-2.0.0/check_netscaler/client/nitro.py +195 -0
  10. check_netscaler-2.0.0/check_netscaler/client/session.py +149 -0
  11. check_netscaler-2.0.0/check_netscaler/commands/__init__.py +1 -0
  12. check_netscaler-2.0.0/check_netscaler/commands/base.py +62 -0
  13. check_netscaler-2.0.0/check_netscaler/commands/debug.py +67 -0
  14. check_netscaler-2.0.0/check_netscaler/commands/hastatus.py +177 -0
  15. check_netscaler-2.0.0/check_netscaler/commands/hwinfo.py +98 -0
  16. check_netscaler-2.0.0/check_netscaler/commands/interfaces.py +179 -0
  17. check_netscaler-2.0.0/check_netscaler/commands/license.py +225 -0
  18. check_netscaler-2.0.0/check_netscaler/commands/matches.py +194 -0
  19. check_netscaler-2.0.0/check_netscaler/commands/nsconfig.py +74 -0
  20. check_netscaler-2.0.0/check_netscaler/commands/ntp.py +295 -0
  21. check_netscaler-2.0.0/check_netscaler/commands/perfdata.py +142 -0
  22. check_netscaler-2.0.0/check_netscaler/commands/servicegroup.py +202 -0
  23. check_netscaler-2.0.0/check_netscaler/commands/sslcert.py +175 -0
  24. check_netscaler-2.0.0/check_netscaler/commands/staserver.py +151 -0
  25. check_netscaler-2.0.0/check_netscaler/commands/state.py +226 -0
  26. check_netscaler-2.0.0/check_netscaler/commands/threshold.py +256 -0
  27. check_netscaler-2.0.0/check_netscaler/constants.py +25 -0
  28. check_netscaler-2.0.0/check_netscaler/output/__init__.py +1 -0
  29. check_netscaler-2.0.0/check_netscaler/output/nagios.py +154 -0
  30. check_netscaler-2.0.0/check_netscaler/utils/__init__.py +1 -0
  31. check_netscaler-2.0.0/check_netscaler.egg-info/PKG-INFO +211 -0
  32. check_netscaler-2.0.0/check_netscaler.egg-info/SOURCES.txt +53 -0
  33. check_netscaler-2.0.0/check_netscaler.egg-info/dependency_links.txt +1 -0
  34. check_netscaler-2.0.0/check_netscaler.egg-info/entry_points.txt +2 -0
  35. check_netscaler-2.0.0/check_netscaler.egg-info/requires.txt +10 -0
  36. check_netscaler-2.0.0/check_netscaler.egg-info/top_level.txt +1 -0
  37. check_netscaler-2.0.0/pyproject.toml +110 -0
  38. check_netscaler-2.0.0/setup.cfg +4 -0
  39. check_netscaler-2.0.0/tests/test_cli.py +275 -0
  40. check_netscaler-2.0.0/tests/test_client.py +365 -0
  41. check_netscaler-2.0.0/tests/test_constants.py +56 -0
  42. check_netscaler-2.0.0/tests/test_debug_command.py +259 -0
  43. check_netscaler-2.0.0/tests/test_hastatus_command.py +618 -0
  44. check_netscaler-2.0.0/tests/test_hwinfo_command.py +248 -0
  45. check_netscaler-2.0.0/tests/test_interfaces_command.py +693 -0
  46. check_netscaler-2.0.0/tests/test_license_command.py +641 -0
  47. check_netscaler-2.0.0/tests/test_matches_command.py +377 -0
  48. check_netscaler-2.0.0/tests/test_nsconfig_command.py +162 -0
  49. check_netscaler-2.0.0/tests/test_ntp_command.py +508 -0
  50. check_netscaler-2.0.0/tests/test_perfdata_command.py +417 -0
  51. check_netscaler-2.0.0/tests/test_servicegroup_command.py +652 -0
  52. check_netscaler-2.0.0/tests/test_sslcert_command.py +402 -0
  53. check_netscaler-2.0.0/tests/test_staserver_command.py +376 -0
  54. check_netscaler-2.0.0/tests/test_state_command.py +249 -0
  55. check_netscaler-2.0.0/tests/test_threshold_command.py +358 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 slauger
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.4
2
+ Name: check_netscaler
3
+ Version: 2.0.0
4
+ Summary: Nagios/Icinga monitoring plugin for Citrix NetScaler ADC using NITRO REST API
5
+ Author-email: slauger <slauger@users.noreply.github.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/slauger/check_netscaler
8
+ Project-URL: Repository, https://github.com/slauger/check_netscaler
9
+ Project-URL: Issues, https://github.com/slauger/check_netscaler/issues
10
+ Keywords: nagios,icinga,monitoring,netscaler,citrix,adc
11
+ Classifier: Development Status :: 2 - Pre-Alpha
12
+ Classifier: Intended Audience :: System Administrators
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: System :: Monitoring
21
+ Requires-Python: >=3.8
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: requests>=2.31.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
27
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
28
+ Requires-Dist: pytest-mock>=3.11.0; extra == "dev"
29
+ Requires-Dist: black>=23.7.0; extra == "dev"
30
+ Requires-Dist: ruff>=0.0.285; extra == "dev"
31
+ Requires-Dist: mypy>=1.5.0; extra == "dev"
32
+ Requires-Dist: types-requests>=2.31.0; extra == "dev"
33
+ Dynamic: license-file
34
+
35
+ # check_netscaler
36
+
37
+ [![CI](https://github.com/slauger/check_netscaler/actions/workflows/lint-and-type-check.yml/badge.svg?branch=master)](https://github.com/slauger/check_netscaler/actions/workflows/lint-and-type-check.yml)
38
+ [![PyPI](https://img.shields.io/pypi/v/check_netscaler)](https://pypi.org/project/check_netscaler/)
39
+ [![Python](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)](https://www.python.org/)
40
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
41
+
42
+ Nagios/Icinga monitoring plugin for Citrix NetScaler (ADC) using the NITRO REST API.
43
+
44
+ ## Version 2.0 - Python Rewrite
45
+
46
+ This is a complete Python rewrite of check_netscaler. **All 16 check commands are implemented** with 343 passing tests and full CI/CD integration.
47
+
48
+ > **Looking for the stable Perl version (v1.x)?**
49
+ > See tags < 2.0.0 for the legacy Perl implementation.
50
+
51
+ ### Breaking Changes from v1.x
52
+
53
+ - **HTTPS is now default** - Use `--no-ssl` for HTTP instead of `-s` for HTTPS
54
+ - Environment variable support added: `NETSCALER_HOST`, `NETSCALER_USER`, `NETSCALER_PASS`
55
+
56
+ ## Features
57
+
58
+ Monitor your NetScaler without SNMP:
59
+
60
+ - **Virtual Servers** - Load balancer, VPN, GSLB, Content Switching, AAA
61
+ - **Services & Service Groups** - State and member quorum monitoring
62
+ - **SSL Certificates** - Expiration warnings
63
+ - **High Availability** - HA status and sync monitoring
64
+ - **System Resources** - CPU, memory, disk usage thresholds
65
+ - **Network Interfaces** - Interface status and statistics
66
+ - **License Management** - License expiration tracking
67
+ - **NTP Synchronization** - Time sync validation
68
+ - **Configuration** - Unsaved config detection
69
+ - **Performance Data** - Generic metric collection for any NITRO object
70
+
71
+ ### Advanced Features
72
+
73
+ - Regex-based filtering (`--filter` / `--limit`)
74
+ - Custom performance data labels
75
+ - Flexible threshold formats
76
+ - Multiple Python versions supported (3.8-3.12)
77
+
78
+ ## Requirements
79
+
80
+ ```
81
+ Python >= 3.8
82
+ requests >= 2.31.0
83
+ ```
84
+
85
+ ## Installation
86
+
87
+ ```bash
88
+ git clone https://github.com/slauger/check_netscaler.git
89
+ cd check_netscaler
90
+ git checkout v2-python-rewrite
91
+
92
+ # Install
93
+ pip install -e .
94
+
95
+ # For development
96
+ pip install -e ".[dev]"
97
+ ```
98
+
99
+ ## Quick Start
100
+
101
+ ```bash
102
+ # Check all load balancer vServers
103
+ check_netscaler -H 192.168.1.10 -u nsroot -p nsroot -C state -o lbvserver
104
+
105
+ # Check SSL certificate expiration
106
+ check_netscaler -H 192.168.1.10 -C sslcert -w 60 -c 30
107
+
108
+ # Check CPU usage
109
+ check_netscaler -H 192.168.1.10 -C above -o system -n cpuusagepcnt -w 75 -c 90
110
+
111
+ # Check HA status
112
+ check_netscaler -H 192.168.1.10 -C hastatus
113
+
114
+ # Check NTP sync
115
+ check_netscaler -H 192.168.1.10 -C ntp -w "o=0.03" -c "o=0.05"
116
+ ```
117
+
118
+ ### Using Environment Variables (Recommended)
119
+
120
+ For improved security and convenience, use environment variables instead of command-line arguments:
121
+
122
+ ```bash
123
+ # Export credentials once
124
+ export NETSCALER_HOST=192.168.1.10
125
+ export NETSCALER_USER=monitoring
126
+ export NETSCALER_PASS=SecurePassword123
127
+
128
+ # Now run checks without passing credentials
129
+ check_netscaler -C state -o lbvserver
130
+ check_netscaler -C sslcert -w 60 -c 30
131
+ check_netscaler -C hastatus
132
+ ```
133
+
134
+ **Why use environment variables?**
135
+
136
+ - **Security**: Credentials are not visible in process listings (`ps`, `top`, `/proc`)
137
+ - **Convenience**: Set once, use in multiple commands
138
+ - **Best Practice**: Follows patterns from other monitoring plugins (PostgreSQL, MySQL)
139
+ - **Integration**: Works seamlessly with Icinga 2 `env` attribute, Nagios/systemd environments
140
+
141
+ Command-line arguments always override environment variables if both are provided.
142
+
143
+ ## Available Commands
144
+
145
+ | Command | Description |
146
+ |---------|-------------|
147
+ | `state` | vServer/service/servicegroup/server state monitoring |
148
+ | `above`/`below` | Threshold-based checks (CPU, memory, disk, etc.) |
149
+ | `sslcert` | SSL certificate expiration |
150
+ | `hastatus` | High availability status |
151
+ | `interfaces` | Network interface monitoring |
152
+ | `servicegroup` | Service group member quorum |
153
+ | `perfdata` | Generic performance data collection |
154
+ | `license` | License expiration |
155
+ | `ntp` | NTP synchronization status |
156
+ | `nsconfig` | Unsaved configuration detection |
157
+ | `matches`/`matches_not` | String matching in API responses |
158
+ | `staserver` | STA server availability |
159
+ | `hwinfo` | Hardware information |
160
+ | `debug` | Raw API output for troubleshooting |
161
+
162
+ ## Documentation
163
+
164
+ - **[Command Examples](examples/commands/)** - Detailed usage for every command
165
+ - **[Icinga 2 Integration](examples/icinga2/)** - CheckCommand definitions
166
+ - **[Nagios Integration](examples/nagios/)** - Command and service configurations
167
+
168
+ ## Development
169
+
170
+ ### Running Tests
171
+
172
+ ```bash
173
+ # Run all tests
174
+ pytest tests/
175
+
176
+ # With coverage
177
+ pytest tests/ --cov=check_netscaler --cov-report=html
178
+
179
+ # Linting
180
+ ruff check check_netscaler/ tests/
181
+
182
+ # Formatting
183
+ black check_netscaler/ tests/
184
+ ```
185
+
186
+ ### CI/CD
187
+
188
+ GitHub Actions pipeline runs automatically on every push:
189
+ - Matrix testing on Python 3.8, 3.9, 3.10, 3.11, 3.12
190
+ - Linting with ruff
191
+ - Code formatting with black
192
+ - Type checking with mypy
193
+ - Full test suite (343 tests)
194
+
195
+ ## License
196
+
197
+ MIT License - See [LICENSE](LICENSE)
198
+
199
+ ## Contributors
200
+
201
+ - [slauger](https://github.com/slauger) - Original author
202
+ - [macampo](https://github.com/macampo)
203
+ - [Velociraptor85](https://github.com/Velociraptor85)
204
+ - [bb-ricardo](https://github.com/bb-ricardo)
205
+ - [DerInti](https://github.com/DerInti)
206
+
207
+ ## Links
208
+
209
+ - [Issue Tracker](https://github.com/slauger/check_netscaler/issues)
210
+ - [Pull Requests](https://github.com/slauger/check_netscaler/pulls)
211
+ - [NetScaler NITRO API Documentation](http://docs.citrix.com/en-us/netscaler/)
@@ -0,0 +1,177 @@
1
+ # check_netscaler
2
+
3
+ [![CI](https://github.com/slauger/check_netscaler/actions/workflows/lint-and-type-check.yml/badge.svg?branch=master)](https://github.com/slauger/check_netscaler/actions/workflows/lint-and-type-check.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/check_netscaler)](https://pypi.org/project/check_netscaler/)
5
+ [![Python](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12-blue)](https://www.python.org/)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
7
+
8
+ Nagios/Icinga monitoring plugin for Citrix NetScaler (ADC) using the NITRO REST API.
9
+
10
+ ## Version 2.0 - Python Rewrite
11
+
12
+ This is a complete Python rewrite of check_netscaler. **All 16 check commands are implemented** with 343 passing tests and full CI/CD integration.
13
+
14
+ > **Looking for the stable Perl version (v1.x)?**
15
+ > See tags < 2.0.0 for the legacy Perl implementation.
16
+
17
+ ### Breaking Changes from v1.x
18
+
19
+ - **HTTPS is now default** - Use `--no-ssl` for HTTP instead of `-s` for HTTPS
20
+ - Environment variable support added: `NETSCALER_HOST`, `NETSCALER_USER`, `NETSCALER_PASS`
21
+
22
+ ## Features
23
+
24
+ Monitor your NetScaler without SNMP:
25
+
26
+ - **Virtual Servers** - Load balancer, VPN, GSLB, Content Switching, AAA
27
+ - **Services & Service Groups** - State and member quorum monitoring
28
+ - **SSL Certificates** - Expiration warnings
29
+ - **High Availability** - HA status and sync monitoring
30
+ - **System Resources** - CPU, memory, disk usage thresholds
31
+ - **Network Interfaces** - Interface status and statistics
32
+ - **License Management** - License expiration tracking
33
+ - **NTP Synchronization** - Time sync validation
34
+ - **Configuration** - Unsaved config detection
35
+ - **Performance Data** - Generic metric collection for any NITRO object
36
+
37
+ ### Advanced Features
38
+
39
+ - Regex-based filtering (`--filter` / `--limit`)
40
+ - Custom performance data labels
41
+ - Flexible threshold formats
42
+ - Multiple Python versions supported (3.8-3.12)
43
+
44
+ ## Requirements
45
+
46
+ ```
47
+ Python >= 3.8
48
+ requests >= 2.31.0
49
+ ```
50
+
51
+ ## Installation
52
+
53
+ ```bash
54
+ git clone https://github.com/slauger/check_netscaler.git
55
+ cd check_netscaler
56
+ git checkout v2-python-rewrite
57
+
58
+ # Install
59
+ pip install -e .
60
+
61
+ # For development
62
+ pip install -e ".[dev]"
63
+ ```
64
+
65
+ ## Quick Start
66
+
67
+ ```bash
68
+ # Check all load balancer vServers
69
+ check_netscaler -H 192.168.1.10 -u nsroot -p nsroot -C state -o lbvserver
70
+
71
+ # Check SSL certificate expiration
72
+ check_netscaler -H 192.168.1.10 -C sslcert -w 60 -c 30
73
+
74
+ # Check CPU usage
75
+ check_netscaler -H 192.168.1.10 -C above -o system -n cpuusagepcnt -w 75 -c 90
76
+
77
+ # Check HA status
78
+ check_netscaler -H 192.168.1.10 -C hastatus
79
+
80
+ # Check NTP sync
81
+ check_netscaler -H 192.168.1.10 -C ntp -w "o=0.03" -c "o=0.05"
82
+ ```
83
+
84
+ ### Using Environment Variables (Recommended)
85
+
86
+ For improved security and convenience, use environment variables instead of command-line arguments:
87
+
88
+ ```bash
89
+ # Export credentials once
90
+ export NETSCALER_HOST=192.168.1.10
91
+ export NETSCALER_USER=monitoring
92
+ export NETSCALER_PASS=SecurePassword123
93
+
94
+ # Now run checks without passing credentials
95
+ check_netscaler -C state -o lbvserver
96
+ check_netscaler -C sslcert -w 60 -c 30
97
+ check_netscaler -C hastatus
98
+ ```
99
+
100
+ **Why use environment variables?**
101
+
102
+ - **Security**: Credentials are not visible in process listings (`ps`, `top`, `/proc`)
103
+ - **Convenience**: Set once, use in multiple commands
104
+ - **Best Practice**: Follows patterns from other monitoring plugins (PostgreSQL, MySQL)
105
+ - **Integration**: Works seamlessly with Icinga 2 `env` attribute, Nagios/systemd environments
106
+
107
+ Command-line arguments always override environment variables if both are provided.
108
+
109
+ ## Available Commands
110
+
111
+ | Command | Description |
112
+ |---------|-------------|
113
+ | `state` | vServer/service/servicegroup/server state monitoring |
114
+ | `above`/`below` | Threshold-based checks (CPU, memory, disk, etc.) |
115
+ | `sslcert` | SSL certificate expiration |
116
+ | `hastatus` | High availability status |
117
+ | `interfaces` | Network interface monitoring |
118
+ | `servicegroup` | Service group member quorum |
119
+ | `perfdata` | Generic performance data collection |
120
+ | `license` | License expiration |
121
+ | `ntp` | NTP synchronization status |
122
+ | `nsconfig` | Unsaved configuration detection |
123
+ | `matches`/`matches_not` | String matching in API responses |
124
+ | `staserver` | STA server availability |
125
+ | `hwinfo` | Hardware information |
126
+ | `debug` | Raw API output for troubleshooting |
127
+
128
+ ## Documentation
129
+
130
+ - **[Command Examples](examples/commands/)** - Detailed usage for every command
131
+ - **[Icinga 2 Integration](examples/icinga2/)** - CheckCommand definitions
132
+ - **[Nagios Integration](examples/nagios/)** - Command and service configurations
133
+
134
+ ## Development
135
+
136
+ ### Running Tests
137
+
138
+ ```bash
139
+ # Run all tests
140
+ pytest tests/
141
+
142
+ # With coverage
143
+ pytest tests/ --cov=check_netscaler --cov-report=html
144
+
145
+ # Linting
146
+ ruff check check_netscaler/ tests/
147
+
148
+ # Formatting
149
+ black check_netscaler/ tests/
150
+ ```
151
+
152
+ ### CI/CD
153
+
154
+ GitHub Actions pipeline runs automatically on every push:
155
+ - Matrix testing on Python 3.8, 3.9, 3.10, 3.11, 3.12
156
+ - Linting with ruff
157
+ - Code formatting with black
158
+ - Type checking with mypy
159
+ - Full test suite (343 tests)
160
+
161
+ ## License
162
+
163
+ MIT License - See [LICENSE](LICENSE)
164
+
165
+ ## Contributors
166
+
167
+ - [slauger](https://github.com/slauger) - Original author
168
+ - [macampo](https://github.com/macampo)
169
+ - [Velociraptor85](https://github.com/Velociraptor85)
170
+ - [bb-ricardo](https://github.com/bb-ricardo)
171
+ - [DerInti](https://github.com/DerInti)
172
+
173
+ ## Links
174
+
175
+ - [Issue Tracker](https://github.com/slauger/check_netscaler/issues)
176
+ - [Pull Requests](https://github.com/slauger/check_netscaler/pulls)
177
+ - [NetScaler NITRO API Documentation](http://docs.citrix.com/en-us/netscaler/)
@@ -0,0 +1,10 @@
1
+ """
2
+ check_netscaler - Nagios/Icinga monitoring plugin for Citrix NetScaler ADC
3
+
4
+ A monitoring plugin for Citrix NetScaler Application Delivery Controllers
5
+ using the NITRO REST API.
6
+ """
7
+
8
+ __version__ = "2.0.0"
9
+ __author__ = "slauger"
10
+ __license__ = "MIT"
@@ -0,0 +1,10 @@
1
+ """
2
+ CLI entry point for check_netscaler
3
+ """
4
+
5
+ import sys
6
+
7
+ from check_netscaler.cli import main
8
+
9
+ if __name__ == "__main__":
10
+ sys.exit(main())