Пример #1
0
def retrieve_health(configmanager, creds, node, results, element):
    wc = WebClient(node, configmanager, creds)
    hinfo = wc.fetch('/affluent/health', results)
    if hinfo:
        results.put(
            msg.HealthSummary(hinfo.get('health', 'unknown'), name=node))
        results.put(msg.SensorReadings(hinfo.get('sensors', []), name=node))
Пример #2
0
 def health(self):
     if 'read' == self.op:
         try:
             response = self.ipmicmd.get_health()
         except pygexc.IpmiException:
             self.output.put(msg.ConfluentTargetTimeout(self.node))
             return
         health = response['health']
         health = _str_health(health)
         self.output.put(msg.HealthSummary(health, self.node))
         if 'badreadings' in response:
             badsensors = []
             for reading in response['badreadings']:
                 if hasattr(reading, 'health'):
                     reading.health = _str_health(reading.health)
                 badsensors.append(reading)
             self.output.put(msg.SensorReadings(badsensors, name=self.node))
     else:
         raise exc.InvalidArgumentException('health is read-only')
Пример #3
0
def retrieve_health(configmanager, creds, node, results):
    wc = cnos_login(node, configmanager, creds)
    hinfo = wc.grab_json_response('/nos/api/sysinfo/globalhealthstatus')
    summary = hinfo['status'].lower()
    if summary == 'noncritical':
        summary = 'warning'
    results.put(msg.HealthSummary(summary, name=node))
    state = None
    badreadings = []
    if summary != 'ok':  # temperature or dump or fans or psu
        wc.grab_json_response('/nos/api/sysinfo/panic_dump')
        switchinfo = wc.grab_json_response('/nos/api/sysinfo/panic_dump')
        if switchinfo:
            badreadings.append(
                SwitchSensor('Panicdump', ['Present'], health='warning'))
        switchinfo = wc.grab_json_response('/nos/api/sysinfo/temperatures')
        for temp in switchinfo:
            if temp == 'Temperature threshold':
                continue
            if switchinfo[temp]['State'] != 'OK':
                temphealth = switchinfo[temp]['State'].lower()
                if temphealth == 'noncritical':
                    temphealth = 'warning'
                tempval = switchinfo[temp]['Temp']
                badreadings.append(
                    SwitchSensor(temp, [], value=tempval, health=temphealth))
        switchinfo = wc.grab_json_response('/nos/api/sysinfo/fans')
        for fan in switchinfo:
            if switchinfo[fan]['speed-rpm'] < 100:
                badreadings.append(
                    SwitchSensor(fan, [],
                                 value=switchinfo[fan]['speed-rpm'],
                                 health='critical'))
        switchinfo = wc.grab_json_response('/nos/api/sysinfo/power')
        for psu in switchinfo:
            if switchinfo[psu]['State'] != 'Normal ON':
                psuname = switchinfo[psu]['Name']
                badreadings.append(
                    SwitchSensor(psuname,
                                 states=[switchinfo[psu]['State']],
                                 health='critical'))
    results.put(msg.SensorReadings(badreadings, name=node))