Describe the alarm.
544534
def do_alarm_show(mc, args):
    ''''''
    fields = {}
    fields['alarm_id'] = args.id
    try:
        alarm = mc.alarms.get(**fields)
    except (osc_exc.ClientException, k_exc.HttpError) as he:
        raise osc_exc.CommandError('%s\n%s' % (he.message, he.details))
    else:
        if args.json:
            print(utils.json_formatter(alarm))
            return
        # print out detail of a single alarm
        formatters = {
            'id': utils.json_formatter,
            'alarm_definition': utils.json_formatter,
            'metrics': utils.json_formatter,
            'state': utils.json_formatter,
            'links': utils.format_dictlist,
        }
        utils.print_dict(alarm, formatters=formatters)
567161
def main():
    
    alarm = XBeeAlarm('/dev/ttyUSB0', '\x56\x78')
    routine = SimpleWakeupRoutine(alarm)

    from time import sleep
    while True:
        """
        Run the routine with 10 second delays
        """
        try:
            print "Waiting 5 seconds..."
            sleep(5)
            print "Firing"
            routine.trigger()
        except KeyboardInterrupt:
            break
1220471
def get_alert_log(self,
                      current=0,
                      minimum=0,
                      maximum=100,
                      header="",
                      action_key=None):
        """"""
        return self.get_alert(current=current,
                              minimum=minimum,
                              maximum=maximum,
                              header=header,
                              action_key=action_key,
                              log=True)
936892
private void checkAlarms(final ZonedDateTime TIME) {
        alarmsToRemove.clear();
        for (Alarm alarm : alarms) {
            final ZonedDateTime ALARM_TIME = alarm.getTime();
            switch (alarm.getRepetition()) {
                case ONCE:
                    if (TIME.isAfter(ALARM_TIME)) {
                        if (alarm.isArmed()) {
                            fireAlarmEvent(new AlarmEvent(Clock.this, alarm));
                            alarm.executeCommand();
                        }
                        alarmsToRemove.add(alarm);
                    }
                    break;
                case HALF_HOURLY:
                    if ((ALARM_TIME.getMinute() == TIME.getMinute() ||
                        ALARM_TIME.plusMinutes(30).getMinute() == TIME.getMinute()) &&
                        ALARM_TIME.getSecond() == TIME.getSecond()) {
                        if (alarm.isArmed()) {
                            fireAlarmEvent(new AlarmEvent(Clock.this, alarm));
                            alarm.executeCommand();
                        }
                    }
                    break;
                case HOURLY:
                    if (ALARM_TIME.getMinute() == TIME.getMinute() &&
                        ALARM_TIME.getSecond() == TIME.getSecond()) {
                        if (alarm.isArmed()) {
                            fireAlarmEvent(new AlarmEvent(Clock.this, alarm));
                            alarm.executeCommand();
                        }
                    }
                    break;
                case DAILY:
                    if (ALARM_TIME.getHour()   == TIME.getHour() &&
                        ALARM_TIME.getMinute() == TIME.getMinute() &&
                        ALARM_TIME.getSecond() == TIME.getSecond()) {
                        if (alarm.isArmed()) {
                            fireAlarmEvent(new AlarmEvent(Clock.this, alarm));
                            alarm.executeCommand();
                        }
                    }
                    break;
                case WEEKLY:
                    if (ALARM_TIME.getDayOfWeek() == TIME.getDayOfWeek() &&
                        ALARM_TIME.getHour()      == TIME.getHour() &&
                        ALARM_TIME.getMinute()    == TIME.getMinute() &&
                        ALARM_TIME.getSecond()    == TIME.getSecond()) {
                        if (alarm.isArmed()) {
                            fireAlarmEvent(new AlarmEvent(Clock.this, alarm));
                            alarm.executeCommand();
                        }
                    }
                    break;
            }
        }
        for (Alarm alarm : alarmsToRemove) {
            removeAlarm(alarm);
        }
    }
212502
async def get_alarms():
    """"""
    async with aiohttp.ClientSession() as session:
        ghlocalapi = Alarms(LOOP, session, IPADDRESS)
        await ghlocalapi.get_alarms()

        print("Alarms:", ghlocalapi.alarms)
