535
536
**Optional Parameters:**
537
538
-| Parameter | Purpose | Details |
539
-|--------------------|-----------------------------|----------------------------------------------------------------------|
538
+| Parameter | Purpose | Details |
539
+|--------------------|-----------------------------|----------------------------------------------------------------------------|
540
| `GROUPING OPTIONS` | Conditional processing | `CONDITION VALUE` where condition is `!=`, `=`, `==`, `<=`, `<`, `>`, `>=` |
541
-| `at BEFORE` | End of lookup timeframe | Default is 0 (now) |
542
-| `every DURATION` | Update frequency | Supports `s`, `m`, `h`, `d` units |
543
-| `OPTIONS` | Processing modifiers | See options table below |
544
-| `of DIMENSIONS` | Which dimensions to include | Space-separated list, supports patterns |
541
+| `at BEFORE` | End of lookup timeframe | Default is 0 (now) |
542
+| `every DURATION` | Update frequency | Supports `s`, `m`, `h`, `d` units |
543
+| `OPTIONS` | Processing modifiers | See options table below |
544
+| `of DIMENSIONS` | Which dimensions to include | Space-separated list, supports patterns |
545
546
**Processing Options:**
547
895
|------------|----------------------------------------|---------------------------|
896
| Arithmetic | `+`, `-`, `*`, `/` | Numeric values |
897
| Comparison | `<`, `==`, `<=`, `<>`, `!=`, `>`, `>=` | `1` (true) or `0` (false) |
898
-| Logical | `&&`, `||`, `!`, `AND`, `OR`, `NOT` | `1` (true) or `0` (false) |
898
+| Logical | `&&`, `||`,`!`,`AND`,`OR`,`NOT` | `1` (true) or `0` (false) |
899
900
**Special Functions:**
901
1489
**Debug Steps:**
1490
1491
1. **Check Available Variables:**
1492
+
1493
```
1494
http://NODE:19999/api/v1/alarm_variables?chart=CHART_NAME
1495
```
1508
**Safe Testing Process:**
1509
1510
1. **Create Test File:**
1511
+
1512
```bash
1513
sudo touch health.d/test-alert.conf
1514
sudo ./edit-config health.d/test-alert.conf
1515
```
1516
1517
2. **Write Simple Alert:**
1518
+
1519
```text
1520
alarm: test_ram
1521
on: system.ram
1526
```
1527
1528
3. **Reload and Monitor:**
1529
+
1530
```bash
1531
sudo netdatacli reload-health
1532
# Watch dashboard for test alert appearance
1533
```
1534
1535
4. **Remove When Done:**
1536
+
1537
```bash
1538
sudo rm health.d/test-alert.conf
1539
sudo netdatacli reload-health
1565
When seeking help, include:
1566
1567
1. **Alert Configuration:**
1568
+
1569
```text
1570
# Your complete alert definition
1571
```
1572
1573
2. **Chart Information:**
1574
+
1575
```
1576
http://your-server:19999/api/v1/alarm_variables?chart=chart_name
1577
```
1578
1579
3. **Current Status:**
1580
+
1581
```
1582
http://your-server:19999/api/v1/alarms?all
1583
```
1588
- [Netdata Community Forum](https://community.netdata.cloud)
1589
- [Netdata Discord](https://discord.com/invite/2mEmfW735j)
1590
1591
+### Alert Notification Variables
1592
+
1593
+The following variables are available in alert notification templates and custom notification scripts:
1594
+
1595
+| Variable name | Description |
1596
+|:---------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------|
1597
+| `${alarm}` | Like "name = value units" |
1598
+| `${status_message}` | Like "needs attention", "recovered", "is critical" |
1599
+| `${severity}` | Like "Escalated to CRITICAL", "Recovered from WARNING" |
1600
+| `${raised_for}` | Like "(alarm was raised for 10 minutes)" |
1601
+| `${host}` | The host generated this event |
1602
+| `${url_host}` | Same as `${host}` but URL encoded |
1603
+| `${unique_id}` | The unique id of this event |
1604
+| `${alarm_id}` | The unique id of the alarm that generated this event |
1605
+| `${event_id}` | The incremental id of the event, for this alarm id |
1606
+| `${when}` | The timestamp this event occurred |
1607
+| `${date}` | The date and time the event occurred (local timezone) |
1608
+| `${date_utc}` | The date and time the event occurred (UTC) |
1609
+| `${name}` | The name of the alarm, as given in netdata health.d entries |
1610
+| `${url_name}` | Same as `${name}` but URL encoded |
1611
+| `${chart}` | The name of the chart (type.id) |
1612
+| `${url_chart}` | Same as `${chart}` but URL encoded |
1613
+| `${status}` | The current status: REMOVED, UNINITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL |
1614
+| `${old_status}` | The previous status: REMOVED, UNINITIALIZED, UNDEFINED, CLEAR, WARNING, CRITICAL |
1615
+| `${value}` | The current value of the alarm |
1616
+| `${old_value}` | The previous value of the alarm |
1617
+| `${src}` | The line number and file the alarm has been configured |
1618
+| `${duration}` | The duration in seconds of the previous alarm state |
1619
+| `${duration_txt}` | Same as `${duration}` for humans |
1620
+| `${non_clear_duration}` | The total duration in seconds this is/was non-clear. For repeating alerts in WARNING or CRITICAL state, Netdata sends `${duration}` instead. |
1621
+| `${non_clear_duration_txt}` | Same as `${non_clear_duration}` for humans |
1622
+| `${units}` | The units of the value |
1623
+| `${info}` | A short description of the alarm |
1624
+| `${value_string}` | Friendly value (with units) |
1625
+| `${old_value_string}` | Friendly old value (with units) |
1626
+| `${image}` | The URL of an image to represent the status of the alarm |
1627
+| `${color}` | A color in #AABBCC format for the alarm |
1628
+| `${goto_url}` | The URL the user can click to see the netdata dashboard |
1629
+| `${calc_expression}` | The expression evaluated to provide the value for the alarm |
1630
+| `${calc_param_values}` | The values of the variables in the evaluated expression |
1631
+| `${total_warnings}` | The total number of alarms in WARNING state on the host |
1632
+| `${total_critical}` | The total number of alarms in CRITICAL state on the host |
1633
+
1634
## Related Pages
1635
1636
- [Alerts Automation](/docs/netdata-ai/alerts-automation/alerts-automation.md) - Create and tune alerts using natural language with AI assistance (no manual configuration needed)