default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / torrus / examples / onmsInterfaces.sh
1 #!/bin/sh
2 #  Copyright (C) 2004 Gustavo Torres
3 #  Copyright (C) 2004 Stanislav Sinyagin
4 #
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.
9 #
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.
14 #
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.
18
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>
22 #
23
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.
27
28 # Usage (RESPONCEDIR setting may be skipped if it's in the default path)
29 #
30 # RESPONCEDIR=/var/opennms/rrd/response
31 # export RESPONCEDIR
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
35
36
37 if test x"$RESPONCEDIR" = x""; then
38   RESPONCEDIR=/var/opennms/rrd/response
39 fi
40
41 echo '[% responcedir = "'$RESPONCEDIR'" %]'
42 echo '[% ifs = ['
43
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}'}"
51   done
52   echo '    ]';
53   echo '  }';
54 done
55 echo '] %]'
56
57 # Local Variables:
58 # mode: shell-script
59 # indent-tabs-mode: nil
60 # perl-indent-level: 4
61 # End: