mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
- Removed default alerting rules, user can create their own.
- Updated documentation
This commit is contained in:
@@ -281,18 +281,26 @@ Please see the [API-Docs](http://docs.librenms.org/API/API-Docs/#api-route-25) f
|
||||
|
||||
## <a name="alert">Alerting</a>
|
||||
|
||||
A default alerting rule exists that will raise an alert for any component which has a status of 0.
|
||||
This can be disabled:
|
||||
|
||||
- Globally - by removing the 'Component Alert' alerting rule.
|
||||
- Locally - by setting the ignore field of an individual component to 1.
|
||||
It is intended that discovery/poller modules will detect the status of a component during the polling cycle.
|
||||
If you are creating a poller module which can detect a fault condition simply set STATUS to 0 and ERROR to a message that indicates the problem.
|
||||
|
||||
|
||||
To actually raise an alert, the user will need to create an alert rule. To assist with this several Alerting Macro's have been created:
|
||||
|
||||
- ```%macro.component_alert``` - A component that is not disabled or ignored and in alert state.
|
||||
- ```%macro.component_normal``` - A component that is not disabled or ignored and NOT in alert state.
|
||||
|
||||
To raise alerts for components, the following rules could be created:
|
||||
|
||||
- ```%macros.component_alert = "1"``` - To alert on all components
|
||||
- ```%macros.component_alert = "1" && %component.type = "<Type of Component>"``` - To alert on all components of a particular type.
|
||||
|
||||
If there is a particular component you would like excluded from alerting, simply set the ignore field to 1.
|
||||
|
||||
The data that is written to each alert when it is raised is in the following format:
|
||||
|
||||
`COMPONENT_TYPE - LABEL - ERROR`
|
||||
|
||||
if you are creating a poller module which can detect a fault condition simply set STATUS to 0 and ERROR to a message that indicates the problem.
|
||||
|
||||
# <a name="examples">Example Code</a>
|
||||
|
||||
To see an example of how the component module can used, please see the following modules:
|
||||
|
@@ -2,5 +2,4 @@ DROP TABLE IF EXISTS `component`;
|
||||
CREATE TABLE `component` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID for each component, unique index', `device_id` int(11) unsigned NOT NULL COMMENT 'device_id from the devices table', `type` varchar(50) COLLATE utf8_unicode_ci NOT NULL COMMENT 'name from the component_type table', `label` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Display label for the component', `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'The status of the component, retreived from the device', `disabled` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Should this component be polled', `ignore` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Should this component be alerted on', `error` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Error message if in Alert state', PRIMARY KEY (`id`), KEY `device` (`device_id`), KEY `type` (`type`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='components attached to a device.';
|
||||
DROP TABLE IF EXISTS `component_prefs`;
|
||||
CREATE TABLE `component_prefs` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID for each entry', `component` int(11) unsigned NOT NULL COMMENT 'id from the component table', `attribute` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Attribute for the Component', `value` varchar(255) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Value for the Component', PRIMARY KEY (`id`), KEY `component` (`component`), CONSTRAINT `component_prefs_ibfk_1` FOREIGN KEY (`component`) REFERENCES `component` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='AV Pairs for each component';
|
||||
INSERT INTO `alert_rules` (`device_id`,`rule`,`severity`,`extra`,`disabled`,`name`) VALUES ('-1','%macros.component_alert = \"1\"','critical','{\"mute\":false,\"count\":\"-1\",\"delay\":\"300\"}',0,'Component Alert');
|
||||
INSERT INTO `config` (`config_name`,`config_value`,`config_default`,`config_descr`,`config_group`,`config_group_order`,`config_sub_group`,`config_sub_group_order`,`config_hidden`,`config_disabled`) VALUES ('alert.macros.rule.component','(%component.disabled = 0 && %component.ignore = 0)','(%component.disabled = 0 && %component.ignore = 0)','Component that isn\'t disabled or ignored','alerting',0,'macros',0,'1','0'),('alert.macros.rule.component_normal','(%component.status = 1 && %macros.component)','(%component.status = 1 && %macros.component)','Component that is in a normal state','alerting',0,'macros',0,'1','0'),('alert.macros.rule.component_alert','(%component.status = 0 && %macros.component)','(%component.status = 0 && %macros.component)','Component that alerting','alerting',0,'macros',0,'1','0');
|
Reference in New Issue
Block a user