Check OpenNebula hosts

Script: check_onehost

check_onevm is a plugin to show count of hosts in OpenNebula and warn if a host is down.

Requirements

The icinga user needs sudo permissions on onehost.

icingaclient ALL=(ALL) NOPASSWD: /bin/onehost

Standalone installation

From this repository ypu need next to this script:

  • inc_pluginfunctions shared function for all IML checks written in bash

Syntax

$ check_onevm [-c CRITICAL] [-w WARING]

Parameters

./check_onehost -h
______________________________________________________________________

CHECK_ONEHOST
v1.3

(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3

https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_onehost.html
______________________________________________________________________

Show count of hosts in OpenNebula and warn if a host is disabled or on error.
It switches to critical if more than a given critical level are not running.

SYNTAX:
check_onehost [ -w value -c value -h ]

    -w VALUE       warning level  (default: 1)
    -c VALUE       critical level (default: 2)
    -h or --help   show this help.

PARAMETERS:

    None.

EXAMPLE:
check_onehost -c 1   set to critical if the 1st host is off.

Example

Without parameter we get a warning if the 1st host is disabled or on error. ./check_onehost returns

WARNING: ONEHOST - Total: 5 .. on: 4 .. disabled: 1 ... other: 0
ID,NAME,CLUSTER,TVM,ALLOCATED_CPU,ALLOCATED_MEM,STAT
4,kvm5.example.com,default,11,1930 / 2400 (80%),76G / 503.1G (15%),dsbl
3,kvm4.example.com,default,2,400 / 2400 (16%),5G / 503.1G (0%),on
2,kvm3.example.com,default,9,1600 / 2400 (66%),55G / 251.1G (21%),on
1,kvm2.example.com,default,14,1770 / 2400 (73%),71.5G / 188.1G (38%),on
0,kvm1.example.com,default,16,2380 / 2400 (99%),75G / 188.1G (39%),on
WARNING: not all hosts are up - count 1 reached warning value 1
 |total=5;; on=4;; disabled=1;; other=0;;