EasyTarget, quick Torrus config generator

EastTarget is a Torrus plugin designed for those users who need to add some specific SNMP OIDs to Torrus collector, without having to edit the complex XML files. EasyTarget is a quick way to add a few new objects without too much efforts.

Installation

Follow the Torrus installation guide for the main software installation.

Install two Perl modules from CPAN:

  perl -MCPAN -e 'install Config::Tiny'
  perl -MCPAN -e 'install Config::Any'

Unpack the plugin distribution package in some directory:

  gzip -dc tp-easytarget-1.X.tar.gz | tar xvf -

Then run the Torrus plugin installation utility, pointing to the unpacked plugin directory:

  torrus install_plugin tp-easytarget-1.X

Quick steps

EasyTarget accepts input files in Windows-style INI format. It is important that the file extension is exactly ``.ini''. By default, the files are searched in the current directpoy and then in /easytarget.

The input file consists of sections, each representing a leaf or a subtree of Torrus datasource tree. You define the default parameters at the top of the file in global section, and then create a section for each tree element that you want to define. Here is a minimalistic example:

 OUTXML = mydevices.xml
 [/EasyTarget/dev1]
 snmp-host = 10.0.0.1
 snmp-community = public
 snmp-object = 1.3.6.1.4.1.5655.4.2.2.1.1.1.1.1.1
 [/EasyTarget/dev2]
 snmp-host = 10.0.0.2
 snmp-community = public
 snmp-object = 1.3.6.1.4.1.5655.4.2.2.1.1.1.1.1.1

Here's a more complex example:

 OUTXML = mydevices.xml
 [/EasyTarget/Myrouter/]
 snmp-host = 10.0.0.1
 snmp-community = public
 [/EasyTarget/Myrouter/data1]
 snmp-object = 1.3.6.1.4.1.5655.4.2.2.1.1.1.1.1.1
 
 [/EasyTarget/Myrouter/data2]
 snmp-object = 1.3.6.1.4.1.5655.4.2.2.1.1.1.1.2.1

Next step is to feed the input file to EasyTarget:

 torrus et --in=mydevices.ini --verbose

Then you need to add the generated XML file to the tree by editing the torrus-siteconfig.pl file, and compile the resulting tree:

 torrus compile --tree=main --verbose

Now you can start the collector and Apache server if they aren't yet running. If they were already running, you don't need to restart them.

Plugin documentation

The input file for the EasyTarget plugin is a two-level configuration file. Currently Windows-style INI format is supported. Other formats implemented in Config::Any Perl module should also work, but they were not tested.

The input file consists of two parts: the global parameters and per-section parameters. The section name defines the Torrus datasource subtree or leaf: if the name ends with the slash (/), it denotes a subtree and defines parameters for child leaves. Otherwise the section defines a leaf. The section name should always start with slash.

There are two types of parameters: the ones consisting of capitals ([A-Z]) are the parameters for the EasyTarget engine, and all others are the parameters passed to the generated Torrus config file.

There is no parameter inheritance. You can only define either a parameter on the global level, or in each of the sections. That means, for example, that if OUTXML is missing at the global level, it should be present in each section, regardless of the generated tree hierarchy. If a parameter exists both at the global level and in a section, the value in the section overrides the global one.

EasyTarget understands the following parameters:

The following parameters are set implicitly to their default values:

By default, EasyTarget applies the template snmp-defaults from snmp-defs.xml to each leaf.

The minimum set of parameters that should be defined in EasyTarget input files are: OUTXML, snmp-host, snmp-community and snmp-object.


Author

Copyright (c) 2007 Stanislav Sinyagin <ssinyagin@yahoo.com>