Health Read API
NetData enables alarms on demand, i.e. when the chart they should be linked to starts collecting data. So, although many more alarms are configured, only the useful ones are enabled.
To get the list of all enabled alarms:
This API call will return the alarms currently in WARNING or CRITICAL state.
The size of the alarm log is configured in
netdata.conf. There are 2 settings: the rotation of the alarm log file and the in memory size of the alarm log.
The API call retrieves all entries of the alarm log:
Alarm Log Incremental Updates
The above returns all the events in the alarm log that occurred after UNIQUEID (you poll it once without
after=, remember the last UNIQUEID of the returned set, which you give back to get incrementally the next events).
The following will return an SVG badge of the alarm named
NAME, attached to the chart named
Health Management API
Netdata v1.12 and beyond provides a command API to control health checks and notifications at runtime. The feature is especially useful for maintenance periods, during which you receive meaningless alarms. From Netdata v1.16.0 and beyond, the configuration controlled via the API commands is persisted across Netdata restarts.
Specifically, the API allows you to:
- Disable health checks completely. Alarm conditions will not be evaluated at all and no entries will be added to the alarm log.
- Silence alarm notifications. Alarm conditions will be evaluated, the alarms will appear in the log and the Netdata UI will show the alarms as active, but no notifications will be sent.
- Disable or Silence specific alarms that match selectors on alarm/template name, chart, context, host and family.
The API is available by default, but it is protected by an
api authorization token that is stored in the file you will see in the following entry of
You can access the API via GET requests, by adding the bearer token to an
Authorization http header, like this:
By default access to the health management API is only allowed from
localhost. Accessing the API from anything else will return a 403 error with the message
You are not allowed to access this resource.. You can change permissions by editing the
allow management from variable in
netdata.conf within the [web] section. See web server access lists for more information.
RESET just returns Netdata to the default operation, with all health checks and notifications enabled.
If you've configured and entered your token correclty, you should see the plain text response
All health checks and notifications are enabled.
Disable or silence all alarms
If all you need is temporarily disable all health checks, then you issue the following before your maintenance period starts:
The effect of disabling health checks is that the alarm criteria are not evaluated at all and nothing is written in the alarm log. If you want the health checks to be running but to not receive any notifications during your maintenance period, you can instead use this:
Alarms may then still be raised and logged in Netdata, so you'll be able to see them via the UI.
Regardless of the option you choose, at the end of your maintenance period you revert to the normal state via the RESET command.
Disable or silence specific alarms
If you do not wish to disable/silence all alarms, then the
DISABLE ALL and
SILENCE ALL commands can't be used.
Instead, the following commands expect that one or more alarm selectors will be added, so that only alarms that match the selectors are disabled or silenced.
DISABLE: Set the mode to disable health checks.
SILENCE: Set the mode to silence notifications.
You will normally put one of these commands in the same request with your first alarm selector, but it's possible to issue them separately as well. You will get a warning in the response, if a selector was added without a SILENCE/DISABLE command, or vice versa.
Each request can specify a single alarm
selector, with one or more
A single alarm will match a
selector if all selection criteria match the alarm.
You can add as many selectors as you like.
In essence, the rule is: IF (alarm matches all the criteria in selector1 OR all the criteria in selector2 OR ...) THEN apply the DISABLE or SILENCE command.
To clear all selectors and reset the mode to default, use the
The following example silences notifications for all the alarms with context=load:
selection criteria are key/value pairs, in the format
key : value, where value is a Netdata simple pattern. This means that you can create very powerful selectors (you will rarely need more than one or two).
The accepted keys for the
selection criteria are the following:
alarm: The expression provided will match both
chart: Chart ids/names, as shown on the dashboard. These will match the
onentry of a configured
context: Chart context, as shown on the dashboard. These will match the
onentry of a configured
hosts: The hostnames that will need to match.
families: The alarm families.
You can add any of the selection criteria you need on the request, to ensure that only the alarms you are interested in are matched and disabled/silenced. e.g. there is no reason to add
hosts: *, if you want the criteria to be applied to alarms for all hosts.
Example 1: Disable all health checks for context =
Example 2: Silence all alarms and templates with name starting with
out_of on host
Example 2.2: Add one more selector, to also silence alarms for cpu1 and cpu2
LIST was added in Netdata v1.16.0 and returns a JSON with the current status of the silencers.
As an example, the following response shows that we have two silencers configured, one for an alarm called
samplealarm and one for alarms with context
random on host
The response below shows that we have disabled all health checks.
- "Auth Error" : Token authentication failed
- "All alarm notifications are silenced" : Successful response to cmd=SILENCE ALL
- "All health checks are disabled" : Successful response to cmd=DISABLE ALL
- "All health checks and notifications are enabled" : Successful response to cmd=RESET
- "Health checks disabled for alarms matching the selectors" : Added to the response for a cmd=DISABLE
- "Alarm notifications silenced for alarms matching the selectors" : Added to the response for a cmd=SILENCE
- "Alarm selector added" : Added to the response when a new selector is added
- "Invalid key. Ignoring it." : Wrong name of a parameter. Added to the response and ignored.
- "WARNING: Added alarm selector to silence/disable alarms without a SILENCE or DISABLE command." : Added to the response if a selector is added without a selector-specific command.
- "WARNING: SILENCE or DISABLE command is ineffective without defining any alarm selectors." : Added to the response if a selector-specific command is issued without a selector.
From Netdata v1.16.0 and beyond, the silencers configuration is persisted to disk and loaded when Netdata starts.
The JSON string returned by the LIST command is automatically saved to the
silencers file, every time a command alters the silencers configuration.
The file's location is configurable in
netdata.conf. The default is shown below:
The test script under tests/health_mgmtapi contains a series of tests that you can either run or read through to understand the various calls and responses better.