author | Mahlon E. Smith <mahlon@martini.nu> |
Mon, 09 Apr 2018 18:51:52 -0700 | |
changeset 16 | d6773db8469c |
parent 15 | d4776d62b193 |
child 17 | e4f0fd44734d |
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 |
home |
|
6 |
: http://bitbucket.org/mahlon/Arborist-SNMP |
|
7 |
||
8 |
code |
|
9 |
: http://code.martini.nu/Arborist-SNMP |
|
10 |
||
11 |
||
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
12 |
Description |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
13 |
----------- |
0 | 14 |
|
15 |
Arborist is a monitoring toolkit that follows the UNIX philosophy |
|
16 |
of small parts and loose coupling for stability, reliability, and |
|
17 |
customizability. |
|
18 |
||
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
19 |
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
|
20 |
for OIDS involving: |
0 | 21 |
|
22 |
- Disk space capacity |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
23 |
- System CPU utilization |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
24 |
- Memory and swap usage |
0 | 25 |
- Running process checks |
26 |
||
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
27 |
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
|
28 |
per resource node. Both Windows and UCD-SNMP systems are supported. |
0 | 29 |
|
30 |
||
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
31 |
Prerequisites |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
32 |
------------- |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
33 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
34 |
* 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
|
35 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
36 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
37 |
Installation |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
38 |
------------ |
0 | 39 |
|
40 |
$ gem install arborist-snmp |
|
41 |
||
42 |
||
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
43 |
Configuration |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
44 |
------------- |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
45 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
46 |
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
|
47 |
under the `snmp` key. |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
48 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
49 |
The defaults are as follows: |
0 | 50 |
|
11 | 51 |
``` |
52 |
arborist: |
|
53 |
snmp: |
|
54 |
timeout: 2 |
|
55 |
retries: 1 |
|
56 |
community: public |
|
57 |
version: 2c |
|
58 |
port: 161 |
|
59 |
batchsize: 25 |
|
60 |
cpu: |
|
61 |
warn_at: 80 |
|
62 |
disk: |
|
63 |
warn_at: 90 |
|
64 |
include: ~ |
|
65 |
exclude: |
|
66 |
- "^/dev(/.+)?$" |
|
67 |
- "^/net(/.+)?$" |
|
68 |
- "^/proc$" |
|
69 |
- "^/run$" |
|
70 |
- "^/sys/" |
|
71 |
memory: |
|
72 |
physical_warn_at: ~ |
|
73 |
swap_warn_at: 60 |
|
74 |
processes: |
|
75 |
check: [] |
|
76 |
``` |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
77 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
78 |
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
|
79 |
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
|
80 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
81 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
82 |
### Library Options |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
83 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
84 |
* **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
|
85 |
* **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
|
86 |
* **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
|
87 |
* **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
|
88 |
* **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
|
89 |
* **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
|
90 |
|
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 |
### Category Options and Behavior |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
93 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
94 |
#### CPU |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
95 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
96 |
* **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
|
97 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
98 |
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
|
99 |
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
|
100 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
101 |
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
|
102 |
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
|
103 |
averages of the machine. |
0 | 104 |
|
8
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 |
#### Disk |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
107 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
108 |
* **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
|
109 |
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
|
110 |
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
|
111 |
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
|
112 |
* **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
|
113 |
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
|
114 |
* **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
|
115 |
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
|
116 |
|
15
d4776d62b193
Include set property information for each monitor type.
Mahlon E. Smith <mahlon@martini.nu>
parents:
14
diff
changeset
|
117 |
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
|
118 |
mountpoint, with current capacity values. |
d4776d62b193
Include set property information for each monitor type.
Mahlon E. Smith <mahlon@martini.nu>
parents:
14
diff
changeset
|
119 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
120 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
121 |
#### Memory |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
122 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
123 |
* **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
|
124 |
* **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
|
125 |
|
11 | 126 |
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
|
127 |
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
|
128 |
|
15
d4776d62b193
Include set property information for each monitor type.
Mahlon E. Smith <mahlon@martini.nu>
parents:
14
diff
changeset
|
129 |
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
|
130 |
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
|
131 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
132 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
133 |
#### Processes |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
134 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
135 |
* **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
|
136 |
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
|
137 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
138 |
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
|
139 |
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
|
140 |
|
15
d4776d62b193
Include set property information for each monitor type.
Mahlon E. Smith <mahlon@martini.nu>
parents:
14
diff
changeset
|
141 |
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
|
142 |
current number of running processes. |
d4776d62b193
Include set property information for each monitor type.
Mahlon E. Smith <mahlon@martini.nu>
parents:
14
diff
changeset
|
143 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
144 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
145 |
Examples |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
146 |
-------- |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
147 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
148 |
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
|
149 |
example Monitor configuration: |
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
150 |
|
11 | 151 |
``` |
152 |
require 'arborist/snmp' |
|
153 |
||
154 |
Arborist::Monitor 'cpu load check', :cpu do |
|
155 |
every 1.minute |
|
156 |
match type: 'resource', category: 'cpu' |
|
157 |
exec( Arborist::Monitor::SNMP::CPU ) |
|
158 |
end |
|
0 | 159 |
|
11 | 160 |
Arborist::Monitor 'partition capacity', :disk do |
161 |
every 1.minute |
|
162 |
match type: 'resource', category: 'disk' |
|
163 |
exec( Arborist::Monitor::SNMP::Disk ) |
|
164 |
end |
|
165 |
||
166 |
Arborist::Monitor 'process checks', :proc do |
|
167 |
every 1.minute |
|
168 |
match type: 'resource', category: 'process' |
|
169 |
exec( Arborist::Monitor::SNMP::Process ) |
|
170 |
end |
|
171 |
||
172 |
Arborist::Monitor 'memory', :memory do |
|
173 |
every 1.minute |
|
174 |
match type: 'resource', category: 'memory' |
|
175 |
exec( Arborist::Monitor::SNMP::Memory ) |
|
176 |
end |
|
177 |
``` |
|
0 | 178 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
179 |
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
|
180 |
service itself, you can add a UDP check for that. |
0 | 181 |
|
11 | 182 |
``` |
183 |
Arborist::Monitor 'udp service checks', :udp do |
|
184 |
every 30.seconds |
|
185 |
match type: 'service', protocol: 'udp' |
|
186 |
exec( Arborist::Monitor::Socket::UDP ) |
|
187 |
end |
|
188 |
``` |
|
0 | 189 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
190 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
191 |
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
|
192 |
|
11 | 193 |
``` |
194 |
Arborist::Host 'example' do |
|
195 |
description 'An example host' |
|
196 |
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
|
197 |
|
11 | 198 |
resource 'cpu' |
199 |
resource 'memory' |
|
200 |
resource 'disk' |
|
201 |
end |
|
202 |
``` |
|
4
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
203 |
|
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
204 |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
205 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
206 |
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
|
207 |
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
|
208 |
|
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
209 |
* 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
|
210 |
* 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
|
211 |
* 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
|
212 |
* 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
|
213 |
|
10
794cd469a1a2
README.md edited online with Bitbucket
Mahlon E. Smith <mahlon@martini.nu>
parents:
9
diff
changeset
|
214 |
- |
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
215 |
|
11 | 216 |
``` |
217 |
Arborist::Host 'example' do |
|
218 |
description 'An example host' |
|
219 |
address 'demo.example.com' |
|
220 |
||
221 |
service 'snmp', protocol: 'udp' |
|
222 |
||
223 |
resource 'cpu', description: 'machine cpu load' do |
|
224 |
depends_on 'example-snmp' |
|
225 |
end |
|
226 |
||
227 |
resource 'memory', description: 'machine ram and swap' do |
|
228 |
depends_on 'example-snmp' |
|
229 |
config physical_warn_at: 95, swap_warn_at: 10 |
|
230 |
end |
|
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
231 |
|
11 | 232 |
resource 'disk', description: 'partition capacity' do |
233 |
depends_on 'example-snmp' |
|
234 |
config \ |
|
235 |
include: [ |
|
236 |
'^/tmp', |
|
237 |
'^/var' |
|
238 |
], |
|
239 |
warn_at: { |
|
240 |
'/tmp' => 50, |
|
241 |
'/var' => 80 |
|
242 |
} |
|
243 |
end |
|
0 | 244 |
|
11 | 245 |
resource 'process' do |
246 |
depends_on 'example-snmp' |
|
247 |
config check: 'important --production' |
|
248 |
end |
|
249 |
end |
|
250 |
``` |
|
0 | 251 |
|
4
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
252 |
|
0 | 253 |
## License |
254 |
||
8
e0b7c95a154f
Refactor for real world usage and latest Arborist behaviors.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
255 |
Copyright (c) 2016-2018 Michael Granger and Mahlon E. Smith |
0 | 256 |
All rights reserved. |
257 |
||
258 |
Redistribution and use in source and binary forms, with or without |
|
259 |
modification, are permitted provided that the following conditions are met: |
|
260 |
||
261 |
* Redistributions of source code must retain the above copyright notice, |
|
262 |
this list of conditions and the following disclaimer. |
|
263 |
||
264 |
* Redistributions in binary form must reproduce the above copyright notice, |
|
265 |
this list of conditions and the following disclaimer in the documentation |
|
266 |
and/or other materials provided with the distribution. |
|
267 |
||
268 |
* Neither the name of the author/s, nor the names of the project's |
|
269 |
contributors may be used to endorse or promote products derived from this |
|
270 |
software without specific prior written permission. |
|
271 |
||
272 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
273 |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
274 |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
275 |
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
|
276 |
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
277 |
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
278 |
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
279 |
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
280 |
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
281 |
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
282 |
||
283 |