Changes between Version 1 and Version 2 of OMDpost-install-checklist

Show
Ignore:
Timestamp:
10/03/11 17:09:41 (8 years ago)
Author:
jonmills (IP: 152.54.8.104)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OMDpost-install-checklist

    v1 v2  
    5050Add this check so that you can use Check_MK to inventory the VMs hosted by the KVM hypervisor. 
    5151 
     52Contents of ~/share/check_mk/checks/qemu: 
     53{{{ 
     54# inventory 
     55def inventory_qemu(checkname, info): 
     56    inventory = [] 
     57    for line in info: 
     58        if line[2] == "running":  # only VM's running while inventory are monitored ! 
     59            vm = line[1] # we want to capture hostname, not vm id here 
     60            inventory.append( (vm, None) ) 
     61    return inventory 
     62 
     63# check 
     64def check_qemu(name, param, info): 
     65    for line in info: 
     66        perfdata = [] 
     67        if line[1] == name: 
     68            item = line[0] 
     69            status = line[2] 
     70            ram = line[3] 
     71            infotext = "%s  (id: %s, ram: %s MB)" % (status, item, ram) 
     72            if status == "running": 
     73                perfdata.append( ( "CPU%", int(round(float(line[4]))) ) ) 
     74                perfdata.append( ( "RAM%", int(round(float(line[5]))) ) ) 
     75                return (0, "OK - status is " + infotext, perfdata) 
     76            else: 
     77                return (2, "CRITICAL - status is " + infotext, perfdata) 
     78    return (3, "UNKNOWN - VM %s not found in agent output" % item)  
     79 
     80# declare the check to Check_MK 
     81check_info['qemu'] = \ 
     82        (check_qemu, "VM %s", 1, inventory_qemu) 
     83}}} 
     84 
    5285== ~/.euca[/eucarc] ==  
    5386(so omd user can run euca commands)