346058
public void alarm(Object context)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
    	SibTr.entry(this, tc, "alarm", context);
    
    btmLockManager.lock();
    boolean btmLocked = true;
    timeoutLockManager.lockExclusive();
    boolean timeoutLocked = true;
    try
    {
      //we won't be called unless there are alarms which have timedout but check anyway
      if (!timedout.isEmpty() && !isStopped)
      {
        btmLockManager.unlock();
        btmLocked = false;
        //see defect 280069:
        //So that we can release the exclusive lock before calling processTimedoutEntries
        //(and so avoid deadlock on streamStatus monitor) we take a local copy 
        //(which therefore cannot be modified by anyone behind us) and create 
        //a new list; this replaces holding the exclusive lock for the duration of the method
        //and then clearing the list at the end. 
        
        List tempTimeoutList = timedout; //take a local copy of the list
        
        timedout = new ArrayList<BatchedTimeoutEntry>(); //the timeout entries will be dealt with
        //presently. Meantime we empty the timedout list so that subsequent timeouts
        //can be added to it without affecting processTimedoutEntries
        
        timeoutLockManager.unlockExclusive(); //we no longer care if timedout
        timeoutLocked = false;
        //changes underneath us so we can release the exclusive lock.

        try
        {
          //call the processor with the list of timedout BTEs, which should not be changed
          handler.processTimedoutEntries(tempTimeoutList);
          
          // We had a good batch - clear any previous failures
          batchFailed = false;
          batchCleared = false;
        }
        catch(Throwable e)
        {
          // FFDC the problem with the alarm, but don't re-throw the exception
          FFDCFilter.processException(
            e,
            "com.ibm.ws.sib.processor.utils.am.BatchedTimeoutManager.alarm",
            "1:280:1.24",
            new Object[] {this, handler, tempTimeoutList});
          
          SibTr.exception(tc, e);          
          
          // Alarms registered with the BatchedTimeoutManager are set to auto-repeat,
          // if we simply report the failure in an alarm it'll probably happen again
          // and again, forever. So we need to take steps to stop that happening, by
          // removing entries and possibly even stopping the manager (athough as a manager
          // is specific to a certain object (e.g. a specific AOStream) the damage should 
          // be contained - although still serious.
          
          // We worked the previous time so we'll give the alarms one more try before
          // bombing out
          if(!batchFailed)
            batchFailed = true;
         // If we've failed before, this was our last chance, something is wrong with
          // at least one of the entries, but we can't tell which one so we'll have to
          // remove all the entries - which will stop the error happening over and over
          // again (but not fix the reason for the error!)
          else
          {
            batchFailed = false;
            
            // Remove all the entries and see if that stops the error happening
            Iterator itr = tempTimeoutList.iterator();
            while(itr.hasNext())
            {
              BatchedTimeoutEntry bte = (BatchedTimeoutEntry)itr.next();
              removeTimeoutEntry(bte);
            }

            // If we've already been here and cleared the entries but something has
            // reregistered a new alarm that caused another problem (probably the same
            // one) we just give up and stop the alarm manager to prevent new alarms
            // being registered
            if(batchCleared)
            {
              // This is serious, throw another FFDC
              SIErrorException e2 =
                new SIErrorException(
                  nls.getFormattedMessage(
                    "INTERNAL_MESSAGING_ERROR_CWSIP0001",
                    new Object[] {
                      "com.ibm.ws.sib.processor.utils.am.BatchedTimeoutManager.alarm",
                      "1:325:1.24" },
                    null), e);
              
              FFDCFilter.processException(
                e2,
                "com.ibm.ws.sib.processor.utils.am.BatchedTimeoutManager.alarm",
                "1:331:1.24",
                this);
              
              SibTr.exception(tc, e2);
              
              // Stop the timer
              stopTimer();
            }
            // Remember that we've just cleared up after a problem
            else
              batchCleared = true;
          }
        }
        //restart the entries
        restartEntries(tempTimeoutList);      
      }
    }
    finally
    {
      if(timeoutLocked)
        timeoutLockManager.unlockExclusive();
      if(btmLocked)
        btmLockManager.unlock();
    }
        
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
    	SibTr.exit(tc, "alarm");
  }
791389
function Alert() {
        this.mode = LiteGraph.ON_EVENT;
        this.addProperty("msg", "");
        this.addInput("", LiteGraph.EVENT);
        var that = this;
        this.widget = this.addWidget("text", "Text", "", function(v) {
            that.properties.msg = v;
        });
        this.widgets_up = true;
        this.size = [200, 30];
    }
619134
def create_alarm(self, check, notification_plan, criteria=None,
            disabled=False, label=None, name=None, metadata=None):
        
        return self._alarm_manager.create(check, notification_plan,
                criteria=criteria, disabled=disabled, label=label, name=name,
                metadata=metadata)
1319425
def update_alarm(self, alarm, criteria=None, disabled=False,
            label=None, name=None, metadata=None):
        
        return self._alarm_manager.update(alarm, criteria=criteria,
                disabled=disabled, label=label, name=name, metadata=metadata)
