Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
NSXMon
NSXMon
Nagios Library to monitor VMware NSX Devices
Command Line
Usage: /usr/bin/php NSXMon.php -H "" -f "/path/to/authfile.cfg" -m "" -a "" -c "" -C "" -O "" -s "" -n ""
NagiosXI Command
Name: NSXMon
/usr/bin/php -q $USER1$/NSXMon.php -H "$HOSTADDRESS$" -f "$ARG1$" -m "$ARG2$" -a "$ARG3$" -c "$ARG4$" -C "$ARG5$" -O "$ARG6$" -s "$ARG7$" -n "$ARG8$"
Auth File
pass the full path to the file in $ARG1 of the check command.
See auth-file-example,cfg for content and format requirements
NSXMon Check Options
SYSTEM
-m | --monitor (system)
-a | --action system(uptime, version, cpu-usage, cpu-count, cpu-cap, mem-usage, mem-total, storage-usage, storage-total)
-c | --critcal
-n | --negate (default is false) - forces check to exit with OK state
SYSTEM-EVENT
-m | --monitor* (system-event)
-a | --action* system-event(show-crit, show-high)
-c | --critcal* (eventId to match against)
-C | --criticalcount (The number of number of matched events before alert)
-O | --criticalobject (Specific origin objectId to match against)
-s | --scanrange (Only scan events newer than the last X seconds) - seconds only
-n | --negate (default is emptyfalse) - forces check to exit with OK state
SYSTEM-ALARM
-m | --monitor* (system-alarm)
-a | --action* system-event(show-resolvable, show-unresolvable)
-c | --critcal ()
-C | --criticalcount (The number of number of matched events before alert) default = 1
-O | --criticalobject (Specific alarm objectId to match against)
-s | --scanrange (Only scan events newer than the last X seconds) - default = 600
AUDIT-LOG
-m | --monitor (audit-log)
-a | --action audit-log(show-fail)
-c | --critcal
-C | --criticalcount (The number of number of matched events before alert) -> default = 1
-O | --criticalobject (Specific operation type to match against)
-s | --scanrange (Only scan events newer than the last X seconds) - default = 600
SNMP
-m | --monitor (snmp)
-a | --action snmp(list-all, list-enabled, trap-info)
-c | --critcal
Service Check Examples
SHOW-CRITICAL-SYSTEM-EVENTS
/usr/bin/php -q NSXMon.php -H "yourhostname" -f "/usr/local/nagios/libexec/nsxmgrauthfile.cfg" -m "system-event" -a "show-crit" -c "1" -w "0" -n "" -x "0"
SHOW-RESOLVABLE-SYSTEM-EVENTS
/usr/bin/php -q NSXMon.php -H "yourhostname" -f "/usr/local/nagios/libexec/nsxmgrauthfile.cfg" -m "system-alarm" -a "show-resolvable" -c "" -C "5" -O "" -s "" -n ""
MEM-USAGE (CRITICAL > 95%)
/usr/bin/php -q NSXMon.php -H "yourhostname" -f "/usr/local/nagios/libexec/nsxmgrauthfile.cfg" -m "system" -a "mem-usage" -c "95" -C "" -O "" -s "" -n ""
VMware Setup
Create Read-Only user via the API with full permissions to the API.
Use this username and password in the auth file.
Nagios Library to monitor VMware NSX Devices
Command Line
Usage: /usr/bin/php NSXMon.php -H "" -f "/path/to/authfile.cfg" -m "" -a "" -c "" -C "" -O "" -s "" -n "
NagiosXI Command
Name: NSXMon
/usr/bin/php -q $USER1$/NSXMon.php -H "$HOSTADDRESS$" -f "$ARG1$" -m "$ARG2$" -a "$ARG3$" -c "$ARG4$" -C "$ARG5$" -O "$ARG6$" -s "$ARG7$" -n "$ARG8$"
Auth File
pass the full path to the file in $ARG1 of the check command.
See auth-file-example,cfg for content and format requirements
NSXMon Check Options
SYSTEM
-m | --monitor (system)
-a | --action system(uptime, version, cpu-usage, cpu-count, cpu-cap, mem-usage, mem-total, storage-usage, storage-total)
-c | --critcal
-n | --negate (default is false) - forces check to exit with OK state
SYSTEM-EVENT
-m | --monitor* (system-event)
-a | --action* system-event(show-crit, show-high)
-c | --critcal* (eventId to match against)
-C | --criticalcount (The number of number of matched events before alert)
-O | --criticalobject (Specific origin objectId to match against)
-s | --scanrange (Only scan events newer than the last X seconds) - seconds only
-n | --negate (default is emptyfalse) - forces check to exit with OK state
SYSTEM-ALARM
-m | --monitor* (system-alarm)
-a | --action* system-event(show-resolvable, show-unresolvable)
-c | --critcal ()
-C | --criticalcount (The number of number of matched events before alert) default = 1
-O | --criticalobject (Specific alarm objectId to match against)
-s | --scanrange (Only scan events newer than the last X seconds) - default = 600
AUDIT-LOG
-m | --monitor (audit-log)
-a | --action audit-log(show-fail)
-c | --critcal
-C | --criticalcount (The number of number of matched events before alert) -> default = 1
-O | --criticalobject (Specific operation type to match against)
-s | --scanrange (Only scan events newer than the last X seconds) - default = 600
SNMP
-m | --monitor (snmp)
-a | --action snmp(list-all, list-enabled, trap-info)
-c | --critcal
Service Check Examples
SHOW-CRITICAL-SYSTEM-EVENTS
/usr/bin/php -q NSXMon.php -H "yourhostname" -f "/usr/local/nagios/libexec/nsxmgrauthfile.cfg" -m "system-event" -a "show-crit" -c "1" -w "0" -n "" -x "0"
SHOW-RESOLVABLE-SYSTEM-EVENTS
/usr/bin/php -q NSXMon.php -H "yourhostname" -f "/usr/local/nagios/libexec/nsxmgrauthfile.cfg" -m "system-alarm" -a "show-resolvable" -c "" -C "5" -O "" -s "" -n ""
MEM-USAGE (CRITICAL > 95%)
/usr/bin/php -q NSXMon.php -H "yourhostname" -f "/usr/local/nagios/libexec/nsxmgrauthfile.cfg" -m "system" -a "mem-usage" -c "95" -C "" -O "" -s "" -n ""
VMware Setup
Create Read-Only user via the API with full permissions to the API.
Use this username and password in the auth file.
Reviews (2)
byCerealK1ller, June 29, 2021
There is any possibilities to upgrade this to NEW api released?
https://code.vmware.com/apis/547/nsx-t
https://code.vmware.com/apis/547/nsx-t
php -q ./NSXMon.php -H 10.6.253.253 -f "/usr/lib/nagios/plugins/NSXauthfile.cfg" -m "system" -a "mem-usage" -c "95" -C "" -O "" -s "" -n ""
PHP Notice: Undefined variable: mymempercent in /usr/lib/nagios/plugins/NSXMon.php on line 384
PHP Stack trace:
PHP 1. {main}() /usr/lib/nagios/plugins/NSXMon.php:0
PHP 2. main() /usr/lib/nagios/plugins/NSXMon.php:1177
PHP Notice: Undefined variable: mymempercent in /usr/lib/nagios/plugins/NSXMon.php on line 389
PHP Stack trace:
PHP 1. {main}() /usr/lib/nagios/plugins/NSXMon.php:0
PHP 2. main() /usr/lib/nagios/plugins/NSXMon.php:1177
How could I fix that ?
PHP Notice: Undefined variable: mymempercent in /usr/lib/nagios/plugins/NSXMon.php on line 384
PHP Stack trace:
PHP 1. {main}() /usr/lib/nagios/plugins/NSXMon.php:0
PHP 2. main() /usr/lib/nagios/plugins/NSXMon.php:1177
PHP Notice: Undefined variable: mymempercent in /usr/lib/nagios/plugins/NSXMon.php on line 389
PHP Stack trace:
PHP 1. {main}() /usr/lib/nagios/plugins/NSXMon.php:0
PHP 2. main() /usr/lib/nagios/plugins/NSXMon.php:1177
How could I fix that ?
Owner's reply
Can you remove the -C "" variable from your command?
Also could you provide the output from
"/api/1.0/appliance-management/summary/system"
--SN