<commit_before>===============
Realtime Alerts
===============

.. note::
   Realtime alerting features are in Early Access and are not yet available
   to all customers. You can read more about the Early Access program 
   `here <https://blog.tempoiq.com/introducing-the-tempoiq-early-access-program>`_.
   If you're interested in joining the Early Access program, please 
   `contact us <https://www.tempoiq.com/contact/>`_.


This guide shows you how to use TempoIQ's Realtime Alert system to
actively monitor your device infrastructure. At the moment, The
TempoIQ Alerting system supports the following alerting criteria:

- Simple threshold *above* a static value
- Simple threshold *below* a static value

The Alert system features the following supported alert scopes:

- Alert on all sensors with a given key
- Alert on any sensor from a subset of devices

Notification Methods
--------------------

The TempoIQ Alerting system supports the following notification
methods for receiving alerts:

- Email
- Webhook

For each notification method, you can expect to receive two event
types:

1. *ALERT*: Sent when a datapoint from a sensor meets the criteria of
   the rule. 
2. *OK*: Sent when a datapoint from a sensor recovers to within the
   rule's criteria.

For information regarding webhooks, see the :doc:`reference documentation for webhooks </reference/objects/webhook>`.

Examples
--------

To work with Realtime Alerts, click the "Rule List" link under the
Realtime header in your developer console.

.. image:: /images/dev_console.png

From there, you'll see a list of your active rules, which you can view
and edit by clicking on them. Otherwise, you can create a new Realtime
Alert.

.. image:: /images/rule_list.png

Sensor Type Monitoring
~~~~~~~~~~~~~~~~~~~~~~

If you want to monitor all sensors of a specific key, fill out only
the "Sensor Key" form field from the Rule Create page:

.. image:: /images/temp_simple.png

For example, if you want to receive an alert whenever a temperature sensor
from any thermostat falls below a certain threshold, the input values
might look something something like this:

- Sensor Key: *temp*
- Sensor value: *less than*
- Threshold: *80*<commit_msg>document requestbin for webhooks<commit_after>===============
Realtime Alerts
===============

.. note::
   Realtime alerting features are in Early Access and are not yet available
   to all customers. You can read more about the Early Access program 
   `here <https://blog.tempoiq.com/introducing-the-tempoiq-early-access-program>`_.
   If you're interested in joining the Early Access program, please 
   `contact us <https://www.tempoiq.com/contact/>`_.


This guide shows you how to use TempoIQ's Realtime Alert system to
actively monitor your device infrastructure. At the moment, The
TempoIQ Alerting system supports the following alerting criteria:

- Simple threshold *above* a static value
- Simple threshold *below* a static value

The Alert system features the following supported alert scopes:

- Alert on all sensors with a given key
- Alert on any sensor from a subset of devices

Notification Methods
--------------------

The TempoIQ Alerting system supports the following notification
methods for receiving alerts:

- Email
- Webhook

For each notification method, you can expect to receive two event
types:

1. *ALERT*: Sent when a datapoint from a sensor meets the criteria of
   the rule. 
2. *OK*: Sent when a datapoint from a sensor recovers to within the
   rule's criteria.

For information regarding webhooks, see the :doc:`reference documentation for webhooks </reference/objects/webhook>`.

Prototyping With Webhooks
-------------------------

To receive a webhook, you must have a server with access to the internet that 
can handle a POST request to the URL with which you configured your rule.  If 
you do not already have a server set up, a quick way to prototype your rule is 
to use a RequestBin to receive webhooks from TempoIQ.

You can set up a RequestBin by visiting `requestb.in <http://requestb.in/>`_.  
Simply click the green "Create a RequestBin" button to generate one.  You can 
optionally make your RequestBin private by clicking the checkbox below the 
button.  This restricts access to your RequestBin by cookie.

Once your RequestBin has been created, you can copy the URL provided into the 
rule definition through the TempoIQ console.  All alerts events generated by 
that rule will be sent to your RequestBin.  Once you are ready to send the 
traffic to your own server, you can change the URL for the rule in the TempoIQ 
console, and you will immediately begin receiving alert events at the updated 
URL.

.. note::
   RequestBins cannot receive HTTPS traffic.  If you are concerned that 
   webhooks from TempoIQ could contain sensitive information (e.g. if an 
   alerting sensor has a customer address in its attributes), then directing 
   the webhooks to your own HTTPS-enabled web servers is necessary.

Examples
--------

To work with Realtime Alerts, click the "Rule List" link under the
Realtime header in your developer console.

.. image:: /images/dev_console.png

From there, you'll see a list of your active rules, which you can view
and edit by clicking on them. Otherwise, you can create a new Realtime
Alert.

.. image:: /images/rule_list.png

Sensor Type Monitoring
~~~~~~~~~~~~~~~~~~~~~~

If you want to monitor all sensors of a specific key, fill out only
the "Sensor Key" form field from the Rule Create page:

.. image:: /images/temp_simple.png

For example, if you want to receive an alert whenever a temperature sensor
from any thermostat falls below a certain threshold, the input values
might look something something like this:

- Sensor Key: *temp*
- Sensor value: *less than*
- Threshold: *80*
{'fraction_non_alphanumeric': 0.08278603525751815, 'fraction_numerical': 0.00138264777048047, 'mean_word_length': 3.850796311818944, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3931892', 'n_tokens_mistral': 1549, 'n_tokens_neox': 1475, 'n_words': 812}