2 # Copyright (C) 2004 Gustavo Torres
3 # Copyright (C) 2004 Stanislav Sinyagin
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
19 # $Id: onmsInterfaces.sh,v 1.1 2010-12-27 00:04:40 ivan Exp $
20 # Gustavo Torres <r3db34rd@yahoo.com>
21 # Stanislav Sinyagin <ssinyagin@yahoo.com>
24 # This shell script extracts OpenNMS information about interfaces
25 # and builds the data file which you can use with onms.tmpl to generate
26 # Torrus XML configuration.
28 # Usage (RESPONCEDIR setting may be skipped if it's in the default path)
30 # RESPONCEDIR=/var/opennms/rrd/response
32 # cd /usr/local/torrus-0.1/share/torrus/
33 # ./examples/onmsInterfaces.sh > onms.data
34 # tpage --define data=onms.data examples/onms.tmpl > xmlconfig/onms.xml
37 if test x"$RESPONCEDIR" = x""; then
38 RESPONCEDIR=/var/opennms/rrd/response
41 echo '[% responcedir = "'$RESPONCEDIR'" %]'
44 for ipaddr in `ls ${RESPONCEDIR}`; do
45 echo " { addr => '$i',";
46 echo " services => [";
47 for service in `ls ${RESPONCEDIR}/$i | awk -F. '{print $1}'`; do
48 echo -n " {name => '${service}', "
49 legend=`echo $j | awk '{print toupper($1)}'`
50 echo "legend => '${legend}'}"
59 # indent-tabs-mode: nil
60 # perl-indent-level: 4