How to present data sources from n Nodes
Subscribe

From OpenNMS

Jump to: navigation, search

Contents

Situation

Assume you are collecting data on several nodes. These information are related to each other. In my example, I am collecting the number of open radius sessions from my radius servers.

The idea is now to show two graphs:

  • One with a line per server, showing how the load is distributed over the servers

[[1]]

  • One with an Area showing the total number of concurrent users

[[2]]


Problem

If you look at the way OpenNMS is storing the data you see that that happens by node. The creation of the graphs happens as well "per node". With the given tools it's not possible to aggregate data sources from several nodes into a single graph.

Solution

The solution to this problem was described by Tarus on the opennms discussion mailinglist. As he was only sketching out the concept, I will describe in more detail how to get to the intended graphs.

The basic idea is the following: If opennms insists on having all the data sources in one node, we make sure it has. This can be done by using symlinks - the data source is a file. So you can simply add a symlink on the filesystem to make the data source from node A available to opennms in the directory of node B.

Using a real server as a "master" has however the disadvantage that this real server is connected to the "real" world. In the real world servers change names, place, interface or dedication.

But there's no need to use a "real" server as the point of reporting. A node can well be created without having an interface.

So the solution is: Create a virtual node, link all the datasources into it and define your graph. That simple.

Step by Step

Creating a "virtual" Node

Idea: Use the "Provisioning Groups" to add a node without interface.

  • Log in as Administrator to OpenNMS
  • Select the Admin Menu
  • Then "Manage Provisioning Groups"
  • 'Enter a name for the new Group', eg "Reporting Nodes" and 'then' click on "Add New Group" (clicking on "Add New Group" without giving a name will throw an ugly error)
  • Click on the Group Name ("Reporting Nodes")
  • "Add Node", enter a name for the Node ("App XYZ Reporting") and Save; there's no need to add an interface or anything else
  • You are done here - click on "done"
  • Now you should be back in the Provisioning Groups overview
  • The Nodes in Group / Nodes in DB field for your new group says "1/0"
  • To import the new nodes, click on "Import"
  • Reload the page
  • The Nodes in Group / DB should read 1/1 now - your node is in the DB
  • You can now search for your node (use the global search function)
  • 'Write down the NodeID' - in my case it's "2790"

The new virtual node should now be in the DB.

Link the Data Sources

Idea: Create symlinks in the file system to make the data sources available in the virtual node.

  • Log on to your opennms system
  • cd into your share/rrd/snmp/ directory

Now you need to find the datasources you want to link. This means that you need to know two things:

The filename of the data source and the NodeIDs of the nodes you want to report on.

In my cases the datasources are named "radusers_eins(zwei,drei).jrb":

/opt/OpenNMS/share/rrd/snmp/2790$ ls -l 
total 521
lrwxrwxrwx 1 root root     20 2008-04-02 19:01 radusers_eins.jrb -> ../2777/radusers.jrb
lrwxrwxrwx 1 root root     20 2008-04-02 19:00 radusers_zwei.jrb -> ../1185/radusers.jrb
lrwxrwxrwx 1 root root     20 2008-04-02 19:01 radusers_drei.jrb -> ../1252/radusers.jrb

The Nodes I retrieve the data from are 2777, 1185 and 1252:


radusers_eins.jrb -> ../2777/radusers.jrb
^^^^^^^^^^^^^           ^^^^^^^^^^^^^     
New ds-name          Real Datasource

Note: Under Windows 2000+ running OpenNMS, Hardlinks can be archived by using the GNU Tools for Win32 using the ln.exe command the same as on a Linux server. GNU Tools for Win32 can be found at http://sourceforge.net/projects/unxutils. Windows 2008 and Vista can create hardlinks using the native MKLINK command which is now included with Windows.

When this step is finished I have

  • A virtual Node
  • Symbolically linked data sources in the rrd/snmp/$NODE directory

Creating a Graph

Idea: Now we use the standard graphing facilities and make the graph.

Not much special anymore, but because creating RRD Graphs is such a major pain, I add the config I did:

Note that the new linked names are referenced in the report columns definition, while the original file names are used in the graphs DEF.

# radius.allusers
report.radius.allusers.name=allusers
report.radius.allusers.columns=radusers_eins,radusers_zwei,radusers_drei
report.radius.allusers.type=nodeSnmp
report.radius.allusers.command=--title="Users per Server" \
    --vertical-label Number \
    DEF:broker={rrd1}:radusers:AVERAGE \
    DEF:broker2={rrd2}:radusers:AVERAGE \
    DEF:broker3={rrd3}:radusers:AVERAGE \
    LINE1:broker#ff0000:"drei" \
    GPRINT:broker:MIN:"Min\\: %8.2lf %s" \
    GPRINT:broker:AVERAGE:"Avg\\: %8.2lf %s" \
    GPRINT:broker:MAX:"Max\\: %8.2lf %s\\n" \
    LINE1:broker2#00ff00:"zwei" \
    GPRINT:broker2:MIN:"Min\\: %8.2lf %s" \
    GPRINT:broker2:AVERAGE:"Avg\\: %8.2lf %s" \
    GPRINT:broker2:MAX:"Max\\: %8.2lf %s\\n" \
    LINE1:broker3#0000ff:"drei            " \
    GPRINT:broker3:MIN:"Min\\: %8.2lf %s" \
    GPRINT:broker3:AVERAGE:"Avg\\: %8.2lf %s" \
    GPRINT:broker3:MAX:"Max\\: %8.2lf %s\\n" \

Where getting three lines was fairly simple, the aggregation took a bit more effort:

# radius.totalusers
report.radius.totalusers.name=totalusers
report.radius.totalusers.columns=radusers_eins,radusers_zwei,radusers_drei
report.radius.totalusers.type=nodeSnmp
report.radius.totalusers.command=--title="Total Concurrent Users" \
    --vertical-label Number \
    DEF:eins={rrd1}:radusers:AVERAGE \
    DEF:zwei={rrd2}:radusers:AVERAGE \
    DEF:drei={rrd3}:radusers:AVERAGE \
    CDEF:totalusers=eins,zwei,drei,+,+ \
    AREA:totalusers#bacaff:"Total Users" \
    GPRINT:totalusers:MIN:"Min  \\: %8.2lf %s" \
    GPRINT:totalusers:AVERAGE:"Avg  \\: %8.2lf %s" \
    GPRINT:totalusers:MAX:"Max  \\: %8.2lf %s\\n" \

For examples of the graphs, look for the links on the top of the page.

'Key Learnings':

  • {rrdn} (n=1,2..) is related to the Columns (thanks, Karl)
  • CDEF is a pain to configure but works and is "sort of" logical

Result

If you have added the new reports (radius.allusers, radius.totalusers) to your list of prefabricated reports they should show now when you look at the resource graphs of your virtual node.

That's it.

'Tags': RRD, Jrobin, graphing, symlinks, node