monet is a flexible monitoring tool, suitable for network monitoring, host performance tracking, and for the instrumentation of complex systems, among others.
monet is written in Erlang. Erlang is a functional language developed at Ericsson, with nice fault-tolerancy features, inherent distribution, and soft realtime capabilities. It also makes heavy use of OTP, the Open Telecom Platform: a set of applications and libraries that provide support for SNMP, HTTP, ASN.1 and lots of other useful protocols and functionality. See the open-source erlang site or your closest mirror for more information.
At its current stage, monet is certainly not for the faint of heart. It works, but an alpha version is an alpha... Standard disclaimer about you being the only responsible if your cat dies and your network switches blow up because of using this software applies.
Because of legal issues, it has been almost completely reimplemented. Right now it's quite more primitive than the original monet, but I hope it will evolve quickly.
monet is released to the public under the terms of the General Public License (GPL), version 2 or later.
Measurement Objects are responsible for reading values from external resources (ie, performing measures) and then reporting them to MESH. They can also throw alarms at EVA upon errors from the resources they monitor.
An adaptation can be installed on EVA in order to receive and process the system alarms. By default, monet installs the main_handler adaptation, which calls user-defined alarm handlers. The syslog_adapt adaptation, which logs all events and alarms to the unix syslog can also be started.
Measurement reports and alarm deassertions, among others, generate events. EVA receives and logs them. Measurement values are logged separately.
Before proceeding, please note the erlang notation: terms between curly braces {} denote tuples, ie., like a record on a database. Terms between brackets [] denote a list. A list can have arbitrary length.
In erlang, strings are represented between double quotation marks, "So, this is a sample string". Atoms are identifiers, and they can be denoted with arbitrary strings as long as they use only a restricted set of characters (letters, numbers, underline). They can't begin with an uppercase letter, so thisIsAValidAtom but ThisIsNotAValidAtom. In case one needs to use an atom whose textual representation would be invalid (atoms including spaces, for instance) they can be enclosed between simple quotation marks, so 'this is a valid atom with spaces'.
Basic configuration is spread across three files:{meastype, TypeName, "Description of this measurement type", ModuleName, MaxInstances}. {measobject, ObjectName, TypeName, "Description of this Measurement Object", Resource, started, [argslist]}. {threshold, [ {ObjectName, ThresholdType, Value} ...]}. ...In the description above, meastype and measobject identify whether the tuple defines a measurement type or a measurement object.
TypeName in a type definition and ObjectName in a MO definition name the type or object being defined. TypeName in a MO definition is the type this object belongs to.
The ModuleName is the erlang module where the type is implemented, and MaxInstances is the maximum number of MOs allowed for this type. For the MOs, Resource is the resource it should monitor or get measurements from; it's up to each MO to interpret its meaning. Similarly, [argslist] is a list of arguments that will be passed to this MO. Finally, started is the state into which the MO will be created; for now, only this value is valid.
As well as measurement types and individual measurements of each type, maximum and minimum value thresholds for each measurement can also be defined in monitors.config, with tuples {threshold, [ List_of_Thresholds ]}, where the List_of_Thresholds is made of tuples {MeasurementObject, ThresholdType, Value}. MeasurementObject is the object to keep track of, and ThresholdType can be either the atom 'upper' or 'lower'. If any of these thresholds are ever exceeded an alarm will be generated (more on alarms and events later).
{ exttesthandler, "/path/to/handler.sh" }. { testhandler, { module, function } }. ...Each tuple is formed by a handler name and a handler definition. The definition can be either a string with a unix path - any executable - or a pair {Module,Function} - ie, an erlang function. Both will be called with the name, sender, severity and class of the alarm.
The exact calling convention is:
{ Condition, Handler }. ...Condition selects an erlang function which should return a boolean value when applied to an alarm, and if it returns true then the corresponding handler will be called. The general form of Condition is:
{Node,Module,Function,ArgumentList}For instance, {'agent@node14',scmodule,testfun,[]}.
{Module,Function}. {Function,ArgumentsList}.In the first case, arguments are assumed to be an empty list (ie., no arguments). In the second, the module is taken by default (several common functions are provided in the stddeps module). Even, for these common functions, the syntax:
{Function}.is valid.
Some of the common functions provided in the stddeps module are:
Valid classes are: communications,qos,processing,equipment, and environmental.
Valid severities are: indeterminate,critical,major,minor,warning.
As a sample, consider the following destinations.config:
{ always, exttesthandler}. { {class, [processing]}, testhandler}. {any, [ {always},{never,[]}], handlerA}. {all, [ {always,[]},{never}], handlerB}.In this example:
The generic erlang measurement type (generlmon) implements all the code needed for most simple measurements. You just have to provide him with a function of arity 2 that will be called as module:function(ResourceId, [ParamList]). In order to configure a monitor with generlmon, just add it to the monitors definition file; it should receive the following list of arguments:
[module,ModuleName,function,FunctionName,period,TimeInSecs,monargs,[ListOfArgs]]The ModuleName and FunctionName values point at your module:function() developed in erlang. The TimeInSecs period is the time between sucessive invocations of the function, and the ListOfArgs is the list of arguments that will be passed to your erlang monitor. See the examples in the sample config files.
The generic external measurement type (extmon) acts as a bridge between monet and external monitoring scripts such as those used by mon. In fact, it can use mon scripts without change. These monitoring scripts will be called as
monitor args resource-idThey should return nothing on stdout if everything is ok, or the resource-id in case of error (for compatibility with mon)