Monitors.md in arborist-0.0.1.pre20161005182540 vs Monitors.md in arborist-0.1.0

- old
+ new

@@ -5,36 +5,50 @@ of an Arborist::MonitorRunner object. The `Arborist::Monitor.each_in` method, given a path to a directory containing `.rb` files that declare one or more monitors, will return such an Enumerator, but you could also use this to load monitor descriptions from any source you prefer, e.g., LDAP, a RDBMS, etc. ## Declaration DSL -To facilitate describing monitors to run, Arborist::Monitor also provides a DSL-like syntax for constructing them. +To facilitate describing monitors to run, Arborist::Monitor also provides a DSL-like syntax for constructing them. For example, this would declare two monitors, one which pings every 'host' node except those tagged as laptops in the network every 20 seconds, and the other which pings 'host' nodes tagged as laptops every 5 minutes. # monitors/pings.rb require 'arborist/monitor' Arborist::Monitor 'ping check' do - every 20.seconds - match type: 'host' - exclude tag: :laptop - use :address - exec 'fping' + key :pingcheck + every 20.seconds + match type: 'host' + exclude tag: :laptop + use :address + exec 'fping' end Arborist::Monitor 'transient host pings' do - every 5.minutes - match type: 'host', tag: 'laptop' + key :pingcheck + every 5.minutes + match type: 'host', tag: 'laptop' use :address - exec 'fping' + exec 'fping' end Each monitor is given a human-readable description for use in user interfaces, and one or more attributes that describe which nodes should be monitored, how they should be monitored, and how often the monitor should be run. ### Monitor Attributes +#### key + +Declare a namespace for the monitor. The error status for a node is keyed by this value, so that monitors with different keys don't clear each other's errors. + +This attribute is mandatory. + +#### description + +Set a human-readable description for the monitor, for use in interfaces or logs. + +This attribute is mandatory. + #### every( seconds ) Declare the interval between runs of the monitor. The monitor will be skewed by a small amount from this value (unless you specify `splay 0`) to prevent many monitors from starting up simultaneously. #### splay( seconds ) @@ -43,10 +57,10 @@ #### exec( command ) #### exec {|node_attributes| ... } #### exec( module ) -Specify what should be run to do the actual monitoring. The first form simply `spawn`s the specified command with its STDIN opened to a stream of serialized node data. +Specify what should be run to do the actual monitoring. The first form simply `spawn`s the specified command with its STDIN opened to a stream of serialized node data. By default, the format of the serialized nodes is one node per line, and each line looks like this: «identifier» «attribute1»=«attribute1 value» «attribute2»=«attribute2 value»