author | Mahlon E. Smith <mahlon@martini.nu> |
Wed, 07 Sep 2016 15:23:53 -0700 | |
changeset 5 | 309727e262af |
parent 4 | e6eb11b1e00d |
child 6 | 71578fe8e9ec |
permissions | -rw-r--r-- |
0 | 1 |
# Arborist-SNMP |
2 |
||
3 |
home |
|
4 |
: http://bitbucket.org/mahlon/Arborist-SNMP |
|
5 |
||
6 |
code |
|
7 |
: http://code.martini.nu/Arborist-SNMP |
|
8 |
||
9 |
||
10 |
## Description |
|
11 |
||
12 |
Arborist is a monitoring toolkit that follows the UNIX philosophy |
|
13 |
of small parts and loose coupling for stability, reliability, and |
|
14 |
customizability. |
|
15 |
||
16 |
This adds SNMP support to Arborist's monitoring, for things such as: |
|
17 |
||
18 |
- Disk space capacity |
|
19 |
- System load |
|
20 |
- Free memory |
|
21 |
- Swap in use |
|
22 |
- Running process checks |
|
23 |
||
24 |
||
25 |
## Prerequisites |
|
26 |
||
27 |
* Ruby 2.2 or better |
|
28 |
||
29 |
||
30 |
## Installation |
|
31 |
||
32 |
$ gem install arborist-snmp |
|
33 |
||
34 |
||
35 |
## Usage |
|
36 |
||
37 |
In this example, we've created a resource node under an existing host, like so: |
|
38 |
||
39 |
Arborist::Host( 'example' ) do |
|
40 |
description "Example host" |
|
41 |
address '10.6.0.169' |
|
4
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
42 |
resource 'load', description: 'machine load' |
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
43 |
resource 'disk' do |
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
44 |
include: [ '/', '/mnt' ] |
1
8446f55f7e58
Allow local node "config" to override SNMP instanced globals. Add mount point includes and excludes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
0
diff
changeset
|
45 |
end |
0 | 46 |
end |
47 |
||
48 |
||
49 |
From a monitor file, require this library, and create an snmp instance. |
|
50 |
You can reuse a single instance, or create individual ones per monitor. |
|
51 |
||
52 |
require 'arborist/monitor/snmp' |
|
53 |
||
54 |
Arborist::Monitor '5 minute load average check' do |
|
55 |
every 30.seconds |
|
56 |
match type: 'resource', category: 'load' |
|
57 |
include_down true |
|
58 |
use :addresses |
|
59 |
||
4
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
60 |
snmp = Arborist::Monitor::SNMP::Load( error_at: 10 ) |
0 | 61 |
exec( snmp ) |
62 |
end |
|
63 |
||
4
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
64 |
Arborist::Monitor 'mount capacity check' do |
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
65 |
every 30.seconds |
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
66 |
match type: 'resource', category: 'load' |
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
67 |
include_down true |
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
68 |
use :addresses, :config |
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
69 |
|
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
70 |
exec( Arborist::Monitor::SNMP::Disk ) |
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
71 |
end |
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
72 |
|
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
73 |
|
1
8446f55f7e58
Allow local node "config" to override SNMP instanced globals. Add mount point includes and excludes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
0
diff
changeset
|
74 |
Please see the rdoc for all the mode types and error_at options. Per |
8446f55f7e58
Allow local node "config" to override SNMP instanced globals. Add mount point includes and excludes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
0
diff
changeset
|
75 |
node "config" vars override global defaults when instantiating the |
8446f55f7e58
Allow local node "config" to override SNMP instanced globals. Add mount point includes and excludes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
0
diff
changeset
|
76 |
monitor. |
0 | 77 |
|
78 |
||
4
e6eb11b1e00d
Refactor. Move all SNMP "sections" to their own classes.
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
79 |
|
0 | 80 |
## License |
81 |
||
82 |
Copyright (c) 2016, Michael Granger and Mahlon E. Smith |
|
83 |
All rights reserved. |
|
84 |
||
85 |
Redistribution and use in source and binary forms, with or without |
|
86 |
modification, are permitted provided that the following conditions are met: |
|
87 |
||
88 |
* Redistributions of source code must retain the above copyright notice, |
|
89 |
this list of conditions and the following disclaimer. |
|
90 |
||
91 |
* Redistributions in binary form must reproduce the above copyright notice, |
|
92 |
this list of conditions and the following disclaimer in the documentation |
|
93 |
and/or other materials provided with the distribution. |
|
94 |
||
95 |
* Neither the name of the author/s, nor the names of the project's |
|
96 |
contributors may be used to endorse or promote products derived from this |
|
97 |
software without specific prior written permission. |
|
98 |
||
99 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
100 |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
101 |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
102 |
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
|
103 |
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
|
104 |
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
105 |
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
106 |
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
|
107 |
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
108 |
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
109 |
||
110 |