683608
def do_alarm_definition_patch(mc, args):
    ''''''
    fields = {}
    fields['alarm_id'] = args.id
    if args.name:
        fields['name'] = args.name
    if args.description:
        fields['description'] = args.description
    if args.expression:
        fields['expression'] = args.expression
    if args.alarm_actions:
        fields['alarm_actions'] = _arg_split_patch_update(args.alarm_actions, patch=True)
    if args.ok_actions:
        fields['ok_actions'] = _arg_split_patch_update(args.ok_actions, patch=True)
    if args.undetermined_actions:
        fields['undetermined_actions'] = _arg_split_patch_update(args.undetermined_actions,
                                                                 patch=True)
    if args.actions_enabled:
        if args.actions_enabled not in enabled_types:
            errmsg = ('Invalid value, not one of [' +
                      ', '.join(enabled_types) + ']')
            print(errmsg)
            return
        fields['actions_enabled'] = args.actions_enabled in ['true', 'True']
    if args.severity:
        if not _validate_severity(args.severity):
            return
        fields['severity'] = args.severity
    try:
        alarm = mc.alarm_definitions.patch(**fields)
    except (osc_exc.ClientException, k_exc.HttpError) as he:
        raise osc_exc.CommandError('%s\n%s' % (he.message, he.details))
    else:
        print(jsonutils.dumps(alarm, indent=2))
425466
def notify():
    """"""
    a = TpPd(pd=0x3)
    b = MessageType(mesType=0x3e)  # 00111110
    c = NotificationIndicator()
    packet = a / b / c
    return packet
1362384
def get_alerts_unarchived(self):
        """"""

        js = json.dumps({'_sort': '-time', 'archived': False})
        params = urllib.urlencode({'json': js})
        return self._read(self.api_url + 'list/alarm', params)
1082047
private void handleAlarm()
  {
    AlarmListener listener = getListener();

    if (listener == null) {
      return;
    }

    Thread thread = Thread.currentThread();
    ClassLoader loader = getContextLoader();

    if (loader != null) {
      thread.setContextClassLoader(loader);
    }
    else {
      thread.setContextClassLoader(_systemLoader);
    }

    try {
      listener.handleAlarm(this);
    } finally {
      thread.setContextClassLoader(_systemLoader);
    }
  }
1346699
public void alarm(Object handle)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "alarm", handle);

    synchronized (this)
    {
      keepAliveAlarmHandle =
        am.create(parent.getMessageProcessor().getCustomProperties().get_browse_liveness_timeout(), this);
      parent.sendBrowseStatus(SIMPConstants.BROWSE_ALIVE, browseId);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "alarm");
  }
261451
def alerts(self, alert_level='High'):
        """"""
        alerts = self.zap.core.alerts()
        alert_level_value = self.alert_levels[alert_level]

        alerts = sorted((a for a in alerts if self.alert_levels[a['risk']] >= alert_level_value),
                        key=lambda k: self.alert_levels[k['risk']], reverse=True)

        return alerts
253238
protected void handleAlert(Alert alert) {
        if (LOGGEER.isDebugEnabled()) {
            LOGGEER.debug("Accepting alert box with message: {}", alert.getText());
        }
        alert.accept();
    }
21193
def _alarms_present(name, min_size_equals_max_size, alarms, alarms_from_pillar, region, key, keyid, profile):
    '''
    
    '''
    # load data from alarms_from_pillar
    tmp = copy.deepcopy(__salt__['config.option'](alarms_from_pillar, {}))
    # merge with data from alarms
    if alarms:
        tmp = dictupdate.update(tmp, alarms)
    # set alarms, using boto_cloudwatch_alarm.present
    merged_return_value = {'name': name, 'result': True, 'comment': '', 'changes': {}}
    for _, info in six.iteritems(tmp):
        # add asg to name and description
        info['name'] = name + ' ' + info['name']
        info['attributes']['description'] = name + ' ' + info['attributes']['description']
        # add dimension attribute
        if 'dimensions' not in info['attributes']:
            info['attributes']['dimensions'] = {'AutoScalingGroupName': [name]}
        scaling_policy_actions_only = True
        # replace ":self:" with our name
        for action_type in ['alarm_actions', 'insufficient_data_actions', 'ok_actions']:
            if action_type in info['attributes']:
                new_actions = []
                for action in info['attributes'][action_type]:
                    if 'scaling_policy' not in action:
                        scaling_policy_actions_only = False
                    if ':self:' in action:
                        action = action.replace(':self:', ':{0}:'.format(name))
                    new_actions.append(action)
                info['attributes'][action_type] = new_actions
        # skip alarms that only have actions for scaling policy, if min_size == max_size for this ASG
        if scaling_policy_actions_only and min_size_equals_max_size:
            continue
        # set alarm
        kwargs = {
            'name': info['name'],
            'attributes': info['attributes'],
            'region': region,
            'key': key,
            'keyid': keyid,
            'profile': profile,
        }
        results = __states__['boto_cloudwatch_alarm.present'](**kwargs)
        if not results['result']:
            merged_return_value['result'] = False
        if results.get('changes', {}) != {}:
            merged_return_value['changes'][info['name']] = results['changes']
        if 'comment' in results:
            merged_return_value['comment'] += results['comment']
    return merged_return_value