no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | addons:xymonconfigsync [2010/05/31 14:19] (current) – created - external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Xymon.pm ====== | ||
| + | |||
| + | ^ Author | [[ nelis@nlr.nl | wnelis ]] | | ||
| + | ^ Compatibility | Xymon 4.x | | ||
| + | ^ Requirements | Perl | | ||
| + | ^ Download | http:// | ||
| + | ^ Last Update | 2009-04-10 | | ||
| + | |||
| + | ===== Description ===== | ||
| + | |||
| + | The Xymon configuration files, and especially bb-hosts, contain information which is often also available in a configuration database. It would be nice if changes in the database are automatically replicated in the configuration files: it would eliminate the need to enter a change multiple times. The information in the database is generally not sufficient to generate a Xymon configuration file completely, thus some sort of synchronization between them is needed. Module Xymon.pm offers a part of a synchronization solution: it allows one to read a Xymon configuration file, to add, delete or change elements in it and to rewrite the file. | ||
| + | |||
| + | Module Xymon.pm is to be used in a script which reads the configuration database, and updates the configuration file accordingly. This script is specific to each company: it depends on the servers and services monitored in Xymon, the information available in a configuration database and the local policies with respect to the use of that information. | ||
| + | |||
| + | ===== Installation ===== | ||
| + | |||
| + | Not really applicable: it is to be installed in the search path of Perl. | ||
| + | |||
| + | ===== Source ===== | ||
| + | |||
| + | The module is available at [[http:// | ||
| + | |||
| + | <hidden onHidden=" | ||
| + | < | ||
| + | sub BuildComment(@) | ||
| + | sub BuildEmptyLines($) { return Xymon:: | ||
| + | sub BuildLayout(@) | ||
| + | sub BuildHost(@) | ||
| + | |||
| + | # | ||
| + | # Update the Xymon tests of the printers. These tests can be generated | ||
| + | # completely using information from the configuration database only. However, | ||
| + | # manual modifications of the tests are maintained. | ||
| + | # | ||
| + | sub UpdatePrinter() { | ||
| + | my $XMPrinterFil= '/ | ||
| + | my %Printer= () ; # List of printers | ||
| + | my $OldFile= undef ; # Ref to an existing bb-hosts file | ||
| + | my $NewFile= undef ; # Ref to rebuilded file | ||
| + | my @Host ; # List of references to one host | ||
| + | my $AHost ; # Ref to a host object | ||
| + | my $Descr ; # DESCR tag | ||
| + | my ($AnIf, | ||
| + | |||
| + | # | ||
| + | # %Ncm contains information of all devices. This information is retrieved from | ||
| + | # the Network Configuration Management database. Build a list of printers and | ||
| + | # group them by location. | ||
| + | # | ||
| + | | ||
| + | | ||
| + | | ||
| + | $Loc = $Ncm{$AnIf}{Room} ; | ||
| + | | ||
| + | | ||
| + | |||
| + | # | ||
| + | # Using the previously generated version of the file, if any, make a new | ||
| + | # version of the printer tests. | ||
| + | # | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | |||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | $ph= $Printer{$Site}{$Loc}{$AnIf} ; # Ref to printer info | ||
| + | | ||
| + | | ||
| + | | ||
| + | if ( @Host ) { | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | # | ||
| + | # Save the new version if there is no old version or if it differs from | ||
| + | # the old version. | ||
| + | # | ||
| + | if ( defined $OldFile ) { | ||
| + | | ||
| + | if ( $OldFile-> | ||
| + | | ||
| + | } else { | ||
| + | | ||
| + | } else { | ||
| + | | ||
| + | | ||
| + | | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ===== Known Bugs and Issues ===== | ||
| + | |||
| + | Module Xymon.pm is up to now only used to update the bb-hosts file. | ||
| + | |||
| + | ===== To Do ===== | ||
| + | |||
| + | ===== Credits ===== | ||
| + | |||
| + | ===== Changelog ===== | ||
| + | |||
| + | * **2009-04-10** | ||
| + | * Initial release | ||