LoginSignup
0
1

More than 5 years have passed since last update.

LibreNMSのalert設定方法

Last updated at Posted at 2016-12-28

概要

LibreNMSには非常に柔軟な監視機能があります。
が、柔軟ゆえに設定方法が分かりにくい部分も多いです。

そこで今回は、実際にアラートをメールで受信出来るまでの手順を解説したいと思います。

標準ドキュメントも参考になります
http://docs.librenms.org/Extensions/Alerting/

手順

送信先メールアドレスを設定する

ページ上部のGlobal Settingsを選択します
01.png

Alerting Settings -> General alert settingsと進みメールアドレスを設定します
02.png

アドレス単位のalert出し分けも可能なようですが、今回はDefault contactを宛先にします

Email transportに進みEnable email alertingYesになっていることを確認します
03.png

標準以外のメールサーバーを利用する場合もこの画面から設定します。
この画面からテスト送信出来るので試しておきましょう。

Ruleを作成する

ページ上部からAlerts -> 'Rules'を選択します
04.png

恐らくデフォルトRuleが表示されているのではないでしょうか?
そのまま使うことも出来ますし、自分でRuleを追加することも出来ます。

いきなり%devices.uptimeとか書いてあって戸惑うと思いますが、
これはインストール時に作成したDBを参照しています。

試しにDBを覗いてみましょう。

mysql> show tables;
+--------------------------+
| Tables_in_librenms       |
+--------------------------+
| access_points            |
| alert_log                |
| alert_map                |
| alert_rules              |
| alert_schedule           |
| alert_schedule_items     |
| alert_template_map       |
| alert_templates          |
| alerts                   |
| api_tokens               |
| applications             |
| authlog                  |
| bgpPeers                 |
| bgpPeers_cbgp            |
| bill_data                |
| bill_history             |
| bill_perms               |
| bill_port_counters       |
| bill_ports               |
| bills                    |
| callback                 |
| cef_switching            |
| ciscoASA                 |
| component                |
| component_prefs          |
| component_statuslog      |
| config                   |
| customers                |
| dashboards               |
| dbSchema                 |
| device_graphs            |
| device_group_device      |
| device_groups            |
| device_mibs              |
| device_oids              |
| device_perf              |
| devices                  |
| devices_attribs          |
| devices_perms            |
| entPhysical              |
| entPhysical_state        |
| eventlog                 |
| graph_types              |
| graph_types_dead         |
| hrDevice                 |
| ipsec_tunnels            |
| ipv4_addresses           |
| ipv4_mac                 |
| ipv4_networks            |
| ipv6_addresses           |
| ipv6_networks            |
| juniAtmVp                |
| links                    |
| loadbalancer_rservers    |
| loadbalancer_vservers    |
| locations                |
| mac_accounting           |
| mempools                 |
| mibdefs                  |
| munin_plugins            |
| munin_plugins_ds         |
| netscaler_vservers       |
| notifications            |
| notifications_attribs    |
| ospf_areas               |
| ospf_instances           |
| ospf_nbrs                |
| ospf_ports               |
| packages                 |
| perf_times               |
| plugins                  |
| poller_groups            |
| pollers                  |
| port_association_mode    |
| ports                    |
| ports_adsl               |
| ports_perms              |
| ports_stack              |
| ports_statistics         |
| ports_stp                |
| ports_vlans              |
| processes                |
| processors               |
| proxmox                  |
| proxmox_ports            |
| pseudowires              |
| route                    |
| sensors                  |
| sensors_to_state_indexes |
| services                 |
| session                  |
| slas                     |
| state_indexes            |
| state_translations       |
| storage                  |
| stp                      |
| syslog                   |
| toner                    |
| ucd_diskio               |
| users                    |
| users_prefs              |
| users_widgets            |
| vlans                    |
| vminfo                   |
| vrf_lite_cisco           |
| vrfs                     |
| widgets                  |
+--------------------------+

いっぱいテーブルがありますね。
では今度はdevicesテーブルを覗いてみましょう。

