This is a TrueNAS/FreeNAS Nagios check script. Checks for Alerts, Pool health, Replication errors, etc.
This is an updated version of check_truenas.py
, written by Goran Tornqvist, and originally found here:
Checks a TrueNAS/FreeNAS server using the 2.0 API. Version 1.1
optional arguments:
-h, --help show this help message and exit
-H HOSTNAME, --hostname HOSTNAME
Hostname or IP address
-u USER, --user USER Normally only root works
-p PASSWD, --passwd PASSWD
Password
-t TYPE, --type TYPE Type of check, either alerts, zpool, or repl
-pn ZPOOLNAME, --zpoolname ZPOOLNAME
For check type zpool, the name of zpool to check.
Optional; defaults to all zpools.
-ns, --no-ssl Disable SSL (use HTTP); default is to use SSL (use
HTTPS)
-nv, --no-verify-cert
Do not verify the server SSL cert; default is to
verify the SSL cert
-ig, --ignore-dismissed-alerts
Ignore alerts that have already been dismissed in
FreeNas/TrueNAS; default is to treat them as relevant
-d, --debug Display debugging information; run script this way and
record result when asking for help.
Check for alerts. This may be all the average user needs to set up. TrueNAS/FreeNas alerts about nearly all significant events here.
check_truenas_extended_play.py -H apollo.yourdomain.local -u root -p RootPassy --type alerts -nv
OK - No problem alerts
check_truenas_extended_play.py -H sicknas.yourdomain.local -u root -p RootPa$$worD -type alerts -nv -ns
CRITICAL - (C) Space usage for pool "BigMediaThree" is 85%. Optimal pool performance requires
used space remain below 80%. - (W) New feature flags are available for volume BigMediaToo. Refer
to the "Upgrading a ZFS Pool" subsection in the User Guide "Installing and Upgrading" chapter
and "Upgrading" section for more instructions. - (W) New feature flags are available for volume
BigMediaThree. Refer to the "Upgrading a ZFS Pool" subsection in the User Guide "Installing and Upgrading"
chapter and "Upgrading" section for more instructions.
check_truenas_extended_play.py -H apollo.yourdomain.local -u root -p RootPassy --type zpool -nv
OK - No problem Zpools. Zpools examined: ApolloZpoolOne ApolloZPoolEleven
check_truenas_extended_play.py -H apollo.yourdomain.local -u root -p RootPassy --type zpool -nv --zpoolname ApolloZPoolEleven
OK - No problem Zpools. Zpools examined: ApolloZPoolEleven
check_truenas_extended_play.py -H apollo.yourdomain.local -u root -p RootPassy --type zpool -nv --zpoolname PoolNameWhichIsNotActuallyThere
CRITICAL - No Zpools found matching PoolNameWhichIsNotActuallyThere out of 2 pools (ApolloZpoolOne ApolloZPoolEleven)
check_truenas_extended_play.py -H apollo.yourdomain.local -u root -p RootPassy --type repl -nv
OK - No replication errors. Replications examined: ApolloDatasetReplications: FINISHED
If you have a suggestion or encounter a problem, I encourage users to get in touch. I've found half-baked Nagios plugins to be a chore to deal with, and I'd like this not to be one of them.