check_freenas

check_freenas

build status

FreeNAS Naemon/Icinga/Nagios plugin which checks various stuff via FreeNAS REST API(v1.0).

Tested with: Naemon 1.0.5, Ruby 2.3.0, FreeNAS 9.10.2

Usage

./check_freenas.rb
check_freenas v0.1 [https://gitlab.com/6uellerBpanda/check_freenas]

This plugin checks various parameters of FreeNAS

Mode:
  alerts      Notifies of alerts
  updates     Check if update is available
  datasets    Checks used space of all datasets in megabytes with perfdata.
              Exclude datasets: "-z tank -x dataset0,dataset1"
              Include datasets: "-z tank -i data,home"

Usage: check_freenas.rb [options]

Options:
    -s, --address ADDRESS            FreeNAS address (https://freenas.test.at)
    -u, --username USERNAME          Username to connect - only root possible
    -p, --password PASSWORD          Password for root
    -k, --insecure                   No ssl verification
    -m, --mode MODE                  Mode to check
    -z, --zpool ZPOOL                Zpool/Volume name
    -i, --include INCLUDE            Include dataset
    -x, --exclude EXCLUDE            Exclude dataset
    -w, --warning WARNING            Warning threshold
    -c, --critical CRITICAL          Critical threshold
    -v, --version                    Print version information
    -h, --help                       Show this help message

Options

  • -s: FreeNAS url, only https supported, https://freenas.test.at, mandatory
  • -u: only root is possible, mandatory
  • -k: if you've a self signed cert
  • -z: zpool name, mandatory for datasets mode
  • -i: only use this dataset, multiple values seperated with comma e.g. home,data,test
  • -x: exclude dataset, multiple values seperated with comma e.g. home,data,test

Modes

Alerts

Check outstanding alerts.

./check_freenas.rb -s https://freenas.test.at -u root -p  [-k] -m alerts
Warning - smartd is not running

Updates

Notifies of available updates.

./check_freenas.rb -s https://freenas.test.at -u root -p  [-k] -m updates
Warning - There are pending updates. Go to System > Update to apply pending updates

Datasets

Check used space in MB of all datasets with perfdata. Use include/exclude option to limit output.

./check_freenas.rb -s https://freenas.test.at -u root -p  [-k] -m datasets -z tank -i data,home -w 1176000 -c 1185555
Warning - Dataset data used 1176133MB | home=910786MB;1176000;1185555 data=1176133MB;1176000;1185555