Changes between Version 3 and Version 4 of OMDqemu

Show
Ignore:
Timestamp:
11/14/11 14:18:17 (8 years ago)
Author:
jonmills (IP: 152.54.3.30)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OMDqemu

    v3 v4  
    1616== The Check_MK native 'qemu' check == 
    1717 
    18  * The 'qemu' check gets installed on the monitoring host as $OMD_ROOT/share/check_mk/checks/qemu 
    19  
    20 {{{ 
    21 #!/usr/bin/python 
    22 # -*- encoding: utf-8; py-indent-offset: 4 -*- 
    23  
    24 # based upon 'qemu' from 
    25 # 12/2010 Matthias Henze 
    26 # 
    27 # updated for libvirtd (virsh) by 
    28 # Jonathan Mills 09/2011 
    29  
    30 # Example output from agent: 
    31 # <<<qemu>>> 
    32 # 4 i-4B9008BE running 2048 4.0 2.7 
    33 # 5 i-44F608B6 running 2048 0.0 0.7 
    34  
    35  
    36  
    37  
    38 # inventory 
    39 def inventory_qemu(checkname, info): 
    40     inventory = [] 
    41     for line in info: 
    42         if line[2] == "running":  # only VM's running while inventory are monitored ! 
    43             vm = line[1] # we want to capture hostname, not vm id here 
    44             inventory.append( (vm, None) ) 
    45     return inventory 
    46  
    47 # check 
    48 def check_qemu(name, param, info): 
    49     for line in info: 
    50         perfdata = [] 
    51         if line[1] == name: 
    52             item = line[0] 
    53             status = line[2] 
    54             ram = line[3] 
    55             infotext = "%s  (id: %s, ram: %s MB)" % (status, item, ram) 
    56             if status == "running": 
    57                 perfdata.append( ( "CPU%", int(round(float(line[4]))) ) ) 
    58                 perfdata.append( ( "RAM%", int(round(float(line[5]))) ) ) 
    59                 return (0, "OK - status is " + infotext, perfdata) 
    60             else: 
    61                 return (2, "CRITICAL - status is " + infotext, perfdata) 
    62     return (3, "UNKNOWN - VM %s not found in agent output" % item)  
    63  
    64 # declare the check to Check_MK 
    65 check_info['qemu'] = \ 
    66         (check_qemu, "VM %s", 1, inventory_qemu) 
    67 }}} 
    68  
     18 * Get the source from SVN 
     19  * [https://code.renci.org/gf/project/networkedclouds/scmsvn/nagios/?action=browse&path=%2Fnagios%2Ftrunk%2Fcheck_mk%2Fchecks%2Fqemu&view=markup qemu] 
     20 * The 'qemu' check gets installed on the monitoring host as $OMD_ROOT/local/share/check_mk/checks/qemu 
    6921 
    7022== Using the 'qemu' check ==