OpenBSD SNMPv3 general check

This script uses SNMPv3 to check memory/swap usage, file system space usage and CPU load average on OpenBSD system.


> ./openbsd_snmp3.py -h
usage: openbsd_snmp3.py [-h] [--version] -H HOST -l SECLEVEL -u SECNAME
                        [-a AUTHPROTOCOL] [-A AUTHPASSWORD] [-x PRIVPROTOCOL]
                        [-X PRIVPASSWORD] -O OPTION [-w WARNING] [-c CRITICAL]

optional arguments:
  -h, --help       show this help message and exit
  --version        show program's version number and exit
  -H HOST          IP addess or hostname of the target host
  -l SECLEVEL      Set the securityLevel used for SNMPv3 messages
                   (noAuthNoPriv|authNoPriv|authPriv).
  -u SECNAME       Set the securityName used for authenticated SNMPv3
                   messages.
  -a AUTHPROTOCOL  Set the authentication protocol (MD5|SHA) used for
                   authenticated SNMPv3 messages.
  -A AUTHPASSWORD  Set the authentication pass phrase used for authenticated
                   SNMPv3 messages.
  -x PRIVPROTOCOL  Set the privacy protocol (DES|AES) used for encrypted
                   SNMPv3 messages.
  -X PRIVPASSWORD  Set the privacy pass phrase used for encrypted SNMPv3
                   messages.
  -O OPTION        Check target. This can be "cpu", "mem", "swap", "fs" or
                   "proc" - number of running processes. Use "os" to see
                   operation system information, "proc" to see table of
                   running processes, "interfaces" to see some intormation
                   about installed network interfaces, "file-systems" to see
                   the statistic of disk usage on all mounted file systems.
  -w WARNING       WARNING threshold
  -c CRITICAL      CRITICAL threshold

      _____                 ____   _____ _____        _____ _   _ __  __ _____       ____
     / ___ \               |  _ \ / ____|  __ \      / ____| \ | |  \/  |  __ \     |___ \
    / /  / /___  ___  ____ | |_) | (___ | |  | |    | (___ |  \| | \  / | |__) |_   ____) |
   / /  / / __ \/ _ \/ __ \|  _ < \___ \| |  | |     \___ \| . ` | |\/| |  ___/\ \ / /__ <
  / /__/ / /_/ /  __/ / / /| |_) |____) | |__| |     ____) | |\  | |  | | |     \ V /___) |
  \_____/ .___/\___/_/ /_/ |____/|_____/|_____/     |_____/|_| \_|_|  |_|_|      \_/|____/
       /_/
              |    .
          .   |L  /|   .       This script uses SNMPv3 to check memory/swap usage, file system
      _ . |\ _| \--+._/| .      space usage and CPU load average on (remote) OpenBSD system.
     / ||\| Y J  )   / |/| ./    It also shows detailed information about all avaliable file
    J  |)'( |        ` F`.'/     systems, and configured NICs, system information about OS
  -<|  F         __     .-<       and list of running processes.
    | /       .-'. `.  /-. L___
    J \      <    \  | | O\|.-'                           EXAMPLES:
  _J \  .-    \/ O | | \  |F
 '-F  --'  )._.   |-'             $./openbsd_snmp3.py -H IP_ADDRESS -u secName -A authPassword 
`-|.'   /_.           \_|   F           -a authProtocol -X privPassword -x privProtocol -O fs:/var 
  /.-   .                _.<           -w 80 -c 90
 /'    /.'             .'  `\
  /L  /'   |/      _.-'-\       Checks RAM usage (in %) with 'authNoPriv' secLevel:
 /'J       ___.---'\|           $./openbsd_snmp3.py -u secName -A authPassword -a authProtocol
   |\  .--' V  | `. `            -l authNoPriv -H  -O mem -w 60 -c 90
   |/`. `-.     `._)
      / .-.\                 Checks SWAP usage (in %) with 'noAuthNoPriv' secLevel:
      \ (  `\                  $./openbsd_snmp3.py -u secName -l noAuthNoPriv -H IP_ADDRESS 
       `.\                       -O swap -w 60 -c 90