author | Mahlon E. Smith <mahlon@martini.nu> |
Sun, 01 Sep 2019 13:28:18 -0700 | |
changeset 25 | 6217282f6070 |
parent 20 | 00a38d493f2c |
child 26 | 54f2f57cc0b0 |
permissions | -rw-r--r-- |
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
1 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
2 |
Arborist-SNMP |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
3 |
============= |
0 | 4 |
|
5 |
code |
|
6 |
: http://code.martini.nu/Arborist-SNMP |
|
7 |
||
25 | 8 |
mirrors |
9 |
: https://github.com/mahlonsmith/Arborist-SNMP |
|
10 |
: https://hg.sr.ht/~mahlon/Arborist-SNMP |
|
11 |
||
0 | 12 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
13 |
Description |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
14 |
----------- |
0 | 15 |
|
16 |
Arborist is a monitoring toolkit that follows the UNIX philosophy |
|
17 |
of small parts and loose coupling for stability, reliability, and |
|
18 |
customizability. |
|
19 |
||
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
20 |
This adds various SNMP support to Arborist's monitoring, specifically |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
21 |
for OIDS involving: |
0 | 22 |
|
23 |
- Disk space capacity |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
24 |
- System CPU utilization |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
25 |
- Memory and swap usage |
0 | 26 |
- Running process checks |
20
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
27 |
- UPS battery checks |
0 | 28 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
29 |
It tries to provide sane defaults, while allowing fine grained settings |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
30 |
per resource node. Both Windows and UCD-SNMP systems are supported. |
0 | 31 |
|
32 |
||
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
33 |
Prerequisites |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
34 |
------------- |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
35 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
36 |
* Ruby 2.3 or better |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
37 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
38 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
39 |
Installation |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
40 |
------------ |
0 | 41 |
|
42 |
$ gem install arborist-snmp |
|
43 |
||
44 |
||
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
45 |
Configuration |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
46 |
------------- |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
47 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
48 |
Global configuration overrides can be added to the Arborist config file, |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
49 |
under the `snmp` key. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
50 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
51 |
The defaults are as follows: |
0 | 52 |
|
11 | 53 |
``` |
54 |
arborist: |
|
55 |
snmp: |
|
17
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
56 |
timeout: 2 |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
57 |
retries: 1 |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
58 |
community: public |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
59 |
version: 2c |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
60 |
port: 161 |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
61 |
batchsize: 25 |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
62 |
cpu: |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
63 |
warn_at: 80 |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
64 |
disk: |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
65 |
warn_at: 90 |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
66 |
include: |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
67 |
exclude: |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
68 |
- "^/dev(/.+)?$" |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
69 |
- "/dev$" |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
70 |
- "^/net(/.+)?$" |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
71 |
- "/proc$" |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
72 |
- "^/run$" |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
73 |
- "^/sys/" |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
74 |
- "/sys$" |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
75 |
processes: |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
76 |
check: [] |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
77 |
memory: |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
78 |
physical_warn_at: |
e4f0fd44734d
Fix up the docs, make the default disk exclusion list more useful.
Mahlon E. Smith <mahlon@martini.nu>
parents:
15
diff
changeset
|
79 |
swap_warn_at: 60 |
20
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
80 |
ups: |
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
81 |
battery: |
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
82 |
capacity_warn_at: 60 |
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
83 |
temperature_warn_at: 50 |
11 | 84 |
``` |
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
85 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
86 |
The `warn_at` keys imply usage capacity as a percentage. ie: "Warn me |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
87 |
when a disk mount point is at 90 percent utilization." |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
88 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
89 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
90 |
### Library Options |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
91 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
92 |
* **timeout**: How long to wait for an SNMP response, in seconds? |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
93 |
* **retries**: If an error occurs during SNMP communication, try again this many times before giving up. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
94 |
* **community**: The SNMP community name for reading data. |
14
d5cb8bd33170
Although faster, once aiming a few thousand nodes at net-snmp2 it leaks memory like a sieve. Use 'netsnmp' instead.
Mahlon E. Smith <mahlon@martini.nu>
parents:
11
diff
changeset
|
95 |
* **version**: The SNMP protocol version. v1, v2c, and v3 are supported. |
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
96 |
* **port**: The UDP port SNMP is listening on. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
97 |
* **batchsize**: How many hosts to gather SNMP data on simultaneously. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
98 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
99 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
100 |
### Category Options and Behavior |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
101 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
102 |
#### CPU |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
103 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
104 |
* **warn_at**: Set the node to a `warning` state when utilization is at or over this percentage. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
105 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
106 |
Utilization takes into account CPU core counts, and uses the 5 minute |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
107 |
load average to calculate a percentage of current CPU use. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
108 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
109 |
2 properties are set on the node. `cpu` contains the detected CPU count |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
110 |
and current utilization. `load` contains the 1, 5, and 15 minute load |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
111 |
averages of the machine. |
0 | 112 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
113 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
114 |
#### Disk |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
115 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
116 |
* **warn_at**: Set the node to a `warning` state when disk capacity is at or over this amount. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
117 |
You can also set this to a Hash, keyed on mount name, if you want differing |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
118 |
warning values per mount point. A mount point that is at 100% capacity will |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
119 |
be explicity set to `down`, as the resource it represents has been exhausted. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
120 |
* **include**: String or Array of Strings. If present, only matching mount points are |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
121 |
considered while performing checks. These are treated as regular expressions. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
122 |
* **exclude**: String or Array of Strings. If present, matching mount point are removed |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
123 |
from evaluation. These are treated as regular expressions. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
124 |
|
15
d4776d62b193
Include set property information for each monitor type.
Mahlon E. Smith <mahlon@martini.nu>
parents:
14
diff
changeset
|
125 |
A single property "mounts" is set on the node, which is a hash keyed by |
d4776d62b193
Include set property information for each monitor type.
Mahlon E. Smith <mahlon@martini.nu>
parents:
14
diff
changeset
|
126 |
mountpoint, with current capacity values. |
d4776d62b193
Include set property information for each monitor type.
Mahlon E. Smith <mahlon@martini.nu>
parents:
14
diff
changeset
|
127 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
128 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
129 |
#### Memory |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
130 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
131 |
* **physical_warn_at**: Set the node to a `warning` state when RAM utilization is at or over this percentage. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
132 |
* **swap_warn_at**: Set the node to a `warning` state when swap utilization is at or over this percentage. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
133 |
|
11 | 134 |
Warnings are only set for swap by default, since that is usually a |
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
135 |
better indication of an impending problem. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
136 |
|
15
d4776d62b193
Include set property information for each monitor type.
Mahlon E. Smith <mahlon@martini.nu>
parents:
14
diff
changeset
|
137 |
2 properties are set on the node, "memory" and "swap". Each is a Hash |
d4776d62b193
Include set property information for each monitor type.
Mahlon E. Smith <mahlon@martini.nu>
parents:
14
diff
changeset
|
138 |
that contains current usage and remaining available. |
d4776d62b193
Include set property information for each monitor type.
Mahlon E. Smith <mahlon@martini.nu>
parents:
14
diff
changeset
|
139 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
140 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
141 |
#### Processes |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
142 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
143 |
* **check**: String or Array of Strings. A list of processes to check if running. These are |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
144 |
treated as regular expressions, and include process arguments. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
145 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
146 |
If any process in the list is not found in the process table, the |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
147 |
resource is set to a `down` state. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
148 |
|
15
d4776d62b193
Include set property information for each monitor type.
Mahlon E. Smith <mahlon@martini.nu>
parents:
14
diff
changeset
|
149 |
A single property is set on the node, a "counts" key that contains the |
d4776d62b193
Include set property information for each monitor type.
Mahlon E. Smith <mahlon@martini.nu>
parents:
14
diff
changeset
|
150 |
current number of running processes. |
d4776d62b193
Include set property information for each monitor type.
Mahlon E. Smith <mahlon@martini.nu>
parents:
14
diff
changeset
|
151 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
152 |
|
20
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
153 |
#### UPS |
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
154 |
|
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
155 |
##### Battery |
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
156 |
|
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
157 |
* **capacity_warn_at**: Set the node to a `warning` state when the battery capacity is at or below this percentage. |
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
158 |
* **temperature_warn_at**: Set the node to a `warning` state when the battery temperature is at or above this |
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
159 |
temperature (in Celcius). |
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
160 |
|
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
161 |
This check warns when the UPS is on battery, and reports the UPS' own |
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
162 |
estimated time remaining. |
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
163 |
|
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
164 |
A warning state will also be triggered based on battery status - low, |
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
165 |
depleted, or unknown. |
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
166 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
167 |
Examples |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
168 |
-------- |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
169 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
170 |
In the simplest form, using default behaviors and settings, here's an |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
171 |
example Monitor configuration: |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
172 |
|
11 | 173 |
``` |
174 |
require 'arborist/snmp' |
|
175 |
||
176 |
Arborist::Monitor 'cpu load check', :cpu do |
|
177 |
every 1.minute |
|
178 |
match type: 'resource', category: 'cpu' |
|
179 |
exec( Arborist::Monitor::SNMP::CPU ) |
|
180 |
end |
|
0 | 181 |
|
11 | 182 |
Arborist::Monitor 'partition capacity', :disk do |
183 |
every 1.minute |
|
184 |
match type: 'resource', category: 'disk' |
|
185 |
exec( Arborist::Monitor::SNMP::Disk ) |
|
186 |
end |
|
187 |
||
188 |
Arborist::Monitor 'process checks', :proc do |
|
189 |
every 1.minute |
|
190 |
match type: 'resource', category: 'process' |
|
191 |
exec( Arborist::Monitor::SNMP::Process ) |
|
192 |
end |
|
193 |
||
194 |
Arborist::Monitor 'memory', :memory do |
|
195 |
every 1.minute |
|
196 |
match type: 'resource', category: 'memory' |
|
197 |
exec( Arborist::Monitor::SNMP::Memory ) |
|
198 |
end |
|
199 |
``` |
|
0 | 200 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
201 |
Additionally, if you'd like these SNMP monitors to rely on the SNMP |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
202 |
service itself, you can add a UDP check for that. |
0 | 203 |
|
11 | 204 |
``` |
205 |
Arborist::Monitor 'udp service checks', :udp do |
|
206 |
every 30.seconds |
|
207 |
match type: 'service', protocol: 'udp' |
|
208 |
exec( Arborist::Monitor::Socket::UDP ) |
|
209 |
end |
|
210 |
``` |
|
0 | 211 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
212 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
213 |
And a default node declaration: |
4
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
214 |
|
11 | 215 |
``` |
216 |
Arborist::Host 'example' do |
|
217 |
description 'An example host' |
|
218 |
address 'demo.example.com' |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
219 |
|
11 | 220 |
resource 'cpu' |
221 |
resource 'memory' |
|
222 |
resource 'disk' |
|
223 |
end |
|
224 |
``` |
|
4
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
225 |
|
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
226 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
227 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
228 |
All configuration can be overridden from the defaults using the `config` |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
229 |
pragma, per node. Here's a more elaborate example that performs the following: |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
230 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
231 |
* All SNMP monitored resources are quieted if the SNMP service itself is unavailable. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
232 |
* Only monitor specific disk partitions, warning at different capacities . |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
233 |
* Ensure the 'important' processing is running with the '--production' flag. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
234 |
* Warns at 95% memory utilization OR 10% swap. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
235 |
|
10
794cd469a1a2
README.md edited online with Bitbucket
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
236 |
- |
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
237 |
|
11 | 238 |
``` |
239 |
Arborist::Host 'example' do |
|
240 |
description 'An example host' |
|
241 |
address 'demo.example.com' |
|
242 |
||
243 |
service 'snmp', protocol: 'udp' |
|
244 |
||
245 |
resource 'cpu', description: 'machine cpu load' do |
|
246 |
depends_on 'example-snmp' |
|
247 |
end |
|
248 |
||
249 |
resource 'memory', description: 'machine ram and swap' do |
|
250 |
depends_on 'example-snmp' |
|
251 |
config physical_warn_at: 95, swap_warn_at: 10 |
|
252 |
end |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
253 |
|
11 | 254 |
resource 'disk', description: 'partition capacity' do |
255 |
depends_on 'example-snmp' |
|
256 |
config \ |
|
257 |
include: [ |
|
258 |
'^/tmp', |
|
259 |
'^/var' |
|
260 |
], |
|
261 |
warn_at: { |
|
262 |
'/tmp' => 50, |
|
263 |
'/var' => 80 |
|
264 |
} |
|
265 |
end |
|
0 | 266 |
|
11 | 267 |
resource 'process' do |
268 |
depends_on 'example-snmp' |
|
269 |
config check: 'important --production' |
|
270 |
end |
|
271 |
end |
|
272 |
``` |
|
0 | 273 |
|
4
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
274 |
|
0 | 275 |
## License |
276 |
||
20
00a38d493f2c
add UPS monitoring capability
Katelyn Schiesser <kschiesser@laika.com>
parents:
17
diff
changeset
|
277 |
Copyright (c) 2016-2019 Michael Granger and Mahlon E. Smith |
0 | 278 |
All rights reserved. |
279 |
||
280 |
Redistribution and use in source and binary forms, with or without |
|
281 |
modification, are permitted provided that the following conditions are met: |
|
282 |
||
283 |
* Redistributions of source code must retain the above copyright notice, |
|
284 |
this list of conditions and the following disclaimer. |
|
285 |
||
286 |
* Redistributions in binary form must reproduce the above copyright notice, |
|
287 |
this list of conditions and the following disclaimer in the documentation |
|
288 |
and/or other materials provided with the distribution. |
|
289 |
||
290 |
* Neither the name of the author/s, nor the names of the project's |
|
291 |
contributors may be used to endorse or promote products derived from this |
|
292 |
software without specific prior written permission. |
|
293 |
||
294 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
295 |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
296 |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
297 |
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
|
298 |
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
299 |
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
300 |
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
301 |
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
302 |
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
303 |
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
304 |
||
305 |