Returns all available alerters
198816
@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		if (alertingPlugin.getAlertSender() != null) {
			JsonUtils.writeJsonToOutputStream(alertingPlugin.getAlertSender().getAvailableAlerters(),
					resp.getOutputStream());
		} else {
			JsonUtils.writeJsonToOutputStream(Collections.emptyList(), resp.getOutputStream());
		}
	}
214121
def notify_all(self):
        """"""
        self.condition.acquire()
        # python 3.x
        try:
            self.condition.notify_all()
        except:
            self.condition.notifyAll()
        self.condition.release()
1373107
def get_alert(self, stat, header=""):
        """"""
        if not isinstance(stat['size'], numbers.Number):
            ret = 'DEFAULT'
        else:
            ret = 'OK'

            if stat['critical'] is not None and \
               stat['size'] > int(stat['critical']) * 1000000:
                ret = 'CRITICAL'
            elif stat['warning'] is not None and \
                    stat['size'] > int(stat['warning']) * 1000000:
                ret = 'WARNING'
            elif stat['careful'] is not None and \
                    stat['size'] > int(stat['careful']) * 1000000:
                ret = 'CAREFUL'

        # Get stat name
        stat_name = self.get_stat_name(header=header)

        # Manage threshold
        self.manage_threshold(stat_name, ret)

        # Manage action
        self.manage_action(stat_name,
                           ret.lower(),
                           header,
                           stat[self.get_key()])

        return ret
87852
public void getNewLines() {
        try {
            List<MonitorLine> lines;
            if (getAll()) {
                lines = getSource().getLinesFrom(null);
            } else {
                lines = getSource().getLinesFrom(actual);
            }
            updateLines(lines);
        } catch (Exception e) {
            notifyObservers(e);
        }
    }
1227050
def get_alert(self, alert_id):
        
        for alert in self.alerts:
            if alert.id == alert_id:
                return alert
        return None
1058639
@SuppressWarnings("javadoc")
    private static List<AbstractWarningsParser> all() {
        Hudson instance = Hudson.getInstance();
        if (instance == null) {
            return Lists.newArrayList();
        }
        List<AbstractWarningsParser> parsers = Lists.newArrayList(instance.getExtensionList(AbstractWarningsParser.class));
        addParsersWithDeprecatedApi(instance, parsers);

        return parsers;
    }
774262
@Override
	public List<CommerceNotificationAttachment> findAll() {
		return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}
337443
def alert(self, msg):
        """"""
        if self.event_callback is not None:
            try:
                self.event_callback(msg)
            except Exception as exception:  # pylint: disable=broad-except
                _LOGGER.exception(exception)

        if self.persistence:
            self.persistence.need_save = True
168070
async def listen_all_notifications(self, callback):
        
        everything = [noti.asdict() for noti in self.notifications]
        if len(everything) > 0:
            await self._methods["switchNotifications"](
                {"enabled": everything}, _consumer=callback
            )
        else:
            _LOGGER.debug("No notifications available for %s", self.name)
915305
def GetNotifications(self, queue):
    """"""
    queue_shard = self.GetNotificationShard(queue)
    return self._GetUnsortedNotifications(queue_shard).values()
18746
def get_notifications(self, start=None, stop=None, *args, **kwargs):
        
        filter_kwargs = {}
        # Todo: Also support sequencing by 'position' if items are sequenced by timestamp?
        if start is not None:
            filter_kwargs['%s__gte' % self.notification_id_name] = start + 1
        if stop is not None:
            filter_kwargs['%s__lt' % self.notification_id_name] = stop + 1
        objects = self.record_class.objects.filter(**filter_kwargs)

        if hasattr(self.record_class, 'application_name'):
            objects = objects.filter(application_name=self.application_name)
        if hasattr(self.record_class, 'pipeline_id'):
            objects = objects.filter(pipeline_id=self.pipeline_id)

        objects = objects.order_by('%s' % self.notification_id_name)
        return objects.all()
184950
def get_listeners(self, event_type: str) -> List[Callable]:
        """"""
        if event_type not in self.events:
            raise ValueError(f'No event {event_type} in system.')
        return self.events.get_listeners(event_type)
30937
def list_types(self):
        
        uri = "/notification_types"
        resp, resp_body = self.api.method_get(uri)
        return [CloudMonitorNotificationType(self, info)
                for info in resp_body["values"]]
725392
def check_alerts(self):
        """"""

        alerted = []

        for alert_time, task in self.alerts.items():
            task_time = dateutil.parser.parse(alert_time)
            if task_time < get_time():
                self.log('Alerting about task now:', task)

                address = objectmodels['user'].find_one({'uuid': task.owner}).mail
                subject = "Task alert: %s" % task.name
                text = """Task alert is due:\n%s""" % task.notes

                self.fireEvent(send_mail(address, subject, text))

                alerted.append(task.alert_time)

        for item in alerted:
            del self.alerts[item]
949468
def alerts(self):
        """"""
        endpoint = '/'.join((self.endpoint, self.id, 'alerts'))
        return self.alertFactory.find(
            endpoint=endpoint,
            api_key=self.api_key,
        )
893925
public function getAlerts()
    {
        if (count($this->_alerts) > 0) return $this->_alerts;
        if (!isset($this->_contentArray['alerts']) || !isset($this->_contentArray['alerts']['alert'])) return array();
        if (isset($this->_contentArray['alerts']['alert']['id'])) {
            $this->_alerts[$this->_contentArray['alerts']['alert']['id']] = $this->_contentArray['alerts']['alert'];
        } else {
            foreach ($this->_contentArray['alerts']['alert'] as $alert) {
                $this->_alerts[$alert['id']] = $alert;
            }
        }
        return $this->_alerts;
    }
687380
public function getListAlertsData()
    {
        $alerts = ArrayList::create();
        
        foreach ($this->getListAlerts() as $alert) {
            $alerts->push(ArrayData::create($alert));
        }
        
        return $alerts;
    }