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