# Check OpenNebula virtual machines

## Introduction

**check_onevm** is a plugin to show count of vms in OpenNebula - listed by state and by host.

## Requirements

The icinga user needs sudo permissions on `onevm`.

```txt
icingaclient ALL=(ALL) NOPASSWD: /bin/onevm
```

## Syntax

`$ check_onevm` (without parameters)

### Parameters

```txt
./check_onevm -h
______________________________________________________________________

CHECK_ONEVM
v1.2

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

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

Show count of vms in OpenNebula - listed by state and by host.
It will go to warning if a non running state was found.
It will go to critical if a vm is on failure.

SYNTAX:
check_onevm

    -h or --help   show this help.

PARAMETERS:

    None.

```

### Examples

Without parameter:

```txt
./check_onevm
OK: OpenNebula VMs - Total: 32 .. running: 32 .. other: 0
>>>>>> By state
--- Running (runn): 32
The VM is running (note that this stage includes the internal virtualized machine booting and shutting down phases). In this state, the virtualization driver will periodically monitor it.
>>>>>> By host:
--- kvm1.ecample.com: 8
--- kvm2.ecample.com: 6
--- kvm3.ecample.com: 8
--- kvm4.ecample.com: 5
--- kvm5.ecample.com: 5

|total=32;; running=32;; fail=0;; unknown=0;; other=0;; 
```

If no vm was created yet the result is OK.

```txt
/check_onevm
OK: OpenNebula VMs - Total: 0 .. running: 0, Fail: 0, unknown: 0 .. other: 0
Info: no vm was created yet.
 |total=0;; running=0;; fail=0;; unknown=0;; other=0;; root@admin:one plugins# 
```