mysql> show columns from devices;
+---------------------------+----------------------------------------------+------+-----+---------+----------------+
| Field                     | Type                                         | Null | Key | Default | Extra          |
+---------------------------+----------------------------------------------+------+-----+---------+----------------+
| device_id                 | int(11) unsigned                             | NO   | PRI | NULL    | auto_increment |
| hostname                  | varchar(128)                                 | NO   | MUL | NULL    |                |
| sysName                   | varchar(128)                                 | YES  | MUL | NULL    |                |
| ip                        | varbinary(16)                                | NO   |     | NULL    |                |
| community                 | varchar(255)                                 | YES  |     | NULL    |                |
| authlevel                 | enum('noAuthNoPriv','authNoPriv','authPriv') | YES  |     | NULL    |                |
| authname                  | varchar(64)                                  | YES  |     | NULL    |                |
| authpass                  | varchar(64)                                  | YES  |     | NULL    |                |
| authalgo                  | enum('MD5','SHA')                            | YES  |     | NULL    |                |
| cryptopass                | varchar(64)                                  | YES  |     | NULL    |                |
| cryptoalgo                | enum('AES','DES')                            | YES  |     | NULL    |                |
| snmpver                   | varchar(4)                                   | NO   |     | v2c     |                |
| port                      | smallint(5) unsigned                         | NO   |     | 161     |                |
| transport                 | varchar(16)                                  | NO   |     | udp     |                |
| timeout                   | int(11)                                      | YES  |     | NULL    |                |
| retries                   | int(11)                                      | YES  |     | NULL    |                |
| bgpLocalAs                | varchar(16)                                  | YES  |     | NULL    |                |
| sysObjectID               | varchar(64)                                  | YES  |     | NULL    |                |
| sysDescr                  | text                                         | YES  |     | NULL    |                |
| sysContact                | text                                         | YES  |     | NULL    |                |
| version                   | text                                         | YES  |     | NULL    |                |
| hardware                  | text                                         | YES  |     | NULL    |                |
| features                  | text                                         | YES  |     | NULL    |                |
| location                  | text                                         | YES  |     | NULL    |                |
| os                        | varchar(32)                                  | YES  | MUL | NULL    |                |
| status                    | tinyint(4)                                   | NO   | MUL | 0       |                |
| status_reason             | varchar(50)                                  | NO   |     | NULL    |                |
| ignore                    | tinyint(4)                                   | NO   |     | 0       |                |
| disabled                  | tinyint(1)                                   | NO   |     | 0       |                |
| uptime                    | bigint(20)                                   | YES  |     | NULL    |                |
| agent_uptime              | int(11)                                      | NO   |     | 0       |                |
| last_polled               | timestamp                                    | YES  | MUL | NULL    |                |
| last_poll_attempted       | timestamp                                    | YES  | MUL | NULL    |                |
| last_polled_timetaken     | double(5,2)                                  | YES  |     | NULL    |                |
| last_discovered_timetaken | double(5,2)                                  | YES  |     | NULL    |                |
| last_discovered           | timestamp                                    | YES  |     | NULL    |                |
| last_ping                 | timestamp                                    | YES  |     | NULL    |                |
| last_ping_timetaken       | double(5,2)                                  | YES  |     | NULL    |                |
| purpose                   | text                                         | YES  |     | NULL    |                |
| type                      | varchar(20)                                  | NO   |     |         |                |
| serial                    | text                                         | YES  |     | NULL    |                |
| icon                      | varchar(255)                                 | YES  |     | NULL    |                |
| poller_group              | int(11)                                      | NO   |     | 0       |                |
| override_sysLocation      | tinyint(1)                                   | YES  |     | 0       |                |
| notes                     | text                                         | YES  |     | NULL    |                |
| port_association_mode     | int(11)                                      | NO   |     | 1       |                |
+---------------------------+----------------------------------------------+------+-----+---------+----------------+

uptimeがちゃんと入っていますね。

このようにLibreNMSのアラートシステムはDBを直接参照出来るので、
非常に柔軟な設定が可能なのです。

参考までに、私の使っているRuleはこんな感じです。
3638822-1931beb7f1d299b712ef8005457916b759be8e28.png

「descriptionにuplinkが含まれているインターフェイスの帯域使用率が70 - 100%になったらアラート」
といった感じでしょうか。
わざわざ70 - 100%としているのは、UDPでのpollingだとたまに取りこぼして帯域使用率の計算に失敗し
異常な値でアラート発砲する場合があるためです。

LibreNMSではDBの値だけでなく、DBの値を使ったmacroという仕組みもRuleに組み込むことが出来ます。
06.png

既存のmacroはGlobal Settingsの中に記載されていますが、自分で追加することも可能です。

Device Groupを作成する

Ruleが作成出来たので、対象を指定するためのDevice Groupを作成します。

ページ上部のDevices -> Manage Groupsを選択します。
07.png

Groupを作成します。
08.png

Groupの作成にもRuleと同じようにDBの値を使います。
ホスト名やIPなど、環境に合わせて作成しましょう。
ちなみに、上のように設定すると全てのデバイスが対象になります。

RuleとDevice GroupをMappingする

ページ上部のAlerts -> Rule Mappingを選択します。
04.png

先程作成したRuleGroupをそれぞれ指定しましょう。
09.png

以上で設定完了です。

さいごに

ユーザー会もあります!参加おまちしてます!!

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1