def processResults(self, cmd, result):
    """
    Process the results for command "lsdrive -delim :".
    """
    update = False
    datapointMap = dict([(dp.id, dp) for dp in cmd.points])
    devname = cmd.deviceConfig.device

    # returned from datasource component field with ${here/id}
    componentid = cmd.component

    rresult = Utils.cmdParser(cmd.result.output,'id','DRIVE_ID')
    # specific component device
    rresult = rresult[componentid] 


    # drive status raise event
    if rresult['status']!='online': 
      result.events.append(Utils.getEvent(cmd,"Drive status not online",clear=False))
      update = True

    # drive error sequence number
    if rresult['error_sequence_number']!='': 
      result.events.append(Utils.getEvent(cmd,"Drive error sequence number: "+rresult['error_sequence_number'],clear=False))
      update = True
  
    # update current component if needed
    if update:
      scriptbase = ZenScriptBase(noopts = 1, connect = True)
      device = scriptbase.findDevice(devname)
      component = device.drives.findObjectsById(componentid)[0]
      component.drive_status=rresult['status']
      component.error_sequence_number=rresult['error_sequence_number']
      commit()
  def processResults(self, cmd, result):
    """
    Process the results for command "lseventlog -message no -fixed no -delim :".
    """
    
    devname = cmd.deviceConfig.device

    rresult = Utils.cmdParser(cmd.result.output,'event_id','EVT_ID')
  
    for key,evt in rresult.iteritems():
      result.events.append(Utils.getEvent(cmd,key+':'+evt['description'],clear=False))
  def processResults(self, cmd, result):
    
      
    """
    Process the results for command "lsenclosurebattery -delim :".
    """
    datapointMap = dict([(dp.id, dp) for dp in cmd.points])
    devname = cmd.deviceConfig.device
    # returned from datasource component field with ${here/id}
    componentid = cmd.component

    rresult = Utils.cmdParser(cmd.result.output,'battery_id','BAT_ID')

    # specific component device
    rresult = rresult[componentid] 

    
    # recondition_needed raise event
    if rresult['recondition_needed']!='no': 
      result.events.append(Utils.getEvent(cmd,"Battery recondition needed",clear=False))

    #Battery end of life warning raise event
    if rresult['end_of_life_warning']!='no': 
      result.events.append(Utils.getEvent(cmd,"Battery end of life warning",clear=False))

    
    # update current component
    # zencommand does not have direct access to the model and components but
    # maybe theres another way to do this
    
    scriptbase = ZenScriptBase(noopts = 1, connect = True)
    device = scriptbase.findDevice(devname)
    component = device.batteries.findObjectsById(componentid)[0]
    component.battery_status=rresult['status']
    component.charging_status=rresult['charging_status']
    component.recondition_needed=rresult['recondition_needed']
    component.percent_charged=int(rresult['percent_charged'])
    component.end_of_life_warning=rresult['end_of_life_warning']
    commit()
Exemple #4
0
    def processResults(self, cmd, result):
        """
    Process the results for command "lsdrive -delim :".
    """
        update = False
        datapointMap = dict([(dp.id, dp) for dp in cmd.points])
        devname = cmd.deviceConfig.device

        # returned from datasource component field with ${here/id}
        componentid = cmd.component

        rresult = Utils.cmdParser(cmd.result.output, 'id', 'DRIVE_ID')
        # specific component device
        rresult = rresult[componentid]

        # drive status raise event
        if rresult['status'] != 'online':
            result.events.append(
                Utils.getEvent(cmd, "Drive status not online", clear=False))
            update = True

        # drive error sequence number
        if rresult['error_sequence_number'] != '':
            result.events.append(
                Utils.getEvent(cmd,
                               "Drive error sequence number: " +
                               rresult['error_sequence_number'],
                               clear=False))
            update = True

        # update current component if needed
        if update:
            scriptbase = ZenScriptBase(noopts=1, connect=True)
            device = scriptbase.findDevice(devname)
            component = device.drives.findObjectsById(componentid)[0]
            component.drive_status = rresult['status']
            component.error_sequence_number = rresult['error_sequence_number']
            commit()
Exemple #5
0
    def processResults(self, cmd, result):
        """
    Process the results for command "lseventlog -message no -fixed no -delim :".
    """

        devname = cmd.deviceConfig.device

        rresult = Utils.cmdParser(cmd.result.output, 'event_id', 'EVT_ID')

        for key, evt in rresult.iteritems():
            result.events.append(
                Utils.getEvent(cmd,
                               key + ':' + evt['description'],
                               clear=False))