Introduction |
The EDG WP4 Fabric Monitoring framework provides a facility to collect data from
distributed nodes and to store them centrally. The following picture gives an
overview of the different components involved:
![]() edg-fmon-agent , usually referred as
Monitoring Sensor Agent - MSA) running sensors on each node to monitor, and a
central server (edg-fmon-server ) to collect data. The server
receives samples as they are measured by MSA, and stores them in a database. Many
types of consumers can access the repository, including correlation engines,
plotting tools, alarm display, etc.
Programming interfaces are provided to add new sensors and to access the database.
We will discuss in this tutorial how to extend the set of sensors, how to deploy them, and how to access data in the repository. |
Install package |
The first action is to install the tutorial package on your computer. This
package is basically the EDG release with custom config files for this tutorial.
The normal EDG distribution is available as a rpm. But to avoid the need of root access, this tutorial is provided as a tarball that can be installed anywhere. File organization is the same as for the rpm, under a chosen root directory. The commands given below assume you put the package in your home directory.
To unpack the files, execute the commands:
This creates edg-fmon-tutorial directory, which includes all the
files for the following exercises.
At the end of the tutorial, if you need to clean-up the system, just type:
Now that the package is installed, we need to set some environment variables
(like the path to the edg-fmon package ,as it is not in the standard place, and
the server URL). A script with the default variables can be sourced to initialize
the environment properly. It must be done in all shell windows in which you plan
to use fmon software. Under bash, use:
Finally we can launch the MSA:
All the run time files (log files, repository cache, etc) are stored in
~/edg-fmon-tutorial/var/fmon . We can check if everything was fine by
having a quick look to the log file:
Of course, if you want to query status or stop the agent, you can use one of:
|
Configure metrics |
The configuration file of the MSA is written in
~/edg-fmon-tutorial/etc/edg-fmon-agent.conf .
This file is an ASCII representation of the configuration tree, consisting of key/value pairs organized hierarchically. So that it is easily readable (for us and for the MSA), it has a quite strict rule: the number of leading tabulations of each line correspond to the level of the tree node. Then follows the configuration node name (the key), and possibly a value. Take care that only tabs (and no spaces) are present before the first word on each line. Lines beginning with a dash (#) are skipped (this can be used to add comments). Blanks lines are allowed. Now that this tedious but necessary description has been done, we can have a look at the content of the file. The one distributed with the package contains only information related to general MSA setup (repository server name, etc). But the 'sensors', 'metrics', and 'samples' subtrees are empty. We are going to fill in the gaps now. The following example configures a metric checking if the program 'xeyes' is running on the machine.
After we made these modifications, the configuration file should look like:
When saved, the MSA re-reads the configuration automatically, as you can see in
the log file. And the measurements should actually appear in the database. You
can verify that easily in the local cache located in
~/edg-fmon-tutorial/var/fmon/agent_db/ . A flat file system is used,
one file per metric and per day, within each subdirectory (one per node).
Let's launch a subscriber, to have a 'live' feeling of what's going on.
This dumps the latest values of the metric, and then a message is displayed each
time a new sample is available:
It contains MSA identifier (usually the node name, here 'pcitpdp47'), the metric
identifier ('1'), the timestamp ('1037096424'), and the metric value ('0').
Once you launch xeyes , the value changes:
Note that the value is actually the number of running daemons among all the
users. If you launch other instances of xeyes the value will
increase (2,3,4..). There is the possibility to count the instances of the
process for a given user. To do that, the metric parameter user has
to be set to the wanted user name.
Exercise:
|
Write sensors |
Each sensor is a separate process launched by MSA when it starts. MSA then uses
an ASCII protocol through the standard input/ouput of the sensor to initialize
metrics, trigger measurements and collect samples. In this way, it is fairly
flexible to add new sensors, and to extend the capabilities of the monitoring
system.
Several ways exist to add a new sensor, and we will now go through them.
Exercise:
|
Access repository |
Currently, the only API available for the repository is a C API.
We have seen previously how to use edg-fmon-subscribe , a
repository subscriber that dumps on the screen the value of subscribed metrics. The simplest to write a
repository subscriber is to have a look at repositoryAPI.h and to the source code of
edg-fmon-subscribe , which is the file MR_Client.c .
To select the repository, set the environment variable MR_SERVER_URL correctly (this is done when you source
edg-fmon-tutorial-setup.sh ):
By default, a local connexion to port 12409 is done. edg-fmon-agent and edg-fmon-server use by default
this port for queries and subscriptions. The port number is set via variable MR_SOAP_PORT before launching MSA or repository.
Note that for the tutorial we use port 12411 instead (to avoid conflicts with possible running systems).
To build the executable:
The current interface uses some structures defined in edg_monitoring_types.h , but a simpler
interface (C and some scripting languages) will be delivered.
|