NAME

YATG::Tutorial - A simple YATG tutorial

DESCRIPTION

This tutorial will teach you how to set up YATG using a very simple configuration.

CREATING A SIMPLE CONFIGURATION

Although we could use "any" configuration format, let's start with a simple YAML configuration file:

---
yatg:
    oids:
        "sysUpTime":            [disk]
        "ifHCInOctets":         [ifindex, disk]
        "ifHCOutOctets":        [ifindex, disk]
    communities: [public]
    disk_root: '.' 
    dbi_connect:
        - "dbi:SQLite:database.db"
    dbi_ip_query: 'select ip from device;'

oids

This configuration file lists a few oids (sysUpTime, ifHCInOctets, ifHCOutOctets), and describes how to store each one (disk).

It's important to note that some oids represent scalar values (for instance, sysUpTime), while others represent arrays. For instance, ifHCInOctets may refer to several interfaces in the same machine: ifHCInOctets.0, ifHCInOctets.1, and so on.

You should hint YATG about these indexed interfaces, with the keyword ifindex.

communities

This is a list of community strings recognized by the monitored networks. In our case we'll use the default "public" community string.

disk_root

This configuration item specifies the root of the "disk" storage. By default it is /var/lib/yatg, but we'll use the current directory ('.') instead.

dbi_connect and dbi_ip_query

YATG uses an external database to store a list of IPs. By default it uses NetDisco schema; but NetDisco requires additional setup and configuration, so we'll use a simpler SQLite database, consisting of a single table.

CREATING A SOURCE DATABASE USING SQLITE

YATG uses a database to store the list of IPs it will monitor. We'll use the following script to create such a database, using SQLite:

CREATE TABLE device (
    id INTEGER AUTO_INCREMENT PRIMARY KEY,
    ip VARCHAR(15)
);

INSERT INTO device (id, ip) VALUES (1, '127.0.0.1');

Save this file as "database.sql" and create the database with the command:

sqlite3 database.db < database.sql

If no problems occur, you can start YATG.

STARTING YATG

By now, you should have the following files in your working directory:

config.yaml  # configuration file
database.sql # sql schema
database.db  # database file

Just execute yatg_updater, using the configuration file as parameter:

yatg_updater config.yaml

YATG will store the information gathered via SNMP in a sub-directory called 127.0.0.1.

TROUBLESHOOTING

The "disk" storage requires Tie::File::FixedRecLen. Make sure you have this module installed.

SEE ALSO

YATG
YATG::Config
http://www.sqlite.org/

AUTHOR

Nelson Ferraz <nferraz@gmail.com>

ACKNOWLEDGMENTS

Thanks to Oliver Gorwits who created YATG.

COPYRIGHT & LICENSE

Copyright (c) 2007 Nelson Ferraz. All Rights Reserved.

This documentation is free; you can redistribute it and/or modify it under the same terms as Perl itself.