import torrus 1.0.9
authorivan <ivan>
Mon, 27 Dec 2010 00:04:44 +0000 (00:04 +0000)
committerivan <ivan>
Mon, 27 Dec 2010 00:04:44 +0000 (00:04 +0000)
322 files changed:
torrus/AUTHORS [new file with mode: 0644]
torrus/COPYING [new file with mode: 0644]
torrus/ChangeLog [new file with mode: 0644]
torrus/DIST_REVISION [new file with mode: 0644]
torrus/INSTALL [new file with mode: 0644]
torrus/Makefile.am [new file with mode: 0644]
torrus/Makefile.in [new file with mode: 0644]
torrus/NEWS [new file with mode: 0644]
torrus/README [new file with mode: 0644]
torrus/TODO [new file with mode: 0644]
torrus/aclocal.m4 [new file with mode: 0644]
torrus/bin/Makefile.am [new file with mode: 0644]
torrus/bin/Makefile.in [new file with mode: 0644]
torrus/bin/acledit.in [new file with mode: 0644]
torrus/bin/action_notify.in [new file with mode: 0644]
torrus/bin/action_printemail.in [new file with mode: 0644]
torrus/bin/action_snmptrap.in [new file with mode: 0644]
torrus/bin/action_snmpv1trap.in [new file with mode: 0644]
torrus/bin/bdbinfo.in [new file with mode: 0644]
torrus/bin/buildsearchdb.in [new file with mode: 0644]
torrus/bin/cleanup.in [new file with mode: 0644]
torrus/bin/clearcache.in [new file with mode: 0644]
torrus/bin/collector.in [new file with mode: 0644]
torrus/bin/compilexml.in [new file with mode: 0644]
torrus/bin/configinfo.in [new file with mode: 0644]
torrus/bin/configsnapshot.in [new file with mode: 0644]
torrus/bin/devdiscover.in [new file with mode: 0644]
torrus/bin/flushmonitors.in [new file with mode: 0644]
torrus/bin/genddx.in [new file with mode: 0644]
torrus/bin/genlist.in [new file with mode: 0644]
torrus/bin/genreport.in [new file with mode: 0644]
torrus/bin/install_plugin.in [new file with mode: 0644]
torrus/bin/monitor.in [new file with mode: 0644]
torrus/bin/nodeid.in [new file with mode: 0644]
torrus/bin/rrddir2xml.in [new file with mode: 0644]
torrus/bin/schedulerinfo.in [new file with mode: 0644]
torrus/bin/snmpfailures.in [new file with mode: 0644]
torrus/bin/srvderive.in [new file with mode: 0644]
torrus/bin/torrus.fcgi.in [new file with mode: 0644]
torrus/bin/torrus.in [new file with mode: 0644]
torrus/bin/ttproclist.in [new file with mode: 0644]
torrus/configs/Makefile.am [new file with mode: 0644]
torrus/configs/Makefile.in [new file with mode: 0644]
torrus/configs/devdiscover-config.pl [new file with mode: 0644]
torrus/configs/devdiscover-siteconfig.pl [new file with mode: 0644]
torrus/configs/email-siteconfig.pl [new file with mode: 0644]
torrus/configs/initscript.conf [new file with mode: 0644]
torrus/configs/notify-siteconfig.pl [new file with mode: 0644]
torrus/configs/snmptrap-siteconfig.pl [new file with mode: 0644]
torrus/configs/torrus-config.pl [new file with mode: 0644]
torrus/configs/torrus-siteconfig.pl [new file with mode: 0644]
torrus/configs/webmux.pl [new file with mode: 0644]
torrus/configs/webmux2.pl [new file with mode: 0644]
torrus/configure [new file with mode: 0755]
torrus/configure.ac [new file with mode: 0644]
torrus/conftools/config.guess [new file with mode: 0755]
torrus/conftools/config.sub [new file with mode: 0755]
torrus/conftools/install-sh [new file with mode: 0755]
torrus/conftools/missing [new file with mode: 0755]
torrus/discovery/README [new file with mode: 0644]
torrus/doc/Makefile.am [new file with mode: 0644]
torrus/doc/Makefile.in [new file with mode: 0644]
torrus/doc/devdoc/architecture.pod [new file with mode: 0644]
torrus/doc/devdoc/devdiscover.pod [new file with mode: 0644]
torrus/doc/devdoc/progstyle.pod [new file with mode: 0644]
torrus/doc/devdoc/reqs.0.0.pod [new file with mode: 0644]
torrus/doc/devdoc/reqs.0.1.pod [new file with mode: 0644]
torrus/doc/devdoc/torrus_roadmap.pod [new file with mode: 0644]
torrus/doc/devdoc/wd.distributed.pod [new file with mode: 0644]
torrus/doc/devdoc/wd.messaging.pod [new file with mode: 0644]
torrus/doc/devdoc/wd.monitor-escalation.pod [new file with mode: 0644]
torrus/doc/devdoc/wd.uptime-mon.pod [new file with mode: 0644]
torrus/doc/install.pod.in [new file with mode: 0644]
torrus/doc/manpages/Makefile.am [new file with mode: 0644]
torrus/doc/manpages/Makefile.in [new file with mode: 0644]
torrus/doc/manpages/torrus.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_acledit.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_action_notify.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_action_printemail.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_action_snmptrap.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_buildsearchdb.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_cleanup.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_clearcache.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_collector.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_compilexml.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_configinfo.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_configsnapshot.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_devdiscover.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_flushmonitors.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_genddx.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_genlist.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_genreport.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_install_plugin.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_monitor.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_nodeid.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_rrddir2xml.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_schedulerinfo.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_snmpfailures.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_srvderive.pod.in [new file with mode: 0644]
torrus/doc/manpages/torrus_ttproclist.pod.in [new file with mode: 0644]
torrus/doc/nodeid_usage.pod.in [new file with mode: 0644]
torrus/doc/reporting_setup.pod.in [new file with mode: 0644]
torrus/doc/rpnexpr.pod.in [new file with mode: 0644]
torrus/doc/rrfw_torrus_migration.pod.in [new file with mode: 0644]
torrus/doc/scalability.pod.in [new file with mode: 0644]
torrus/doc/snmpdiscovery.pod.in [new file with mode: 0644]
torrus/doc/stylingprofile.pod.in [new file with mode: 0644]
torrus/doc/userguide.pod.in [new file with mode: 0644]
torrus/doc/vendorsupport.pod.in [new file with mode: 0644]
torrus/doc/webintf.pod.in [new file with mode: 0644]
torrus/doc/xmlconfig.pod.in [new file with mode: 0644]
torrus/examples/Makefile.am [new file with mode: 0644]
torrus/examples/Makefile.in [new file with mode: 0644]
torrus/examples/README [new file with mode: 0644]
torrus/examples/onms.tmpl [new file with mode: 0644]
torrus/examples/onmsInterfaces.sh [new file with mode: 0644]
torrus/examples/setmonitor.xupdate.xml [new file with mode: 0644]
torrus/examples/torrus-siteconfig.powerbook.pl [new file with mode: 0644]
torrus/init.d/torrus.in [new file with mode: 0644]
torrus/perllib/Makefile.am [new file with mode: 0644]
torrus/perllib/Makefile.in [new file with mode: 0644]
torrus/perllib/Torrus/ACL.pm [new file with mode: 0644]
torrus/perllib/Torrus/ACL/AuthLocalMD5.pm [new file with mode: 0644]
torrus/perllib/Torrus/ACL/Edit.pm [new file with mode: 0644]
torrus/perllib/Torrus/ACL/Export.pm [new file with mode: 0644]
torrus/perllib/Torrus/ACL/Import.pm [new file with mode: 0644]
torrus/perllib/Torrus/Apache2Handler.pm [new file with mode: 0644]
torrus/perllib/Torrus/ApacheHandler.pm [new file with mode: 0644]
torrus/perllib/Torrus/CGI.pm [new file with mode: 0644]
torrus/perllib/Torrus/Collector.pm [new file with mode: 0644]
torrus/perllib/Torrus/Collector/CDef.pm [new file with mode: 0644]
torrus/perllib/Torrus/Collector/CDef_Params.pm [new file with mode: 0644]
torrus/perllib/Torrus/Collector/ExtDBI.pm [new file with mode: 0644]
torrus/perllib/Torrus/Collector/ExternalStorage.pm [new file with mode: 0644]
torrus/perllib/Torrus/Collector/RRDStorage.pm [new file with mode: 0644]
torrus/perllib/Torrus/Collector/SNMP.pm [new file with mode: 0644]
torrus/perllib/Torrus/Collector/SNMP_Params.pm [new file with mode: 0644]
torrus/perllib/Torrus/ConfigBuilder.pm [new file with mode: 0644]
torrus/perllib/Torrus/ConfigTree.pm [new file with mode: 0644]
torrus/perllib/Torrus/ConfigTree/Validator.pm [new file with mode: 0644]
torrus/perllib/Torrus/ConfigTree/Writer.pm [new file with mode: 0644]
torrus/perllib/Torrus/ConfigTree/XMLCompiler.pm [new file with mode: 0644]
torrus/perllib/Torrus/DB.pm [new file with mode: 0644]
torrus/perllib/Torrus/DataAccess.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/ALU_Timetra.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/ATMEL.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/AlliedTelesyn_PBC18.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/Alteon.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/Apple_AE.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/Arbor_E.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/Arista.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/AscendMax.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/AxxessIT.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/BetterNetworks.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/CasaCMTS.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/CiscoCatOS.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/CiscoFirewall.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/CiscoGeneric.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/CiscoIOS.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/CiscoIOS_Docsis.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/CiscoIOS_MacAccounting.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/CiscoIOS_SAA.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/CiscoSCE.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/CiscoVDSL.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/CompaqCIM.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/EmpireSystemedge.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/F5BigIp.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/FTOS.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/Foundry.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/Jacarta.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/JunOS.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/Liebert.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/MicrosoftWindows.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/MotorolaBSR.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/NetApp.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/NetBotz.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/NetScreen.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/OracleDatabase.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/Paradyne.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/RFC1628_UPS_MIB.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/RFC1657_BGP4_MIB.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/RFC1697_RDBMS.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/RFC2011_IP_MIB.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/RFC2662_ADSL_LINE.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/RFC2670_DOCS_IF.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/RFC2737_ENTITY_MIB.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/RFC2790_HOST_RESOURCES.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/Symmetricom.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/UcdSnmp.pm [new file with mode: 0644]
torrus/perllib/Torrus/DevDiscover/Xylan.pm [new file with mode: 0644]
torrus/perllib/Torrus/Log.pm [new file with mode: 0644]
torrus/perllib/Torrus/Monitor.pm [new file with mode: 0644]
torrus/perllib/Torrus/RPN.pm [new file with mode: 0644]
torrus/perllib/Torrus/Renderer.pm [new file with mode: 0644]
torrus/perllib/Torrus/Renderer/AdmInfo.pm [new file with mode: 0644]
torrus/perllib/Torrus/Renderer/Frontpage.pm [new file with mode: 0644]
torrus/perllib/Torrus/Renderer/HTML.pm [new file with mode: 0644]
torrus/perllib/Torrus/Renderer/RRDtool.pm [new file with mode: 0644]
torrus/perllib/Torrus/ReportGenerator.pm [new file with mode: 0644]
torrus/perllib/Torrus/ReportGenerator/MonthlySrvUsage.pm [new file with mode: 0644]
torrus/perllib/Torrus/ReportOutput.pm [new file with mode: 0644]
torrus/perllib/Torrus/ReportOutput/HTML.pm [new file with mode: 0644]
torrus/perllib/Torrus/SNMP_Failures.pm [new file with mode: 0644]
torrus/perllib/Torrus/SQL.pm [new file with mode: 0644]
torrus/perllib/Torrus/SQL/Reports.pm [new file with mode: 0644]
torrus/perllib/Torrus/SQL/SrvExport.pm [new file with mode: 0644]
torrus/perllib/Torrus/Scheduler.pm [new file with mode: 0644]
torrus/perllib/Torrus/SchedulerInfo.pm [new file with mode: 0644]
torrus/perllib/Torrus/Search.pm [new file with mode: 0644]
torrus/perllib/Torrus/ServiceID.pm [new file with mode: 0644]
torrus/perllib/Torrus/SiteConfig.pm [new file with mode: 0644]
torrus/perllib/Torrus/TimeStamp.pm [new file with mode: 0644]
torrus/scripts/rrdup_notify.sh [new file with mode: 0644]
torrus/scripts/xml/extract-skeleton.xsl [new file with mode: 0644]
torrus/setup_tools/Bundle/Torrus.pm [new file with mode: 0644]
torrus/setup_tools/check_perlthreading.pl [new file with mode: 0644]
torrus/setup_tools/configure_fhs [new file with mode: 0755]
torrus/setup_tools/mkvardir.sh.in [new file with mode: 0644]
torrus/setup_tools/replace_rrfw.sh [new file with mode: 0755]
torrus/setup_tools/substvars.sh.in [new file with mode: 0644]
torrus/sup/Makefile.am [new file with mode: 0644]
torrus/sup/Makefile.in [new file with mode: 0644]
torrus/sup/dtd/snmp-discovery.dtd [new file with mode: 0644]
torrus/sup/dtd/torrus-config.dtd [new file with mode: 0644]
torrus/sup/mibs/RRDTOOL-SMI.txt [new file with mode: 0644]
torrus/sup/mibs/TORRUS-MIB.txt [new file with mode: 0644]
torrus/sup/styling/colornames.pl [new file with mode: 0644]
torrus/sup/styling/rainbow-schema.pl [new file with mode: 0644]
torrus/sup/styling/torrus-schema.pl [new file with mode: 0644]
torrus/sup/webplain/explain-rrdgraph.html [new file with mode: 0644]
torrus/sup/webplain/torrus-printer.css [new file with mode: 0644]
torrus/sup/webplain/torrus-report.css [new file with mode: 0644]
torrus/sup/webplain/torrus.css [new file with mode: 0644]
torrus/templates/aclexport.xml [new file with mode: 0644]
torrus/templates/adminfo.html [new file with mode: 0644]
torrus/templates/default-chooser.html [new file with mode: 0644]
torrus/templates/default-dir.html [new file with mode: 0644]
torrus/templates/default-helptext.html [new file with mode: 0644]
torrus/templates/default-login.html [new file with mode: 0644]
torrus/templates/default-recursivedir.html [new file with mode: 0644]
torrus/templates/default-rrd.html [new file with mode: 0644]
torrus/templates/default-tset.html [new file with mode: 0644]
torrus/templates/email-alarm.txt [new file with mode: 0644]
torrus/templates/expanded-dir.html [new file with mode: 0644]
torrus/templates/globalsearch.html [new file with mode: 0644]
torrus/templates/html-incblocks.txt [new file with mode: 0644]
torrus/templates/overview-subleaves.html [new file with mode: 0644]
torrus/templates/report-index.html [new file with mode: 0644]
torrus/templates/report-monthly.html [new file with mode: 0644]
torrus/templates/report-serviceid.html [new file with mode: 0644]
torrus/templates/report-yearly.html [new file with mode: 0644]
torrus/templates/search.html [new file with mode: 0644]
torrus/templates/tset-list.html [new file with mode: 0644]
torrus/xmlconfig/Makefile.am [new file with mode: 0644]
torrus/xmlconfig/Makefile.in [new file with mode: 0644]
torrus/xmlconfig/cdef-collector-defs.xml [new file with mode: 0644]
torrus/xmlconfig/defaults.xml [new file with mode: 0644]
torrus/xmlconfig/examples/apc-ups.xml [new file with mode: 0644]
torrus/xmlconfig/examples/ascend.max.xml [new file with mode: 0644]
torrus/xmlconfig/examples/docsis-monitors.xml [new file with mode: 0644]
torrus/xmlconfig/examples/generic-netsnmp.xml [new file with mode: 0644]
torrus/xmlconfig/examples/hpux.xml [new file with mode: 0644]
torrus/xmlconfig/examples/monitors.xml [new file with mode: 0644]
torrus/xmlconfig/examples/multigraph.xml [new file with mode: 0644]
torrus/xmlconfig/examples/rainbow-schema.xml [new file with mode: 0644]
torrus/xmlconfig/examples/servers.data [new file with mode: 0644]
torrus/xmlconfig/examples/servers.tmpl [new file with mode: 0644]
torrus/xmlconfig/generic/collector-periods.xml [new file with mode: 0644]
torrus/xmlconfig/generic/monitors.xml [new file with mode: 0644]
torrus/xmlconfig/generic/rfc1628.ups.xml [new file with mode: 0644]
torrus/xmlconfig/generic/rfc1697.rdbms.xml [new file with mode: 0644]
torrus/xmlconfig/generic/rfc2662.adsl-line.xml [new file with mode: 0644]
torrus/xmlconfig/generic/rfc2670.docsis-if.xml [new file with mode: 0644]
torrus/xmlconfig/generic/rfc2790.host-resources.xml [new file with mode: 0644]
torrus/xmlconfig/generic/rfc2863.if-mib.xml [new file with mode: 0644]
torrus/xmlconfig/old/cisco-mac-accounting-example.xml [new file with mode: 0644]
torrus/xmlconfig/old/cisco.generic.old-0.1.4.xml [new file with mode: 0644]
torrus/xmlconfig/old/cisco.ios.mac-accounting-0.1.8.xml [new file with mode: 0644]
torrus/xmlconfig/old/rfc1213.xml [new file with mode: 0644]
torrus/xmlconfig/old/rfc2670.docsis-if.old.0.1.5d-20040224.xml [new file with mode: 0644]
torrus/xmlconfig/old/rfc2670.docsis-if.old.1.0.4.xml [new file with mode: 0644]
torrus/xmlconfig/old/rfc2863.if-mib.old-0.1.4.xml [new file with mode: 0644]
torrus/xmlconfig/old/rfc2863.if-mib.old-0.1.7.xml [new file with mode: 0644]
torrus/xmlconfig/old/snmp-defs.old-0.1.2.xml [new file with mode: 0644]
torrus/xmlconfig/site-global.xml [new file with mode: 0644]
torrus/xmlconfig/snmp-defs.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/alteon.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/alu-timetra.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/apc.ups.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/apple.ae.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/arbor_e.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/ascend.max.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/atmel.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/betternetworks.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/casa-cmts.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/cisco.firewall.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/cisco.generic.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/cisco.ios.docsis.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/cisco.ios.mac-accounting.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/cisco.ios.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/cisco.sce.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/cisco.vdsl-line.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/compaq.cim.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/empire.systemedge.ntregperf.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/empire.systemedge.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/f5.bigip.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/foundry.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/ftos.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/hp.hpux.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/jacarta.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/junos.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/liebert.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/microsoft.windows.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/motorola.bsr.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/netapp.filer.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/netbotz.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/netscreen.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/paradyne.xdsl.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/symmetricom.xml [new file with mode: 0644]
torrus/xmlconfig/vendor/ucd.ucd-snmp.xml [new file with mode: 0644]

diff --git a/torrus/AUTHORS b/torrus/AUTHORS
new file mode 100644 (file)
index 0000000..a884ff2
--- /dev/null
@@ -0,0 +1,47 @@
+***************************************************
+Stanislav Sinyagin
+Senior System Engineer, CCIE #5478
+K-Open GmbH
+Switzerland
+Tel. +41 79 407 0224
+
+ssinyagin@yahoo.com
+http://www.k-open.com
+***************************************************
+
+CREDITS:
+
+  Chris Amley
+    Xylan switches SNMP discovery
+
+  Scott Brooks <sbrooks@binary-solutions.net>
+    Atmel wireless devices SNMP discovery
+
+  Aaron Bush <abush@microcenter.com> 
+    APC and HP vendor templates.
+
+  Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+    Many contributions in various parts.
+
+  Marc Haber <mh+torrus@zugschlus.de>
+    Lots of bug reports and architecture ideas.
+
+  Roman Hochuli <roman@hochu.li>
+    Bug reports and new feature ideas.
+    Vendor templates for Ascend and DOCSIS.
+
+  Ian Holsman http://holsman.net <ian@holsman.net>
+    Adapted the bluerobot.com HTML layout design for Torrus.
+
+  Gord Philpott <tech@gordphilpott.com>
+    Numerous bug reports.
+
+  Christian Schnidrig <christian.schnidrig@gmx.ch>
+    Architecture ideas, interface improvements, other contributions.
+
+  Jurij Smakov <jurij@wooyd.org>
+    Contributed in manpages creation. Maintainer of Debian port.
+
+  Jon Nistor <nistor@snickers.org>
+    Bug reports and contributions for JunOS, Cisco SCE and other
+    vendors discovery.
diff --git a/torrus/COPYING b/torrus/COPYING
new file mode 100644 (file)
index 0000000..d60c31a
--- /dev/null
@@ -0,0 +1,340 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+\f
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/torrus/ChangeLog b/torrus/ChangeLog
new file mode 100644 (file)
index 0000000..30543fe
--- /dev/null
@@ -0,0 +1,2302 @@
+2010-10-24  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 1.0.9
+
+2010-10-12  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/CGI.pm: New URL parameter: 'v' is a synonym for 'view'
+
+2010-10-06  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/html-incblocks.txt: 'cssoverlay' now must point to
+       an absolute URL
+
+2010-09-23  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoIOS.pm (checkdevtype):
+       New discovery parameter: CiscoIOS::enable-unrouted-vlan-interfaces
+
+2010-09-20  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/Jacarta.pm:
+       New discovery module for Jacarta iMeter (thanks to Roman Hochuli)
+
+2010-09-17  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector/SNMP.pm (initCollectorGlobals):
+       Refresh the SNMP maps after a configuration re-compile
+
+2010-08-31  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * performance optimizations: XML compiler runs 15-20% faster 
+
+2010-08-16  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm:
+       Selector actions split: discards moved from NoErrorCounters to
+       NoDiscardCounters;
+       and from InErrorsMonitor/OutErrorsMonitor to
+       InDiscardsMonitor/OutDiscardsMonitor
+
+       * perllib/Torrus/Collector.pm: collector_tokens database now depends
+       on DS configuration instance
+
+2010-08-13  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/CGI.pm: Added host-based authentication
+
+2010-08-09  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * Updated discovery modules for Net::SNMP 6.0.0 compatibility
+
+2010-08-03  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * init.d/torrus.in: bugfix in RHEL compatibility.
+       Do "chkconfig --del torrus", install the new version into /etc/init.d,
+       then "chkconfig --add torrus", then "service torrus restart"    
+
+2010-07-21  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/snmpfailures.in: new utility for SNMP failures reporting
+
+       * perllib/Torrus/Collector/SNMP.pm: SNMP failures stored in a database
+
+2010-06-12  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/genlist.in: Added a list of all SNMP hosts
+
+2010-05-14  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CasaCMTS.pm: new discovery module
+
+2010-05-09  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/nodeid.in: new command-line utility
+
+       * configure.ac: new Perl module dependency: JSON
+
+2010-04-11  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * configs/torrus-config.pl:
+       replaced $Torrus::ApacheHandler::authorizeUsers with
+       $Torrus::CGI::authorizeUsers.
+
+2010-04-08  Jon Nistor  <nistor@snickers.org>
+        * perllib/Torrus/DevDiscover/Arbor_E.pm:
+        New parameter: Arbor_E::disable-e100-policymgmt, disable-e100-submgmt
+        Added policy management and subscriber information
+
+2010-04-07  Jon Nistor  <nistor@snickers.org>
+
+        * perllib/Torrus/DevDiscover/Arbor_E.pm:
+        New parameter: Arbor_E::disable-e100-mem
+        Added memory usage per CPU for the e100 series devices
+
+2010-04-04  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/ConfigTree.pm,
+       perllib/Torrus/ConfigTree/Writer.pm,
+       perllib/Torrus/CGI.pm:
+       New parameter: nodeid. It defines a new way of referring
+       to subtrees and leaves.
+       Also IF-MIB and Foundry discovery is updated.
+
+2010-03-30  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover.pm: 
+       Default snmp-max-msg-size is set back to 1470
+       
+       * perllib/Torrus/DevDiscover/Foundry.pm: new discovery module
+
+2010-03-23  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/generic/rfc2790.host-resources.xml:
+       [Bernhard Schmidt] Simplify the Uptime graph to display only Days
+
+       * xmlconfig/vendor/ucd.ucd-snmp.xml:
+       [Bernhard Schmidt] make Block I/O datasources a COUNTER
+       correct display units for Memory
+
+       * perllib/Torrus/DevDiscover/UcdSnmp.pm:
+       [Bernhard Schmidt] added ssCpuRawSoftIRQ
+
+2010-03-07  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/torrus.fcgi.in: FastCGI support
+
+       * templates/default-login.html: Added "remember me"
+
+       * perllib/Torrus/ApacheHandler.pm: Changed to Torrus::CGI
+
+       * perllib/Torrus/Apache2Handler.pm: Changed to Torrus::CGI.
+       Now incompatible with "SetHandler modperl"
+
+       * perllib/Torrus/CGI.pm: New HTTP handler instead of two different
+       Apache handlers.
+
+2010-03-05  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/flushmonitors.in: new utility
+
+       * bin/compilexml.in: Dynamic tokenset members are preserved between
+       compilations
+
+       * perllib/Torrus/ConfigTree.pm (tsetAddMember): Tokenset members
+       have now an indicated origin (monitor/static)
+
+       * perllib/Torrus/Monitor.pm: Alarms are now persistent between
+       config re-compilations
+
+2010-02-21  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Renderer/HTML.pm:
+       New parameter: node-display-name. Now interface names are not
+       underscored
+       
+
+2010-02-18  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Renderer/RRDtool.pm (rrd_make_multigraph):
+       new multigraph parameters: line-stack-X, line-alpha-X
+
+2010-02-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover.pm (discover):
+       Default snmp-max-msg-size is set to 65535 for SNMP v1 and v2
+
+2010-02-07  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (buildConfig):
+       new selector action: NotifyPolicy
+
+2010-02-02  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/ALU_Timetra.pm:
+       new discovery parameter: ALU_Timetra::full-ifdescr
+
+2010-01-27  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/ALU_Timetra.pm: new discovery module
+
+2010-01-24  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover.pm (discover):
+       snmp-max-msg-size is used now in discivery, not only in collector
+
+2009-10-28  Jon Nistor  <nistor@snickers.org>
+
+        * perllib/Torrus/DevDiscover/Arista.pm (discover):
+        New discovery module: Arista Networks
+
+2009-05-31  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Renderer/RRDtool.pm:
+       new view parameters:
+       disable-legend, disable-title, disable-vertical-label
+
+2009-05-26  Jon Nistor  <nistor@snickrs.org>
+
+       * perllib/Torrus/DevDiscover/Arbor_E.pm (discover):
+       New discovery parameter: Arbor_E::disable-e30-hdd-logs,
+        Arbor_E::enable-e30-mempool
+
+2009-05-11  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/NetBotz.pm (discover):
+       Discovery parameters: NetBotz::temp-max, NetBotz::humi-max,
+       NetBotz::dew-max
+
+2009-05-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/NetBotz.pm: new discovery module
+       for NetBotz modular sensors
+
+2009-05-07  Jon Nistor <nistor@snickers.org>
+
+       * perllib/Torrus/DevDiscover/FTOS.pm
+       New discovery module for Force10 Networks devices
+
+2009-04-05  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 1.0.8
+
+2008-11-29  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoIOS.pm (discover):
+       New discovery parameter: CiscoIOS::short-device-comment
+
+2008-11-06  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector/SNMP.pm (runCollector):
+       Number of SNMP sessions per snmp_dispatcher is limited to 100
+       because of some strange bugs (found on SPARC/Solaris platform)
+
+2008-10-28  Jon Nistor <nistor@snickers.org>
+
+        * perllib/Torrus/DevDiscover/Liebert.pm:
+        New discovery module for Liebert HVAC systems
+
+2008-10-26  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/srvderive.in: new utility that combines several services
+       and combines them as MAX or SUM
+       (sponsored by nexellent ag, www.nexellent.ch)
+
+2008-09-25  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * Added safe signal handlers to all components. Also Apache handlers
+       close the BDB environment at the end of each execution.
+       BDB should now be much more stable.
+
+2008-09-16  Jon Nistor <nistor@snickers.org>
+
+       * perllib/Torrus/DevDiscover/Arbor_E.pm:
+       New discovery module for Arbor E series devices
+
+2008-09-15  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector.pm: Now the collector cache is filled by
+       the compiler. This optimizes the collector startup. Need to re-compile
+       after upgrade.
+
+2008-09-13  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/configsnapshot.in: Bugfix in root subtree parameters
+       * bin/configsnapshot.in: added parameter filtering option
+
+2008-09-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoIOS.pm: Filtered out EOBC and FIFO
+       virtual interfaces
+
+       * xmlconfig/vendor/cisco.ios.mac-accounting.xml:
+       Bugfix in the RRD filename
+
+2008-08-07  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Renderer/RRDtool.pm (rrd_make_opts):
+       View parameters can be overridden with URL
+       variables "Gstart", "Gend" and so on.
+
+2008-08-05  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 1.0.7
+
+2008-08-04  Jon Nistor <nistor@snickers.org>
+
+        * perllib/Torrus/DevDiscover/CiscoIOS.pm (discover):
+        new discovery parameter: CiscoIOS::disable-vpdn-stats
+
+2008-07-23  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2670_DOCS_IF.pm (discover):
+       new discovery parameter: RFC2670_DOCS_IF::upstreams-only
+
+2008-06-20  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * Tree names can be specified in the External
+       Storage (Billing reports) 
+
+2008-06-07  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector/SNMP.pm:
+       New parameter: snmp-ignore-mib-errors
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (buildConfig):
+       New parameter generated by IF-MIB: interface-comment
+
+2008-06-01  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * IPv6 support in devdiscover and in SNMP collector
+
+2008-05-22  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/bdbinfo.in: BerkeleyDB version info utility
+
+2008-03-29  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (buildConfig):
+       RFC2863_IF_MIB::external-serviceid now accepts host/interface notation
+
+2008-03-28  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/SQL/Reports.pm (finalize): added SQL commit
+
+2008-03-16  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/collector.in: Threads are now always initialized,
+       not only in daemon mode
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm:
+       New selectors: InBytesParameters, OutBytesParameters
+
+       * perllib/Torrus/DevDiscover.pm (buildConfig):
+       New discovery parameter: include-files
+
+2008-01-12  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/JunOS.pm: Added interface filter to
+       exclude service interfaces
+
+       * perllib/Torrus/DevDiscover.pm, perllib/Torrus/Collector/SNMP.pm:
+       snmp-max-msg-size, new parameter for SNMP session
+
+2007-12-09  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoSCE.pm: New discovery parameters:
+       CiscoSCE::disable-*** (Jon Nistor)
+
+2007-11-30  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/defaults.xml: Default collector-timeoffset-step increased
+       from 30 to 60 seconds. 30 seconds is too short for too many
+       installations.
+
+2007-11-08  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (buildConfig):
+       New selector action: RemoveInterface
+
+2007-09-30  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/JunOS.pm: Dramatic update by Jon Nistor
+
+2007-08-23  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/Symmetricom.pm:
+       New discovery module for Symmetricom NTP clock (Jon Nistor)
+
+2007-08-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoIOS.pm:
+       Removed BGP Advertized prefixes
+       Added the prefix limits to Accepted prefixes
+       
+
+2007-08-03  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Torrus release 1.0.6
+
+2007-07-27  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector/SNMP.pm: removed "reptoken" and
+       optimized the snmp arguments
+
+2007-06-16  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/collector.in: Now multiple collector instances can run
+       in a single tree. Need to recompile all trees and re-start the
+       daemons. A new copy of init.d/torrus should be copied
+       in startup scripts directory. Also execute for every tree:
+       torrus si --tree=TREE --clear
+       
+
+2007-06-15  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * configure.ac: Perl 5.8.8 is required for threads
+
+2007-06-14  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/genreport.in: New option: --all2tree
+
+       * perllib/Torrus/DevDiscover/Alteon.pm: New discovery module
+
+2007-06-04  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoIOS.pm: Cisco CAR statistics
+
+2007-05-05  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector/SNMP.pm:
+       fixed the bug for unreachable timeout
+       the target that receives noSuchObject is deleted from polling
+
+2007-05-04  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector/CDef.pm: Imported the CDEF collector
+       from Chrstian Schnidrig and adapted to multithreading.
+
+       * perllib/Torrus/DevDiscover.pm: Adapted for global configuration.
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm:
+       New discovery parameter: RFC2863_IF_MIB::traffic-summaries
+       Currently summaries work only within single output file.
+       
+
+2007-04-12  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Renderer/HTML.pm: Search engine GUI
+
+2007-04-11  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/buildsearchdb.in: The search DB builder (GUI is not ready yet)
+
+       * perllib/Torrus/DevDiscover.pm:
+       New discovery param: show-recursive
+
+       * templates/default-dir.html: Limit recursive view to
+       subtrees having show-recursive=yes
+
+2007-04-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/ConfigTree.pm:
+       Moved the param properties to the XML config.
+       All trees need recompilation after this change.
+
+2007-04-05  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/ConfigTree/XMLCompiler.pm (compile_subtrees):
+       Removed support for <filepattern>
+
+2007-03-23  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Renderer/RRDtool.pm (rrd_make_graphline):
+       line-style line-color from the node params override thse
+       in the view params
+
+2007-03-18  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/JunOS.pm: Added per-CoS traffic statistics
+
+2007-03-16  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Apache2Handler.pm, perllib/Torrus/ApacheHandler.pm:
+       User login event in the apache error log
+
+       * perllib/Torrus/DevDiscover/CiscoIOS_MacAccounting.pm:
+       MAC accounting on subinterfaces
+
+2007-02-14  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoIOS.pm (discover):
+       Replaced CiscoIOS::disable-membuf-stats with
+       CiscoIOS::enable-membuf-stats.
+       Now cisco buffer stats are disabled by default
+
+2007-02-13  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector/SNMP.pm: SNMP maps automatic refreshing
+
+       * bin/devdiscover.in: Devdiscover now accepts multiple input files
+
+2007-02-09  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover.pm:
+       New discovery param: template-registry-overlays
+
+2007-02-02  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoSCE.pm:
+       Added service counters and queue utilization
+
+2007-01-25  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 1.0.5
+
+2007-01-23  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * configure.ac: Synchronized with Autoconf 2.60.
+       Now 2.60 is the minimum required version.
+       Changed docdir to pkgdocdir
+
+2007-01-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoIOS.pm (checkdevtype):
+       IOS XR support
+
+2007-01-05  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoIOS.pm (checkdevtype):
+       New discovery parameter: CiscoIOS::enable-vlan-interfaces
+       (discover): added Cisco BGP statistics
+
+2006-12-22  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/JunOS.pm:
+       New discovery module for Juniper 
+
+2006-12-21  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoIOS_MacAccounting.pm (discover):
+       New discovery parameter: CiscoIOS_MacAccounting::tokenset-members
+
+2006-12-05  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (discover):
+       New discovery parameter:
+       RFC2863_IF_MIB::exclude-down-interfaces
+
+       * bin/configinfo.in: Added the tree compilation timestamp
+
+2006-12-03  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector/SNMP.pm:
+       SNMP mapping lookups are now asynchronous.
+       PDUs are rescheduled with delays
+       Not compatible with old cbQos plugin, needs tp-cisco-cbqos-1.4d
+
+2006-11-26  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector/SNMP.pm: new SNMP parameters:
+         snmp-localaddr and snmp-localport
+
+
+2006-11-23  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoIOS_MacAccounting.pm:
+       New discovery parameter:
+       CiscoIOS_MacAccounting::external-serviceid
+
+2006-10-14  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm:
+       new discovery parameters:
+       RFC2863_IF_MIB::bandwidth-usage
+       RFC2863_IF_MIB::bandwidth-limits
+
+2006-10-08  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/ConfigTree.pm (new): exclusivity lock:
+       only one compiler can run for a tree
+
+2006-09-29  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/generic/rfc2863.if-mib.xml: added an overvew shortcut
+       for interface errors
+
+       * perllib/Torrus/RPN.pm: IF accepts UNKN values
+
+2006-09-28  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * configure.ac: theads module version must be 1.41 or higher,
+       and threads::shared 1.03 or higher.
+
+2006-09-27  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/rrddir2xml.in: New option: --filter
+
+       * xmlconfig/generic/rfc2670.docsis-if.xml:
+       Added Frequency to upstream statictics monitoring.
+       Old upstream stats will be lost!!
+       The old templates file is
+       in xmlconfig/old/rfc2670.docsis-if.old.1.0.4.xml
+
+2006-09-26  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoSCE.pm: New discovery module
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm:
+       Improvements for persistent interface indexes
+
+       * perllib/Torrus/DevDiscover/MotorolaBSR.pm: New discovery module
+       for Motorola CMTS (Riverdelta)
+
+2006-09-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector/RRDStorage.pm (storeData):
+       RRDQueue statistics are now set in the beginning of the cycle
+
+2006-08-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/ConfigBuilder.pm (new): encoding changed from
+       UTF8 to UTF-8
+
+2006-07-31  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoFirewall.pm (discover):
+       Interface names taken from ifName
+
+2006-07-24  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * setup_tools/check_perlthreading.pl: Quick test of multithreading
+       support
+
+2006-07-21  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector/RRDStorage.pm (updateRRD):
+       Added threading support: a background thread for RRD updates    
+
+2006-07-20  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/devdiscover.in: Added multithreading support
+
+       * configure.ac: Multithreading checkup
+
+       * NEWS: Torrus release 1.0.4
+
+2006-05-17  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (buildConfig):
+       RFC2863_IF_MIB::tokenset-members now accepts host names
+       and can be defined at the global level.
+
+2006-05-11  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (buildConfig):
+       new discovery parameter: RFC2863_IF_MIB::noout
+
+2006-03-09  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (buildConfig):
+       New discovery parameter: RFC2863_IF_MIB::subtree-comment
+
+       * perllib/Torrus/Renderer/Frontpage.pm (renderUserLogin):
+       New config option: $Torrus::Renderer::lostPasswordURL
+
+2006-03-01  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Renderer/HTML.pm:
+       New config variable: $Torrus::Renderer::companyLogo
+       to display a logo instead of text
+
+2006-02-22  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover.pm: 'comment' parameter is copied
+       from DDX to the host level.
+
+2006-02-21  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Monitor.pm: New monitor parameters:
+       display-rpn-expr display-format
+       (run_event_exec): New environment variable: TORRUS_DISPLAY_VALUE
+
+2006-02-15  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover.pm (discover):
+       New discovery parameter: suppress-legend
+
+2006-02-13  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm:
+       Complex matching expressions for subtree name selector 
+
+       * perllib/Torrus/DevDiscover/CiscoGeneric.pm (discover):
+       Cisco power supply monitoring
+
+2006-02-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/action_notify.in: New monitor action
+
+       * perllib/Torrus/Monitor.pm:
+       New monitor parameter: "severity"
+
+       * perllib/Torrus/DevDiscover/CiscoIOS.pm: Cisco Docsis bundle
+       interfaces excluded from discovery
+
+2006-01-06  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/RPN.pm: New RPM functions: INF, NEGINF
+
+2005-12-12  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/RPN.pm: DUP and EXC accept undefined arguments now
+
+2005-12-07  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/RPN.pm: New RPN function: NUM
+
+2005-11-28  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/ttproclist.in: Two new functions: lc, uc  
+
+2005-11-22  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector/SNMP.pm: Added SNMPv3 support
+
+2005-10-19  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/genreport.in: Report generator utility
+
+2005-10-17  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoVDSL.pm:
+       New discovery module for Cisco Catalyst LRE
+
+2005-10-14  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/default-dir.html, templates/expanded-dir.html:
+       Alex Ustyancev's patches for aliased leaf nodes
+
+       * perllib/Torrus/SQL.pm: New module dependency: DBIx::Sequence
+
+2005-10-06  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/SQL.pm: new module dependencies:
+       DBIx::Abstract, DBI.
+
+2005-10-05  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoGeneric.pm:
+       added support for dual-CPU cisco routers (7301)
+
+2005-09-28  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/AlliedTelesyn_PBC18.pm:
+       new discovery module
+
+2005-09-02  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover.pm:
+       New discovery parameter: define-tokensets
+
+2005-08-12  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (discover):
+       Replaced $Torrus::DevDiscover::listAdminDownInterfaces
+       with parameter RFC2863_IF_MIB::list-admindown-interfaces
+       and $Torrus::DevDiscover::listNotPresentInterfaces
+       with RFC2863_IF_MIB::list-notpresent-interfaces
+
+2005-08-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * doc/extstorage.pod.in: Started documenting the External storage
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm:
+       New discovery parameter: RFC2863_IF_MIB::external-serviceid
+
+       * xmlconfig/generic/rfc2863.if-mib.xml: Byte counters adapted for
+       External storage
+
+       * perllib/Torrus/Collector.pm: Multiple storage types per token
+
+       * perllib/Torrus/ConfigTree/Validator.pm (validateInstanceParams):
+       Enabled validation of list values
+
+       * perllib/Torrus/Collector/ExtDBI.pm: Pluggable backend module for
+       External storage
+
+       * perllib/Torrus/Collector/ExternalStorage.pm:
+       New collector storage type
+
+2005-08-02  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 1.0.3
+
+2005-07-29  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * configure.ac: Patch Level 1: PERLINC configuration variable
+
+2005-07-27  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 1.0.2
+
+2005-07-22  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover.pm (applySelectors):
+       Selectors format slightly changed: the type is passed into the methods
+
+2005-07-15  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover.pm (buildConfig):
+       New discovery parameter: disable-snmpcollector  
+
+       * bin/devdiscover.in: Preventing the bundle file update when
+       --limit is specified.
+
+       * perllib/Torrus/Collector/SNMP.pm (callback): mapping reset after
+       host unreachable
+
+       * configs/torrus-config.pl:
+       $Torrus::Collector::SNMP::unreachableTimeout set to 6 hours
+
+       * perllib/Torrus/Renderer/HTML.pm: entered Date/time verification
+       New CPAN module required:
+       perl -MCPAN -e 'install Date::Parse'
+
+2005-07-14  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/html-incblocks.txt: Added date setting dialog.
+       TODO: date format validation.
+
+2005-07-11  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm:
+       New discovery parameter: RFC2863_IF_MIB::only-interfaces
+
+       * configure.ac: Now checking if user torrus exists
+
+       * perllib/Torrus/DevDiscover/AxxessIT.pm: support for WANX/LANX modules
+
+2005-07-06  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/rrddir2xml.in: New utility for generating XML from a directory
+       with RRD files
+
+2005-06-24  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector/SNMP.pm: [1.0.1pl2] - fixed bug
+       with deleting unreachable targets
+
+2005-06-21  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * configure.ac: 1.0.1 Patchlevel 1
+
+       * bin/action_snmpv1trap.in, bin/action_snmptrap.in:
+       added torrusMonitorDesc 
+
+       * sup/mibs/TORRUS-MIB.txt: new OID: torrusMonitorDesc
+
+       * NEWS: release 1.0.1
+
+       * perllib/Torrus/SiteConfig.pm (verify):
+       $Torrus::Renderer::stylingProfileOverlay is now an absolute file name
+
+       * xmlconfig/vendor/cisco.ios.docsis.xml:
+       Added Registered modems graph. WARNING: RRD structure changed
+
+       * bin/devdiscover.in: New option: --fallback
+
+       * perllib/Torrus/Collector/SNMP.pm (initTargetAttributes):
+       Target is deleted when SNMP map expansion fails
+
+2005-06-16  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Monitor.pm: sleep --delay minutes also after
+       recompiling
+
+       * configs/torrus-config.pl:
+       $Torrus::Collector::SNMP::unreachableTimeout increased to 1900
+       $Torrus::Collector::SNMP::unreachableRetryDelay increased to 600
+
+       * perllib/Torrus/Collector/SNMP.pm:
+       Better handling of SNMP errors. Delete all tokens for a host
+       if it is unreachable.
+
+2005-06-09  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Torrus release 1.0.0
+
+       * bin/monitor.in: New option: --delay
+
+       * init.d/torrus.in: The init script reads its options from
+       initscript.conf and initscript.siteconf
+
+2005-06-08  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/devdiscover.in: new CLI option: --forcebundle
+
+       * perllib/Torrus/DevDiscover.pm: monitor-period and monitor-timeoffset
+       are now copied from DDX
+
+       * bin/action_snmpv1trap.in, bin/action_snmptrap.in,
+       sup/mibs/TORRUS-MIB.txt: Added new SNMP variable: severity
+
+2005-06-02  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoIOS_MacAccounting.pm:
+       New discovery module for Cisco MAC accounting
+
+2005-05-30  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/BetterNetworks.pm:
+       new discovery module
+
+       * bin/collector.in: new command line option: --runalways
+
+2005-05-27  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/MicrosoftWindows.pm:
+       per-interface RRD files named by MAC addresses, not interface name
+
+2005-05-25  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoGeneric.pm: enchanced memory
+       pools stats (line cards and VIP memory)
+
+2005-05-23  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/html-incblocks.txt:
+       has-overview-subleaves replaced with has-overview-shortcuts,
+       with multiple overviews per subtree
+
+2005-05-20  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/tset-list.html: Tokensets list now displays their sizes
+
+2005-05-18  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/ttproclist.in: New utility for generating DDX files
+
+2005-05-17  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DataAccess.pm: improved performance by caching
+
+2005-05-13  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/examples/docsis-monitors.xml: DOCSIS monitoring examples
+
+       * perllib/Torrus/DevDiscover/RFC2670_DOCS_IF.pm:
+       Added DOCSIS-specific selector actions
+
+2005-05-12  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector/RRDStorage.pm (updateRRD):
+       $Torrus::Collector::RRDStorage::moveConflictRRD -- moving RRD files
+       with conflicting structure
+
+2005-05-11  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2670_DOCS_IF.pm:
+       Downstream utilization added, and the subtrees rearranged.
+
+2005-05-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/default-rrd.html: Monitor names and comments displayed
+       on the leaf HTML
+
+2005-05-04  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoGeneric.pm:
+       replaced CiscoGeneric::sensor-monitor and
+       CiscoGeneric::sensor-monitor-regexp with CiscoSensor selector
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm:
+       RFC2863_IF_MIB::errors-monitor is no longer supported.
+       Replaced with appropriate selector action
+       
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm:
+       Implemented IF-MIB selector actions - 
+       InBytesMonitor, OutBytesMonitor, ErrorsMonitor, HoltWinters,
+       NoPacketCounters, NoErrorCounters, Parameters
+
+2005-05-02  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover.pm (applySelectors):
+       The infrastructure for object selectors
+
+2005-04-29  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/CiscoGeneric.pm:
+       New discovery parameters: CiscoGeneric::sensor-monitor,
+       CiscoGeneric::sensor-monitor-regexp
+
+2005-04-28  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Collector/SNMP.pm (runCollector):
+       SO_RCVBUF is set explicitly
+
+2005-04-09  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Renderer/RRDtool.pm (rrd_make_hrules):
+       hrule-legend-X is now a leaf parameter, not view
+
+       * templates/default-recursivedir.html: Recursive directory view
+
+2005-04-08  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/schedulerinfo.in: Timeline reports separate for monitors
+       and collectors
+
+2005-03-30  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/Paradyne.pm:
+       New discovery parameter: "Paradyne::slot-name"
+
+2005-03-22  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * configure.ac: New variables: plugwrapperdir, defrrddir
+
+2005-03-09  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover.pm (discover): Screening coli and
+       semicoli in legend text
+
+2005-03-08  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (discover):
+       New device capability: 'interfaceIndexingManaged'.
+       New DDX parameters: 'RFC2863_IF_MIB::ifindex-map-hint'
+       and 'RFC2863_IF_MIB::subtree-name-hint'.
+
+       * xmlconfig/generic/rfc2863.if-mib.xml: Moved "ifindex-table"
+       definition from snmp-defs to IF-MIB host template
+
+       * perllib/Torrus/DevDiscover.pm (discover):
+       In the legend, replace ':' with '=' and ';' with ','
+
+2005-03-05  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover.pm (oidBaseMatch): better OID comparison
+
+2005-02-28  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/Renderer.pm (newCacheFileName): MD5 to generate
+       unique file names
+
+2005-02-18  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * configure.ac (also in all plugins): AM_INIT_AUTOMAKE(1.9)
+       instead of 1.6. The old version conflicted with plugins.
+
+2005-01-30  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * doc/Makefile.am: Variable substitution in doc files
+
+       * doc/manpages/Makefile.am: Man sections configurable
+
+       * perllib/Torrus/DevDiscover/CiscoIOS_Docsis.pm:
+       New discovery module for Cisco-specific DOCSIS statistics
+
+2005-01-21  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (discover):
+       Moved the IF-MIB discovery from checkdevtype() to discover()
+
+2005-01-06  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/AxxessIT.pm: new discovery module
+
+2005-01-04  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (checkdevtype):
+       Interface excluded when ifOperStatus=6 [notPresent]
+
+2004-12-27  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/devdiscover.in (absXmlFilename): output file is placed in
+       siteXmlDir if the path is not absolute. $XMLCONFIG is still
+       supported for the sake of compatibility.
+
+2004-12-03  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * configure.ac: replaced --disable-modcheck with --enable-pkgonly
+       
+2004-11-22  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.1.8
+       * Started Torrus development
+
+2004-11-02  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigTree/Validator.pm:
+       New parameters:  'monitor-period', 'monitor-timeoffset'
+
+       * lib/Torrus/Monitor.pm: Now monitor runs under standard Scheduler
+
+2004-10-25  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Collector.pm:
+       Moved collector specific code from bin/collector.in.
+
+2004-10-24  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/acledit.in: New privilege added: DisplayAdmInfo
+
+       * lib/Torrus/Renderer/AdmInfo.pm, templates/adminfo.html:
+       First step to display administratove information.
+
+2004-10-13  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/collector.in, bin/monitor.in:
+       Process name reflecting the commandline and status
+
+2004-10-04  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer/RRDtool.pm (rrd_make_multigraph):
+       New multigraph parameter: disable-gprint-X
+
+2004-09-30  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/generic/collector-periods.xml:
+       Changed rrd-create-rra
+
+2004-09-29  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/NetScreen.pm:
+       Changed the interface mapping from ifDescr to MAC address
+
+2004-09-22  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * examples/rrdup_notify.sh: collector failure notification script
+
+2004-09-20  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Apache2Handler.pm: mod_perl 1.99_15 compatibility.
+       Replaced Apache::ParseFormData with libapreq2.
+
+       * templates/html-incblocks.txt: Added "Up" navigation tab
+
+2004-09-02  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer/RRDtool.pm: New parameter: graph-disable-gprint
+
+2004-08-27  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/default-rrd.html:
+       Added link to web/plain/explain-rrdgraph.html
+
+       * templates/html-incblocks.txt: Moved Top and Help menu to the top
+       of the page
+
+2004-08-20  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/CiscoIOS.pm (discover):
+       New discovery parameter: CiscoIOS::disable-ipsec-stats
+
+2004-08-16  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/default-helptext.html: First draft of help window
+
+       * bin/devdiscover.in: --snmpdebug option is no more hidden
+
+2004-08-13  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/vendor/cisco.ios.xml: reorganized leaves
+
+       * xmlconfig/generic/rfc2863.if-mib.xml:
+       Replaced the leaf names with user friendly ones.
+       The old template is in old/rfc2863.if-mib.old-0.1.7.xml
+
+2004-08-04  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.1.7
+
+       * lib/Torrus/DevDiscover/RFC2863_IF_MIB.pm:
+       New discovery parameter: RFC2863_IF_MIB::copy-params
+
+       * lib/Torrus/DevDiscover.pm: new discovery parameter: host-copy-params
+
+2004-07-29  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/ATMEL.pm: New discocery module from Scott Brooks
+
+2004-07-28  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer/RRDtool.pm (rrd_make_holtwinters):
+       New global variable: $Torrus::Renderer::hwGraphLegend
+
+       * Disabled Holt-Winters in system performance and interface errors
+
+2004-07-27  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * Torrus Demo server opened: http://torrusdemo.tbw.ch
+
+2004-07-26  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Collector.pm (setValue): DOLLAR and MOD in transform-value
+
+2004-07-20  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/acledit.in: Added --force option
+
+       * bin/monitor.in, bin/collector.in: umask changed to 0017
+
+2004-07-19  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * doc/scalability.pod: Document finished
+
+       * doc/vendorsupport.pod: Vendor and MIBs support document
+
+2004-07-13  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/site-global.xml: New place for global parameters.
+       In existing installations, you need to change the line in
+       torrus-siteconfig.pl:
+       @Torrus::Global::xmlAlwaysIncludeFirst =
+                                       ( 'defaults.xml', 'site-global.xml' );
+
+2004-07-12  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/NetApp.pm: new discovery module (Shawn)
+
+2004-07-09  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/CiscoIOS.pm: Added CISCO-IPSEC-FLOW-MONITOR-MIB
+
+2004-07-07  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Monitor.pm (run_event_exec):
+       New environment variable: Torrus_VALUE
+
+       * xmlconfig/defaults.xml: New view parameter: description
+
+2004-07-06  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/default-login.html,
+       lib/Torrus/Renderer/Frontpage.pm (renderUserLogin),
+       lib/Torrus/Apache2Handler.pm (handler),
+       lib/Torrus/ApacheHandler.pm (handler): URL parameters
+       (token, path, and view) are remembered during login
+
+2004-06-30  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ACL.pm (hasPrivilege): Wildcard ACL object (*) implemented
+
+2004-06-28  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * Log levels updated. Now info is always printed, and verbose means
+       verbose.
+
+2004-06-25  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/defaults.xml: New view name: last24h-small
+
+2004-06-23  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (buildConfig):
+       New discovery parameter: RFC2863_IF_MIB::errors-monitor
+
+2004-06-22  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (buildConfig):
+       New discovery parameter: RFC2863_IF_MIB::exclude-interfaces
+       New discovery parameter: RFC2863_IF_MIB::tokenset-members
+
+2004-06-21  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/CiscoCatOS.pm (discover): New discovery
+       parameter: CiscoCatOS::suppress-noname-ports
+
+2004-06-16  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * configure.ac: For backward compatibility with autoconf 2.57,
+       AS_HELP_STRING is replaced with obsoleted AC_HELP_STRING.
+       Don't forget to change it back when 2.59 or later becomes mainstream.
+
+2004-06-15  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer/RRDtool.pm (rrd_make_gprint): GPRINT implemented
+
+       * bin/prepviews.in, bin/rrd_getdim.in: removed because no longer needed
+
+       * doc/manpages/Makefile.am: commandref.pod to be replaced by manpages
+       (contrib from Jurij Smakov)
+
+2004-05-26  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Collector.pm (setValue): transform-value parameter
+       is now expandable
+
+       * doc/devdoc/wd.distributed.pod: New working draft document
+
+2004-05-24  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * webmux2.pl: Added support for mod_perl 1.99_12 (before it was 1.99_13
+       only)
+
+2004-05-19  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover.pm: New parameter: custom-host-templates
+
+2004-05-16  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Collector/SNMP.pm: New parameter: 'snmp-check-sysuptime'
+
+       * bin/Makefile.am: rrd_hwreapply is moved to a separate
+       package (RRDman)
+
+2004-05-12  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * Makefile.am, bin/Makefile.am: removed mkroutercfg
+
+       * templates/html-incblocks.txt: Removed image width hinting
+
+2004-05-05  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/SiteConfig.pm (verify): Minus sign allowed in tree names
+
+2004-05-03  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.1.6
+
+       * ../plugins/cbqos: first release of Cisco QoS monitoring plugin 
+
+       * bin/rrd_getdim.in: RRDtool 1.1.x compatibility improved
+
+2004-04-22  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * examples/onmsInterfaces.sh: Gustavo Torres' contribution for
+       OpenNMS integration
+
+2004-04-19  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigTree/XMLCompiler.pm:
+       New XML statements: setvar, iftrue, iffalse
+
+2004-04-15  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/RPN.pm (translate): New RPN function: MOD
+
+       * xmlconfig/generic/rfc2790.host-resources.xml: More sophysticated
+       Uptime graph (Shawn)
+
+2004-04-14  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/html-incblocks.txt: New items in HTML page top: siteInfo
+       and treeInfo.
+
+       * lib/Torrus/Apache2Handler.pm: First alpha release of
+       mod_perl 2.0 handler.
+
+       * doc/webintf.pod: It is recommended to Alias /torrus/plain
+       instead of just /torrus.
+
+2004-04-07  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/schedulerinfo.in: New option: --clear
+
+       * lib/Torrus/SchedulerInfo.pm, lib/Torrus/Scheduler.pm: reorganized
+       statistics collection
+
+       * bin/schedulerinfo.in: Only nonzero statistics are shown in runtime
+       report
+
+       * lib/Torrus/Scheduler.pm: reorganized statistics: late start increments
+       only when that happens. Runtime longer than period is also recorded
+       (sferry).
+
+       * bin/collector.in: more verbosity in non-verbose mode (sferry)
+
+       * init.torrus.in: gracefully waits for daemons to shut down (sferry)
+
+2004-04-06  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/RFC1697_RDBMS.pm, 
+        lib/Torrus/DevDiscover/OracleDatabase.pm: New discovery modules (sferry)
+
+       * NEWS: Bugfix release 0.1.5bf2
+
+2004-03-31  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DB.pm (cursor): Bugfix for write access cursors
+
+2004-03-26  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer/RRDtool.pm (rrd_make_cdef):
+       New @-functions in RPN references: AVERAGE MIN MAX LAST
+       
+       (rrd_make_multigraph): New multigraph parameter: ignore-views-X
+
+       * lib/Torrus/DevDiscover/CiscoGeneric.pm (buildConfig):
+       New discovery parameter: CiscoGeneric::file-per-sensor
+
+2004-03-25  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/compilexml.in: New commandline option: --noval
+
+       * NEWS: Bugfix release 0.1.5bf1
+
+2004-03-24  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/RPN.pm: now Math::BigFloat is always used for numbers
+       Perl 5.8.0 or higher is required: BigFloat implementation in 5.6.1
+       is untested and hardly compatible
+
+       * lib/Torrus/Collector.pm (run): $Torrus::Collector::needsConfigTree:
+       a new registry for those collectors needing access to configuration.
+
+2004-03-22  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * Implemented Cisco class-based QoS monitoring plugin
+
+2004-03-20  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigTree.pm: More parameters to be expanded:
+       lower-limit normal-level upper-limit
+
+2004-03-19  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/devdiscover.in: New option: --limit=regexp
+
+2004-03-17  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.1.5
+
+       * lib/Torrus/DB.pm (new): Unique DB environment log file per PID. 
+
+2004-03-16  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/devdiscover.in: new parameter: output-bundle
+
+2004-03-12  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/overview-subleaves.html: New parameters:
+       overview-direct-link, overview-direct-link-view
+
+2004-03-09  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/UcdSnmp.pm, 
+       lib/Torrus/DevDiscover/RFC2790_HOST_RESOURCES.pm,
+       xmlconfig/vendor/ucd.ucd-snmp.xml,
+       xmlconfig/generic/rfc2790.host-resources.xml:
+       Rearranged the host performance templates.
+       Fixed bug in Interrupts RRD. You need to
+       rm /var/snmpcollector/*ucd-context_interrupts.rrd               
+
+2004-03-04  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer/RRDtool.pm (render_rrgraph):
+       New configuration option: $Torrus::Renderer::ignoreDecorations
+
+2004-03-01  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/generic/rfc2670.docsis-if.xml: Modified DOCSIS template
+       to include codewords statistics (data-file changed).
+
+       * bin/monitor.in, bin/collector.in: Log rotation on SIGHUP
+
+2004-02-26  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/generic/monitors.xml: New standard monitors and actions
+
+       * xmlconfig/vendor/smokeping.xml:
+       (Shawn) Smokeping RRD files access templates
+
+       * lib/Torrus/DevDiscover/NetScreen.pm: (Shawn) new discovery module
+
+       * lib/Torrus/DevDiscover/CompaqCIM.pm: (Shawn) new discovery module
+
+       * lib/Torrus/DevDiscover/MicrosoftWindows.pm:
+       (Shawn) added support for IIS HTTP and FTP stats
+
+2004-02-24  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigTree/Writer.pm (postProcessNodes):
+       Dispersed collector offset
+
+2004-02-23  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigTree.pm (new),
+       lib/Torrus/ConfigTree/Writer.pm (finalize):
+       Dual configuration database implemented
+
+       * lib/Torrus/ConfigTree.pm (setReady): ConfigurationReady
+       flag moved to other_config.db.
+
+2004-02-18  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer/RRDtool.pm: view parameter "title" removed.
+       New node parameter: "graph-title"
+
+2004-02-16  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer/RRDtool.pm (rrd_make_decorations):
+       Implemented back- and foreground decorations (Christian's Change 7,
+       modified)
+
+2004-02-14  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigTree.pm (getNodeParam): Optimized nodepcache
+       structure
+
+       * lib/Torrus/ConfigTree/Writer.pm (newToken): Next free token is
+       no longer stored in database
+
+2004-02-13  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover.pm (buildConfig): New parameter: host-aliases
+
+       * lib/Torrus/Collector.pm (setValue): New parameter: transform-value
+
+2004-02-12  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/snmp-defs.xml, xmlconfig/*/*.xml: data-file refers now
+       to system-id, instead of snmp-host.
+
+       * lib/Torrus/DevDiscover.pm (buildConfig): symbolic-name is no longer
+       mandatory. New parameter: system-id.
+
+2004-02-11  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DB.pm (new): DB internal errors are stored in
+       var/log/dbenv_errlog
+
+2004-02-05  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigTree.pm (expandNodeParam):
+       $Torrus::ConfigTree::nodeParamHook: hook for custom parameter processing 
+
+2004-02-03  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer/RRDtool.pm: Restructured the whole grapher.
+
+2004-02-02  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer.pm: Split one big module into 4 smaller ones:
+       Torrus::Renderer, Torrus::Renderer::HTML, Torrus::Renderer::RRDtool,
+       Torrus::Renderer::Frontpage
+
+       * lib/Torrus/DevDiscover.pm (discover):
+       New discovery parameter: only-devtypes
+
+2004-01-30  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover.pm (discover):
+       New discovery parameter: disable-devtypes
+       
+       * lib/Torrus/DevDiscover.pm (discover):
+       Better treatment for agents without "system" OIDs.
+
+2004-01-21  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover.pm (discover): Now snmp-oids-per-pdu may
+       be defined from discovery parameters.
+
+       * bin/schedulerinfo.in: Scheduler runtime statistics report
+
+2004-01-20  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Scheduler.pm: runtime statistics stored in a database
+
+2004-01-15  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover.pm (discover):
+       'collector-period' and 'collector-timeoffset' can be specified in
+       devdiscover input
+
+       * Makefile.am: Now DIST_REVISION file in the distribution
+       package tells the distribution revision date
+
+       * lib/Torrus/Collector.pm: listTargets() is replaced with
+       listCollectorTargets() with collector type as argument
+
+2004-01-14  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (buildConfig):
+       Split iftable-errors template into input and output
+       (some Cisco ATM aal5 interfaces dont have both in and out error
+       counters)
+
+       * doc/devdoc/wd.gprint-and-cf-plot.pod:
+       New design draft from Christian Schnidrig
+
+       * lib/Torrus/RPN.pm: Slight reorganisation and better fault control
+
+       * doc/userguide.pod: New in Tips: Several Torrus instances on one server
+
+2004-01-13  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigTree.pm (token),
+       lib/Torrus/ConfigTree/Writer.pm (setAlias),
+       lib/Torrus/DB.pm (getBestMatch):
+       Recursive alias expansion. New database: aliases.db.
+       configsnapshot is no more compatible with previous releases' database.
+
+2004-01-12  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigTree.pm (getAliases): Improved logics for aliases.
+       Needs database recompilation.
+
+2004-01-09  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/schedulerinfo.in: New utility for scheduler analysis
+
+2004-01-08  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/old/rfc1213.xml: Moved from xmlconfig/generic/rfc1213.xml
+
+       * templates/html-incblocks.txt: cssoverlay property
+
+       * bin/configsnapshot.in: Ready for tests
+
+       * lib/Torrus/DevDiscover/RFC2737_ENTITY_MIB.pm (discover):
+       Chassis desription is put into host-level comment
+
+2004-01-07  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/configsnapshot.in: first step towards a snapshot utility
+
+       * xmlconfig/vendor/cisco.generic.xml:
+       New template: cisco-temperature-sensor-fahrenheit
+
+       * xmlconfig/generic/collector-periods.xml: Changed XFF the same way
+       as in snmp-defs.xml.
+       Added Holt-Winters parameters to 1-minute interval.
+
+       * xmlconfig/snmp-defs.xml: Changed XFF in default RRAs: 1 missing
+       sample is allowed in half-hour average, and 1 missing hour
+       is allowed in daily average.
+
+       * lib/Torrus/Collector/SNMP.pm (initTargetAttributes):
+       New parameter: snmp-object-type
+
+2004-01-06  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/generic/rfc2662.adsl-line.xml: Reduced number of RRD files
+
+       * xmlconfig/vendor/cisco.generic.xml: Moved buffer statistics into
+       a single RRD file
+
+       * xmlconfig/generic/rfc2863.if-mib.xml:
+       Reorganized RRD data structure. Significantly reduced number of files.
+
+2004-01-05  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/genlist.in: New utility for data listing
+
+2003-12-31  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/RFC2737_ENTITY_MIB.pm: New discovery module
+
+       * lib/Torrus/DevDiscover/CiscoGeneric.pm: CPU enties mapped against
+       ENTITY-MIB names
+
+2003-12-30  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/devdiscover.in: $XMLCONFIG substitution
+
+2003-12-29  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/generic/rfc2863.if-mib.xml: Moved ifindex-map to host level
+
+2003-12-28  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/CiscoGeneric.pm,
+       xmlconfig/vendor/cisco.generic.xml: Reorganized CPU and Memory
+       pool statistics.
+
+       * lib/Torrus/DevDiscover/CiscoFirewall.pm: New discovery module
+
+       * lib/Torrus/DevDiscover/F5BigIp.pm: New discovery module for
+       F5 BigIp Load Balancer
+
+2003-12-24  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/old/snmp-defs.old-0.1.2.xml: Moved from generic/ to old/
+
+       * xmlconfig/old/rfc2863.if-mib.old-0.1.4.xml: Saved the file from
+       previous version.
+
+2003-12-22  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/Xylan.pm: New discovery module for
+       Alcatel (Xylan) OmniSwitch
+
+       * lib/Torrus/DevDiscover/AscendMax.pm: New discovery module for
+       Ascend (Lucent) MAX
+
+2003-12-21  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/CiscoIOS.pm (checkdevtype):
+       Use CISCO-IMAGE-MIB::ciscoImageTable for more strict IOS-based
+       product detection
+
+2003-12-18  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (buildConfig):
+       Vendor templates for interface counters taken from
+       @{$interface->{'vendor_templates'}}
+
+       * lib/Torrus/DB.pm (new): Berkeley db-4.2 compatibility
+
+2003-12-17  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/vendor/empire.systemedge.xml: Data structure and templates
+       changed for better flexibility and system support
+
+       * bin/devdiscover.in, bin/genddx.in:
+       Output file is now controlled from DDX parameter 'output-file'.
+
+2003-12-15  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/MicrosoftWindows.pm:
+       Moved MicrosoftWindowsServer.pm to MicrosoftWindows
+
+2003-12-14  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/MicrosoftWindowsServer.pm: New discovery module
+       for Windows2000/XP SNMP agent
+
+2003-12-13  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/generic/rfc2863.if-mib.xml:
+       Replaced $IFIDX with %ifindex-map%
+       
+       Split template iftable-discards into iftable-discards-in and
+       iftable-discards-out. For some devices,
+       /var/snmpcollector/*_discards.rrd need to be deleted, and
+       devdiscover re-launched
+
+2003-12-11  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/default-tset.html, xmlconfig/generic/rfc2863.if-mib.xml:
+       New parameter: descriptive-nickname
+
+2003-12-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.1.4
+
+       * devdiscover-config.pl: Commented out "RFC2662_ADSL_LINE" and
+       "Paradyne" (need more testing)
+
+2003-12-08  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/*, web/plain/*.css: more flexible CSS layout
+
+2003-12-04  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer.pm (do_render_rrdgraph):
+       New parameter: graph-rigid-boundaries
+
+2003-12-01  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (discover):
+       New discovery option: RFC2863_IF_MIB::suppress-hc-counters
+       
+2003-11-28  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/devdiscover.in: now it accepts XML input only
+
+       * bin/genddx.in: New utility for next-generation devdiscover
+
+       * lib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (buildConfig):
+       interface counters moved to a separate subtree
+
+2003-11-25  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer.pm (do_render_rrdgraph):
+       New parameter: graph-logarithmic
+
+2003-11-23  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/EmpireSystemedge.pm: new discovery module
+
+2003-11-22  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover.pm (clearCap): capability clearing needed for
+       Empire Sysedge
+
+2003-11-18  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/generic/rfc2863.if-mib.xml: templates interface-counters
+       and hc-interface-counters removed
+       New templates: read-iftable-octets, read-ifxtable-hcoctets
+
+2003-11-11  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * web/plain/torrus.css: Increased maximum node name length to 25 symbols
+
+       * lib/Torrus/DevDiscover/CiscoGeneric.pm: moved memory, cpu, and
+       temperature statistics to a common module, shared by IOS and CatOS
+
+       * lib/Torrus/DevDiscover/CiscoCatOS.pm (discover): interface comments
+       are now derived from CISCO-STACK-MIB::portName
+
+2003-11-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlsup/extract-skeleton.xsl: XSLT template for tree structure
+       extraction
+
+       * bin/configinfo.in: New utility
+
+       * bin/devdiscover.in: New options: --retries and --timeout
+
+       * lib/Torrus/DevDiscover/CiscoCatOS.pm: Interface filters for CatOS
+
+2003-11-09  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigBuilder.pm (addStatistics): congfiguration statistics
+
+       * lib/Torrus/DevDiscover/CiscoIOS.pm: Interface filters for IOS devices
+
+       * lib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (discover): Implemented
+       generic interface filtering
+
+2003-11-07  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/generic/rfc2863.if-mib.xml: rrd-create-max=1e15 for HC
+       packet and octets counters
+
+       * lib/Torrus/DevDiscover/RFC2863_IF_MIB.pm (buildConfig):
+       New interface counters: iftable-discards
+
+2003-11-05  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * New devdiscover modules: "RFC2662_ADSL_LINE" and "Paradyne"
+
+2003-11-04  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Collector/SNMP.pm (initTarget):
+       New parameter: snmp-oids-per-pdu
+
+2003-11-03  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.1.3
+
+       * doc/, doc/devdoc/: Documentation is reorganized. Developer
+       documentation is separated from User docs.
+
+2003-10-31  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/overview-subleaves.html: Replacement for InOutBps.
+       New parameters: has-overview-subleaves, overview-subleave-name,
+       overview-shortcut-text, overview-shortcut-title, overview-page-title
+
+2003-10-30  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/CiscoIOS_SAA.pm: New discovery module
+
+2003-10-29  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer.pm (do_render_rrdgraph): New parameter:
+       rrd-scaling-base
+       (new): cache initialization optimized
+
+2003-10-28  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * doc/devdiscover_devguide.pod: new Device Discovery Developer's Guide
+
+2003-10-27  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover/RFC2790_HOST_RESOURCES.pm:
+       New Host resources MIB discovery module
+
+2003-10-26  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * examples/setmonitor.xupdate.xml: XUpdate technique to update
+       autogenerated files. Described in userguide.pod.
+
+2003-10-24  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/generic/rfc2863.if-mib.xml: New names for interace
+       counter RRD files: host_intf_octets.rrd, host_intf_packets.rrd, etc.
+
+       * xmlconfig/snmp-defs.xml: data-file and data-dir are no longer
+       defined in snmp-defaults.
+
+       * xmlconfig/generic/rfc2863.if-mib.xml: Broke interface counter
+       templates into smaller parts. New counters template: "iftable-errors".
+
+       * xmlconfig/snmp-defs.xml: Moved interface counters to
+       generic/rfc2863.if-mib.xml
+
+2003-10-21  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * New ACL user and group attribute: "modified"
+
+2003-10-20  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/DevDiscover.pm (genDataDir): data-dir hash implemented
+
+       * bin/devdiscover.in: Default subtree is now /Routers.
+       Alternative device names may be given as host:devname
+
+       * xmlconfig/: Vendor and generic templates from Shawn Ferry
+
+2003-10-19  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * Shawn Ferry's contribution on styling profiles, with recursive
+       color references
+
+2003-10-18  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigTree/XMLCompiler.pm (compile): <include> directives
+       are now processed recursively, before any other processing.
+
+2003-10-17  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/snmp-defs.xml: Replaced subtree /SNMP with template
+       Moved old version to generic/snmp-defs.old-0.1.2.xml
+
+2003-10-15  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/devdiscover.in: First proof of concept version of
+       a new modular device discovery tool
+
+2003-10-14  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.1.2
+
+       * lib/Torrus/ConfigTree/Writer.pm (addChild): Nodes longer than 20
+       characters are reported with warning.
+
+2003-10-13  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig: New vendor files:
+       vendor/ascend.max.xml, examples/ascend.max.xml,
+       generic/rfc2670.docsis-if.xml
+
+       * doc/userguide.pod,
+       xmlconfig/examples/servers.data, xmlconfig/examples/servers.tmpl:
+       New approach in automatic config generation.
+
+2003-10-12  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/mkroutercfg.in (retrieveSnmpData): VLAN interfaces are excluded
+       from the list of discovered interfaces.
+
+2003-10-09  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigTree/Writer.pm (propagateViewParams): Moved view
+       parameter inheritance from XML compiler to Writer post-processing
+
+2003-10-07  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer.pm (do_render_rrdgraph): New view parameters:
+       ignore-limits, ignore-lower-limit, ignore-upper-limit
+
+       * bin/cleanup.in: Cronjob for cleaning up diskspace.
+
+       * lib/Torrus/Renderer.pm (do_render_rrdgraph): New parameters:
+       graph-lower-limit, graph-upper-limit
+
+2003-10-06  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * styling/torrus-original.pl: Styling profiles implemented
+
+2003-10-04  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer.pm: New parameter: vertical-label
+
+2003-09-30  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer.pm (do_render_rrdgraph): Added HRULE handling
+
+2003-09-29  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer.pm (render_html): Added current time in HTML output
+
+2003-09-18  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Scheduler.pm: VmWare clock support
+
+2003-09-17  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Monitor.pm (setAlarm): New parameter: monitor-action-target
+
+2003-09-14  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.1.1
+
+2003-09-13  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigTree.pm:
+       %Torrus::ConfigTree::expand_params now contains parameters for
+       expansion
+
+       * lib/Torrus/ConfigTree/Writer.pm:
+       %Torrus::ConfigTree::Writer::remove_space now contains parameters
+       for space removal
+
+       * lib/Torrus/Collector.pm (addTarget): New parameter: value-map
+
+       * configure.ac: New configure variable: torrus_user.
+       torrus_var default value changed from root to torrus
+
+2003-09-09  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * init.torrus.in: New launcher for multi-tree support.
+       FreeBSD 5.1 gives weird error without "&" in launching command.
+       Needs testing on other systems.
+
+2003-09-07  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * Monitor event "throw" changed to "set"
+
+2003-09-05  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ACL/Import.pm, lib/Torrus/ACL/Export.pm: ACL import/export
+       utilities
+
+       * bin/aclfixup.in: Temporary utility to convert ACL database to
+       the new format.
+
+       * lib/Torrus/ACL/Edit.pm: ACL Database structure changed:
+       added "uA:" lists
+
+2003-09-03  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/RPN.pm: Got use of use Math::BigFloat, as suggested by
+       Christian.
+
+       * xmlconfig/snmp-defs.xml: Changed xff to 0.5, as recommended by
+       rodrigo.cunha at corp.vodafone.pt
+
+       * lib/Torrus/DB.pm: Database handles are held in a pool and reused
+
+2003-09-02  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * Added user authentication: lib/Torrus/ACL*, bin/acledit, Apache handler
+       * Multiple trees support as described in Requirements 0.1
+
+2003-08-26  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Collector/SNMP.pm: Moved the validator parameters to
+       a separate module
+
+2003-08-07  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/defaults.xml: Tokenset views expiry time
+       changed from 300 to 60
+
+       * lib/Torrus/Renderer.pm (checkAndClearCache): Renderer cache is
+       cleared at least once a day
+
+       * webmux.pl: New Apache init script. DB environment is now
+       correctly destroyed
+
+2003-08-06  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * mibs/Torrus-MIB.txt: Added DS tree name to Monitor action exec
+       and helper programs
+
+       * web/plain/torrus.css: Replaced <BR> with display:block in current path
+
+       * height-hint parameter is removed.
+
+       * templates/routercfg.xml: Fixed the subtree deepness bug for
+       temperature sensors.
+
+       * First steps towards version 0.1: Multiple trees and database
+       split are implemented.
+
+2003-08-04  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.0.20
+
+2003-07-31  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer.pm: added $Torrus::Renderer::rendererURL
+       and $Torrus::Renderer::plainURL
+
+2003-07-29  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/html-incblocks.txt: Absolute URL for CSS stylesheet
+
+       * lib/Torrus/Collector/SNMP.pm: multiple ports and SNMP communities
+       per IP address.
+
+2003-07-23  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * templates/routercfg.xml: moved snmp-community and other parameters
+       to a host-level subtree
+
+2003-07-17  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * SNMP Agent reload and unavailable handling
+
+2003-07-15  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/mkroutercfg.in, templates/*, lib/Torrus/Renderer.pm:
+       Bugs item #747893 resolved.
+
+2003-07-02  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/mkroutercfg.in (reportResults), templates/routercfg.xml:
+       Legend is now XML-escaped
+
+2003-07-01  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.0.19
+
+2003-06-26  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/snmp-defs.xml, lib/Torrus/Collector/RRDStorage.pm,
+       lib/Torrus/ConfigTree/Validator.pm:
+       typo fixed: rrd-create-heartbit changed to rrd-create-heartbeat
+
+       * xmlconfig/snmp-defs.xml: as proposed by Christian Schnidrig,
+       rrd-create-heartbeat changed from 1800 to 500
+
+2003-06-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/mkroutercfg.in (reportResults), templates/routercfg.xml:
+       SNMP version bugfix
+
+       * configure.ac: Now most of the directory names are configurable
+
+2003-05-18  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer.pm (render):
+       Bug #735753 (Christian Schnidrig) fixed
+
+       * bin/mkroutercfg.in, templates/routercfg.xml:
+       Marc Haber's patch for deeper subtrees
+
+       * torrus-config.pl: added @Torrus::ConfigTree::XMLCompiler::listparams
+
+2003-05-01  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Collector/SNMP.pm: SNMP-specific config validator is
+       now within the module.
+
+       * lib/Torrus/ConfigTree/Validator.pm: Additional validation
+       parameters are read from @Torrus::Validator::loadLeafValidators
+
+       * lib/Torrus/Collector.pm: Collector modules
+       are loaded from @Torrus::Collector::loadModules
+
+2003-04-02  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.0.18
+
+2003-03-31  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/defaults.xml: New parameter: rrgraph-views
+
+2003-03-30    <ssinyagin@HOME>
+
+       * xmlconfig/Makefile.am: Added Cisco MAC accounting
+
+2003-03-27  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer.pm and temlates: reorganized Holt-Winters views
+
+2003-03-25  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * torrus-config.pl: Moved monitor parameters from siteconfig to
+       default config.
+
+2003-03-21  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.0.17
+
+       * web/plain/torrus-printer.css: Finalized the printer-friendly layout
+
+2003-03-17  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * init.torrus.in: now running under user "torrus"
+
+2003-03-15  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * configure.ac: Changed the group to "torrus"; init.torrus is
+       more universal
+
+2003-03-15  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer.pm, lib/Torrus/ApacheHandler.pm:
+       optimized Renderer to reuse Template processor in mod_perl
+
+2003-03-15  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * web/plain/torrus.css: New HTML layout
+
+2003-03-11  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/Makefile.am (dist_examples_DATA): Moved
+       apcups-example.xml to apc-ups.xml. Added hpux.xml
+
+       * bin/rrd_getdim.in, bin/prepviews.in, xmlconfig/Makefile.am:
+       "make install prefix=/some/path" now works correctly.
+
+       * lib/Bundle/Torrus.pm: Perl bundle for easy installation
+
+2003-03-04  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.0.16
+
+       * lib/Torrus/Renderer.pm (do_render_rrdgraph): Fixed TICK bug
+
+       * xmlconfig/vendor/hp.hpux.xml: New definitions file from Aaron Bush
+
+       * xmlconfig/vendor/apc.ups.xml:
+       * xmlconfig/examples/apcups-example.xml: Merged the several
+       templates into one.
+
+2003-03-03  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * Makefile.am: added torrus-config.dtd to distribution
+
+       * xmlsup/torrus-config.dtd: The configuration DTD first cut
+
+2003-03-02    <ssinyagin@HOME>
+
+       * Makefile.am (dist_mibs_DATA): Moved mibs from lib to share
+
+2003-03-01  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/mkroutercfg.in (reportResults): Added vendor/cisco.ios.xml
+       chekup
+
+       * xmlconfig/examples/apcups-defs.xml: moved to
+       xmlconfig/vendor/apc.ups.xml
+
+       * xmlconfig/examples/snmp-view.xml: moved contents into
+       xmlconfig/vendor/cisco.ios.xml
+
+       * xmlconfig/snmp-defs.xml: Moved Cisco specifics to
+       xmlconfig/vendor/cisco.ios.xml
+
+       * xmlconfig/Makefile.am: snmp-defs.xml is not any more preserved
+
+       * configure.ac, Makefile.am: added plugin functionality
+
+2003-02-27  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/Renderer.pm (render_html),
+       lib/Torrus/ApacheHandler.pm (handler), web/grapher.cgi.in:
+       Fixed the non-ASCII display problem.
+       Also XML-LibXML-1.54_3 is required.
+
+2003-02-26  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.0.15
+
+       * xmlconfig/examples/apcups-defs.xml:
+       * xmlconfig/examples/apcups-example.xml: Added APC UPS example
+       configurations
+
+       * lib/Torrus/Collector/RRDStorage.pm (updateRRD): Reverted to
+       a more promiscious code, because the memory problem persists with
+       perl 5.8.
+
+2003-02-20  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.0.14
+
+2003-02-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigTree/Writer.pm: fixed bug with parameter cache
+
+2003-01-29  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * bin/mkroutercfg.in: fixed the exit code bug
+
+2003-01-24  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/Makefile.am: added xmlconfig/examples/snmp-view.xml
+
+       * lib/Torrus/ConfigTree/XMLCompiler.pm, bin/compilexml.in:
+       added <include> XML statement
+
+2003-01-20  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * NEWS: Release 0.0.13
+
+       * bin/compilexml.in, bin/collector.in, bin/monitor.in:
+       Added signal handlers for more graceful database closing.
+
+2003-01-13  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigTree.pm: Now compiler waits for readers to finish.
+
+2003-01-08  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * lib/Torrus/ConfigTree.pm: implemented ConfigurationReady checkup
+       * lib/Torrus/ApacheHandler.pm, web/grapher.cgi.in:
+          more user friendly error reporting
+
+2003-01-05  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/snmp-defs.xml: Added InOutBps leaf to the templates.
+       Affected files:  xmlconfig/defaults.xml, templates/routercfg.xml,
+       templates/default-dir.html, templates/inout-leaves.html
+
+2003-01-03  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/snmp-defs.xml: Added graph-legend parameters
+
+2003-01-02  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * xmlconfig/Makefile.am: moved XML examples to a separate directory
+
+       * implemented 'rrd-multigraph'
+
+       * changed ds-type RRDfile to rrd-file
+
+2002-09-10  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * Release 0.0.5 published. Everything except SNMP data collector
+         is ready to run.
+
+2002-08-12  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * Reorganized a lot of things. First cut of monitor is runnable.
+
+2002-07-19  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * Implemented Holt-Winters support
+
+2002-07-18  Stanislav Sinyagin  <ssinyagin@users.sourceforge.net>
+
+       * Reorganized ConfigTree and implemented tokens
diff --git a/torrus/DIST_REVISION b/torrus/DIST_REVISION
new file mode 100644 (file)
index 0000000..65629b0
--- /dev/null
@@ -0,0 +1 @@
+Sun Oct 24 15:06:45 CEST 2010
diff --git a/torrus/INSTALL b/torrus/INSTALL
new file mode 100644 (file)
index 0000000..23e5f25
--- /dev/null
@@ -0,0 +1,236 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
+Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about.  Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory.  After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).  Here is a another example:
+
+     /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+     Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+
diff --git a/torrus/Makefile.am b/torrus/Makefile.am
new file mode 100644 (file)
index 0000000..dcf2763
--- /dev/null
@@ -0,0 +1,109 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.am,v 1.1 2010-12-27 00:03:32 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+SUBDIRS = . bin configs doc examples perllib sup xmlconfig 
+
+EXTRA_DIST = \
+       setup_tools/Bundle/Torrus.pm \
+       setup_tools/replace_rrfw.sh \
+       setup_tools/configure_fhs \
+       setup_tools/check_perlthreading.pl
+
+noinst_SCRIPTS = \
+       setup_tools/substvars.sh \
+       setup_tools/mkvardir.sh \
+       init.d/torrus
+
+tmpldir = @tmpldir@
+dist_tmpl_DATA = \
+       templates/aclexport.xml \
+       templates/adminfo.html \
+       templates/default-chooser.html \
+       templates/default-dir.html \
+       templates/default-helptext.html \
+       templates/default-login.html \
+       templates/default-recursivedir.html \
+       templates/default-rrd.html \
+       templates/default-tset.html \
+       templates/expanded-dir.html \
+       templates/globalsearch.html \
+       templates/overview-subleaves.html \
+       templates/report-index.html \
+       templates/report-monthly.html \
+       templates/report-serviceid.html \
+       templates/report-yearly.html \
+       templates/search.html \
+       templates/html-incblocks.txt \
+       templates/tset-list.html \
+       templates/email-alarm.txt
+
+
+
+scriptsdir  = @scriptsdir@
+dist_scripts_DATA = scripts/rrdup_notify.sh
+
+xmlscriptsdir  = @scriptsdir@/xml
+dist_xmlscripts_DATA = scripts/xml/extract-skeleton.xsl
+
+
+discoverydir = @sitedir@/discovery
+dist_discovery_DATA = discovery/README
+
+mkvardir=@abs_top_builddir@/setup_tools/mkvardir.sh
+
+install-data-local:
+       @echo Testing if prefix has changed during make
+       test "$(prefix)" = "@prefix@"
+       $(mkvardir) $(DESTDIR)$(dbhome)
+       $(mkvardir) $(DESTDIR)$(cachedir)
+       $(mkvardir) $(DESTDIR)$(piddir)
+       $(mkvardir) $(DESTDIR)$(reportsdir)
+       $(mkvardir) $(DESTDIR)$(logdir)
+       $(mkvardir) $(DESTDIR)$(sesstordir)
+       $(mkvardir) $(DESTDIR)$(seslockdir)     
+       $(mkinstalldirs) $(DESTDIR)$(tmpluserdir)
+       $(mkinstalldirs) $(DESTDIR)$(plugtorruscfgdir)
+       $(mkinstalldirs) $(DESTDIR)$(plugdevdisccfgdir)
+       $(mkinstalldirs) $(DESTDIR)$(plugwrapperdir)
+
+HTMLDIR = @abs_top_builddir@/../htdocs
+
+htdocs:
+       cd doc; make htdocs
+       @for f in $(dist_mibs_DATA); do \
+         f2=$(HTMLDIR)/`basename $$f`; \
+         if test ! -f $$f2 -o $$f -nt $$f2; then \
+           echo "cp $$f $$f2"; \
+           cp $$f $$f2; \
+         fi; \
+       done
+
+UPLOADPATH = \
+   ssinyagin,torrus@web.sourceforge.net:/home/groups/t/to/torrus/htdocs/devel
+
+upload: dist
+       scp $(distdir).tar.gz TODO $(UPLOADPATH)
+         
+todoup:
+       scp TODO $(UPLOADPATH)
+
+dist-hook:
+       date >DIST_REVISION
+       cp DIST_REVISION $(distdir)/
diff --git a/torrus/Makefile.in b/torrus/Makefile.in
new file mode 100644 (file)
index 0000000..1ff1d52
--- /dev/null
@@ -0,0 +1,808 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.in,v 1.1 2010-12-27 00:03:32 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(am__configure_deps) $(dist_discovery_DATA) \
+       $(dist_scripts_DATA) $(dist_tmpl_DATA) $(dist_xmlscripts_DATA) \
+       $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(top_srcdir)/configure $(top_srcdir)/init.d/torrus.in \
+       $(top_srcdir)/setup_tools/mkvardir.sh.in \
+       $(top_srcdir)/setup_tools/substvars.sh.in AUTHORS COPYING \
+       ChangeLog INSTALL NEWS TODO conftools/config.guess \
+       conftools/config.sub conftools/install-sh conftools/missing
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES = setup_tools/substvars.sh setup_tools/mkvardir.sh \
+       init.d/torrus
+SCRIPTS = $(noinst_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-exec-recursive install-info-recursive \
+       install-recursive installcheck-recursive installdirs-recursive \
+       pdf-recursive ps-recursive uninstall-info-recursive \
+       uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(discoverydir)" \
+       "$(DESTDIR)$(scriptsdir)" "$(DESTDIR)$(tmpldir)" \
+       "$(DESTDIR)$(xmlscriptsdir)"
+dist_discoveryDATA_INSTALL = $(INSTALL_DATA)
+dist_scriptsDATA_INSTALL = $(INSTALL_DATA)
+dist_tmplDATA_INSTALL = $(INSTALL_DATA)
+dist_xmlscriptsDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_discovery_DATA) $(dist_scripts_DATA) $(dist_tmpl_DATA) \
+       $(dist_xmlscripts_DATA)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  { test ! -d $(distdir) \
+    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+FIND = @FIND@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KILL = @KILL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERLINC = @PERLINC@
+POD2MAN = @POD2MAN@
+POD2MAN_PRESENT_FALSE = @POD2MAN_PRESENT_FALSE@
+POD2MAN_PRESENT_TRUE = @POD2MAN_PRESENT_TRUE@
+POD2TEXT = @POD2TEXT@
+POD2TEXT_PRESENT_FALSE = @POD2TEXT_PRESENT_FALSE@
+POD2TEXT_PRESENT_TRUE = @POD2TEXT_PRESENT_TRUE@
+RM = @RM@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SLEEP = @SLEEP@
+STRIP = @STRIP@
+SU = @SU@
+VERSION = @VERSION@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+cachedir = @cachedir@
+cfgdefdir = @cfgdefdir@
+datadir = @datadir@
+dbhome = @dbhome@
+defrrddir = @defrrddir@
+distxmldir = @distxmldir@
+enable_pkgonly = @enable_pkgonly@
+enable_varperm = @enable_varperm@
+exec_prefix = @exec_prefix@
+exmpdir = @exmpdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mansec_misc = @mansec_misc@
+mansec_usercmd = @mansec_usercmd@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+perlithreads = @perlithreads@
+perllibdir = @perllibdir@
+perllibdirs = @perllibdirs@
+piddir = @piddir@
+pkgbindir = @pkgbindir@
+pkgdocdir = @pkgdocdir@
+pkghome = @pkghome@
+plugdevdisccfgdir = @plugdevdisccfgdir@
+pluginsdir = @pluginsdir@
+plugtorruscfgdir = @plugtorruscfgdir@
+plugwrapperdir = @plugwrapperdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+reportsdir = @reportsdir@
+sbindir = @sbindir@
+scriptsdir = @scriptsdir@
+seslockdir = @seslockdir@
+sesstordir = @sesstordir@
+sharedstatedir = @sharedstatedir@
+siteconfdir = @siteconfdir@
+sitedir = @sitedir@
+sitexmldir = @sitexmldir@
+supdir = @supdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+tmpldir = @tmpldir@
+tmpluserdir = @tmpluserdir@
+torrus_user = @torrus_user@
+var_group = @var_group@
+var_mode = @var_mode@
+var_user = @var_user@
+varprefix = @varprefix@
+webplaindir = @webplaindir@
+webscriptsdir = @webscriptsdir@
+wrapperdir = @wrapperdir@
+SUBDIRS = . bin configs doc examples perllib sup xmlconfig 
+EXTRA_DIST = \
+       setup_tools/Bundle/Torrus.pm \
+       setup_tools/replace_rrfw.sh \
+       setup_tools/configure_fhs \
+       setup_tools/check_perlthreading.pl
+
+noinst_SCRIPTS = \
+       setup_tools/substvars.sh \
+       setup_tools/mkvardir.sh \
+       init.d/torrus
+
+dist_tmpl_DATA = \
+       templates/aclexport.xml \
+       templates/adminfo.html \
+       templates/default-chooser.html \
+       templates/default-dir.html \
+       templates/default-helptext.html \
+       templates/default-login.html \
+       templates/default-recursivedir.html \
+       templates/default-rrd.html \
+       templates/default-tset.html \
+       templates/expanded-dir.html \
+       templates/globalsearch.html \
+       templates/overview-subleaves.html \
+       templates/report-index.html \
+       templates/report-monthly.html \
+       templates/report-serviceid.html \
+       templates/report-yearly.html \
+       templates/search.html \
+       templates/html-incblocks.txt \
+       templates/tset-list.html \
+       templates/email-alarm.txt
+
+dist_scripts_DATA = scripts/rrdup_notify.sh
+xmlscriptsdir = @scriptsdir@/xml
+dist_xmlscripts_DATA = scripts/xml/extract-skeleton.xsl
+discoverydir = @sitedir@/discovery
+dist_discovery_DATA = discovery/README
+mkvardir = @abs_top_builddir@/setup_tools/mkvardir.sh
+HTMLDIR = @abs_top_builddir@/../htdocs
+UPLOADPATH = \
+   ssinyagin,torrus@web.sourceforge.net:/home/groups/t/to/torrus/htdocs/devel
+
+all: all-recursive
+
+.SUFFIXES:
+am--refresh:
+       @:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+             cd $(srcdir) && $(AUTOMAKE) --gnu  \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           echo ' $(SHELL) ./config.status'; \
+           $(SHELL) ./config.status;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+setup_tools/substvars.sh: $(top_builddir)/config.status $(top_srcdir)/setup_tools/substvars.sh.in
+       cd $(top_builddir) && $(SHELL) ./config.status $@
+setup_tools/mkvardir.sh: $(top_builddir)/config.status $(top_srcdir)/setup_tools/mkvardir.sh.in
+       cd $(top_builddir) && $(SHELL) ./config.status $@
+init.d/torrus: $(top_builddir)/config.status $(top_srcdir)/init.d/torrus.in
+       cd $(top_builddir) && $(SHELL) ./config.status $@
+uninstall-info-am:
+install-dist_discoveryDATA: $(dist_discovery_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(discoverydir)" || $(mkdir_p) "$(DESTDIR)$(discoverydir)"
+       @list='$(dist_discovery_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_discoveryDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(discoverydir)/$$f'"; \
+         $(dist_discoveryDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(discoverydir)/$$f"; \
+       done
+
+uninstall-dist_discoveryDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_discovery_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(discoverydir)/$$f'"; \
+         rm -f "$(DESTDIR)$(discoverydir)/$$f"; \
+       done
+install-dist_scriptsDATA: $(dist_scripts_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(scriptsdir)" || $(mkdir_p) "$(DESTDIR)$(scriptsdir)"
+       @list='$(dist_scripts_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_scriptsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(scriptsdir)/$$f'"; \
+         $(dist_scriptsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(scriptsdir)/$$f"; \
+       done
+
+uninstall-dist_scriptsDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_scripts_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(scriptsdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(scriptsdir)/$$f"; \
+       done
+install-dist_tmplDATA: $(dist_tmpl_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(tmpldir)" || $(mkdir_p) "$(DESTDIR)$(tmpldir)"
+       @list='$(dist_tmpl_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_tmplDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(tmpldir)/$$f'"; \
+         $(dist_tmplDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(tmpldir)/$$f"; \
+       done
+
+uninstall-dist_tmplDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_tmpl_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(tmpldir)/$$f'"; \
+         rm -f "$(DESTDIR)$(tmpldir)/$$f"; \
+       done
+install-dist_xmlscriptsDATA: $(dist_xmlscripts_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(xmlscriptsdir)" || $(mkdir_p) "$(DESTDIR)$(xmlscriptsdir)"
+       @list='$(dist_xmlscripts_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_xmlscriptsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xmlscriptsdir)/$$f'"; \
+         $(dist_xmlscriptsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xmlscriptsdir)/$$f"; \
+       done
+
+uninstall-dist_xmlscriptsDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_xmlscripts_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(xmlscriptsdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(xmlscriptsdir)/$$f"; \
+       done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       rev=''; for subdir in $$list; do \
+         if test "$$subdir" = "."; then :; else \
+           rev="$$subdir $$rev"; \
+         fi; \
+       done; \
+       rev="$$rev ."; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+ctags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       $(am__remove_distdir)
+       mkdir $(distdir)
+       $(mkdir_p) $(distdir)/conftools $(distdir)/discovery $(distdir)/init.d $(distdir)/scripts $(distdir)/scripts/xml $(distdir)/setup_tools $(distdir)/setup_tools/Bundle $(distdir)/templates
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+       list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test -d "$(distdir)/$$subdir" \
+           || $(mkdir_p) "$(distdir)/$$subdir" \
+           || exit 1; \
+           distdir=`$(am__cd) $(distdir) && pwd`; \
+           top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+           (cd $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$top_distdir" \
+               distdir="$$distdir/$$subdir" \
+               distdir) \
+             || exit 1; \
+         fi; \
+       done
+       $(MAKE) $(AM_MAKEFLAGS) \
+         top_distdir="$(top_distdir)" distdir="$(distdir)" \
+         dist-hook
+       -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+         ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+         ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+       || chmod -R a+r $(distdir)
+dist-gzip: distdir
+       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       $(am__remove_distdir)
+
+dist-bzip2: distdir
+       tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+       $(am__remove_distdir)
+
+dist-tarZ: distdir
+       tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+       $(am__remove_distdir)
+
+dist-shar: distdir
+       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+       $(am__remove_distdir)
+
+dist-zip: distdir
+       -rm -f $(distdir).zip
+       zip -rq $(distdir).zip $(distdir)
+       $(am__remove_distdir)
+
+dist dist-all: distdir
+       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+       $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+       case '$(DIST_ARCHIVES)' in \
+       *.tar.gz*) \
+         GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+       *.tar.bz2*) \
+         bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+       *.tar.Z*) \
+         uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+       *.shar.gz*) \
+         GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+       *.zip*) \
+         unzip $(distdir).zip ;;\
+       esac
+       chmod -R a-w $(distdir); chmod a+w $(distdir)
+       mkdir $(distdir)/_build
+       mkdir $(distdir)/_inst
+       chmod a-w $(distdir)
+       dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+         && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+         && cd $(distdir)/_build \
+         && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+           $(DISTCHECK_CONFIGURE_FLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) \
+         && $(MAKE) $(AM_MAKEFLAGS) dvi \
+         && $(MAKE) $(AM_MAKEFLAGS) check \
+         && $(MAKE) $(AM_MAKEFLAGS) install \
+         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+         && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+         && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+               distuninstallcheck \
+         && chmod -R a-w "$$dc_install_base" \
+         && ({ \
+              (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+                   distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+             } || { rm -rf "$$dc_destdir"; exit 1; }) \
+         && rm -rf "$$dc_destdir" \
+         && $(MAKE) $(AM_MAKEFLAGS) dist \
+         && rm -rf $(DIST_ARCHIVES) \
+         && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+       $(am__remove_distdir)
+       @(echo "$(distdir) archives ready for distribution: "; \
+         list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+         sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
+distuninstallcheck:
+       @cd $(distuninstallcheck_dir) \
+       && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+          || { echo "ERROR: files left after uninstall:" ; \
+               if test -n "$(DESTDIR)"; then \
+                 echo "  (check DESTDIR support)"; \
+               fi ; \
+               $(distuninstallcheck_listfiles) ; \
+               exit 1; } >&2
+distcleancheck: distclean
+       @if test '$(srcdir)' = . ; then \
+         echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+         exit 1 ; \
+       fi
+       @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+         || { echo "ERROR: files left in build directory after distclean:" ; \
+              $(distcleancheck_listfiles) ; \
+              exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(SCRIPTS) $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+       for dir in "$(DESTDIR)$(discoverydir)" "$(DESTDIR)$(scriptsdir)" "$(DESTDIR)$(tmpldir)" "$(DESTDIR)$(xmlscriptsdir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-data-local install-dist_discoveryDATA \
+       install-dist_scriptsDATA install-dist_tmplDATA \
+       install-dist_xmlscriptsDATA
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+       -rm -rf $(top_srcdir)/autom4te.cache
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-dist_discoveryDATA uninstall-dist_scriptsDATA \
+       uninstall-dist_tmplDATA uninstall-dist_xmlscriptsDATA \
+       uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+       check-am clean clean-generic clean-recursive ctags \
+       ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \
+       dist-shar dist-tarZ dist-zip distcheck distclean \
+       distclean-generic distclean-recursive distclean-tags \
+       distcleancheck distdir distuninstallcheck dvi dvi-am html \
+       html-am info info-am install install-am install-data \
+       install-data-am install-data-local install-dist_discoveryDATA \
+       install-dist_scriptsDATA install-dist_tmplDATA \
+       install-dist_xmlscriptsDATA install-exec install-exec-am \
+       install-info install-info-am install-man install-strip \
+       installcheck installcheck-am installdirs installdirs-am \
+       maintainer-clean maintainer-clean-generic \
+       maintainer-clean-recursive mostlyclean mostlyclean-generic \
+       mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+       uninstall uninstall-am uninstall-dist_discoveryDATA \
+       uninstall-dist_scriptsDATA uninstall-dist_tmplDATA \
+       uninstall-dist_xmlscriptsDATA uninstall-info-am
+
+
+install-data-local:
+       @echo Testing if prefix has changed during make
+       test "$(prefix)" = "@prefix@"
+       $(mkvardir) $(DESTDIR)$(dbhome)
+       $(mkvardir) $(DESTDIR)$(cachedir)
+       $(mkvardir) $(DESTDIR)$(piddir)
+       $(mkvardir) $(DESTDIR)$(reportsdir)
+       $(mkvardir) $(DESTDIR)$(logdir)
+       $(mkvardir) $(DESTDIR)$(sesstordir)
+       $(mkvardir) $(DESTDIR)$(seslockdir)     
+       $(mkinstalldirs) $(DESTDIR)$(tmpluserdir)
+       $(mkinstalldirs) $(DESTDIR)$(plugtorruscfgdir)
+       $(mkinstalldirs) $(DESTDIR)$(plugdevdisccfgdir)
+       $(mkinstalldirs) $(DESTDIR)$(plugwrapperdir)
+
+htdocs:
+       cd doc; make htdocs
+       @for f in $(dist_mibs_DATA); do \
+         f2=$(HTMLDIR)/`basename $$f`; \
+         if test ! -f $$f2 -o $$f -nt $$f2; then \
+           echo "cp $$f $$f2"; \
+           cp $$f $$f2; \
+         fi; \
+       done
+
+upload: dist
+       scp $(distdir).tar.gz TODO $(UPLOADPATH)
+
+todoup:
+       scp TODO $(UPLOADPATH)
+
+dist-hook:
+       date >DIST_REVISION
+       cp DIST_REVISION $(distdir)/
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/torrus/NEWS b/torrus/NEWS
new file mode 100644 (file)
index 0000000..354397f
--- /dev/null
@@ -0,0 +1,320 @@
+24-OCT-2010: Torrus release 1.0.9
+
+It is recommended to re-run discovery and compilation immediately after
+upgrading from 1.0.8.
+
+In this release:
+
+-- WebUI handling is re-designed. FastCGI is supported with Apache
+   and Lighttpd. User authorization option has changed its name:
+   "$Torrus::CGI::authorizeUsers". Login page has now "remember me" checkbox.
+   Apache configuration statements for mod_perl have slightly changed.
+   Removed dependency: libapreq2 is no longer needed.
+
+-- New Perl module required by installer: JSON
+
+-- New discovery modules: Force10, NetBotz, Arista, ALU_Timetra, Foundry,
+   CasaCMTS, Jacarta.
+
+-- Support for semi-transparent lines and areas in multigraphs.
+
+-- Support for arbitrary names for subtrees and leaves (node-display-name
+   parameter). Now original interface names are displayed, without underscores.
+
+-- Monitor alarms are now preserved between config re-compilations. Also
+   dynamic tokenset members are preserved. A new utility:
+   "torrus flushmonitors" flushes old alarms.
+
+-- New parameter: nodeid. It is designed for easier integration of Torrus with
+   other OSS systems. See the "NodeID usage guidelines" document for more
+   details.
+
+-- Current SNMP failures are recorded in a database and displayed by
+   "torrus snmpfailures" utility. The output is in JSON format, so it's easy
+   to integrate into other alerting systems.
+
+-- RHEL compatibility: the old Init script did not stop the daemons properly
+   upon a system reboot.
+
+-- Compatibility with the newest version of Net::SNMP module.
+
+-- Host-based authentication: remote systems, such as customer self-care
+   portals, can retrieve graphs from Torrus WebUI.
+
+-- Performance optimizations: XML compiler runs 10-15% faster.
+
+-- Custom CSS styles must no longer reside in Torrus installation directory.
+
+
+
+
+26-APR-2010: Torrus release 1.0.8bf01
+
+Bugfix release. No new features or functionality.
+
+05-APR-2009: Torrus release 1.0.8
+
+Note: a complete re-compile of the XML is required after upgrading.
+
+In this release:
+
+-- BerkeleyDB stability has significantly improved due to new signal handlers.
+
+-- View parameters can be overridden with URL variables "Gstart",
+   "Gend" and so on.
+
+-- Collector initialization time is improved by shifting some work
+   to the XML compiler.
+
+-- New command-line utility: srvderive. It combines several serviceIDs into
+   a single report by calculating their sum or maximum value
+   (sponsored by nexellent ag, www.nexellent.ch)
+
+-- A number of bugfixes and minor imprvements.
+
+-- Added SNMP discovery support for Arbor E series and Liebert HVAC
+
+
+05-AUG-2008: Torrus release 1.0.7
+
+In this release:
+
+-- Added and improved vendor support for Symmetricom, Juniper JunOS,
+   Cisco SCE, 
+
+-- New discovery parameters, selectors and selector actions.
+
+-- Default value for "collector-timeoffset-step" increased from 30 to 60
+   seconds. 30 seconds is too short for many installations.
+
+-- Support for PostgreSQL in reports generator.
+
+-- Support for IPv6 in SNMP discovery and collector.
+
+-- New collector plugin: "tp-rawexport" for plaintext export of collector data.
+
+-- Cisco QoS monitoring plugin "tp-cisco-cbqos" upgraded to version 1.6.
+   It fixes an old bug in RRD file naming, thus all the QoS-related RRD files
+   would have to be renamed or started from scratch.
+
+-- Other minor enhancements and bugfixes (see ChangeLog for details).
+
+
+03-AUG-2007: Torrus release 1.0.6
+
+In this release:
+
+-- All the trees need to be recompiled after Torrus upgrade.
+
+-- Search capability. The nodes can be searched within a tree or globally.
+   The search database needs to be updated with "torrus buildsearchdb"
+   utility.
+
+-- GUI improvements. Recursive view is restricted and is not offered
+   averywhere. Bugfix for Mozilla browser compatibility: now the graph
+   images are clickable.
+
+-- devdiscover accepts multiple DDX files. Combined with multithreading,
+   this improves the discovery performance even further.
+
+-- SNMP collector periodically refreshes the table mappings. This helps
+   for modular routers with online insertion and removal: the collector
+   does not need to be restarted after the physical configuration changes.
+   Also the OIDs that return noSuchObject are excluded from polling
+   immediately.
+
+-- New MIBs support: Cisco SCE per-service traffic statistics; Cisco CAR
+   statistics; Cisco Ethernet MAC accounting statistics now available on
+   subinterfaces; JunOS per-CoS stats; support for Alteon hardware.
+
+-- <filepattern> XML statement is no longer supported. Use the rrddir2xml
+   utility instead.
+
+-- The CDEF collector from Chrstian Schnidrig is integrated in the main
+   distribution. Devdiscover supports traffic summaries for multiple
+   interfaces.
+
+-- The report generator can generate HTML in any tree. Earlier it was
+   generating the reports only for the trees where data was collected.
+   This improvement allows to split the collecting and viewing trees.
+
+-- The installer allows multithreading for Perl version 5.8.8 or higher only.
+   Earlier versions are known for memory leaks in multithreaded operation.
+
+-- Multiple collector instances per tree. This improves the CPU utilization
+   for multi-CPU servers. See the torrus_collector manpage.
+
+
+
+25-JAN-2007: Torrus release 1.0.5
+
+This is a major release with many new features.
+
+In this release:
+
+-- Bugfixes in SNMPv3 support
+
+-- Perl multithreading. If threads are supported by local Perl,
+   Devdiscover can perform parallel discoveries per output file.
+   Also the Collector runs a background thread for RRD updates.
+
+-- Improvement in SNMP collector initialization. Now the collector expands
+   the interface names and other maps asynchronously, which dramatically
+   reduces the initialization time for large installations.
+   Cisco QoS plugin needs an upgrade to version 1.4 or higher.
+
+-- New vendor support in SNMP discovery engine:
+   Motorola BSR CMTS (ex-Riverdelta), Cisco SCE, BGP prefix statistics for
+   Cisco IOS routers, Cisco IOS XR support.
+
+-- DOCSIS upstream statistics have changed the format, therefore
+   the old stats will be lost after upgrade. The stats now include the
+   US Frequency graphs.
+
+-- Interface statistics now contain "All Errors" tab with all error graphs
+   in one page.
+
+-- Interface traffic graphs may contain bandwidth utilization percentage
+   information (see RFC2863_IF_MIB::bandwidth-usage in SNMP Discovery
+   Guide).
+
+-- Cisco MAC accounting can also be used for billing reports.
+
+
+20-JUL-2006: Torrus release 1.0.4
+
+This is a major release with many new features.
+
+In this release:
+
+-- SNMP Version 3 support in Devdiscover and SNMP collector.
+
+-- Usage reports for billing. Including 95% percentile reports.
+   More details at http://torrus.org/reporting_setup.pod.html
+
+-- Various improvements in SNMP discovery engine and new equipment
+   vendor support
+
+-- Improved monitor notifications. New parameter: "severity"
+   and new action "action_notify".
+
+-- New torrus-siteconfig.pl variables to improve WebUI customization
+
+
+
+02-AUG-2005: Torrus release 1.0.3
+
+This is a minor bugfix release. Unreachable device handling is improved, and
+also there's a possibility to specify extra Perl library path in ./configure
+
+
+27-JUL-2005: Torrus release 1.0.2
+
+The new release requires one additional Perl module to be
+installed: Date::Parse. You can install it from CPAN by using the command:
+  perl -MCPAN -e 'install Date::Parse'
+
+In this release:
+
+-- Unreachable SNMP devices handling has significantly improved.
+   The default unreachable timeout is set to 6 hours.
+
+-- Support for the new mod_perl 2.0 layout.
+
+-- New OID in TORRUS-MIB: torrusMonitorDesc, for easier processing of
+   SNMP traps.
+
+-- ./configure checks if the user "torrus" exists in the system
+
+-- New SNMP discovery parameters:
+   RFC2863_IF_MIB::only-interfaces
+   disable-snmpcollector
+
+-- On the graph page, it is now possible to choose the date for displaying
+   old statistics.
+
+-- The Cisco CPUs are now managed by devdiscover's selectors.
+   This allows you to add monitors to specific CPU graphs, and also add them
+   to a tokenset.
+
+
+21-JUN-2005: Torrus release 1.0.1
+
+In this release:
+
+-- SNMP errors are now handled better. See the User guide for more details.
+
+-- New command line option for monitor: --delay. The init script
+   launches the monitor with 20 minutes delay, to allow the collector
+   update RRD files before monitoring them.
+
+-- New devdiscover option: --fallback. It is useful in large production
+   environments when it's important to have a device in the web interface
+   even if it's turned off
+
+-- Cisco DOCSIS templates now include Total, Active, and Registered
+   modem quantities. RRD file structure has changed, so the graphs will
+   start anew.
+
+-- The meaning of $Torrus::Renderer::stylingProfileOverlay
+   has changed: now it refers to a file name.
+
+
+10-JUN-2005: Torrus release 1.0.0
+
+In this release, compared to RRFW release 0.1.8:
+
+-- New directory structure, with local configuration completely separated
+   from the distribution files
+
+-- Comand-line wrapper "torrus" for executing all commands, with short aliases
+   ("dd" for "devdiscover" etc.)
+
+-- Plugins may be easily added to existing installation
+
+-- Relative file names in DDX files searched in the right directories
+
+-- Discovery object selectors: the new way to customize the discovery results
+
+-- New discovery modules:
+   AxxessIT.pm: Cisco ONS 15300 SDH switches
+   CiscoIOS_Docsis.pm: Cisco IOS DOCSIS specifics: upstream utilization and
+     modem quantities
+   BetterNetworks.pm: BetterNetworks EthernetBox sensors (temperature, humidity
+     and so on)
+   CiscoIOS_MacAccounting.pm: Automated discovery for Cisco MAC accounting.
+     If applicable, MAC peers are associated with BGP peers.
+
+-- Discovery modules improvements:
+     IF-MIB indexing hints for unknown devices
+     Docsis downstream utilization
+     Selector actions for IF-MIB, Docsis, and temperature sensor objects
+     Line cards and modules memory stats for modular Ciscso routers     
+
+-- Improved performance of monitor daemon
+
+-- extended example of DOCSIS monitors and 3-level alarms in
+   xmlconfig/examples/docsis-monitors.xml
+
+-- Renderer module improved for multi-CPU servers
+
+-- Web interface improvements:
+     Recursive directory view,
+     Monitor names and comments diaplayed,
+     Sizes of tokensets displayed
+     Multiple overviews possible for a subtree
+
+-- SO_RCVBUF is set explicitly in SNMP collector to sustain bursts of traffic
+
+-- RRD files automatically moved in case of conflicts
+
+-- ttproclist: the new utility for automating the DDX files generation
+
+-- action_snmptrap now sends an optional severity parameter
+
+-- New option for devdiscover: --forcebundle to write the bundle file
+   even if errors occur
+
+-- The init script is configurable by a separate configuration file.
+   It also launches the monitors with 20 minutes delay if monitors
+   are launched together with collectors
diff --git a/torrus/README b/torrus/README
new file mode 100644 (file)
index 0000000..ee9a2d6
--- /dev/null
@@ -0,0 +1,10 @@
+Round Robin Database Framework
+
+    http://sourceforge.net/projects/torrus
+    http://torrus.org
+
+For installation instructions, see doc/install.txt or convert doc/install.pod
+into a format of your preference.
+
+
+(C) 2002-2005, Stanislav Sinyagin <ssinyagin@yahoo.com>
diff --git a/torrus/TODO b/torrus/TODO
new file mode 100644 (file)
index 0000000..e5f7b10
--- /dev/null
@@ -0,0 +1,161 @@
+Round Robin Database Framework
+  
+To do now:
+
+-- index the parameters during compilation and add search function to UI
+-- Update User Guide
+-- Persistent maps in snmp collector
+-- Multithreading in collector
+-- Additive list parameters
+-- New security model (access control within a tree)
+-- New WebUI model
+-- take the CF for graphing from view definition
+-- implement new RPN functions: SORT, REV, TREND
+-- Display docsIfDownstreamChannelTable docsIfUpstreamChannelTable in
+   DOCSIS chanel legends
+-- validate %Torrus::SQL::connections
+-- periodically refresh SNMP collector mappings
+-- Modular structure in Monitor, with pluggable actions
+-- in Monitor::run_event_exec, distinguish between monitor target and
+   action target
+-- document selectors internals
+-- fix the bug in recursive $def expansion
+-- Move expandable parameters from ConfigTree.pm to XML config
+-- dispersed timeoffsets for monitor
+-- use Parallel::ForkManager in devdiscover
+-- Set the daemon's log level by signal
+-- Selector for Cisco CPU and memory buffer monitoring
+-- Option to expand directory view by default
+-- Traceroute plugin (Gustavo Torres)
+-- CDef Collector plugin (Christian Schnidrig)
+-- Optionally show Admin info when authentication disabled
+-- RRD Renderer to take CF from the view definition
+-- Do we need a separate directory for user-defined styling?
+-- Startup script that verifies database consistency at server boot
+-- Collector that reports the BerkeleyDB stats
+-- Sysedge ntregperf discovery optimization (Shawn)
+-- Check RRD DS name length limit (19 bytes) and variable name limit (29 bytes)
+-- Better handling of SNMP timeouts in devdiscover
+-- MS-SQL SNMP support? (Shawn)
+-- Discovery profiles (router, server, etc.) to limit the number of probes
+-- Per-tree styling profiles (CSS, color schemas, company name and URL)
+-- Describe IF-MIB discovery internals in doc/devdoc/devdiscover.pod
+-- New utility to verify the installation files consistency (see below)
+-- rrd-create-max for interface counters tunable in vendor modules
+-- Backup snapshot of dynamic data (monitor status etc.)
+-- Relative path in alias definition
+-- "Remember me" login screen option
+-- Graph colouring by monitor action
+-- Session history display
+-- Track changes of XML configurations (XML::Diff, cvs-alike?)
+-- Translate parameters in monitor comments
+-- Show maximum value in the graph image comments
+
+Design work to do:
+
+-- Design draft for custom indexing and quering
+-- Develop a Concept of 95th percentile monthly reports
+-- Reports generation (monthly, weekly etc.)
+-- Write working draft for "collector-copy" datasource type
+
+To do before Release 1.0.1:
+
+-- Implement monitor escalation (devdoc/wd.monitor-escalation.pod)
+-- BUG: template may add children to a leaf
+-- Add more documentation to the existing XML
+-- Document HTML templates
+-- Web interface for ACL editing
+-- Date selector in Web interface
+-- CSV data export (new Renderer type)
+-- Syslog logging
+
+To do someday:
+
+-- Finish and test "RFC2662_ADSL_LINE" and "Paradyne" devdiscover modules
+-- Backplane performance for Catalyst switches
+-- VoIP dial peer statistics
+-- Gradual highlighting for subtree listings
+-- Tools for RRD files manipulation (adding/deleting DSes etc.)
+-- Service uptime monitoring and reporting (devdoc/wd.uptime-mon.pod)
+-- Distributed collector (devdoc/wd.distributed.pod)
+-- Log files wraparound
+-- Packaging for major OSes: RedHat, Debian, FreeBSD, Solaris, MacOS X (?)
+-- rrdtool-1.1 font option (only after rrdtool 1.1.x is released)
+-- navigation links to represent the network topology
+-- Messaging (devdoc/wd.messaging.pod)
+-- Tighter integration with OpenNMS and probably other systems
+-- Several obscurity levels instead of hidden=yes/no
+
+
+(C) 2002-2004, Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+$Id: TODO,v 1.1 2010-12-27 00:03:35 ivan Exp $
+
+==========================================================================
+
+CC: rrfw-devel@lists.sourceforge.net, "Shawn Ferry" <sferry@sevenspace.com> 
+From: "Shawn Ferry" <sferry@sevenspace.com>
+Subject: Re: [rrfw-devel] health check 
+Date: Mon, 15 Dec 2003 10:08:35 -0500 
+To: "Stanislav Sinyagin" <ssinyagin@yahoo.com> 
+      
+On Dec 15, 2003, at 9:56 AM, Stanislav Sinyagin wrote:
+
+> 'Morning Shawn,
+>
+> --- Shawn Ferry <sferry@sevenspace.com> wrote:
+>>> It might be also that this installation uses old version of
+>>> RRFW::Collector::SNMP,
+>>> or some buggy version of Net::SNMP.
+>>
+>> Something like that...When I installed 1.5d I did not stop and
+>> restart the collector. It is much happier now.
+>>
+>> Can you check at each initialization that the versions of all
+>> the supporting files is up to date? or maybe stash the modify time
+>> of files that are loaded and check.
+>>
+>> Not an issue just a thought to try and prevent
+>> other people from having the same silly problem.
+>
+> good idea. But I can check the files on disk only, it's not possible
+> (not easy) to check if the running process is up to date.
+>
+> bin/configinfo already prints some versions information.
+>
+> Let's say, an utility called "bin/checkfiles", would do the following:
+>
+> -- for files that are simply copied by make install: verify md5 sum 
+> against that in distribution
+>
+> -- for files that are modified by make install: 
+> verify md5 sum against that calculated during make install
+>
+> -- optionally store and verify md5 sums of user files in 
+> share/rrfw/discovery and share/rrfw/xmlconfig, as well as 
+> *-siteconfig.pl
+>
+> Does someone know if there's already something alike in other software?
+
+Similar functionality exists in cfengine, but I don't think it is 
+applicable in this case.
+Also tripwire.
+
+I am not so worried about knowing if the loaded version is up to date 
+based on a
+stored version string.  Although that was my original thought.
+
+I was thinking that the functionality of the "checkfiles" utility could 
+just be as you
+suggest an md5 sum.  Also, that md5 sum could be stored at 
+initialization for the libraries
+used in any long running process. The next initialization after a 
+compile could verify
+that the on disk sums have not changed.  Possibly to reload, alert or 
+something.
+
+Shawn
+
+==========================================================================
+
diff --git a/torrus/aclocal.m4 b/torrus/aclocal.m4
new file mode 100644 (file)
index 0000000..7a634b5
--- /dev/null
@@ -0,0 +1,574 @@
+# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005  Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+        [AM_AUTOMAKE_VERSION([1.9.6])])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 12
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.58])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+                            [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                  [_AM_DEPENDENCIES(CC)],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                  [_AM_DEPENDENCIES(CXX)],
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $1 | $1:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
+#
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake.  There are at least two reasons why we must not
+# use `-m 0755':
+#   - it causes special bits like SGID to be ignored,
+#   - it may be too restrictive (some setups expect 775 directories).
+#
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out.  Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
diff --git a/torrus/bin/Makefile.am b/torrus/bin/Makefile.am
new file mode 100644 (file)
index 0000000..b6abf74
--- /dev/null
@@ -0,0 +1,177 @@
+
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.am,v 1.1 2010-12-27 00:04:01 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+SUBST = @abs_top_builddir@/setup_tools/substvars.sh
+
+pkgbindir = @pkgbindir@
+pkgbin_SCRIPTS = \
+       acledit                 \
+       action_notify           \
+       action_printemail       \
+       action_snmptrap         \
+       action_snmpv1trap       \
+       bdbinfo                 \
+       buildsearchdb           \
+       cleanup                 \
+       clearcache              \
+       collector               \
+       compilexml              \
+       configinfo              \
+       configsnapshot          \
+       devdiscover             \
+       flushmonitors           \
+       genddx                  \
+       genlist                 \
+       genreport               \
+       install_plugin          \
+       monitor                 \
+       nodeid                  \
+       rrddir2xml              \
+       schedulerinfo           \
+       snmpfailures            \
+       srvderive               \
+       torrus.fcgi             \
+       ttproclist
+
+wrapperdir = @wrapperdir@
+wrapper_SCRIPTS = \
+       torrus
+
+CLEANFILES = $(pkgbin_SCRIPTS) $(wrapper_SCRIPTS)
+
+EXTRA_DIST = \
+       acledit.in              \
+       action_notify.in        \
+       action_printemail.in    \
+       action_snmptrap.in      \
+       action_snmpv1trap.in    \
+       bdbinfo.in              \
+       buildsearchdb.in        \
+       clearcache.in           \
+       cleanup.in              \
+       collector.in            \
+       compilexml.in           \
+       configinfo.in           \
+       configsnapshot.in       \
+       devdiscover.in          \
+       flushmonitors.in        \
+       genddx.in               \
+       genlist.in              \
+       genreport.in            \
+       install_plugin.in       \
+       monitor.in              \
+       nodeid.in               \
+       rrddir2xml.in           \
+       schedulerinfo.in        \
+       snmpfailures.in         \
+       srvderive.in            \
+       torrus.fcgi.in          \
+       torrus.in               \
+       ttproclist.in
+
+
+# Result of:
+# ls -1 | egrep '^[a-z][^.]+$' | \
+# awk '{printf "%s: %s.in\n\t$(SUBST) %s.in > %s\n\n", $1, $1, $1, $1}'
+
+acledit: acledit.in
+       $(SUBST) acledit.in > acledit
+
+action_printemail: action_printemail.in
+       $(SUBST) action_printemail.in > action_printemail
+
+action_notify: action_notify.in
+       $(SUBST) action_notify.in > action_notify
+
+action_snmptrap: action_snmptrap.in
+       $(SUBST) action_snmptrap.in > action_snmptrap
+
+action_snmpv1trap: action_snmpv1trap.in
+       $(SUBST) action_snmpv1trap.in > action_snmpv1trap
+
+buildsearchdb: buildsearchdb.in
+       $(SUBST) buildsearchdb.in > buildsearchdb
+
+bdbinfo: bdbinfo.in
+       $(SUBST) bdbinfo.in > bdbinfo
+
+cleanup: cleanup.in
+       $(SUBST) cleanup.in > cleanup
+
+clearcache: clearcache.in
+       $(SUBST) clearcache.in > clearcache
+
+collector: collector.in
+       $(SUBST) collector.in > collector
+
+compilexml: compilexml.in
+       $(SUBST) compilexml.in > compilexml
+
+configinfo: configinfo.in
+       $(SUBST) configinfo.in > configinfo
+
+configsnapshot: configsnapshot.in
+       $(SUBST) configsnapshot.in > configsnapshot
+
+devdiscover: devdiscover.in
+       $(SUBST) devdiscover.in > devdiscover
+
+flushmonitors: flushmonitors.in
+       $(SUBST) flushmonitors.in > flushmonitors
+
+genddx: genddx.in
+       $(SUBST) genddx.in > genddx
+
+genlist: genlist.in
+       $(SUBST) genlist.in > genlist
+
+genreport: genreport.in
+       $(SUBST) genreport.in > genreport
+
+install_plugin: install_plugin.in
+       $(SUBST) install_plugin.in > install_plugin
+
+monitor: monitor.in
+       $(SUBST) monitor.in > monitor
+
+nodeid: nodeid.in
+       $(SUBST) nodeid.in > nodeid
+
+rrddir2xml: rrddir2xml.in
+       $(SUBST) rrddir2xml.in > rrddir2xml
+
+schedulerinfo: schedulerinfo.in
+       $(SUBST) schedulerinfo.in > schedulerinfo
+
+snmpfailures: snmpfailures.in
+       $(SUBST) snmpfailures.in > snmpfailures
+
+srvderive: srvderive.in
+       $(SUBST) srvderive.in > srvderive
+
+torrus: torrus.in
+       $(SUBST) torrus.in > torrus
+
+torrus.fcgi: torrus.fcgi.in
+       $(SUBST) torrus.fcgi.in > torrus.fcgi
+
+ttproclist: ttproclist.in
+       $(SUBST) ttproclist.in > ttproclist
diff --git a/torrus/bin/Makefile.in b/torrus/bin/Makefile.in
new file mode 100644 (file)
index 0000000..fb4aa2b
--- /dev/null
@@ -0,0 +1,538 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.in,v 1.1 2010-12-27 00:04:01 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = bin
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(pkgbindir)" "$(DESTDIR)$(wrapperdir)"
+pkgbinSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+wrapperSCRIPT_INSTALL = $(INSTALL_SCRIPT)
+SCRIPTS = $(pkgbin_SCRIPTS) $(wrapper_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+FIND = @FIND@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KILL = @KILL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERLINC = @PERLINC@
+POD2MAN = @POD2MAN@
+POD2MAN_PRESENT_FALSE = @POD2MAN_PRESENT_FALSE@
+POD2MAN_PRESENT_TRUE = @POD2MAN_PRESENT_TRUE@
+POD2TEXT = @POD2TEXT@
+POD2TEXT_PRESENT_FALSE = @POD2TEXT_PRESENT_FALSE@
+POD2TEXT_PRESENT_TRUE = @POD2TEXT_PRESENT_TRUE@
+RM = @RM@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SLEEP = @SLEEP@
+STRIP = @STRIP@
+SU = @SU@
+VERSION = @VERSION@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+cachedir = @cachedir@
+cfgdefdir = @cfgdefdir@
+datadir = @datadir@
+dbhome = @dbhome@
+defrrddir = @defrrddir@
+distxmldir = @distxmldir@
+enable_pkgonly = @enable_pkgonly@
+enable_varperm = @enable_varperm@
+exec_prefix = @exec_prefix@
+exmpdir = @exmpdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mansec_misc = @mansec_misc@
+mansec_usercmd = @mansec_usercmd@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+perlithreads = @perlithreads@
+perllibdir = @perllibdir@
+perllibdirs = @perllibdirs@
+piddir = @piddir@
+pkgbindir = @pkgbindir@
+pkgdocdir = @pkgdocdir@
+pkghome = @pkghome@
+plugdevdisccfgdir = @plugdevdisccfgdir@
+pluginsdir = @pluginsdir@
+plugtorruscfgdir = @plugtorruscfgdir@
+plugwrapperdir = @plugwrapperdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+reportsdir = @reportsdir@
+sbindir = @sbindir@
+scriptsdir = @scriptsdir@
+seslockdir = @seslockdir@
+sesstordir = @sesstordir@
+sharedstatedir = @sharedstatedir@
+siteconfdir = @siteconfdir@
+sitedir = @sitedir@
+sitexmldir = @sitexmldir@
+supdir = @supdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+tmpldir = @tmpldir@
+tmpluserdir = @tmpluserdir@
+torrus_user = @torrus_user@
+var_group = @var_group@
+var_mode = @var_mode@
+var_user = @var_user@
+varprefix = @varprefix@
+webplaindir = @webplaindir@
+webscriptsdir = @webscriptsdir@
+wrapperdir = @wrapperdir@
+SUBST = @abs_top_builddir@/setup_tools/substvars.sh
+pkgbin_SCRIPTS = \
+       acledit                 \
+       action_notify           \
+       action_printemail       \
+       action_snmptrap         \
+       action_snmpv1trap       \
+       bdbinfo                 \
+       buildsearchdb           \
+       cleanup                 \
+       clearcache              \
+       collector               \
+       compilexml              \
+       configinfo              \
+       configsnapshot          \
+       devdiscover             \
+       flushmonitors           \
+       genddx                  \
+       genlist                 \
+       genreport               \
+       install_plugin          \
+       monitor                 \
+       nodeid                  \
+       rrddir2xml              \
+       schedulerinfo           \
+       snmpfailures            \
+       srvderive               \
+       torrus.fcgi             \
+       ttproclist
+
+wrapper_SCRIPTS = \
+       torrus
+
+CLEANFILES = $(pkgbin_SCRIPTS) $(wrapper_SCRIPTS)
+EXTRA_DIST = \
+       acledit.in              \
+       action_notify.in        \
+       action_printemail.in    \
+       action_snmptrap.in      \
+       action_snmpv1trap.in    \
+       bdbinfo.in              \
+       buildsearchdb.in        \
+       clearcache.in           \
+       cleanup.in              \
+       collector.in            \
+       compilexml.in           \
+       configinfo.in           \
+       configsnapshot.in       \
+       devdiscover.in          \
+       flushmonitors.in        \
+       genddx.in               \
+       genlist.in              \
+       genreport.in            \
+       install_plugin.in       \
+       monitor.in              \
+       nodeid.in               \
+       rrddir2xml.in           \
+       schedulerinfo.in        \
+       snmpfailures.in         \
+       srvderive.in            \
+       torrus.fcgi.in          \
+       torrus.in               \
+       ttproclist.in
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  bin/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  bin/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-pkgbinSCRIPTS: $(pkgbin_SCRIPTS)
+       @$(NORMAL_INSTALL)
+       test -z "$(pkgbindir)" || $(mkdir_p) "$(DESTDIR)$(pkgbindir)"
+       @list='$(pkgbin_SCRIPTS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         if test -f $$d$$p; then \
+           f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+           echo " $(pkgbinSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgbindir)/$$f'"; \
+           $(pkgbinSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgbindir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-pkgbinSCRIPTS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(pkgbin_SCRIPTS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+         echo " rm -f '$(DESTDIR)$(pkgbindir)/$$f'"; \
+         rm -f "$(DESTDIR)$(pkgbindir)/$$f"; \
+       done
+install-wrapperSCRIPTS: $(wrapper_SCRIPTS)
+       @$(NORMAL_INSTALL)
+       test -z "$(wrapperdir)" || $(mkdir_p) "$(DESTDIR)$(wrapperdir)"
+       @list='$(wrapper_SCRIPTS)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         if test -f $$d$$p; then \
+           f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+           echo " $(wrapperSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(wrapperdir)/$$f'"; \
+           $(wrapperSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(wrapperdir)/$$f"; \
+         else :; fi; \
+       done
+
+uninstall-wrapperSCRIPTS:
+       @$(NORMAL_UNINSTALL)
+       @list='$(wrapper_SCRIPTS)'; for p in $$list; do \
+         f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
+         echo " rm -f '$(DESTDIR)$(wrapperdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(wrapperdir)/$$f"; \
+       done
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(SCRIPTS)
+installdirs:
+       for dir in "$(DESTDIR)$(pkgbindir)" "$(DESTDIR)$(wrapperdir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pkgbinSCRIPTS install-wrapperSCRIPTS
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-pkgbinSCRIPTS \
+       uninstall-wrapperSCRIPTS
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+       distclean-generic distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am install-exec \
+       install-exec-am install-info install-info-am install-man \
+       install-pkgbinSCRIPTS install-strip install-wrapperSCRIPTS \
+       installcheck installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+       pdf-am ps ps-am uninstall uninstall-am uninstall-info-am \
+       uninstall-pkgbinSCRIPTS uninstall-wrapperSCRIPTS
+
+
+# Result of:
+# ls -1 | egrep '^[a-z][^.]+$' | \
+# awk '{printf "%s: %s.in\n\t$(SUBST) %s.in > %s\n\n", $1, $1, $1, $1}'
+
+acledit: acledit.in
+       $(SUBST) acledit.in > acledit
+
+action_printemail: action_printemail.in
+       $(SUBST) action_printemail.in > action_printemail
+
+action_notify: action_notify.in
+       $(SUBST) action_notify.in > action_notify
+
+action_snmptrap: action_snmptrap.in
+       $(SUBST) action_snmptrap.in > action_snmptrap
+
+action_snmpv1trap: action_snmpv1trap.in
+       $(SUBST) action_snmpv1trap.in > action_snmpv1trap
+
+buildsearchdb: buildsearchdb.in
+       $(SUBST) buildsearchdb.in > buildsearchdb
+
+bdbinfo: bdbinfo.in
+       $(SUBST) bdbinfo.in > bdbinfo
+
+cleanup: cleanup.in
+       $(SUBST) cleanup.in > cleanup
+
+clearcache: clearcache.in
+       $(SUBST) clearcache.in > clearcache
+
+collector: collector.in
+       $(SUBST) collector.in > collector
+
+compilexml: compilexml.in
+       $(SUBST) compilexml.in > compilexml
+
+configinfo: configinfo.in
+       $(SUBST) configinfo.in > configinfo
+
+configsnapshot: configsnapshot.in
+       $(SUBST) configsnapshot.in > configsnapshot
+
+devdiscover: devdiscover.in
+       $(SUBST) devdiscover.in > devdiscover
+
+flushmonitors: flushmonitors.in
+       $(SUBST) flushmonitors.in > flushmonitors
+
+genddx: genddx.in
+       $(SUBST) genddx.in > genddx
+
+genlist: genlist.in
+       $(SUBST) genlist.in > genlist
+
+genreport: genreport.in
+       $(SUBST) genreport.in > genreport
+
+install_plugin: install_plugin.in
+       $(SUBST) install_plugin.in > install_plugin
+
+monitor: monitor.in
+       $(SUBST) monitor.in > monitor
+
+nodeid: nodeid.in
+       $(SUBST) nodeid.in > nodeid
+
+rrddir2xml: rrddir2xml.in
+       $(SUBST) rrddir2xml.in > rrddir2xml
+
+schedulerinfo: schedulerinfo.in
+       $(SUBST) schedulerinfo.in > schedulerinfo
+
+snmpfailures: snmpfailures.in
+       $(SUBST) snmpfailures.in > snmpfailures
+
+srvderive: srvderive.in
+       $(SUBST) srvderive.in > srvderive
+
+torrus: torrus.in
+       $(SUBST) torrus.in > torrus
+
+torrus.fcgi: torrus.fcgi.in
+       $(SUBST) torrus.fcgi.in > torrus.fcgi
+
+ttproclist: ttproclist.in
+       $(SUBST) ttproclist.in > ttproclist
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/torrus/bin/acledit.in b/torrus/bin/acledit.in
new file mode 100644 (file)
index 0000000..725d3b5
--- /dev/null
@@ -0,0 +1,432 @@
+#!@PERL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: acledit.in,v 1.1 2010-12-27 00:04:01 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use Getopt::Long;
+
+use Torrus::Log;
+use Torrus::ACL::Edit;
+use Torrus::SiteConfig;
+
+exit(1) if not Torrus::SiteConfig::verify();
+
+our %knownPrivileges =
+    ( 'DisplayTree' => 'tree',
+      'DisplayAdmInfo' => 'tree',
+      'DisplayReports' => 'tree',
+      'GlobalSearch' => 'global' );
+
+our @addgroups;
+our @delgroups;
+our @modgroups;
+
+our @permitprivs;
+our @denyprivs;
+our @forobjects;
+
+our $adduser;
+our $addhost;
+our $deluser;
+our $moduser;
+our @addtogroups;
+our @delfromgroups;
+our $password;
+our $host_password;
+our $commonname;
+our $exportfile;
+our $exporttemplate = "aclexport.xml";
+our $importfile;
+our $clearconf;
+
+our @showgroups;
+our @showusers;
+our $listall;
+
+our $force;
+our $debug;
+our $verbose;
+our $help_needed;
+
+my $ok = GetOptions ('addgroup=s'     => \@addgroups,
+                     'delgroup=s'     => \@delgroups,
+                     'modgroup=s'     => \@modgroups,
+                     'permit=s'       => \@permitprivs,
+                     'deny=s'         => \@denyprivs,
+                     'for=s'          => \@forobjects,
+                     'adduser=s'      => \$adduser,
+                     'addhost=s'      => \$addhost,
+                     'deluser=s'      => \$deluser,
+                     'moduser=s'      => \$moduser,
+                     'addtogroup=s'   => \@addtogroups,
+                     'delfromgroup=s' => \@delfromgroups,
+                     'password=s'     => \$password,
+                     'hostpassword=s' => \$host_password,
+                     'cn=s'           => \$commonname,
+                     'export=s'       => \$exportfile,
+                     'template=s'     => \$exporttemplate,
+                     'import=s'       => \$importfile,
+                     'clear'          => \$clearconf,
+                     'showgroup=s'    => \@showgroups,
+                     'showuser=s'     => \@showusers,
+                     'list'           => \$listall,
+                     'force'          => \$force,
+                     'debug'    => \$debug,
+                     'verbose'  => \$verbose,
+                     'help'     => \$help_needed);
+
+if( not $ok or $help_needed or scalar(@ARGV) > 0 or
+    ( @addgroups ? 1:0 ) + ( @delgroups ? 1:0 ) + ( @modgroups ? 1:0 ) > 1 or
+    ( ( @permitprivs or @denyprivs ) and not @forobjects ) or
+    ( $adduser ? 1:0 ) + ( $deluser ? 1:0 ) + ( $moduser ? 1:0 ) > 1 or
+    ( ( @addtogroups or @delfromgroups or
+        length($password) > 0 or
+        length($host_password) > 0 or
+        length($commonname) > 0 ) and
+      ( length($adduser) + length($addhost) + length($moduser) == 0 ) ) )
+{
+    print STDERR "Usage: $0 [options...]\n",
+    "Group Options:\n",
+    "  --addgroup=GROUP        add group\n",
+    "  --delgroup=GROUP        delete group\n",
+    "  --modgroup=GROUP        modify group\n",
+    "  --permit=PRIVILEGE      add privilege to group(s)\n",
+    "  --deny=PRIVILEGE        revoke privilege from group(s)\n",
+    "  --for=TREE              subject of privilege or '*'\n",
+    "  --force                 change privilege for non-existent object\n",
+    "  --showgroup=GROUP       display group details\n",
+    "User Options:\n",
+    "  --adduser=UID           add new user\n",
+    "  --deluser=UID           delete user\n",
+    "  --moduser=UID           modify user\n",
+    "  --addtogroup=GROUP      add user to group(s)\n",
+    "  --delfromgroup=GROUP    delete user from group(s)\n",
+    "  --password=PASSWORD     set the user password\n",
+    "  --hostpassword=PASSWORD set the host password (UID must be a host)\n",
+    "  --cn=\"John Smith\"       set the user common name\n",
+    "  --showuser=USER         display user details\n",
+    "General Options:\n",
+    "  --export=FILE           export ACL config to a file\n",
+    "  --template=NAME         [aclexport.xml] export template \n",
+    "  --import=FILE           import ACL config from a file\n",
+    "  --clear                 delete ALL user and privileges configuration\n",
+    "  --list                  list all users and groups they belong to\n",
+    "  --debug                 set the log level to debug\n",
+    "  --verbose               set the log level to verbose\n",
+    "  --help                  this help message\n\n",
+    "Privileges:\n",
+    "  DisplayTree             see the datasources for a tree\n",
+    "  DisplayAdmInfo          see the administrative info for a tree\n",
+    "  DisplayReports          see the administrative info for a tree\n",
+    "  GlobalSearch            search globally for '*'\n";
+    exit 1;
+}
+
+if( $debug )
+{
+    Torrus::Log::setLevel('debug');
+}
+elsif( $verbose )
+{
+    Torrus::Log::setLevel('verbose');
+}
+
+# We set the signal handlers, but we actually don't react on
+# signals, because the acledit is a fast utility
+&Torrus::DB::setSafeSignalHandlers();
+
+Verbose(sprintf("Torrus version %s", '@VERSION@'));
+
+my $aclEdit = new Torrus::ACL::Edit;
+
+if( $ok and $exportfile )
+{
+    $ok = $aclEdit->exportACL( $exportfile, $exporttemplate ) ? $ok:0;
+}
+
+if( $ok and $clearconf )
+{
+    $ok = $aclEdit->clearConfig() ? $ok:0;
+}
+
+if( @delgroups )
+{
+    $ok = $aclEdit->deleteGroups( @delgroups ) ? $ok:0;
+}
+
+if( @addgroups )
+{
+    $ok = $aclEdit->addGroups( @addgroups ) ? $ok:0;
+}
+
+if( @addgroups or @modgroups )
+{
+    my $groups = [ @addgroups, @modgroups ];
+    if( @permitprivs )
+    {
+        $ok = setupPrivileges( $aclEdit, \@permitprivs,
+                               $groups, \@forobjects, 1 ) ? $ok:0;
+    }
+    if( @denyprivs )
+    {
+        $ok = setupPrivileges( $aclEdit, \@denyprivs,
+                               $groups, \@forobjects, 0 ) ? $ok:0;
+    }
+}
+
+
+my $attrValues = {};
+my $uid;
+
+if( $commonname )
+{
+    $attrValues->{'cn'} = $commonname;
+}
+
+if( $adduser )
+{
+    $uid = $adduser;
+    $ok = $aclEdit->addUser( $uid, $attrValues ) ? $ok:0;
+}
+elsif( $addhost )
+{
+    $uid = $addhost;
+    $uid =~ s/\W/_/g;
+    $ok = $aclEdit->addUser( $uid, $attrValues ) ? $ok:0;
+}
+
+elsif( $moduser )
+{
+    $uid = $moduser;
+    if( scalar( keys %{$attrValues} ) )
+    {
+        $ok = $aclEdit->setUserAttributes( $uid, $attrValues ) ? $ok:0;
+    }
+}
+elsif( $deluser )
+{
+    $ok = $aclEdit->deleteUser( $deluser ) ? $ok:0;
+}
+
+if( $uid )
+{
+    if( $password )
+    {
+        $ok = $aclEdit->setPassword( $uid, $password ) ? $ok:0;
+    }
+    elsif( $host_password )
+    {
+        $ok = $aclEdit->setPassword( $uid,
+                                     $uid . '//' . $host_password ) ? $ok:0;
+    }
+}
+
+if( $uid and scalar( @addtogroups ) )
+{
+    $ok = $aclEdit->addUserToGroups( $uid, @addtogroups ) ? $ok:0;
+}
+
+if( $uid and scalar( @delfromgroups ) )
+{
+    $ok = $aclEdit->delUserFromGroups( $uid, @delfromgroups ) ? $ok:0;
+}
+
+if( $ok and $importfile )
+{
+    $ok = $aclEdit->importACL( $importfile ) ? $ok:0;
+}
+
+if( $listall )
+{
+    @showusers = $aclEdit->listUsers();
+    @showgroups = $aclEdit->listGroups();
+}
+
+my %showGroupsHash;
+
+if( @showgroups )
+{
+    foreach my $group ( @showgroups )
+    {
+        if( $aclEdit->groupExists( $group ) )
+        {
+            $showGroupsHash{$group} = 1;
+        }
+        else
+        {
+            Error('No such group: ' . $group); $ok = 0;
+        }
+    }
+}
+
+if( @showusers )
+{
+    foreach my $uid ( sort @showusers )
+    {
+        if( $aclEdit->userExists( $uid ) )
+        {
+            printf("User: %s (%s)\n",
+                   $uid, $aclEdit->userAttribute( $uid, 'cn' ) );
+            foreach my $group ( sort $aclEdit->memberOf( $uid ) )
+            {
+                printf("Member of: %s\n", $group);
+                $showGroupsHash{$group} = 1;
+            }
+
+            if( $verbose or $debug )
+            {
+                printf("Modified: %s\n",
+                       $aclEdit->userAttribute( $uid, 'modified' ) );
+            }
+            printf ("\n");
+        }
+        else
+        {
+            Error('No such user: ' . $uid); $ok = 0;
+        }
+    }
+}
+
+if( %showGroupsHash )
+{
+    foreach my $group ( sort keys %showGroupsHash )
+    {
+        printf("Group: %s\n", $group);
+
+        my $privs = $aclEdit->listPrivileges( $group );
+        foreach my $object ( sort keys %{$privs} )
+        {
+            foreach my $priv ( sort keys %{$privs->{$object}} )
+            {
+                printf("Has privilege \"%s\" for %s \"%s\"\n", $priv,
+                       $knownPrivileges{$priv}, $object);
+            }
+        }
+
+        foreach my $uid ( sort @{$aclEdit->listGroupMembers( $group )} )
+        {
+            printf("Member: %s\n", $uid);
+        }
+
+        if( $verbose or $debug )
+        {
+            printf("Modified: %s\n",
+                   $aclEdit->groupAttribute( $group, 'modified' ) );
+        }
+
+        printf ("\n");
+    }
+}
+
+if( not $ok )
+{
+    Warn('acledit exited with errors');
+}
+exit( $ok ? 0:1 );
+
+sub setupPrivileges
+{
+    my $aclEdtit = shift;
+    my $privs = shift;
+    my $groups = shift;
+    my $objects = shift;
+    my $permit = shift;
+
+    my $ok = 1;
+    foreach my $priv ( @{$privs} )
+    {
+        if( defined( $knownPrivileges{$priv} ) )
+        {
+            if( $knownPrivileges{$priv} eq 'tree' )
+            {
+                foreach my $obj ( @{$objects} )
+                {
+                    if( $obj eq '*' or
+                        Torrus::SiteConfig::treeExists( $obj ) or $force )
+                    {
+                        foreach my $group ( @{$groups} )
+                        {
+                            if( $permit )
+                            {
+                                $ok = $aclEdit->
+                                    setPrivilege( $group, $obj,
+                                                  $priv ) ? $ok:0;
+                            }
+                            else
+                            {
+                                $ok = $aclEdit->
+                                    clearPrivilege( $group, $obj,
+                                                    $priv ) ? $ok:0;
+                            }
+                        }
+                    }
+                    else
+                    {
+                        Error('No such tree: ' . $obj); $ok = 0;
+                    }
+                }
+            }
+            elsif( $knownPrivileges{$priv} eq 'global' )
+            {
+                foreach my $obj ( @{$objects} )
+                {
+                    if( $obj ne '*' )
+                    {
+                        Error("Privilege GlobalSearch should be for '*'");
+                        $ok = 0;
+                    }                    
+                }
+
+                if( $ok )
+                {
+                    foreach my $group ( @{$groups} )
+                    {
+                        if( $permit )
+                        {
+                            $ok = $aclEdit->
+                                setPrivilege( $group, '*', $priv ) ? $ok:0;
+                        }
+                        else
+                        {
+                            $ok = $aclEdit->
+                                clearPrivilege( $group, '*', $priv ) ? $ok:0;
+                        }
+                    }
+                }
+            }
+        }
+        else
+        {
+            Error('Unknown privilege name: ' . $priv); $ok = 0;
+        }
+    }
+    return $ok;
+}
+
+
+
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/action_notify.in b/torrus/bin/action_notify.in
new file mode 100644 (file)
index 0000000..a01b548
--- /dev/null
@@ -0,0 +1,96 @@
+#!@PERL@
+#  Copyright (C) 2006  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: action_notify.in,v 1.1 2010-12-27 00:04:01 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# We need this for $Torrus::Global::templateDirs
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use Date::Format;
+
+use Torrus::Log;
+
+require '@notify_siteconfig_pl@';
+
+if( not $ENV{'TORRUS_TREE'} )
+{
+    print STDERR ("Torrus environment variables missing. This program ",
+                  "must be run from Torrus Monitor\n");
+    exit 1;
+}
+
+our $now = time();
+our $nowHour = time2str('%H', $now);
+our $nowWeekday = time2str('%w', $now);
+
+my $severity = $ENV{'TORRUS_SEVERITY'};
+my $ok = 1;
+
+foreach my $policy ( keys %Torrus::Notify::policies )
+{
+    if( &{$Torrus::Notify::policies{$policy}{'match'}} )
+    {
+        Debug('Notification policy matched: ' . $policy);
+
+        my @targets = ();
+        my $levels = $Torrus::Notify::policies{$policy}{'severity'};
+        
+        foreach my $level ( sort {$a <=>$b} keys %{$levels} )
+        {
+            if( $severity >= $level )
+            {
+                push( @targets, @{$levels->{$level}} );
+            }
+        }
+
+        if( isDebug() )
+        {
+            Debug('Selected notification targets: ' . join(' ', @targets));
+        }
+
+        foreach my $target ( @targets )
+        {
+            my($protocol, $arg) = split(':', $target);
+            if( defined( $Torrus::Notify::programs{$protocol} ) )
+            {
+                $ENV{'ARG1'} = $arg;
+                my $status = system( $Torrus::Notify::programs{$protocol} );
+                delete $ENV{'ARG1'};
+
+                if( $status != 0 )
+                {
+                    Error('The command "' .
+                          $Torrus::Notify::programs{$protocol} .
+                          '" returned error code ' . $status);
+                    $ok = 0;
+                }
+            }
+        }
+    }
+}
+   
+exit( $ok ? 0:1 );                          
+        
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/action_printemail.in b/torrus/bin/action_printemail.in
new file mode 100644 (file)
index 0000000..416147b
--- /dev/null
@@ -0,0 +1,83 @@
+#!@PERL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: action_printemail.in,v 1.1 2010-12-27 00:04:03 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# We need this for $Torrus::Global::templateDirs
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use Template;
+use Getopt::Long;
+
+require '@email_siteconfig_pl@';
+
+if( not $ENV{'TORRUS_TREE'} )
+{
+    print STDERR ("Torrus environment variables missing. This program ",
+                  "must be run from Torrus Monitor\n");
+    exit 1;
+}
+
+
+my $ok = GetOptions( 'url=s' => \$Torrus::Email::url,
+                     'template=s' => \$Torrus::Email::template );
+
+if( not $ok )
+{
+    print STDERR ("Error parsing options\n");
+    exit 1;
+}
+
+my $tt = new Template(INCLUDE_PATH => $Torrus::Global::templateDirs);
+
+my $vars =
+{
+    'tree'       => $ENV{'TORRUS_TREE'},
+    'token'      => $ENV{'TORRUS_TOKEN'},
+    'path'       => $ENV{'TORRUS_NODEPATH'},
+    'nickname'   => $ENV{'TORRUS_NICKNAME'},
+    'url'        => $Torrus::Email::url . '/' .
+        $ENV{'TORRUS_TREE'} . '?token='.$ENV{'TORRUS_TOKEN'},
+    'ncomment'   => $ENV{'TORRUS_NCOMMENT'},
+    'npcomment'  => $ENV{'TORRUS_NPCOMMENT'},
+    'event'      => $ENV{'TORRUS_EVENT'},
+    'monitor'    => $ENV{'TORRUS_MONITOR'},
+    'mcomment'   => $ENV{'TORRUS_MCOMMENT'},
+    'severity'   => $ENV{'TORRUS_SEVERITY'},
+    'timestamp'  => scalar(localtime($ENV{'TORRUS_TSTAMP'})),
+    'value'      => $ENV{'TORRUS_VALUE'},
+    'dispvalue'  => $ENV{'TORRUS_DISPLAY_VALUE'},
+    'env'        => sub  { return $ENV{$_[0]} }
+};
+
+my $result = $tt->process($Torrus::Email::template, $vars);
+
+if( not $result )
+{
+    print STDERR "Error while processing template: ".$tt->error()."\n";
+}
+
+exit( $result ? 0:1 );
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/action_snmptrap.in b/torrus/bin/action_snmptrap.in
new file mode 100644 (file)
index 0000000..c2e9c20
--- /dev/null
@@ -0,0 +1,183 @@
+#!@PERL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: action_snmptrap.in,v 1.1 2010-12-27 00:04:01 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# SNMP v2c trap
+# See Torrus-MIB.txt for reference
+
+use strict;
+use Net::SNMP qw(:ALL);
+use Getopt::Long;
+
+require '@snmptrap_siteconfig_pl@';
+
+if( not $ENV{'TORRUS_TOKEN'} )
+{
+    print STDERR ("Torrus environment variables missing. This program ",
+                  "must be run from Torrus Monitor\n");
+    exit 1;
+}
+
+my @hosts;
+my $severity;
+
+my $ok = GetOptions( 'host=s'     => \@hosts,
+                     'community=s' => \$Torrus::Snmptrap::community,
+                     'port=i'      => \$Torrus::Snmptrap::port,
+                     'severity=i'  => \$severity );
+
+if( not $ok )
+{
+    print STDERR ("Error parsing options\n");
+    exit 1;
+}
+
+if( scalar(@hosts) > 0 )
+{
+    @Torrus::Snmptrap::hosts = @hosts;
+}
+
+my $oid_prefix = '.1.3.6.1.4.1.14697.1.1.1';
+
+my %event_type = ( 'set'    => 1,
+                   'repeat' => 2,
+                   'clear'  => 3,
+                   'forget' => 4
+                   );
+
+my @varbindlist = ( $oid_prefix . '.1',
+                    INTEGER32, 1,
+
+                    $oid_prefix . '.2',
+                    OCTET_STRING, $ENV{'TORRUS_TOKEN'},
+
+                    $oid_prefix . '.3',
+                    OCTET_STRING, $ENV{'TORRUS_MONITOR'},
+
+                    $oid_prefix . '.4',
+                    INTEGER, $event_type{$ENV{'TORRUS_EVENT'}},
+
+                    $oid_prefix . '.5',
+                    OCTET_STRING, $ENV{'TORRUS_NODEPATH'},
+
+                    $oid_prefix . '.6',
+                    OCTET_STRING, snmp_dateandtime( $ENV{'TORRUS_TSTAMP'} ),
+
+                    $oid_prefix . '.7',
+                    OCTET_STRING, $ENV{'TORRUS_TREE'},
+                    
+                    $oid_prefix . '.9',
+                    OCTET_STRING, $ENV{'TORRUS_MCOMMENT'}
+                    );
+
+if( defined( $severity ) )
+{
+    push( @varbindlist,
+          $oid_prefix . '.8',
+          INTEGER32, $severity );
+}
+          
+
+foreach my $host ( @Torrus::Snmptrap::hosts )
+{
+    my( $session, $error ) =
+        Net::SNMP->session( -hostname  => $host,
+                            -community => $Torrus::Snmptrap::community,
+                            -port      => $Torrus::Snmptrap::port,
+                            -version   => 2
+                            );
+
+    if( not defined($session) )
+    {
+        printf STDERR ("Error opening SNMP trap session: %s.\n", $error);
+        exit 1;
+    }
+
+
+    my $result =
+        $session->snmpv2_trap( -varbindlist  => \@varbindlist );
+
+    if( not $result )
+    {
+        printf STDERR ("Error sending SNMP trap: %s.\n", $session->error());
+    }
+
+    $session->close();
+}
+
+# Converts UNIX time to DateAndTime from SNMPv2-TC
+# Currently timezone is not handled.
+
+# DateAndTime ::= TEXTUAL-CONVENTION
+#     DISPLAY-HINT "2d-1d-1d,1d:1d:1d.1d,1a1d:1d"
+#     STATUS       current
+#     DESCRIPTION
+#             "A date-time specification.
+#
+#             field  octets  contents                  range
+#             -----  ------  --------                  -----
+#               1      1-2   year*                     0..65536
+#               2       3    month                     1..12
+#               3       4    day                       1..31
+#               4       5    hour                      0..23
+#               5       6    minutes                   0..59
+#               6       7    seconds                   0..60
+#                            (use 60 for leap-second)
+#               7       8    deci-seconds              0..9
+#               8       9    direction from UTC        '+' / '-'
+#               9      10    hours from UTC*           0..13
+#              10      11    minutes from UTC          0..59
+#
+#             * Notes:
+#             - the value of year is in network-byte order
+#             - daylight saving time in New Zealand is +13
+#
+#             For example, Tuesday May 26, 1992 at 1:30:15 PM EDT would be
+#             displayed as:
+#
+#                              1992-5-26,13:30:15.0,-4:0
+#
+#             Note that if only local time is known, then timezone
+#             information (fields 8-10) is not present."
+#     SYNTAX       OCTET STRING (SIZE (8 | 11))
+
+sub snmp_dateandtime
+{
+    my $thetime = shift;
+
+    my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
+        localtime( $thetime );
+
+    my $result = pack('nC6',
+                      $year + 1900,
+                      $mon + 1,
+                      $mday,
+                      $hour,
+                      $min,
+                      $sec,
+                      0);
+    return $result;
+}
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/action_snmpv1trap.in b/torrus/bin/action_snmpv1trap.in
new file mode 100644 (file)
index 0000000..02ec14a
--- /dev/null
@@ -0,0 +1,134 @@
+#!@PERL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: action_snmpv1trap.in,v 1.1 2010-12-27 00:04:02 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Obsoleted and not used SNMP v1 trap script.
+# Version 2c is preferred one.
+
+
+use strict;
+use Net::SNMP qw(:ALL);
+use Getopt::Long;
+
+require '@snmptrap_siteconfig_pl@';
+
+# SNMP Enterprise. Needed for SNMP v1 trap.
+# See http://www.iana.org/assignments/enterprise-numbers for reference
+$Torrus::Snmptrap::enterprise = '1.3.6.1.4.1.14697.1.1.1';
+
+
+if( not $ENV{'TORRUS_TOKEN'} )
+{
+    print STDERR ("Torrus environment variables missing. This program ",
+                  "must be run from Torrus Monitor\n");
+    exit 1;
+}
+
+my @hosts;
+my $severity;
+
+my $ok = GetOptions( 'host=s'     => \@hosts,
+                     'community=s' => \$Torrus::Snmptrap::community,
+                     'port=i'      => \$Torrus::Snmptrap::port,
+                     'enterprise'  => \$Torrus::Snmptrap::enterprise,
+                     'severity=i'  => \$severity );
+
+if( not $ok )
+{
+    print STDERR ("Error parsing options\n");
+    exit 1;
+}
+
+if( scalar(@hosts) > 0 )
+{
+    @Torrus::Snmptrap::hosts = @hosts;
+}
+
+my %specifictrap = ( 'set'    => 1,
+                     'repeat' => 2,
+                     'clear'  => 3,
+                     'forget' => 4
+                     );
+
+my @varbindlist = ( $Torrus::Snmptrap::enterprise . '.2',
+                    OCTET_STRING, $ENV{'TORRUS_TOKEN'},
+
+                    $Torrus::Snmptrap::enterprise . '.5',
+                    OCTET_STRING, $ENV{'TORRUS_NODEPATH'},
+
+                    $Torrus::Snmptrap::enterprise . '.3',
+                    OCTET_STRING, $ENV{'TORRUS_MONITOR'},
+
+                    $Torrus::Snmptrap::enterprise . '.4',
+                    OCTET_STRING, $ENV{'TORRUS_EVENT'},
+
+                    $Torrus::Snmptrap::enterprise . '.6',
+                    OCTET_STRING, scalar(localtime($ENV{'TORRUS_TSTAMP'})),
+
+                    $Torrus::Snmptrap::enterprise . '.7',
+                    OCTET_STRING, $ENV{'TORRUS_TREE'},
+                    
+                    $Torrus::Snmptrap::enterprise . '.9',
+                    OCTET_STRING, $ENV{'TORRUS_MCOMMENT'}
+                    );
+
+if( defined( $severity ) )
+{
+    push( @varbindlist,
+          $Torrus::Snmptrap::enterprise . '.8',
+          INTEGER32, $severity );
+}
+
+foreach my $host ( @Torrus::Snmptrap::hosts )
+{
+    my( $session, $error ) =
+        Net::SNMP->session( -hostname  => $host,
+                            -community => $Torrus::Snmptrap::community,
+                            -port      => $Torrus::Snmptrap::port
+                            );
+
+    if( not defined($session) )
+    {
+        printf STDERR ("Error opening SNMP trap session: %s.\n", $error);
+        exit 1;
+    }
+
+
+    my $result =
+        $session->trap( -enterprise   => $Torrus::Snmptrap::enterprise,
+                        -generictrap  => ENTERPRISE_SPECIFIC,
+                        -specifictrap => $specifictrap{$ENV{'TORRUS_EVENT'}},
+                        -timestamp    => $ENV{'TORRUS_UPTIME'} * 100,
+                        -varbindlist  => \@varbindlist
+                        );
+
+    if( not $result )
+    {
+        printf STDERR ("Error sending SNMP trap: %s.\n", $session->error());
+    }
+
+    $session->close();
+}
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/bdbinfo.in b/torrus/bin/bdbinfo.in
new file mode 100644 (file)
index 0000000..c5628ac
--- /dev/null
@@ -0,0 +1,38 @@
+#!@PERL@ -w
+#  Copyright (C) 2002-2008  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: bdbinfo.in,v 1.1 2010-12-27 00:04:03 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use BerkeleyDB;
+
+
+printf("MAJOR: %d\n", DB_VERSION_MAJOR);
+printf("MINOR: %d\n", DB_VERSION_MINOR);
+printf("PATCH: %d\n", DB_VERSION_PATCH);
+printf("STRING: %s\n", DB_VERSION_STRING);
+
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/buildsearchdb.in b/torrus/bin/buildsearchdb.in
new file mode 100644 (file)
index 0000000..19c1ea8
--- /dev/null
@@ -0,0 +1,200 @@
+#!@PERL@ -w
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: buildsearchdb.in,v 1.1 2010-12-27 00:04:01 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use Getopt::Long;
+
+use Torrus::ConfigTree;
+use Torrus::Search;
+use Torrus::SiteConfig;
+use Torrus::Log;
+
+exit(1) if not Torrus::SiteConfig::verify();
+
+my @trees;
+my $build_global;
+my $all_trees;
+
+my $verbose;
+my $help_needed;
+
+my $ok = GetOptions ('tree=s'   => \@trees,
+                     'all'      => \$all_trees,
+                     'global'   => \$build_global,
+                     'verbose'  => \$verbose,
+                     'help'     => \$help_needed);
+
+if( not $ok or not (scalar(@trees) or $all_trees or $build_global) or
+    $help_needed or scalar(@ARGV) > 0 )
+{
+    print STDERR "Usage: $0 --tree=NAME [options...]\n",
+    "Options:\n",
+    "  --tree=NAME     rebuild search DB for a tree\n",
+    "  --all           rebuild search DB for all trees\n",
+    "  --global        rebuild global search DB\n",
+    "  --verbose       print extra information\n",
+    "  --help          this help message\n";
+    exit 1;
+}
+
+if( $build_global )
+{
+    $all_trees = 1;
+}
+
+if( $all_trees )
+{
+    @trees = Torrus::SiteConfig::listTreeNames();
+}
+
+if( $verbose )
+{
+    Torrus::Log::setLevel('verbose');
+}
+
+&Torrus::DB::setSafeSignalHandlers();
+
+Verbose(sprintf('Torrus version %s', '@VERSION@'));
+
+my $search = new Torrus::Search( -WriteAccess => 1 );
+
+if( $build_global )
+{
+    $search->openGlobal();
+}
+
+foreach my $tree ( @trees )
+{
+    if( not Torrus::SiteConfig::treeExists( $tree ) )
+    {
+        Error("Tree named \"" . $tree . "\" does not exist");
+        exit(1);
+    }
+
+    &Torrus::DB::checkInterrupted();
+
+    my $config_tree = new Torrus::ConfigTree( -TreeName => $tree );
+    if( not defined($config_tree) )
+    {
+        print("Configuration is not ready\n");
+        exit(1);
+    }
+
+    Verbose("Processing the tree: $tree");
+
+    $search->openTree( $tree );
+    
+    walkSubtree( $config_tree, $search, $config_tree->token('/') );
+    
+    $search->closeTree( $tree );
+    $config_tree = undef;
+}
+
+exit(0);
+
+
+sub walkSubtree
+{
+    my $config_tree = shift;
+    my $search = shift;
+    my $ptoken = shift;
+
+    my $tree = $config_tree->treeName();
+    
+    foreach my $token ( $config_tree->getChildren( $ptoken ) )
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        if( $config_tree->isSubtree( $token ) )
+        {
+            walkSubtree( $config_tree, $search, $token );
+        }
+
+        my $isSearchable =
+            $config_tree->getNodeParam( $token, 'searchable', 1 );
+        if( defined( $isSearchable ) and $isSearchable eq 'yes' )
+        {
+            my $path = $config_tree->path( $token );
+            
+            my $nodeName = $config_tree->nodeName( $path );
+            splitAndStore( $tree, $nodeName, $path );
+            
+            my $params = $config_tree->getParams( $token, 1 );
+            while( my( $param, $value ) = each %{$params} )
+            {
+                if( $config_tree->getParamProperty( $param, 'search' ) )
+                {
+                    splitAndStore( $tree, $value, $path, $param );
+                }
+            }
+        }
+    }
+}
+
+
+sub splitAndStore
+{
+    my $tree = shift;
+    my $value = shift;
+    my $path = shift;
+    my $param = shift;
+
+    if( length( $value ) > 0 )
+    {
+        # split the value into words
+        my @words = split( /\W+/ms, $value );
+        if( scalar( @words ) > 0 )
+        {
+            foreach my $word ( @words )
+            {
+                if( length( $word ) > 1 )
+                {
+                    $search->storeKeyword( $tree, $word, $path, $param );
+                            
+                    # Split the word by underscores and minus
+                    my @subwords = split( /_+/, $word );
+                    if( scalar( @subwords ) > 1 )
+                    {
+                        foreach my $subword ( @subwords )
+                        {
+                            if( length( $subword ) > 1 )
+                            {
+                                $search->storeKeyword( $tree,
+                                                       $subword,
+                                                       $path,
+                                                       $param );
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
+        
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/cleanup.in b/torrus/bin/cleanup.in
new file mode 100644 (file)
index 0000000..bc4f69f
--- /dev/null
@@ -0,0 +1,32 @@
+#!@SHELL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: cleanup.in,v 1.1 2010-12-27 00:04:03 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+# How soon the sessions expire
+EXPIRE=60
+
+@FIND@ @sesstordir@ -type f -mtime +$EXPIRE -exec @RM@ '{}' ';'
+@FIND@ @seslockdir@ -type f -mtime +$EXPIRE -exec @RM@ '{}' ';'
+
+# Local Variables:
+# mode: shell-script
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/clearcache.in b/torrus/bin/clearcache.in
new file mode 100644 (file)
index 0000000..a3c0365
--- /dev/null
@@ -0,0 +1,40 @@
+#!@PERL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: clearcache.in,v 1.1 2010-12-27 00:04:01 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use Torrus::Log;
+
+use Torrus::Renderer;
+
+&Torrus::DB::setSafeSignalHandlers();
+
+my $renderer = new Torrus::Renderer;
+$renderer->clearcache();
+undef $renderer;
+
+Info('Renderer cache cleared');
+exit 0;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/collector.in b/torrus/bin/collector.in
new file mode 100644 (file)
index 0000000..e682fad
--- /dev/null
@@ -0,0 +1,205 @@
+#!@PERL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: collector.in,v 1.1 2010-12-27 00:04:03 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use Proc::Daemon;
+use Getopt::Long;
+
+use Torrus::Log;
+use Torrus::ConfigTree;
+use Torrus::Collector;
+use Torrus::SiteConfig;
+
+$| = 1;
+
+exit(1) if not Torrus::SiteConfig::verify();
+
+my $tree;
+my $instance;
+my $nodaemon;
+my $runonce;
+my $runalways;
+my $debug;
+my $verbose;
+my $help_needed;
+
+# Derive the process name from the command line
+my $process_name = $0;
+$process_name =~ s/^.*\/([^\/]+)$/$1/;
+$process_name .= ' ' . join(' ', @ARGV);
+                            
+my $ok = GetOptions ('tree=s'     => \$tree,
+                     'instance=i' => \$instance,
+                     'nodaemon'   => \$nodaemon,
+                     'runonce'    => \$runonce,
+                     'runalways'  => \$runalways,
+                     'debug'      => \$debug,
+                     'verbose'    => \$verbose,
+                     'help'       => \$help_needed);
+
+if( not $ok or not $tree or $help_needed or scalar(@ARGV) > 0 )
+{
+    print STDERR "Usage: $0 --tree=NAME [options...]\n",
+    "Options:\n",
+    "  --tree=NAME     tree name\n",
+    "  --instance=N    instance number for multiple collectors per tree\n",
+    "  --nodaemon      do not fork daemon and log to STDERR\n",
+    "  --runonce       run one time and exit. Implies --nodaemon\n",
+    "  --runalways     continue running if no collectors defined\n",
+    "  --debug         set the log level to debug\n",
+    "  --verbose       set the log level to info\n",
+    "  --help          this help message\n";
+    exit 1;
+}
+
+if( not Torrus::SiteConfig::mayRunCollector( $tree ) )
+{
+    Error('Tree ' . $tree . ' is not configured to run collector');
+    exit 1;
+}
+
+my $nInstances = Torrus::SiteConfig::collectorInstances( $tree );
+
+if( $nInstances > 1 and not defined( $instance ) )
+{
+    Error('--instance option is missing');
+    exit 1;
+}
+
+if( not defined( $instance ) )
+{
+    $instance = 0;
+}
+
+if( $instance >= $nInstances )
+{
+    Error('Invalid instance number. Allowed from 0 to ' . ($nInstances-1));
+    exit 1;
+}
+
+if( $debug )
+{
+    Torrus::Log::setLevel('debug');
+}
+elsif( $verbose )
+{
+    Torrus::Log::setLevel('verbose');
+}
+
+my $logfile =
+    $Torrus::Global::logDir . '/collector.' . $tree . '_' . $instance . '.log';
+my $pidfile;
+
+my $rotateLogs = sub
+{
+    Info('Caught SIGHUP. Reopening log file');
+    close( STDERR );
+    open( STDERR, ">>$logfile" );
+    $| = 1;
+};
+
+if( not $nodaemon and not $runonce )
+{
+    my $pidfilename = 
+        $Torrus::Global::pidDir . '/collector.' .
+        $tree . '_' . $instance . '.pid';
+    
+    if( -r $pidfilename )
+    {
+        Error("Another collector daemon is running, pid=",
+              `cat $pidfilename`);
+        exit 1;
+    }
+
+    &Proc::Daemon::Init();
+    umask 0017; # Proc::Daemon::Init sets the mask to all-writable
+    
+    $SIG{'HUP'} = $rotateLogs;
+
+    # At this point, we cannot tell anyone if "open" fails
+    open(STDERR, ">>$logfile");
+
+    $pidfile = $pidfilename;
+    
+    if( open( PID, ">$pidfile" ) )
+    {
+        printf PID ( "%d", $$ );
+        close PID;
+    }
+    else
+    {
+        Error("Cannot open $pidfile for writing: $!");
+    }
+}
+
+
+Torrus::Collector::initThreads();
+
+&Torrus::DB::setSafeSignalHandlers();
+
+
+Info(sprintf("Torrus version %s", '@VERSION@'));
+Info(sprintf("%s started for tree %s, instance #%d", $0, $tree, $instance));
+Debug(sprintf("Process ID %d", $$));
+
+my %options =
+    (
+     '-ProcessName' => $process_name,
+     '-Tree'        => $tree,
+     '-Instance'    => $instance
+     );
+
+if( $runonce )
+{
+    $options{'-RunOnce'} = 1;
+}
+if( $runalways )
+{
+    $options{'-RunAlways'} = 1;
+}
+
+
+my $scheduler = new Torrus::CollectorScheduler( %options );
+$scheduler->run();
+
+if( not $options{'-RunOnce'} )
+{
+    Error("Collector process exited: nothing to collect");
+    unlink $pidfile;
+}
+
+exit;
+
+
+END
+{
+    if( defined($pidfile) and -r $pidfile )
+    {
+        unlink $pidfile;
+    }
+}
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/compilexml.in b/torrus/bin/compilexml.in
new file mode 100644 (file)
index 0000000..56bbada
--- /dev/null
@@ -0,0 +1,207 @@
+#!@PERL@ -w
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: compilexml.in,v 1.1 2010-12-27 00:04:00 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use Getopt::Long;
+use strict;
+
+use Torrus::ConfigTree::XMLCompiler;
+use Torrus::SiteConfig;
+use Torrus::Log;
+
+exit(1) if not Torrus::SiteConfig::verify();
+
+our @trees;
+our $all_trees;
+our $no_ds;
+our $no_validation;
+our $force;
+
+our $debug;
+our $verbose;
+our $help_needed;
+
+my $ok = GetOptions ('tree=s'   => \@trees,
+                     'all'      => \$all_trees,
+                     'nods'     => \$no_ds,
+                     'noval'    => \$no_validation,
+                     'force'    => \$force,
+                     'debug'    => \$debug,
+                     'verbose'  => \$verbose,
+                     'help'     => \$help_needed);
+
+if( not $ok or not (scalar(@trees) or $all_trees) or
+    $help_needed or scalar(@ARGV) > 0 )
+{
+    print STDERR "Usage: $0 --tree=NAME [options...]\n",
+    "Options:\n",
+    "  --tree=NAME     tree name(s) to compile\n",
+    "  --all           compile all trees\n",
+    "  --nods          compile non-datasource configuration only\n",
+    "  --noval         disable parameter validation\n",
+    "  --force         force the compiler even if anoother " .
+        "compiler process is probably running\n",
+    "  --debug         set the log level to debug\n",
+    "  --verbose       set the log level to info\n",
+    "  --help          this help message\n";
+    exit 1;
+}
+
+if( $all_trees )
+{
+    @trees = Torrus::SiteConfig::listTreeNames();
+}
+
+if( $debug )
+{
+    Torrus::Log::setLevel('debug');
+}
+elsif( $verbose )
+{
+    Torrus::Log::setLevel('verbose');
+}
+
+
+&Torrus::DB::setSafeSignalHandlers();
+
+Verbose(sprintf('Torrus version %s', '@VERSION@'));
+
+our $global_ok = 1;
+
+foreach my $tree ( @trees )
+{
+    if( not Torrus::SiteConfig::treeExists( $tree ) )
+    {
+        Error("Tree named \"" . $tree . "\" does not exist");
+        exit(1);
+    }
+
+    &Torrus::DB::checkInterrupted();
+    
+    Verbose("Compiling tree: $tree");
+
+    my $ok = 1;
+    my $compiler =
+        new Torrus::ConfigTree::XMLCompiler( -TreeName => $tree,
+                                             -NoDSRebuild => $no_ds,
+                                             -ForceWriter => $force );
+    if( not defined( $compiler ) )
+    {
+        Error('Cannot initialize compiler for tree ' . $tree . '. Exiting');
+        Error('If you are sure there are no other compiler processes ' .
+              'running, use the --force option');
+        $global_ok = 0;
+        last;
+    }     
+    
+    my @xmlFiles = @Torrus::Global::xmlAlwaysIncludeFirst;
+    push( @xmlFiles, Torrus::SiteConfig::listXmlFiles( $tree ) );
+    push( @xmlFiles, @Torrus::Global::xmlAlwaysIncludeLast );
+
+    foreach my $xmlfile ( @xmlFiles )
+    {
+        if( not $compiler->compile( $xmlfile ) )
+        {
+            Error($xmlfile . ' compiled with errors'); $ok = 0;
+        }
+    }
+
+    if( not $ok )
+    {
+        Error("Errors found during XML compilation in the tree named \"" .
+              $tree . "\"");
+        $global_ok = 0;
+        last;
+    }
+
+    Verbose('Data post-processing...');
+    if( not $compiler->postProcess() )
+    {
+        Error('Errors found during post-processing');
+        $ok = 0;
+    }
+
+    if( $no_validation )
+    {
+        Verbose('Skipping data validation...');
+    }
+    else
+    {
+        Verbose('Data validation...');
+        if( not $compiler->validate() )
+        {
+            Error('Errors found during validation process');
+            $ok = 0;
+        }
+    }
+
+    &Torrus::DB::checkInterrupted();
+    
+    # Preserve the dynamic tokenset members
+    if( not $compiler->{'first_time_created'} )
+    {
+        my $oldConfig = new Torrus::ConfigTree( -TreeName => $tree );
+        if( defined( $oldConfig ) )
+        {
+            foreach my $ts ( $oldConfig->getTsets() )
+            {
+                if( $compiler->tsetExists( $ts ) )
+                {
+                    foreach my $member ( $oldConfig->tsetMembers( $ts ) )
+                    {
+                        my $origin = $oldConfig->tsetMembers( $ts, $member );
+                        if( defined( $origin ) and $origin ne 'static' )
+                        {
+                            my $path = $oldConfig->path($member);
+                            if( $compiler->nodeExists( $path ) )
+                            {
+                                my $token = $compiler->token( $path );
+                                $compiler->tsetAddMember
+                                    ( $ts, $token, $origin );
+                                Verbose('Preserved dynamic tokenset member: ' .
+                                        $path . ' in ' . $ts);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        undef $oldConfig;
+    }
+                    
+    &Torrus::DB::checkInterrupted();
+                             
+    $compiler->finalize( $ok );
+    undef $compiler;
+    &Torrus::DB::cleanupEnvironment();
+
+    $global_ok = $ok ? $global_ok:0;
+}
+
+exit($global_ok ? 0:1);
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/configinfo.in b/torrus/bin/configinfo.in
new file mode 100644 (file)
index 0000000..1b985f8
--- /dev/null
@@ -0,0 +1,166 @@
+#!@PERL@ -w
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: configinfo.in,v 1.1 2010-12-27 00:04:03 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use BerkeleyDB;
+
+use Torrus::ConfigTree;
+use Torrus::TimeStamp;
+use Torrus::SiteConfig;
+use Torrus::Log;
+
+exit(1) if not Torrus::SiteConfig::verify();
+
+&Torrus::DB::setSafeSignalHandlers();
+
+Torrus::TimeStamp::init();
+
+my @tree_names = Torrus::SiteConfig::listTreeNames();
+
+
+printf("Torrus version %s\n", '@VERSION@');
+printf("%s\n", DB_VERSION_STRING);
+printf("BerkeleyDB.pm version %s\n", $BerkeleyDB::VERSION);
+printf("\n");
+
+printf("Datasource trees: %d\n", scalar( @tree_names ) );
+printf("Tree names: %s\n", join(', ', @tree_names) );
+printf("\n");
+
+foreach my $tree ( @tree_names )
+{
+    &Torrus::DB::checkInterrupted();
+    
+    printf("Tree: %s\n", $tree );
+
+    my $config_tree = new Torrus::ConfigTree( -TreeName => $tree );
+    if( not defined($config_tree) )
+    {
+        print("Configuration is not ready\n");
+    }
+    else
+    {
+        my $stats = {};
+        foreach my $name ( 'leaves', 'collectorLeaves', 'monitorLeaves',
+                           'holtwintersLeaves', 'subtrees',
+                           'maxSubtreePath', 'maxSubtreeSize', 'views',
+                           'monitors', 'actions', 'compiled' )
+        {
+            $stats->{$name} = 0;
+        }
+
+        collectStats( $config_tree, $stats );
+        collectOtherStats( $config_tree, $stats );
+
+        printf("Leaves: %d\n",                $stats->{'leaves'} );
+        printf("Collector leaves: %d\n",      $stats->{'collectorLeaves'} );
+        printf("Monitor leaves: %d\n",        $stats->{'monitorLeaves'} );
+        printf("Holt-Winters leaves: %d\n",   $stats->{'holtwintersLeaves'} );
+        printf("Subtrees: %d\n",              $stats->{'subtrees'} );
+        printf("Largest subtree: %s\n",       $stats->{'maxSubtreePath'} );
+        printf("Largest subtree size: %d\n",  $stats->{'maxSubtreeSize'} );
+        printf("Views: %d\n",                 $stats->{'views'} );
+        printf("Monitors: %d\n",              $stats->{'monitors'} );
+        printf("Actions: %d\n",               $stats->{'actions'} );
+        printf("Last compiled: %s\n",
+               scalar(localtime($stats->{'compiled'})));
+        printf("\n");
+    }
+}
+
+
+sub collectStats
+{
+    my $config_tree = shift;
+    my $stats = shift;
+    my $token = shift;
+
+    &Torrus::DB::checkInterrupted();
+
+    if( not defined( $token ) )
+    {
+        $token = $config_tree->token('/');
+    }
+
+    my @children = $config_tree->getChildren( $token );
+
+    my $nChildren = scalar( @children );
+    if( not defined( $stats->{'maxSubtreeSize'} ) or
+        $stats->{'maxSubtreeSize'} < $nChildren )
+    {
+        $stats->{'maxSubtreeSize'} = $nChildren;
+        $stats->{'maxSubtreePath'} = $config_tree->path( $token );
+    }
+
+    foreach my $ctoken ( @children )
+    {
+        if( $config_tree->isSubtree( $ctoken ) )
+        {
+            $stats->{'subtrees'}++;
+            collectStats( $config_tree, $stats, $ctoken );
+        }
+        elsif( $config_tree->isLeaf( $ctoken ) )
+        {
+            $stats->{'leaves'}++;
+            if( $config_tree->getNodeParam( $ctoken, 'ds-type' )
+                eq 'collector' )
+            {
+                $stats->{'collectorLeaves'}++;
+            }
+            if( defined( $config_tree->getNodeParam( $ctoken, 'monitor' ) ) )
+            {
+                $stats->{'monitorLeaves'}++;
+            }
+            my $val = $config_tree->getNodeParam( $ctoken, 'rrd-hwpredict' );
+            if( defined( $val ) and $val eq 'enabled' )
+            {
+                $stats->{'holtwintersLeaves'}++;
+            }            
+        }
+    }
+}
+
+
+sub collectOtherStats
+{
+    my $config_tree = shift;
+    my $stats = shift;
+
+    my $n = scalar( $config_tree->getViewNames() );
+    $stats->{'views'} = $n if defined( $n );
+
+    $n = scalar( $config_tree->getMonitorNames() );
+    $stats->{'monitors'} = $n if defined( $n );
+
+    $n = scalar( $config_tree->getActionNames() );
+    $stats->{'actions'} = $n if defined( $n );
+
+    $n = $config_tree->getTimestamp();
+    $stats->{'compiled'} = $n if defined( $n );
+}
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/configsnapshot.in b/torrus/bin/configsnapshot.in
new file mode 100644 (file)
index 0000000..dc79e5b
--- /dev/null
@@ -0,0 +1,332 @@
+#!@PERL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: configsnapshot.in,v 1.1 2010-12-27 00:04:01 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use Getopt::Long;
+
+use Torrus::Log;
+use Torrus::ConfigTree;
+use Torrus::SiteConfig;
+use Torrus::ConfigBuilder;
+
+exit(1) if not Torrus::SiteConfig::verify();
+
+my $tree;
+my $help_needed;
+my $verbose = 0;
+
+my $outfile = 'snapshot.xml';
+
+my $filter_param;
+my $filter_value;
+my $filter_op = '=';
+
+my $creator = "Torrus version @VERSION@\n" .
+    "This file was generated by command:\n" .
+    $0 . " \\\n";
+foreach my $arg ( @ARGV )
+{
+    if( $arg =~ /^--/ )
+    {
+        $creator .= ' ' . $arg . ' ';
+    }
+    else
+    {
+        $creator .= "\'" . $arg . "\'\\\n";
+    }
+}
+$creator .= "\nOn " . scalar(localtime(time));
+
+my $ok = GetOptions('tree=s'   => \$tree,
+                    'out=s'    => \$outfile,
+                    'param=s'  => \$filter_param,
+                    'value=s'  => \$filter_value,
+                    'op=s'     => \$filter_op,
+                    'verbose'  => \$verbose,
+                    'help'     => \$help_needed);
+
+if( not $ok or not $tree or $help_needed or
+    ( defined($filter_param) + defined($filter_value) == 1 ) or
+    ( $filter_op ne '=' and $filter_op ne 'eq' and $filter_op ne 're' ) or
+    scalar(@ARGV) > 0 )
+{
+    print STDERR "Usage: $0 --tree=NAME [options...]\n",
+    "Options:\n",
+    "  --tree=NAME     tree name\n",
+    "  --out=filename  output file [".$outfile."]\n",
+    "  --param=PARAM --value=VALUE \n",
+    "                  filter the output by leaves with specified value\n",
+    "  --op=OP         filter operation [=|eq|re], default: [=]\n",
+    "  --verbose       print extra information\n",
+    "  --help          this help message\n";
+    exit 1;
+}
+
+if( $verbose )
+{
+    Torrus::Log::setLevel('verbose');
+}
+
+if( not Torrus::SiteConfig::treeExists( $tree ) )
+{
+    Error('Tree ' . $tree . ' does not exist');
+    exit 1;
+}
+
+&Torrus::DB::setSafeSignalHandlers();
+
+my $config_tree = new Torrus::ConfigTree( -TreeName => $tree, -Wait => 1 );
+if( not defined( $config_tree ) )
+{
+    exit 1;
+}
+
+
+my $filter_match = sub {return $_[0] == $filter_value};
+
+if(defined($filter_param))
+{
+    if( $filter_op eq 'eq' )
+    {
+        $filter_match = sub {return $_[0] eq $filter_value};
+    }
+    elsif( $filter_op eq 're' )
+    {
+        $filter_match = sub {return $_[0] =~ $filter_value};
+    }
+}
+
+
+        
+my $cb = new Torrus::ConfigBuilder;
+
+$cb->addCreatorInfo( $creator );
+
+# We don't collect views, since they are in defaults.xml which is always
+# included
+
+collect_monitors( $config_tree, $cb );
+collect_tokensets( $config_tree, $cb );
+collect_definitions( $config_tree, $cb );
+collect_datasources( $config_tree, $cb );
+
+my $ok = $cb->toFile( $outfile );
+if( $ok )
+{
+    Verbose('Wrote ' . $outfile);
+}
+else
+{
+    Error('Cannot write ' . $outfile . ': ' . $!);
+}
+
+exit($ok ? 0:1);
+
+sub collect_monitors
+{
+    my $config_tree = shift;
+    my $cb = shift;
+
+    my $monitorsNode = $cb->startMonitors();
+
+    foreach my $action ( $config_tree->getActionNames() )
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        my $params = $config_tree->getParams( $action );
+        $cb->addMonitorAction( $monitorsNode, $action, $params );
+    }
+
+    foreach my $monitor ( $config_tree->getMonitorNames() )
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        my $params = $config_tree->getParams( $monitor );
+        $cb->addMonitor( $monitorsNode, $monitor, $params );
+    }
+}
+
+sub collect_tokensets
+{
+    my $config_tree = shift;
+    my $cb = shift;
+
+    my $tsetsNode = $cb->startTokensets();
+
+    foreach my $tset ( $config_tree->getTsets() )
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        my $params = $config_tree->getParams( $tset );
+        my $name = $tset;
+        $name =~ s/^S//;
+        $cb->addTokenset( $tsetsNode, $name, $params );
+    }
+}
+
+
+sub collect_definitions
+{
+    my $config_tree = shift;
+    my $cb = shift;
+
+    my $definitionsNode = $cb->startDefinitions();
+
+    foreach my $defName ( sort $config_tree->getDefinitionNames() )
+    {
+        &Torrus::DB::checkInterrupted();
+
+        my $value = $config_tree->getDefinition( $defName );
+        $cb->addDefinition( $definitionsNode, $defName, $value );
+    }
+
+    my $propsNode = $cb->startParamProps();
+    my $props = $config_tree->getParamProperties();
+
+    &Torrus::DB::checkInterrupted();
+
+    foreach my $prop ( sort keys %{$props} )
+    {
+        foreach my $param ( sort keys %{$props->{$prop}} )
+        {
+            $cb->addParamProp( $propsNode, $param, $prop,
+                               $props->{$prop}{$param} );
+        }
+    }
+}
+
+
+my %filterTokens;
+
+
+sub collect_datasources
+{
+    my $config_tree = shift;
+    my $cb = shift;
+    
+    my $topNode = $cb->getTopSubtree();
+    my $topToken = $config_tree->token('/');
+    
+    my $params = prepare_params( $config_tree, $topToken );
+    $cb->addParams( $topNode, $params );
+
+    if( defined($filter_param) )
+    {
+        $filterTokens{$topToken} = apply_filter( $config_tree, $topToken );
+    }
+    
+    collect_subtrees( $config_tree, $cb, $topToken, $topNode );
+}
+        
+
+
+sub apply_filter
+{
+    my $config_tree = shift;
+    my $token = shift;
+
+    $filterTokens{$token} = 0;
+    
+    foreach my $ctoken ( $config_tree->getChildren( $token ) )
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        if( $config_tree->isSubtree( $ctoken ) )
+        {
+            $filterTokens{$token} += apply_filter( $config_tree, $ctoken );
+        }
+        elsif( $config_tree->isLeaf( $ctoken ) )
+        {
+            my $val = $config_tree->getNodeParam( $ctoken, $filter_param );
+            if( defined($val) and &{$filter_match}($val) )
+            {
+                $filterTokens{$ctoken} = 1;
+                $filterTokens{$token}++;
+            }                
+        }
+    }
+
+    return $filterTokens{$token};
+}
+        
+
+
+sub collect_subtrees
+{
+    my $config_tree = shift;
+    my $cb = shift;
+    my $token = shift;
+    my $parentNode = shift;
+    
+    foreach my $ctoken ( $config_tree->getChildren( $token ) )
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        if( not defined($filter_param) or $filterTokens{$ctoken} )
+        {
+            my $childName =
+                $config_tree->nodeName( $config_tree->path($ctoken) );
+            my $params = prepare_params( $config_tree, $ctoken );
+        
+            if( $config_tree->isSubtree( $ctoken ) )
+            {
+                my $subtreeNode =
+                    $cb->addSubtree( $parentNode, $childName, $params );
+                collect_subtrees( $config_tree, $cb, $ctoken, $subtreeNode );
+            }
+            elsif( $config_tree->isLeaf( $ctoken ) )
+            {
+                $cb->addLeaf( $parentNode, $childName, $params );
+            }
+            
+            foreach my $aliasToken ( $config_tree->getAliases( $ctoken ) )
+            {
+                $cb->addAlias( $parentNode,
+                               $config_tree->path( $aliasToken ) );
+            }
+        }
+    }
+}
+
+
+sub prepare_params
+{
+    my $config_tree = shift;
+    my $token = shift;
+    
+    my $params = $config_tree->getParams( $token, 1 );
+
+    # Remove linebreaks
+    while( my( $param, $value ) = each %{$params} )
+    {
+        $value =~ s/\s+/ /gm;
+        $params->{$param} = $value;
+    }
+
+    return $params;
+}
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/devdiscover.in b/torrus/bin/devdiscover.in
new file mode 100644 (file)
index 0000000..f113723
--- /dev/null
@@ -0,0 +1,619 @@
+#!@PERL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: devdiscover.in,v 1.1 2010-12-27 00:04:02 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Collect the router information and create the XML file
+
+BEGIN { require '@devdiscover_config_pl@'; }
+
+use strict;
+use Getopt::Long;
+use XML::LibXML;
+
+use Torrus::Log;
+use Torrus::DevDiscover;
+use Torrus::ConfigBuilder;
+
+$| = 1;
+
+my @infiles;
+my $makedirs;
+my $limitre;
+my $forcebundle;
+my $fallback;
+my $workerThreads = 0;
+
+# Hidden parameter for debugging
+my $snmpdebug = 0;
+my $debug = 0;
+my $verbose = 0;
+
+my %formatsSupported = ( '1.0' => 1 );
+
+
+my $creator = "Torrus version @VERSION@\n" .
+    "This file was generated by command:\n" .
+    $0 . " \\\n";
+foreach my $arg ( @ARGV )
+{
+    if( $arg =~ /^--/ )
+    {
+        $creator .= ' ' . $arg . ' ';
+    }
+    else
+    {
+        $creator .= "\'" . $arg . "\'\\\n";
+    }
+}
+$creator .= "\n On " . scalar(localtime(time));
+
+my $ok = GetOptions(
+                    'in=s'        => \@infiles,
+                    'mkdir'       => \$makedirs,
+                    'limit=s'     => \$limitre,
+                    'forcebundle' => \$forcebundle,
+                    'fallback=i'  => \$fallback,
+                    'threads=i'   => \$workerThreads,
+                    'snmpdebug'   => \$snmpdebug,
+                    'verbose'     => \$verbose,
+                    'debug'       => \$debug
+                    );
+if( $ok and scalar( @ARGV ) > 0 )
+{
+    push( @infiles, @ARGV );
+}
+
+if( not $ok or scalar(@infiles) == 0 or
+    ($workerThreads > 1 and not $Torrus::Global::threadsEnabled ) )
+{
+    print STDERR "Usage: $0 --in=filename.ddx options... [ddx files]\n",
+    "Options:\n",
+    " --in=filename.ddx       discovery instructions XML file(s)\n",
+    " --mkdir                 create data-dir directories\n",
+    " --limit=regexp          limit the discovery by output files\n",
+    " --forcebundle           always write the bundle file\n",
+    " --fallback=integer      maximum age of XML file to fall back to\n",
+    " --threads=integer       number of parallel discovery threads\n",
+    " --verbose               print extra information\n",
+    " --debug                 print debugging information\n",
+    " --snmpdebug             print SNMP protocol details\n",
+    "\n";
+    if( not $Torrus::Global::threadsEnabled )
+    {
+        print STDERR "Multithreading is NOT SUPPORTED by current " .
+            "perl interpreter\n";
+    }
+
+    exit 1;
+}
+
+if( $snmpdebug )
+{
+    $Net::SNMP::Transport::UDP::DEBUG = 1;
+    $Net::SNMP::Message::DEBUG = 1;
+    $Net::SNMP::MessageProcessing::DEBUG = 1;
+    $Net::SNMP::Dispatcher::DEBUG = 1;
+}
+
+if( $debug )
+{
+    Torrus::Log::setLevel('debug');
+}
+elsif( $verbose )
+{
+    Torrus::Log::setLevel('verbose');
+}
+
+my $everythingsOk = 1;
+my $perOutfileHostParams = {};
+my %outputBundles;
+
+foreach my $infile ( @infiles )
+{
+    if( not -r $infile )
+    {
+        my $altfile = $Torrus::Global::discoveryDir . $infile;
+        if( not -r $altfile )
+        {
+            Error('Cannot find file ' . $infile .
+                  ' neither in current directory nor in ' .
+                  $Torrus::Global::discoveryDir);
+            exit 1;
+        }
+        else
+        {
+            $infile = $altfile;
+        }
+    }
+
+    Verbose('Processing ' . $infile);
+
+    my $parser = new XML::LibXML;
+    my $doc;
+    eval { $doc = $parser->parse_file( $infile );  };
+    if( $@ )
+    {
+        Error("Failed to parse $infile: $@");
+        exit 1;
+    }
+
+    my $root = $doc->documentElement();
+    if( $root->nodeName() ne 'snmp-discovery' )
+    {
+        Error('XML root element is not "snmp-discovery" in ' . $infile);
+        exit 1;
+    }
+        
+    my $format_version =
+        (($root->getElementsByTagName('file-info'))[0]->
+         getElementsByTagName('format-version'))[0]->textContent();
+    
+    $format_version =~ s/\s//g;
+    
+    if( not $format_version or not $formatsSupported{$format_version} )
+    {
+        Error('Invalid format or format version not supported: ' . $infile);
+        exit 1;
+    }
+
+    my $globalParams = parseParams( $root );
+
+
+    # Parse the body of the XML
+
+    foreach my $hostNode ( $root->getChildrenByTagName('host') )
+    {
+        my $hostParams = parseParams( $hostNode, $globalParams );
+        normalizeParams( $hostParams );
+
+        my $outfile = $hostParams->{'output-file'};
+        if( not exists($perOutfileHostParams->{$outfile}) )
+        {
+            $perOutfileHostParams->{$outfile} = [];
+        }
+        push( @{$perOutfileHostParams->{$outfile}}, $hostParams );
+
+        my $outBundles = $hostParams->{'output-bundle'};
+        if( length( $outBundles ) > 0 )
+        {
+            foreach my $bundleName ( split( /\s*,\s*/, $outBundles ) )
+            {
+                $bundleName = absXmlFilename( $bundleName );
+                $outputBundles{$bundleName}{ relXmlFilename($outfile) } = 1;
+            }
+        }
+    }
+}
+
+
+# Start discovery
+my $jobQueue;
+my $bundleDeletionQueue;
+my $confBuildSemaphore;
+
+if( $workerThreads > 1 )
+{
+    require threads;
+    require threads::shared;
+    require Thread::Queue;
+    require Thread::Semaphore;
+
+    threads::shared::share( \$everythingsOk );
+
+    $jobQueue = new Thread::Queue;
+    $bundleDeletionQueue = new Thread::Queue;
+    $confBuildSemaphore = new Thread::Semaphore;
+
+    # Enqueue the output filenames    
+    foreach my $outfile ( sort keys %{$perOutfileHostParams} )
+    {
+        if( not matchLimitRe( $outfile ) )
+        {
+            next;
+        }
+
+        $jobQueue->enqueue( $outfile );
+    }
+
+    # Start the worker threads
+    my @workers;
+    foreach my $i ( 1..$workerThreads )
+    {
+        push( @workers, threads->create( \&discoveryThread ) );
+    }
+
+    # Wait for workers to finish the jobs
+    while( my $thr = shift( @workers ) )
+    {
+        my $tid = $thr->tid();
+        $thr->join();
+        Debug('Cleaning up thread #' . $tid);
+        undef $thr;
+    }
+
+    # Process the files to be excluded from bundles
+
+    if( not $everythingsOk )
+    {
+        my $outfile;
+        while( defined( $outfile = $bundleDeletionQueue->dequeue_nb() ) )
+        {
+            removeFromBundle( $outfile );
+        }
+    }
+}
+else
+{
+    # Single-thread operation
+       
+    foreach my $outfile ( sort keys %{$perOutfileHostParams} )
+    {
+        if( not matchLimitRe( $outfile ) )
+        {
+            next;
+        }
+        
+        if( not doDiscover( $outfile ) )
+        {
+            removeFromBundle( $outfile );
+        }
+    }
+}
+
+# Discovery finished, do the bundles
+
+if( scalar( keys %outputBundles ) > 0 )
+{
+    if( defined( $limitre ) )
+    {
+        Warn('Cannot write bundles with --limit option specified. ' .
+             'Bundle files remain unchanged');
+    }
+    elsif( $everythingsOk )
+    {
+        foreach my $bundleName ( sort keys %outputBundles )
+        {
+            my $cb = new Torrus::ConfigBuilder;
+
+            $cb->addCreatorInfo( $creator );
+            
+            foreach my $bundleMember
+                ( sort keys %{$outputBundles{$bundleName}} )
+            {
+                $cb->addFileInclusion( $bundleMember );
+            }
+
+            my $ok = $cb->toFile( $bundleName );
+            if( $ok )
+            {
+                Verbose('Wrote bundle to ' . $bundleName);
+            }
+            else
+            {
+                Error('Cannot write bundle to ' . $bundleName . ': ' . $!);
+                $everythingsOk = 0;
+            }
+        }
+    }
+    else
+    {
+        Error('Skipping bundles generation because of errors');
+    }
+}
+
+
+exit($everythingsOk ? 0:1);
+
+
+sub parseParams
+{
+    my $parentNode = shift;
+    my $paramhash = shift;
+
+    # Clone the parameters hash
+    my $ret = {};
+    if( $paramhash )
+    {
+        while( my($key, $val) = each %{$paramhash} )
+        {
+            $ret->{$key} = $val;
+        }
+    }
+
+    foreach my $paramNode ( $parentNode->getChildrenByTagName('param') )
+    {
+        my $param = $paramNode->getAttribute('name');
+        my $value = $paramNode->getAttribute('value');
+
+        if( not $param )
+        {
+            Error("Parameter without name");
+            exit 1;
+        }
+
+        if( not defined( $value ) )
+        {
+            $value = $paramNode->textContent();
+        }
+
+        # Remove spaces in the head and tail.
+        $value =~ s/^\s+//;
+        $value =~ s/\s+$//;
+
+        $ret->{$param} = $value;
+    }
+    return $ret;
+}
+
+
+sub normalizeParams
+{
+    my $params = shift;
+
+    if( not defined( $params->{'output-file'} ) )
+    {
+        Warn('output-file parameter is not defined. Using routers.xml');
+        $params->{'output-file'} = 'routers.xml';
+    }
+    else
+    {
+        $params->{'output-file'} = absXmlFilename( $params->{'output-file'} );
+    }
+
+    if( defined( $params->{'host-subtree'} ) )
+    {
+        my $subtree = $params->{'host-subtree'};
+
+        if( $subtree !~ /^\/[0-9A-Za-z_\-\.\/]*$/ or
+            $subtree =~ /\.\./ )
+        {
+            Error("Invalid format for subtree name: " . $subtree);
+            exit 1;
+        }
+    }
+
+    if( defined( $params->{'snmp-community'} ) )
+    {
+        # Remove any possible Unicode character treatment
+        $params->{'snmp-community'} =
+            pack( 'A*', $params->{'snmp-community'} );
+    }
+}
+
+
+# Replaces $XMLCONFIG with the XML root directory
+sub absXmlFilename
+{
+    my $filename = shift;
+
+    my $subst = '$XMLCONFIG';
+    my $offset = index( $filename, $subst );
+    if( $offset >= 0 )
+    {
+        my $len = length( $subst );
+        substr( $filename, $offset, $len ) = $Torrus::Global::siteXmlDir;
+    }
+    else
+    {
+        if( $filename !~ /^\// )
+        {
+            $filename = $Torrus::Global::siteXmlDir . '/' . $filename;
+        }
+    }
+    return $filename;
+}
+
+
+# Removes XML root directory from path
+sub relXmlFilename
+{
+    my $filename = shift;
+
+    my $subst = $Torrus::Global::siteXmlDir;
+    my $len = length( $subst );
+
+    if( $filename =~ /^\// )
+    {
+        my $offset = index( $filename, $subst );
+        if( $offset == 0 )
+        {
+            $filename = substr( $filename, $len );
+            # we don't know if xmldir has a trailing slash
+            $filename =~ s/^\///;
+        }
+    }
+    return $filename;
+}
+
+
+sub matchLimitRe
+{
+    my $filename = shift;
+
+    if( defined( $limitre ) )
+    {
+        $filename =~ s/^.*\///;
+
+        if( $filename !~ $limitre )
+        {
+            return 0;
+        }
+    }
+
+    return 1;
+}
+
+
+# Pick up next available outfile until the job queue is empty
+
+sub discoveryThread
+{
+    Torrus::Log::setTID( threads->tid() );
+    Debug('Started thread #' . threads->tid());
+    my $outfile;
+    while( defined( $outfile = $jobQueue->dequeue_nb() ))
+    {
+        if( not doDiscover( $outfile ) )
+        {
+            $bundleDeletionQueue->enqueue( $outfile );
+        }
+    }
+    Debug('Finished thread #' . threads->tid());
+}
+
+
+
+sub doDiscover
+{
+    my $outfile = shift;
+    
+    Verbose('Preparing to write ' . $outfile);
+
+    my $dd = new Torrus::DevDiscover;
+    my $ok = 1;
+
+    foreach my $hostParams ( @{$perOutfileHostParams->{$outfile}} )
+    {
+        $ok = $dd->discover( $hostParams );
+
+        if( not $ok )
+        {
+            Error($outfile . ' was not written because of errors');
+            $everythingsOk = 0;
+            last;
+        }
+    }
+
+    if( $ok )
+    {
+        # LibXML2 is not thread-safe, so we create the XML files
+        # one at a time
+        if( $workerThreads > 1 )
+        {
+            $confBuildSemaphore->down();
+        }
+        
+        my $cb = new Torrus::ConfigBuilder;
+
+        $cb->addCreatorInfo( $creator );
+
+        $dd->buildConfig( $cb );
+        $cb->addRequiredFiles();
+        $cb->addStatistics();
+
+        $ok = $cb->toFile( $outfile );
+        if( $ok )
+        {
+            Verbose('Wrote ' . $outfile);
+        }
+        else
+        {
+            Error('Cannot write ' . $outfile . ': ' . $!);
+            $everythingsOk = 0;
+        }
+
+        if( $workerThreads > 1 )
+        {
+            $confBuildSemaphore->up();
+        }
+    }
+
+    if( $makedirs )
+    {
+        if( $everythingsOk )
+        {
+            # Not sure if these calls are reentrant
+            if( $workerThreads > 1 )
+            {
+                $confBuildSemaphore->down();
+            }
+            
+            my ($login,$pass,$uid,$gid) = getpwnam('@torrus_user@')
+                or die "Cannot get user details for @torrus_user@";
+            
+            foreach my $dir ( $dd->listDataDirs() )
+            {
+                if( not -d $dir )
+                {
+                    Debug('Creating directory: ' . $dir);
+                    mkdir( $dir ) or
+                        Error('Cannot create directory: ' .
+                              $dir . ': ' . $!);
+                    chown( $uid, $gid, $dir ) or
+                        Error('Cannot change ownership for ' .
+                              $dir . ': ' . $!);
+                    chmod( 02755, $dir ) or
+                        Error('Cannot chmod 02755 for ' .
+                              $dir . ': ' . $!);
+                }
+            }
+
+            if( $workerThreads > 1 )
+            {
+                $confBuildSemaphore->up();
+            }            
+        }
+        else
+        {
+            Error('Skipping mkdir because of errors');
+        }
+    }
+    
+    return $ok;
+}
+
+
+sub removeFromBundle
+{
+    my $outfile = shift;
+    
+    my $relname  = relXmlFilename($outfile);
+    
+    my $removeFromBundle = 1;
+        
+    if( $forcebundle )
+    {
+        if( defined( $fallback ) and
+            -e $outfile and -M $outfile <= $fallback )
+        {               
+            Warn('Falling back to the old version of ' . $relname);
+            $removeFromBundle = 0;
+        }
+        $everythingsOk = 1;
+    }
+
+    if( $removeFromBundle )
+    {
+        foreach my $bundleName ( sort keys %outputBundles )
+        {
+            if( exists( $outputBundles{$bundleName}{$relname} ) )
+            {
+                delete $outputBundles{$bundleName}{$relname};
+                Warn('Bundle ' . $bundleName . ' will not have ' .
+                     $relname . ' included because of errors');
+            }
+        }
+    }
+}
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/flushmonitors.in b/torrus/bin/flushmonitors.in
new file mode 100644 (file)
index 0000000..6c01269
--- /dev/null
@@ -0,0 +1,143 @@
+#!@PERL@ -w
+#  Copyright (C) 2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: flushmonitors.in,v 1.1 2010-12-27 00:04:01 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use Getopt::Long;
+use strict;
+
+use Torrus::SiteConfig;
+use Torrus::ConfigTree;
+use Torrus::Log;
+
+exit(1) if not Torrus::SiteConfig::verify();
+
+our @trees;
+our $all_trees;
+
+our $debug;
+our $verbose;
+our $help_needed;
+
+my $ok = GetOptions ('tree=s'   => \@trees,
+                     'all'      => \$all_trees,
+                     'debug'    => \$debug,
+                     'verbose'  => \$verbose,
+                     'help'     => \$help_needed);
+
+if( not $ok or not (scalar(@trees) or $all_trees) or
+    $help_needed or scalar(@ARGV) > 0 )
+{
+    print STDERR "Usage: $0 --tree=NAME [options...]\n",
+    "The utility flushes all monitor alarms and dynamic tokenset members\n",
+    "Options:\n",
+    "  --tree=NAME     tree name(s) to flush\n",
+    "  --all           flush all trees\n",
+    "  --debug         set the log level to debug\n",
+    "  --verbose       set the log level to info\n",
+    "  --help          this help message\n";
+    exit 1;
+}
+
+if( $all_trees )
+{
+    @trees = Torrus::SiteConfig::listTreeNames();
+}
+
+if( $debug )
+{
+    Torrus::Log::setLevel('debug');
+}
+elsif( $verbose )
+{
+    Torrus::Log::setLevel('verbose');
+}
+
+
+&Torrus::DB::setSafeSignalHandlers();
+
+Verbose(sprintf('Torrus version %s', '@VERSION@'));
+
+foreach my $tree ( @trees )
+{
+    if( not Torrus::SiteConfig::treeExists( $tree ) )
+    {
+        Error("Tree named \"" . $tree . "\" does not exist");
+        exit(1);
+    }
+
+    &Torrus::DB::checkInterrupted();
+    
+    Verbose("Flushing alarms and tokensets for the tree: $tree");
+
+    my $config_tree = new Torrus::ConfigTree( -TreeName => $tree,
+                                              -Wait => 1 );
+    if( not defined( $config_tree ) )
+    {
+        next;
+    }
+
+    my $db = new Torrus::DB('monitor_alarms',
+                            -Subdir => $tree,
+                            -WriteAccess => 1);
+
+
+    my $cursor = $db->cursor(-Write => 1);
+    while( my ($key, $timers) = $db->next($cursor) )
+    {
+        Debug('Deleting alarm: ' . $key);        
+        $db->c_del( $cursor );            
+        
+    }
+    undef $cursor;   
+    undef $db;
+    
+    &Torrus::DB::checkInterrupted();
+
+    my @members;
+    foreach my $ts ( $config_tree->getTsets() )
+    {
+        Debug('Processing tokenset: ' . $ts);
+        
+        foreach my $member ( $config_tree->tsetMembers( $ts ) )
+        {
+            my $origin = $config_tree->tsetMembers( $ts, $member );
+            
+            if( not defined( $origin ) or $origin ne 'static' )
+            {
+                my $path = $config_tree->path($member);
+                $config_tree->tsetDelMember($ts, $member);
+                Verbose('deleted ' . $path . ' from tokenset: ' . $ts);
+            }
+        }
+    }
+
+    undef $config_tree;
+    &Torrus::DB::cleanupEnvironment();
+}
+
+exit;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/genddx.in b/torrus/bin/genddx.in
new file mode 100644 (file)
index 0000000..6e3464e
--- /dev/null
@@ -0,0 +1,255 @@
+#!@PERL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: genddx.in,v 1.1 2010-12-27 00:04:00 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Generate the SNMP discovery instructions XML file out of plaintext
+# list of hosts.
+
+BEGIN { require '@devdiscover_config_pl@'; }
+
+use strict;
+use Getopt::Long;
+use XML::LibXML;
+
+use Torrus::Log;
+
+our $outFormatVersion = '1.0';
+
+our @hosts = ();
+our $hostfile;
+
+our %globalParams =
+    (
+     'output-file'         => 'routers.xml',
+     'domain-name'         => '',
+     'host-subtree'        => '/Routers',
+     'snmp-port'           => '161',
+     'snmp-community'      => 'public',
+     'snmp-version'        => '2c',
+     'snmp-timeout'        => 10,
+     'snmp-retries'        => 2,
+     'rrd-hwpredict'       => 0,
+     'data-dir'            => '@defrrddir@',
+     );
+
+our $outfile = 'routers.ddx';
+
+
+my $creator = "Torrus version @VERSION@\n" .
+    "This file was generated by command:\n" .
+    $0 . " \\\n";
+foreach my $arg ( @ARGV )
+{
+    if( $arg =~ /^--/ )
+    {
+        $creator .= ' ' . $arg . ' ';
+    }
+    else
+    {
+        $creator .= "\'" . $arg . "\'\\\n";
+    }
+}
+$creator .= "\nOn " . scalar(localtime(time));
+
+my $ok = GetOptions(
+                    'host=s'      => \@hosts,
+                    'hostfile=s'  => \$hostfile,
+                    'out=s'       => \$outfile,
+                    'discout=s'   => \$globalParams{'output-file'},
+                    'domain=s'    => \$globalParams{'domain-name'},
+                    'version=s'   => \$globalParams{'snmp-version'},
+                    'community=s' => \$globalParams{'snmp-community'},
+                    'port=i'      => \$globalParams{'snmp-port'},
+                    'timeout=i'   => \$globalParams{'snmp-timeout'},
+                    'retries=i'   => \$globalParams{'snmp-retries'},
+                    'subtree=s'   => \$globalParams{'host-subtree'},
+                    'holtwinters' => \$globalParams{'rrd-hwpredict'},
+                    'datadir=s'   => \$globalParams{'data-dir'},
+                    );
+
+if( not $ok or
+    ( not $hostfile and scalar(@hosts) == 0 ) or
+    scalar( @ARGV ) > 0 )
+{
+    print STDERR "Generate devdiscover XML configuration\n";
+
+    print STDERR "Usage: $0 options...\n",
+    "Options:\n",
+    " --host=hostname         router hostname\n",
+    " --hostfile=filename     space-separated router hostnames file\n",
+    " --out=filename          output file             [".$outfile."]\n",
+
+    " --discout=filename      discovery output file\n",
+    "      [", $globalParams{'output-file'}, "]\n",
+
+    " --domain=domain         optional DNS domain name\n",
+
+    " --version=v             SNMP version         [",
+    $globalParams{'snmp-version'}, "]\n",
+
+    " --community=string      SNMP read community  [",
+    $globalParams{'snmp-community'}, "]\n",
+
+    " --port=number           SNMP port            [",
+    $globalParams{'snmp-port'}, "]\n",
+
+    " --retries=number        SNMP retries         [",
+    $globalParams{'snmp-retries'}, "]\n",
+
+    " --timeout=number        SNMP timeout         [",
+    $globalParams{'snmp-timeout'}, "]\n",
+
+    " --subtree=string        Subtree name         [",
+    $globalParams{'host-subtree'}, "]\n",
+
+    " --datadir=path          data-dir parameter   [",
+    $globalParams{'data-dir'}, "]\n",
+
+    " --holtwinters           Enable Holt-Winters analysis\n",
+    "\n",
+    "Host names may be of form \"host:devname\" where devname is a symbolic\n",
+    "device name.\n",
+    "Output file is placed into " . $Torrus::Global::discoveryDir,
+    "\n if no path is given.\n";
+    exit 1;
+}
+
+# Place the output file in discovery directory if the path is not given
+if( $outfile !~ /\// )
+{
+    $outfile = $Torrus::Global::discoveryDir . '/' . $outfile;
+}
+
+# Convert flags from true/false to yes/no
+foreach my $param ( 'rrd-hwpredict' )
+{
+    if( $globalParams{$param} )
+    {
+        $globalParams{$param} = 'yes';
+    }
+    else
+    {
+        $globalParams{$param} = 'no';
+    }
+}
+
+if( $globalParams{'host-subtree'} !~ /^\/[0-9A-Za-z_\-\.\/]*$/ or
+    $globalParams{'host-subtree'} =~ /\.\./ )
+{
+    Error("Invalid format for subtree name: " . $globalParams{'host-subtree'});
+    exit 1;
+}
+
+if( defined $hostfile )
+{
+    if( not open(HOSTS, $hostfile) )
+    {
+        print STDERR "Cannot open $hostfile: $!";
+        exit 1;
+    }
+    while(<HOSTS>)
+    {
+        s/^\s+//;
+        s/\s+$//;
+        push( @hosts, split( /\s+/ ) );
+    }
+}
+
+# Create XML DOM
+
+my $doc = XML::LibXML->createDocument( "1.0", "UTF-8" );
+my $root = $doc->createElement('snmp-discovery');
+$doc->setDocumentElement( $root );
+
+{
+    my $fileInfoNode = $doc->createElement('file-info');
+    $root->appendChild( $fileInfoNode );
+
+    my $formatNode = $doc->createElement('format-version');
+    $formatNode->appendText( $outFormatVersion );
+    $fileInfoNode->appendChild( $formatNode );
+}
+
+{
+    my $creatorNode = $doc->createElement('creator-info');
+    $creatorNode->appendText( $creator );
+    $root->appendChild( $creatorNode );
+}
+
+createParamsDom( \%globalParams, $doc, $root );
+
+
+foreach my $host ( @hosts )
+{
+    my $devname = $host;
+    if( $host =~ /([^:]+):(.+)/ )
+    {
+        $host = $1;
+        $devname = $2;
+    }
+
+    my $hostNode = $doc->createElement('host');
+    $root->appendChild( $hostNode );
+
+    my %hostParams = ( 'snmp-host'      => $host );
+    if( $devname ne $host )
+    {
+        $hostParams{'symbolic-name'} = $devname;
+    }
+
+    createParamsDom( \%hostParams, $doc, $hostNode );
+}
+
+my $ok = $doc->toFile( $outfile, 2 );
+if( $ok )
+{
+    print STDERR ("Wrote $outfile\n");
+}
+else
+{
+    print STDERR ("Cannot write $outfile: $!\n");
+}
+
+
+exit($ok ? 0:1);
+
+
+sub createParamsDom
+{
+    my $params = shift;
+    my $doc = shift;
+    my $parentNode = shift;
+
+    foreach my $param ( sort keys %{$params} )
+    {
+        my $paramNode = $doc->createElement('param');
+        $paramNode->setAttribute( 'name', $param );
+        $paramNode->setAttribute( 'value', $params->{$param} );
+        $parentNode->appendChild( $paramNode );
+    }
+}
+
+
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/genlist.in b/torrus/bin/genlist.in
new file mode 100644 (file)
index 0000000..2b79fc1
--- /dev/null
@@ -0,0 +1,197 @@
+#!@PERL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: genlist.in,v 1.1 2010-12-27 00:04:01 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use Getopt::Long;
+
+use Torrus::Log;
+use Torrus::ConfigTree;
+use Torrus::SiteConfig;
+
+exit(1) if not Torrus::SiteConfig::verify();
+
+my $tree;
+my $initPath = '/';
+my $listWhat = 'rrdfiles';
+my $selectType = 'all';
+
+my $help_needed;
+
+my %listingsSupported =
+    (
+     'rrdfiles' => {
+         'collector'  => 1,
+         'readonly'   => 1,
+         'all'        => 1,
+     },
+     
+     'snmphosts' => {
+         'collector'  => 1,
+     },
+     );
+
+my $ok = GetOptions ('tree=s'   => \$tree,
+                     'path=s'   => \$initPath,
+                     'what=s'   => \$listWhat,
+                     'type=s'   => \$selectType,
+                     'help'     => \$help_needed);
+
+if( not $ok or not $tree or $help_needed or
+    not $listingsSupported{$listWhat}{$selectType} or scalar(@ARGV) > 0 )
+{
+    print STDERR "Usage: $0 --tree=NAME [options...]\n",
+    "Options:\n",
+    "  --tree=NAME     tree name\n",
+    "  --path=/PATH    [".$initPath."] subtree name\n",
+    "  --what=WHAT     [".$listWhat."] what to list\n",
+    "    Supported listings:\n",
+    "      rrdfiles      List RRD file paths\n",
+    "      snmphosts     List SNMP hosts\n",
+    "  --type=TYPE     [".$selectType."] selection type\n",
+    "    Supported types:\n",
+    "      collector     Collector leaves\n",
+    "      readonly      Read-only leaves\n",
+    "      all           All of above\n",
+    "  --help          this help message\n";
+    exit 1;
+}
+
+
+if( not Torrus::SiteConfig::treeExists( $tree ) )
+{
+    Error('Tree ' . $tree . ' does not exist');
+    exit 1;
+}
+
+&Torrus::DB::setSafeSignalHandlers();
+
+my $config_tree = new Torrus::ConfigTree( -TreeName => $tree, -Wait => 1 );
+if( not defined( $config_tree ) )
+{
+    exit 1;
+}
+
+my $initToken = $config_tree->token( $initPath );
+if( not defined( $initToken ) )
+{
+    Error('No such subtree: ' . $initPath);
+    exit 1;
+}
+
+my $listing = {};
+
+my $listParams = {};
+if( $selectType eq 'all' )
+{
+    foreach my $type ( keys %{$listingsSupported{$listWhat}} )
+    {
+        if( $type ne 'all' )
+        {
+            $listParams->{$type} = 1;
+        }
+    }
+}
+else
+{
+    $listParams->{$selectType} = 1;
+}
+
+pickup_data( $config_tree, $initToken, $listing, $listWhat, $listParams );
+
+foreach my $item ( sort keys %{$listing} )
+{
+    print $item, "\n";
+}
+
+exit 0;
+
+sub pickup_data
+{
+    my $config_tree = shift;
+    my $token = shift;
+    my $listing = shift;
+    my $listWhat = shift;
+    my $listParams = shift;
+
+    foreach my $ctoken ( $config_tree->getChildren( $token ) )
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        if( $config_tree->isSubtree( $ctoken ) )
+        {
+            pickup_data( $config_tree, $ctoken,
+                         $listing, $listWhat, $listParams );
+        }
+        elsif( $config_tree->isLeaf( $ctoken ) )
+        {
+            if( $listWhat eq 'rrdfiles' and
+                (
+                 (
+                  $listParams->{'collector'} and
+                  $config_tree->getNodeParam( $ctoken, 'ds-type' ) eq
+                  'collector' and
+                  $config_tree->getNodeParam( $ctoken, 'storage-type' ) eq
+                  'rrd'
+                  ) or
+                 (
+                  $listParams->{'readonly'} and
+                  $config_tree->getNodeParam( $ctoken, 'ds-type' ) eq
+                  'rrd-file' and
+                  $config_tree->getNodeParam( $ctoken, 'leaf-type' ) eq
+                  'rrd-def'
+                  )
+                 )
+                )
+            {
+                my $datafile =
+                    $config_tree->getNodeParam( $ctoken, 'data-file' );
+                my $datadir =
+                    $config_tree->getNodeParam( $ctoken, 'data-dir' );
+                $listing->{$datadir . '/' . $datafile} = 1;
+            }
+            elsif( $listWhat eq 'snmphosts' and
+                   $listParams->{'collector'} and
+                   $config_tree->getNodeParam( $ctoken, 'ds-type' ) eq
+                   'collector' )
+            {
+                my $host =
+                    $config_tree->getNodeParam( $ctoken, 'snmp-host' );
+                my $oid =
+                    $config_tree->getNodeParam( $ctoken, 'snmp-object' );
+                
+                if( defined( $host ) and length( $host ) > 0 and
+                    defined( $oid ) and length( $oid ) > 0 )
+                {
+                    $listing->{$host} = 1;
+                }                
+            }
+        }
+    }
+}
+
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/genreport.in b/torrus/bin/genreport.in
new file mode 100644 (file)
index 0000000..6d21b48
--- /dev/null
@@ -0,0 +1,181 @@
+#!@PERL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: genreport.in,v 1.1 2010-12-27 00:04:01 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Collect the router information and create the XML file
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use Getopt::Long;
+
+use Torrus::Log;
+use Torrus::ReportOutput::HTML;
+use Torrus::SiteConfig;
+
+my $report;
+my $date;
+my $time = '00:00';
+my $genhtml;
+my @trees;
+my $all2tree;
+
+my $debug = 0;
+my $verbose = 0;
+
+my $ok = GetOptions(
+                    'report=s'    => \$report,
+                    'date=s'      => \$date,
+                    'time=s'      => \$time,
+                    'genhtml'     => \$genhtml,
+                    'tree=s'      => \@trees,
+                    'all2tree=s'  => \$all2tree,
+                    'verbose'     => \$verbose,
+                    'debug'       => \$debug
+                    );
+
+if( $report and not defined($Torrus::ReportGenerator::modules{$report}) )
+{
+    print STDERR "Unknown report name: ", $report, "\n\n";
+    $ok = 0;
+}
+                                            
+if( not $ok or (not $report and not $genhtml) or
+    ($report and not $date) or
+    ($genhtml and scalar(@trees) > 0 and $all2tree) or
+    scalar( @ARGV ) > 0 )
+{
+    print STDERR
+        "Usage: $0 --report=ReportName --date=YYYY-MM-DD | ",
+        "--genhtml options...\n";
+    print STDERR "Options:\n",
+    " --report=ReportName Report name.\n",
+    " --date=YYYY-MM-DD   Report start date. ",
+    "For monthly reports, 1st day in a month.\n",
+    " --time=hh:mm        Report start time. Ignored for monthly reports\n",
+    " --genhtml           Generate HTML output from the database\n",
+    " --tree=TREE         Generate HTML for a given tree only\n",
+    " --all2tree=TREE     Generate reports for all service IDs and place\n",
+    "                     into the given tree (excludes the option --tree)\n",
+    " --verbose           print extra information\n",
+    " --debug             print debugging information\n",   
+    "\n",
+    "Report names supported:\n";
+
+    foreach my $rep ( sort keys %Torrus::ReportGenerator::modules )
+    {
+        print STDERR "  ", $rep, "\n";
+    }
+    print STDERR "\n";    
+    
+    exit 1;
+}
+
+if( $debug )
+{
+    Torrus::Log::setLevel('debug');
+}
+elsif( $verbose )
+{
+    Torrus::Log::setLevel('verbose');
+}
+
+&Torrus::DB::setSafeSignalHandlers();
+
+if( $report )
+{
+    my $class = $Torrus::ReportGenerator::modules{$report};
+    eval( 'require ' . $class );
+    die( $@ ) if $@;
+    
+    my $generator = $class->new({
+        'Name' => $report,
+        'Date' => $date,
+        'Time' => $time});
+    
+    if( defined( $generator ) )
+    {
+        $generator->generate();
+    }
+    else
+    {
+        $ok = 0;
+    }
+}
+
+if( $genhtml )
+{
+    if( $all2tree )
+    {
+        push( @trees, $all2tree );
+    }
+    
+    if( scalar( @trees ) == 0 )
+    {
+        @trees = Torrus::SiteConfig::listTreeNames();
+    }
+    else
+    {
+        foreach my $tree ( @trees )
+        {
+            if( not Torrus::SiteConfig::treeExists( $tree ) )
+            {
+                Error('Tree ' . $tree . ' does not exist');
+                $ok = 0;
+            }
+        }
+    }
+
+    if( $ok )
+    {
+        foreach my $tree ( @trees )
+        {
+            &Torrus::DB::checkInterrupted();
+            
+            Verbose('Generating HTML report for tree ' . $tree);
+
+            my $options = {'Tree' => $tree};
+
+            if( length( $all2tree ) > 0 )
+            {
+                $options->{'All_Service_IDs'} = 1;
+            }
+            
+            my $out = new Torrus::ReportOutput::HTML( $options );
+            
+            if( $out->init() )
+            {
+                $ok = $out->generate() ? $ok:0;
+            }
+            else
+            {
+                $ok = 0;
+            }
+        }
+    }
+}
+
+exit($ok ? 0:1);
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/install_plugin.in b/torrus/bin/install_plugin.in
new file mode 100644 (file)
index 0000000..31b44e7
--- /dev/null
@@ -0,0 +1,51 @@
+#!@SHELL@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: install_plugin.in,v 1.1 2010-12-27 00:04:00 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+# Torrus plugin installation utility
+
+plugin=$1
+shift
+
+if test -z "$plugin"; then
+  echo "Usage: $0 plugin_dir [options...]" 1>&2
+  exit 1
+fi
+
+if test ! -d $plugin; then
+  echo "No such directory: $plugin" 1>&2
+  exit 1
+fi
+
+echo Installing Torrus plugin from $plugin
+
+cd $plugin
+eval './configure '`cat @cfgdefdir@/instvars`' '$@ || exit 1
+make || exit 1
+make install || exit 1
+
+echo Plugin installation finished
+
+
+# Local Variables:
+# mode: shell-script
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/monitor.in b/torrus/bin/monitor.in
new file mode 100644 (file)
index 0000000..c857999
--- /dev/null
@@ -0,0 +1,176 @@
+#!@PERL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: monitor.in,v 1.1 2010-12-27 00:04:03 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use Proc::Daemon;
+use Getopt::Long;
+
+use Torrus::Log;
+use Torrus::Monitor;
+use Torrus::SiteConfig;
+
+exit(1) if not Torrus::SiteConfig::verify();
+
+our $tree;
+our $nodaemon;
+our $runonce;
+our $delay = 0;
+our $debug;
+our $verbose;
+our $help_needed;
+
+# Derive the process name from the command line
+our $process_name = $0;
+$process_name =~ s/^.*\/([^\/]+)$/$1/;
+$process_name .= ' ' . join(' ', @ARGV);
+
+
+my $ok = GetOptions ('tree=s'   => \$tree,
+                     'nodaemon' => \$nodaemon,
+                     'runonce'  => \$runonce,
+                     'delay=i'  => \$delay,
+                     'debug'    => \$debug,
+                     'verbose'  => \$verbose,
+                     'help'     => \$help_needed);
+
+if( not $ok or not $tree or $help_needed or scalar(@ARGV) > 0 )
+{
+    print STDERR "Usage: $0 --tree=NAME [options...]\n",
+    "Options:\n",
+    "  --tree=NAME     tree name\n",
+    "  --nodaemon      do not fork daemon and log to STDERR\n",
+    "  --runonce       run one time and exit. Implies --nodaemon\n",
+    "  --delay         delay the start of the first cycle, minutes\n",
+    "  --debug         set the log level to debug\n",
+    "  --verbose       set the log level to info\n",
+    "  --help          this help message\n";
+    exit 1;
+}
+
+if( not Torrus::SiteConfig::mayRunMonitor( $tree ) )
+{
+    Error('Tree ' . $tree . ' is not configured to run monitor');
+    exit 1;
+}
+
+
+if( $debug )
+{
+    Torrus::Log::setLevel('debug');
+}
+elsif( $verbose )
+{
+    Torrus::Log::setLevel('verbose');
+}
+
+my $logfile = $Torrus::Global::logDir . '/monitor.' . $tree . '.log';
+my $pidfile;
+
+my $rotateLogs = sub
+{
+    Info('Caught SIGHUP. Reopening log file');
+    close( STDERR );
+    open( STDERR, ">>$logfile" );
+};
+
+if( not $nodaemon and not $runonce )
+{
+    my $pidfilename =
+        $Torrus::Global::pidDir . '/monitor.' . $tree . '.pid';
+    
+    if( -r $pidfilename )
+    {
+        Error("Another monitor daemon is running, pid=",
+              `cat $pidfilename`);
+        exit 1;
+    }
+
+    &Proc::Daemon::Init();
+    umask 0017; # Proc::Daemon::Init sets the mask to all-writable
+
+    $SIG{'HUP'} = $rotateLogs;
+
+    # At this point, we cannot tell anyone if "open" fails
+    open(STDERR, ">>$logfile");
+
+    $pidfile = $pidfilename;
+    
+    if( open( PID, ">$pidfile" ) )
+    {
+        printf PID ( "%d", $$ );
+        close PID;
+    }
+    else
+    {
+        Error("Cannot open $pidfile for writing: $!");
+    }
+}
+
+Info(sprintf("Torrus version %s", '@VERSION@'));
+Info(sprintf("%s started for tree %s", $0, $tree));
+Debug(sprintf("Process ID %d", $$));
+
+if( $delay > 0 )
+{
+    Info(sprintf('Delaying for %d minutes', $delay));
+    sleep($delay * 60);
+}
+
+&Torrus::DB::setSafeSignalHandlers();
+
+my %options =
+    (
+     '-ProcessName' => $process_name,
+     '-Tree'      => $tree,
+     '-Delay'     => $delay
+     );
+if( $runonce )
+{
+    $options{'-RunOnce'} = 1;
+}
+
+my $scheduler = new Torrus::MonitorScheduler( %options );
+$scheduler->run();
+
+if( not $options{'-RunOnce'} )
+{
+    Error("Monitor process exited: nothing to collect");
+    unlink $pidfile;
+}
+
+exit;
+
+
+END
+{
+    if( defined($pidfile) and -r $pidfile )
+    {
+        unlink $pidfile;
+    }
+}
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/nodeid.in b/torrus/bin/nodeid.in
new file mode 100644 (file)
index 0000000..b362a95
--- /dev/null
@@ -0,0 +1,252 @@
+#!@PERL@ -w
+#  Copyright (C) 2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: nodeid.in,v 1.1 2010-12-27 00:04:03 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use Getopt::Long;
+use JSON;
+use File::Copy;
+    
+use Torrus::ConfigTree;
+use Torrus::SiteConfig;
+use Torrus::Renderer;
+use Torrus::Log;
+
+exit(1) if not Torrus::SiteConfig::verify();
+
+
+my %commands =
+    ('info'   => \&do_info,
+     'search' => \&do_search,
+     'render' => \&do_render);
+
+
+
+my $tree;
+my $cmd;
+
+my $nodeid;
+my $print_details;
+my $search_prefix;
+my $search_substring;
+my $render_view;
+my $render_out;
+
+
+my $help_needed;
+
+
+my $ok = GetOptions('tree=s'      => \$tree,
+                    'cmd=s'       => \$cmd,
+                    'nodeid=s'    => \$nodeid,
+                    'details'     => \$print_details,
+                    'prefix=s'    => \$search_prefix,
+                    'substring=s' => \$search_substring,
+                    'view=s'      => \$render_view,
+                    'out=s'       => \$render_out,
+                    'help'        => \$help_needed);
+
+if( not $ok or
+    not $tree or not $cmd or not $commands{$cmd} or
+    ( ($cmd eq 'info' or $cmd eq 'render') and not $nodeid ) or
+    ( $cmd eq 'search' and not ($search_prefix or $search_substring) ) or
+    $help_needed or scalar(@ARGV) > 0 )
+{
+    print STDERR "Usage: $0 --tree=NAME --cmd=CMD [options...]\n",
+    "Options:\n",
+    "  --tree=NAME      tree name\n",
+    "  --cmd=CMD        Command (info|search|render)\n",
+    "  --nodeid=NODEID  nodeid (mandatory for info and render)\n",
+    "  --details        print nodeid details (valid with info and search)\n",
+    "  --prefix=STR     search prefix\n",
+    "  --substring=STR  search substring\n",
+    "  --view=VIEW      render view (optional)\n",
+    "  --out=FILE       render output\n",
+    "  --help           this help message\n";
+    exit 1;
+}
+
+
+if( not Torrus::SiteConfig::treeExists( $tree ) )
+{
+    Error('Tree ' . $tree . ' does not exist');
+    exit 1;
+}
+
+
+&Torrus::DB::setSafeSignalHandlers();
+
+{
+    my $config_tree = new Torrus::ConfigTree( -TreeName => $tree );
+    if( not defined($config_tree) )
+    {
+        Error("Configuration is not ready");
+        exit 1;
+    }
+        
+    if( $cmd eq 'info' or $cmd eq 'render' )
+    {
+        my $token = $config_tree->getNodeByNodeid($nodeid);
+        if( not defined( $token ) )
+        {
+            Error('nodeid not found: ' . $nodeid);
+            exit(1);
+        }
+
+        if( $cmd eq 'info' )
+        {
+            print_nodeid($config_tree, [$token], $print_details);
+        }
+        else
+        {
+            render_node($config_tree, $token, $render_view, $render_out);
+        }
+    }
+    elsif( $cmd eq 'search' )
+    {
+        my $results;
+        if( defined($search_prefix) )
+        {
+            $results = $config_tree->searchNodeidPrefix($search_prefix);
+        }
+        else
+        {
+            $results = $config_tree->searchNodeidSubstring($search_substring);
+        }
+
+        if( defined( $results ) and scalar(@{$results}) > 0 )
+        {
+            my $tokens = [];
+            # results are pairs [nodeid,token]
+            foreach my $res ( @{$results} )
+            {
+                push(@{$tokens}, $res->[1]);
+            }
+            print_nodeid($config_tree, $tokens, $print_details);
+        }
+        else
+        {
+            print STDERR "Nothing found\n";
+            exit(1);
+        }
+    }
+    else
+    {
+        printf STDERR ("Unknown command: %s\n", $cmd);
+        exit(1);
+    }
+}
+
+exit(0);
+
+
+sub print_nodeid
+{
+    my $config_tree = shift;
+    my $tokens = shift;
+    my $details = shift;
+
+    my $json = new JSON;
+    $json->pretty();
+    $json->canonical();
+
+    my @all;
+
+    foreach my $token ( @{$tokens} )
+    {
+        my $info = {
+            'nodeid' => $config_tree->getNodeParam($token, 'nodeid', 1),
+        };
+
+        if( $details )
+        {
+            $info->{'path'} = $config_tree->path($token);
+            $info->{'is_leaf'} = $config_tree->isLeaf($token) ? 1:0;
+            $info->{'tree'} = $config_tree->treeName();
+            if( $info->{'is_leaf'} )
+            {
+                my $dsType = $config_tree->getNodeParam( $token, 'ds-type' );
+                $info->{'param:ds-type'} = $dsType;
+                if( $dsType eq 'collector' )
+                {
+                    foreach my $param
+                        ('collector-type', 'collector-period',
+                         'storage-type', 'data-file', 'data-dir', 'rrd-ds',
+                         'ext-service-id',
+                         'snmp-host', 'domain-name', 'snmp-object')
+                    {
+                        my $val = $config_tree->getNodeParam($token, $param);
+
+                        if( defined( $val ) )
+                        {
+                            $info->{'param:' . $param} = $val;
+                        }
+                    }
+                }
+            }
+        }
+
+        push(@all, $info);
+    }
+
+    print $json->encode(\@all);
+}
+            
+
+
+sub render_node
+{
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+    my $out = shift;
+
+    my $r = new Torrus::Renderer;
+
+    my($fname, $mimetype) = $r->render($config_tree, $token, $view);
+
+    if( defined($out) )
+    {
+        if( not copy( $fname, $out ) )
+        {
+            printf STDERR ("Failed to write to %s: %s\n", $out, $!);
+            exit(1);
+        }
+
+        $fname = $out;
+    }
+        
+    my $json = new JSON;
+    $json->pretty();
+
+    print $json->encode({'Content-type' => $mimetype,
+                         'Filename' => $fname});
+}
+        
+
+
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/rrddir2xml.in b/torrus/bin/rrddir2xml.in
new file mode 100644 (file)
index 0000000..c82fcf8
--- /dev/null
@@ -0,0 +1,311 @@
+#!@PERL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: rrddir2xml.in,v 1.1 2010-12-27 00:04:01 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Generate Torrus XML configuration from a directory containing RRD files
+# 
+
+BEGIN { require '@devdiscover_config_pl@'; }
+
+use strict;
+use Getopt::Long;
+use IO::Dir;
+use Fcntl qw(:mode);
+use RRDs;
+
+use Torrus::ConfigBuilder;
+use Torrus::Log;
+
+
+my $creator = "Torrus version @VERSION@\n" .
+    "This file was generated by command:\n" .
+    $0 . " \\\n";
+foreach my $arg ( @ARGV )
+{
+    if( $arg =~ /^--/ )
+    {
+        $creator .= ' ' . $arg . ' ';
+    }
+    else
+    {
+        $creator .= "\'" . $arg . "\'\\\n";
+    }
+}
+$creator .= "\nOn " . scalar(localtime(time));
+
+
+my $indir;
+my $recursive = 0;
+my $filter = '.*';
+my $outfile = 'rrddir.xml';
+my $topsubtree = '/';
+my $splitexpr = '_+';
+my $levels = 2;
+my $hwpredict = 0;
+my $comment;
+my $debug = 0;
+my $verbose = 0;
+
+
+my $ok = GetOptions(
+                    'dir=s'       => \$indir,
+                    'recursive'   => \$recursive,
+                    'filter=s'    => \$filter,
+                    'out=s'       => \$outfile,
+                    'subtree=s'   => \$topsubtree,
+                    'split=s'     => \$splitexpr,
+                    'levels=i'    => \$levels,
+                    'comment=s'   => \$comment,
+                    'holtwinters' => \$hwpredict,
+                    'verbose'     => \$verbose,
+                    'debug'       => \$debug
+                    );
+
+if( not $ok or not $indir or scalar( @ARGV ) > 0 )
+{
+    print STDERR
+        "Generate Torrus XML configuration from a directory with RRD files\n";
+
+    print STDERR "Usage: $0 --dir=path options...\n",
+    "Options:\n",
+    " --dir=path              directory to read RRD files from\n",
+    " --recursive             read the directories recursively\n",
+    " --filter=re             filter RE for file and directory names\n",
+    " --out=filename          output file             [".$outfile."]\n",
+    " --subtree=subtree       XML config subtree      [".$topsubtree."]\n",
+    " --split=regexp          regexp to split file names [".$splitexpr."]\n",
+    " --levels=integer        no. of subtree levels  [".$levels."]\n",
+    " --comment=text          top subtree comment\n",
+    " --holtwinters           enable Holt-Winters boundaries diaplay\n",
+    " --verbose               print extra information\n",
+    " --debug                 print debugging information\n";
+
+    exit 1;
+}
+
+if( $debug )
+{
+    Torrus::Log::setLevel('debug');
+}
+elsif( $verbose )
+{
+    Torrus::Log::setLevel('verbose');
+}
+
+if( not -d $indir )
+{
+    Error('No such directory: ' . $indir);
+    exit 1;
+}
+
+if( $indir !~ /^\// )
+{
+    Error('Input directory must be an absolute path: ' . $indir);
+    exit 1;
+}
+
+# remove trailing slash from $indir
+$indir =~ s/\/$//;
+
+if( $topsubtree !~ /^\/[0-9A-Za-z_\-\.\/]*$/ or
+    $topsubtree =~ /\.\./ )
+{
+    Error("Invalid format for subtree name: " . $topsubtree);
+    exit 1;
+}
+
+
+if( $outfile !~ /^\// )
+{
+    $outfile = $Torrus::Global::siteXmlDir . '/' . $outfile;
+}
+
+my %rrdinfos;
+read_rrd_dir( \%rrdinfos, $indir, $filter, $recursive );
+
+Verbose(sprintf('Found %d RRD files', scalar( keys( %rrdinfos ) ) ));
+
+my $cb = new Torrus::ConfigBuilder;
+$cb->addCreatorInfo( $creator );
+
+# Chop the first and last slashes
+my $path = $topsubtree;
+$path =~ s/^\///;
+$path =~ s/\/$//;
+
+# generate subtree path XML
+my $topSubtreeNode = undef;
+foreach my $subtreeName ( split( '/', $path ) )
+{
+    $topSubtreeNode = $cb->addSubtree( $topSubtreeNode, $subtreeName );
+}
+
+if( length( $comment ) > 0 )
+{
+    $cb->addParam( $topSubtreeNode, 'comment', $comment );
+}
+
+foreach my $rrdfile ( sort keys %rrdinfos )
+{
+    my @nameparts = split( $splitexpr, $rrdfile, $levels );
+    
+    my $subtreeNode = $topSubtreeNode;
+    foreach my $subtreeName ( @nameparts )
+    {
+        $subtreeNode = $cb->addSubtree( $subtreeNode, $subtreeName );
+    }
+
+    my $info = $rrdinfos{$rrdfile};
+    
+    my $legend =
+        'Directory:' . $info->{'dir'} . ';' .
+        'File:' . $rrdfile . ';';
+    
+    $cb->addParam( $subtreeNode, 'legend', $legend );
+
+    my %dsnames;
+    my $this_rrd_hwpredict = 0;
+
+    foreach my $prop ( keys %{$info->{'rrdinfo'}} )
+    {
+        if( $prop =~ /^ds\[(\S+)\]\./o )
+        {
+            $dsnames{$1} = 1;
+        }
+        else
+        {
+            if( $prop =~ /^rra\[\d+\]\.cf/o and
+                $info->{'rrdinfo'}->{$prop} eq 'FAILURES' )                
+            {
+                $this_rrd_hwpredict = 1;
+            }
+        }
+    }
+
+    if( not $hwpredict )
+    {
+        $this_rrd_hwpredict = 0;
+    }
+    
+    foreach my $dsname ( sort keys %dsnames )
+    {
+        my $dslegend = $legend . 'DS:' . $dsname . ';Type:' .
+            $info->{'rrdinfo'}->{'ds['.$dsname.'].type'};
+        
+        my $params = {
+            'legend'        => $dslegend,
+            'ds-type'       => 'rrd-file',
+            'leaf-type'     => 'rrd-def',
+            'rrd-cf'        => 'AVERAGE',
+            'data-file'     => $rrdfile,
+            'data-dir'      => $info->{'dir'},
+            'rrd-ds'        => $dsname,
+            'rrd-hwpredict' => ($this_rrd_hwpredict ? 'enabled':'disabled')
+            };
+        
+        $cb->addLeaf( $subtreeNode, $dsname, $params );
+    }    
+}
+
+my $ok = $cb->toFile( $outfile );
+if( $ok )
+{
+    Verbose('Wrote ' . $outfile);
+}
+else
+{
+    Error('Cannot write ' . $outfile . ': ' . $!);
+}
+
+exit( $ok ? 0:1);
+
+
+
+sub read_rrd_dir
+{
+    my $infos = shift;
+    my $indir = shift;
+    my $filter = shift;
+    my $recursive = shift;
+
+    Debug('Reading directory: ' . $indir);
+    
+    my @subdirs;
+    
+    my %dir;
+    tie( %dir, 'IO::Dir', $indir );
+    
+    foreach my $file ( keys %dir )
+    {
+        if( $file =~ /^\./ or $file !~ $filter )
+        {
+            Debug('Skipping ' . $file);
+            next;
+        }
+        
+        my $mode = $dir{$file}->mode();
+        if( S_ISDIR( $mode ) )
+        {
+            Debug($file . ' is a directory');
+            push( @subdirs, $file );
+        }
+        elsif( S_ISREG( $mode ) )
+        {
+            Debug($file . ' is a regular file');
+            if( defined( $infos->{$file} ) )
+            {
+                Warn("Duplicate file name: $file");
+            }
+            else
+            {
+                my $fullname = $indir . '/' . $file;
+                my $rrdinfo = RRDs::info( $fullname );
+                my $err = RRDs::error();
+                if( $err )
+                {
+                    Verbose($fullname . ' is not an RRD file');
+                }
+                else
+                {
+                    Debug('Found RRD file: ' . $file);
+                    $infos->{$file}->{'fullname'} = $fullname;
+                    $infos->{$file}->{'dir'} = $indir;
+                    $infos->{$file}->{'rrdinfo'} = $rrdinfo;
+                }
+            }
+        }
+    }
+
+    untie %dir;
+    
+    if( $recursive and scalar( @subdirs ) > 0 )
+    {
+        foreach my $subdir ( @subdirs )
+        {
+            read_rrd_dir( $infos, $indir . '/' . $subdir,
+                          $filter, $recursive );
+        }
+    }
+}
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/schedulerinfo.in b/torrus/bin/schedulerinfo.in
new file mode 100644 (file)
index 0000000..42515b0
--- /dev/null
@@ -0,0 +1,454 @@
+#!@PERL@ -w
+#  Copyright (C) 2003  Stanislav Sinyagin
+#  Copyright (C) 2003  Christian Schnidrig
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: schedulerinfo.in,v 1.1 2010-12-27 00:04:00 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use Getopt::Long;
+
+use Torrus::ConfigTree;
+use Torrus::SiteConfig;
+use Torrus::SchedulerInfo;
+use Torrus::Log;
+
+exit(1) if not Torrus::SiteConfig::verify();
+
+my $tree;
+my $report_config;
+my $report_runtime;
+my $clear_treestats;
+
+my $help_needed;
+
+
+my $ok = GetOptions('tree=s'   => \$tree,
+                    'config'   => \$report_config,
+                    'runtime'  => \$report_runtime,
+                    'clear'    => \$clear_treestats,
+                    'help'     => \$help_needed);
+
+if( not $ok or
+    not $tree or
+    not ( $report_config or $report_runtime or $clear_treestats  ) or
+    $help_needed or scalar(@ARGV) > 0 )
+{
+    print STDERR "Usage: $0 --tree=NAME [options...]\n",
+    "Options:\n",
+    "  --tree=NAME     tree name\n",
+    "  --config        report scheduler configuration\n",
+    "  --runtime       report scheduler runtime statistics\n",
+    "  --clear         clear scheduler statistics for specific tree\n",
+    "  --help          this help message\n";
+    exit 1;
+}
+
+
+if( not Torrus::SiteConfig::treeExists( $tree ) )
+{
+    Error('Tree ' . $tree . ' does not exist');
+    exit 1;
+}
+
+
+&Torrus::DB::setSafeSignalHandlers();
+
+if( $clear_treestats )
+{
+    my $stats = new Torrus::SchedulerInfo( -Tree => $tree, -WriteAccess => 1 );
+    $stats->clearAll();
+    print STDERR "Statistics cleared for tree $tree\n";
+    exit 0;
+}
+
+thickLine();
+printf("Torrus version %s\n", '@VERSION@');
+printf("Datasources tree: %s\n", $tree);
+printf("Date: %s\n\n", scalar( localtime( time() ) ) );
+
+if( $report_config )
+{
+    my $config_tree = new Torrus::ConfigTree( -TreeName => $tree );
+    if( not defined($config_tree) )
+    {
+        Error("Configuration is not ready");
+        exit 1;
+    }
+
+    my $stats = { 'collectorLeaves' => {}, 'monitorLeaves' => 0 };
+    
+    collectStats( $config_tree, $stats );
+
+    thickLine();
+    printf("Scheduler configuration report\n\n");
+
+    foreach my $instance ( sort {$a<=>$b} keys %{$stats->{'collectorLeaves'}} )
+    {
+        printf("Collector leaves for instance #%d: %d\n",
+               $instance, 
+               $stats->{'collectorLeaves'}{$instance});
+    }
+    
+    printf("Total monitor leaves: %d\n\n", $stats->{'monitorLeaves'});
+
+    printf("Scheduled leaves by type:\n");
+
+    foreach my $type ( sort keys %{$stats->{'leavesPerType'}} )
+    {
+        printf("  %10s  %-10d\n", $type,
+               $stats->{'leavesPerType'}{$type});
+    }
+    printf("\n");
+
+    foreach my $instance ( sort {$a<=>$b} keys %{$stats->{'collectorLeaves'}} )
+    {
+        if( $stats->{'collectorLeaves'}{$instance} > 0 )
+        {
+            &Torrus::DB::checkInterrupted();
+            
+            printf("Collector execution timeline for instance #%d:\n",
+                   $instance);
+            reportTimeline( $stats->{'collectorSchedule'}{$instance} );
+        }
+    }
+
+    if( $stats->{'monitorLeaves'} > 0 )
+    {
+        printf("Monitor execution timeline:\n");
+        reportTimeline( $stats->{'monitorSchedule'} );
+    }
+}
+
+if( $report_runtime )
+{
+    my @reportFormats =
+        (
+         { 'label'   => 'Running Time',
+           'varname' => 'RunningTime' },
+         
+         { 'label'   => 'Late Start',
+           'varname' => 'LateStart' },
+         
+         { 'label'   => 'Too Long',
+           'varname' => 'TooLong' },
+
+         { 'label'   => 'RRD Queue',
+           'varname' => 'RRDQueue' },
+
+         { 'label'   => 'Raw Queue',
+           'varname' => 'RawQueue' }
+
+         );
+
+    my @counterFormats =
+        (
+         { 'label'   => 'running cycles passed',
+           'varname' => 'NTimesRunningTime' },
+         
+         { 'label'   => 'late starts',
+           'varname' => 'NTimesLateStart' },
+
+         { 'label'   => 'too long runs',
+           'varname' => 'NTimesTooLong' },
+
+         { 'label'   => 'overrun periods',
+           'varname' => 'CountOverrunPeriods' },
+
+         { 'label'   => 'missed periods',
+           'varname' => 'CountMissedPeriods' }
+         );
+    
+    my $sInfo = new Torrus::SchedulerInfo( '-Tree' => $tree );
+    exit(1) if not defined( $sInfo );
+
+    my $stats = $sInfo->readStats();
+
+    thickLine();
+    printf("Scheduler runtime report\n\n");
+
+    my $periodicTasks = {};
+    foreach my $taskId ( keys %{$stats} )
+    {
+        my ($type, $taskName, $instance, $period, $offset) =
+            split( ':', $taskId );
+        if( $type eq 'P' )
+        {
+            $periodicTasks->{$taskName}{$instance}{$period}{$offset} = $taskId;
+        }
+    }
+    
+    foreach my $taskName ( sort keys %{$periodicTasks} )
+    {
+        foreach my $instance ( sort {$a<=>$b}
+                               keys %{$periodicTasks->{$taskName}} )
+        {
+            foreach my $period
+                ( sort {$a<=>$b}
+                  keys %{$periodicTasks->{$taskName}{$instance}} )
+            {
+                foreach my $offset
+                    ( sort {$a<=>$b}
+                      keys %{$periodicTasks->{$taskName}{$instance}{$period}} )
+                {
+                    &Torrus::DB::checkInterrupted();
+                    
+                    my $taskId =
+                        $periodicTasks->{$taskName}{$instance}{
+                            $period}{$offset};
+                    my $ref = $stats->{$taskId};
+                
+                    printf("Task: %s, Instance: %d, " .
+                           "Period: %d seconds, Offset: %d seconds\n",
+                           $taskName, $instance, $period, $offset);
+                
+                    foreach my $format ( @counterFormats )
+                    {
+                        if( defined( $ref->{$format->{'varname'}} ) )
+                        {
+                            printf("%5d %s\n",
+                                   $ref->{$format->{'varname'}},
+                                   $format->{'label'} );
+                        }
+                    }
+
+                    thinLine();
+                    printf("%-15s%-10s%-10s%-10s%-10s\n",
+                           '', 'Min', 'Max', 'Average', 'Exp Average');
+
+                    foreach my $format ( @reportFormats )
+                    {
+                        my $varname =  $format->{'varname'};
+                        if( defined( $ref->{'Min' . $varname} ) )
+                        {
+                            printf("%-15s%-10d%-10d%-10.1f%-10.1f\n",
+                                   $format->{'label'},
+                                   $ref->{'Min' . $varname},
+                                   $ref->{'Max' . $varname},
+                                   $ref->{'Avg' . $varname},
+                                   $ref->{'ExpAvg' . $varname});
+                        }
+                    }
+
+                    thinLine();
+                    printf("\n");
+                }
+            }
+        }
+    }
+}
+
+thickLine();
+exit 0;
+
+
+sub collectStats
+{
+    my $config_tree = shift;
+    my $stats = shift;
+    my $token = shift;
+
+    if( not defined( $token ) )
+    {
+        $token = $config_tree->token('/');
+    }
+
+    my @children = $config_tree->getChildren( $token );
+
+    foreach my $ctoken ( @children )
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        if( $config_tree->isSubtree( $ctoken ) )
+        {
+            collectStats( $config_tree, $stats, $ctoken );
+        }
+        elsif( $config_tree->isLeaf( $ctoken ) )
+        {
+            if( $config_tree->getNodeParam( $ctoken, 'ds-type' )
+                eq 'collector' )
+            {
+                my $instance =
+                    $config_tree->getNodeParam
+                    ( $ctoken, 'collector-instance' );
+                
+                $stats->{'collectorLeaves'}{$instance}++;
+                
+                my $type = 'c:' .
+                    $config_tree->getNodeParam( $ctoken, 'collector-type' );
+
+                my $period =
+                    $config_tree->getNodeParam( $ctoken, 'collector-period' );
+                $period = int( $period ); # make sure we're talking integers
+
+                my $offset = $config_tree->
+                    getNodeParam( $ctoken, 'collector-timeoffset' );
+                
+                $stats->{'leavesPerType'}{$type}++;
+                $stats->{'collectorSchedule'}{$instance}{$period}{
+                    $offset}{$type}++;
+            }
+            
+            if( defined( $config_tree->getNodeParam( $ctoken, 'monitor' ) ) )
+            {
+                $stats->{'monitorLeaves'}++;
+                my $type = 'monitor';
+
+                my $period =
+                    $config_tree->getNodeParam( $ctoken, 'monitor-period' );
+                $period = int( $period ); # make sure we're talking integers
+
+                my $offset = $config_tree->
+                    getNodeParam( $ctoken, 'monitor-timeoffset' );
+                $offset = int($offset) % $period;
+
+                $stats->{'leavesPerType'}{$type}++;
+                $stats->{'monitorSchedule'}{$period}{$offset}{$type}++;
+            }
+        }
+    }
+}
+
+
+# caluclate and print the schedule
+sub reportTimeline
+{
+    my $schedule = shift;
+    
+    # calculate the common period length (least common multiple)
+    my $lcm = 0;
+    foreach my $period ( keys %{$schedule} )
+    {
+        my $a = $period;
+        my $b = $lcm;
+        my $c;
+        if( $b == 0 )
+        {
+            $lcm = $a;
+        }
+        else
+        {
+            if( $a < $b )
+            {
+                my $tmp = $b;
+                $b = $a;
+                $a = $tmp;
+            }
+            while( $b != 0 )
+            {
+                $c = $a % $b;
+                $a = $b;
+                $b = $c;
+            }
+            $lcm = $lcm * $period / $a;
+        }
+    }
+
+    printf("Least common period: %d seconds\n", $lcm);
+
+    # populate the common period
+    my %cp;
+    my $chunks = 0;
+    foreach my $period ( keys %{$schedule} )
+    {
+        foreach my $offset ( keys %{$schedule->{$period}} )
+        {
+            $chunks++;
+            foreach my $type ( keys %{$schedule->{$period}{$offset}} )
+            {
+                for( my $i = 0; $i < ($lcm / $period); $i++ )
+                {
+                    $cp{$i * $period + $offset}{'col'}{$type} +=
+                        $schedule->{$period}{$offset}{$type};
+                }
+            }
+        }
+    }
+    printf("Number of chunks: %d \n\n", $chunks );
+
+    # calculate interval lengths
+
+    my $previous;
+    my $first;
+    foreach my $time ( sort { $a <=> $b } keys %cp )
+    {
+        if( not defined($first) )
+        {
+            $first = $time;
+        }
+        else
+        {
+            $cp{$previous}{'endtime'} = $time;
+        }
+        $previous = $time;
+    }
+    $cp{$previous}{'endtime'} = $lcm + $first;
+
+    # print results
+
+    thinLine();
+    printf("%-10s%-10s%-20s%-10s\n",
+           'Offset', 'Interval', 'Type', 'Data');
+    printf("%-10s%-10s%-20s%-10s\n",
+           '(sec)', '(sec)', '', 'sources');
+    thinLine();
+
+    foreach my $time ( sort { $a <=> $b } keys %cp )
+    {
+        foreach my $type ( keys %{$cp{$time}{'col'}} )
+        {
+            printf("%-10d%-10d%-20s%-10d\n",
+                   $time,
+                   $cp{$time}{'endtime'} - $time,
+                   $type,
+                   $cp{$time}{'col'}{$type} );
+        }
+    }
+    thinLine();
+    printf("\n");
+}
+
+
+sub thickLine
+{
+    foreach my $i ( 1..75 )
+    {
+        print '=';
+    }
+    print "\n";
+}
+
+sub thinLine
+{
+    foreach my $i ( 1..70 )
+    {
+        print '-';
+    }
+    print "\n";
+}
+
+
+
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/snmpfailures.in b/torrus/bin/snmpfailures.in
new file mode 100644 (file)
index 0000000..f46cc2d
--- /dev/null
@@ -0,0 +1,98 @@
+#!@PERL@ -w
+#  Copyright (C) 2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: snmpfailures.in,v 1.1 2010-12-27 00:04:03 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use Getopt::Long;
+use JSON;
+    
+use Torrus::SiteConfig;
+use Torrus::DB;
+use Torrus::Log;
+use Torrus::SNMP_Failures;
+
+exit(1) if not Torrus::SiteConfig::verify();
+
+
+my $tree;
+my $print_details;
+
+my $help_needed;
+
+
+my $ok = GetOptions('tree=s'      => \$tree,
+                    'details'     => \$print_details,
+                    'help'        => \$help_needed);
+
+if( not $ok or not $tree or
+    $help_needed or scalar(@ARGV) > 0 )
+{
+    print STDERR "Usage: $0 --tree=NAME [options...]\n",
+    "Options:\n",
+    "  --tree=NAME      tree name\n",
+    "  --details        print failure details\n",
+    "  --help           this help message\n";
+    exit 1;
+}
+
+
+if( not Torrus::SiteConfig::treeExists( $tree ) )
+{
+    Error('Tree ' . $tree . ' does not exist');
+    exit 1;
+}
+
+
+my $out = {};
+
+&Torrus::DB::setSafeSignalHandlers();
+
+my $nInstances = Torrus::SiteConfig::collectorInstances( $tree );
+for( my $instance = 0; $instance < $nInstances; $instance++ )
+{
+    my $db_failures = new Torrus::SNMP_Failures( -Tree => $tree,
+                                                 -Instance => $instance );
+    
+    if( not defined( $db_failures ) )
+    {
+        exit(1);
+    }
+    
+    
+    $db_failures->read( $out, -details => $print_details );
+    undef $db_failures;
+}
+
+
+my $json = new JSON;
+$json->canonical();
+$json->pretty();
+print $json->encode($out);
+
+
+exit(0);
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/srvderive.in b/torrus/bin/srvderive.in
new file mode 100644 (file)
index 0000000..1774917
--- /dev/null
@@ -0,0 +1,371 @@
+#!@PERL@
+#  Copyright (C) 2008  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: srvderive.in,v 1.1 2010-12-27 00:04:02 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Combine SUM or MAX from several service IDs and create a new one
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use POSIX qw(floor);
+use Getopt::Long;
+use Date::Parse;
+use Date::Format;
+use Math::BigFloat;
+
+use Torrus::Log;
+use Torrus::ServiceID;
+use Torrus::SQL::SrvExport;
+
+my $startdate;
+my $enddate;
+my $onemonth;
+
+my $function;
+my @input;
+my $output;
+
+my $step = 300;
+
+my $debug;
+my $verbose;
+my $help_needed;
+
+my %known_functions = ('MAX' => \&function_max, 'SUM' => \&function_sum);
+
+
+my $ok = GetOptions(
+                    'start=s'      => \$startdate,
+                    'end=s'        => \$enddate,
+                    'month'        => \$onemonth,
+                    'func=s'       => \$function,
+                    'in=s'         => \@input,
+                    'out=s'        => \$output,
+                    'step=i'       => \$step,
+                    'verbose'      => \$verbose,
+                    'debug'        => \$debug,
+                    'help'         => \$help_needed,
+                    );
+
+if( $help_needed or not $ok or (not $startdate) or
+    (defined($enddate) + defined($onemonth) != 1) or
+    not $function or
+    (scalar(@input) < 2 and scalar( @ARGV ) < 2) or
+    not $output )
+{
+    print STDERR "Usage: $0 TIMESPAN OUTPUT FUNCTION SOURCES...\n\n",
+    "TIMESPAN:\n",
+    "  --start=YYYY-MM-DD   [mandatory] Start date\n",
+    "  --month              [optional] Calendar month timespan\n",
+    "  --end=YYYY-MM-DD     [optional] Next day after the timespan end\n",
+    "  Either --month or --end option must be defined\n\n",
+    "OUTPUT:\n",    
+    "  --out=SERVICEID      [mandatory] Output Service ID\n\n",
+    "FUNCTION:\n",
+    "  --func=MAX|SUM       [mandatory] Aggregation function\n\n",
+    "SOURCES:\n",
+    "  Either --in=SERVICEID, or Service ID names as command line ",
+    "arguments.\n",
+    "  Minimum 2 sources required\n\n",
+    "Options:\n",
+    " --step=N              [300] service data interval\n",
+    " --verbose             print extra information\n",
+    " --debug               print debugging information\n",   
+    " --help                print usage information\n",   
+    "\n";
+    
+    exit 1;
+}
+
+push(@input, @ARGV);
+
+if( not defined($known_functions{$function}) )
+{
+    printf STDERR ("Unknown function: %s. Must be onne of: %s\n",
+                   $function, join(', ', sort keys %known_functions));
+    exit 1;
+}
+
+
+
+if( $debug )
+{
+    Torrus::Log::setLevel('debug');
+}
+elsif( $verbose )
+{
+    Torrus::Log::setLevel('verbose');
+}
+
+
+my $starttime = str2time( $startdate );
+if( not defined($starttime) )
+{
+    Error('Cannot parse start date: ' . $startdate);
+    exit 1;
+}
+
+# Canonize the date
+$startdate = time2str('%Y-%m-%d', $starttime);
+
+my $endtime;
+
+if( defined($enddate) )
+{
+    $endtime = str2time( $startdate ); 
+    if( not defined($endtime) )
+    {
+        Error('Cannot parse end date: ' . $enddate);
+        exit 1;
+    }
+
+    if( $endtime < $starttime )
+    {
+        Error('End date is earlier than start date');
+        exit 1;
+    }        
+}
+else
+{
+    # Calculate +1 calendar month
+
+    my ($ss,$mm,$hh,$day,$month,$year,$zone) =
+        strptime( $startdate );
+    $year += 1900;
+    $month++;
+    $day++;
+  
+    my $endyear = $year;
+    my $endmonth = $month + 1;
+    
+    if( $endmonth > 12 )
+    {
+        $endmonth = 1;
+        $endyear++;
+    }
+
+    $endtime = str2time( sprintf('%.4d-%.2d-%.2d',
+                                 $endyear, $endmonth, $day) );
+    if( not defined($endtime) )
+    {
+        # oops, it was past the end of the month
+        $day++;
+        $endmonth++;
+        if( $endmonth > 12 )
+        {
+            $endmonth = 1;
+            $endyear++;
+        }
+        
+        $endtime = str2time( sprintf('%.4d-%.2d-%.2d',
+                                     $endyear, $endmonth, $day) );
+        
+        if( not defined($endtime) )
+        {
+            Error('Cannot determine the end date');
+            exit 1;
+        }
+    }
+}
+
+# Canonize the date
+$enddate = time2str('%Y-%m-%d', $endtime);
+
+
+Verbose('Start time: ', scalar(localtime($starttime)));
+Verbose('End time: ', scalar(localtime($endtime)));
+
+my $srvExp = Torrus::SQL::SrvExport->new();
+if( not defined( $srvExp ) )
+{
+    Error('Cannot connect to the SQL database');
+    exit 1;
+}
+
+my $srvIDs = $srvExp->getServiceIDs();
+
+foreach my $serviceid ( @input )
+{
+    if( not grep {$serviceid eq $_} @{$srvIDs} )
+    {
+        Error('Input service ID not found in the database: ' . $serviceid);
+        exit 1;
+    }
+}
+
+&Torrus::DB::setSafeSignalHandlers();
+
+# Check if the output ServiceID exists in the local database
+# The database contains only IDs generated from datasource trees.
+
+my $srvIDParams = new Torrus::ServiceID();
+if( $srvIDParams->idExists( $output ) )
+{
+    Error('Output service ID was previously created from Torrus ' .
+          'datasource tree. Cannot override it: ' . $output);
+    exit 1;
+}
+&Torrus::DB::cleanupEnvironment();
+&Torrus::DB::setUnsafeSignalHandlers();
+
+
+my %in_data;
+
+foreach my $serviceid ( @input )
+{
+    $in_data{$serviceid} =
+        $srvExp->getIntervalData( $startdate, $enddate, $serviceid );
+
+    Verbose(sprintf('Loaded %d rows of data for %s',
+                    scalar( @{$in_data{$serviceid}} ),
+                    $serviceid));
+}
+
+my $n_points = floor( ($endtime - $starttime) / $step );
+
+my %aligned_data;
+
+foreach my $serviceid ( @input )
+{
+    my @aligned = ();
+    $#aligned = $n_points;
+
+    # Fill in the aligned array. For each interval by modulo(step),
+    # we take the sum of values that get into that interval
+    
+    foreach my $row ( @{$in_data{$serviceid}} )
+    {
+        my $rowtime = str2time( $row->{'srv_date'} . 'T' .
+                                $row->{'srv_time'} );
+        
+        my $pos = floor( ($rowtime - $starttime) / $step );
+        my $value = Math::BigFloat->new( $row->{'value'} );
+        if( $value->is_nan() )
+        {
+            $value->bzero();
+        }
+            
+        if( not defined($aligned[$pos]))
+        {
+            $aligned[$pos] = $value;
+        }
+        else
+        {
+            $aligned[$pos]->badd($value);
+        }
+    }
+
+    $aligned_data{$serviceid} = \@aligned;
+}
+    
+Verbose(sprintf('Aligned data into %d intervals', $n_points));
+
+# Store the derived data
+my $dbh = Torrus::SQL::SrvExport->dbh();
+if( not defined( $dbh ) )
+{
+    Error('Lost SQL connection');
+    exit 1;
+}
+
+my $sth = $dbh->prepare( Torrus::SQL::SrvExport->sqlInsertStatement() );
+if( not defined( $sth ) )
+{
+    Error('Error preparing the SQL statement: ' . $dbh->errstr);
+}
+
+
+
+for( my $pos = 0; $pos < $n_points; $pos++ )
+{
+    my @args;
+    foreach my $serviceid ( @input )
+    {
+        my $val = $aligned_data{$serviceid}->[$pos];
+        if( defined( $val ) )
+        {
+            push( @args, $val );
+        }
+    }
+
+    if( scalar( @args ) > 0 )
+    {
+        my $value = &{$known_functions{$function}}(@args);
+
+        my $timestamp = $starttime + $pos * $step;
+        my $datestr = time2str('%Y-%m-%d', $timestamp);
+        my $timestr = time2str('%H:%M:%S', $timestamp);
+        
+        if( isDebug() )
+        {
+            Debug('Updating SQL database: ' .
+                  join(', ', $datestr, $timestr,
+                       $output, $value, $step ));
+        }
+    
+        if( not $sth->execute( $datestr, $timestr,
+                               $output, $value, $step ) )
+        {
+            Error('Error executing SQL: ' . $dbh->errstr);
+            exit 1;
+        }
+    }
+}
+
+Verbose('Database update finished');
+
+exit($ok ? 0:1);
+
+
+sub function_max
+{
+    my $value = Math::BigFloat->new();
+    $value->binf('-');
+
+    foreach my $a ( @_ )
+    {
+        if( $value->bcmp($a) < 0 )
+        {
+            $value = Math::BigFloat->new($a);
+        }
+    }
+
+    return $value;
+}
+
+
+sub function_sum
+{
+    my $value = Math::BigFloat->new(0);
+
+    foreach my $a ( @_ )
+    {
+        $value->badd($a);
+    }
+
+    return $value;
+}
+    
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/torrus.fcgi.in b/torrus/bin/torrus.fcgi.in
new file mode 100644 (file)
index 0000000..fc6ee41
--- /dev/null
@@ -0,0 +1,50 @@
+#!@PERL@ -w
+#  Copyright (C) 2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus.fcgi.in,v 1.1 2010-12-27 00:04:02 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# FastCGI handler
+# Can be used as alternative to mod_perl in Apache
+# Can also be used with lighttpd
+
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use strict;
+use CGI::Fast;
+use Torrus::Log;
+use Torrus::CGI;
+
+
+if( $Torrus::Renderer::globalDebug )
+{
+    &Torrus::Log::setLevel('debug');
+}
+
+
+while( my $q = new CGI::Fast )
+{
+    Torrus::CGI->process($q);
+}
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/torrus.in b/torrus/bin/torrus.in
new file mode 100644 (file)
index 0000000..7c5118c
--- /dev/null
@@ -0,0 +1,76 @@
+#!@SHELL@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus.in,v 1.1 2010-12-27 00:04:00 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+# CLI wrapper for Torrus utilities
+
+cmd=$1
+
+commands="acl=acledit acledit=acledit \
+          bs=buildsearchdb buildsearchdb=buildsearchdb \
+          cleanup=cleanup \
+          clc=clearcache clearcache=clearcache \
+          collector=collector \
+          compile=compilexml compilexml=compilexml \
+          configinfo=configinfo ci=configinfo \
+          snapshot=configsnapshot configsnapshot=configsnapshot \
+          dd=devdiscover discover=devdiscover devdiscover=devdiscover \
+          fm=flushmonitors flushmonitors=flushmonitors \
+          genddx=genddx \
+          genlist=genlist \
+          genreport=genreport report=genreport \
+          install_plugin=install_plugin \
+          monitor=monitor \
+          nodeid=nodeid ni=nodeid \
+          rrddir=rrddir2xml rrddir2xml=rrddir2xml \
+          schedulerinfo=schedulerinfo si=schedulerinfo \
+          snmpfailures=snmpfailures failures=snmpfailures \
+          srvderive=srvderive derive=srvderive \
+          ttproclist=ttproclist"
+
+for f in `ls -1 @plugwrapperdir@`; do
+  . @plugwrapperdir@/${f}
+done
+
+for pair in ${commands}; do
+  eval execcmd_${pair}
+done
+
+eval expanded_cmd='${execcmd_'${cmd}'}'
+
+
+if test ${expanded_cmd:-no} = no; then
+  echo "Usage: $0 cmd [options...]" 1>&2
+  echo "   cmd is one of:" 1>&2
+  for pair in ${commands}; do
+    eval `echo ${pair} | sed -e 's/=.*//' -e 's/^/a=/'`
+    echo "     "${a}
+  done
+else
+    shift
+    @pkgbindir@/${expanded_cmd} "$@"
+fi
+
+
+# Local Variables:
+# mode: shell-script
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/bin/ttproclist.in b/torrus/bin/ttproclist.in
new file mode 100644 (file)
index 0000000..614cdd6
--- /dev/null
@@ -0,0 +1,135 @@
+#!@PERL@
+#  Copyright (C) 2005  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: ttproclist.in,v 1.1 2010-12-27 00:04:03 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+use strict;
+use Template;
+use Getopt::Long;
+
+my $template;
+my $outfile;
+my $nodelist;
+my $parameters;
+
+
+my $creator = "Torrus version @VERSION@\n" .
+    "This file was generated by command:\n" .
+    $0 . " \\\n";
+foreach my $arg ( @ARGV )
+{
+    if( $arg =~ /^--/ )
+    {
+        $creator .= ' ' . $arg . ' ';
+    }
+    else
+    {
+        $creator .= "\'" . $arg . "\'\\\n";
+    }
+}
+$creator .= "\nOn " . scalar(localtime(time));
+
+
+my $ok = GetOptions( 'tmpl=s'   => \$template,
+                     'out=s'    => \$outfile,
+                     'nodes=s'  => \$nodelist,
+                     'param=s'  => \$parameters );
+
+if( not $ok or not $template or not $outfile or not $nodelist)
+{
+    print STDERR "Process a template with a nodelist\n\n";
+
+    print STDERR "Usage: $0 options...\n",
+    "Mandatory options:\n",
+    " --tmpl=filename                 template file name\n",
+    " --out=filename                  output file\n",
+    " --nodes=filename                file with nodes\n",
+    "Options:\n",
+    " --param=NAME:VALUE,NAME:VALUE...  parameters passed to template\n";
+    exit 1;
+}
+
+my @rawnodes;
+
+if( not open( NODES, $nodelist ) )
+{
+    print STDERR "Cannot open $nodelist: $!\n";
+    exit 1;
+}
+while(<NODES>)
+{
+    s/^\s+//;
+    s/\s+$//;
+    push( @rawnodes, split( /\s+/ ) );
+}
+close( NODES );
+
+my %nodes;
+foreach my $node ( @rawnodes )
+{
+    my $symname = $node;
+    if( $node =~ /([^:]+):(.+)/ )
+    {
+        $node = $1;
+        $symname = $2;
+    }
+
+    $nodes{$node} = $symname;
+}
+
+my %params;
+if( defined( $parameters ) )
+{
+    foreach my $pair ( split( '\s*,\s*', $parameters ) )
+    {
+        my ($name, $val) = split( '\s*:\s*', $pair );
+        $params{$name} = $val;
+    }
+}
+
+my $tt = new Template( INCLUDE_PATH => '@tmpluserdir@',
+                       ABSOLUTE => 1,
+                       RELATIVE => 1,
+                       TRIM => 1 );
+
+my $vars =
+{
+    'nodes'   => \%nodes,
+    'param'   => \%params,
+    'nodesfile' => $nodelist,
+    'creator' => $creator,
+    'lc' => sub{ return lc $_[0] },
+    'uc' => sub{ return uc $_[0] }
+};
+
+my $result = $tt->process($template, $vars, $outfile);
+
+if( not $result )
+{
+    print STDERR "Error while processing template: ".$tt->error()."\n";
+}
+
+exit( $result ? 0:1 );
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/configs/Makefile.am b/torrus/configs/Makefile.am
new file mode 100644 (file)
index 0000000..2b10a7c
--- /dev/null
@@ -0,0 +1,52 @@
+
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.am,v 1.1 2010-12-27 00:04:41 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+EXTRA_DIST = \
+       devdiscover-config.pl \
+       devdiscover-siteconfig.pl \
+       email-siteconfig.pl \
+       initscript.conf \
+       notify-siteconfig.pl \
+       snmptrap-siteconfig.pl \
+       torrus-config.pl \
+       torrus-siteconfig.pl \
+       webmux.pl \
+       webmux2.pl
+
+DISTCLEANFILES = instvars
+
+instvarsdir = $(cfgdefdir)
+nodist_instvars_DATA = instvars
+
+install-data-local:
+       $(mkinstalldirs) $(DESTDIR)$(cfgdefdir) $(DESTDIR)$(siteconfdir)
+       for f in initscript.conf devdiscover-config.pl torrus-config.pl \
+               webmux.pl webmux2.pl; do \
+         @abs_top_builddir@/setup_tools/substvars.sh $$f > \
+               $(DESTDIR)$(cfgdefdir)/$$f; \
+       done
+       for f in devdiscover-siteconfig.pl email-siteconfig.pl \
+                notify-siteconfig.pl \
+                snmptrap-siteconfig.pl torrus-siteconfig.pl; do \
+         if test ! -r $(DESTDIR)$(siteconfdir)/$$f; then \
+           $(INSTALL_DATA) $$f $(DESTDIR)$(siteconfdir)/$$f; \
+         fi \
+       done
diff --git a/torrus/configs/Makefile.in b/torrus/configs/Makefile.in
new file mode 100644 (file)
index 0000000..a3c979e
--- /dev/null
@@ -0,0 +1,399 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.in,v 1.1 2010-12-27 00:04:41 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = configs
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(instvarsdir)"
+nodist_instvarsDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(nodist_instvars_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+FIND = @FIND@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KILL = @KILL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERLINC = @PERLINC@
+POD2MAN = @POD2MAN@
+POD2MAN_PRESENT_FALSE = @POD2MAN_PRESENT_FALSE@
+POD2MAN_PRESENT_TRUE = @POD2MAN_PRESENT_TRUE@
+POD2TEXT = @POD2TEXT@
+POD2TEXT_PRESENT_FALSE = @POD2TEXT_PRESENT_FALSE@
+POD2TEXT_PRESENT_TRUE = @POD2TEXT_PRESENT_TRUE@
+RM = @RM@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SLEEP = @SLEEP@
+STRIP = @STRIP@
+SU = @SU@
+VERSION = @VERSION@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+cachedir = @cachedir@
+cfgdefdir = @cfgdefdir@
+datadir = @datadir@
+dbhome = @dbhome@
+defrrddir = @defrrddir@
+distxmldir = @distxmldir@
+enable_pkgonly = @enable_pkgonly@
+enable_varperm = @enable_varperm@
+exec_prefix = @exec_prefix@
+exmpdir = @exmpdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mansec_misc = @mansec_misc@
+mansec_usercmd = @mansec_usercmd@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+perlithreads = @perlithreads@
+perllibdir = @perllibdir@
+perllibdirs = @perllibdirs@
+piddir = @piddir@
+pkgbindir = @pkgbindir@
+pkgdocdir = @pkgdocdir@
+pkghome = @pkghome@
+plugdevdisccfgdir = @plugdevdisccfgdir@
+pluginsdir = @pluginsdir@
+plugtorruscfgdir = @plugtorruscfgdir@
+plugwrapperdir = @plugwrapperdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+reportsdir = @reportsdir@
+sbindir = @sbindir@
+scriptsdir = @scriptsdir@
+seslockdir = @seslockdir@
+sesstordir = @sesstordir@
+sharedstatedir = @sharedstatedir@
+siteconfdir = @siteconfdir@
+sitedir = @sitedir@
+sitexmldir = @sitexmldir@
+supdir = @supdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+tmpldir = @tmpldir@
+tmpluserdir = @tmpluserdir@
+torrus_user = @torrus_user@
+var_group = @var_group@
+var_mode = @var_mode@
+var_user = @var_user@
+varprefix = @varprefix@
+webplaindir = @webplaindir@
+webscriptsdir = @webscriptsdir@
+wrapperdir = @wrapperdir@
+EXTRA_DIST = \
+       devdiscover-config.pl \
+       devdiscover-siteconfig.pl \
+       email-siteconfig.pl \
+       initscript.conf \
+       notify-siteconfig.pl \
+       snmptrap-siteconfig.pl \
+       torrus-config.pl \
+       torrus-siteconfig.pl \
+       webmux.pl \
+       webmux2.pl
+
+DISTCLEANFILES = instvars
+instvarsdir = $(cfgdefdir)
+nodist_instvars_DATA = instvars
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  configs/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  configs/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+install-nodist_instvarsDATA: $(nodist_instvars_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(instvarsdir)" || $(mkdir_p) "$(DESTDIR)$(instvarsdir)"
+       @list='$(nodist_instvars_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(nodist_instvarsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(instvarsdir)/$$f'"; \
+         $(nodist_instvarsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(instvarsdir)/$$f"; \
+       done
+
+uninstall-nodist_instvarsDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(nodist_instvars_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(instvarsdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(instvarsdir)/$$f"; \
+       done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+       for dir in "$(DESTDIR)$(instvarsdir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local install-nodist_instvarsDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-nodist_instvarsDATA
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+       distclean-generic distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am \
+       install-data-local install-exec install-exec-am install-info \
+       install-info-am install-man install-nodist_instvarsDATA \
+       install-strip installcheck installcheck-am installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
+       uninstall-info-am uninstall-nodist_instvarsDATA
+
+
+install-data-local:
+       $(mkinstalldirs) $(DESTDIR)$(cfgdefdir) $(DESTDIR)$(siteconfdir)
+       for f in initscript.conf devdiscover-config.pl torrus-config.pl \
+               webmux.pl webmux2.pl; do \
+         @abs_top_builddir@/setup_tools/substvars.sh $$f > \
+               $(DESTDIR)$(cfgdefdir)/$$f; \
+       done
+       for f in devdiscover-siteconfig.pl email-siteconfig.pl \
+                notify-siteconfig.pl \
+                snmptrap-siteconfig.pl torrus-siteconfig.pl; do \
+         if test ! -r $(DESTDIR)$(siteconfdir)/$$f; then \
+           $(INSTALL_DATA) $$f $(DESTDIR)$(siteconfdir)/$$f; \
+         fi \
+       done
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/torrus/configs/devdiscover-config.pl b/torrus/configs/devdiscover-config.pl
new file mode 100644 (file)
index 0000000..34c6dd2
--- /dev/null
@@ -0,0 +1,1430 @@
+#  Copyright (C) 2003  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: devdiscover-config.pl,v 1.1 2010-12-27 00:04:42 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+# DO NOT EDIT THIS FILE!
+
+# Torrus Device Discovery local configuration.
+# Put all your local settings into devdiscover-siteconfig.pl
+
+use lib(@perllibdirs@);
+
+$Torrus::Global::version        = '@VERSION@';
+$Torrus::Global::discoveryDir   = '@sitedir@/discovery/';
+$Torrus::Global::siteXmlDir     = '@sitexmldir@';
+
+$Torrus::Global::threadsEnabled  = '@perlithreads@';
+
+$Torrus::DevDiscover::timeFormat = '%d-%m-%Y %H:%M';
+
+
+@Torrus::DevDiscover::loadModules =
+    (
+     'Torrus::DevDiscover::RFC1628_UPS_MIB',
+     'Torrus::DevDiscover::RFC1657_BGP4_MIB',
+     'Torrus::DevDiscover::RFC2011_IP_MIB',
+     'Torrus::DevDiscover::RFC2863_IF_MIB',
+     'Torrus::DevDiscover::RFC2662_ADSL_LINE', # needs testing
+     'Torrus::DevDiscover::RFC2670_DOCS_IF',
+     'Torrus::DevDiscover::RFC2737_ENTITY_MIB',
+     'Torrus::DevDiscover::RFC2790_HOST_RESOURCES',
+     'Torrus::DevDiscover::Alteon',
+     'Torrus::DevDiscover::ALU_Timetra',
+     'Torrus::DevDiscover::AlliedTelesyn_PBC18',
+     'Torrus::DevDiscover::Apple_AE',
+     'Torrus::DevDiscover::Arbor_E',
+     'Torrus::DevDiscover::Arista',
+     'Torrus::DevDiscover::AscendMax',
+     'Torrus::DevDiscover::ATMEL',
+     'Torrus::DevDiscover::AxxessIT',
+     'Torrus::DevDiscover::BetterNetworks',
+     'Torrus::DevDiscover::CasaCMTS',
+     'Torrus::DevDiscover::CiscoCatOS',
+     'Torrus::DevDiscover::CiscoFirewall',
+     'Torrus::DevDiscover::CiscoGeneric',
+     'Torrus::DevDiscover::CiscoIOS',
+     'Torrus::DevDiscover::CiscoIOS_Docsis',
+     'Torrus::DevDiscover::CiscoIOS_MacAccounting',
+     'Torrus::DevDiscover::CiscoIOS_SAA',
+     'Torrus::DevDiscover::CiscoSCE',
+     'Torrus::DevDiscover::CiscoVDSL',
+     'Torrus::DevDiscover::CompaqCIM',
+     'Torrus::DevDiscover::EmpireSystemedge',
+     'Torrus::DevDiscover::F5BigIp',
+     'Torrus::DevDiscover::Foundry',
+     'Torrus::DevDiscover::FTOS',
+     'Torrus::DevDiscover::Jacarta',
+     'Torrus::DevDiscover::JunOS',
+     'Torrus::DevDiscover::Liebert',
+     'Torrus::DevDiscover::MicrosoftWindows',
+     'Torrus::DevDiscover::MotorolaBSR',
+     'Torrus::DevDiscover::NetApp',
+     'Torrus::DevDiscover::NetScreen',
+     'Torrus::DevDiscover::NetBotz',
+     'Torrus::DevDiscover::OracleDatabase',
+     'Torrus::DevDiscover::Paradyne',          # needs testing
+     'Torrus::DevDiscover::RFC1697_RDBMS',
+     'Torrus::DevDiscover::Symmetricom',
+     'Torrus::DevDiscover::UcdSnmp',
+     'Torrus::DevDiscover::Xylan'
+     );
+
+
+
+# Template name and source file for each template referenced in discovery
+# modules
+
+%Torrus::ConfigBuilder::templateRegistry =
+    (
+     ####  SNMP defaults
+     '::holt-winters-defaults' => {
+         'name'   => 'holt-winters-defaults',
+         'source' => 'snmp-defs.xml'
+         },
+     '::snmp-defaults' => {
+         'name'   => 'snmp-defaults',
+         'source' => 'snmp-defs.xml'
+         },
+     '::viewonly-defaults' => {
+         'name'   => 'viewonly-defaults',
+         'source' => 'snmp-defs.xml'
+         },
+
+     #### CDef Collector defaults
+     '::cdef-collector-defaults' => {
+         'name'   => 'cdef-collector-defaults',
+         'source' => 'cdef-collector-defs.xml'
+         },
+
+     #### UPS-MIB
+     'RFC1628_UPS_MIB::battery-subtree' => {
+         'name'   => 'battery-subtree',
+         'source' => 'generic/rfc1628.ups.xml'
+         },
+     'RFC1628_UPS_MIB::ups-input-subtree' => {
+         'name'   => 'ups-input-subtree',
+         'source' => 'generic/rfc1628.ups.xml'
+         },
+     'RFC1628_UPS::ups-input-leaf' => {
+         'name'   => 'ups-input-leaf',
+         'source' => 'generic/rfc1628.ups.xml'
+         },
+     'RFC1628_UPS_MIB::ups-output-subtree' => {
+         'name'   => 'ups-output-subtree',
+         'source' => 'generic/rfc1628.ups.xml'
+         },
+     'RFC1628_UPS::ups-output-leaf' => {
+         'name'   => 'ups-output-leaf',
+         'source' => 'generic/rfc1628.ups.xml'
+         },
+     'RFC1628_UPS_MIB::ups-bypass-subtree' => {
+         'name'   => 'ups-bypass-subtree',
+         'source' => 'generic/rfc1628.ups.xml'
+         },
+     'RFC1628_UPS::ups-bypass-leaf' => {
+         'name'   => 'ups-bypass-leaf',
+         'source' => 'generic/rfc1628.ups.xml'
+         },
+
+     #### IF-MIB
+     'RFC2863_IF_MIB::rfc2863-ifmib-hostlevel' => {
+         'name'   => 'rfc2863-ifmib-hostlevel',
+         'source' => 'generic/rfc2863.if-mib.xml'
+         },
+     'RFC2863_IF_MIB::rfc2863-ifmib-subtree' => {
+         'name'   => 'rfc2863-ifmib-subtree',
+         'source' => 'generic/rfc2863.if-mib.xml'
+         },
+     'RFC2863_IF_MIB::iftable-octets' => {
+         'name'   => 'iftable-octets',
+         'source' => 'generic/rfc2863.if-mib.xml'
+         },
+     'RFC2863_IF_MIB::iftable-ucast-packets' => {
+         'name'   => 'iftable-ucast-packets',
+         'source' => 'generic/rfc2863.if-mib.xml'
+         },
+     'RFC2863_IF_MIB::iftable-discards-in' => {
+         'name'   => 'iftable-discards-in',
+         'source' => 'generic/rfc2863.if-mib.xml'
+         },
+     'RFC2863_IF_MIB::iftable-discards-out' => {
+         'name'   => 'iftable-discards-out',
+         'source' => 'generic/rfc2863.if-mib.xml'
+         },
+     'RFC2863_IF_MIB::iftable-errors-in' => {
+         'name'   => 'iftable-errors-in',
+         'source' => 'generic/rfc2863.if-mib.xml'
+         },
+     'RFC2863_IF_MIB::iftable-errors-out' => {
+         'name'   => 'iftable-errors-out',
+         'source' => 'generic/rfc2863.if-mib.xml'
+         },
+     'RFC2863_IF_MIB::ifxtable-hcoctets' => {
+         'name'   => 'ifxtable-hcoctets',
+         'source' => 'generic/rfc2863.if-mib.xml'
+         },
+     'RFC2863_IF_MIB::ifxtable-hcucast-packets' => {
+         'name'   => 'ifxtable-hcucast-packets',
+         'source' => 'generic/rfc2863.if-mib.xml'
+         },
+     'RFC2863_IF_MIB::interface-bandwidth-usage' => {
+         'name'   => 'interface-bandwidth-usage',
+         'source' => 'generic/rfc2863.if-mib.xml'
+         },
+
+     #### RDBMS MIB
+     'RFC1697_RDBMS::rdbms-dbtable' => {
+         'name'     => 'rdbms-dbtable',
+         'source'   => 'generic/rfc1697.rdbms.xml',
+     },
+     
+     #### DOCSIS MIB
+     'RFC2670_DOCS_IF::docsis-downstream-subtree' => {
+         'name'   => 'docsis-downstream-subtree',
+         'source' => 'generic/rfc2670.docsis-if.xml'
+         },
+     'RFC2670_DOCS_IF::docsis-downstream-util' => {
+         'name'   => 'docsis-downstream-util',
+         'source' => 'generic/rfc2670.docsis-if.xml'
+         },
+     'RFC2670_DOCS_IF::docsis-upstream-subtree' => {
+         'name'   => 'docsis-upstream-subtree',
+         'source' => 'generic/rfc2670.docsis-if.xml'
+         },
+     'RFC2670_DOCS_IF::docsis-upstream-stats' => {
+         'name'   => 'docsis-upstream-stats',
+         'source' => 'generic/rfc2670.docsis-if.xml'
+         },
+
+     #### RFC2790_HOST_RESOURCES
+     'RFC2790_HOST_RESOURCES::hr-system-performance-subtree' => {
+         'name'   => 'hr-system-performance-subtree',
+         'source' => 'generic/rfc2790.host-resources.xml'
+         },
+     'RFC2790_HOST_RESOURCES::hr-system-uptime' => {
+         'name'   => 'hr-system-uptime',
+         'source' => 'generic/rfc2790.host-resources.xml'
+         },
+     'RFC2790_HOST_RESOURCES::hr-system-num-users' => {
+         'name'   => 'hr-system-num-users',
+         'source' => 'generic/rfc2790.host-resources.xml'
+         },
+     'RFC2790_HOST_RESOURCES::hr-system-processes' => {
+         'name'   => 'hr-system-processes',
+         'source' => 'generic/rfc2790.host-resources.xml'
+         },
+     'RFC2790_HOST_RESOURCES::hr-storage-subtree' => {
+         'name'   => 'hr-storage-subtree',
+         'source' => 'generic/rfc2790.host-resources.xml'
+         },
+     'RFC2790_HOST_RESOURCES::hr-storage-usage' => {
+         'name'   => 'hr-storage-usage',
+         'source' => 'generic/rfc2790.host-resources.xml'
+         },
+
+     #### ADSL-LINE-MIB
+     'RFC2662_ADSL_LINE::adsl-line-interface' => {
+         'name'   => 'adsl-line-interface',
+         'source' => 'generic/rfc2662.adsl-line.xml'
+         },
+
+     #### Alteon application switches
+     'Alteon::alteon-cpu' => {
+         'name'   => 'alteon-cpu',
+         'source' => 'vendor/alteon.xml'
+         },     
+     'Alteon::alteon-mem' => {
+         'name'   => 'alteon-mem',
+         'source' => 'vendor/alteon.xml'
+         },     
+     'Alteon::alteon-packets' => {
+         'name'   => 'alteon-packets',
+         'source' => 'vendor/alteon.xml'
+         },     
+     'Alteon::alteon-sensor' => {
+         'name'   => 'alteon-sensor',
+         'source' => 'vendor/alteon.xml'
+         },     
+     'Alteon::alteon-vserver-subtree' => {
+         'name'   => 'alteon-vserver-subtree',
+         'source' => 'vendor/alteon.xml'
+         },     
+     'Alteon::alteon-vserver' => {
+         'name'   => 'alteon-vserver',
+         'source' => 'vendor/alteon.xml'
+         },     
+     'Alteon::alteon-maint-subtree' => {
+         'name'   => 'alteon-maint-subtree',
+         'source' => 'vendor/alteon.xml'
+         },     
+     'Alteon::alteon-maint' => {
+         'name'   => 'alteon-maint',
+         'source' => 'vendor/alteon.xml'
+         },     
+
+     #### Alcatel-Lucent ESS and SR
+     'ALU_Timetra::alu-timetra-customer' => {
+         'name'   => 'alu-timetra-customer',
+         'source' => 'vendor/alu-timetra.xml'
+         },     
+     'ALU_Timetra::alu-timetra-sap' => {
+         'name'   => 'alu-timetra-sap',
+         'source' => 'vendor/alu-timetra.xml'
+         },     
+     
+     #### Apple Airport Extreme
+     'Apple_AE::ae-wireless-clients-subtree' => {
+         'name'   => 'ae-wireless-clients-subtree',
+         'source' => 'vendor/apple.ae.xml'
+         },
+     'Apple_AE::ae-wireless-clients-leaf' => {
+         'name'   => 'ae-wireless-clients-leaf',
+         'source' => 'vendor/apple.ae.xml'
+         },
+     'Apple_AE::ae-global-stats' => {
+         'name'   => 'ae-global-stats',
+         'source' => 'vendor/apple.ae.xml'
+         },
+     
+     #### Arbor Networks E Series
+     'Arbor_E::arbor-bundle-subtree' => {
+         'name'   => 'arbor-bundle-subtree',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::arbor-bundle' => {
+         'name'   => 'arbor-bundle',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::arbor-bundle-deny' => {
+         'name'   => 'arbor-bundle-deny',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::arbor-bundle-pktsize' => {
+         'name'   => 'arbor-bundle-pktsize',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::arbor-bundle-ratelimit' => {
+         'name'   => 'arbor-bundle-ratelimit',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::arbor-bundle-subcount' => {
+         'name'   => 'arbor-bundle-subcount',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::arbor-flowlkup-subtree' => {
+         'name'   => 'arbor-flowlkup-subtree',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::arbor-flowlkup' => {
+         'name'   => 'arbor-flowlkup',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::arbor-flowlkup-leaf' => {
+         'name'   => 'arbor-flowlkup-leaf',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-buffers' => {
+         'name'   => 'e30-buffers',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-bundle-subtree' => {
+         'name'   => 'e30-bundle-subtree',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-bundle' => {
+         'name'   => 'e30-bundle',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-bundle-deny' => {
+         'name'   => 'e30-bundle-deny',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-bundle-ratelimit' => {
+         'name'   => 'e30-bundle-ratelimit',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-cpu' => {
+         'name'   => 'e30-cpu',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-fwdTable' => {
+         'name'   => 'e30-fwdTable',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-fwdTable-login' => {
+         'name'   => 'e30-fwdTable-login',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-hdd-subtree' => {
+         'name'   => 'e30-hdd-subtree',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-hdd' => {
+         'name'   => 'e30-hdd',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-hdd-errors' => {
+         'name'   => 'e30-hdd-errors',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-hdd-logs' => {
+         'name'   => 'e30-hdd-logs',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-l2tp-subtree' => {
+         'name'   => 'e30-l2tp-subtree',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-l2tp' => {
+         'name'   => 'e30-l2tp',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-l2tp-secure-endpoints-subtree' => {
+         'name'   => 'e30-l2tp-secure-endpoints-subtree',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-l2tp-secure-endpoints-leaf' => {
+         'name'   => 'e30-l2tp-secure-endpoints-leaf',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-mem' => {
+         'name'   => 'e30-mem',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-mempool-subtree' => {
+         'name'   => 'e30-mempool-subtree',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-mempool' => {
+         'name'   => 'e30-mempool',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e30-slowpath' => {
+         'name'   => 'e30-slowpath',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e100-cpu-subtree' => {
+         'name'   => 'e100-cpu-subtree',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e100-cpu' => {
+         'name'   => 'e100-cpu',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e100-hdd-subtree' => {
+         'name'   => 'e100-hdd-subtree',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e100-hdd' => {
+         'name'   => 'e100-hdd',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e100-mem-subtree' => {
+         'name'   => 'e100-mem-subtree',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e100-mem' => {
+         'name'   => 'e100-mem',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e100-policymgmt' => {
+         'name'   => 'e100-policymgmt',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e100-submgmt-subtree' => {
+         'name'   => 'e100-submgmt-subtree',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e100-submgmt-state-subtree' => {
+         'name'   => 'e100-submgmt-state-subtree',
+         'source' => 'vendor/arbor_e.xml'
+         },
+     'Arbor_E::e100-submgmt-state' => {
+         'name'   => 'e100-submgmt-state',
+         'source' => 'vendor/arbor_e.xml'
+         },
+
+     #### ATMEL smartbridges
+     'ATMEL::atmel-device-subtree' => {
+         'name'   => 'atmel-device-subtree',
+         'source' => 'vendor/atmel.xml'
+         },
+     'ATMEL::atmel-accesspoint-stats' => {
+         'name'   => 'atmel-accesspoint-stats',
+         'source' => 'vendor/atmel.xml'
+         },
+     'ATMEL::atmel-client-stats' => {
+         'name'   => 'atmel-client-stats',
+         'source' => 'vendor/atmel.xml'
+         },
+
+     #### AscendMax
+     'AscendMax::ascend-totalcalls' => {
+         'name'   => 'ascend-totalcalls',
+         'source' => 'vendor/ascend.max.xml'
+         },
+     'AscendMax::ascend-line-stats' => {
+         'name'   => 'ascend-line-stats',
+         'source' => 'vendor/ascend.max.xml'
+         },
+
+     #### BetterNetworks
+     'BetterNetworks::betternetworks-sensor' => {
+         'name'   => 'betternetworks-sensor',
+         'source' => 'vendor/betternetworks.xml'
+         },
+     
+     #### CASA Systems CMTS
+     'CasaCMTS::casa-docsis-mac-subtree' => {
+         'name'   => 'casa-docsis-mac-subtree',
+         'source' => 'vendor/casa-cmts.xml'
+         },
+     'CasaCMTS::casa-docsis-mac-util' => {
+         'name'   => 'casa-docsis-mac-util',
+         'source' => 'vendor/casa-cmts.xml'
+         },
+     'CasaCMTS::casa-docsis-upstream-util' => {
+         'name'   => 'casa-docsis-upstream-util',
+         'source' => 'vendor/casa-cmts.xml'
+         },
+     'CasaCMTS::casa-docsis-downstream-util' => {
+         'name'   => 'casa-docsis-downstream-util',
+         'source' => 'vendor/casa-cmts.xml'
+         },
+     
+     #### Cisco
+     'CiscoGeneric::cisco-cpu' => {
+         'name'   => 'cisco-cpu',
+         'source' => 'vendor/cisco.generic.xml'
+         },
+     'CiscoGeneric::cisco-cpu-revised' => {
+         'name'   => 'cisco-cpu-revised',
+         'source' => 'vendor/cisco.generic.xml'
+         },
+     'CiscoGeneric::cisco-cpu-usage-subtree' => {
+         'name'   => 'cisco-cpu-usage-subtree',
+         'source' => 'vendor/cisco.generic.xml'
+         },
+     'CiscoGeneric::old-cisco-cpu' => {
+         'name'   => 'old-cisco-cpu',
+         'source' => 'vendor/cisco.generic.xml'
+         },
+     'CiscoGeneric::old-cisco-mempool' => {
+         'name'   => 'cisco-mempool',
+         'source' => 'vendor/cisco.generic.xml'
+         },
+     'CiscoGeneric::cisco-mempool' => {
+         'name'   => 'cisco-mempool',
+         'source' => 'vendor/cisco.generic.xml'
+         },
+     'CiscoGeneric::cisco-enh-mempool' => {
+         'name'   => 'cisco-enh-mempool',
+         'source' => 'vendor/cisco.generic.xml'
+         },
+     'CiscoGeneric::cisco-memusage-subtree' => {
+         'name'   => 'cisco-memusage-subtree',
+         'source' => 'vendor/cisco.generic.xml'
+         },
+     'CiscoGeneric::cisco-temperature-subtree' => {
+         'name'   => 'cisco-temperature-subtree',
+         'source' => 'vendor/cisco.generic.xml'
+         },
+     'CiscoGeneric::cisco-temperature-sensor' => {
+         'name'   => 'cisco-temperature-sensor',
+         'source' => 'vendor/cisco.generic.xml'
+         },
+     'CiscoGeneric::cisco-temperature-sensor-fahrenheit' => {
+         'name'   => 'cisco-temperature-sensor-fahrenheit',
+         'source' => 'vendor/cisco.generic.xml'
+         },
+     'CiscoGeneric::cisco-power-supply' => {
+         'name'   => 'cisco-power-supply',
+         'source' => 'vendor/cisco.generic.xml'
+         },
+     'CiscoIOS::cisco-interface-counters' => {
+         'name'   => 'cisco-interface-counters',
+         'source' => 'vendor/cisco.ios.xml'
+         },
+     'CiscoIOS::old-cisco-memory-buffers' => {
+         'name'   => 'old-cisco-memory-buffers',
+         'source' => 'vendor/cisco.ios.xml'
+         },
+     'CiscoIOS::cisco-ipsec-flow-globals' => {
+         'name'   => 'cisco-ipsec-flow-globals',
+         'source' => 'vendor/cisco.ios.xml'
+         },
+     'CiscoIOS::cisco-bgp' => {
+         'name'   => 'cisco-bgp',
+         'source' => 'vendor/cisco.ios.xml'
+         },
+     'CiscoIOS::cisco-car-subtree' => {
+         'name'   => 'cisco-car-subtree',
+         'source' => 'vendor/cisco.ios.xml'
+         },
+     'CiscoIOS::cisco-car' => {
+         'name'   => 'cisco-car',
+         'source' => 'vendor/cisco.ios.xml'
+         },
+     'CiscoIOS::cisco-vpdn-subtree' => {
+         'name'   => 'cisco-vpdn-subtree',
+         'source' => 'vendor/cisco.ios.xml'
+         },
+     'CiscoIOS::cisco-vpdn-leaf' => {
+         'name'   => 'cisco-vpdn-leaf',
+         'source' => 'vendor/cisco.ios.xml'
+         },
+     'CiscoIOS_Docsis::cisco-docsis-mac-subtree' => {
+         'name'   => 'cisco-docsis-mac-subtree',
+         'source' => 'vendor/cisco.ios.docsis.xml'
+         },
+     'CiscoIOS_Docsis::cisco-docsis-mac-util' => {
+         'name'   => 'cisco-docsis-mac-util',
+         'source' => 'vendor/cisco.ios.docsis.xml'
+         },
+     'CiscoIOS_Docsis::cisco-docsis-upstream-util' => {
+         'name'   => 'cisco-docsis-upstream-util',
+         'source' => 'vendor/cisco.ios.docsis.xml'
+         },
+     'CiscoIOS_MacAccounting::cisco-macacc-subtree' => {
+         'name'   => 'cisco-macacc-subtree',
+         'source' => 'vendor/cisco.ios.mac-accounting.xml'
+         },
+     'CiscoIOS_MacAccounting::cisco-macacc' => {
+         'name'   => 'cisco-macacc',
+         'source' => 'vendor/cisco.ios.mac-accounting.xml'
+         },
+     'CiscoIOS_SAA::cisco-saa-subtree' => {
+         'name'   => 'cisco-saa-subtree',
+         'source' => 'vendor/cisco.ios.xml'
+         },
+     'CiscoIOS_SAA::cisco-rtt-echo-subtree' => {
+         'name'   => 'cisco-rtt-echo-subtree',
+         'source' => 'vendor/cisco.ios.xml'
+         },
+     'CiscoFirewall::cisco-firewall-subtree' => {
+         'name'   => 'cisco-firewall-subtree',
+         'source' => 'vendor/cisco.firewall.xml',
+     },
+     'CiscoFirewall::events' => {
+         'name'   => 'cisco-firewall-events-delta',
+         'source' => 'vendor/cisco.firewall.xml',
+     },
+     'CiscoFirewall::connections' => {
+         'name'   => 'cisco-firewall-connections',
+         'source' => 'vendor/cisco.firewall.xml',
+     },
+
+     'CiscoSCE::cisco-sce-disk' => {
+         'name'   => 'cisco-sce-disk',
+         'source' => 'vendor/cisco.sce.xml',
+     },
+     'CiscoSCE::cisco-sce-subscribers' => {
+         'name'   => 'cisco-sce-subscribers',
+         'source' => 'vendor/cisco.sce.xml',
+     },
+     'CiscoSCE::cisco-sce-tp-subtree' => {
+         'name'   => 'cisco-sce-tp-subtree',
+         'source' => 'vendor/cisco.sce.xml',
+     },
+     'CiscoSCE::cisco-sce-tp' => {
+         'name'   => 'cisco-sce-tp',
+         'source' => 'vendor/cisco.sce.xml',
+     },
+     'CiscoSCE::cisco-sce-rdr' => {
+         'name'   => 'cisco-sce-rdr',
+         'source' => 'vendor/cisco.sce.xml',
+     },
+     'CiscoSCE::cisco-sce-rdr-category' => {
+         'name'   => 'cisco-sce-rdr-category',
+         'source' => 'vendor/cisco.sce.xml',
+     },
+     'CiscoSCE::cisco-sce-rdr-category-subtree' => {
+         'name'   => 'cisco-sce-rdr-category-subtree',
+         'source' => 'vendor/cisco.sce.xml',
+     },
+     'CiscoSCE::cisco-sce-queues-subtree' => {
+         'name'   => 'cisco-sce-queues-subtree',
+         'source' => 'vendor/cisco.sce.xml',
+     },
+     'CiscoSCE::cisco-sce-gc-subtree' => {
+         'name'   => 'cisco-sce-gc-subtree',
+         'source' => 'vendor/cisco.sce.xml',
+     },
+     'CiscoSCE::cisco-sce-gcounter' => {
+         'name'   => 'cisco-sce-gcounter',
+         'source' => 'vendor/cisco.sce.xml',
+     },
+     
+     'CiscoVDSL::cvdsl-subtree' => {
+         'name'   => 'cvdsl-subtree',
+         'source' => 'vendor/cisco.vdsl-line.xml',
+     },
+     'CiscoVDSL::cvdsl-interface' => {
+         'name'   => 'cvdsl-interface',
+         'source' => 'vendor/cisco.vdsl-line.xml',
+     },
+
+     ### Compaq Insite Manager
+     'CompaqCIM::cpq-cim-temperature-sensor' => {
+         'name'     => 'cpq-cim-temperature-sensor',
+         'source'   => 'vendor/compaq.cim.xml',
+     },
+     'CompaqCIM::cpq-cim-corr-mem-errs' => {
+         'name'     => 'cpq-cim-corr-mem-errs',
+         'source'   => 'vendor/compaq.cim.xml',
+     },
+
+     #### Empire Sysedge
+     'EmpireSystemedge::sysedge_opmode' => {
+         'name'      => 'sysedge_opmode',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-memory' => {
+         'name'      => 'empire-memory',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-swap-counters-nt' => {
+         'name'      => 'empire-swap-counters-nt',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-swap-counters-nt40Intel' => {
+         'name'      => 'empire-swap-counters-nt40Intel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-swap-counters-nt50Intel' => {
+         'name'      => 'empire-swap-counters-nt50Intel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-swap-counters-unix' => {
+         'name'      => 'empire-swap-counters-unix',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-swap-counters-solarisSparc' => {
+         'name'      => 'empire-swap-counters-solarisSparc',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-swap-counters-aix5RS6000' => {
+         'name'      => 'empire-swap-counters-aix5RS6000',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-swap-counters-linuxIntel' => {
+         'name'      => 'empire-swap-counters-linuxIntel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-performance' => {
+         'name'      => 'empire-performance',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-device-subtree' => {
+         'name'      => 'empire-device-subtree',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-device' => {
+         'name'      => 'empire-device',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-load' => {
+         'name'      => 'empire-load',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-cpu-subtree' => {
+         'name'      => 'empire-cpu-subtree',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-cpu-nt' => {
+         'name'      => 'empire-cpu-nt',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-cpu-nt40Intel' => {
+         'name'      => 'empire-cpu-nt40Intel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-cpu-nt50Intel' => {
+         'name'      => 'empire-cpu-nt50Intel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-cpu-unix' => {
+         'name'      => 'empire-cpu-unix',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-cpu-solarisSparc' => {
+         'name'      => 'empire-cpu-solarisSparc',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-cpu-aix5RS6000' => {
+         'name'      => 'empire-cpu-aix5RS6000',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-cpu-linuxIntel' => {
+         'name'      => 'empire-cpu-linuxIntel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-total-cpu-nt' => {
+         'name'      => 'empire-total-cpu-nt',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-total-cpu-nt40Intel' => {
+         'name'      => 'empire-total-cpu-nt40Intel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-total-cpu-nt50Intel' => {
+         'name'      => 'empire-total-cpu-nt50Intel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-total-cpu-unix' => {
+         'name'      => 'empire-total-cpu-unix',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-total-cpu-solarisSparc' => {
+         'name'      => 'empire-total-cpu-solarisSparc',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-total-cpu-aix5RS6000' => {
+         'name'      => 'empire-total-cpu-aix5RS6000',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-total-cpu-linuxIntel' => {
+         'name'      => 'empire-total-cpu-linuxIntel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-cpu-raw-unix' => {
+         'name'      => 'empire-cpu-raw-unix',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-cpu-raw-solarisSparc' => {
+         'name'      => 'empire-cpu-raw-solarisSparc',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-cpu-raw-aix5RS6000' => {
+         'name'      => 'empire-cpu-raw-aix5RS6000',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-cpu-raw-linuxIntel' => {
+         'name'      => 'empire-cpu-raw-linuxIntel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-cpu-raw-nt' => {
+         'name'      => 'empire-cpu-raw-nt',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-cpu-raw-nt40Intel' => {
+         'name'      => 'empire-cpu-raw-nt40Intel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-cpu-raw-nt50Intel' => {
+         'name'      => 'empire-cpu-raw-nt50Intel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-total-cpu-raw-nt' => {
+         'name'      => 'empire-total-cpu-raw-nt',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-total-cpu-raw-nt40Intel' => {
+         'name'      => 'empire-total-cpu-raw-nt40Intel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-total-cpu-raw-nt50Intel' => {
+         'name'      => 'empire-total-cpu-raw-nt50Intel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-total-cpu-raw-unix' => {
+         'name'      => 'empire-total-cpu-raw-unix',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-total-cpu-raw-solarisSparc' => {
+         'name'      => 'empire-total-cpu-raw-solarisSparc',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-total-cpu-raw-aix5RS6000' => {
+         'name'      => 'empire-total-cpu-raw-aix5RS6000',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-total-cpu-raw-linuxIntel' => {
+         'name'      => 'empire-total-cpu-raw-linuxIntel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-counters-nt' => {
+         'name'      => 'empire-counters-nt',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-counters-nt40Intel' => {
+         'name'      => 'empire-counters-nt40Intel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-counters-nt50Intel' => {
+         'name'      => 'empire-counters-nt50Intel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-counters-unix' => {
+         'name'      => 'empire-counters-unix',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-counters-solarisSparc' => {
+         'name'      => 'empire-counters-solarisSparc',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-counters-aix5RS6000' => {
+         'name'      => 'empire-counters-aix5RS6000',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-counters-linuxIntel' => {
+         'name'      => 'empire-counters-linuxIntel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-runq' => {
+         'name'      => 'empire-runq',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-diskwait' => {
+         'name'      => 'empire-diskwait',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-pagewait' => {
+         'name'      => 'empire-pagewait',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-swapactive' => {
+         'name'      => 'empire-swapactive',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-sleepactive' => {
+         'name'      => 'empire-sleepactive',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-disk-stats-subtree' => {
+         'name'      => 'empire-disk-stats-subtree',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-disk-stats-unix' => {
+         'name'      => 'empire-disk-stats-unix',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-disk-stats-solarisSparc' => {
+         'name'      => 'empire-disk-stats-solarisSparc',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-disk-stats-aix5RS6000' => {
+         'name'      => 'empire-disk-stats-aix5RS6000',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-disk-stats-linuxIntel' => {
+         'name'      => 'empire-disk-stats-linuxIntel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-disk-stats-nt' => {
+         'name'      => 'empire-disk-stats-nt',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-disk-stats-nt40Intel' => {
+         'name'      => 'empire-disk-stats-nt40Intel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+     'EmpireSystemedge::empire-disk-stats-nt50Intel' => {
+         'name'      => 'empire-disk-stats-nt50Intel',
+         'source'    => 'vendor/empire.systemedge.xml',
+     },
+
+     #### MicrosoftWindows
+     'MicrosoftWindows::microsoft-iis-ftp-stats' => {
+         'name'     => 'microsoft-iis-ftp-stats',
+         'source'   => 'vendor/microsoft.windows.xml',
+     },
+     'MicrosoftWindows::microsoft-iis-http-stats' => {
+         'name'     => 'microsoft-iis-http-stats',
+         'source'   => 'vendor/microsoft.windows.xml',
+     },
+
+     #### Motorola BSR
+     'MotorolaBSR::motorola-bsr-docsis-upstream-util' => {
+         'name'     => 'motorola-bsr-docsis-upstream-util',
+         'source'   => 'vendor/motorola.bsr.xml',
+     },     
+     
+     #### F5 BigIp
+     'F5BigIp::BigIp_4.x' => {
+         'name'     => 'BigIp_4.x',
+         'source'   => 'vendor/f5.bigip.xml',
+     },
+     'F5BigIp::BigIp_4.x_virtualServer' => {
+         'name'     => 'BigIp_4.x_virtualServer',
+         'source'   => 'vendor/f5.bigip.xml',
+     },
+     'F5BigIp::BigIp_4.x_virtualServer-connrate-overview' => {
+         'name'     => 'BigIp_4.x_virtualServer-connrate-overview',
+         'source'   => 'vendor/f5.bigip.xml',
+     },
+     'F5BigIp::BigIp_4.x_virtualServer-actvconn-overview' => {
+         'name'     => 'BigIp_4.x_virtualServer-connrate-overview',
+         'source'   => 'vendor/f5.bigip.xml',
+     },
+     'F5BigIp::BigIp_4.x_pool-actvconn-overview' => {
+         'name'     => 'BigIp_4.x_pool-actvconn-overview',
+         'source'   => 'vendor/f5.bigip.xml',
+     },
+     'F5BigIp::BigIp_4.x_pool' => {
+         'name'     => 'BigIp_4.x_pool',
+         'source'   => 'vendor/f5.bigip.xml',
+     },
+     'F5BigIp::BigIp_4.x_poolMember-actvconn-overview' => {
+         'name'     => 'BigIp_4.x_poolMember-actvconn-overview',
+         'source'   => 'vendor/f5.bigip.xml',
+     },
+     'F5BigIp::BigIp_4.x_poolMember' => {
+         'name'     => 'BigIp_4.x_poolMember',
+         'source'   => 'vendor/f5.bigip.xml',
+     },
+     'F5BigIp::BigIp_4.x_sslProxy_Global' => {
+         'name'     => 'BigIp_4.x_sslProxy_Global',
+         'source'   => 'vendor/f5.bigip.xml',
+     },
+     'F5BigIp::BigIp_4.x_sslProxy-currconn-overview' => {
+         'name'     => 'BigIp_4.x_sslProxy-currconn-overview',
+         'source'   => 'vendor/f5.bigip.xml',
+     },
+     'F5BigIp::BigIp_4.x_sslProxy' => {
+         'name'     => 'BigIp_4.x_sslProxy',
+         'source'   => 'vendor/f5.bigip.xml',
+     },
+     'F5BigIp::BigIp_3.x' => {
+         'name'     => 'BigIp_3.x',
+         'source'   => 'vendor/f5.bigip.xml',
+     },
+
+     ##### Foundry/Brocade
+     'Foundry::fdry-chass-temperature' => {
+         'name'     => 'fdry-chass-temperature',
+         'source'   => 'vendor/foundry.xml',
+     },
+     'Foundry::fdry-board-overview' => {
+         'name'     => 'fdry-board-overview',
+         'source'   => 'vendor/foundry.xml',
+     },
+     'Foundry::fdry-board-subtree' => {
+         'name'     => 'fdry-board-subtree',
+         'source'   => 'vendor/foundry.xml',
+     },
+     'Foundry::fdry-board-memstats' => {
+         'name'     => 'fdry-board-memstats',
+         'source'   => 'vendor/foundry.xml',
+     },     
+     'Foundry::fdry-board-cpustats' => {
+         'name'     => 'fdry-board-cpustats',
+         'source'   => 'vendor/foundry.xml',
+     },
+     'Foundry::fdry-board-tempstats' => {
+         'name'     => 'fdry-board-tempstats',
+         'source'   => 'vendor/foundry.xml',
+     },
+     'Foundry::fdry-board-temp-sensor-halfcelsius' => {
+         'name'     => 'fdry-board-temp-sensor-halfcelsius',
+         'source'   => 'vendor/foundry.xml',
+     },
+     
+     ##### Force10 networks (by Jon Nistor)
+     'FTOS::ftos-cpu-subtree' => {
+         'name'     => 'ftos-cpu-subtree',
+         'source'   => 'vendor/ftos.xml',
+     },
+     'FTOS::ftos-cpu' => {
+         'name'     => 'ftos-cpu',
+         'source'   => 'vendor/ftos.xml',
+     },
+     'FTOS::ftos-power-supply-leaf' => {
+         'name'     => 'ftos-power-supply-leaf',
+         'source'   => 'vendor/ftos.xml',
+     },
+     'FTOS::ftos-temperature-subtree' => {
+         'name'     => 'ftos-temperature-subtree',
+         'source'   => 'vendor/ftos.xml',
+     },
+     'FTOS::ftos-temperature-sensor' => {
+         'name'     => 'ftos-temperature-sensor',
+         'source'   => 'vendor/ftos.xml',
+     },
+     'FTOS::ftos-temperature-sensor-fahrenheit' => {
+         'name'     => 'ftos-temperature-sensor-fahrenheit',
+         'source'   => 'vendor/ftos.xml',
+     },
+
+     #### Jacarta
+     'Jacarta::imeter-amps-sensor' => {
+         'name'     => 'imeter-amps-sensor',
+         'source'   => 'vendor/jacarta.xml',
+     },
+     'Jacarta::imeter-humi-sensor' => {
+         'name'     => 'imeter-humi-sensor',
+         'source'   => 'vendor/jacarta.xml',
+     },
+     'Jacarta::imeter-temp-sensor' => {
+         'name'     => 'imeter-temp-sensor',
+         'source'   => 'vendor/jacarta.xml',
+     },
+
+     ##### Juniper JunOS (by Jon Nistor)
+     'JunOS::junos-cos-subtree' => {
+         'name'     => 'junos-cos-subtree',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-cos-subtree-interface' => {
+         'name'     => 'junos-cos-subtree-interface',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-cos-leaf' => {
+         'name'     => 'junos-cos-leaf',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-cos-red' => {
+         'name'     => 'junos-cos-red',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-cos-tail' => {
+         'name'     => 'junos-cos-tail',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-cpu-subtree' => {
+         'name'     => 'junos-cpu-subtree',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-cpu' => {
+         'name'     => 'junos-cpu',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-firewall-subtree' => {
+         'name'     => 'junos-firewall-subtree',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-firewall-filter-subtree' => {
+         'name'     => 'junos-firewall-filter-subtree',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-firewall-filter' => {
+         'name'     => 'junos-firewall-filter',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-firewall-filter-counter' => {
+         'name'     => 'junos-firewall-filter-counter',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-firewall-filter-policer' => {
+         'name'     => 'junos-firewall-filter-policer',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-memory-subtree' => {
+         'name'     => 'junos-memory-subtree',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-memory' => {
+         'name'     => 'junos-memory',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-rpf-subtree' => {
+         'name'     => 'junos-rpf-subtree',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-rpf' => {
+         'name'     => 'junos-rpf',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-temperature-subtree' => {
+         'name'     => 'junos-temperature-subtree',
+         'source'   => 'vendor/junos.xml',
+     },
+     'JunOS::junos-temperature-sensor' => {
+         'name'     => 'junos-temperature-sensor',
+         'source'   => 'vendor/junos.xml',
+     },
+
+
+     ##### Liebert
+     'Liebert::humidity-sensor' => {
+         'name'     => 'humidity-sensor',
+         'source'   => 'vendor/liebert.xml',
+     },
+     'Liebert::humidity-subtree' => {
+         'name'     => 'humidity-subtree',
+         'source'   => 'vendor/liebert.xml',
+     },
+     'Liebert::state-subtree' => {
+         'name'     => 'state-subtree',
+         'source'   => 'vendor/liebert.xml',
+     },
+     'Liebert::state-capacity' => {
+         'name'     => 'state-capacity',
+         'source'   => 'vendor/liebert.xml',
+     },
+     'Liebert::temperature-subtree' => {
+         'name'     => 'temperature-subtree',
+         'source'   => 'vendor/liebert.xml',
+     },
+     'Liebert::temperature-sensor' => {
+         'name'     => 'temperature-sensor',
+         'source'   => 'vendor/liebert.xml',
+     },
+     'Liebert::temperature-sensor-fahrenheit' => {
+         'name'     => 'temperature-sensor-fahrenheit',
+         'source'   => 'vendor/liebert.xml',
+     },
+
+     
+     ##### Ucd Snmp
+     'UcdSnmp::ucdsnmp-memory-real' => {
+         'name'     => 'ucdsnmp-memory-real',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-memory-swap' => {
+         'name'     => 'ucdsnmp-memory-swap',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-blockio' => {
+         'name'     => 'ucdsnmp-blockio',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-raw-interrupts' => {
+         'name'     => 'ucdsnmp-raw-interrupts',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-user-multi' => {
+         'name'     => 'ucdsnmp-cpu-user-multi',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-user' => {
+         'name'     => 'ucdsnmp-cpu-user',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-system-multi' => {
+         'name'     => 'ucdsnmp-cpu-system-multi',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-system' => {
+         'name'     => 'ucdsnmp-cpu-system',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-wait-multi' => {
+         'name'     => 'ucdsnmp-cpu-wait-multi',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-wait' => {
+         'name'     => 'ucdsnmp-cpu-wait',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-kernel-multi' => {
+         'name'     => 'ucdsnmp-cpu-kernel-multi',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-kernel' => {
+         'name'     => 'ucdsnmp-cpu-kernel',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-idle-multi' => {
+         'name'     => 'ucdsnmp-cpu-idle-multi',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-idle' => {
+         'name'     => 'ucdsnmp-cpu-idle',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-nice-multi' => {
+         'name'     => 'ucdsnmp-cpu-nice-multi',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-nice' => {
+         'name'     => 'ucdsnmp-cpu-nice',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-interrupts-multi' => {
+         'name'     => 'ucdsnmp-cpu-interrupts-multi',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-softirq' => {
+         'name'     => 'ucdsnmp-cpu-softirq',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-softirq-multi' => {
+         'name'     => 'ucdsnmp-cpu-softirq-multi',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-cpu-interrupts' => {
+         'name'     => 'ucdsnmp-cpu-interrupts',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+     'UcdSnmp::ucdsnmp-load-average' => {
+         'name'     => 'ucdsnmp-load-average',
+         'source'   => 'vendor/ucd.ucd-snmp.xml',
+     },
+
+     #### NetApp (Network Appliance)
+     'NetApp::CPU' => {
+         'name'     => 'netapp-cpu',
+         'source'   => 'vendor/netapp.filer.xml',
+     },
+     'NetApp::misc' => {
+         'name'     => 'netapp-misc',
+         'source'   => 'vendor/netapp.filer.xml',
+     },
+     'NetApp::nfsv2' => {
+         'name'     => 'netapp-nfsv2',
+         'source'   => 'vendor/netapp.filer.xml',
+     },
+     'NetApp::nfsv3' => {
+         'name'     => 'netapp-nfsv3',
+         'source'   => 'vendor/netapp.filer.xml',
+     },
+     'NetApp::cifs' => {
+         'name'     => 'netapp-cifs',
+         'source'   => 'vendor/netapp.filer.xml',
+     },
+
+     #### NetBotz
+     'NetBotz::netbotz-temp-sensor' => {
+         'name'     => 'netbotz-temp-sensor',
+         'source'   => 'vendor/netbotz.xml',
+     },
+     'NetBotz::netbotz-humi-sensor' => {
+         'name'     => 'netbotz-humi-sensor',
+         'source'   => 'vendor/netbotz.xml',
+     },
+     'NetBotz::netbotz-dew-sensor' => {
+         'name'     => 'netbotz-dew-sensor',
+         'source'   => 'vendor/netbotz.xml',
+     },
+     'NetBotz::netbotz-audio-sensor' => {
+         'name'     => 'netbotz-audio-sensor',
+         'source'   => 'vendor/netbotz.xml',
+     },
+     'NetBotz::netbotz-air-sensor' => {
+         'name'     => 'netbotz-air-sensor',
+         'source'   => 'vendor/netbotz.xml',
+     },
+     'NetBotz::netbotz-door-sensor' => {
+         'name'     => 'netbotz-door-sensor',
+         'source'   => 'vendor/netbotz.xml',
+     },
+
+     #### NetScreen
+     'NetScreen::netscreen-cpu-stats' => {
+         'name'     => 'netscreen-cpu-stats',
+         'source'   => 'vendor/netscreen.xml',
+     },
+     'NetScreen::netscreen-memory-stats' => {
+         'name'     => 'netscreen-memory-stats',
+         'source'   => 'vendor/netscreen.xml',
+     },
+     'NetScreen::netscreen-sessions-stats' => {
+         'name'     => 'netscreen-sessions-stats',
+         'source'   => 'vendor/netscreen.xml',
+     },
+
+     #### OracleDatabase
+     'OracleDatabase::Sys' => {
+         'name'     => 'oracle-database-sys',
+         'source'   => 'vendor/oracle.database.xml',
+     },
+     'OracleDatabase::CacheSum' => {
+         'name'     => 'oracle-cache-sum',
+         'source'   => 'vendor/oracle.database.xml',
+     },
+     'OracleDatabase::SGA' => {
+         'name'     => 'oracle-sga',
+         'source'   => 'vendor/oracle.database.xml',
+     },
+     'OracleDatabase::table-space' => {
+         'name'     => 'oracle-table-space',
+         'source'   => 'vendor/oracle.database.xml',
+     },
+     'OracleDatabase::data-file' => {
+         'name'     => 'oracle-data-file',
+         'source'   => 'vendor/oracle.database.xml',
+     },
+     'OracleDatabase::library-cache' => {
+         'name'     => 'oracle-library-cache',
+         'source'   => 'vendor/oracle.database.xml',
+     },
+
+     #### Paradyne
+     'Paradyne::paradyne-xdsl-interface' => {
+         'name'   => 'paradyne-xdsl-interface',
+         'source' => 'vendor/paradyne.xdsl.xml'
+         },
+
+     #### Symmetricom
+     'Symmetricom::ntp-stats' => {
+         'name'   => 'ntp-stats',
+         'source' => 'vendor/symmetricom.xml'
+         },
+     );
+
+##########################
+# Common parameters
+
+# If true, data-dir would be hashed across a number of subdirectories
+# Only concatenation of hostname and domain name is hashed.
+$Torrus::DevDiscover::hashDataDirEnabled = 0;
+
+# Format for hashed data-dir subdirectory name. The argument is a number
+# from 0 to bucketSize-1.
+$Torrus::DevDiscover::hashDataDirFormat = '%.2X';
+
+# How many hashed data-dir subdirectories are used.
+$Torrus::DevDiscover::hashDataDirBucketSize = 256;
+
+
+##########################
+# RFC2790_HOST_RESOURCES parameters
+
+# The top level of the Host Resources Storage graph, percentage
+$Torrus::DevDiscover::RFC2790_HOST_RESOURCES::storageGraphTop = 105;
+
+# Where to draw the hi-mark line in Host Resources Storage, percentage
+$Torrus::DevDiscover::RFC2790_HOST_RESOURCES::storageHiMark = 100;
+
+
+##########################
+# EmpireSystemedge parameters
+
+# The top level of the Host Resources Storage graph, percentage
+$Torrus::DevDiscover::EmpireSystemedge::storageGraphTop = 105;
+
+# Where to draw the hi-mark line in Empire Storage, percentage
+$Torrus::DevDiscover::EmpireSystemedge::storageHiMark = 100;
+
+
+##########################
+#  CiscoIOS parameters
+
+# For mkroutercfg compatibility, set this to 1
+$Torrus::DevDiscover::CiscoIOS::useCiscoInterfaceCounters = 0;
+
+
+
+# Read plugin configurations
+{
+    my $dir = '@plugdevdisccfgdir@';
+    opendir(CFGDIR, $dir) or die("Cannot open directory $dir: $!");
+    my @files = grep { !/^\./ } readdir(CFGDIR);
+    closedir( CFGDIR );
+    foreach my $file ( @files )
+    {
+        require $dir . '/' . $file;
+    }
+}
+
+
+require '@devdiscover_siteconfig_pl@';
+
+1;
diff --git a/torrus/configs/devdiscover-siteconfig.pl b/torrus/configs/devdiscover-siteconfig.pl
new file mode 100644 (file)
index 0000000..421a5a6
--- /dev/null
@@ -0,0 +1,4 @@
+# Torrus Device Discovery Site config. Put all your site specifics here.
+
+
+1;
diff --git a/torrus/configs/email-siteconfig.pl b/torrus/configs/email-siteconfig.pl
new file mode 100644 (file)
index 0000000..74a82e5
--- /dev/null
@@ -0,0 +1,16 @@
+# Torrus Email notifications configuration. Put all your site specifics here.
+
+# The URL where the user can browse the datasources
+$Torrus::Email::url = 'http://localhost/torrus';
+
+# Filename within templates directory which will be used
+# for e-mail notification
+$Torrus::Email::template = 'email-alarm.txt';
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/configs/initscript.conf b/torrus/configs/initscript.conf
new file mode 100644 (file)
index 0000000..7752479
--- /dev/null
@@ -0,0 +1,31 @@
+# Torrus init script configuration
+# You can override any value in @siteconfdir@/initscript.siteconf
+
+# If we perform su @torrus_user@
+TORRUS_CHANGE_UID=yes
+
+# How many times we sleep and wait for processes to finish
+TORRUS_KILL_COUNT=9
+
+# How much we sleep each time and wait for processes to finish
+TORRUS_KILL_SLEEP=10
+
+# Command-line options for collector and monitor daemons
+TORRUS_CMDOPTS=""
+
+# When collector and monitor are executed together,
+# let the monitor sleep 20 minutes and wait for some data
+# to be collected
+TORRUS_MONITOR_DELAY="--delay=20"
+
+# Place for collector commandline options, such as --runalways
+TORRUS_COLLECTOR_CMDOPTS=""
+
+
+
+
+# Local Variables:
+# mode: shell-script
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/configs/notify-siteconfig.pl b/torrus/configs/notify-siteconfig.pl
new file mode 100644 (file)
index 0000000..5eaee6f
--- /dev/null
@@ -0,0 +1,31 @@
+
+%Torrus::Notify::programs =
+    (
+     'mailto' => '$TORRUS_BIN/action_printemail | /usr/bin/mail $ARG1',
+     'page' => '/usr/bin/echo $TORRUS_NODEPATH:$TORRUS_MONITOR ' .
+     '>> /tmp/monitor.$ARG1.log'
+     );
+
+%Torrus::Notify::policies =
+    (
+     'CUST_A' => {
+         'match' => sub { $ENV{'TORRUS_P_notify_policy'} eq 'A' },
+         'severity' => {
+             '3' => [ 'mailto:aaa@domain.com',
+                      'mailto:bbb@domain.com' ],
+             '5' => [ 'page:1234', 'mailto:boss@domain.com' ] } } );
+     
+                 
+             
+         
+# Torrus::Log::setLevel('debug');    
+    
+
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/configs/snmptrap-siteconfig.pl b/torrus/configs/snmptrap-siteconfig.pl
new file mode 100644 (file)
index 0000000..27fbb1d
--- /dev/null
@@ -0,0 +1,19 @@
+# Torrus SNMP Trap configuration. Put all your site specifics here.
+
+# Hosts that will receive traps
+@Torrus::Snmptrap::hosts = qw( localhost );
+
+# SNMP community for trap sending
+$Torrus::Snmptrap::community = 'public';
+
+# SNMP trap port.
+$Torrus::Snmptrap::port = 162;
+
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/configs/torrus-config.pl b/torrus/configs/torrus-config.pl
new file mode 100644 (file)
index 0000000..b93c5da
--- /dev/null
@@ -0,0 +1,377 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus-config.pl,v 1.1 2010-12-27 00:04:40 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+# DO NOT EDIT THIS FILE!
+
+# Torrus local configuration.
+# Put all your local settings into torrus-siteconfig.pl
+
+use lib(@perllibdirs@);
+
+$Torrus::Global::version        = '@VERSION@';
+$Torrus::Global::cfgDefsDir     = '@cfgdefdir@';
+$Torrus::Global::cfgSiteDir     = '@siteconfdir@';
+$Torrus::Global::pkgbindir      = '@pkgbindir@';
+$Torrus::Global::dbHome         = '@dbhome@';
+$Torrus::Global::templateDirs   = ['@tmpldir@', '@tmpluserdir@'];
+$Torrus::Global::stylingDir     = '@styldir@';
+$Torrus::Global::cacheDir       = '@cachedir@';
+$Torrus::Global::pidDir         = '@piddir@';
+$Torrus::Global::logDir         = '@logdir@';
+$Torrus::Global::reportsDir     = '@reportsdir@';
+$Torrus::Global::sesStoreDir    = '@sesstordir@';
+$Torrus::Global::sesLockDir     = '@seslockdir@';
+$Torrus::Global::webPlainDir    = '@webplaindir@';
+
+@Torrus::Global::xmlDirs        = ('@distxmldir@', '@sitexmldir@');
+
+$Torrus::Global::threadsEnabled  = '@perlithreads@';
+
+$Torrus::DB::dbSub              = 'sub';
+
+# How long we can wait till the configuration is ready, in seconds
+$Torrus::Global::ConfigReadyTimeout = 1800;
+
+# How often we check if the configuration is ready, in seconds
+$Torrus::Global::ConfigReadyRetryPeriod = 30;
+
+# How long the compiler waits till readers finish, in seconds
+$Torrus::Global::ConfigReadersWaitTimeout = 180;
+
+# How often compiler checks for readers to finish
+$Torrus::Global::ConfigReadersWaitPeriod = 5;
+
+# How much the timestamps can differ in one RRD file, in seconds
+$Torrus::Global::RRDTimestampTolerance = 15;
+
+# SO_RCVBUF, the receiving buffer size of the SNMP collector socket.
+# Should be large enough to sustain the traffic bursts, and should be
+# within limits incurred by local OS and kernel settings.
+# Check your system manuals and the results of network statistics.
+#
+# On Solaris, the maximum buffer size is 256k, and it is configurable
+# via "/usr/sbin/ndd /dev/udp udp_max_buf <value>",
+# and the statistics are shown in udpInOverflows of "netstat -s -P ip" output.
+#
+# On FreeBSD, the statistics can be obtained via "netstat -s -p udp".
+# The maximum socket buffer can be changed via
+# "sysctl kern.ipc.maxsockbuf=<value>", and default is 256k.
+# On startup, the OS reads these settings from /etc/sysctl.conf
+#
+# On Linux (FC2), the default limit is 131071, and it can be changed
+# by "sysctl -w net.core.rmem_max=<value>". On startup, the OS reads these
+# settings from /etc/sysctl.conf
+#
+$Torrus::Collector::SNMP::RxBuffer = 131071;
+
+# The time period after which we give up to reach the host being unreachable
+$Torrus::Collector::SNMP::unreachableTimeout = 21600; # 6 hours
+
+# For unreachable host, we retry SNMP query not earlier than this
+$Torrus::Collector::SNMP::unreachableRetryDelay = 600; # 10 min
+
+# Variables that define the SNMP map refreshing.
+# The maps (e.g. ifDescr=>ifIndex mapping) are stored in the collector
+# process and are not automatically refreshed after recompiling.
+# They refresh only when the SNMP agent is rebooted or at periodic intervals
+# defined below. For SNMPv1 agents, periodic refreshing is disabled
+# because of performance impact.
+#
+# Refresh SNMP maps every 5 to 7 hours
+$Torrus::Collector::SNMP::mapsRefreshPeriod = 18000;
+$Torrus::Collector::SNMP::mapsRefreshRandom = 0.40;
+
+# After configuration re-compiling, update the maps.
+# Do it randomly and spread the load evenly between 0 and 30 minutes.
+$Torrus::Collector::SNMP::mapsUpdateInterval = 1800;
+
+
+# Wait 10min between refresh checkups
+$Torrus::Collector::SNMP::mapsExpireCheckPeriod = 600;
+
+# There is a strange bug that with more than 400 sessions per SNMP
+# dispatcher some requests are not sent at all
+$Torrus::Collector::SNMP::maxSessionsPerDispatcher = 100;
+
+# When enabled, the collector starts a background thread that
+# writes to RRD files
+$Torrus::Collector::RRDStorage::useThreads = $Torrus::Global::threadsEnabled;
+
+# How many unwritten updates are allowed to stay in the queue
+$Torrus::Collector::RRDStorage::thrQueueLimit = 1000000;
+
+# The following errors are caused by changes in the device configurations,
+# when the collector tries to store data in a RRD file, but the
+# structure of the file is no longer suitable:
+#     Datasource exists in RRD file, but is not updated
+#     Datasource being updated does not exist
+# Set this variable to true if you want these RRD files automatically moved.
+# The current date is appended to the filename, and the file
+# is moved to another directory or renamed.
+$Torrus::Collector::RRDStorage::moveConflictRRD = 0;
+
+
+# The path where conflicted RRD files would be moved. This directory
+# should exist, be writable by Torrus daemon user, and in most OSes
+# it must reside in the same filesystem as the original files.
+# When undefined, the files are renamed within their original directory.
+$Torrus::Collector::RRDStorage::conflictRRDPath = undef;
+
+# Sleep interval when scheduler initialization failed (i.e. configuration
+# reading timeout)
+$Torrus::Scheduler::failedInitSleep = 1800;
+
+# When positive, the scheduler will sleep in small intervals.
+# Use this when the system clock is not reliable, like in VmWare
+$Torrus::Scheduler::maxSleepTime = 0;
+
+# Set this to true when the system clock is not reliable, like in VmWare
+$Torrus::Scheduler::ignoreClockSkew = 0;
+
+# Exponential decay parameter (alpha) for Scheduler statistics averages:
+#
+# Xnew = alpha * Xmes + (1-alpha) * Xprev
+# Xnew: new calculated average
+# Xmes: measured value
+# Xprev: old calculated average
+#
+# Alpha defines how many previous measurements composite the average:
+# alpha = 1.0 - exp( log(1-TotalWeight)/NPoints )
+# TotalWeight: the weight of NPoints measurements
+# NPoints: number of measurements
+# 0.63 corresponds to TotalWeight=0.95 and NPoints=3 (95% of average is from
+# last three datapoints
+#
+$Torrus::Scheduler::statsExpDecayAlpha = 0.63;
+
+# Monitor alarms may become orphaned if the configuration changes
+# in the middle of an event. Events older than this time are cleaned up
+# default: 2 weeks
+$Torrus::Monitor::alarmTimeout = 1209600; 
+
+# The default CSS stylesheet and other details for HTML output.
+# These settings may optionally be overwritten by the styling profile below.
+# Additional CSS overlay may be specified with 'cssoverlay' property,
+# It should point to an absolute URL.
+# for example:
+# $Torrus::Renderer::styling{'default'}{'cssoverlay'} = '/mystyle.css';
+#
+%Torrus::Renderer::styling =
+    ( 'default' => {'stylesheet'   => 'torrus.css'},
+      'printer' => {'stylesheet'   => 'torrus-printer.css'},
+      'report'  => {'stylesheet'   => 'torrus-report.css'}
+      );
+
+# Color schema for RRDtool graph. It can be extended by setting
+# $Torrus::Renderer::stylingProfileOverlay. The overlay should
+# be an absolute file name. You can use $Torrus::Global::cfgSiteDir
+# to refer to the site configs path.
+$Torrus::Renderer::stylingProfile = 'torrus-schema';
+
+# Top level URI
+$Torrus::Renderer::rendererURL = '/torrus';
+
+# Trailing slash is important!
+$Torrus::Renderer::plainURL = '/torrus/plain/';
+
+# The small piece of text in the corner of the HTML output.
+$Torrus::Renderer::companyName = 'Your company name';
+
+# The URL to use for that piece of text
+$Torrus::Renderer::companyURL = 'http://torrus.sf.net';
+
+# The URL of your company logo which will be displayed instead of
+# companyName
+# $Torrus::Renderer::companyLogo = 'http://domain.com/logo.png';
+
+# Another piece of text on the right to the company name
+$Torrus::Renderer::siteInfo = undef;
+
+# URL to be shown on the login page for lost password
+# You have to implement that yourself
+# $Torrus::Renderer::lostPasswordURL = 'http://domain.com/lostpw.cgi';
+    
+# The time format to print in HTML
+$Torrus::Renderer::timeFormat = '%d-%m-%Y %H:%M';
+
+# Exception characters for URI::Escape
+# By default, slash (/) is escaped, and we don't really want it
+$Torrus::Renderer::uriEscapeExceptions = '^A-Za-z0-9-._~/:';
+
+# The page that lets you choose the tree from the list
+$Torrus::Renderer::Chooser::mimeType = 'text/html; charset=UTF-8';
+$Torrus::Renderer::Chooser::expires = '300';
+$Torrus::Renderer::Chooser::template = 'default-chooser.html';
+$Torrus::Renderer::Chooser::searchTemplate = 'globalsearch.html';
+
+# We clean the renderer cache at least once a day
+$Torrus::Renderer::cacheMaxAge = 86400;
+
+# Some RRDtool versions may report errors on decorations
+$Torrus::Renderer::ignoreDecorations = 0;
+
+# This enables full Apache handler debugging
+$Torrus::Renderer::globalDebug = 0;
+
+# When true, Holt-Winters boundaries and failures are described in the
+# graph legend
+$Torrus::Renderer::hwGraphLegend = 0;
+
+# When true, users may view service usage reports (requires SQL connection)
+$Torrus::Renderer::displayReports = 0;
+
+# Allow tree searching. The search DB should be built with buildsearchdb
+$Torrus::Renderer::searchEnabled = 1;
+
+# Allow global searching across the trees. If the user authentication
+# is enabled, the user should have rights DisplayTree and GlobalSearch for '*'
+$Torrus::Renderer::globalSearchEnabled = 1;
+
+
+# Modules that Collector will use for collecting and storing data.
+@Torrus::Collector::loadModules =
+    ( 'Torrus::Collector::SNMP',
+      'Torrus::Collector::CDef',
+      'Torrus::Collector::RRDStorage' );
+
+# Configurable part of Validator
+@Torrus::Validator::loadLeafValidators =
+    ( 'Torrus::Collector::SNMP_Params',
+      'Torrus::Collector::CDef_Params' );
+
+# Configurable part of AdmInfo renderer
+@Torrus::Renderer::loadAdmInfo =
+    ( 'Torrus::Collector::SNMP_Params',
+      'Torrus::Collector::CDef_Params' );
+
+# Parameters that are comma-separated values
+@Torrus::ConfigTree::XMLCompiler::listparams = ();
+
+# XML files to be compiled first for every tree
+@Torrus::Global::xmlAlwaysIncludeFirst = ();
+
+# XML files to be compiled after the tree files, but before the files
+# included with <include> XML directive
+@Torrus::Global::xmlAlwaysIncludeLast = ();
+
+# Do we need Web user authentication/authorization ?
+$Torrus::CGI::authorizeUsers = 1;
+
+# User authentication method may be changed locally
+$Torrus::ACL::userAuthModule = 'Torrus::ACL::AuthLocalMD5';
+
+# Minimum allowed password length
+$Torrus::ACL::minPasswordLength = 6;
+
+# The login page
+$Torrus::Renderer::LoginScreen::mimeType = 'text/html; charset=UTF-8';
+$Torrus::Renderer::LoginScreen::template = 'default-login.html';
+
+####
+####  SQL connections configuration
+# For a given Perl class and an optional subtype,
+# the connection attributes are derived in the following order:
+# 'Default', 'Default/[subtype]', '[Class]', '[Class]/[subtype]',
+# 'All/[subtype]'.
+# For a simple setup, the default attributes are usually defined for
+# 'Default' key.
+# The key attributes are: 'dsn', 'username', and 'password'.
+%Torrus::SQL::connections =
+    ('Default' => {'dsn' => 'DBI:mysql:database=torrus;host=localhost',
+                   'username' => 'torrus',
+                   'password' => 'torrus'}
+     );
+
+####
+####  ExternalStorage collector module initialization.
+# In order to enable External storage, add these lines to torrus-siteconfig.pl:
+# push(@Torrus::Collector::loadModules, 'Torrus::Collector::ExternalStorage');
+# 
+
+# Other configuration available:
+
+# Maximum age for backlog in case of unavailable storage.
+# We stop recording new data when maxage is reached. Default: 24h
+$Torrus::Collector::ExternalStorage::backlogMaxAge = 86400;
+
+# How often we retry to contact an unreachable external storage. Default: 10min
+$Torrus::Collector::ExternalStorage::unavailableRetry = 600;
+
+# Backend engine for External storage
+$Torrus::Collector::ExternalStorage::backend = 'Torrus::Collector::ExtDBI';
+
+# SQL table configuration for collector's external storage
+$Torrus::SQL::SrvExport::tableName = 'srvexport';
+%Torrus::SQL::SrvExport::columns =
+    ('srv_date'    => 'srv_date',
+     'srv_time'    => 'srv_time',
+     'serviceid'   => 'serviceid',
+     'value'       => 'value',
+     'intvl'       => 'intvl');
+
+# Optional SQL connection subtype for Collector export
+# $Torrus::Collector::ExtDBI::subtype
+
+
+# SQL table configuration for Reports
+$Torrus::SQL::Reports::tableName = 'reports';
+%Torrus::SQL::Reports::columns =
+    ('id'          => 'id',
+     'rep_date'    => 'rep_date',
+     'rep_time'    => 'rep_time',
+     'reportname'  => 'reportname',
+     'iscomplete'  => 'iscomplete');
+
+$Torrus::SQL::ReportFields::tableName = 'reportfields';
+%Torrus::SQL::ReportFields::columns =
+    ('id'         => 'id',
+     'rep_id'     => 'rep_id',
+     'name'       => 'name',
+     'serviceid'  => 'serviceid',
+     'value'      => 'value',
+     'units'      => 'units');
+
+%Torrus::ReportGenerator::modules =
+    ( 'MonthlyUsage' => 'Torrus::ReportGenerator::MonthlySrvUsage' );
+
+
+%Torrus::ReportOutput::HTML::templates =
+    ( 'index'      => 'report-index.html',
+      'serviceid'  => 'report-serviceid.html',
+      'monthly'    => 'report-monthly.html',
+      'yearly'     => 'report-yearly.html');
+
+# Read plugin configurations
+{
+    my $dir = '@plugtorruscfgdir@';
+    opendir(CFGDIR, $dir) or die("Cannot open directory $dir: $!");
+    my @files = grep { !/^\./ } readdir(CFGDIR);
+    closedir( CFGDIR );
+    foreach my $file ( @files )
+    {
+        require $dir . '/' . $file;
+    }
+}
+
+    
+
+require '@torrus_siteconfig_pl@';
+
+1;
diff --git a/torrus/configs/torrus-siteconfig.pl b/torrus/configs/torrus-siteconfig.pl
new file mode 100644 (file)
index 0000000..ed51c17
--- /dev/null
@@ -0,0 +1,21 @@
+# Torrus Site config. Put all your site specifics here.
+# You need to stop and start Apache server every time you change this file.
+
+@Torrus::Global::xmlAlwaysIncludeFirst = ( 'defaults.xml', 'site-global.xml' );
+
+%Torrus::Global::treeConfig =
+    (
+     'main' => {
+         'description' => 'The main tree',
+         'info'        => 'some tree',
+         'xmlfiles' => [qw(routers.xml)],
+         'run' => { 'collector' => 1, 'monitor' => 0 } }
+     );
+
+# Customizable look in the HTML page top
+# $Torrus::Renderer::companyName = 'Your company name';
+# $Torrus::Renderer::companyURL = 'http://torrus.sf.net';
+# $Torrus::Renderer::siteInfo = `hostname`;
+
+
+1;
diff --git a/torrus/configs/webmux.pl b/torrus/configs/webmux.pl
new file mode 100644 (file)
index 0000000..cfda1cd
--- /dev/null
@@ -0,0 +1,38 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: webmux.pl,v 1.1 2010-12-27 00:04:41 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Apache mod_perl initialisation
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use Torrus::DB;
+use Torrus::ApacheHandler;
+
+if( $Torrus::Renderer::globalDebug )
+{
+    &Torrus::Log::setLevel('debug');
+}
+
+Apache->server->register_cleanup( sub {
+    my $r = shift;
+    Torrus::DB::cleanupEnvironment();
+});
+
+
+1;
diff --git a/torrus/configs/webmux2.pl b/torrus/configs/webmux2.pl
new file mode 100644 (file)
index 0000000..55f2bae
--- /dev/null
@@ -0,0 +1,74 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: webmux2.pl,v 1.1 2010-12-27 00:04:42 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Apache mod_perl initialisation
+
+BEGIN { require '@torrus_config_pl@'; }
+
+use Apache2::ServerUtil;
+use mod_perl2;
+
+use Torrus::Log;
+use Torrus::DB;
+
+# Probably we need MPM-specific Code here
+# http://perl.apache.org/docs/2.0/user/coding/coding.html
+
+# Tested with prefork MPM only.
+# Threaded MPMs will not work because RRDtool is RRDs.pm is not
+# currently thread safe
+
+
+sub child_exit_handler
+{
+    my( $child_pool, $s ) = @_;
+    Debug('Torrus child exit handler executed');
+    Torrus::DB::cleanupEnvironment();
+}
+
+
+if( $Torrus::Renderer::globalDebug )
+{
+    &Torrus::Log::setLevel('debug');
+}
+
+my $ok = 1;
+my $s = Apache2::ServerUtil->server();
+
+# Apache::Server::is_perl_option_enabled is implemented since
+# mod_perl2-1.99r13, but many installations still use mod_perl2-1.99r12
+if( $mod_perl::VERSION > 1.9912 and
+    not $s->is_perl_option_enabled('ChildExit') )
+{
+    $ok = 0;
+    $s->log_error('ChildExit must be enabled for proper cleanup');
+}
+else
+{
+    $s->push_handlers( 'ChildExit' => \&child_exit_handler );
+}
+
+
+$ok;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/configure b/torrus/configure
new file mode 100755 (executable)
index 0000000..53dcc81
--- /dev/null
@@ -0,0 +1,3709 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59 for torrus 1.0.9.
+#
+# Report bugs to <ssinyagin@users.sourceforge.net>.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete.  It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME='torrus'
+PACKAGE_TARNAME='torrus'
+PACKAGE_VERSION='1.0.9'
+PACKAGE_STRING='torrus 1.0.9'
+PACKAGE_BUGREPORT='ssinyagin@users.sourceforge.net'
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar PERL SU KILL SED FIND RM SLEEP POD2TEXT POD2TEXT_PRESENT_TRUE POD2TEXT_PRESENT_FALSE POD2MAN POD2MAN_PRESENT_TRUE POD2MAN_PRESENT_FALSE enable_pkgonly PERLINC perllibdirs perlithreads torrus_user var_user var_group var_mode enable_varperm pkghome pkgbindir cfgdefdir pkgdocdir exmpdir perllibdir pluginsdir plugtorruscfgdir plugdevdisccfgdir plugwrapperdir scriptsdir supdir webplaindir webscriptsdir tmpldir distxmldir sitedir siteconfdir tmpluserdir sitexmldir logdir piddir varprefix cachedir dbhome reportsdir seslockdir sesstordir wrapperdir mansec_usercmd mansec_misc defrrddir LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_option in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval "enable_$ac_feature=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_$ac_feature='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_$ac_package='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
+    eval "with_$ac_package=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+    eval "$ac_envvar='$ac_optarg'"
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+             localstatedir libdir includedir oldincludedir infodir mandir
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$0" : 'X\(//\)[^/]' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+   { (exit 1); exit 1; }; }
+  else
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+  fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+   { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_PERLINC_set=${PERLINC+set}
+ac_env_PERLINC_value=$PERLINC
+ac_cv_env_PERLINC_set=${PERLINC+set}
+ac_cv_env_PERLINC_value=$PERLINC
+ac_env_torrus_user_set=${torrus_user+set}
+ac_env_torrus_user_value=$torrus_user
+ac_cv_env_torrus_user_set=${torrus_user+set}
+ac_cv_env_torrus_user_value=$torrus_user
+ac_env_var_user_set=${var_user+set}
+ac_env_var_user_value=$var_user
+ac_cv_env_var_user_set=${var_user+set}
+ac_cv_env_var_user_value=$var_user
+ac_env_var_group_set=${var_group+set}
+ac_env_var_group_value=$var_group
+ac_cv_env_var_group_set=${var_group+set}
+ac_cv_env_var_group_value=$var_group
+ac_env_var_mode_set=${var_mode+set}
+ac_env_var_mode_value=$var_mode
+ac_cv_env_var_mode_set=${var_mode+set}
+ac_cv_env_var_mode_value=$var_mode
+ac_env_pkghome_set=${pkghome+set}
+ac_env_pkghome_value=$pkghome
+ac_cv_env_pkghome_set=${pkghome+set}
+ac_cv_env_pkghome_value=$pkghome
+ac_env_pkgbindir_set=${pkgbindir+set}
+ac_env_pkgbindir_value=$pkgbindir
+ac_cv_env_pkgbindir_set=${pkgbindir+set}
+ac_cv_env_pkgbindir_value=$pkgbindir
+ac_env_cfgdefdir_set=${cfgdefdir+set}
+ac_env_cfgdefdir_value=$cfgdefdir
+ac_cv_env_cfgdefdir_set=${cfgdefdir+set}
+ac_cv_env_cfgdefdir_value=$cfgdefdir
+ac_env_pkgdocdir_set=${pkgdocdir+set}
+ac_env_pkgdocdir_value=$pkgdocdir
+ac_cv_env_pkgdocdir_set=${pkgdocdir+set}
+ac_cv_env_pkgdocdir_value=$pkgdocdir
+ac_env_exmpdir_set=${exmpdir+set}
+ac_env_exmpdir_value=$exmpdir
+ac_cv_env_exmpdir_set=${exmpdir+set}
+ac_cv_env_exmpdir_value=$exmpdir
+ac_env_perllibdir_set=${perllibdir+set}
+ac_env_perllibdir_value=$perllibdir
+ac_cv_env_perllibdir_set=${perllibdir+set}
+ac_cv_env_perllibdir_value=$perllibdir
+ac_env_pluginsdir_set=${pluginsdir+set}
+ac_env_pluginsdir_value=$pluginsdir
+ac_cv_env_pluginsdir_set=${pluginsdir+set}
+ac_cv_env_pluginsdir_value=$pluginsdir
+ac_env_plugtorruscfgdir_set=${plugtorruscfgdir+set}
+ac_env_plugtorruscfgdir_value=$plugtorruscfgdir
+ac_cv_env_plugtorruscfgdir_set=${plugtorruscfgdir+set}
+ac_cv_env_plugtorruscfgdir_value=$plugtorruscfgdir
+ac_env_plugdevdisccfgdir_set=${plugdevdisccfgdir+set}
+ac_env_plugdevdisccfgdir_value=$plugdevdisccfgdir
+ac_cv_env_plugdevdisccfgdir_set=${plugdevdisccfgdir+set}
+ac_cv_env_plugdevdisccfgdir_value=$plugdevdisccfgdir
+ac_env_plugwrapperdir_set=${plugwrapperdir+set}
+ac_env_plugwrapperdir_value=$plugwrapperdir
+ac_cv_env_plugwrapperdir_set=${plugwrapperdir+set}
+ac_cv_env_plugwrapperdir_value=$plugwrapperdir
+ac_env_scriptsdir_set=${scriptsdir+set}
+ac_env_scriptsdir_value=$scriptsdir
+ac_cv_env_scriptsdir_set=${scriptsdir+set}
+ac_cv_env_scriptsdir_value=$scriptsdir
+ac_env_supdir_set=${supdir+set}
+ac_env_supdir_value=$supdir
+ac_cv_env_supdir_set=${supdir+set}
+ac_cv_env_supdir_value=$supdir
+ac_env_webplaindir_set=${webplaindir+set}
+ac_env_webplaindir_value=$webplaindir
+ac_cv_env_webplaindir_set=${webplaindir+set}
+ac_cv_env_webplaindir_value=$webplaindir
+ac_env_webscriptsdir_set=${webscriptsdir+set}
+ac_env_webscriptsdir_value=$webscriptsdir
+ac_cv_env_webscriptsdir_set=${webscriptsdir+set}
+ac_cv_env_webscriptsdir_value=$webscriptsdir
+ac_env_tmpldir_set=${tmpldir+set}
+ac_env_tmpldir_value=$tmpldir
+ac_cv_env_tmpldir_set=${tmpldir+set}
+ac_cv_env_tmpldir_value=$tmpldir
+ac_env_distxmldir_set=${distxmldir+set}
+ac_env_distxmldir_value=$distxmldir
+ac_cv_env_distxmldir_set=${distxmldir+set}
+ac_cv_env_distxmldir_value=$distxmldir
+ac_env_sitedir_set=${sitedir+set}
+ac_env_sitedir_value=$sitedir
+ac_cv_env_sitedir_set=${sitedir+set}
+ac_cv_env_sitedir_value=$sitedir
+ac_env_siteconfdir_set=${siteconfdir+set}
+ac_env_siteconfdir_value=$siteconfdir
+ac_cv_env_siteconfdir_set=${siteconfdir+set}
+ac_cv_env_siteconfdir_value=$siteconfdir
+ac_env_tmpluserdir_set=${tmpluserdir+set}
+ac_env_tmpluserdir_value=$tmpluserdir
+ac_cv_env_tmpluserdir_set=${tmpluserdir+set}
+ac_cv_env_tmpluserdir_value=$tmpluserdir
+ac_env_sitexmldir_set=${sitexmldir+set}
+ac_env_sitexmldir_value=$sitexmldir
+ac_cv_env_sitexmldir_set=${sitexmldir+set}
+ac_cv_env_sitexmldir_value=$sitexmldir
+ac_env_logdir_set=${logdir+set}
+ac_env_logdir_value=$logdir
+ac_cv_env_logdir_set=${logdir+set}
+ac_cv_env_logdir_value=$logdir
+ac_env_piddir_set=${piddir+set}
+ac_env_piddir_value=$piddir
+ac_cv_env_piddir_set=${piddir+set}
+ac_cv_env_piddir_value=$piddir
+ac_env_varprefix_set=${varprefix+set}
+ac_env_varprefix_value=$varprefix
+ac_cv_env_varprefix_set=${varprefix+set}
+ac_cv_env_varprefix_value=$varprefix
+ac_env_cachedir_set=${cachedir+set}
+ac_env_cachedir_value=$cachedir
+ac_cv_env_cachedir_set=${cachedir+set}
+ac_cv_env_cachedir_value=$cachedir
+ac_env_dbhome_set=${dbhome+set}
+ac_env_dbhome_value=$dbhome
+ac_cv_env_dbhome_set=${dbhome+set}
+ac_cv_env_dbhome_value=$dbhome
+ac_env_reportsdir_set=${reportsdir+set}
+ac_env_reportsdir_value=$reportsdir
+ac_cv_env_reportsdir_set=${reportsdir+set}
+ac_cv_env_reportsdir_value=$reportsdir
+ac_env_seslockdir_set=${seslockdir+set}
+ac_env_seslockdir_value=$seslockdir
+ac_cv_env_seslockdir_set=${seslockdir+set}
+ac_cv_env_seslockdir_value=$seslockdir
+ac_env_sesstordir_set=${sesstordir+set}
+ac_env_sesstordir_value=$sesstordir
+ac_cv_env_sesstordir_set=${sesstordir+set}
+ac_cv_env_sesstordir_value=$sesstordir
+ac_env_wrapperdir_set=${wrapperdir+set}
+ac_env_wrapperdir_value=$wrapperdir
+ac_cv_env_wrapperdir_set=${wrapperdir+set}
+ac_cv_env_wrapperdir_value=$wrapperdir
+ac_env_mansec_usercmd_set=${mansec_usercmd+set}
+ac_env_mansec_usercmd_value=$mansec_usercmd
+ac_cv_env_mansec_usercmd_set=${mansec_usercmd+set}
+ac_cv_env_mansec_usercmd_value=$mansec_usercmd
+ac_env_mansec_misc_set=${mansec_misc+set}
+ac_env_mansec_misc_value=$mansec_misc
+ac_cv_env_mansec_misc_set=${mansec_misc+set}
+ac_cv_env_mansec_misc_value=$mansec_misc
+ac_env_defrrddir_set=${defrrddir+set}
+ac_env_defrrddir_value=$defrrddir
+ac_cv_env_defrrddir_set=${defrrddir+set}
+ac_cv_env_defrrddir_value=$defrrddir
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures torrus 1.0.9 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+  cat <<_ACEOF
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                         [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                         [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of torrus 1.0.9:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-pkgonly        Skip all checking
+  --disable-threads       Disable Perl threads usage
+  --disable-varperm       Disable db and cache access rights tuning
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-rrdtool=DIR      RRDTool location
+
+Some influential environment variables:
+  PERLINC     [] Additional space-separated Perl library paths
+  torrus_user [torrus] UID to run the daemons
+  var_user    [TORRUS_USER] Owner of db and cache directories
+  var_group   [torrus] Group of db and cache directories
+  var_mode    [775] Mode of db and cache directories
+  pkghome     [PREFIX/torrus] Place for Torrus static files
+  pkgbindir   [PKGHOME/bin] Torrus executables
+  cfgdefdir   [PKGHOME/conf_defaults] torrus-config.pl and others
+  pkgdocdir   [PKGHOME/doc] Documentation files
+  exmpdir     [PKGHOME/examples] Examples
+  perllibdir  [PKGHOME/perllib] Torrus Perl libraries
+  pluginsdir  [PKGHOME/plugins] Plugin configurations
+  plugtorruscfgdir
+              [PLUGINSDIR/torrus-config]
+  plugdevdisccfgdir
+              [PLUGINSDIR/devdiscover-config]
+  plugwrapperdir
+              [PLUGINSDIR/wrapper]
+  scriptsdir  [PKGHOME/scripts] Script files
+  supdir      [PKGHOME/sup] Supplementary files
+  webplaindir [SUPDIR/webplain] Web interface plain files path
+  webscriptsdir
+              [SUPDIR/webscripts] Directory for optional web scripts
+  tmpldir     [PKGHOME/templates] Template files
+  distxmldir  [PKGHOME/xmlconfig] Distribution XML config files
+  sitedir     [SYSCONFDIR/torrus] Site configuration files
+  siteconfdir [SITEDIR/conf] Site configuration files
+  tmpluserdir [SITEDIR/templates] User-defined Template files
+  sitexmldir  [SITEDIR/xmlconfig] Site XML configs
+  logdir      [/var/log/torrus] Log files
+  piddir      [/var/run/torrus] PID files
+  varprefix   [/var/torrus] Common prefix for runtime data
+  cachedir    [VARPREFIX/cache] Renderer cache
+  dbhome      [VARPREFIX/db] Berkeley DB files
+  reportsdir  [VARPREFIX/reports] Reports output
+  seslockdir  [VARPREFIX/session_data/lock] Web session locks
+  sesstordir  [VARPREFIX/session_data/store] Web session storage
+  wrapperdir  [BINDIR] CLI wrapper
+  mansec_usercmd
+              [1] User commands man section
+  mansec_misc [7] Miscellaneous man section
+  defrrddir   [/srv/torrus/collector_rrd] Default RRD storage path
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <ssinyagin@users.sourceforge.net>.
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  ac_popdir=`pwd`
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d $ac_dir || continue
+    ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+    cd $ac_dir
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_srcdir/configure.gnu; then
+      echo
+      $SHELL $ac_srcdir/configure.gnu  --help=recursive
+    elif test -f $ac_srcdir/configure; then
+      echo
+      $SHELL $ac_srcdir/configure  --help=recursive
+    elif test -f $ac_srcdir/configure.ac ||
+          test -f $ac_srcdir/configure.in; then
+      echo
+      $ac_configure --help
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi
+    cd $ac_popdir
+  done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+  cat <<\_ACEOF
+torrus configure 1.0.9
+generated by GNU Autoconf 2.59
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by torrus $as_me 1.0.9, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+       ac_must_keep_next=false # Got value, back to normal.
+      else
+       case $ac_arg in
+         *=* | --config-cache | -C | -disable-* | --disable-* \
+         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+         | -with-* | --with-* | -without-* | --without-* | --x)
+           case "$ac_configure_args0 " in
+             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+           esac
+           ;;
+         -* ) ac_must_keep_next=true ;;
+       esac
+      fi
+      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+{
+  (set) 2>&1 |
+    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      sed -n \
+       "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+      ;;
+    *)
+      sed -n \
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+}
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+       eval ac_val=$`echo $ac_var`
+       echo "$ac_var='"'"'$ac_val'"'"'"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h | sort
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core &&
+  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+     ' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . $cache_file;;
+      *)                      . ./$cache_file;;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+              sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+  eval ac_new_val="\$ac_env_${ac_var}_value"
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+       { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+       { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+       { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+       ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_aux_dir=
+for ac_dir in conftools $srcdir/conftools; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f $ac_dir/shtool; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in conftools $srcdir/conftools" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in conftools $srcdir/conftools" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+  ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+  ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+am__api_version="1.9"
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+       if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+         if test $ac_prog = install &&
+           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+           break 3
+         fi
+       fi
+      done
+    done
+    ;;
+esac
+done
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,$program_prefix,;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+  # We used to keeping the `.' as first argument, in order to
+  # allow $(mkdir_p) to be used without argument.  As in
+  #   $(mkdir_p) $(somedir)
+  # where $(somedir) is conditionally defined.  However this is wrong
+  # for two reasons:
+  #  1. if the package is installed by a user who cannot write `.'
+  #     make install will fail,
+  #  2. the above comment should most certainly read
+  #     $(mkdir_p) $(DESTDIR)$(somedir)
+  #     so it does not work when $(somedir) is undefined and
+  #     $(DESTDIR) is not.
+  #  To support the latter case, we have to write
+  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
+  #  so the `.' trick is pointless.
+  mkdir_p='mkdir -p --'
+else
+  # On NextStep and OpenStep, the `mkdir' command does not
+  # recognize any option.  It will interpret all options as
+  # directories to create, and then abort because `.' already
+  # exists.
+  for d in ./-p ./--version;
+  do
+    test -d $d && rmdir $d
+  done
+  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+  if test -f "$ac_aux_dir/mkinstalldirs"; then
+    mkdir_p='$(mkinstalldirs)'
+  else
+    mkdir_p='$(install_sh) -d'
+  fi
+fi
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$AWK" && break
+done
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+all:
+       @echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+  SET_MAKE=
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='torrus'
+ VERSION='1.0.9'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  STRIP=$ac_ct_STRIP
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+
+# Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_PERL+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $PERL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="no"
+  ;;
+esac
+fi
+PERL=$ac_cv_path_PERL
+
+if test -n "$PERL"; then
+  echo "$as_me:$LINENO: result: $PERL" >&5
+echo "${ECHO_T}$PERL" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+# Need this for init.torrus
+# Extract the first word of "su", so it can be a program name with args.
+set dummy su; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_SU+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $SU in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_SU="$SU" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_SU="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_SU" && ac_cv_path_SU="no"
+  ;;
+esac
+fi
+SU=$ac_cv_path_SU
+
+if test -n "$SU"; then
+  echo "$as_me:$LINENO: result: $SU" >&5
+echo "${ECHO_T}$SU" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+# Extract the first word of "kill", so it can be a program name with args.
+set dummy kill; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_KILL+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $KILL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_KILL="$KILL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_KILL="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_KILL" && ac_cv_path_KILL="no"
+  ;;
+esac
+fi
+KILL=$ac_cv_path_KILL
+
+if test -n "$KILL"; then
+  echo "$as_me:$LINENO: result: $KILL" >&5
+echo "${ECHO_T}$KILL" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+# Extract the first word of "sed", so it can be a program name with args.
+set dummy sed; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_SED+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $SED in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_SED="$SED" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_SED" && ac_cv_path_SED="no"
+  ;;
+esac
+fi
+SED=$ac_cv_path_SED
+
+if test -n "$SED"; then
+  echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+# Extract the first word of "find", so it can be a program name with args.
+set dummy find; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_FIND+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $FIND in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_FIND="$FIND" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_FIND="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_FIND" && ac_cv_path_FIND="no"
+  ;;
+esac
+fi
+FIND=$ac_cv_path_FIND
+
+if test -n "$FIND"; then
+  echo "$as_me:$LINENO: result: $FIND" >&5
+echo "${ECHO_T}$FIND" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+# Extract the first word of "rm", so it can be a program name with args.
+set dummy rm; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_RM+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $RM in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_RM="$RM" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_RM" && ac_cv_path_RM="no"
+  ;;
+esac
+fi
+RM=$ac_cv_path_RM
+
+if test -n "$RM"; then
+  echo "$as_me:$LINENO: result: $RM" >&5
+echo "${ECHO_T}$RM" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+# Extract the first word of "sleep", so it can be a program name with args.
+set dummy sleep; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_SLEEP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $SLEEP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_SLEEP="$SLEEP" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_SLEEP="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_SLEEP" && ac_cv_path_SLEEP="no"
+  ;;
+esac
+fi
+SLEEP=$ac_cv_path_SLEEP
+
+if test -n "$SLEEP"; then
+  echo "$as_me:$LINENO: result: $SLEEP" >&5
+echo "${ECHO_T}$SLEEP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+
+# This will generate doc pages from POD sources
+# Extract the first word of "pod2text", so it can be a program name with args.
+set dummy pod2text; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_POD2TEXT+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $POD2TEXT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_POD2TEXT="$POD2TEXT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_POD2TEXT="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_POD2TEXT" && ac_cv_path_POD2TEXT="no"
+  ;;
+esac
+fi
+POD2TEXT=$ac_cv_path_POD2TEXT
+
+if test -n "$POD2TEXT"; then
+  echo "$as_me:$LINENO: result: $POD2TEXT" >&5
+echo "${ECHO_T}$POD2TEXT" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+
+if test "$POD2TEXT" != no; then
+  POD2TEXT_PRESENT_TRUE=
+  POD2TEXT_PRESENT_FALSE='#'
+else
+  POD2TEXT_PRESENT_TRUE='#'
+  POD2TEXT_PRESENT_FALSE=
+fi
+
+# Extract the first word of "pod2man", so it can be a program name with args.
+set dummy pod2man; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_POD2MAN+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $POD2MAN in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_POD2MAN="$POD2MAN" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_POD2MAN="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_POD2MAN" && ac_cv_path_POD2MAN="no"
+  ;;
+esac
+fi
+POD2MAN=$ac_cv_path_POD2MAN
+
+if test -n "$POD2MAN"; then
+  echo "$as_me:$LINENO: result: $POD2MAN" >&5
+echo "${ECHO_T}$POD2MAN" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+
+if test "$POD2MAN" != no; then
+  POD2MAN_PRESENT_TRUE=
+  POD2MAN_PRESENT_FALSE='#'
+else
+  POD2MAN_PRESENT_TRUE='#'
+  POD2MAN_PRESENT_FALSE=
+fi
+
+
+# Check whether --enable-pkgonly or --disable-pkgonly was given.
+if test "${enable_pkgonly+set}" = set; then
+  enableval="$enable_pkgonly"
+
+fi;
+
+
+# Check whether --enable-threads or --disable-threads was given.
+if test "${enable_threads+set}" = set; then
+  enableval="$enable_threads"
+
+fi;
+
+perllibdirs="\'\${perllibdir}\'"
+
+PERLOPTS=
+
+if test ! -z "$PERLINC"; then
+   for d in $PERLINC; do
+       PERLOPTS="${PERLOPTS} -I${d}"
+       perllibdirs=${perllibdirs}"\,\'"${d}"\'"
+   done
+fi
+
+find_rrdtool () {
+    if ${PERL} -e 'use RRDs' 2>/dev/null; then :; else
+        if test "$enable_pkgonly" != yes; then
+            { echo "$as_me:$LINENO: RRDs.pm is not in default Perl search paths." >&5
+echo "$as_me: RRDs.pm is not in default Perl search paths." >&6;}
+            echo "$as_me:$LINENO: checking RRDtool in /usr/local/rrdtool*" >&5
+echo $ECHO_N "checking RRDtool in /usr/local/rrdtool*... $ECHO_C" >&6
+            with_rrdtool=`ls -1dr /usr/local/rrdtool* | head -1`
+            if test -d $with_rrdtool; then
+               echo "$as_me:$LINENO: result: ${with_rrdtool}" >&5
+echo "${ECHO_T}${with_rrdtool}" >&6
+            else
+               { { echo "$as_me:$LINENO: error: Cannot find RRDtool" >&5
+echo "$as_me: error: Cannot find RRDtool" >&2;}
+   { (exit 1); exit 1; }; }
+            fi
+            test_rrdtool
+        else
+            with_rrdtool="/usr/local/rrdtool"
+        fi
+    fi
+}
+
+test_rrdtool () {
+    if test "$enable_pkgonly" != yes; then
+        if ${PERL} -I${with_rrdtool}/lib/perl -e 'use RRDs'; then :; else
+            { { echo "$as_me:$LINENO: error: Could not find RRDs perl module in ${with_rrdtool}" >&5
+echo "$as_me: error: Could not find RRDs perl module in ${with_rrdtool}" >&2;}
+   { (exit 1); exit 1; }; }
+        fi
+    fi
+    perllibdirs=${perllibdirs}"\,\'"${with_rrdtool}"/lib/perl/\'"
+}
+
+
+# Check whether --with-rrdtool or --without-rrdtool was given.
+if test "${with_rrdtool+set}" = set; then
+  withval="$with_rrdtool"
+  test_rrdtool
+else
+  find_rrdtool
+fi;
+
+perllibdirs=${perllibdirs}
+
+
+
+# Check the necessary Perl modules
+
+if test "$enable_pkgonly" != yes; then
+
+   for module in 'BerkeleyDB' 'XML::LibXML' 'Template' \
+                 'Proc::Daemon' 'Net::SNMP' 'URI::Escape' 'Apache::Session' \
+                 'Date::Parse' 'JSON'
+   do
+     echo "$as_me:$LINENO: checking presence of $module" >&5
+echo $ECHO_N "checking presence of $module... $ECHO_C" >&6
+     if ${PERL} ${PERLOPTS} -e 'use '$module 2>/dev/null; then
+         echo "$as_me:$LINENO: result: Ok" >&5
+echo "${ECHO_T}Ok" >&6
+     else
+         { { echo "$as_me:$LINENO: error: Perl cannot find $module" >&5
+echo "$as_me: error: Perl cannot find $module" >&2;}
+   { (exit 1); exit 1; }; };
+     fi
+   done
+
+#  Check if Perl threads can be used.
+#  Requirements are: perl 5.8.8 with threads compiled,
+#  threads ver. 1.41 or higher, threads::shared ver. 1.03 or higher
+
+   perlithreads=1
+   if test x"$enable_threads" = xno; then
+     perlithreads=0
+   else
+
+     echo "$as_me:$LINENO: checking if Perl version is 5.8.8 or higher" >&5
+echo $ECHO_N "checking if Perl version is 5.8.8 or higher... $ECHO_C" >&6
+     if ${PERL} ${PERLOPTS} -e 'use 5.8.8' 2>/dev/null; then
+       echo "$as_me:$LINENO: result: Ok" >&5
+echo "${ECHO_T}Ok" >&6
+     else
+       perlithreads=0
+     fi
+
+     if test ${perlithreads} -eq 1; then
+       echo "$as_me:$LINENO: checking threading support in Perl" >&5
+echo $ECHO_N "checking threading support in Perl... $ECHO_C" >&6
+       if ${PERL} ${PERLOPTS} -e 'use threads' 2>/dev/null; then
+         echo "$as_me:$LINENO: result: Ok" >&5
+echo "${ECHO_T}Ok" >&6
+       else
+         perlithreads=0
+       fi
+     fi
+
+     if test ${perlithreads} -eq 1; then
+       echo "$as_me:$LINENO: checking if threads module version is 1.41 or higher" >&5
+echo $ECHO_N "checking if threads module version is 1.41 or higher... $ECHO_C" >&6
+       if ${PERL} ${PERLOPTS} -e \
+         'use threads; exit($threads::VERSION >= 1.41 ? 0:1)'; then
+           echo "$as_me:$LINENO: result: Ok" >&5
+echo "${ECHO_T}Ok" >&6
+       else
+           perlithreads=0
+       fi
+     fi
+
+     if test ${perlithreads} -eq 1; then
+       echo "$as_me:$LINENO: checking if threads::shared module version is 1.03 or higher" >&5
+echo $ECHO_N "checking if threads::shared module version is 1.03 or higher... $ECHO_C" >&6
+       if ${PERL} ${PERLOPTS} -e \
+         'use threads; use threads::shared;
+          exit($threads::shared::VERSION >= 1.03 ? 0:1)'; then
+           echo "$as_me:$LINENO: result: Ok" >&5
+echo "${ECHO_T}Ok" >&6
+       else
+           perlithreads=0
+       fi
+     fi
+
+     if test ${perlithreads} -eq 0; then
+       echo "$as_me:$LINENO: result: No. Multithreading will not be used." >&5
+echo "${ECHO_T}No. Multithreading will not be used." >&6
+     fi
+
+   fi
+   perlithreads=${perlithreads}
+
+fi
+
+
+if test -z "$torrus_user"; then
+   torrus_user=torrus; fi
+
+if test "$enable_pkgonly" != yes; then
+    echo "$as_me:$LINENO: checking if user ${torrus_user} exists" >&5
+echo $ECHO_N "checking if user ${torrus_user} exists... $ECHO_C" >&6
+    torrus_check_file=torrus_usercheck_$$
+    torrus_check_error=no
+    if ! touch ${torrus_check_file}; then
+        { { echo "$as_me:$LINENO: error: Cannot create ${torrus_check_file}" >&5
+echo "$as_me: error: Cannot create ${torrus_check_file}" >&2;}
+   { (exit 1); exit 1; }; }
+    elif ! chown ${torrus_user} ${torrus_check_file}; then
+        torrus_check_error=yes
+    fi
+    rm -f ${torrus_check_file}
+    if test ${torrus_check_error} = yes; then
+        { { echo "$as_me:$LINENO: error: User ${torrus_user} does not exist" >&5
+echo "$as_me: error: User ${torrus_user} does not exist" >&2;}
+   { (exit 1); exit 1; }; }
+    else
+        echo "$as_me:$LINENO: result: Ok" >&5
+echo "${ECHO_T}Ok" >&6
+    fi
+fi
+
+
+# Set the var/db and var/cache ownership
+
+
+
+
+
+# Check whether --enable-varperm or --disable-varperm was given.
+if test "${enable_varperm+set}" = set; then
+  enableval="$enable_varperm"
+
+else
+  enable_varperm="yes"
+fi;
+
+
+
+if test -z "$pkghome"; then
+   pkghome='${prefix}/torrus'; fi
+
+
+if test -z "$pkgbindir"; then
+   pkgbindir='${pkghome}/bin'; fi
+
+
+if test -z "$cfgdefdir"; then
+   cfgdefdir='${pkghome}/conf_defaults'; fi
+
+
+if test -z "$pkgdocdir"; then
+   pkgdocdir='${pkghome}/doc'; fi
+
+
+if test -z "$exmpdir"; then
+   exmpdir='${pkghome}/examples'; fi
+
+
+if test -z "$perllibdir"; then
+   perllibdir='${pkghome}/perllib'; fi
+
+
+if test -z "$pluginsdir"; then
+   pluginsdir='${pkghome}/plugins'; fi
+
+
+if test -z "$plugtorruscfgdir"; then
+   plugtorruscfgdir='${pluginsdir}/torrus-config'; fi
+
+
+if test -z "$plugdevdisccfgdir"; then
+   plugdevdisccfgdir='${pluginsdir}/devdiscover-config'; fi
+
+
+if test -z "$plugwrapperdir"; then
+   plugwrapperdir='${pluginsdir}/wrapper'; fi
+
+
+
+if test -z "$scriptsdir"; then
+   scriptsdir='${pkghome}/scripts'; fi
+
+
+if test -z "$supdir"; then
+   supdir='${pkghome}/sup'; fi
+
+
+if test -z "$webplaindir"; then
+   webplaindir='${supdir}/webplain'; fi
+
+
+if test -z "$webscriptsdir"; then
+   webscriptsdir='${supdir}/webscripts'; fi
+
+
+if test -z "$tmpldir"; then
+   tmpldir='${pkghome}/templates'; fi
+
+
+if test -z "$distxmldir"; then
+   distxmldir='${pkghome}/xmlconfig'; fi
+
+
+if test -z "$sitedir"; then
+   sitedir='${sysconfdir}/torrus'; fi
+
+
+if test -z "$siteconfdir"; then
+   siteconfdir='${sitedir}/conf'; fi
+
+
+if test -z "$tmpluserdir"; then
+   tmpluserdir='${sitedir}/templates'; fi
+
+
+if test -z "$sitexmldir"; then
+   sitexmldir='${sitedir}/xmlconfig'; fi
+
+
+if test -z "$logdir"; then
+   logdir='/var/log/torrus'; fi
+
+
+if test -z "$piddir"; then
+   piddir='/var/run/torrus'; fi
+
+
+if test -z "$varprefix"; then
+   varprefix='/var/torrus'; fi
+
+
+if test -z "$cachedir"; then
+   cachedir='${varprefix}/cache'; fi
+
+
+if test -z "$dbhome"; then
+   dbhome='${varprefix}/db'; fi
+
+
+if test -z "$reportsdir"; then
+   reportsdir='${varprefix}/reports'; fi
+
+
+if test -z "$seslockdir"; then
+   seslockdir='${varprefix}/session_data/lock'; fi
+
+
+if test -z "$sesstordir"; then
+   sesstordir='${varprefix}/session_data/store'; fi
+
+
+if test -z "$wrapperdir"; then
+   wrapperdir='${bindir}'; fi
+
+
+if test -z "$mansec_usercmd"; then
+   mansec_usercmd='1'; fi
+
+
+if test -z "$mansec_misc"; then
+   mansec_misc='7'; fi
+
+
+if test -z "$defrrddir"; then
+   defrrddir='/srv/torrus/collector_rrd'; fi
+
+
+                              ac_config_files="$ac_config_files Makefile bin/Makefile configs/Makefile"
+
+                    ac_config_files="$ac_config_files doc/Makefile doc/manpages/Makefile"
+
+                    ac_config_files="$ac_config_files examples/Makefile perllib/Makefile"
+
+                    ac_config_files="$ac_config_files sup/Makefile xmlconfig/Makefile"
+
+
+          ac_config_files="$ac_config_files setup_tools/substvars.sh"
+
+          ac_config_files="$ac_config_files setup_tools/mkvardir.sh"
+
+          ac_config_files="$ac_config_files init.d/torrus"
+
+
+
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+  (set) 2>&1 |
+    case `(ac_space=' '; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+       "s/'/'\\\\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;;
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n \
+       "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+  if test -w $cache_file; then
+    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+    cat confcache >$cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[         ]*VPATH[        ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[    ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[      ]*$//;
+}'
+fi
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section.  Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\_ACEOF
+t clear
+: clear
+s,^[    ]*#[    ]*define[       ][      ]*\([^  (][^    (]*([^)]*)\)[   ]*\(.*\),-D\1=\2,g
+t quote
+s,^[    ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\),-D\1=\2,g
+t quote
+d
+: quote
+s,[     `~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output.  A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+        sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${POD2TEXT_PRESENT_TRUE}" && test -z "${POD2TEXT_PRESENT_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"POD2TEXT_PRESENT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"POD2TEXT_PRESENT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${POD2MAN_PRESENT_TRUE}" && test -z "${POD2MAN_PRESENT_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"POD2MAN_PRESENT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"POD2MAN_PRESENT\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by torrus $as_me 1.0.9, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+                  instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+torrus config.status 1.0.9
+configured by $0, generated by GNU Autoconf 2.59,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "x$1" : 'x\([^=]*\)='`
+    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  -*)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1" ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+  "bin/Makefile" ) CONFIG_FILES="$CONFIG_FILES bin/Makefile" ;;
+  "configs/Makefile" ) CONFIG_FILES="$CONFIG_FILES configs/Makefile" ;;
+  "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+  "doc/manpages/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/manpages/Makefile" ;;
+  "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
+  "perllib/Makefile" ) CONFIG_FILES="$CONFIG_FILES perllib/Makefile" ;;
+  "sup/Makefile" ) CONFIG_FILES="$CONFIG_FILES sup/Makefile" ;;
+  "xmlconfig/Makefile" ) CONFIG_FILES="$CONFIG_FILES xmlconfig/Makefile" ;;
+  "setup_tools/substvars.sh" ) CONFIG_FILES="$CONFIG_FILES setup_tools/substvars.sh" ;;
+  "setup_tools/mkvardir.sh" ) CONFIG_FILES="$CONFIG_FILES setup_tools/mkvardir.sh" ;;
+  "init.d/torrus" ) CONFIG_FILES="$CONFIG_FILES init.d/torrus" ;;
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./confstat$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CYGPATH_W@,$CYGPATH_W,;t t
+s,@PACKAGE@,$PACKAGE,;t t
+s,@VERSION@,$VERSION,;t t
+s,@ACLOCAL@,$ACLOCAL,;t t
+s,@AUTOCONF@,$AUTOCONF,;t t
+s,@AUTOMAKE@,$AUTOMAKE,;t t
+s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@MAKEINFO@,$MAKEINFO,;t t
+s,@install_sh@,$install_sh,;t t
+s,@STRIP@,$STRIP,;t t
+s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s,@mkdir_p@,$mkdir_p,;t t
+s,@AWK@,$AWK,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@am__leading_dot@,$am__leading_dot,;t t
+s,@AMTAR@,$AMTAR,;t t
+s,@am__tar@,$am__tar,;t t
+s,@am__untar@,$am__untar,;t t
+s,@PERL@,$PERL,;t t
+s,@SU@,$SU,;t t
+s,@KILL@,$KILL,;t t
+s,@SED@,$SED,;t t
+s,@FIND@,$FIND,;t t
+s,@RM@,$RM,;t t
+s,@SLEEP@,$SLEEP,;t t
+s,@POD2TEXT@,$POD2TEXT,;t t
+s,@POD2TEXT_PRESENT_TRUE@,$POD2TEXT_PRESENT_TRUE,;t t
+s,@POD2TEXT_PRESENT_FALSE@,$POD2TEXT_PRESENT_FALSE,;t t
+s,@POD2MAN@,$POD2MAN,;t t
+s,@POD2MAN_PRESENT_TRUE@,$POD2MAN_PRESENT_TRUE,;t t
+s,@POD2MAN_PRESENT_FALSE@,$POD2MAN_PRESENT_FALSE,;t t
+s,@enable_pkgonly@,$enable_pkgonly,;t t
+s,@PERLINC@,$PERLINC,;t t
+s,@perllibdirs@,$perllibdirs,;t t
+s,@perlithreads@,$perlithreads,;t t
+s,@torrus_user@,$torrus_user,;t t
+s,@var_user@,$var_user,;t t
+s,@var_group@,$var_group,;t t
+s,@var_mode@,$var_mode,;t t
+s,@enable_varperm@,$enable_varperm,;t t
+s,@pkghome@,$pkghome,;t t
+s,@pkgbindir@,$pkgbindir,;t t
+s,@cfgdefdir@,$cfgdefdir,;t t
+s,@pkgdocdir@,$pkgdocdir,;t t
+s,@exmpdir@,$exmpdir,;t t
+s,@perllibdir@,$perllibdir,;t t
+s,@pluginsdir@,$pluginsdir,;t t
+s,@plugtorruscfgdir@,$plugtorruscfgdir,;t t
+s,@plugdevdisccfgdir@,$plugdevdisccfgdir,;t t
+s,@plugwrapperdir@,$plugwrapperdir,;t t
+s,@scriptsdir@,$scriptsdir,;t t
+s,@supdir@,$supdir,;t t
+s,@webplaindir@,$webplaindir,;t t
+s,@webscriptsdir@,$webscriptsdir,;t t
+s,@tmpldir@,$tmpldir,;t t
+s,@distxmldir@,$distxmldir,;t t
+s,@sitedir@,$sitedir,;t t
+s,@siteconfdir@,$siteconfdir,;t t
+s,@tmpluserdir@,$tmpluserdir,;t t
+s,@sitexmldir@,$sitexmldir,;t t
+s,@logdir@,$logdir,;t t
+s,@piddir@,$piddir,;t t
+s,@varprefix@,$varprefix,;t t
+s,@cachedir@,$cachedir,;t t
+s,@dbhome@,$dbhome,;t t
+s,@reportsdir@,$reportsdir,;t t
+s,@seslockdir@,$seslockdir,;t t
+s,@sesstordir@,$sesstordir,;t t
+s,@wrapperdir@,$wrapperdir,;t t
+s,@mansec_usercmd@,$mansec_usercmd,;t t
+s,@mansec_misc@,$mansec_misc,;t t
+s,@defrrddir@,$defrrddir,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # Split the substitutions into bite-sized pieces for seds with
+  # small command number limits, like on Digital OSF/1 and HP-UX.
+  ac_max_sed_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # Line after last line for current file.
+  ac_more_lines=:
+  ac_sed_cmds=
+  while $ac_more_lines; do
+    if test $ac_beg -gt 1; then
+      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
+    else
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+       ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+       ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
+    fi
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
+  fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+       cat >$tmp/stdin
+       ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+       ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  esac
+
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+                                    sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+        # Absolute (can't be DOS-style, as IFS=:)
+        test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        echo "$f";;
+      *) # Relative
+        if test -f "$f"; then
+          # Build tree
+          echo "$f"
+        elif test -f "$srcdir/$f"; then
+          # Source tree
+          echo "$srcdir/$f"
+        else
+          # /dev/null tree
+          { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+        fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
+
+  # Run the commands associated with the file.
+  case $ac_file in
+    setup_tools/substvars.sh ) chmod +x setup_tools/substvars.sh ;;
+    setup_tools/mkvardir.sh ) chmod +x setup_tools/mkvardir.sh ;;
+    init.d/torrus ) chmod +x init.d/torrus ;;
+  esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
+
+VARSAVE=configs/instvars
+echo creating $VARSAVE
+rm -f $VARSAVE
+for VAR in $ac_subst_vars; do
+    case ${VAR} in
+      DEFS | PACKAGE* | INSTALL* | VERSION | ACLOCAL | AUTO* | MAKEINFO |\
+      install_sh | AM* | am* | ac* | ECHO* | build* | host* | target* |\
+      CYG* | PATH_SEPARATOR | AWK | STRIP | mkdir* |\
+      perllibdirs )
+      ;;
+      *)
+        eval 'VAL=${'$VAR'}'
+        echo ${VAR}=\'${VAL}\' >>$VARSAVE
+      ;;
+    esac
+done
diff --git a/torrus/configure.ac b/torrus/configure.ac
new file mode 100644 (file)
index 0000000..f137c04
--- /dev/null
@@ -0,0 +1,363 @@
+#  Copyright (C) 2002-2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: configure.ac,v 1.1 2010-12-27 00:03:31 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+
+AC_INIT([torrus],[1.0.9],[ssinyagin@users.sourceforge.net])
+AC_PREREQ([2.59])
+AC_CONFIG_AUX_DIR(conftools)
+AC_CANONICAL_HOST
+AM_INIT_AUTOMAKE(1.9)
+
+AC_PATH_PROG(PERL, perl, no)
+
+# Need this for init.torrus
+AC_PATH_PROG(SU, su, no)
+AC_PATH_PROG(KILL, kill, no)
+AC_PATH_PROG(SED, sed, no)
+AC_PATH_PROG(FIND, find, no)
+AC_PATH_PROG(RM, rm, no)
+AC_PATH_PROG(SLEEP, sleep, no)
+
+
+# This will generate doc pages from POD sources
+AC_PATH_PROG(POD2TEXT, pod2text, no)
+AM_CONDITIONAL([POD2TEXT_PRESENT], [test "$POD2TEXT" != no])
+AC_PATH_PROG(POD2MAN, pod2man, no)
+AM_CONDITIONAL([POD2MAN_PRESENT], [test "$POD2MAN" != no])
+
+AC_ARG_ENABLE(pkgonly,
+        [AC_HELP_STRING([--enable-pkgonly],
+                        [Skip all checking])])
+AC_SUBST(enable_pkgonly)
+
+AC_ARG_ENABLE(threads,
+        [AC_HELP_STRING([--disable-threads],
+                        [Disable Perl threads usage])])
+        
+perllibdirs="\'\${perllibdir}\'"
+
+PERLOPTS=
+AC_ARG_VAR(PERLINC,  [[] Additional space-separated Perl library paths])
+if test ! -z "$PERLINC"; then
+   for d in $PERLINC; do
+       PERLOPTS="${PERLOPTS} -I${d}"
+       perllibdirs=${perllibdirs}"\,\'"${d}"\'"
+   done
+fi
+
+find_rrdtool () {
+    if ${PERL} -e 'use RRDs' 2>/dev/null; then :; else
+        if test "$enable_pkgonly" != yes; then
+            AC_MSG_NOTICE([RRDs.pm is not in default Perl search paths.])
+            AC_MSG_CHECKING([RRDtool in /usr/local/rrdtool*])
+            with_rrdtool=`ls -1dr /usr/local/rrdtool* | head -1`
+            if test -d $with_rrdtool; then
+               AC_MSG_RESULT([${with_rrdtool}])
+            else
+               AC_MSG_ERROR([Cannot find RRDtool])
+            fi
+            test_rrdtool
+        else
+            with_rrdtool="/usr/local/rrdtool"
+        fi
+    fi
+}
+
+test_rrdtool () {
+    if test "$enable_pkgonly" != yes; then
+        if ${PERL} -I${with_rrdtool}/lib/perl -e 'use RRDs'; then :; else
+            AC_MSG_ERROR([Could not find RRDs perl module in ${with_rrdtool}])
+        fi
+    fi
+    perllibdirs=${perllibdirs}"\,\'"${with_rrdtool}"/lib/perl/\'"
+}
+
+AC_ARG_WITH(rrdtool,
+        [AC_HELP_STRING(--with-rrdtool=DIR,RRDTool location)],
+        test_rrdtool, find_rrdtool)
+
+AC_SUBST(perllibdirs, [${perllibdirs}])
+
+
+# Check the necessary Perl modules
+
+if test "$enable_pkgonly" != yes; then
+
+   for module in 'BerkeleyDB' 'XML::LibXML' 'Template' \
+                 'Proc::Daemon' 'Net::SNMP' 'URI::Escape' 'Apache::Session' \
+                 'Date::Parse' 'JSON'
+   do
+     AC_MSG_CHECKING([presence of $module])
+     if ${PERL} ${PERLOPTS} -e 'use '$module 2>/dev/null; then
+         AC_MSG_RESULT([Ok])
+     else
+         AC_MSG_ERROR([Perl cannot find $module]);
+     fi
+   done
+
+#  Check if Perl threads can be used.
+#  Requirements are: perl 5.8.8 with threads compiled,
+#  threads ver. 1.41 or higher, threads::shared ver. 1.03 or higher
+   
+   perlithreads=1
+   if test x"$enable_threads" = xno; then
+     perlithreads=0     
+   else
+   
+     AC_MSG_CHECKING([if Perl version is 5.8.8 or higher])
+     if ${PERL} ${PERLOPTS} -e 'use 5.8.8' 2>/dev/null; then
+       AC_MSG_RESULT([Ok])
+     else
+       perlithreads=0
+     fi       
+
+     if test ${perlithreads} -eq 1; then
+       AC_MSG_CHECKING([threading support in Perl])
+       if ${PERL} ${PERLOPTS} -e 'use threads' 2>/dev/null; then
+         AC_MSG_RESULT([Ok])
+       else
+         perlithreads=0
+       fi
+     fi
+
+     if test ${perlithreads} -eq 1; then     
+       AC_MSG_CHECKING([if threads module version is 1.41 or higher])
+       if ${PERL} ${PERLOPTS} -e \
+         'use threads; exit($threads::VERSION >= 1.41 ? 0:1)'; then
+           AC_MSG_RESULT([Ok])
+       else
+           perlithreads=0
+       fi
+     fi
+
+     if test ${perlithreads} -eq 1; then  
+       AC_MSG_CHECKING([if threads::shared module version is 1.03 or higher])
+       if ${PERL} ${PERLOPTS} -e \
+         'use threads; use threads::shared;
+          exit($threads::shared::VERSION >= 1.03 ? 0:1)'; then
+           AC_MSG_RESULT([Ok])
+       else         
+           perlithreads=0
+       fi
+     fi
+     
+     if test ${perlithreads} -eq 0; then  
+       AC_MSG_RESULT([No. Multithreading will not be used.])
+     fi
+          
+   fi
+   AC_SUBST(perlithreads, [${perlithreads}])   
+fi
+
+AC_ARG_VAR(torrus_user,  [[torrus] UID to run the daemons])
+if test -z "$torrus_user"; then
+   torrus_user=torrus; fi
+
+if test "$enable_pkgonly" != yes; then
+    AC_MSG_CHECKING([if user ${torrus_user} exists])
+    torrus_check_file=torrus_usercheck_$$
+    torrus_check_error=no
+    if ! touch ${torrus_check_file}; then
+        AC_MSG_ERROR([Cannot create ${torrus_check_file}])
+    elif ! chown ${torrus_user} ${torrus_check_file}; then
+        torrus_check_error=yes
+    fi
+    rm -f ${torrus_check_file}
+    if test ${torrus_check_error} = yes; then
+        AC_MSG_ERROR([User ${torrus_user} does not exist])
+    else
+        AC_MSG_RESULT([Ok])
+    fi
+fi
+   
+
+# Set the var/db and var/cache ownership
+
+AC_ARG_VAR(var_user,  [[TORRUS_USER] Owner of db and cache directories])
+AC_ARG_VAR(var_group, [[torrus] Group of db and cache directories])
+AC_ARG_VAR(var_mode,  [[775] Mode of db and cache directories])
+
+AC_ARG_ENABLE(varperm,
+        [AC_HELP_STRING(--disable-varperm,
+        Disable db and cache access rights tuning)],
+        [],
+        [enable_varperm="yes"])
+AC_SUBST(enable_varperm)
+
+AC_ARG_VAR(pkghome,   [[PREFIX/torrus] Place for Torrus static files])
+if test -z "$pkghome"; then
+   pkghome='${prefix}/torrus'; fi
+
+AC_ARG_VAR(pkgbindir,   [[PKGHOME/bin] Torrus executables])
+if test -z "$pkgbindir"; then
+   pkgbindir='${pkghome}/bin'; fi
+
+AC_ARG_VAR(cfgdefdir,   [[PKGHOME/conf_defaults] torrus-config.pl and others])
+if test -z "$cfgdefdir"; then
+   cfgdefdir='${pkghome}/conf_defaults'; fi
+
+AC_ARG_VAR(pkgdocdir, [[PKGHOME/doc] Documentation files])
+if test -z "$pkgdocdir"; then
+   pkgdocdir='${pkghome}/doc'; fi
+
+AC_ARG_VAR(exmpdir, [[PKGHOME/examples] Examples])
+if test -z "$exmpdir"; then
+   exmpdir='${pkghome}/examples'; fi
+
+AC_ARG_VAR(perllibdir,  [[PKGHOME/perllib] Torrus Perl libraries])
+if test -z "$perllibdir"; then
+   perllibdir='${pkghome}/perllib'; fi
+
+AC_ARG_VAR(pluginsdir,   [[PKGHOME/plugins] Plugin configurations])
+if test -z "$pluginsdir"; then
+   pluginsdir='${pkghome}/plugins'; fi
+
+AC_ARG_VAR(plugtorruscfgdir, [[PLUGINSDIR/torrus-config]])
+if test -z "$plugtorruscfgdir"; then
+   plugtorruscfgdir='${pluginsdir}/torrus-config'; fi
+
+AC_ARG_VAR(plugdevdisccfgdir, [[PLUGINSDIR/devdiscover-config]])
+if test -z "$plugdevdisccfgdir"; then
+   plugdevdisccfgdir='${pluginsdir}/devdiscover-config'; fi
+
+AC_ARG_VAR(plugwrapperdir, [[PLUGINSDIR/wrapper]])
+if test -z "$plugwrapperdir"; then
+   plugwrapperdir='${pluginsdir}/wrapper'; fi
+
+      
+AC_ARG_VAR(scriptsdir, [[PKGHOME/scripts] Script files])
+if test -z "$scriptsdir"; then
+   scriptsdir='${pkghome}/scripts'; fi
+
+AC_ARG_VAR(supdir, [[PKGHOME/sup] Supplementary files])
+if test -z "$supdir"; then
+   supdir='${pkghome}/sup'; fi
+
+AC_ARG_VAR(webplaindir, [[SUPDIR/webplain] Web interface plain files path])
+if test -z "$webplaindir"; then
+   webplaindir='${supdir}/webplain'; fi
+
+AC_ARG_VAR(webscriptsdir,
+        [[SUPDIR/webscripts] Directory for optional web scripts])
+if test -z "$webscriptsdir"; then
+   webscriptsdir='${supdir}/webscripts'; fi
+
+AC_ARG_VAR(tmpldir, [[PKGHOME/templates] Template files])
+if test -z "$tmpldir"; then
+   tmpldir='${pkghome}/templates'; fi
+
+AC_ARG_VAR(distxmldir, [[PKGHOME/xmlconfig] Distribution XML config files])
+if test -z "$distxmldir"; then
+   distxmldir='${pkghome}/xmlconfig'; fi
+
+AC_ARG_VAR(sitedir, [[SYSCONFDIR/torrus] Site configuration files])
+if test -z "$sitedir"; then
+   sitedir='${sysconfdir}/torrus'; fi
+
+AC_ARG_VAR(siteconfdir, [[SITEDIR/conf] Site configuration files])
+if test -z "$siteconfdir"; then
+   siteconfdir='${sitedir}/conf'; fi
+
+AC_ARG_VAR(tmpluserdir, [[SITEDIR/templates] User-defined Template files])
+if test -z "$tmpluserdir"; then
+   tmpluserdir='${sitedir}/templates'; fi
+
+AC_ARG_VAR(sitexmldir, [[SITEDIR/xmlconfig] Site XML configs])
+if test -z "$sitexmldir"; then
+   sitexmldir='${sitedir}/xmlconfig'; fi
+
+AC_ARG_VAR(logdir, [[/var/log/torrus] Log files])
+if test -z "$logdir"; then
+   logdir='/var/log/torrus'; fi
+
+AC_ARG_VAR(piddir, [[/var/run/torrus] PID files])
+if test -z "$piddir"; then
+   piddir='/var/run/torrus'; fi
+
+AC_ARG_VAR(varprefix, [[/var/torrus] Common prefix for runtime data])
+if test -z "$varprefix"; then
+   varprefix='/var/torrus'; fi
+   
+AC_ARG_VAR(cachedir, [[VARPREFIX/cache] Renderer cache])
+if test -z "$cachedir"; then
+   cachedir='${varprefix}/cache'; fi
+
+AC_ARG_VAR(dbhome, [[VARPREFIX/db] Berkeley DB files])
+if test -z "$dbhome"; then
+   dbhome='${varprefix}/db'; fi
+
+AC_ARG_VAR(reportsdir, [[VARPREFIX/reports] Reports output])
+if test -z "$reportsdir"; then
+   reportsdir='${varprefix}/reports'; fi
+
+AC_ARG_VAR(seslockdir, [[VARPREFIX/session_data/lock] Web session locks])
+if test -z "$seslockdir"; then
+   seslockdir='${varprefix}/session_data/lock'; fi
+
+AC_ARG_VAR(sesstordir, [[VARPREFIX/session_data/store] Web session storage])
+if test -z "$sesstordir"; then
+   sesstordir='${varprefix}/session_data/store'; fi
+
+AC_ARG_VAR(wrapperdir, [[BINDIR] CLI wrapper])
+if test -z "$wrapperdir"; then
+   wrapperdir='${bindir}'; fi
+
+AC_ARG_VAR(mansec_usercmd, [[1] User commands man section])
+if test -z "$mansec_usercmd"; then
+   mansec_usercmd='1'; fi
+
+AC_ARG_VAR(mansec_misc, [[7] Miscellaneous man section])
+if test -z "$mansec_misc"; then
+   mansec_misc='7'; fi
+
+AC_ARG_VAR(defrrddir, [[/srv/torrus/collector_rrd] Default RRD storage path])
+if test -z "$defrrddir"; then
+   defrrddir='/srv/torrus/collector_rrd'; fi
+
+   
+AC_CONFIG_FILES([Makefile bin/Makefile configs/Makefile])
+AC_CONFIG_FILES([doc/Makefile doc/manpages/Makefile])
+AC_CONFIG_FILES([examples/Makefile perllib/Makefile])
+AC_CONFIG_FILES([sup/Makefile xmlconfig/Makefile])
+                                    
+AC_CONFIG_FILES([setup_tools/substvars.sh],[chmod +x setup_tools/substvars.sh])
+AC_CONFIG_FILES([setup_tools/mkvardir.sh], [chmod +x setup_tools/mkvardir.sh])
+AC_CONFIG_FILES([init.d/torrus], [chmod +x init.d/torrus])
+
+AC_SUBST(VERSION)
+
+AC_OUTPUT
+
+VARSAVE=configs/instvars
+echo creating $VARSAVE
+rm -f $VARSAVE
+for VAR in $ac_subst_vars; do
+    case ${VAR} in
+      DEFS | PACKAGE* | INSTALL* | VERSION | ACLOCAL | AUTO* | MAKEINFO |\
+      install_sh | AM* | am* | ac* | ECHO* | build* | host* | target* |\
+      CYG* | PATH_SEPARATOR | AWK | STRIP | mkdir* |\
+      perllibdirs )
+      ;;
+      *)
+        eval 'VAL=${'$VAR'}'
+        echo ${VAR}=\'${VAL}\' >>$VARSAVE
+      ;;
+    esac
+done
diff --git a/torrus/conftools/config.guess b/torrus/conftools/config.guess
new file mode 100755 (executable)
index 0000000..917bbc5
--- /dev/null
@@ -0,0 +1,1463 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-07-08'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+       for c in cc gcc c89 c99 ; do
+         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+            CC_FOR_BUILD="$c"; break ;
+         fi ;
+       done ;
+       if test x"$CC_FOR_BUILD" = x ; then
+         CC_FOR_BUILD=no_compiler_found ;
+       fi
+       ;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+       PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+       # NetBSD (nbsd) targets should (where applicable) match one or
+       # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+       # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+       # switched to ELF, *-*-netbsd* would select the old
+       # object file format.  This provides both forward
+       # compatibility and a consistent mechanism for selecting the
+       # object file format.
+       #
+       # Note: NetBSD doesn't particularly care about the vendor
+       # portion of the name.  We always set it to "unknown".
+       sysctl="sysctl -n hw.machine_arch"
+       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+       case "${UNAME_MACHINE_ARCH}" in
+           armeb) machine=armeb-unknown ;;
+           arm*) machine=arm-unknown ;;
+           sh3el) machine=shl-unknown ;;
+           sh3eb) machine=sh-unknown ;;
+           *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+       esac
+       # The Operating System including object format, if it has switched
+       # to ELF recently, or will in the future.
+       case "${UNAME_MACHINE_ARCH}" in
+           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+               eval $set_cc_for_build
+               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+                       | grep __ELF__ >/dev/null
+               then
+                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+                   # Return netbsd for either.  FIX?
+                   os=netbsd
+               else
+                   os=netbsdelf
+               fi
+               ;;
+           *)
+               os=netbsd
+               ;;
+       esac
+       # The OS release
+       # Debian GNU/NetBSD machines have a different userland, and
+       # thus, need a distinct triplet. However, they do not need
+       # kernel version information, so it can be replaced with a
+       # suitable tag, in the style of linux-gnu.
+       case "${UNAME_VERSION}" in
+           Debian*)
+               release='-gnu'
+               ;;
+           *)
+               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+               ;;
+       esac
+       # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+       # contains redundant information, the shorter form:
+       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+       echo "${machine}-${os}${release}"
+       exit ;;
+    *:OpenBSD:*:*)
+       UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+       echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+       exit ;;
+    *:ekkoBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+       exit ;;
+    macppc:MirBSD:*:*)
+       echo powerppc-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    *:MirBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+       exit ;;
+    alpha:OSF1:*:*)
+       case $UNAME_RELEASE in
+       *4.0)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+               ;;
+       *5.*)
+               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+               ;;
+       esac
+       # According to Compaq, /usr/sbin/psrinfo has been available on
+       # OSF/1 and Tru64 systems produced since 1995.  I hope that
+       # covers most systems running today.  This code pipes the CPU
+       # types through head -n 1, so we only detect the type of CPU 0.
+       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+       case "$ALPHA_CPU_TYPE" in
+           "EV4 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "EV4.5 (21064)")
+               UNAME_MACHINE="alpha" ;;
+           "LCA4 (21066/21068)")
+               UNAME_MACHINE="alpha" ;;
+           "EV5 (21164)")
+               UNAME_MACHINE="alphaev5" ;;
+           "EV5.6 (21164A)")
+               UNAME_MACHINE="alphaev56" ;;
+           "EV5.6 (21164PC)")
+               UNAME_MACHINE="alphapca56" ;;
+           "EV5.7 (21164PC)")
+               UNAME_MACHINE="alphapca57" ;;
+           "EV6 (21264)")
+               UNAME_MACHINE="alphaev6" ;;
+           "EV6.7 (21264A)")
+               UNAME_MACHINE="alphaev67" ;;
+           "EV6.8CB (21264C)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8AL (21264B)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.8CX (21264D)")
+               UNAME_MACHINE="alphaev68" ;;
+           "EV6.9A (21264/EV69A)")
+               UNAME_MACHINE="alphaev69" ;;
+           "EV7 (21364)")
+               UNAME_MACHINE="alphaev7" ;;
+           "EV7.9 (21364A)")
+               UNAME_MACHINE="alphaev79" ;;
+       esac
+       # A Pn.n version is a patched version.
+       # A Vn.n version is a released version.
+       # A Tn.n version is a released field test version.
+       # A Xn.n version is an unreleased experimental baselevel.
+       # 1.2 uses "1.2" for uname -r.
+       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+       exit ;;
+    Alpha\ *:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # Should we change UNAME_MACHINE based on the output of uname instead
+       # of the specific Alpha model?
+       echo alpha-pc-interix
+       exit ;;
+    21064:Windows_NT:50:3)
+       echo alpha-dec-winnt3.5
+       exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+       echo m68k-unknown-sysv4
+       exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-amigaos
+       exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+       echo ${UNAME_MACHINE}-unknown-morphos
+       exit ;;
+    *:OS/390:*:*)
+       echo i370-ibm-openedition
+       exit ;;
+    *:z/VM:*:*)
+       echo s390-ibm-zvmoe
+       exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+       exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+       echo arm-acorn-riscix${UNAME_RELEASE}
+       exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+       echo arm-unknown-riscos
+       exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+       echo hppa1.1-hitachi-hiuxmpp
+       exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+       if test "`(/bin/universe) 2>/dev/null`" = att ; then
+               echo pyramid-pyramid-sysv3
+       else
+               echo pyramid-pyramid-bsd
+       fi
+       exit ;;
+    NILE*:*:*:dcosx)
+       echo pyramid-pyramid-svr4
+       exit ;;
+    DRS?6000:unix:4.0:6*)
+       echo sparc-icl-nx6
+       exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+       case `/usr/bin/uname -p` in
+           sparc) echo sparc-icl-nx7; exit ;;
+       esac ;;
+    sun4H:SunOS:5.*:*)
+       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    i86pc:SunOS:5.*:*)
+       echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:6*:*)
+       # According to config.sub, this is the proper way to canonicalize
+       # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+       # it's likely to be more like Solaris than SunOS4.
+       echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    sun4*:SunOS:*:*)
+       case "`/usr/bin/arch -k`" in
+           Series*|S4*)
+               UNAME_RELEASE=`uname -v`
+               ;;
+       esac
+       # Japanese Language versions have a version number like `4.1.3-JL'.
+       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+       exit ;;
+    sun3*:SunOS:*:*)
+       echo m68k-sun-sunos${UNAME_RELEASE}
+       exit ;;
+    sun*:*:4.2BSD:*)
+       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+       case "`/bin/arch`" in
+           sun3)
+               echo m68k-sun-sunos${UNAME_RELEASE}
+               ;;
+           sun4)
+               echo sparc-sun-sunos${UNAME_RELEASE}
+               ;;
+       esac
+       exit ;;
+    aushp:SunOS:*:*)
+       echo sparc-auspex-sunos${UNAME_RELEASE}
+       exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+       echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+       exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+       echo m68k-apple-machten${UNAME_RELEASE}
+       exit ;;
+    powerpc:machten:*:*)
+       echo powerpc-apple-machten${UNAME_RELEASE}
+       exit ;;
+    RISC*:Mach:*:*)
+       echo mips-dec-mach_bsd4.3
+       exit ;;
+    RISC*:ULTRIX:*:*)
+       echo mips-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    VAX*:ULTRIX*:*:*)
+       echo vax-dec-ultrix${UNAME_RELEASE}
+       exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+       echo clipper-intergraph-clix${UNAME_RELEASE}
+       exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+       int main (int argc, char *argv[]) {
+#else
+       int main (argc, argv) int argc; char *argv[]; {
+#endif
+       #if defined (host_mips) && defined (MIPSEB)
+       #if defined (SYSTYPE_SYSV)
+         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_SVR4)
+         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+       #endif
+       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+       #endif
+       #endif
+         exit (-1);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c &&
+         dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+         SYSTEM_NAME=`$dummy $dummyarg` &&
+           { echo "$SYSTEM_NAME"; exit; }
+       echo mips-mips-riscos${UNAME_RELEASE}
+       exit ;;
+    Motorola:PowerMAX_OS:*:*)
+       echo powerpc-motorola-powermax
+       exit ;;
+    Motorola:*:4.3:PL8-*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+       echo powerpc-harris-powermax
+       exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+       echo powerpc-harris-powerunix
+       exit ;;
+    m88k:CX/UX:7*:*)
+       echo m88k-harris-cxux7
+       exit ;;
+    m88k:*:4*:R4*)
+       echo m88k-motorola-sysv4
+       exit ;;
+    m88k:*:3*:R3*)
+       echo m88k-motorola-sysv3
+       exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+       then
+           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+              [ ${TARGET_BINARY_INTERFACE}x = x ]
+           then
+               echo m88k-dg-dgux${UNAME_RELEASE}
+           else
+               echo m88k-dg-dguxbcs${UNAME_RELEASE}
+           fi
+       else
+           echo i586-dg-dgux${UNAME_RELEASE}
+       fi
+       exit ;;
+    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
+       echo m88k-dolphin-sysv3
+       exit ;;
+    M88*:*:R3*:*)
+       # Delta 88k system running SVR3
+       echo m88k-motorola-sysv3
+       exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+       echo m88k-tektronix-sysv3
+       exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+       echo m68k-tektronix-bsd
+       exit ;;
+    *:IRIX*:*:*)
+       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+       exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+       echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+       exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+       echo i386-ibm-aix
+       exit ;;
+    ia64:AIX:*:*)
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:2:3)
+       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+               eval $set_cc_for_build
+               sed 's/^                //' << EOF >$dummy.c
+               #include <sys/systemcfg.h>
+
+               main()
+                       {
+                       if (!__power_pc())
+                               exit(1);
+                       puts("powerpc-ibm-aix3.2.5");
+                       exit(0);
+                       }
+EOF
+               if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+               then
+                       echo "$SYSTEM_NAME"
+               else
+                       echo rs6000-ibm-aix3.2.5
+               fi
+       elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+               echo rs6000-ibm-aix3.2.4
+       else
+               echo rs6000-ibm-aix3.2
+       fi
+       exit ;;
+    *:AIX:*:[45])
+       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+       if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+               IBM_ARCH=rs6000
+       else
+               IBM_ARCH=powerpc
+       fi
+       if [ -x /usr/bin/oslevel ] ; then
+               IBM_REV=`/usr/bin/oslevel`
+       else
+               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+       fi
+       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+       exit ;;
+    *:AIX:*:*)
+       echo rs6000-ibm-aix
+       exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+       echo romp-ibm-bsd4.4
+       exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+       exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+       echo rs6000-bull-bosx
+       exit ;;
+    DPX/2?00:B.O.S.:*:*)
+       echo m68k-bull-sysv3
+       exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+       echo m68k-hp-bsd
+       exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+       echo m68k-hp-bsd4.4
+       exit ;;
+    9000/[34678]??:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       case "${UNAME_MACHINE}" in
+           9000/31? )            HP_ARCH=m68000 ;;
+           9000/[34]?? )         HP_ARCH=m68k ;;
+           9000/[678][0-9][0-9])
+               if [ -x /usr/bin/getconf ]; then
+                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+               fi
+               if [ "${HP_ARCH}" = "" ]; then
+                   eval $set_cc_for_build
+                   sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+               {
+               case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+               case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+               case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+                   switch (bits)
+                       {
+                       case 64: puts ("hppa2.0w"); break;
+                       case 32: puts ("hppa2.0n"); break;
+                       default: puts ("hppa2.0"); break;
+                       } break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+                   puts ("hppa2.0"); break;
+              #endif
+               default: puts ("hppa1.0"); break;
+               }
+                  exit (0);
+              }
+EOF
+                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+                   test -z "$HP_ARCH" && HP_ARCH=hppa
+               fi ;;
+       esac
+       if [ ${HP_ARCH} = "hppa2.0w" ]
+       then
+           eval $set_cc_for_build
+
+           # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+           # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+           # generating 64-bit code.  GNU and HP use different nomenclature:
+           #
+           # $ CC_FOR_BUILD=cc ./config.guess
+           # => hppa2.0w-hp-hpux11.23
+           # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+           # => hppa64-hp-hpux11.23
+
+           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+               grep __LP64__ >/dev/null
+           then
+               HP_ARCH="hppa2.0w"
+           else
+               HP_ARCH="hppa64"
+           fi
+       fi
+       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+       exit ;;
+    ia64:HP-UX:*:*)
+       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+       echo ia64-hp-hpux${HPUX_REV}
+       exit ;;
+    3050*:HI-UX:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <unistd.h>
+       int
+       main ()
+       {
+         long cpu = sysconf (_SC_CPU_VERSION);
+         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+            results, however.  */
+         if (CPU_IS_PA_RISC (cpu))
+           {
+             switch (cpu)
+               {
+                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+                 default: puts ("hppa-hitachi-hiuxwe2"); break;
+               }
+           }
+         else if (CPU_IS_HP_MC68K (cpu))
+           puts ("m68k-hitachi-hiuxwe2");
+         else puts ("unknown-hitachi-hiuxwe2");
+         exit (0);
+       }
+EOF
+       $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+               { echo "$SYSTEM_NAME"; exit; }
+       echo unknown-hitachi-hiuxwe2
+       exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+       echo hppa1.1-hp-bsd
+       exit ;;
+    9000/8??:4.3bsd:*:*)
+       echo hppa1.0-hp-bsd
+       exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+       echo hppa1.0-hp-mpeix
+       exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+       echo hppa1.1-hp-osf
+       exit ;;
+    hp8??:OSF1:*:*)
+       echo hppa1.0-hp-osf
+       exit ;;
+    i*86:OSF1:*:*)
+       if [ -x /usr/sbin/sysversion ] ; then
+           echo ${UNAME_MACHINE}-unknown-osf1mk
+       else
+           echo ${UNAME_MACHINE}-unknown-osf1
+       fi
+       exit ;;
+    parisc*:Lites*:*:*)
+       echo hppa1.1-hp-lites
+       exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+       echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+       echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+       echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+       echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*[A-Z]90:*:*:*)
+       echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+       | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+             -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+             -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*TS:*:*:*)
+       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*T3E:*:*:*)
+       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    CRAY*SV1:*:*:*)
+       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    *:UNICOS/mp:*:*)
+       echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+       exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+       exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+       exit ;;
+    sparc*:BSD/OS:*:*)
+       echo sparc-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:BSD/OS:*:*)
+       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+       exit ;;
+    *:FreeBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit ;;
+    i*:CYGWIN*:*)
+       echo ${UNAME_MACHINE}-pc-cygwin
+       exit ;;
+    i*:MINGW*:*)
+       echo ${UNAME_MACHINE}-pc-mingw32
+       exit ;;
+    i*:windows32*:*)
+       # uname -m includes "-pc" on this system.
+       echo ${UNAME_MACHINE}-mingw32
+       exit ;;
+    i*:PW*:*)
+       echo ${UNAME_MACHINE}-pc-pw32
+       exit ;;
+    x86:Interix*:[34]*)
+       echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+       exit ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+       echo i${UNAME_MACHINE}-pc-mks
+       exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+       # How do we know it's Interix rather than the generic POSIX subsystem?
+       # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+       # UNAME_MACHINE based on the output of uname instead of i386?
+       echo i586-pc-interix
+       exit ;;
+    i*:UWIN*:*)
+       echo ${UNAME_MACHINE}-pc-uwin
+       exit ;;
+    amd64:CYGWIN*:*:*)
+       echo x86_64-unknown-cygwin
+       exit ;;
+    p*:CYGWIN*:*)
+       echo powerpcle-unknown-cygwin
+       exit ;;
+    prep*:SunOS:5.*:*)
+       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       exit ;;
+    *:GNU:*:*)
+       # the GNU system
+       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+       exit ;;
+    *:GNU/*:*:*)
+       # other systems with GNU libc and userland
+       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+       exit ;;
+    i*86:Minix:*:*)
+       echo ${UNAME_MACHINE}-pc-minix
+       exit ;;
+    arm*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    cris:Linux:*:*)
+       echo cris-axis-linux-gnu
+       exit ;;
+    crisv32:Linux:*:*)
+       echo crisv32-axis-linux-gnu
+       exit ;;
+    frv:Linux:*:*)
+       echo frv-unknown-linux-gnu
+       exit ;;
+    ia64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    m32r*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    m68*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    mips:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips
+       #undef mipsel
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mipsel
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+       ;;
+    mips64:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips64
+       #undef mips64el
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mips64el
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips64
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+       ;;
+    ppc:Linux:*:*)
+       echo powerpc-unknown-linux-gnu
+       exit ;;
+    ppc64:Linux:*:*)
+       echo powerpc64-unknown-linux-gnu
+       exit ;;
+    alpha:Linux:*:*)
+       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+         EV5)   UNAME_MACHINE=alphaev5 ;;
+         EV56)  UNAME_MACHINE=alphaev56 ;;
+         PCA56) UNAME_MACHINE=alphapca56 ;;
+         PCA57) UNAME_MACHINE=alphapca56 ;;
+         EV6)   UNAME_MACHINE=alphaev6 ;;
+         EV67)  UNAME_MACHINE=alphaev67 ;;
+         EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+       objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+       exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+       # Look for CPU level
+       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+         PA7*) echo hppa1.1-unknown-linux-gnu ;;
+         PA8*) echo hppa2.0-unknown-linux-gnu ;;
+         *)    echo hppa-unknown-linux-gnu ;;
+       esac
+       exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+       echo hppa64-unknown-linux-gnu
+       exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+       echo ${UNAME_MACHINE}-ibm-linux
+       exit ;;
+    sh64*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    sh*:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+       echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    x86_64:Linux:*:*)
+       echo x86_64-unknown-linux-gnu
+       exit ;;
+    i*86:Linux:*:*)
+       # The BFD linker knows what the default object file format is, so
+       # first see if it will tell us. cd to the root directory to prevent
+       # problems with other programs or directories called `ld' in the path.
+       # Set LC_ALL=C to ensure ld outputs messages in English.
+       ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+                        | sed -ne '/supported targets:/!d
+                                   s/[         ][      ]*/ /g
+                                   s/.*supported targets: *//
+                                   s/ .*//
+                                   p'`
+        case "$ld_supported_targets" in
+         elf32-i386)
+               TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+               ;;
+         a.out-i386-linux)
+               echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+               exit ;;
+         coff-i386)
+               echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+               exit ;;
+         "")
+               # Either a pre-BFD a.out linker (linux-gnuoldld) or
+               # one that does not give us useful --help.
+               echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+               exit ;;
+       esac
+       # Determine whether the default compiler is a.out or elf
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <features.h>
+       #ifdef __ELF__
+       # ifdef __GLIBC__
+       #  if __GLIBC__ >= 2
+       LIBC=gnu
+       #  else
+       LIBC=gnulibc1
+       #  endif
+       # else
+       LIBC=gnulibc1
+       # endif
+       #else
+       #ifdef __INTEL_COMPILER
+       LIBC=gnu
+       #else
+       LIBC=gnuaout
+       #endif
+       #endif
+       #ifdef __dietlibc__
+       LIBC=dietlibc
+       #endif
+EOF
+       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+       test x"${LIBC}" != x && {
+               echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+               exit
+       }
+       test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+       ;;
+    i*86:DYNIX/ptx:4*:*)
+       # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+       # earlier versions are messed up and put the nodename in both
+       # sysname and nodename.
+       echo i386-sequent-sysv4
+       exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+       # I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+       exit ;;
+    i*86:OS/2:*:*)
+       # If we were able to find `uname', then EMX Unix compatibility
+       # is probably installed.
+       echo ${UNAME_MACHINE}-pc-os2-emx
+       exit ;;
+    i*86:XTS-300:*:STOP)
+       echo ${UNAME_MACHINE}-unknown-stop
+       exit ;;
+    i*86:atheos:*:*)
+       echo ${UNAME_MACHINE}-unknown-atheos
+       exit ;;
+    i*86:syllable:*:*)
+       echo ${UNAME_MACHINE}-pc-syllable
+       exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+       echo i386-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    i*86:*DOS:*:*)
+       echo ${UNAME_MACHINE}-pc-msdosdjgpp
+       exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+       else
+               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+       fi
+       exit ;;
+    i*86:*:5:[678]*)
+       # UnixWare 7.x, OpenUNIX and OpenServer 6.
+       case `/bin/uname -X | grep "^Machine"` in
+           *486*)           UNAME_MACHINE=i486 ;;
+           *Pentium)        UNAME_MACHINE=i586 ;;
+           *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+       esac
+       echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+       exit ;;
+    i*86:*:3.2:*)
+       if test -f /usr/options/cb.name; then
+               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+       elif /bin/uname -X 2>/dev/null >/dev/null ; then
+               UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+               (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+               (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+                       && UNAME_MACHINE=i586
+               (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+                       && UNAME_MACHINE=i686
+               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+       else
+               echo ${UNAME_MACHINE}-pc-sysv32
+       fi
+       exit ;;
+    pc:*:*:*)
+       # Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+       echo i386-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+       echo i386-pc-mach3
+       exit ;;
+    paragon:*:*:*)
+       echo i860-intel-osf1
+       exit ;;
+    i860:*:4.*:*) # i860-SVR4
+       if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+         echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+       else # Add other i860-SVR4 vendors below as they are discovered.
+         echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+       fi
+       exit ;;
+    mini*:CTIX:SYS*5:*)
+       # "miniframe"
+       echo m68010-convergent-sysv
+       exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+       echo m68k-convergent-sysv
+       exit ;;
+    M680?0:D-NIX:5.3:*)
+       echo m68k-diab-dnix
+       exit ;;
+    M68*:*:R3V[5678]*:*)
+       test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+       OS_REL=''
+       test -r /etc/.relid \
+       && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+         && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+         && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+       echo m68k-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+       echo m68k-atari-sysv4
+       exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+       echo sparc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    rs6000:LynxOS:2.*:*)
+       echo rs6000-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+       echo powerpc-unknown-lynxos${UNAME_RELEASE}
+       exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+       echo mips-dde-sysv${UNAME_RELEASE}
+       exit ;;
+    RM*:ReliantUNIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    RM*:SINIX-*:*:*)
+       echo mips-sni-sysv4
+       exit ;;
+    *:SINIX-*:*:*)
+       if uname -p 2>/dev/null >/dev/null ; then
+               UNAME_MACHINE=`(uname -p) 2>/dev/null`
+               echo ${UNAME_MACHINE}-sni-sysv4
+       else
+               echo ns32k-sni-sysv
+       fi
+       exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+       # From Gerald Hewes <hewes@openmarket.com>.
+       # How about differentiating between stratus architectures? -djm
+       echo hppa1.1-stratus-sysv4
+       exit ;;
+    *:*:*:FTX*)
+       # From seanf@swdc.stratus.com.
+       echo i860-stratus-sysv4
+       exit ;;
+    i*86:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo ${UNAME_MACHINE}-stratus-vos
+       exit ;;
+    *:VOS:*:*)
+       # From Paul.Green@stratus.com.
+       echo hppa1.1-stratus-vos
+       exit ;;
+    mc68*:A/UX:*:*)
+       echo m68k-apple-aux${UNAME_RELEASE}
+       exit ;;
+    news*:NEWS-OS:6*:*)
+       echo mips-sony-newsos6
+       exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+       if [ -d /usr/nec ]; then
+               echo mips-nec-sysv${UNAME_RELEASE}
+       else
+               echo mips-unknown-sysv${UNAME_RELEASE}
+       fi
+        exit ;;
+    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
+       echo powerpc-be-beos
+       exit ;;
+    BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
+       echo powerpc-apple-beos
+       exit ;;
+    BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
+       echo i586-pc-beos
+       exit ;;
+    SX-4:SUPER-UX:*:*)
+       echo sx4-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-5:SUPER-UX:*:*)
+       echo sx5-nec-superux${UNAME_RELEASE}
+       exit ;;
+    SX-6:SUPER-UX:*:*)
+       echo sx6-nec-superux${UNAME_RELEASE}
+       exit ;;
+    Power*:Rhapsody:*:*)
+       echo powerpc-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Rhapsody:*:*)
+       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+       exit ;;
+    *:Darwin:*:*)
+       UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+       case $UNAME_PROCESSOR in
+           *86) UNAME_PROCESSOR=i686 ;;
+           unknown) UNAME_PROCESSOR=powerpc ;;
+       esac
+       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+       exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+       UNAME_PROCESSOR=`uname -p`
+       if test "$UNAME_PROCESSOR" = "x86"; then
+               UNAME_PROCESSOR=i386
+               UNAME_MACHINE=pc
+       fi
+       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+       exit ;;
+    *:QNX:*:4*)
+       echo i386-pc-qnx
+       exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+       echo nse-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+       echo nsr-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    *:NonStop-UX:*:*)
+       echo mips-compaq-nonstopux
+       exit ;;
+    BS2000:POSIX*:*:*)
+       echo bs2000-siemens-sysv
+       exit ;;
+    DS/*:UNIX_System_V:*:*)
+       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+       exit ;;
+    *:Plan9:*:*)
+       # "uname -m" is not consistent, so use $cputype instead. 386
+       # is converted to i386 for consistency with other x86
+       # operating systems.
+       if test "$cputype" = "386"; then
+           UNAME_MACHINE=i386
+       else
+           UNAME_MACHINE="$cputype"
+       fi
+       echo ${UNAME_MACHINE}-unknown-plan9
+       exit ;;
+    *:TOPS-10:*:*)
+       echo pdp10-unknown-tops10
+       exit ;;
+    *:TENEX:*:*)
+       echo pdp10-unknown-tenex
+       exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+       echo pdp10-dec-tops20
+       exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+       echo pdp10-xkl-tops20
+       exit ;;
+    *:TOPS-20:*:*)
+       echo pdp10-unknown-tops20
+       exit ;;
+    *:ITS:*:*)
+       echo pdp10-unknown-its
+       exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+       exit ;;
+    *:DragonFly:*:*)
+       echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+       exit ;;
+    *:*VMS:*:*)
+       UNAME_MACHINE=`(uname -p) 2>/dev/null`
+       case "${UNAME_MACHINE}" in
+           A*) echo alpha-dec-vms ; exit ;;
+           I*) echo ia64-dec-vms ; exit ;;
+           V*) echo vax-dec-vms ; exit ;;
+       esac ;;
+    *:XENIX:*:SysV)
+       echo i386-pc-xenix
+       exit ;;
+    i*86:skyos:*:*)
+       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+       exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+         ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+       printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+       printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+       { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+       echo c1-convex-bsd
+       exit ;;
+    c2*)
+       if getsysinfo -f scalar_acc
+       then echo c32-convex-bsd
+       else echo c2-convex-bsd
+       fi
+       exit ;;
+    c34*)
+       echo c34-convex-bsd
+       exit ;;
+    c38*)
+       echo c38-convex-bsd
+       exit ;;
+    c4*)
+       echo c4-convex-bsd
+       exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/torrus/conftools/config.sub b/torrus/conftools/config.sub
new file mode 100755 (executable)
index 0000000..1c366df
--- /dev/null
@@ -0,0 +1,1579 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+timestamp='2005-07-08'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )        # Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
+  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+       -sun*os*)
+               # Prevent following clause from handling this invalid input.
+               ;;
+       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+       -apple | -axis | -knuth | -cray)
+               os=
+               basic_machine=$1
+               ;;
+       -sim | -cisco | -oki | -wec | -winbond)
+               os=
+               basic_machine=$1
+               ;;
+       -scout)
+               ;;
+       -wrs)
+               os=-vxworks
+               basic_machine=$1
+               ;;
+       -chorusos*)
+               os=-chorusos
+               basic_machine=$1
+               ;;
+       -chorusrdb)
+               os=-chorusrdb
+               basic_machine=$1
+               ;;
+       -hiux*)
+               os=-hiuxwe2
+               ;;
+       -sco5)
+               os=-sco3.2v5
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco4)
+               os=-sco3.2v4
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2.[4-9]*)
+               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco3.2v[4-9]*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco*)
+               os=-sco3.2v2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -udk*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -isc)
+               os=-isc2.2
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -clix*)
+               basic_machine=clipper-intergraph
+               ;;
+       -isc*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -lynx*)
+               os=-lynxos
+               ;;
+       -ptx*)
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+               ;;
+       -windowsnt*)
+               os=`echo $os | sed -e 's/windowsnt/winnt/'`
+               ;;
+       -psos*)
+               os=-psos
+               ;;
+       -mint | -mint[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+       # Recognize the basic CPU types without company name.
+       # Some are omitted here because they have special meanings below.
+       1750a | 580 \
+       | a29k \
+       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+       | am33_2.0 \
+       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+       | bfin \
+       | c4x | clipper \
+       | d10v | d30v | dlx | dsp16xx \
+       | fr30 | frv \
+       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+       | i370 | i860 | i960 | ia64 \
+       | ip2k | iq2000 \
+       | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+       | mips | mipsbe | mipseb | mipsel | mipsle \
+       | mips16 \
+       | mips64 | mips64el \
+       | mips64vr | mips64vrel \
+       | mips64orion | mips64orionel \
+       | mips64vr4100 | mips64vr4100el \
+       | mips64vr4300 | mips64vr4300el \
+       | mips64vr5000 | mips64vr5000el \
+       | mips64vr5900 | mips64vr5900el \
+       | mipsisa32 | mipsisa32el \
+       | mipsisa32r2 | mipsisa32r2el \
+       | mipsisa64 | mipsisa64el \
+       | mipsisa64r2 | mipsisa64r2el \
+       | mipsisa64sb1 | mipsisa64sb1el \
+       | mipsisa64sr71k | mipsisa64sr71kel \
+       | mipstx39 | mipstx39el \
+       | mn10200 | mn10300 \
+       | ms1 \
+       | msp430 \
+       | ns16k | ns32k \
+       | or32 \
+       | pdp10 | pdp11 | pj | pjl \
+       | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+       | pyramid \
+       | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+       | sh64 | sh64le \
+       | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+       | sparcv8 | sparcv9 | sparcv9b \
+       | strongarm \
+       | tahoe | thumb | tic4x | tic80 | tron \
+       | v850 | v850e \
+       | we32k \
+       | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+       | z8k)
+               basic_machine=$basic_machine-unknown
+               ;;
+       m32c)
+               basic_machine=$basic_machine-unknown
+               ;;
+       m6811 | m68hc11 | m6812 | m68hc12)
+               # Motorola 68HC11/12.
+               basic_machine=$basic_machine-unknown
+               os=-none
+               ;;
+       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+               ;;
+
+       # We use `pc' rather than `unknown'
+       # because (1) that's what they normally are, and
+       # (2) the word "unknown" tends to confuse beginning users.
+       i*86 | x86_64)
+         basic_machine=$basic_machine-pc
+         ;;
+       # Object if more than one company name word.
+       *-*-*)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+       # Recognize the basic CPU types with company name.
+       580-* \
+       | a29k-* \
+       | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+       | avr-* \
+       | bfin-* | bs2000-* \
+       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+       | clipper-* | craynv-* | cydra-* \
+       | d10v-* | d30v-* | dlx-* \
+       | elxsi-* \
+       | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+       | h8300-* | h8500-* \
+       | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+       | i*86-* | i860-* | i960-* | ia64-* \
+       | ip2k-* | iq2000-* \
+       | m32r-* | m32rle-* \
+       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+       | m88110-* | m88k-* | maxq-* | mcore-* \
+       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+       | mips16-* \
+       | mips64-* | mips64el-* \
+       | mips64vr-* | mips64vrel-* \
+       | mips64orion-* | mips64orionel-* \
+       | mips64vr4100-* | mips64vr4100el-* \
+       | mips64vr4300-* | mips64vr4300el-* \
+       | mips64vr5000-* | mips64vr5000el-* \
+       | mips64vr5900-* | mips64vr5900el-* \
+       | mipsisa32-* | mipsisa32el-* \
+       | mipsisa32r2-* | mipsisa32r2el-* \
+       | mipsisa64-* | mipsisa64el-* \
+       | mipsisa64r2-* | mipsisa64r2el-* \
+       | mipsisa64sb1-* | mipsisa64sb1el-* \
+       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+       | mipstx39-* | mipstx39el-* \
+       | mmix-* \
+       | ms1-* \
+       | msp430-* \
+       | none-* | np1-* | ns16k-* | ns32k-* \
+       | orion-* \
+       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+       | pyramid-* \
+       | romp-* | rs6000-* \
+       | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
+       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+       | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+       | sparclite-* \
+       | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+       | tahoe-* | thumb-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+       | tron-* \
+       | v850-* | v850e-* | vax-* \
+       | we32k-* \
+       | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
+       | xstormy16-* | xtensa-* \
+       | ymp-* \
+       | z8k-*)
+               ;;
+       m32c-*)
+               ;;
+       # Recognize the various machine names and aliases which stand
+       # for a CPU type and a company and sometimes even an OS.
+       386bsd)
+               basic_machine=i386-unknown
+               os=-bsd
+               ;;
+       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+               basic_machine=m68000-att
+               ;;
+       3b*)
+               basic_machine=we32k-att
+               ;;
+       a29khif)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       abacus)
+               basic_machine=abacus-unknown
+               ;;
+       adobe68k)
+               basic_machine=m68010-adobe
+               os=-scout
+               ;;
+       alliant | fx80)
+               basic_machine=fx80-alliant
+               ;;
+       altos | altos3068)
+               basic_machine=m68k-altos
+               ;;
+       am29k)
+               basic_machine=a29k-none
+               os=-bsd
+               ;;
+       amd64)
+               basic_machine=x86_64-pc
+               ;;
+       amd64-*)
+               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       amdahl)
+               basic_machine=580-amdahl
+               os=-sysv
+               ;;
+       amiga | amiga-*)
+               basic_machine=m68k-unknown
+               ;;
+       amigaos | amigados)
+               basic_machine=m68k-unknown
+               os=-amigaos
+               ;;
+       amigaunix | amix)
+               basic_machine=m68k-unknown
+               os=-sysv4
+               ;;
+       apollo68)
+               basic_machine=m68k-apollo
+               os=-sysv
+               ;;
+       apollo68bsd)
+               basic_machine=m68k-apollo
+               os=-bsd
+               ;;
+       aux)
+               basic_machine=m68k-apple
+               os=-aux
+               ;;
+       balance)
+               basic_machine=ns32k-sequent
+               os=-dynix
+               ;;
+       c90)
+               basic_machine=c90-cray
+               os=-unicos
+               ;;
+       convex-c1)
+               basic_machine=c1-convex
+               os=-bsd
+               ;;
+       convex-c2)
+               basic_machine=c2-convex
+               os=-bsd
+               ;;
+       convex-c32)
+               basic_machine=c32-convex
+               os=-bsd
+               ;;
+       convex-c34)
+               basic_machine=c34-convex
+               os=-bsd
+               ;;
+       convex-c38)
+               basic_machine=c38-convex
+               os=-bsd
+               ;;
+       cray | j90)
+               basic_machine=j90-cray
+               os=-unicos
+               ;;
+       craynv)
+               basic_machine=craynv-cray
+               os=-unicosmp
+               ;;
+       cr16c)
+               basic_machine=cr16c-unknown
+               os=-elf
+               ;;
+       crds | unos)
+               basic_machine=m68k-crds
+               ;;
+       crisv32 | crisv32-* | etraxfs*)
+               basic_machine=crisv32-axis
+               ;;
+       cris | cris-* | etrax*)
+               basic_machine=cris-axis
+               ;;
+       crx)
+               basic_machine=crx-unknown
+               os=-elf
+               ;;
+       da30 | da30-*)
+               basic_machine=m68k-da30
+               ;;
+       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+               basic_machine=mips-dec
+               ;;
+       decsystem10* | dec10*)
+               basic_machine=pdp10-dec
+               os=-tops10
+               ;;
+       decsystem20* | dec20*)
+               basic_machine=pdp10-dec
+               os=-tops20
+               ;;
+       delta | 3300 | motorola-3300 | motorola-delta \
+             | 3300-motorola | delta-motorola)
+               basic_machine=m68k-motorola
+               ;;
+       delta88)
+               basic_machine=m88k-motorola
+               os=-sysv3
+               ;;
+       djgpp)
+               basic_machine=i586-pc
+               os=-msdosdjgpp
+               ;;
+       dpx20 | dpx20-*)
+               basic_machine=rs6000-bull
+               os=-bosx
+               ;;
+       dpx2* | dpx2*-bull)
+               basic_machine=m68k-bull
+               os=-sysv3
+               ;;
+       ebmon29k)
+               basic_machine=a29k-amd
+               os=-ebmon
+               ;;
+       elxsi)
+               basic_machine=elxsi-elxsi
+               os=-bsd
+               ;;
+       encore | umax | mmax)
+               basic_machine=ns32k-encore
+               ;;
+       es1800 | OSE68k | ose68k | ose | OSE)
+               basic_machine=m68k-ericsson
+               os=-ose
+               ;;
+       fx2800)
+               basic_machine=i860-alliant
+               ;;
+       genix)
+               basic_machine=ns32k-ns
+               ;;
+       gmicro)
+               basic_machine=tron-gmicro
+               os=-sysv
+               ;;
+       go32)
+               basic_machine=i386-pc
+               os=-go32
+               ;;
+       h3050r* | hiux*)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       h8300hms)
+               basic_machine=h8300-hitachi
+               os=-hms
+               ;;
+       h8300xray)
+               basic_machine=h8300-hitachi
+               os=-xray
+               ;;
+       h8500hms)
+               basic_machine=h8500-hitachi
+               os=-hms
+               ;;
+       harris)
+               basic_machine=m88k-harris
+               os=-sysv3
+               ;;
+       hp300-*)
+               basic_machine=m68k-hp
+               ;;
+       hp300bsd)
+               basic_machine=m68k-hp
+               os=-bsd
+               ;;
+       hp300hpux)
+               basic_machine=m68k-hp
+               os=-hpux
+               ;;
+       hp3k9[0-9][0-9] | hp9[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k2[0-9][0-9] | hp9k31[0-9])
+               basic_machine=m68000-hp
+               ;;
+       hp9k3[2-9][0-9])
+               basic_machine=m68k-hp
+               ;;
+       hp9k6[0-9][0-9] | hp6[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hp9k7[0-79][0-9] | hp7[0-79][0-9])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k78[0-9] | hp78[0-9])
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+               # FIXME: really hppa2.0-hp
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][13679] | hp8[0-9][13679])
+               basic_machine=hppa1.1-hp
+               ;;
+       hp9k8[0-9][0-9] | hp8[0-9][0-9])
+               basic_machine=hppa1.0-hp
+               ;;
+       hppa-next)
+               os=-nextstep3
+               ;;
+       hppaosf)
+               basic_machine=hppa1.1-hp
+               os=-osf
+               ;;
+       hppro)
+               basic_machine=hppa1.1-hp
+               os=-proelf
+               ;;
+       i370-ibm* | ibm*)
+               basic_machine=i370-ibm
+               ;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+       i*86v32)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv32
+               ;;
+       i*86v4*)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv4
+               ;;
+       i*86v)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-sysv
+               ;;
+       i*86sol2)
+               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+               os=-solaris2
+               ;;
+       i386mach)
+               basic_machine=i386-mach
+               os=-mach
+               ;;
+       i386-vsta | vsta)
+               basic_machine=i386-unknown
+               os=-vsta
+               ;;
+       iris | iris4d)
+               basic_machine=mips-sgi
+               case $os in
+                   -irix*)
+                       ;;
+                   *)
+                       os=-irix4
+                       ;;
+               esac
+               ;;
+       isi68 | isi)
+               basic_machine=m68k-isi
+               os=-sysv
+               ;;
+       m88k-omron*)
+               basic_machine=m88k-omron
+               ;;
+       magnum | m3230)
+               basic_machine=mips-mips
+               os=-sysv
+               ;;
+       merlin)
+               basic_machine=ns32k-utek
+               os=-sysv
+               ;;
+       mingw32)
+               basic_machine=i386-pc
+               os=-mingw32
+               ;;
+       miniframe)
+               basic_machine=m68000-convergent
+               ;;
+       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+               basic_machine=m68k-atari
+               os=-mint
+               ;;
+       mips3*-*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+               ;;
+       mips3*)
+               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+               ;;
+       monitor)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       morphos)
+               basic_machine=powerpc-unknown
+               os=-morphos
+               ;;
+       msdos)
+               basic_machine=i386-pc
+               os=-msdos
+               ;;
+       mvs)
+               basic_machine=i370-ibm
+               os=-mvs
+               ;;
+       ncr3000)
+               basic_machine=i486-ncr
+               os=-sysv4
+               ;;
+       netbsd386)
+               basic_machine=i386-unknown
+               os=-netbsd
+               ;;
+       netwinder)
+               basic_machine=armv4l-rebel
+               os=-linux
+               ;;
+       news | news700 | news800 | news900)
+               basic_machine=m68k-sony
+               os=-newsos
+               ;;
+       news1000)
+               basic_machine=m68030-sony
+               os=-newsos
+               ;;
+       news-3600 | risc-news)
+               basic_machine=mips-sony
+               os=-newsos
+               ;;
+       necv70)
+               basic_machine=v70-nec
+               os=-sysv
+               ;;
+       next | m*-next )
+               basic_machine=m68k-next
+               case $os in
+                   -nextstep* )
+                       ;;
+                   -ns2*)
+                     os=-nextstep2
+                       ;;
+                   *)
+                     os=-nextstep3
+                       ;;
+               esac
+               ;;
+       nh3000)
+               basic_machine=m68k-harris
+               os=-cxux
+               ;;
+       nh[45]000)
+               basic_machine=m88k-harris
+               os=-cxux
+               ;;
+       nindy960)
+               basic_machine=i960-intel
+               os=-nindy
+               ;;
+       mon960)
+               basic_machine=i960-intel
+               os=-mon960
+               ;;
+       nonstopux)
+               basic_machine=mips-compaq
+               os=-nonstopux
+               ;;
+       np1)
+               basic_machine=np1-gould
+               ;;
+       nsr-tandem)
+               basic_machine=nsr-tandem
+               ;;
+       op50n-* | op60c-*)
+               basic_machine=hppa1.1-oki
+               os=-proelf
+               ;;
+       openrisc | openrisc-*)
+               basic_machine=or32-unknown
+               ;;
+       os400)
+               basic_machine=powerpc-ibm
+               os=-os400
+               ;;
+       OSE68000 | ose68000)
+               basic_machine=m68000-ericsson
+               os=-ose
+               ;;
+       os68k)
+               basic_machine=m68k-none
+               os=-os68k
+               ;;
+       pa-hitachi)
+               basic_machine=hppa1.1-hitachi
+               os=-hiuxwe2
+               ;;
+       paragon)
+               basic_machine=i860-intel
+               os=-osf
+               ;;
+       pbd)
+               basic_machine=sparc-tti
+               ;;
+       pbb)
+               basic_machine=m68k-tti
+               ;;
+       pc532 | pc532-*)
+               basic_machine=ns32k-pc532
+               ;;
+       pentium | p5 | k5 | k6 | nexgen | viac3)
+               basic_machine=i586-pc
+               ;;
+       pentiumpro | p6 | 6x86 | athlon | athlon_*)
+               basic_machine=i686-pc
+               ;;
+       pentiumii | pentium2 | pentiumiii | pentium3)
+               basic_machine=i686-pc
+               ;;
+       pentium4)
+               basic_machine=i786-pc
+               ;;
+       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumpro-* | p6-* | 6x86-* | athlon-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pentium4-*)
+               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       pn)
+               basic_machine=pn-gould
+               ;;
+       power)  basic_machine=power-ibm
+               ;;
+       ppc)    basic_machine=powerpc-unknown
+               ;;
+       ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppcle | powerpclittle | ppc-le | powerpc-little)
+               basic_machine=powerpcle-unknown
+               ;;
+       ppcle-* | powerpclittle-*)
+               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64)  basic_machine=powerpc64-unknown
+               ;;
+       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+               basic_machine=powerpc64le-unknown
+               ;;
+       ppc64le-* | powerpc64little-*)
+               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
+       ps2)
+               basic_machine=i386-ibm
+               ;;
+       pw32)
+               basic_machine=i586-unknown
+               os=-pw32
+               ;;
+       rom68k)
+               basic_machine=m68k-rom68k
+               os=-coff
+               ;;
+       rm[46]00)
+               basic_machine=mips-siemens
+               ;;
+       rtpc | rtpc-*)
+               basic_machine=romp-ibm
+               ;;
+       s390 | s390-*)
+               basic_machine=s390-ibm
+               ;;
+       s390x | s390x-*)
+               basic_machine=s390x-ibm
+               ;;
+       sa29200)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       sb1)
+               basic_machine=mipsisa64sb1-unknown
+               ;;
+       sb1el)
+               basic_machine=mipsisa64sb1el-unknown
+               ;;
+       sei)
+               basic_machine=mips-sei
+               os=-seiux
+               ;;
+       sequent)
+               basic_machine=i386-sequent
+               ;;
+       sh)
+               basic_machine=sh-hitachi
+               os=-hms
+               ;;
+       sh64)
+               basic_machine=sh64-unknown
+               ;;
+       sparclite-wrs | simso-wrs)
+               basic_machine=sparclite-wrs
+               os=-vxworks
+               ;;
+       sps7)
+               basic_machine=m68k-bull
+               os=-sysv2
+               ;;
+       spur)
+               basic_machine=spur-unknown
+               ;;
+       st2000)
+               basic_machine=m68k-tandem
+               ;;
+       stratus)
+               basic_machine=i860-stratus
+               os=-sysv4
+               ;;
+       sun2)
+               basic_machine=m68000-sun
+               ;;
+       sun2os3)
+               basic_machine=m68000-sun
+               os=-sunos3
+               ;;
+       sun2os4)
+               basic_machine=m68000-sun
+               os=-sunos4
+               ;;
+       sun3os3)
+               basic_machine=m68k-sun
+               os=-sunos3
+               ;;
+       sun3os4)
+               basic_machine=m68k-sun
+               os=-sunos4
+               ;;
+       sun4os3)
+               basic_machine=sparc-sun
+               os=-sunos3
+               ;;
+       sun4os4)
+               basic_machine=sparc-sun
+               os=-sunos4
+               ;;
+       sun4sol2)
+               basic_machine=sparc-sun
+               os=-solaris2
+               ;;
+       sun3 | sun3-*)
+               basic_machine=m68k-sun
+               ;;
+       sun4)
+               basic_machine=sparc-sun
+               ;;
+       sun386 | sun386i | roadrunner)
+               basic_machine=i386-sun
+               ;;
+       sv1)
+               basic_machine=sv1-cray
+               os=-unicos
+               ;;
+       symmetry)
+               basic_machine=i386-sequent
+               os=-dynix
+               ;;
+       t3e)
+               basic_machine=alphaev5-cray
+               os=-unicos
+               ;;
+       t90)
+               basic_machine=t90-cray
+               os=-unicos
+               ;;
+       tic54x | c54x*)
+               basic_machine=tic54x-unknown
+               os=-coff
+               ;;
+       tic55x | c55x*)
+               basic_machine=tic55x-unknown
+               os=-coff
+               ;;
+       tic6x | c6x*)
+               basic_machine=tic6x-unknown
+               os=-coff
+               ;;
+       tx39)
+               basic_machine=mipstx39-unknown
+               ;;
+       tx39el)
+               basic_machine=mipstx39el-unknown
+               ;;
+       toad1)
+               basic_machine=pdp10-xkl
+               os=-tops20
+               ;;
+       tower | tower-32)
+               basic_machine=m68k-ncr
+               ;;
+       tpf)
+               basic_machine=s390x-ibm
+               os=-tpf
+               ;;
+       udi29k)
+               basic_machine=a29k-amd
+               os=-udi
+               ;;
+       ultra3)
+               basic_machine=a29k-nyu
+               os=-sym1
+               ;;
+       v810 | necv810)
+               basic_machine=v810-nec
+               os=-none
+               ;;
+       vaxv)
+               basic_machine=vax-dec
+               os=-sysv
+               ;;
+       vms)
+               basic_machine=vax-dec
+               os=-vms
+               ;;
+       vpp*|vx|vx-*)
+               basic_machine=f301-fujitsu
+               ;;
+       vxworks960)
+               basic_machine=i960-wrs
+               os=-vxworks
+               ;;
+       vxworks68)
+               basic_machine=m68k-wrs
+               os=-vxworks
+               ;;
+       vxworks29k)
+               basic_machine=a29k-wrs
+               os=-vxworks
+               ;;
+       w65*)
+               basic_machine=w65-wdc
+               os=-none
+               ;;
+       w89k-*)
+               basic_machine=hppa1.1-winbond
+               os=-proelf
+               ;;
+       xbox)
+               basic_machine=i686-pc
+               os=-mingw32
+               ;;
+       xps | xps100)
+               basic_machine=xps100-honeywell
+               ;;
+       ymp)
+               basic_machine=ymp-cray
+               os=-unicos
+               ;;
+       z8k-*-coff)
+               basic_machine=z8k-unknown
+               os=-sim
+               ;;
+       none)
+               basic_machine=none-none
+               os=-none
+               ;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+       w89k)
+               basic_machine=hppa1.1-winbond
+               ;;
+       op50n)
+               basic_machine=hppa1.1-oki
+               ;;
+       op60c)
+               basic_machine=hppa1.1-oki
+               ;;
+       romp)
+               basic_machine=romp-ibm
+               ;;
+       mmix)
+               basic_machine=mmix-knuth
+               ;;
+       rs6000)
+               basic_machine=rs6000-ibm
+               ;;
+       vax)
+               basic_machine=vax-dec
+               ;;
+       pdp10)
+               # there are many clones, so DEC is not a safe bet
+               basic_machine=pdp10-unknown
+               ;;
+       pdp11)
+               basic_machine=pdp11-dec
+               ;;
+       we32k)
+               basic_machine=we32k-att
+               ;;
+       sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+               basic_machine=sh-unknown
+               ;;
+       sparc | sparcv8 | sparcv9 | sparcv9b)
+               basic_machine=sparc-sun
+               ;;
+       cydra)
+               basic_machine=cydra-cydrome
+               ;;
+       orion)
+               basic_machine=orion-highlevel
+               ;;
+       orion105)
+               basic_machine=clipper-highlevel
+               ;;
+       mac | mpw | mac-mpw)
+               basic_machine=m68k-apple
+               ;;
+       pmac | pmac-mpw)
+               basic_machine=powerpc-apple
+               ;;
+       *-unknown)
+               # Make sure to match an already-canonicalized machine name.
+               ;;
+       *)
+               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+       *-digital*)
+               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+               ;;
+       *-commodore*)
+               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+               ;;
+       *)
+               ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+       # -solaris* is a basic system type, with this one exception.
+       -solaris1 | -solaris1.*)
+               os=`echo $os | sed -e 's|solaris1|sunos4|'`
+               ;;
+       -solaris)
+               os=-solaris2
+               ;;
+       -svr4*)
+               os=-sysv4
+               ;;
+       -unixware*)
+               os=-sysv4.2uw
+               ;;
+       -gnu/linux*)
+               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+               ;;
+       # First accept the basic system types.
+       # The portable systems comes first.
+       # Each alternative MUST END IN A *, to match a version number.
+       # -sysv* is not here because it comes later, after sysvr4.
+       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+             | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+             | -aos* \
+             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
+             | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+             | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+             | -chorusos* | -chorusrdb* \
+             | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+             | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
+             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+             | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+             | -skyos* | -haiku*)
+       # Remember, each alternative MUST END IN *, to match a version number.
+               ;;
+       -qnx*)
+               case $basic_machine in
+                   x86-* | i*86-*)
+                       ;;
+                   *)
+                       os=-nto$os
+                       ;;
+               esac
+               ;;
+       -nto-qnx*)
+               ;;
+       -nto*)
+               os=`echo $os | sed -e 's|nto|nto-qnx|'`
+               ;;
+       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+             | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+               ;;
+       -mac*)
+               os=`echo $os | sed -e 's|mac|macos|'`
+               ;;
+       -linux-dietlibc)
+               os=-linux-dietlibc
+               ;;
+       -linux*)
+               os=`echo $os | sed -e 's|linux|linux-gnu|'`
+               ;;
+       -sunos5*)
+               os=`echo $os | sed -e 's|sunos5|solaris2|'`
+               ;;
+       -sunos6*)
+               os=`echo $os | sed -e 's|sunos6|solaris3|'`
+               ;;
+       -opened*)
+               os=-openedition
+               ;;
+        -os400*)
+               os=-os400
+               ;;
+       -wince*)
+               os=-wince
+               ;;
+       -osfrose*)
+               os=-osfrose
+               ;;
+       -osf*)
+               os=-osf
+               ;;
+       -utek*)
+               os=-bsd
+               ;;
+       -dynix*)
+               os=-bsd
+               ;;
+       -acis*)
+               os=-aos
+               ;;
+       -atheos*)
+               os=-atheos
+               ;;
+       -syllable*)
+               os=-syllable
+               ;;
+       -386bsd)
+               os=-bsd
+               ;;
+       -ctix* | -uts*)
+               os=-sysv
+               ;;
+       -nova*)
+               os=-rtmk-nova
+               ;;
+       -ns2 )
+               os=-nextstep2
+               ;;
+       -nsk*)
+               os=-nsk
+               ;;
+       # Preserve the version number of sinix5.
+       -sinix5.*)
+               os=`echo $os | sed -e 's|sinix|sysv|'`
+               ;;
+       -sinix*)
+               os=-sysv4
+               ;;
+        -tpf*)
+               os=-tpf
+               ;;
+       -triton*)
+               os=-sysv3
+               ;;
+       -oss*)
+               os=-sysv3
+               ;;
+       -svr4)
+               os=-sysv4
+               ;;
+       -svr3)
+               os=-sysv3
+               ;;
+       -sysvr4)
+               os=-sysv4
+               ;;
+       # This must come after -sysvr4.
+       -sysv*)
+               ;;
+       -ose*)
+               os=-ose
+               ;;
+       -es1800*)
+               os=-ose
+               ;;
+       -xenix)
+               os=-xenix
+               ;;
+       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+               os=-mint
+               ;;
+       -aros*)
+               os=-aros
+               ;;
+       -kaos*)
+               os=-kaos
+               ;;
+       -zvmoe)
+               os=-zvmoe
+               ;;
+       -none)
+               ;;
+       *)
+               # Get rid of the `-' at the beginning of $os.
+               os=`echo $os | sed 's/[^-]*-//'`
+               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+               exit 1
+               ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+       *-acorn)
+               os=-riscix1.2
+               ;;
+       arm*-rebel)
+               os=-linux
+               ;;
+       arm*-semi)
+               os=-aout
+               ;;
+    c4x-* | tic4x-*)
+        os=-coff
+        ;;
+       # This must come before the *-dec entry.
+       pdp10-*)
+               os=-tops20
+               ;;
+       pdp11-*)
+               os=-none
+               ;;
+       *-dec | vax-*)
+               os=-ultrix4.2
+               ;;
+       m68*-apollo)
+               os=-domain
+               ;;
+       i386-sun)
+               os=-sunos4.0.2
+               ;;
+       m68000-sun)
+               os=-sunos3
+               # This also exists in the configure program, but was not the
+               # default.
+               # os=-sunos4
+               ;;
+       m68*-cisco)
+               os=-aout
+               ;;
+       mips*-cisco)
+               os=-elf
+               ;;
+       mips*-*)
+               os=-elf
+               ;;
+       or32-*)
+               os=-coff
+               ;;
+       *-tti)  # must be before sparc entry or we get the wrong os.
+               os=-sysv3
+               ;;
+       sparc-* | *-sun)
+               os=-sunos4.1.1
+               ;;
+       *-be)
+               os=-beos
+               ;;
+       *-haiku)
+               os=-haiku
+               ;;
+       *-ibm)
+               os=-aix
+               ;;
+       *-knuth)
+               os=-mmixware
+               ;;
+       *-wec)
+               os=-proelf
+               ;;
+       *-winbond)
+               os=-proelf
+               ;;
+       *-oki)
+               os=-proelf
+               ;;
+       *-hp)
+               os=-hpux
+               ;;
+       *-hitachi)
+               os=-hiux
+               ;;
+       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+               os=-sysv
+               ;;
+       *-cbm)
+               os=-amigaos
+               ;;
+       *-dg)
+               os=-dgux
+               ;;
+       *-dolphin)
+               os=-sysv3
+               ;;
+       m68k-ccur)
+               os=-rtu
+               ;;
+       m88k-omron*)
+               os=-luna
+               ;;
+       *-next )
+               os=-nextstep
+               ;;
+       *-sequent)
+               os=-ptx
+               ;;
+       *-crds)
+               os=-unos
+               ;;
+       *-ns)
+               os=-genix
+               ;;
+       i370-*)
+               os=-mvs
+               ;;
+       *-next)
+               os=-nextstep3
+               ;;
+       *-gould)
+               os=-sysv
+               ;;
+       *-highlevel)
+               os=-bsd
+               ;;
+       *-encore)
+               os=-bsd
+               ;;
+       *-sgi)
+               os=-irix
+               ;;
+       *-siemens)
+               os=-sysv4
+               ;;
+       *-masscomp)
+               os=-rtu
+               ;;
+       f30[01]-fujitsu | f700-fujitsu)
+               os=-uxpv
+               ;;
+       *-rom68k)
+               os=-coff
+               ;;
+       *-*bug)
+               os=-coff
+               ;;
+       *-apple)
+               os=-macos
+               ;;
+       *-atari*)
+               os=-mint
+               ;;
+       *)
+               os=-none
+               ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+       *-unknown)
+               case $os in
+                       -riscix*)
+                               vendor=acorn
+                               ;;
+                       -sunos*)
+                               vendor=sun
+                               ;;
+                       -aix*)
+                               vendor=ibm
+                               ;;
+                       -beos*)
+                               vendor=be
+                               ;;
+                       -hpux*)
+                               vendor=hp
+                               ;;
+                       -mpeix*)
+                               vendor=hp
+                               ;;
+                       -hiux*)
+                               vendor=hitachi
+                               ;;
+                       -unos*)
+                               vendor=crds
+                               ;;
+                       -dgux*)
+                               vendor=dg
+                               ;;
+                       -luna*)
+                               vendor=omron
+                               ;;
+                       -genix*)
+                               vendor=ns
+                               ;;
+                       -mvs* | -opened*)
+                               vendor=ibm
+                               ;;
+                       -os400*)
+                               vendor=ibm
+                               ;;
+                       -ptx*)
+                               vendor=sequent
+                               ;;
+                       -tpf*)
+                               vendor=ibm
+                               ;;
+                       -vxsim* | -vxworks* | -windiss*)
+                               vendor=wrs
+                               ;;
+                       -aux*)
+                               vendor=apple
+                               ;;
+                       -hms*)
+                               vendor=hitachi
+                               ;;
+                       -mpw* | -macos*)
+                               vendor=apple
+                               ;;
+                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+                               vendor=atari
+                               ;;
+                       -vos*)
+                               vendor=stratus
+                               ;;
+               esac
+               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+               ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/torrus/conftools/install-sh b/torrus/conftools/install-sh
new file mode 100755 (executable)
index 0000000..4d4a951
--- /dev/null
@@ -0,0 +1,323 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2005-05-14.22
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+chmodcmd="$chmodprog 0755"
+chowncmd=
+chgrpcmd=
+stripcmd=
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=
+dst=
+dir_arg=
+dstarg=
+no_target_directory=
+
+usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+-c         (ignored)
+-d         create directories instead of installing files.
+-g GROUP   $chgrpprog installed files to GROUP.
+-m MODE    $chmodprog installed files to MODE.
+-o USER    $chownprog installed files to USER.
+-s         $stripprog installed files.
+-t DIRECTORY  install into DIRECTORY.
+-T         report an error if DSTFILE is a directory.
+--help     display this help and exit.
+--version  display version info and exit.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
+"
+
+while test -n "$1"; do
+  case $1 in
+    -c) shift
+        continue;;
+
+    -d) dir_arg=true
+        shift
+        continue;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+        shift
+        shift
+        continue;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) chmodcmd="$chmodprog $2"
+        shift
+        shift
+        continue;;
+
+    -o) chowncmd="$chownprog $2"
+        shift
+        shift
+        continue;;
+
+    -s) stripcmd=$stripprog
+        shift
+        continue;;
+
+    -t) dstarg=$2
+       shift
+       shift
+       continue;;
+
+    -T) no_target_directory=true
+       shift
+       continue;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    *)  # When -d is used, all remaining arguments are directories to create.
+       # When -t is used, the destination is already specified.
+       test -n "$dir_arg$dstarg" && break
+        # Otherwise, the last argument is the destination.  Remove it from $@.
+       for arg
+       do
+          if test -n "$dstarg"; then
+           # $@ is not empty: it contains at least $arg.
+           set fnord "$@" "$dstarg"
+           shift # fnord
+         fi
+         shift # arg
+         dstarg=$arg
+       done
+       break;;
+  esac
+done
+
+if test -z "$1"; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src ;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    src=
+
+    if test -d "$dst"; then
+      mkdircmd=:
+      chmodcmd=
+    else
+      mkdircmd=$mkdirprog
+    fi
+  else
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dstarg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dstarg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst ;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+       echo "$0: $dstarg: Is a directory" >&2
+       exit 1
+      fi
+      dst=$dst/`basename "$src"`
+    fi
+  fi
+
+  # This sed command emulates the dirname command.
+  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
+
+  # Make sure that the destination directory exists.
+
+  # Skip lots of stat calls in the usual case.
+  if test ! -d "$dstdir"; then
+    defaultIFS='
+        '
+    IFS="${IFS-$defaultIFS}"
+
+    oIFS=$IFS
+    # Some sh's can't handle IFS=/ for some reason.
+    IFS='%'
+    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+    shift
+    IFS=$oIFS
+
+    pathcomp=
+
+    while test $# -ne 0 ; do
+      pathcomp=$pathcomp$1
+      shift
+      if test ! -d "$pathcomp"; then
+        $mkdirprog "$pathcomp"
+       # mkdir can fail with a `File exist' error in case several
+       # install-sh are creating the directory concurrently.  This
+       # is OK.
+       test -d "$pathcomp" || exit
+      fi
+      pathcomp=$pathcomp/
+    done
+  fi
+
+  if test -n "$dir_arg"; then
+    $doit $mkdircmd "$dst" \
+      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
+
+  else
+    dstfile=`basename "$dst"`
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+    trap '(exit $?); exit' 1 2 13 15
+
+    # Copy the file name to the temp name.
+    $doit $cpprog "$src" "$dsttmp" &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
+      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
+      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
+      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
+
+    # Now rename the file to the real destination.
+    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
+      || {
+          # The rename failed, perhaps because mv can't rename something else
+          # to itself, or perhaps because mv is so ancient that it does not
+          # support -f.
+
+          # Now remove or move aside any old file at destination location.
+          # We try this two ways since rm can't unlink itself on some
+          # systems and the destination file might be busy for other
+          # reasons.  In this case, the final cleanup might fail but the new
+          # file should still install successfully.
+          {
+            if test -f "$dstdir/$dstfile"; then
+              $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
+              || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
+              || {
+                echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
+                (exit 1); exit 1
+              }
+            else
+              :
+            fi
+          } &&
+
+          # Now rename the file to the real destination.
+          $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
+        }
+    }
+  fi || { (exit 1); exit 1; }
+done
+
+# The final little trick to "correctly" pass the exit status to the exit trap.
+{
+  (exit 0); exit 0
+}
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/torrus/conftools/missing b/torrus/conftools/missing
new file mode 100755 (executable)
index 0000000..894e786
--- /dev/null
@@ -0,0 +1,360 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2005-06-08.21
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
+#   Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case "$1" in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
+  ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case "$1" in
+  lex|yacc)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
+    fi
+    ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+                                      sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+          sed 's/\.am$/.in/' |
+          while read f; do touch "$f"; done
+    ;;
+
+  autom4te)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    if test -f "$file"; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo "#! /bin/sh"
+       echo "# Created by GNU Automake missing as a replacement of"
+       echo "#  $ $@"
+       echo "exit 0"
+       chmod +x $file
+       exit 1
+    fi
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' $msg.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.y)
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.c
+           fi
+           SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" y.tab.h
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f y.tab.h ]; then
+       echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+       echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+       case "$LASTARG" in
+       *.l)
+           SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+           if [ -f "$SRCFILE" ]; then
+                cp "$SRCFILE" lex.yy.c
+           fi
+         ;;
+       esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+       echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+        you modified a dependency of a manual page.  You may need the
+        \`Help2man' package in order for those modifications to take
+        effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+       file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+    fi
+    if [ -f "$file" ]; then
+       touch $file
+    else
+       test -z "$file" || exec >$file
+       echo ".ab help2man is required to generate this page"
+       exit 1
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    # The file to touch is that specified with -o ...
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+    fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
+    touch $file
+    ;;
+
+  tar)
+    shift
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar "$@" && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar "$@" && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+       case "$firstarg" in
+       *o*)
+           firstarg=`echo "$firstarg" | sed s/o//`
+           tar "$firstarg" "$@" && exit 0
+           ;;
+       esac
+       case "$firstarg" in
+       *h*)
+           firstarg=`echo "$firstarg" | sed s/h//`
+           tar "$firstarg" "$@" && exit 0
+           ;;
+       esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequisites for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/torrus/discovery/README b/torrus/discovery/README
new file mode 100644 (file)
index 0000000..7218d9e
--- /dev/null
@@ -0,0 +1,5 @@
+This directory is a typical place for SNMP device discovery instruction
+files.
+
+The discovery instruction files may be generated by "genddx" utility.
+They are used as the input for "devdiscover" utility.
diff --git a/torrus/doc/Makefile.am b/torrus/doc/Makefile.am
new file mode 100644 (file)
index 0000000..336762e
--- /dev/null
@@ -0,0 +1,105 @@
+
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.am,v 1.1 2010-12-27 00:04:32 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+SUBDIRS = . manpages
+
+SUBST = @abs_top_builddir@/setup_tools/substvars.sh
+
+CLEANFILES = $(POD_FILES) $(nodist_pkgdoc_DATA)
+EXTRA_DIST = $(SRCPOD)
+
+SRCPOD = \
+               install.pod.in \
+               nodeid_usage.pod.in \
+               reporting_setup.pod.in \
+               rpnexpr.pod.in \
+               rrfw_torrus_migration.pod.in \
+               scalability.pod.in \
+               snmpdiscovery.pod.in \
+               stylingprofile.pod.in \
+               userguide.pod.in \
+               vendorsupport.pod.in \
+               webintf.pod.in \
+               xmlconfig.pod.in
+
+POD_FILES = \
+               install.pod \
+               nodeid_usage.pod \
+               reporting_setup.pod \
+               rpnexpr.pod \
+               rrfw_torrus_migration.pod \
+               scalability.pod \
+               snmpdiscovery.pod \
+               stylingprofile.pod \
+               userguide.pod \
+               vendorsupport.pod \
+               webintf.pod \
+               xmlconfig.pod
+
+
+pkgdocdir  = @pkgdocdir@
+
+if POD2TEXT_PRESENT
+nodist_pkgdoc_DATA = \
+               install.txt \
+               nodeid_usage.txt \
+               reporting_setup.txt \
+               rpnexpr.txt \
+               rrfw_torrus_migration.txt \
+               scalability.txt \
+               snmpdiscovery.txt \
+               stylingprofile.txt \
+               userguide.txt \
+               vendorsupport.txt \
+               webintf.txt \
+               xmlconfig.txt
+endif
+
+devdocdir  = $(pkgdocdir)/devdoc
+
+dist_devdoc_DATA = \
+               devdoc/architecture.pod \
+               devdoc/devdiscover.pod \
+               devdoc/progstyle.pod \
+               devdoc/reqs.0.0.pod \
+               devdoc/reqs.0.1.pod \
+               devdoc/torrus_roadmap.pod \
+               devdoc/wd.distributed.pod \
+               devdoc/wd.messaging.pod \
+               devdoc/wd.monitor-escalation.pod \
+               devdoc/wd.uptime-mon.pod
+
+SUFFIXES = .pod.in .pod .txt
+
+.PRECIOUS: $(POD_FILES)
+
+.pod.in.pod:
+       $(SUBST) $<  > $@
+
+if POD2TEXT_PRESENT
+.pod.txt:
+       $(POD2TEXT) $< > $@ 
+endif
+
+htdocs: $(POD_FILES)
+       cd manpages; make pods
+       HTMLDIR=@abs_top_builddir@/../htdocs $(SHELL) mkhtdocs.sh
+
diff --git a/torrus/doc/Makefile.in b/torrus/doc/Makefile.in
new file mode 100644 (file)
index 0000000..6c768bb
--- /dev/null
@@ -0,0 +1,620 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.in,v 1.1 2010-12-27 00:04:31 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = doc
+DIST_COMMON = $(dist_devdoc_DATA) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+       html-recursive info-recursive install-data-recursive \
+       install-exec-recursive install-info-recursive \
+       install-recursive installcheck-recursive installdirs-recursive \
+       pdf-recursive ps-recursive uninstall-info-recursive \
+       uninstall-recursive
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(devdocdir)" "$(DESTDIR)$(pkgdocdir)"
+dist_devdocDATA_INSTALL = $(INSTALL_DATA)
+nodist_pkgdocDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_devdoc_DATA) $(nodist_pkgdoc_DATA)
+ETAGS = etags
+CTAGS = ctags
+DIST_SUBDIRS = $(SUBDIRS)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+FIND = @FIND@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KILL = @KILL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERLINC = @PERLINC@
+POD2MAN = @POD2MAN@
+POD2MAN_PRESENT_FALSE = @POD2MAN_PRESENT_FALSE@
+POD2MAN_PRESENT_TRUE = @POD2MAN_PRESENT_TRUE@
+POD2TEXT = @POD2TEXT@
+POD2TEXT_PRESENT_FALSE = @POD2TEXT_PRESENT_FALSE@
+POD2TEXT_PRESENT_TRUE = @POD2TEXT_PRESENT_TRUE@
+RM = @RM@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SLEEP = @SLEEP@
+STRIP = @STRIP@
+SU = @SU@
+VERSION = @VERSION@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+cachedir = @cachedir@
+cfgdefdir = @cfgdefdir@
+datadir = @datadir@
+dbhome = @dbhome@
+defrrddir = @defrrddir@
+distxmldir = @distxmldir@
+enable_pkgonly = @enable_pkgonly@
+enable_varperm = @enable_varperm@
+exec_prefix = @exec_prefix@
+exmpdir = @exmpdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mansec_misc = @mansec_misc@
+mansec_usercmd = @mansec_usercmd@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+perlithreads = @perlithreads@
+perllibdir = @perllibdir@
+perllibdirs = @perllibdirs@
+piddir = @piddir@
+pkgbindir = @pkgbindir@
+pkgdocdir = @pkgdocdir@
+pkghome = @pkghome@
+plugdevdisccfgdir = @plugdevdisccfgdir@
+pluginsdir = @pluginsdir@
+plugtorruscfgdir = @plugtorruscfgdir@
+plugwrapperdir = @plugwrapperdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+reportsdir = @reportsdir@
+sbindir = @sbindir@
+scriptsdir = @scriptsdir@
+seslockdir = @seslockdir@
+sesstordir = @sesstordir@
+sharedstatedir = @sharedstatedir@
+siteconfdir = @siteconfdir@
+sitedir = @sitedir@
+sitexmldir = @sitexmldir@
+supdir = @supdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+tmpldir = @tmpldir@
+tmpluserdir = @tmpluserdir@
+torrus_user = @torrus_user@
+var_group = @var_group@
+var_mode = @var_mode@
+var_user = @var_user@
+varprefix = @varprefix@
+webplaindir = @webplaindir@
+webscriptsdir = @webscriptsdir@
+wrapperdir = @wrapperdir@
+SUBDIRS = . manpages
+SUBST = @abs_top_builddir@/setup_tools/substvars.sh
+CLEANFILES = $(POD_FILES) $(nodist_pkgdoc_DATA)
+EXTRA_DIST = $(SRCPOD)
+SRCPOD = \
+               install.pod.in \
+               nodeid_usage.pod.in \
+               reporting_setup.pod.in \
+               rpnexpr.pod.in \
+               rrfw_torrus_migration.pod.in \
+               scalability.pod.in \
+               snmpdiscovery.pod.in \
+               stylingprofile.pod.in \
+               userguide.pod.in \
+               vendorsupport.pod.in \
+               webintf.pod.in \
+               xmlconfig.pod.in
+
+POD_FILES = \
+               install.pod \
+               nodeid_usage.pod \
+               reporting_setup.pod \
+               rpnexpr.pod \
+               rrfw_torrus_migration.pod \
+               scalability.pod \
+               snmpdiscovery.pod \
+               stylingprofile.pod \
+               userguide.pod \
+               vendorsupport.pod \
+               webintf.pod \
+               xmlconfig.pod
+
+@POD2TEXT_PRESENT_TRUE@nodist_pkgdoc_DATA = \
+@POD2TEXT_PRESENT_TRUE@                install.txt \
+@POD2TEXT_PRESENT_TRUE@                nodeid_usage.txt \
+@POD2TEXT_PRESENT_TRUE@                reporting_setup.txt \
+@POD2TEXT_PRESENT_TRUE@                rpnexpr.txt \
+@POD2TEXT_PRESENT_TRUE@                rrfw_torrus_migration.txt \
+@POD2TEXT_PRESENT_TRUE@                scalability.txt \
+@POD2TEXT_PRESENT_TRUE@                snmpdiscovery.txt \
+@POD2TEXT_PRESENT_TRUE@                stylingprofile.txt \
+@POD2TEXT_PRESENT_TRUE@                userguide.txt \
+@POD2TEXT_PRESENT_TRUE@                vendorsupport.txt \
+@POD2TEXT_PRESENT_TRUE@                webintf.txt \
+@POD2TEXT_PRESENT_TRUE@                xmlconfig.txt
+
+devdocdir = $(pkgdocdir)/devdoc
+dist_devdoc_DATA = \
+               devdoc/architecture.pod \
+               devdoc/devdiscover.pod \
+               devdoc/progstyle.pod \
+               devdoc/reqs.0.0.pod \
+               devdoc/reqs.0.1.pod \
+               devdoc/torrus_roadmap.pod \
+               devdoc/wd.distributed.pod \
+               devdoc/wd.messaging.pod \
+               devdoc/wd.monitor-escalation.pod \
+               devdoc/wd.uptime-mon.pod
+
+SUFFIXES = .pod.in .pod .txt
+all: all-recursive
+
+.SUFFIXES:
+.SUFFIXES: .pod.in .pod .txt
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  doc/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  doc/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+install-dist_devdocDATA: $(dist_devdoc_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(devdocdir)" || $(mkdir_p) "$(DESTDIR)$(devdocdir)"
+       @list='$(dist_devdoc_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_devdocDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(devdocdir)/$$f'"; \
+         $(dist_devdocDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(devdocdir)/$$f"; \
+       done
+
+uninstall-dist_devdocDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_devdoc_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(devdocdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(devdocdir)/$$f"; \
+       done
+install-nodist_pkgdocDATA: $(nodist_pkgdoc_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(pkgdocdir)" || $(mkdir_p) "$(DESTDIR)$(pkgdocdir)"
+       @list='$(nodist_pkgdoc_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(nodist_pkgdocDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdocdir)/$$f'"; \
+         $(nodist_pkgdocDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdocdir)/$$f"; \
+       done
+
+uninstall-nodist_pkgdocDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(nodist_pkgdoc_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(pkgdocdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(pkgdocdir)/$$f"; \
+       done
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       target=`echo $@ | sed s/-recursive//`; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           dot_seen=yes; \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done; \
+       if test "$$dot_seen" = "no"; then \
+         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+       fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+       @failcom='exit 1'; \
+       for f in x $$MAKEFLAGS; do \
+         case $$f in \
+           *=* | --[!k]*);; \
+           *k*) failcom='fail=yes';; \
+         esac; \
+       done; \
+       dot_seen=no; \
+       case "$@" in \
+         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+         *) list='$(SUBDIRS)' ;; \
+       esac; \
+       rev=''; for subdir in $$list; do \
+         if test "$$subdir" = "."; then :; else \
+           rev="$$subdir $$rev"; \
+         fi; \
+       done; \
+       rev="$$rev ."; \
+       target=`echo $@ | sed s/-recursive//`; \
+       for subdir in $$rev; do \
+         echo "Making $$target in $$subdir"; \
+         if test "$$subdir" = "."; then \
+           local_target="$$target-am"; \
+         else \
+           local_target="$$target"; \
+         fi; \
+         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+         || eval $$failcom; \
+       done && test -z "$$fail"
+tags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+       done
+ctags-recursive:
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+       done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+         include_option=--etags-include; \
+         empty_fix=.; \
+       else \
+         include_option=--include; \
+         empty_fix=; \
+       fi; \
+       list='$(SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test ! -f $$subdir/TAGS || \
+             tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+         fi; \
+       done; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+         test -n "$$unique" || unique=$$empty_fix; \
+         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+           $$tags $$unique; \
+       fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+               $(TAGS_FILES) $(LISP)
+       tags=; \
+       here=`pwd`; \
+       list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+       unique=`for i in $$list; do \
+           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+         done | \
+         $(AWK) '    { files[$$0] = 1; } \
+              END { for (i in files) print i; }'`; \
+       test -z "$(CTAGS_ARGS)$$tags$$unique" \
+         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+            $$tags $$unique
+
+GTAGS:
+       here=`$(am__cd) $(top_builddir) && pwd` \
+         && cd $(top_srcdir) \
+         && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+       $(mkdir_p) $(distdir)/devdoc
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+       list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+         if test "$$subdir" = .; then :; else \
+           test -d "$(distdir)/$$subdir" \
+           || $(mkdir_p) "$(distdir)/$$subdir" \
+           || exit 1; \
+           distdir=`$(am__cd) $(distdir) && pwd`; \
+           top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
+           (cd $$subdir && \
+             $(MAKE) $(AM_MAKEFLAGS) \
+               top_distdir="$$top_distdir" \
+               distdir="$$distdir/$$subdir" \
+               distdir) \
+             || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA)
+installdirs: installdirs-recursive
+installdirs-am:
+       for dir in "$(DESTDIR)$(devdocdir)" "$(DESTDIR)$(pkgdocdir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-dist_devdocDATA install-nodist_pkgdocDATA
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-dist_devdocDATA uninstall-info-am \
+       uninstall-nodist_pkgdocDATA
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+       clean clean-generic clean-recursive ctags ctags-recursive \
+       distclean distclean-generic distclean-recursive distclean-tags \
+       distdir dvi dvi-am html html-am info info-am install \
+       install-am install-data install-data-am \
+       install-dist_devdocDATA install-exec install-exec-am \
+       install-info install-info-am install-man \
+       install-nodist_pkgdocDATA install-strip installcheck \
+       installcheck-am installdirs installdirs-am maintainer-clean \
+       maintainer-clean-generic maintainer-clean-recursive \
+       mostlyclean mostlyclean-generic mostlyclean-recursive pdf \
+       pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+       uninstall-dist_devdocDATA uninstall-info-am \
+       uninstall-nodist_pkgdocDATA
+
+
+.PRECIOUS: $(POD_FILES)
+
+.pod.in.pod:
+       $(SUBST) $<  > $@
+
+@POD2TEXT_PRESENT_TRUE@.pod.txt:
+@POD2TEXT_PRESENT_TRUE@        $(POD2TEXT) $< > $@ 
+
+htdocs: $(POD_FILES)
+       cd manpages; make pods
+       HTMLDIR=@abs_top_builddir@/../htdocs $(SHELL) mkhtdocs.sh
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/torrus/doc/devdoc/architecture.pod b/torrus/doc/devdoc/architecture.pod
new file mode 100644 (file)
index 0000000..4cf9c9c
--- /dev/null
@@ -0,0 +1,511 @@
+#  architecture.pod: The Torrus internals
+#  Copyright (C) 2002-2005  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: architecture.pod,v 1.1 2010-12-27 00:04:37 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 Torrus Framework Architecture
+
+=head2 Configuration Processing
+
+The XML configuration is compiled into the database representation by
+operator's manual request.
+
+The compiled version of configuration is not a one-to-one
+representation of the XML version. All aliases and templates are
+expanded. The backwards restoration of XML from the database
+is available with the snapshot utility.
+
+Aliases are the way to represent the data in a more convenient format.
+An alias can point to a subtree or a leaf, and it works similarly as
+a symbolic link in a filesystem.
+
+A template defines a piece of configuration which can be used in
+multiple places. Templates can be nested.
+
+The configuration can consist of several XML files. They will be
+processed in the specified order. Each new file is treated as an additive
+information to the existing tree.
+
+The XML configuration compiler validates all the mandatory parameters.
+
+
+=head2 Database Architecture
+
+All runtime data is stored in
+B<Berkeley DB> database environment (http://www.sleepycat.com).
+
+The compiled version of the configuration XML is stored in
+the B<ds_config_DSINST.db> and B<other_config_OINST.db>.
+These databases have similar structure, and
+B<ds_config_DSINST.db> keeps all datasource-related information.
+C<DSINST> and C<OINST> stand for the productive instance number,
+and have values of 0 or 1.
+Current productive instance numbers are stored in B<db_config_instances.db>
+database.
+
+For each datasource tree, the database files are resided in
+F</var/torrus/db/sub/E<gt>tree_nameE<lt>> directory.
+
+The runtime modules access the configuration via C<ConfigTree> objects.
+
+Each datasource subtree or leaf is identified by a I<token>.
+A token is a short alphanumeric string, generated internally.
+Two types of tokens are recognized: single tokens and token sets.
+
+Single token starts with letter I<T>. The rest is made with decimal digts.
+
+Token set name starts with letter I<S>. The rest is an arbitrary sequence of
+word characters.
+
+The special token I<SS> is reserved for tokensets list. Also tokenset
+parameters are inherited from this token's parameters.
+
+View and monitor names must be unique, and must
+start with a lower case letter.
+
+B<db_config_instances.db> is a I<Hash> database, with keys of form
+C<ds:E<lt>tree_nameE<gt>> or C<other:E<lt>tree_nameE<gt>>, and 0 or 1 as
+values. Also the compiler adds an entry C<compiling:E<lt>tree_nameE<gt>>
+during the compilation time, in order to avoid two compiler processes
+running at the same time on the same tree.
+
+B<ds_config_DSINST.db> is a I<Btree> database, with the keys and values
+defined as follows:
+
+=over 4
+
+=item * tp:E<lt>pathE<gt> -- E<lt>tokenE<gt>
+
+Gives the token correspondig to the given element name.
+
+=item * pt:E<lt>tokenE<gt> -- E<lt>pathE<gt>
+
+Gives the path name by the given token.
+
+=item * c:E<lt>tokenE<gt> -- E<lt>ctokenE<gt>,...
+
+For given subtree, contains the list of child tokens separated by comma.
+
+=item * p:E<lt>tokenE<gt> -- E<lt>ptokenE<gt>
+
+For given subtree or leaf, contains the parent token.
+
+=item * P:E<lt>tokenE<gt>:E<lt>pnameE<gt> -- E<lt>valueE<gt>
+
+Contains the parameter value for specified leaf or subtree.
+Each leaf or subtree inherits parameters from its parent.
+Thus, we must climb up the tree in order to get the parameter's
+value if not defined locally.
+
+=item * Pl:E<lt>tokenE<gt> -- E<lt>pnameE<gt>,...
+
+Contains the list of parameter names for specified leaf or subtree.
+
+=item * a:E<lt>tokenE<gt> -- E<lt>tokenE<gt>
+
+If this subtree or leaf is an alias, specifies the reference to the real node.
+
+=item * ar:E<lt>tokenE<gt> -- E<lt>tokenE<gt>,...
+
+Specifies all alias subtrees or leaves pointing to this token.
+
+=item * d:E<lt>nameE<gt> -- E<lt>valueE<gt>
+
+Definition value for the given name
+
+=item * D: -- E<lt>nameE<gt>,E<lt>nameE<gt>,...
+
+List of all known definitions
+
+=item * n:E<lt>tokenE<gt> -- E<lt>typeE<gt>
+
+Defines a node type. Type is a number with the following values:
+0 for subtree, 1 for leaf, 2 for alias.
+
+=back
+
+B<other_config_OINST.db> is a I<Btree> database, with the keys and values
+defined as follows:
+
+=over 4
+
+=item * ConfigurationReady -- 1:0
+
+When nonzero, the configuration is ready for usage.
+Otherwise, the configuration status is undefined.
+
+=item * P:E<lt>nameE<gt>:E<lt>pnameE<gt> -- E<lt>valueE<gt>
+
+Contains the parameter value for specified view, monitor or action.
+
+=item * Pl:E<lt>nameE<gt> -- E<lt>pnameE<gt>,...
+
+Contains the list of parameter names for specified  view,
+monitor, or action.
+
+=item * V: -- E<lt>vnameE<gt>,...
+
+Specifies comma-separated list of all views defined.
+
+=item * v:E<lt>tokenE<gt> -- E<lt>vnameE<gt>,...
+
+Specifies comma-separated list of view names for the path given.
+The first view in the list is interpreted as default.
+
+=item * M: -- E<lt>mnameE<gt>,...
+
+Specifies comma-separated list of all monitor names defined
+
+=item * A: -- E<lt>anameE<gt>,...
+
+Comma-separated list of actions defined
+
+=back
+
+
+
+
+B<paramprops_DSINST.db> is a I<Btree> database for storing the
+datasource parameter properties, such as expandable, list parameters,
+searchable, etc.:
+
+=over 4
+
+=item * E<lt>pnameE<gt>:E<lt>propertyE<gt> -- E<lt>valueE<gt>
+
+=back
+
+
+
+
+
+B<aliases_DSINST.db> is a I<Btree> database with alias paths as keys
+and target tokens as values. It is used for quick alias expansion.
+
+B<tokensets_DSINST.db> is a I<Hash> database containing the token sets.
+The keys and values are as follows:
+
+=over 4
+
+=item * S: -- E<lt>tokensetE<gt>,...
+
+Keeps the list of all known token sets.
+
+=item * s:E<lt>tokensetE<gt> -- E<lt>tokenE<gt>,...
+
+For given tokenset, keeps its contents.
+
+=item * o:E<lt>tokensetE<gt>:E<lt>tokenE<gt> -- E<lt>originE<gt>
+
+Defines the origin of the member. Currently two types of origin are known:
+C<static> and C<monitor>
+
+=back
+
+B<nodepcache_DSINST.db> is a I<Btree> database containing the cached
+node parameter values. The keys and values are as follows:
+
+=over 4
+
+=item * E<lt>nameE<gt>:E<lt>pnameE<gt> -- E<lt>statusE<gt>E<lt>valueE<gt>
+
+Keeps the status and the value for a given token and parameter.
+Status is a one-byte prefix, with values C<U> for undefined parameter, and
+C<D> for a parameter with value.
+
+=back
+
+
+B<nodeid_DSINST.db> is a I<Btree> database that stores the mapping between
+NodeID values and tokens. Database keys are NodeID strings, and values
+are tokens. One NodeID corresponds to maximum one token.
+
+
+
+B<config_readers.db> is a I<Hash> database which contains the informaton
+about active processes which read the configuration. The configuration
+compiler waits until all readers finish using the current configuration
+database. Process IDs are used as keys, and the values contain timestamps.
+
+B<timestamps.db> is a I<Hash> database containing various kinds of
+timestamps. The timestamp name is the key, and the number of seconds
+since epoch is the value.
+
+B<render_cache.db> keeps the status information about the graphs
+ready to display. Last known timestamp of the configuration is
+compared with the actual one. When the actual timestamp
+differs from known, the renderer cache is cleaned up.
+This is a I<Hash> database, with the following
+keys and values:
+
+=over 4
+
+=item * E<lt>tokenE<gt>:E<lt>vnameE<gt> --
+ E<lt>t_renderE<gt>:E<lt>t_expiresE<gt>:E<lt>filenameE<gt>:E<lt>mime_typeE<gt>
+
+For the leaf/subtree and view name given, specifies two timestamps: the
+moment of last rendering and expiration time. The filename is automatically
+generated unique name in the spool directory. The contents type is determined
+by the MIME type.
+
+=back
+
+B<monitor_cache.db> is a I<Hash> database used in order to avoid the
+unneccessary configuration tree walk. The keys are the leaf tokens, and
+the values are comma-separated monitor names. At each monitor invocation,
+the confguration timestamp is compared against the last known, and the
+cache database is rebuilt if needed.
+
+B<monitor_alarms.db> is a I<Hash> database that keeps alarm status information
+from previous runs of Monitor, with the keys and values as follows:
+
+=over 4
+
+=item * E<lt>mnameE<gt>:E<lt>pathE<gt> --
+E<lt>t_setE<gt>:E<lt>t_expiresE<gt>:E<lt>statusE<gt>:
+E<lt>t_last_changeE<gt>
+
+Key consists of the monitor name and leaf path. In the value, B<t_set>
+is the time when the alarm was raised. If two subsequent runs of Monitor
+raise the same alarm, B<t_set> does not change. B<t_expires> is the
+timestamp that shows when it's still important to keep the entry after the
+alarm is cleared. B<status> is 1 if the alarm is active, and 0 otherwise.
+B<t_last_change> is the timestamp of last status change.
+
+When B<status> is 1, the record is kept regardless of timestamps.
+When B<status> is 0, and the current time is more than B<t_expires>,
+the record is not reliable and may be deleted by Monitor.
+
+=back
+
+B<collector_tokens_X_Y.db> is a I<Hash> database used in order to avoid the
+unneccessary configuration tree walk. X is the collector instance number, and
+Y is the datasource configuration instance number.
+Keys and values are as follows:
+
+=over 4
+
+=item * E<lt>tokenE<gt> -- E<lt>periodE<gt>:E<lt>offsetE<gt>
+
+For each leaf token, period and time offset values are stored.
+
+=back
+
+
+B<scheduler_stats.db> is a I<Btree> database which stores the runtime
+statistics of Scheduler tasks. Each key is of structure
+B<E<lt>tasknameE<gt>:E<lt>periodE<gt>:E<lt>offsetE<gt>:E<lt>variableE<gt>>,
+and the value is a number representing the current value of the variable.
+Depending on variable purpose, the number is floating point or integer.
+
+
+B<users.db> is a I<Hash> database containing user details, passwords,
+and group membership:
+
+=over 4
+
+=item * ua:E<lt>uidE<gt>:E<lt>attrE<gt> -- E<lt>valueE<gt>
+
+User attributes, such as C<cn> (Common name) or C<userPassword>, are stored
+here. For each user, there is a record consisting of the attribute C<uid>,
+with the value equal to the user identifier.
+
+=item * uA:E<lt>uidE<gt> -- E<lt>attrE<gt>, ...
+
+Comma-separated list of attribute names for the given user.
+
+=item * gm:E<lt>uidE<gt> -- E<lt>groupE<gt>, ...
+
+For each user ID, stores the comma-separated list of groups it belongs to.
+
+=item * ga:E<lt>groupE<gt>:E<lt>attrE<gt> -- E<lt>valueE<gt>
+
+Group attributes, such as group description.
+
+=item * gA:E<lt>groupE<gt> -- E<lt>attrE<gt>, ...
+
+Comma-separated list of attribute names for the given group.
+
+=item * G: -- E<lt>groupE<gt>, ...
+
+List of all groups
+
+=back
+
+
+B<acl.db> is a I<Hash> database containing group privileges information:
+
+=over 4
+
+=item * u:E<lt>groupE<gt>:E<lt>objectE<gt>:E<lt>privilegeE<gt> -- 1
+
+The entry exists if and only if the group members have this privilege
+over the object given. Most common privilege is C<DisplayTree>, where
+the object is the tree name.
+
+=back
+
+
+B<serviceid_params.db> is a I<Btree> database containing properties
+for each Service ID (exported collector information, usually stored in
+an SQL database):
+
+=over 4
+
+=item * a: E<lt>serviceidE<gt>,...
+
+Lists all known service IDs
+
+=item * t:E<lt>treeE<gt> -- E<lt>serviceidE<gt>,...
+
+Lists service IDs exported by a given datasource tree.
+
+=item * p:E<lt>serviceidE<gt>:E<lt>paramE<gt> -- E<lt>valueE<gt>
+
+Parameter value for a given service ID. Mandatory parameters are:
+C<tree>, C<token>, C<dstype>. Optional: C<units>.
+
+=item * P:E<lt>serviceidE<gt> -- E<lt>paramE<gt>, ...
+
+List of parameter names for a service ID.
+
+=back
+
+
+B<searchwords.db> is a I<Btree> database with DB_DUP and DB_DUPSORT flags.
+It contains the search strings for the given tree:
+
+=over 4
+
+=item * E<lt>keywordE<gt> -- E<lt>pathE<gt>[:E<lt>paramE<gt>]
+
+For a given keyword, refer to a path of a node that contains this word.
+If the node name matches the keyword, the I<param> element
+is omitted. Otherwise it refers to the parameter that matches the keyword.
+
+=back
+
+
+
+B<globsearchwords.db> is a I<Btree> database with DB_DUP and DB_DUPSORT flags.
+It contains the search strings for all trees:
+
+=over 4
+
+=item * E<lt>keywordE<gt> -- E<lt>treeE<gt>:E<lt>pathE<gt>[:E<lt>paramE<gt>]
+
+For a given keyword, refer to a path of a node that contains this word.
+If the node name matches the keyword, the I<param> element
+is omitted. Otherwise it refers to the parameter that matches the keyword.
+
+=back
+
+
+B<snmp_failures_X.db> is a I<Btree> database containing SNMP collector
+failures information for a given collector instance for a tree.
+
+=over 4
+
+=item * c:E<lt>counterE<gt> -- E<lt>NE<gt>
+
+A counter with a name. Known names: I<unreachable>, I<removed>.
+
+
+=item * h:E<lt>hosthashE<gt> -- E<lt>failureE<gt>:E<lt>timestampE<gt>
+
+SNMP host failure information. Hosthash is a concatenation of hostname, UDP
+port, and SNMP community, separated by "|". Known failures: I<unreachable>,
+I<removed>. Timestamp is a UNIX time of the event.
+
+=item * m:E<lt>hosthashE<gt> -- E<lt>pathE<gt>:E<lt>timestampE<gt>
+
+MIB failures (I<noSuchObject>, I<noSuchInstance>, and I<endOfMibView>)
+for a given host, with the tree path of their occurence and the UNIX timestamp.
+
+=item * M:E<lt>hosthashE<gt> -- E<lt>NE<gt>
+
+Count of MIB failures per SNMP host.
+
+=back
+
+
+
+
+
+
+
+=head2 Modular Structure
+
+The Torrus framework consists of several functional modules:
+
+=over 4
+
+=item * Configuration management
+
+Once the configuration XML files get changed, the configuration compiler
+should be run manually. This guarantees that the actual framework
+configuration is changed only when the files are ready.
+
+The configuration management module provides access methods for
+enumeration and enquery of the configuratin objects.
+
+=item * Data Collector module
+
+Collector program runs as a separate process for each datasource tree.
+Upon startup, it first runs all registered collectors. After that,
+the collectors are grouped depending on period and time offset, and launched
+periodically at the moments defined by formula:
+
+  time + period - (time mod period) + timeoffset
+
+The datasources are grouped by collector type.
+For SNMP collector type, the datasources are grouped by host.
+SNMP requests are sent in non-blocking mode (see Net::SNMP Perl module
+manual).
+
+For each SNMP host, system uptime is verified. For RRD datasource types
+"COUNTER", if the device reload is
+detected, the corresponding RRD file is updated with "undefined"
+value at the calculated moment of reload.
+
+=item * Data threshold monitoring
+
+This module performs the monitoring tasks periodically, based on each
+monitored leaf schedule.
+It checks the conditions for each leaf having a monitor.
+In case of the alarm, it executes the action instructions synchronously.
+
+=item * Rendering module
+
+Upon a request, this module generates the graph and HTML files for the
+requested view and its subviews. It first checks availability of
+cached objects and avoids unneeded regeneration. It must be possible
+to force the renderer to flush the cache.
+
+=item * Web interface module
+
+Web interface module passes the Renderer output to an HTTP client.
+
+
+=back
+
+=head1 Author
+
+Copyright (c) 2002-2005 Stanislav Sinyagin ssinyagin@yahoo.com
diff --git a/torrus/doc/devdoc/devdiscover.pod b/torrus/doc/devdoc/devdiscover.pod
new file mode 100644 (file)
index 0000000..8386c17
--- /dev/null
@@ -0,0 +1,296 @@
+#  devdiscover.pod - Guide to devdiscover
+#  Copyright (C) 2003 Shawn Ferry, Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: devdiscover.pod,v 1.1 2010-12-27 00:04:36 ivan Exp $
+# Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+=head1 Torrus SNMP Device Discovery Developer's Guide
+
+=head2 C<devdiscover> overview
+
+C<devdiscover> is an extensible, module based, SNMP device discovery
+utility. It is intended to automatically generate Torrus configuration
+files, based on SNMP discovery results and templates.
+
+See I<Torrus Command Reference> for command usage and functionality overview.
+
+In general, C<devdiscover> consists of the following files and functional
+parts:
+
+=over 4
+
+=item * C<bin/devdiscover.in>
+
+This file is installed as C<bin/devdiscover> in Torrus installation directory,
+with certain variables substituted. The program provides all the commandline
+functionality and options processing. Once the CLI options are processed and
+verified, the control is passed to the C<Torrus::DevDiscover> object.
+
+=item * C<Torrus::DevDiscover>
+
+This Perl module is responsible for the SNMP discovery process organization:
+
+=over 8
+
+=item *
+
+it registers the discovery modules;
+
+=item *
+
+establishes an SNMP session to the target host;
+
+=item *
+
+initiates a new C<Torrus::DevDiscover::DevDetails> object for the target host;
+
+=item *
+
+stores the connection-specific parameters to the device object;
+
+=item *
+
+for each registered discovery module, executes C<checkdevtype()> in
+I<sequential> order;
+
+=item *
+
+for those discovery modules which paid interest in this target host,
+executes C<discover()> in I<sequential> order;
+
+=item *
+
+upon request from C<bin/devdiscover>, builds the configuration
+XML tree, by calling C<buildConfig()> in I<sequential> order for each
+relevant discovery module for each target host.
+
+=back
+
+=item * C<Torrus::DevDiscover::DevDetails>
+
+This Perl module is defined in F<perllib/Torrus/DevDiscover.pm>, and provides
+the functionality to store the results of SNMP device discovery.
+
+=item * C<Torrus::ConfigBuilder>
+
+This module is an encapsulation wrapper for XML configuration builder.
+It provides methods for every element of Torrus configuration.
+
+=item * Discovery Modules
+
+These provide all the functionality for SNMP discovery. Normally
+one module covers one MIB, or sometimes several vendor-specific MIBs,
+and it is responsible for finding out the device details necessary
+for Torrus configuration building. Usually a discovery module refers to one or
+several I<template definition files>. A module may depend on
+other modules' discovery results. This is controlled by its
+C<sequence number>. Vendor-independent discovery modules are normally named
+as C<Torrus::DevDiscover::RFCXXXX_SOME_HUMAN_NAME>, and vendor-specific
+ones are named as C<Torrus::DevDiscover::Vendor[Product[Subsystem]]>.
+
+=item * Template definition files
+
+These are XML documents residing in F<xmlconfig/vendor> and
+F<xmlconfig/generic> directories. Each file is a piece of Torrus configuration,
+and contains definitions and templates for particular MIB or vendor.
+Generic template definition files are for vendor-independent MIBs,
+and normally they are named as F<rfcXXXX.some-human-name.xml>.
+Vendor-specific files are named as F<vendor.product[.subsystem].xml>.
+
+=back
+
+
+=head2 Discovery Module Internals
+
+Discovery modules are Perl packages with few required components.
+Before creating your own modules, please read and follow
+I<Torrus Programming Style Guide>.
+
+Upon initialization, C<Torrus::DevDiscover> loads the modules listed in
+C<@Torrus::DevDiscover::loadModules> array. This array is pre-populated
+by standard module names in F<devdiscover-config.pl>.
+You can add new module names by pushing them onto this array in your
+local F<devdiscover-siteconfig.pl>.
+
+=head3 Module Registration
+
+Each discovery module should register itself in DevDiscover registry.
+Normally there's only one registry entry per discovery module, though
+it's not a limitation. The registry entry is identified by a registry
+name, which normally repeats the module name.
+
+Example:
+
+    $Torrus::DevDiscover::registry{'RFC2790_HOST_RESOURCES'} = {
+        'sequence'     => 100,
+        'checkdevtype' => \&checkdevtype,
+        'discover'     => \&discover,
+        'buildConfig'  => \&buildConfig
+        };
+
+Each registry entry must contain 4 fields:
+
+=over 4
+
+=item * C<sequence>
+
+The sequence number determines the order in which every discovery module's
+procedure is executed. Sequence numbers of dependant modules must
+be higher than those of their dependencies.
+
+Generic MIB discovery modules should have the sequence number 100. If
+a particular generic module depends on other generic modules, its sequence
+number may be 110.
+
+Vendor-specific modules should have the sequence number 500.
+Vendor-specific modules that depend on other vendor-specific modules,
+should have sequence number 510.
+
+Dependencies deeper than one level may exist, but it's recommended
+to avoid them. For most cases this should be enough.
+
+Exception is made for C<RFC2863_IF_MIB> module, which has the sequence
+number 50. That is because it provides the basic interface discovery,
+and many other modules depend on its results.
+
+Another exception is vendor-specific modules where the SNMP session parameters
+must be set earliest possible. One of such parameters is C<snmp-max-msg-size>.
+Some vendor SNMP agents would not be walked properly without this setting.
+In these occasions, the sequence number is below 50. The recommended value
+is 30.
+
+=item * C<checkdevtype>
+
+Must be a subroutine reference. This subroutine is called with two object
+references as arguments: C<Torrus::DevDiscover> and
+C<Torrus::DevDiscover::DevDetails>.
+The purpose of this subroutine is to determine if the target host is
+of required type, or if it supports the required MIB.
+The subroutine should return true if and only if the target host
+supports the MIB variables this module is supposed to discover. 
+
+In general, C<checkdevtype> subroutine is small, and checks one or several
+OIDs presence on the host, or their values, e.g. the value of I<sysObjectID>
+variable. It should perform as less as possible SNMP requests, in order to
+speed up the pre-discovery process.
+
+=item * C<discover>
+
+Must be a subroutine reference. This subroutine is called with the same
+two arguments as C<checkdevtype()>. It is called for those modules only,
+whose C<checkdevtype()> has returned true. The subroutine should return true
+if no errors occured during the discovery.
+
+The purpose of C<discover()> is to perform the actual SNMP discovery,
+and prepare the parameter values for future XML configuration.
+
+=item * C<buildConfig>
+
+Must be a subroutine reference. This subroutine is called with three object
+references as arguments: C<Torrus::DevDiscover::DevDetails>,
+C<Torrus::ConfigBuilder>, and an XML element object, which should be used only
+to pass data to ConfigBuilder methods.
+
+This subroutine is designed to construct the resulting XML configuration
+subtree as a child of a given XML element. Upper level subtrees
+are handled by CLI options processing code.
+
+=back
+
+
+=head3 OID Definitions
+
+OID definitions are designed to provide symbolic names to OIDs
+in numerical notation. Normally the symbolic names repeat the names from
+corresponding MIBs.
+
+The definitions must be defined in an C<oiddef> hash defined in the
+package namespace. Then they are automatically imported by DevDiscover
+initialization procerure.
+
+Example:
+
+    our %oiddef =
+        (
+         'hrSystemUptime'               => '1.3.6.1.2.1.25.1.1.0',
+         'hrSystemNumUsers'             => '1.3.6.1.2.1.25.1.5.0',
+         'hrSystemProcesses'            => '1.3.6.1.2.1.25.1.6.0',
+         'hrSystemMaxProcesses'         => '1.3.6.1.2.1.25.1.7.0',
+         'hrMemorySize'                 => '1.3.6.1.2.1.25.2.2.0',
+         'hrStorageTable'               => '1.3.6.1.2.1.25.2.3.1',
+         'hrStorageIndex'               => '1.3.6.1.2.1.25.2.3.1.1',
+         'hrStorageType'                => '1.3.6.1.2.1.25.2.3.1.2',
+         'hrStorageDescr'               => '1.3.6.1.2.1.25.2.3.1.3',
+         'hrStorageAllocationUnits'     => '1.3.6.1.2.1.25.2.3.1.4',
+         'hrStorageSize'                => '1.3.6.1.2.1.25.2.3.1.5',
+         'hrStorageUsed'                => '1.3.6.1.2.1.25.2.3.1.6',
+         'hrStorageAllocationFailures'  => '1.3.6.1.2.1.25.2.3.1.7'
+         );
+
+
+=head3 Template References
+
+Normally a discovery module would refer to configuration templates
+defined in template definition files. In order to provide an extra level of
+flexibility, these templates should be defined in
+F<devdiscover-config.pl> or in F<devdiscover-siteconfig.pl>.
+
+It is recommended that the template references in the discovery modules
+follow the naming standard: C<module::template-name>.
+
+ConfigBuilder's C<addTemplateApplication()> method looks up every
+template name in the global hash C<%Torrus::ConfigBuilder::templateRegistry>
+and figures out the source XML file and the actual template name.
+
+Example:
+
+    $Torrus::ConfigBuilder::templateRegistry{
+        'RFC2790_HOST_RESOURCES::hr-system-uptime'} = {
+            'name'   => 'mytest-hr-system-uptime',
+            'source' => 'mytest.templates.xml'
+            };
+
+
+=head3 Interface filtering
+
+Usually not all interfaces from ifTable need to be monitored.
+For example, Loopback and Null0 interfaces on Cisco routers.
+
+C<Torrus::DevDiscover::RFC2863_IF_MIB> provides the functionality to
+automatically filter out the interfaces, based on filter definitions.
+Filter definitions are registered by calling the subroutine
+C<Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+($devdetails, $interfaceFilter)>. The second argument is a reference
+to a hash of the following structure:
+
+Keys are symbolic names that mean nothing and need only to be unique.
+Values are hash references with the following entries: C<ifType>
+specifies the IANA interface type, and optional C<ifDescr> specifies
+a regular expression to match against interface description.
+
+The filters are usually registered within C<checkdevtype> subroutine
+of the vendor module, after the device type is identified. See
+F<CiscoIOS.pm> and F<CiscoCatOS.pm> as examples.
+
+
+=head2 Authors
+
+Shawn Ferry: initial draft.
+
+Stanislav Sinyagin: revision and detailed content.
diff --git a/torrus/doc/devdoc/progstyle.pod b/torrus/doc/devdoc/progstyle.pod
new file mode 100644 (file)
index 0000000..e9ebef5
--- /dev/null
@@ -0,0 +1,138 @@
+#  rpnexpr.pod - Torrus RPN expressions guide
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: progstyle.pod,v 1.1 2010-12-27 00:04:37 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 Torrus Programming Style Guide
+
+=head2 Perl indentation style
+
+The code indentation style is a kind of BSD/Allman style:
+
+    while( not $success and time() < $waitingTimeout )
+    {
+        $self->clearReader();
+
+        Info('Sleeping ' . $Torrus::Global::ConfigReadyRetryPeriod .
+              ' seconds');
+        sleep $Torrus::Global::ConfigReadyRetryPeriod;
+
+        $self->setReader();
+
+        if( $self->isReady() )
+        {
+            $success = 1;
+            Info('Now configuration is ready');
+        }
+        else
+        {
+            Info('Configuration is still not ready');
+        }
+    }
+
+
+Indentation is 4 characters. Opening and closing braces are aligned.
+There's no space between the keyword (C<while>, C<if>, etc.) and the opening
+parenthesis.
+
+Tab characters are prohibited.
+
+Page width is strictly 80 characters. All longer lines must be wrapped.
+
+When possible, leave space between parentheses and the inside content.
+This is not necessary for debug or print statements.
+
+There's always space around the equal sign (C<=>).
+
+The object method calls always have parentheses, even if no arguments are
+reqiured.
+
+Use keywords for logical operations instead of C operators: C<and>, C<or>,
+C<not>.
+
+Use single quotes in hash references: C<$a-E<gt>{'abc'}>.
+
+=head2 Common file properties
+
+With the exception of special-purpose files, each source file
+must ontain the GNU copying statement, CVS C<Id> tag, and author's name and
+e-mail address.
+
+C, Perl, and Bourne shell files must contain Gnu Emacs variables
+at the end of the file:
+
+ # Local Variables:
+ # mode: perl
+ # indent-tabs-mode: nil
+ # perl-indent-level: 4
+ # End:
+
+Each file must always end with the linebreak. Otherwise it might conflict
+with CVS. All files must have Unix linebreak format.
+
+=head2 GNU Emacs settings
+
+Standard C<perl-mode.el> does the thing:
+
+ ;; Set up Perl mode
+ (autoload 'perl-mode "perl-mode")
+ (setq auto-mode-alist
+     (append (list (cons "\\.pl$" 'perl-mode)
+                   (cons "\\.pm$" 'perl-mode)
+                   (cons "\\.pl\\.cgi$" 'perl-mode))
+             auto-mode-alist))
+
+ (custom-set-variables
+   ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
+   ;; Your init file should contain only one such instance.
+  '(indent-tabs-mode nil)
+  '(tab-width 8)
+  )
+
+=head2 X-Emacs settings
+
+In X-Emacs, the default handler for Perl files is C<cperl-mode.el>.
+The following custom variables must be set in order to comply to our styling
+standards:
+
+ (custom-set-variables
+   ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
+   ;; Your init file should contain only one such instance.
+  '(cperl-brace-offset -4)
+  '(cperl-continued-statement-offset 4)
+  '(cperl-indent-level 4)
+  '(indent-tabs-mode nil)
+  '(tab-width 8)
+  )
+
+=head2 Normalizing multiple files
+
+In Torrus CVS repository, in the root of module C<src>, there is a small
+utility that fixes some styling issues for all the sources in
+current directory and subdirectories:
+
+  perl normalize-all-sources.pl
+
+It replaces tabs with spaces, deletes space at the end of line,
+and removes empty lines at the start and the end of file.
+
+=head1 Author
+
+Copyright (c) 2003-2005 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/devdoc/reqs.0.0.pod b/torrus/doc/devdoc/reqs.0.0.pod
new file mode 100644 (file)
index 0000000..7ed9511
--- /dev/null
@@ -0,0 +1,166 @@
+#  requirements.pod: The pre-planning document
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: reqs.0.0.pod,v 1.1 2010-12-27 00:04:36 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 RRD Framework Requirements Version 0.0
+
+Date: Jul 10 2002
+
+This article defines some principles that a supposedly future
+RRD framework should have. The framework should consist of 3
+independent subsystems:
+
+=over 4
+
+=item Data Collection
+
+=item Data Monitoring
+
+=item Data Displaying
+
+=back
+
+=head2 Flexible Hierarchical Configuration
+
+Inspired by Cricket hierarchical configuration, we state here that
+the configuration should be hierarchical. Child nodes should
+inherit the properties from parents.
+
+The format of the configuration files has not to be neccessary
+as in Cricket. I'm not sure if it's worth keeping them in a directory
+structure representing the hierarchy tree, but it's definitive
+that multiple files should be supported.
+
+A good step ahead would be the configuration in XML format.
+It is also possible to have a converter from some other formats
+(plain text, or an SQL database) into XML which will be consumed by the
+framework.
+
+I leave the Data collection uncovered, since all of the existing
+RRD frontends do this part already.
+
+=head1 Data Monitoring Principles
+
+At the moment, the only known solution for RRD data monitoring is
+Cricket. Its threshold monitoring has certain limitation and drawbacks.
+Nevertheless, it may be used as the basis for the ideas in the further
+development.
+
+The major idea is to build data monitoring as a part of a bigger RRD
+framework, still being the independent part of the whole. The data can come
+from many differet sources, from RRDs produced by any of the existing
+and future frontends.
+
+=head2 File Naming Flexibility
+
+In most existing RRD frontends, each RRD datafile should be described
+individually. This is not very convenient, especially for the cases
+when you have several (dozens) files containing one type of data.
+(e.g., input traffic per source autonomous system).
+Also the files of same type can be created and deleted by their sourcing
+frontend, and it would be more convenient not having to change
+the monitoring configuration.
+
+Thus, we need a wildcards language which would allow to specify
+multiple files and derive the datasource names from thir names.
+
+=head2 Datasource Naming
+
+Each data being monitored (for RRDs, its definition specifies the
+E<lt>filename, DS, RRAE<gt> triple) has to have a universal name.
+The name can be fully or partly qualified, depending on the
+configuration tree. Examples of such data reference follow:
+
+  /Netflow/Exporters/63.2.3.224/if3/bps /* Interface #3 on router 63.2.3.224 */
+  /Netflow/Subnets/Dialin/bps   /* Dial-in address pool */
+  /* different grouping for the rack temperature in Server Room 1 */
+  /Envmon/RackTemp/SR1
+  /SR1/Envmon/RackTemp
+
+Name aliasing should allow short or symbolic names for data sources:
+
+  /* Alias for /Netflow/Exporters/63.2.3.224/if3 */
+  /Netflow/Upstream/FranceTelecom1
+
+=head2 Monitoring Rules
+
+Data threshold monitoring should be described in a hierarchical
+manner.
+
+It would be interesting to have monitoring rules separate from
+the data hierarchy. On the other hand, 1) some data sources might need
+special and unique monitoring rules; 2) in some cases, several
+data sources need to be combined in order to build a threshold rule.
+I'm not yet sure how this must be achieved.
+
+=head2 Event Processing
+
+Once the threshold violation occurs, the monitoring system
+should produce the alarm event.
+
+Cricket has a good set of ways to report the alarm, and they can be taken
+as the basis.
+
+Also what Cricket is really missing, is displaying those data sources
+being alarmed. The Monitoring system should produce the instructions
+to the Displaying system in order to display the summary of those
+data sources which produce alarms within certain time.
+
+
+=head1 Data Displaying Principles
+
+View profiles should be configured in a hierarchical manner.
+
+Again as with data monitoring, some Views should be configured independently
+of the data hierarchy, but also some data should be able to define
+specific view profiles.
+
+There should be view profiles of different types:
+
+=over 4
+
+=item *
+
+HTML Framework. Defines the HTML elements that should be displayed around
+the graphs. It also should define the child graphs. Also it should define
+the controls which would cause the option changes in the child graphs
+(e.g., enabling "Show Holt-Winters Boundaries" would produce the
+corresponding graph).
+
+=item *
+
+Individual Graph. Defines the way the graph should look. It should
+also be capable of displaying an arbitrary number of data sources.
+It should have tunable options, like color, size, or time period.
+
+=back
+
+The Displaying system should allow the following ways of viewing:
+1) hierarchical browsing, like Cricket; 2) alarm summary display;
+3) individual graph display, without HTML surrounding.
+
+The graph images should be cashed and reused whenever possible.
+In alarm summary browsing, these images can be generated at the moment
+of the event.
+
+=head1 Author
+
+Copyright (c) 2002 Stanislav Sinyagin ssinyagin@yahoo.com
diff --git a/torrus/doc/devdoc/reqs.0.1.pod b/torrus/doc/devdoc/reqs.0.1.pod
new file mode 100644 (file)
index 0000000..49698d3
--- /dev/null
@@ -0,0 +1,210 @@
+#  requirements.pod: The pre-planning document
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: reqs.0.1.pod,v 1.1 2010-12-27 00:04:36 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 RRFW Requirements Version 0.1
+
+Date: Jun 29 2003; Last revised: Aug 05 2003
+
+In this article, I describe the important changes that are planned
+for RRFW version 0.1.X.
+
+=head1 Independent datasource trees
+
+As noted by many users, RRFW lacks the scalability when the number of
+network devices is more than 100. The XML compiler takes minutes to
+process the configuration, and the Collector process initialization time
+is too long.
+
+Christian Schnidrig E<lt>christian.schnidrig@gmx.chE<gt> has proposed
+a solution to split the database into several subsystems, each
+being compiled separately, and with separate collector process.
+In his concept, there is a "global" datasource tree, and
+"subsystem" trees, each making a subset of global datasource nodes.
+
+I propose to have a number of independent datasource trees, without
+any superset. This would ease the administrator's work, and add more
+security.
+
+=head2 Changes in rrfw-siteconfig.pl
+
+Instead of C<@RRFW::Global::xmlFiles>, the following hash will contain
+the information about the trees:
+
+  %RRFW::Global::treeConfig = (
+    'tree_A' => {
+      'description' => 'The First Tree',
+      'xmlfiles' => ['a1.xml', 'a2.xml', 'a3.xml'],
+      'run' => { 'collector' => 1, 'monitor' => 1 } },
+    'tree_B' => {
+      'description' => 'The Second Tree',
+      'xmlfiles' => ['b1.xml', 'b2.xml'],
+      'run' => {} }
+   );
+
+In this hash, the keys give the tree names, I<xmlfiles> points to an array
+of source XML files, I<run> points to the names of the daemons that
+would be automatically launched for the tree.
+
+Two additional arrays: C<@RRFW::Global::xmlAlwaysIncludeFirst> and
+C<@RRFW::Global::xmlAlwaysIncludeLast> will give a list of source XML
+files that are included in every tree, in the beginning or in the end of
+the XML files list.
+
+=head2 ConfigTree object internals
+
+There will be no such thing as globalInstance. All methods and procedures
+that need to reference the current ConfigTree object will have it as
+argument.
+
+C<RRFW::ConfigTree::new()> will have a mandatory argument "TreeName".
+
+=head2 Database structure
+
+All datasource trees will share one BerkeleyDB environment. The
+BDB environment home directory will stay the same, defined by I<dbhome>
+config variable.
+
+For each tree, the database files will be placed in a separate subdirectory
+of a subdirectory of I<dbhome>.
+
+
+=head2 User interface
+
+All relevant command-line executables will support the following
+options:
+
+=over 4
+
+=item * --tree <tree_name>
+
+Specifies the datasource tree for processing;
+
+=item * --all
+
+If applicable, performs the operation on all available trees.
+
+=back
+
+When in verbose mode (B<--verbose>), the command-line programs must
+print the tree names they operate with.
+
+The web interface will take the PATH_INFO string as the tree name.
+For mod_perl handler, it will be also possible to prohibit
+PATH_INFO selection, and to configure the tree name in Apache
+configuration.
+
+When no PATH_INFO is given to the web interface handler,
+a special superlevel menu may be shown with the list of available trees.
+
+It will also be possible to specify tree-specific renderer attributes, like
+C<%RRFW::Renderer::styling>, C<$RRFW::Renderer::companyName>, etc.
+
+B<Plain CGI interface will not be supported> As Renderer gets more complex,
+CGI initialization time will increase. Also it will become harder to support
+two user interfaces with similar functionality.
+
+
+=head2 Daemons launch master
+
+There will be a master process that will launch collector and monitor
+daemons for each tree. It will be configurable from a separate file,
+specifying the daemons and execution parameters for each tree.
+
+The master process will watch the child processes and issue warnings in the
+events of child process termination.
+
+Stopping the master process will stop all child daemons gracefully.
+
+
+=head1 Separate database for non-datasource objects
+
+In RRFW version 0.0.X, all the parameters for datasources, views,
+monitors, and tokensets are stored in F<configuration.db> database.
+
+As proposed by Christian Schnidrig, storing all non-datasource
+objects information in a separate database would improve the scalability.
+
+In RRFW version 0.1.X, datasource parameters will be stored in
+F<ds_config.db>, and all other object's parameters in F<other_config.db>.
+
+The XML compiler will have a new option, B<--nods>, which disables
+processing of E<lt>datasourcesE<gt> elements in the input XML files.
+
+In addition to C<ConfigurationReady> flag, there will be a flag that indicates
+the readiness of datasource tree only.
+
+All these measures will allow faster administration and testing of
+non-datasource objects, and will prevent the collector from unneeded
+interruptions.
+
+
+=head1 User privileges
+
+User privileges will apply to the tree level: across one datasource tree
+a given user will have uniform privileges.
+
+Each user belongs to one or more groups. Privileges are assigned to
+groups only, not to individual users. Groups are one-level deep: they
+consist of users only. Probably in the future groups will consist
+of groups too.
+
+In the beginning, only one privilege will be implemented: I<DisplayTree>.
+The design should be flexible enough to add more privileges in the future.
+Examples: I<GenerateReport>, I<Debug>, I<ScheduleTask>, and so on.
+
+Privileges maintenance interface will include a command-line utility.
+In the future, a web interface is also possible. In this case, a new
+privilege will be added: I<EditPrivileges>.
+
+Privileges editor will include the following functions:
+
+=over 4
+
+=item * add/delete group
+
+=item * add/delete user
+
+=item * change user password
+
+=item * add/delete user membership in a group
+
+=item * edit privileges for groups and trees
+
+=item * list group members
+
+=item * list groups a user belongs to
+
+=item * list privileges for a given group or user
+
+=item * list privileges and groups (or users) for a given tree
+
+=item * export/import the privileges database to/from XML
+
+=back
+
+Privileges logics implementation must be separate from the database backend.
+At first, BerkeleyDB backend will be supported. In the future, LDAP
+backend is possible.
+
+=head1 Author
+
+Copyright (c) 2003 Stanislav Sinyagin ssinyagin@yahoo.com
diff --git a/torrus/doc/devdoc/torrus_roadmap.pod b/torrus/doc/devdoc/torrus_roadmap.pod
new file mode 100644 (file)
index 0000000..85698f2
--- /dev/null
@@ -0,0 +1,249 @@
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_roadmap.pod,v 1.1 2010-12-27 00:04:36 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+=head1 RRFW to Torrus transition roadmap
+
+=head2 Introduction
+
+The name "RRFW" appeared to be quite difficult to remember and to pronounce.
+There has been a call for a new name, and recently a good suggestion came
+from Francois Mikus:
+
+    --- Francois Mikus <fmikus[at]acktomic.com> wrote:
+    > Here is my humble flash, which I think may be appropriate. Which I will 
+    > explain why below...
+    > 
+    > The name I would suggest is;
+    > 
+    > Torrus
+    > 
+    > Has a mythical sounding name without the actual history. Has a resonance 
+    > with Torrent, where rrfw deals with a torrent of information. A google 
+    > search comes up with near nothing, and nothing commercial. Has a 
+    > resonance with Taurus, which is mythical, astrological and has an 
+    > underlying strength connotation.
+    > 
+    > Anyway, this is the best I could think of. And it provides an opening to 
+    > have a semi-mythical/comic style yet serious mascot.
+    > 
+    > You have a LOT of documentation. web pages, code, etc.. But marketing is 
+    > the way to win hearts and minds, create a following and get rabid 
+    > developpers on-board!
+
+Thus the project will be renamed to Torrus, and few other structural changes
+will accompany the transition.
+
+=head2 Releases roadmap
+
+Version 0.1.8 will be the last of RRFW, unless some urgencies arise.
+
+The first Torrus release will be 1.0.0.
+
+
+
+=head2 Multiple XML cofiguration directories
+
+During XML compilation, the datasource configuration files will be searched in
+multiple directories. The list of directories and the search sequence
+will be configurable. This will allow not to mix the distribution XML files
+and the ones created locally.
+
+=head2 Separated directories for templates and configuration
+
+Perl configuration files and HTML templates will also be separated into
+different directories, so that user-editable files don't mix with the
+ones from distribution.
+
+=head2 Commandline launcher
+
+A small shell script will be installed as C</usr/local/bin/torrus>,
+and it will pass all arguments to appropriate torrus executables. For example,
+
+  torrus compile --tree=main
+
+will execute C<compilexml> torrus utility with the argument C<--tree=main>.
+
+
+
+=head2 New directory hierarchy
+
+Filesystem Hierarchy Standard E<lt>http://www.pathname.com/fhs/E<gt>
+proposes to put the software add-on packages into C</opt> directory
+and user services data, such as database contents or RRD files, in
+C</srv> directory.
+
+However, FreeBSD and some other systems are not FHS-compliant, and require
+to install all additional software into C</usr/local> hierarchy.
+
+We propose that Torrus distribution will support three different directory
+layouts, and the system administrator will decide the most suitable one:
+
+=over 4
+
+=item 1
+
+Default layout based in C</usr/local>;
+
+=item 2
+
+FHS compliant layout, set by running C<./configure_fhs> instead
+of C<./configure>;
+
+=item 3
+
+Custom layout, tunable with standard options and variables in C<./configure>.
+
+=back
+
+
+=head3 Default layout
+
+Although many systems like FreeBSD discourage creation of new
+package-specific subdirectories in /usr/local, we find it quite a common
+practice, and quite convenient for keeping the files together.
+
+  /usr/local/torrus/    Home directory for Torrus distribution files
+        |
+        +- conf_defaults/  torrus-config.pl and others
+        |
+        +- bin/         Command-line executables
+        |
+        +- doc/         POD and TXT documentation files
+        |
+        +- examples/    Miscelaneous example files
+        |
+        +- perllib/     Perl libraries
+        |
+        +- plugins/     Plugins configuration
+        |
+        +- scripts/     Scripts
+        |
+        +- sup/         Supplementary files, DTDs, MIBs, color schemas,
+        |               Web plain files
+        |
+        +- templates/   Renderer output templates
+        |
+        +- xmlconfig/   Distrubution XML files
+
+  /usr/local/etc/torrus/   Site configurable files
+        |
+        +- conf/        Place for torrus-siteconfig.pl and other siteconfigs
+        |
+        +- discovery/   Devdiscover input files
+        |
+        +- templates/   User-defined Renderer output templates
+        |
+        +- xmlconfig/   User XML configuration files
+
+  /usr/local/man/       Place for man pages. All articles will have the
+                        prefix C<torrus_>
+
+  /var/log/torrus/      Daemon logfiles
+
+  /var/run/torrus/      Daemon PID files
+
+  /var/torrus/cache/    Renderer cache
+
+  /var/torrus/db/       Configuration databases
+
+  /var/torrus/session_data/  Web interface session files
+
+  /srv/torrus/collector_rrd/  Default directory for collector
+                              generated RRD files
+
+
+=head3 FHS compliant layout
+
+  /opt/torrus/          Home directory for Torrus distribution files
+        |
+        +- conf_defaults/  torrus-config.pl and others
+        |
+        +- bin/         Command-line executables
+        |
+        +- doc/         POD and TXT documentation files
+        |
+        +- examples/    Miscelaneous example files
+        |
+        +- perllib/     Perl libraries
+        |
+        +- plugins/     Plugins configuration
+        |
+        +- scripts/     Scripts
+        |
+        +- sup/         Supplementary files, DTDs, MIBs, color schemas
+        |
+        +- templates/   Renderer output templates
+        |
+        +- xmlconfig/   Distrubution XML files
+
+  /etc/opt/torrus/   Site configurable files
+        |
+        +- conf/        Place for torrus-siteconfig.pl and other siteconfigs
+        |
+        +- discovery/   Devdiscover input files
+        |
+        +- xmlconfig/   User XML configuration files
+
+  /opt/torrus/share/man/  Place for man pages. All articles will have the
+                          prefix C<torrus_>
+
+  /var/log/torrus/      Daemon logfiles
+
+  /var/run/torrus/      Daemon PID files
+
+  /var/torrus/cache/    Renderer cache
+
+  /var/torrus/session_data/  Web interface session files
+
+  /srv/torrus/db/       Configuration databases
+
+  /srv/torrus/collector_rrd/  Default directory for collector
+                              generated RRD files
+
+
+=head2 New plugins design
+
+Unlike RRFW, the plugins in Torrus will be installed independently.
+This will allow to easily add new plugins to an existing installation.
+
+The Torrus installer stores all important variable settings in a special
+file, F<conf_defaults/instvars>. Then the plugin installer is able
+to access the settings without accessing the Torrus distribution
+directory.
+
+There is a helper utility, C<install_plugin>, which applies all
+I<configure> variables to the plugin configuration utility.
+It follows then the standard installation way:
+
+ ./configure && make && make install
+
+Thus the OS-dependent package installators may follow the standard
+configuration procedure, while those who manually install the software,
+will use the helper.
+
+There are two special directories: F</usr/local/torrus/plugins/torrus-config>
+and F</usr/local/torrus/plugins/devdiscover-config>. Plugins are
+allowed to add Perl files there. They will be automatically I<require>'d by
+F<torrus-config.pl> and F<devdiscover-config.pl>.
+
+
+
+=head2 Authors
+
+Copyright (c) 2004 Stanislav Sinyagin
diff --git a/torrus/doc/devdoc/wd.distributed.pod b/torrus/doc/devdoc/wd.distributed.pod
new file mode 100644 (file)
index 0000000..8dae049
--- /dev/null
@@ -0,0 +1,198 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: wd.distributed.pod,v 1.1 2010-12-27 00:04:36 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 RRFW Working Draft: Distributed collector architecture
+
+Status: pending implementation.
+Date: May 26, 2004. Last revised: June 14, 2004
+
+=head2 Introduction
+
+In large installations, one server has often not enough capacity
+to collect the data from all the data sources. In other cases,
+because of the network bandwidth or security restrictions it is
+preferrable to collect (SNMP) data locally on the site, and transfer
+the updates to the central location less frequently.
+
+=head2 Terminology
+
+We call I<Hub> servers those which run the user web interfaces and
+optionally threshold monitors. These are normally placed in the central
+location or NOC datacenter.
+
+I<Spoke> servers are those running SNMP or other data collectors.
+They periodically transfer the data to Hub servers. One Spoke
+server may send copies of data to several Hub servers, and one
+Hub server may receive data from many Spoke servers.
+
+In general, the property of being a Hub or a Spoke is local to a pair
+of servers and their datasource trees, and it only describes the functions
+of data collection and transfer. In complex installations, the same
+instance of RRFW may function as a Hub for some remote Spokes, and as a
+Spoke for some other Hubs simultaneousely.
+
+We call I<Association> a set of attributes that describe a single connection
+between Hub and Spoke servers. These attributes are:
+
+=over 4
+
+=item * Association ID
+
+Unique symbolic name across the whole range of interconnected servers.
+
+=item * Hub server ID, Spoke server ID
+
+Names of the servers, usually hostnames.
+
+=item * Transport type
+
+One of SSH, RSH, HTTP, etc.
+
+=item * Transport mode
+
+PUSH or PULL
+
+=item * Transport parameters
+
+Parameters needed for this transport connection, like login name, password,
+URL, etc.
+
+=item * Compression type and level
+
+Optional, gzip or bzip2 or something else, with compression levels from 1 to 9.
+
+=item * Tree name on Hub server
+
+Target datasource tree that will receive data from Spokes
+
+=item * Subtree path on Hub server
+
+The data updates from this association will be placed in a subtree
+under the specified path.
+
+=item * Tree name on Spoke server
+
+The tree where a collector runs and stores data into this association.
+
+=item * Path translation rules
+
+Datasource paths from Spoke server may be changed to look different
+in the tree of Hub server.
+
+=back
+
+
+=head2 Transport
+
+The modular architecture design should allow different types of data
+transfer. The default transport is Secure Shell version 2 (SSH). Other
+possible transports may be RSH, HTTP/HTTPS, rsync.
+
+Two transport modes should be implemented: PUSH and PULL.
+In PUSH mode, Spoke servers initiate the data transfer and push the data to
+Hub servers. In PULL mode, Hub servers initiate the data
+transfer and ask Spokes for data updates. It should be possible
+to mix the transport modes for different Associations on the same
+server, but within each Association the mode should be strictly
+determined. The choice of transport mode should be based on local security
+policies, and server and network performance.
+
+Optionally the compression method and level can be configured. Although
+SSH protocol supports its own compression, more aggressive compression
+methods may be used for the sake of better bandwidth usage.
+
+Transport agents should notify the operator in cases of delivery failures.
+
+=head2 Operation
+
+For Spoke servers, distributed data transfer will be implemented as
+additional storage type. For Hub servers, this will be a new collector
+type.
+
+Each data transfer is a concatenation of I<messages>. Messages
+may be of one of two types: I<CONFIG> and I<DATA>. Spoke server generates
+the messages and stores them for the transfer. Messages are delivered
+to Hub servers with a certain delay, but they are guaranteed to
+arrive in sequential order. For each pair of servers, messages are
+consecutively numbered. These numbers are used for failure detection.
+
+A Spoke server keeps track of its configuration, and after each
+configuration change, it sends a CONFIG message. This message contains
+information about mapping between Spoke server tokens and datasource paths,
+and a limited set of parameters for displaying and monitoring the data.
+
+After each collector cycle, Spoke server sends DATA messages.
+These messages contain the following information: timestamp of the
+update, token, and value. The format of the message should be designed
+to consume minimum bandwidth.
+
+Hub server picks up the messages delivered by the transport agents.
+Upon receiving a CONFIG message, it sets a preconfigured delay, in order
+to collect as many as possible CONFIG messages. Then the data transfer agent
+generates a new XML configuration based on the messages, and starts
+the compilation of configuration. The DATA messages are queued for the
+collector to pick up and and store the values. It must be ensured that
+all DATA messages queued for the old configuration are processed before
+the compilation starts.
+
+In case of fatal failure and loss of data, Hub server ignores all DATA
+messages until it gets a new CONFIG message. A periodic configuration update
+schedule should be defined. If no configuration changes occur within a
+certain period of time, Spoke server periodically sends the CONFIG messages
+with the same timestamp.
+
+
+=head2 Message format
+
+Message is a text in email-like format: it starts with a header, followed by
+an empty line and the body. Single dot (.) in a line specifies the end of
+the message. Blocks within a CONFIG message are separated with semicolon (;),
+each block representing a single datasource leaf.
+
+Example:
+
+ MsgID:100001
+ Type:CONFIG
+ Timestamp:1085528682
+
+ level2-token:T0005
+ level2-path:/Routers/RTR1/Interface_Counters/Ethernet0/InOctets
+ vertical-label:bps
+ ....
+ ;
+ level2-token:T0006
+ level2-path:/Routers/RTR1/Interface_Counters/Ethernet0/OutOctets
+ vertical-label:bps
+ .
+ MsgID:100002
+ Type:DATA
+ Timestamp:1085528690
+
+ T0005:12345678
+ T0006:987654321
+ .
+
+
+
+
+=head1 Author
+
+Copyright (c) 2004 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/devdoc/wd.messaging.pod b/torrus/doc/devdoc/wd.messaging.pod
new file mode 100644 (file)
index 0000000..5d76e11
--- /dev/null
@@ -0,0 +1,128 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: wd.messaging.pod,v 1.1 2010-12-27 00:04:36 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 RRFW Working Draft: Messaging subsystem
+
+Status: pending implementation.
+Date: Jun 30 2004. Last revised:
+
+=head2 Introduction
+
+Due to the modular and flexible architecture of RRFW, nothing prevents
+us from having the possibility of user messages displayed in RRFW pages.
+This design document describes the concept of this functionality.
+
+=head2 Description
+
+The messaging subsystem will allow the RRFW users to leave comments and
+short messages directly at the RRFW pages. Those may be remarks about the
+graph contents, troubleshooting journal, etc.
+
+Each user is uniquely identified by RRFW ACL susbsystem. We introduce several
+new attributes and privileges for messaging functionality. Privilege objects
+are the tree names.
+
+Attributes:
+
+=over 4
+
+=item * email
+
+The user's e-mail where the notifications will be sent
+
+=item * msgnotify
+
+When set to true value, e-mail notifications will be sent to this users.
+
+=back
+
+Privileges:
+
+=over 4
+
+=item * PostMessages
+
+allows the user to add messages to the tree objects.
+
+=item * DisplayMessages
+
+allows the user to see all messages for the tree
+
+=item * ReceiveNotifications
+
+allows the user to receive e-mail notifications. For those notifications
+generated by Messages, C<DisplayMessages> must be granted too.
+
+=item * DeleteMessages
+
+allows the user to delete messages from the tree objects
+
+=item * EditMessages
+
+allows the user to change any message
+
+=item * EditOwnMessages
+
+allows the user to change his/her own messages
+
+=back
+
+The C<acledit> program will have two additional options that simplify
+administration: C<--msguser> will grant all privileges except C<DeleteMessages>
+and C<EditMessages>, and C<--msgadmin> will grant all messaging privileges.
+
+The messaging options database will contain parameters that each user can tune
+for himself or herself:
+
+=over 4
+
+=item * Notify when
+
+a) any new message in all trees; b) (default) new message for
+objects that I commented only.
+
+=item * Notification format
+
+a) plain text (default); b) HTML; c) RSS 2.0
+
+=item * Subject line format
+
+The format pattern with keywords like C<$TREE>, C<$PATH>, C<$AUTHOR>,
+C<$MSGID>, etc.
+
+Default:
+
+  [rrfw $MSGID] $TREE $AUTHOR: $PATH
+
+=back
+
+Each message will have the status of Read/Unread per each user in the system.
+
+On the tree chooser page in RRFW Web interface, the user will be shown
+the unread messages.
+
+RRS 2.0 feed will be provided for messages export and for integration with
+other messaging systems.
+
+
+=head1 Author
+
+Copyright (c) 2004 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/devdoc/wd.monitor-escalation.pod b/torrus/doc/devdoc/wd.monitor-escalation.pod
new file mode 100644 (file)
index 0000000..3dc5979
--- /dev/null
@@ -0,0 +1,117 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: wd.monitor-escalation.pod,v 1.1 2010-12-27 00:04:36 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 RRFW Working Draft: Monitor escalation levels
+
+Status: pending implementation.
+Date: Nov 5 2003. Last revised: Nov 10 2003
+
+=head2 Introduction
+
+The initial idea comes from Francois Mikus in Cricket development team.
+His proposal was to raise the alarm only after several true consecutive
+monitor conditions.
+
+The idea has developed into the concept of escalation levels.
+
+
+=head2 Monitor events
+
+Current implementation supports four types of monitor events: C<set>,
+C<repeat>, C<clear>, and C<forget>. New event type will be C<escalate(X)>.
+C<X> designates a symbolic name for a certain escalation level. Each level
+is associated with the escalation time interval.
+
+Given C<Te> as the escalation interval, C<Ta> as the monitor condition age,
+and C<P> as period, the escalation event will occur simultaneously with
+one of C<repeat> events, when the following condition is true:
+
+  Te >= Ta
+
+New event types C<clear(X)> and C<forget(X)> will occur at the same
+time as C<clear> and C<forget> respectively,
+for each escalated level.
+
+
+=head2 Monitor parameters
+
+New parameter will be introduced: C<escalation>. Value will
+be a comma-separated list of C<name=interval> parts, where C<name>
+designates the escalation level, and C<interval> specifies the escalation
+interval in seconds.
+
+Example:
+
+  <monitor name="rate-limits">
+    <param name="escalation value="Medium=1800, High=7200, Critical=14400" />
+    ...
+  </monitor>
+
+Another example would be Cisco TAC style priorities: P3, P2, P1.
+
+
+=head2 Action parameters
+
+C<launch-when> parameter will be valid not for C<exec> actions only, but also
+for C<tset> actions. New valid values will be C<escalate(X)>, C<clear(X)>,
+and C<forget(X)>.
+
+XML configuration validator will not verify if escalation levels in
+action definition match those in datasource configuration.
+
+New optional action parameter: C<allowed-time>. Contains an RPN expression
+which must be true at the time when the action is allowed to execute.
+Two new RPN functions may be used here: C<TOD> and C<DOW>.
+
+C<TOD> returns the current time of day as integer: C<HH*100+MM>. For example,
+830 means 8:30 AM, and 1945 means 7:45 PM.
+
+C<DOW> returns the current day of the week as integer between and including
+0 and 6, with 0 corresponding to Sunday, 1 to Monday, and 6 to Saturday.
+
+In this example, the action is allowed between 8 AM and 6 PM from Monday
+to Friday:
+
+  <param name="allowed-time">
+    TOD,800,GE, TOD,1800,LE, AND,
+    DOW,1,GE, AND,
+    DOW,5,LE, AND
+  </param>
+
+
+=head2 Implementation
+
+B<monitor_alarms.db> database format will change: The values will consist
+of five colon-separated fields. The first four fields will be as earilier,
+and the fifth one will be a comma-separated list of escalation level names
+that have already fired.
+
+The implementation of this feature is preferred after the planned redesign of
+the monitor daemon. The new monitor design would support individual
+schedule for each datasource leaf, analogous to collector schedules.
+
+In turn, the monitor daemon  redesign is better to do after
+the collector daemon redesign. Then it would allow to keep similar design
+and architecture where possible.
+
+=head1 Author
+
+Copyright (c) 2003 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/devdoc/wd.uptime-mon.pod b/torrus/doc/devdoc/wd.uptime-mon.pod
new file mode 100644 (file)
index 0000000..8bc1c42
--- /dev/null
@@ -0,0 +1,162 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: wd.uptime-mon.pod,v 1.1 2010-12-27 00:04:36 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 RRFW Working Draft: Service uptime monitoring and reporting
+
+Status: in pre-design phase.
+Date: Sep 26 2003; Last revised:
+
+=head2 Definitions
+
+It is often required to monitor the service level in networks.
+Service level is normally covered by Service Level Agreement (SLA),
+which defines the following parameters:
+
+=over 4
+
+=item * Service definition
+
+Describes the particular service in terms of functionality and means of
+monitoring. Examples are: IP VPN connectivity, WAN uplink, SQL database engine.
+
+=item * Maintenance window
+
+Describes the periodic time intervals when service outage is possible
+due to some maintenance work. It may be unconditional (outage is always
+possible within the window), or conditional (customer confirmation required
+for outage within the window). Notification period is normally defined
+for maintenance outages.
+Example: every 1st Tuesday of the month between 6AM and 8 AM, with 96 hours
+notification time.
+
+=item * Outage types
+
+Outages may be caused by: 1). system failure; 2). service provider's
+infrastructure failure; 3). customer activity.
+
+=item * Service level objectives
+
+These are the guarantees that the sevice provider gives to the customer.
+Violation of these guarantees is compensated by penalties defined.
+
+These may include: Maxium maintenance downtime per specified period;
+Maximum downtime period due to failures on the service provider side;
+Minimum service availability per specified period.
+
+=back
+
+
+=head2 Event datasource type
+
+In order to store the service level information, we need a new datasource
+type in RRFW: I<event>. It represents an atomic information
+about a single event in time, e.g. it canot be devided into more specific
+elements or sub-events. Its attributes are as follows:
+
+=over 4
+
+=item * Event group name
+
+Several events belong to one and only one group. Event group is a unique
+entity that describes the service.
+
+=item * Event name
+
+Unique name within the event group. Describes the type of the event, such as
+C<maintenance>, C<downtime>. Events with the same names cannot overlap in
+time.
+
+=item * Start time
+
+Timestamp of the event start.
+
+=item * Duration
+
+Positive integer that specifies the length of the event in seconds.
+Zero duration means that the event has not yet finished.
+
+=item * Parameters
+
+Event-specific I<(name, value)> pairs.
+
+=back
+
+Events are uniquely identified by I<(Event group, Event name, Start time)>
+triple.
+
+
+=head2 Event summary reports
+
+Renderer should be able to display the events at different summary levels
+and in different combinations. Event reports should be specified by
+expressions, as follows:
+
+=over 4
+
+=item * Boolean operators
+
+C<downtime AND NOT maintenance>.
+
+=item * Time period
+
+C<(downtime AND NOT maintenance)[-2DAYS,NOW]>
+
+C<(downtime[-2DAYS,NOW] AND NOT maintenance AND
+NOT downtime[200309151200,200309151300])>
+
+=item * Arithmetic operations
+
+Sum of durations, substract of durations...
+
+=back
+
+=head2 Events generation
+
+Events may be generated by the following sources:
+
+=over 4
+
+=item * Collector
+
+SNMP collector may create events on some faulty conditions, like host
+unreachable, or on SNMP variables change, like interface status.
+Also it's possible to create an ICMP Echo collector type,
+which would generate events based on pinging the hosts.
+
+=item * Monitor
+
+Obviously, a new monitor action will be to create events.
+
+=item * Human operator
+
+First from commandline interface, and later from thr Web interface,
+the human operators may create the scheduled events, like maintenance
+outages. Security policy should protect certain types of events
+from human intervention.
+
+=back
+
+
+
+
+=head1 Author
+
+Copyright (c) 2003 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/install.pod.in b/torrus/doc/install.pod.in
new file mode 100644 (file)
index 0000000..3815dad
--- /dev/null
@@ -0,0 +1,630 @@
+#  install.pod - Torrus installation instructions
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: install.pod.in,v 1.1 2010-12-27 00:04:36 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 Torrus Installation Instructions
+
+
+
+=head2 Required Software
+
+=over 4
+
+=item * Operating System
+
+Any UNIX-like operation system where the required components are working.
+The author's primary development platform is Cygwin
+E<lt>http://www.cygwin.comE<gt>,
+and the primary testing environments are Sun Solaris/SPARC and FreeBSD.
+
+Note to B<VmWare> users: as recommended by Gord Philpott, Linux kernel for
+guest machine needs to be compiled with the following feature enabled:
+C<Character devices ---E<gt> Enhanced Real Time Clock Support>.
+For other guest operating systems (e.g. FreeBSD), in order to let the
+Torrus collector and monitor run properly, you need to add the following
+lines to your F<torrus-siteconfig.pl>:
+
+  $Torrus::Scheduler::maxSleepTime = 15;
+  $Torrus::Scheduler::ignoreClockSkew = 1;
+
+# B<Debian> package is maintained by Jurij Smakov and is available at
+# E<lt>http://pkg-torrus.alioth.debian.orgE<gt>.
+
+=item * Perl
+
+Perl version C<5.8.1> or higher is required. B<Version C<5.8.0> is not
+recommended> because of memory access bugs and unpredictable behaviour.
+Perl interpreter should be in PATH environment variable when
+running C<./configure>, otherwise use
+
+  ./configure PERL=/path/to/perl
+
+Torrus also supports Perl multithreading in Device Discovery engine and
+in the Collector. Minimum requirements are as follows: Perl version 5.8.8
+or higher, C<threads> module version 1.41 or higher, C<threads::shared> module
+version 1.03 or higher. Older versions had bugs that were leading to
+severe memory leaks and instability. After installing Perl 5.8.8,
+you need to upgrade the C<threads> and C<threads::shared> modules manually
+from CPAN. If any of the requirements is not met, the installer will
+automatically disable the threads support in Torrus.
+
+=item * RRDtool
+
+Round Robin Database Tool is available at:
+E<lt>http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool/E<gt>.
+Both stable version C<1.0.x> and the development version C<1.1.x>
+are supported.
+
+As of this writing, rrdtool version C<1.1.x> is still in its development
+stage, but it is quite ready for using in production environments.
+There's a small glitch in legend text alignment, and it will
+hopefully be fixed.
+
+=item * libxml2
+
+libxml2 is the XML parser library from Gnome
+project E<lt>http://www.gnome.orgE<gt>,
+available as a standalone package.
+Versions C<2.4.23> and above were tested.
+
+=item * Berkeley DB version 4.2.52 or later
+
+There are two distinct packages with slightly conflicting names:
+The Berkeley DB from Sleepycat Software E<lt>http://www.sleepycat.comE<gt>,
+and C<BerkeleyDB> Perl module available from CPAN. We will always refer
+the latter as I<BerkeleyDB Perl module>.
+
+The Berkeley DB database engine is used for all data storage.
+Versions C<4.2.52> and above are recommended.
+Older versions of Berkeley DB had problems with database integrity
+in concurrent usage. By default, it installs
+into F</usr/local/BerkeleyDB.4.2/>.
+
+Unfortunately, the BerkeleyDB Perl module cannot find the include and
+library files in that directory. Thus either configure Berkeley DB
+with the option C<--prefix=/usr/local>, or you need to edit
+F<config.in> in BerkeleyDB Perl module distribution.
+
+=item * HTTP Server
+
+Torrus requires an HTTP server. It is compatible with the following
+combinations:
+
+=over 8
+
+=item * Apache 1.3 with mod_perl 1.0
+
+=item * Apache 2.x with mod_perl 2.0
+
+=item * lighttpd with FastCGI
+
+=item * Apache with FastCGI
+
+=back
+
+FastCGI is supported in Torrus version 1.0.9 or higher.
+
+B<Note:> Starting from Torrus version 1.0.9, C<libapreq2> is no longer
+required.
+
+See I<Torrus Web Interface Reference> for details on HTTP server configuration.
+
+=item * Perl Modules
+
+The Perl modules required are listed below. They are all available at
+CPAN E<lt>http://www.cpan.orgE<gt>.
+Some of them require other modules to be installed.
+You can install all required modules with the following command,
+executed from within the distribution directory:
+
+  perl -I `pwd`/setup_tools -MCPAN -e 'install Bundle::Torrus'
+
+=over 8
+
+=item * XML::LibXML
+
+This is a Perl interface for libxml2, providing DOM standards compliant
+interface. It is recommended that you use version C<1.54_3> or higher.
+
+=item * BerkeleyDB perl module
+
+Perl interface to the database software.
+Version C<0.19> or higher is required.
+
+=item * Template-Toolkit
+
+This is a powerful set of tools for text template processing.
+Torrus uses it for HTML files output.
+See also the project homepage: E<lt>http://www.template-toolkit.orgE<gt>
+
+=item * Proc::Daemon
+
+Daemon invocation routines.
+
+=item * Net::SNMP
+
+SNMP queries and traps interface. Version C<4.0.3> or higher is required.
+I<Note>: Torrus versions prior to 1.0.9 are incompatible with Net::SNMP
+version 6.0.0. You may need to downgrate the module to 5.2.0.
+
+=item * URI::Escape
+
+Escape and unescape unsafe characters
+
+=item * Apache (mod_perl version 1.0)
+
+Mod_perl is a Perl runtime environment integrated into Apache HTTP server.
+
+=item * Apache::Session
+
+User session tracking helper
+
+=item * Date::Parse and Date::Format
+
+Module for parsing the user input for date and time.
+
+=item * JSON
+
+JSON data format support
+
+=back
+
+
+=item * HTTP Browser requirements
+
+The HTTP browser must be compatible with I<HTML 4.01 Strict> and I<CSS2>
+specifications. The tests were made with the following browsers:
+IE 5.5, Opera 6.12B1/Solaris, Opera 7.03/Win2K, Netscape 7.02.
+
+=back
+
+=head2 Recommended Software
+
+=over 4
+
+=item * C<XML::XUpdate::LibXML> by Petr Pajas
+
+This Perl module implements XUpdate specification
+E<lt>http://www.xmldb.org/xupdate/E<gt>. See Torrus User Guide for details.
+
+=item * XSH by Petr Pajas
+
+Available at E<lt>http://xsh.sourceforge.netE<gt>.
+This is a shell wrapper for a set of utilities for XML extraction, browsing,
+and editing.
+
+=item * libxslt from Gnome project
+
+C<libxslt> is the XSLT stranslation library from Gnome
+project E<lt>http://www.gnome.orgE<gt>, available as a standalone package.
+It includes a binary executable, C<xsltproc>. See Torrus User Guide for
+examples of its usage.
+
+=back
+
+
+
+=head2 Installation Procedure
+
+Create the group C<torrus> and a user C<torrus>. The user should be a member of
+this group.
+
+Add your Apache daemon user to the group C<torrus>.
+Other users that will run any of Torrus processes must be included in
+this group.
+
+For example, in Solaris (you may need to specify the GID and UID numbers
+according to your local administration policy):
+
+  groupadd torrus
+  useradd -c 'Torrus Daemon' -d /usr/local/torrus -g torrus torrus
+  usermod -G www,torrus www
+
+Further installation process is mostly as usual:
+
+  ./configure
+  make
+  make install
+
+The default directory layout is described below. Should you need to change it,
+there is a number of variables and configuration options that you may use
+as C<./configure> arguments. See C<./configure --help> for details.
+Alternatively you can utilize the script C<./setup_tools/configure_fhs>,
+which is designed to provide an FHS compliant setup. The script is equivalent
+to executing
+
+  ./configure \
+   --prefix=/opt \
+   --mandir=/opt/share/man \
+   pkghome=/opt/torrus \
+   sitedir=/etc/opt/torrus
+
+Do not try to change any paths by supplying them as C<make> variables,
+this would most probably break the installation. The only C<make> variable
+that is supported is C<DESTDIR>. It may be used for preparing the package for
+further distribution. For example, the following command would install
+all Torrus files as if F</tmp/stage> were the root of the filesystem:
+
+  make DESTDIR=/tmp/stage install
+
+The presence of prerequisite Perl modules is checked during the execution
+of C<./configure>. You can disable this by giving I<--enable-pkgonly> option.
+
+The installer sets up the site configuration files, but only if
+they don't already exist.
+
+Plugin modules should be installed separately, after the Torrus software is
+successfully installed. For each plugin, unpack the plugin distribution archive
+to some directory, and execute
+
+  torrus install_plugin <UNPACKED_PLUGIN_DIR>
+
+A number of directories is set up by default under the path C</var>,
+and they must be writable by all Torrus processes, including the
+Apache web server.
+
+You can control these directories' access rights by setting the following
+environment variables: I<var_user>, I<var_group>, I<var_mode>, like follows:
+
+  ./configure var_group=wwwrun
+
+Default values for operating systems other than Cygwin are: I<var_user=torrus>,
+I<var_group=torrus>, I<var_mode=775>. Setgid bit is set by default for these
+directories.
+
+If available, you may place these directories on a fast media, for example,
+a robust disk array. Changing the C<varprefix> variable would be generally
+enough, for example:
+
+  ./configure varprefix=/vol1/torrus_var
+
+
+=head2 Torrus directory layout
+
+  @pkghome@/
+        Home directory for Torrus distribution files
+
+  @cfgdefdir@/
+        torrus-config.pl and other configuration files
+
+  @pkgbindir@/
+        Command-line executables
+
+  @docdir@/
+        POD and TXT documentation files
+
+  @exmpdir@/
+        Miscelaneous example files
+
+  @perllibdir@/
+        Perl libraries
+
+  @pluginsdir@/
+        Plugins configuration
+
+  @scriptsdir@/
+        Scripts
+
+  @supdir@/
+        Supplementary files, DTDs, MIBs, color schemas, web plain files
+
+  @tmpldir@/
+        Renderer output templates
+
+  @distxmldir@/
+        Distrubution XML files
+
+  @sitedir@/
+        Site configurable files
+
+  @siteconfdir@/
+        Place for torrus-siteconfig.pl and other siteconfigs
+
+  @siteconfdir@/discovery/
+        Devdiscover input files
+
+  @tmpluserdir@/
+        User-defined Renderer output templates
+
+  @sitexmldir@/
+        User XML configuration files
+
+  @mandir@
+        Place for man pages. All articles have the prefix C<torrus_>
+
+  @logdir@/
+        Daemon logfiles
+
+  @piddir@
+        Daemon PID files
+
+  @cachedir@
+        Renderer cache
+
+  @dbhome@
+        Berkeley DB home
+
+  @seslockdir@
+  @sesstordir@
+        Web interface session files
+
+  @defrrddir@
+        Recommended directory for RRD files generated by collectors
+
+B<Note:> RRFW used the path F</var/snmpcollector> as the default path for
+storing the RRD files. According to FHS specification, the recommended
+path for service data files is recommended to be a subdirectory of F</srv>.
+The path F<@defrrddir@> is used as default by C<torrus genddx>
+utility, and you can always change it in the command line or in your 
+DDX files.
+
+=head2 Configuring Torrus
+
+The datasources are configured with C<%Torrus::Global::treeConfig>
+hash in F<torrus-siteconfig.pl>.
+
+In this hash, the keys give the tree names. The values for each tree name
+are pointers to hashes, with the following keys and values:
+I<xmlfiles> points to an array of source XML file names;
+I<run> points to a hash with the names of the daemons
+that would be automatically launched for the tree;
+I<desription> gives a short line describing the tree contents.
+
+Two additional arrays: C<@Torrus::Global::xmlAlwaysIncludeFirst> and
+C<@Torrus::Global::xmlAlwaysIncludeLast> give a list of source XML
+files that are included in every tree, in the beginning or in the end of
+the XML files list. By default, this array consists of two files:
+F<defaults.xml> and F<site-global.xml>. The second one is resided in
+the user-configurable directory, and you can use it to override any
+default settings. 
+
+Example:
+
+  @Torrus::Global::xmlAlwaysIncludeFirst =
+      ('defaults.xml', 'site-global.xml');
+
+  %Torrus::Global::treeConfig = (
+    'tree_A' => {
+      'description' => 'The First Tree',
+      'xmlfiles' => [qw(a1.xml a2.xml a3.xml)],
+      'run' => { 'collector' => 1, 'monitor' => 1 } },
+    'tree_B' => {
+      'description' => 'The Second Tree',
+      'xmlfiles' => ['b1.xml', 'b2.xml'],
+      'run' => {} }
+   );
+
+XML files are read additively within each tree, in the order
+as they are listed. The XML compiler searches for the files in several
+directories, listed in C<@Torrus::Global::xmlDirs>. By default, this list
+conssists of two paths, one for Torrus distribution files, and the other
+for user files.
+
+Files generated by C<devdiscover> usually contain I<include> statements
+which add the vendor-specific XML files to the compilation.
+
+Below follows a short description of some XML files that come with
+Torrus distribution. Only F<site-global.xml> is installed in the directory 
+for user-configurable files, all others are placed in the distribution
+directory.
+
+=over 4
+
+=item * defaults.xml
+
+Default parameters for the root of the datasources tree.
+Default view definitions. B<Note:> this file is automatically
+overwritten by C<make install>.
+
+=item * site-global.xml
+
+Parameters that you want to change or define for your site.
+This file will be compiled for every tree after F<defaults.xml>,
+and this is the place to override the defaults. The file that is supplied
+with the Torrus distribution has some useful parameters that you may simply
+uncomment.
+B<Note:> this file is never overwritten by C<make install>.
+
+=item * snmp-defs.xml
+
+SNMP collector defaults. The file defines several templates
+used for collecting SNMP data.
+Do not change this file.
+You may redefine the needed parameters in your site-specific files
+and templates.
+
+=item * vendor/E<lt>vendorE<gt>.E<lt>productE<gt>[.E<lt>subsystemE<gt>].xml
+
+SNMP collector definitions and templates for various hardware vendors and
+products. C<devdiscover> includes some of these files automatically in the
+configuration.
+
+=item * generic/*.xml
+
+SNMP collector definitions and templates for vendor-independent MIBs. Most
+files are named after corresponding RFC numbers.
+
+=back
+
+In addition, the distribution package contains several example files.
+
+For more details about XML configuration, see I<Torrus User Guide>
+and I<Torrus XML Configuration Guide>.
+
+=head2 Site configuration options
+
+In addition to I<%Torrus::Global::treeConfig>, you may wish to set
+some other parameters in your site configuration file
+(F<torrus-siteconfig.pl>).
+
+See F<torrus-config.pl> for the complete list
+of varaibes that you may override in your site config. Among them,
+most interesting are:
+
+=over 4
+
+=item * C<$Torrus::Renderer::companyName>
+
+The text that you specify here will appear in the top left corner
+of all HTML pages.
+
+=item * C<$Torrus::Renderer::companyURL>
+
+The company name text will be clickable with the URL specified in
+this variable.
+
+=back
+
+
+=head2 Apache HTTP server configuration
+
+Torrus web interface is designed to run under mod_perl environment
+(E<lt>http://perl.apache.orgE<gt>).
+
+See the I<Torrus Web Interface Reference> document for detailed instructions on
+Apache configuration.
+
+In short, typical Apache configuration for mod_perl version 1.0 would look
+like follows:
+
+  Alias /torrus/plain "@webplaindir@"
+  PerlRequire "@cfgdefdir@/webmux.pl"
+  <Location /torrus>
+    SetHandler perl-script
+    PerlHandler Torrus::ApacheHandler
+  </Location>
+  <Location /torrus/plain/>
+    SetHandler default-handler
+    Options None
+  </Location>
+
+=head2 Access Control Lists
+
+By default, Torrus web interface requires user authentication.
+You can disable this by changing C<$Torrus::CGI::authorizeUsers>
+to zero in your F<torrus-siteconfig.pl>.
+
+ACLs are controlled by C<acledit> utility. See I<Torrus Manual pages>
+for detailed description. Example:
+
+  torrus acledit --addgroup=staff --permit=DisplayTree --for='*'
+  torrus acledit --addgroup=staff --permit=GlobalSearch --for='*'
+  torrus acledit --adduser=jsmith --password=mysecretpassword \
+    --cn="John Smith" --addtogroup=staff
+  torrus acledit --addgroup=admin \
+    --permit=DisplayTree --permit=DisplayAdmInfo --for='*'
+
+=head2 Cron Job
+
+In order to clean old HTTP session data, it is recommended to run
+F<cleanup> script in a cron job, once per day:
+
+ #min hour mday month wday    who     command
+ 5    3    *    *     *       root    @pkgbindir@/cleanup
+
+
+=head2 Startup script
+
+The Torrus distriubution provides a startup script which you can install in
+the init scripts directory (/etc/init.d on most Unixes or /usr/local/etc/rc.d/
+on FreeBSD). The script C<torrus> is created during the installation
+process in the subdirectory <init.d> of the distribution directory.
+
+The init script reads some parameters from F<@cfgdefdir@/initscript.conf>,
+and F<@siteconfdir@/initscript.siteconf> if the latter exists.
+By default, it makes the monitor daemons sleep for 20 minutes when
+they are launched simultaneously with collector daemons.
+
+
+=head2 Upgrade Procedure
+
+Follow these instructions when upgrading from previous Torrus release.
+
+In the previous distribution directory, look up the F<config.log> file.
+It contains the configure options that you used in previous installation.
+
+Unpack the new release distribution.
+
+Run C<./configure> with the same options you used before.
+
+Stop the collector and monitor processes
+(usually by C</etc/init.d/torrus stop>).
+
+Stop Apache process.
+
+Run C<make install>.
+
+Start the collector and monitor processes.
+
+Start Apache process.
+
+Also it is recommended to re-compile your XML configuration.
+If you prefer not to do this, it's recommended that you clear the
+Web interface cache both in your browser and in Torrus:
+
+  torrus clearcache
+
+
+=head2 Planning the disk space
+
+In a typical Torrus setup, there are two disk space consuming entities:
+the RRDtool data storage and the Berkeley DB database.
+
+RRDtool data files (or RRD's) are used to store the values that are gathered
+by the collector daemons. These are the most intensively updated files,
+so the disk speed is important here. If possible, it is better to spread
+the RRD files across several physical disks.
+
+Berkeley DB database is used to keep all the configuratiuon data
+for your datasource trees, and it also keeps some live status information.
+It's intensively updated during XML compilation only.
+During normal Torrus working cycle, there are only few updates, not
+very critical in time. The database is read quite intensively during
+collector initialization, but usually it's the CPU speed that causes
+more delay.
+
+For a typical Torrus installation with standard RRD creation parameters,
+the rough estimation is as follows: the Berkeley DB database occupies
+from 10 to 13 KB per collector datasource, and the RRD storage takes
+approximately 80 to 85 KB per datasource.
+
+For a medium-sized system, few hundred megabytes for the Berkeley DB database
+and several gigabytes for RRD storage would be sufficient. Larger systems
+require a thorough design and staging work. See I<Torrus Scalability Guide>
+for more details.
+
+=head2 Network performance tuning
+
+In large installations, the SNMP collector experiences quite intensive
+input traffic bursts. Thus the UDP socket receive buffers should
+be adapted to sustain the load. By default, Torrus sets the UDP receiving
+buffer size, SO_RCVBUF, to 131071 bytes. This should fit most of
+installations. However, it's useful to check the network statistics
+if there are any UDP buffer overflows. On most systems, the commands
+C<netstat -s -p udp> or C<netstat -s> should show you these counters.
+The maximum buffer size is usually limited by a system kernel variable,
+and can be increased if needed. See C<$Torrus::Collector::SNMP::RxBuffer>
+and its comments in F<torrus-config.pl> for more details.
+
+
+=head1 Author
+
+Copyright (c) 2002-2007 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/Makefile.am b/torrus/doc/manpages/Makefile.am
new file mode 100644 (file)
index 0000000..1f53b87
--- /dev/null
@@ -0,0 +1,134 @@
+
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.am,v 1.1 2010-12-27 00:04:38 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+SUBST = @abs_top_builddir@/setup_tools/substvars.sh
+
+EXTRA_DIST = $(SRCPOD)
+CLEANFILES = $(PODMAN) $(POD_FILES)
+
+SRCPOD = \
+       torrus.pod.in \
+       torrus_acledit.pod.in \
+       torrus_action_notify.pod.in \
+       torrus_action_printemail.pod.in \
+       torrus_action_snmptrap.pod.in \
+       torrus_buildsearchdb.pod.in \
+       torrus_cleanup.pod.in \
+       torrus_clearcache.pod.in \
+       torrus_collector.pod.in \
+       torrus_compilexml.pod.in \
+       torrus_configinfo.pod.in \
+       torrus_configsnapshot.pod.in \
+       torrus_devdiscover.pod.in \
+       torrus_flushmonitors.pod.in \
+       torrus_genddx.pod.in \
+       torrus_genlist.pod.in \
+       torrus_genreport.pod.in \
+       torrus_install_plugin.pod.in \
+       torrus_monitor.pod.in \
+       torrus_nodeid.pod.in \
+       torrus_rrddir2xml.pod.in \
+       torrus_schedulerinfo.pod.in \
+       torrus_snmpfailures.pod.in \
+       torrus_srvderive.pod.in \
+       torrus_ttproclist.pod.in
+
+POD_FILES = \
+       torrus.pod \
+       torrus_acledit.pod \
+       torrus_action_notify.pod \
+       torrus_action_printemail.pod \
+       torrus_action_snmptrap.pod \
+       torrus_buildsearchdb.pod \
+       torrus_cleanup.pod \
+       torrus_clearcache.pod \
+       torrus_collector.pod \
+       torrus_compilexml.pod \
+       torrus_configinfo.pod \
+       torrus_configsnapshot.pod \
+       torrus_devdiscover.pod \
+       torrus_flushmonitors.pod \
+       torrus_genddx.pod \
+       torrus_genlist.pod \
+       torrus_genreport.pod \
+       torrus_install_plugin.pod \
+       torrus_monitor.pod \
+       torrus_nodeid.pod \
+       torrus_rrddir2xml.pod \
+       torrus_schedulerinfo.pod \
+       torrus_snmpfailures.pod \
+       torrus_srvderive.pod \
+       torrus_ttproclist.pod
+
+PODMAN = \
+       torrus.@mansec_usercmd@ \
+       torrus_acledit.@mansec_usercmd@ \
+       torrus_action_notify.@mansec_misc@ \
+       torrus_action_printemail.@mansec_misc@ \
+       torrus_action_snmptrap.@mansec_misc@ \
+       torrus_buildsearchdb.@mansec_usercmd@ \
+       torrus_cleanup.@mansec_usercmd@ \
+       torrus_clearcache.@mansec_usercmd@ \
+       torrus_collector.@mansec_usercmd@ \
+       torrus_compilexml.@mansec_usercmd@ \
+       torrus_configinfo.@mansec_usercmd@ \
+       torrus_configsnapshot.@mansec_usercmd@ \
+       torrus_devdiscover.@mansec_usercmd@ \
+       torrus_flushmonitors.@mansec_usercmd@ \
+       torrus_genddx.@mansec_usercmd@ \
+       torrus_genlist.@mansec_usercmd@ \
+       torrus_genreport.@mansec_usercmd@ \
+       torrus_install_plugin.@mansec_misc@ \
+       torrus_monitor.@mansec_usercmd@ \
+       torrus_nodeid.@mansec_usercmd@ \
+       torrus_rrddir2xml.@mansec_usercmd@ \
+       torrus_schedulerinfo.@mansec_usercmd@ \
+       torrus_snmpfailures.@mansec_usercmd@ \
+       torrus_srvderive.@mansec_usercmd@ \
+       torrus_ttproclist.@mansec_usercmd@
+
+
+
+if POD2MAN_PRESENT
+install-data-local: $(POD_FILES)
+       for f in $(PODMAN); do \
+         base=`echo $$f | sed -e 's/\\.[0-9a-zA-Z]*$$//'`; \
+         ext=`echo $$f | sed -e 's/^.*\\.//'`; \
+         instdir=$(DESTDIR)$(mandir)/man$$ext; \
+         echo BASE=$$base EXT=$$ext INSTDIR=$$instdir; \
+         $(POD2MAN) --section=$$ext \
+            --release="$(PACKAGE_STRING)" --center=torrus \
+             $$base.pod > $$f || exit 1; \
+         test -d $$instdir || $(mkinstalldirs) $$instdir || exit 1; \
+         $(INSTALL_DATA) $$f $$instdir; \
+         rm $$f; \
+       done
+endif
+
+
+SUFFIXES = .pod.in .pod
+
+.PRECIOUS: $(POD_FILES)
+
+.pod.in.pod:
+       $(SUBST) $<  > $@
+
+pods: $(POD_FILES)
diff --git a/torrus/doc/manpages/Makefile.in b/torrus/doc/manpages/Makefile.in
new file mode 100644 (file)
index 0000000..d8cdedf
--- /dev/null
@@ -0,0 +1,445 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.in,v 1.1 2010-12-27 00:04:38 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = doc/manpages
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+FIND = @FIND@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KILL = @KILL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERLINC = @PERLINC@
+POD2MAN = @POD2MAN@
+POD2MAN_PRESENT_FALSE = @POD2MAN_PRESENT_FALSE@
+POD2MAN_PRESENT_TRUE = @POD2MAN_PRESENT_TRUE@
+POD2TEXT = @POD2TEXT@
+POD2TEXT_PRESENT_FALSE = @POD2TEXT_PRESENT_FALSE@
+POD2TEXT_PRESENT_TRUE = @POD2TEXT_PRESENT_TRUE@
+RM = @RM@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SLEEP = @SLEEP@
+STRIP = @STRIP@
+SU = @SU@
+VERSION = @VERSION@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+cachedir = @cachedir@
+cfgdefdir = @cfgdefdir@
+datadir = @datadir@
+dbhome = @dbhome@
+defrrddir = @defrrddir@
+distxmldir = @distxmldir@
+enable_pkgonly = @enable_pkgonly@
+enable_varperm = @enable_varperm@
+exec_prefix = @exec_prefix@
+exmpdir = @exmpdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mansec_misc = @mansec_misc@
+mansec_usercmd = @mansec_usercmd@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+perlithreads = @perlithreads@
+perllibdir = @perllibdir@
+perllibdirs = @perllibdirs@
+piddir = @piddir@
+pkgbindir = @pkgbindir@
+pkgdocdir = @pkgdocdir@
+pkghome = @pkghome@
+plugdevdisccfgdir = @plugdevdisccfgdir@
+pluginsdir = @pluginsdir@
+plugtorruscfgdir = @plugtorruscfgdir@
+plugwrapperdir = @plugwrapperdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+reportsdir = @reportsdir@
+sbindir = @sbindir@
+scriptsdir = @scriptsdir@
+seslockdir = @seslockdir@
+sesstordir = @sesstordir@
+sharedstatedir = @sharedstatedir@
+siteconfdir = @siteconfdir@
+sitedir = @sitedir@
+sitexmldir = @sitexmldir@
+supdir = @supdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+tmpldir = @tmpldir@
+tmpluserdir = @tmpluserdir@
+torrus_user = @torrus_user@
+var_group = @var_group@
+var_mode = @var_mode@
+var_user = @var_user@
+varprefix = @varprefix@
+webplaindir = @webplaindir@
+webscriptsdir = @webscriptsdir@
+wrapperdir = @wrapperdir@
+SUBST = @abs_top_builddir@/setup_tools/substvars.sh
+EXTRA_DIST = $(SRCPOD)
+CLEANFILES = $(PODMAN) $(POD_FILES)
+SRCPOD = \
+       torrus.pod.in \
+       torrus_acledit.pod.in \
+       torrus_action_notify.pod.in \
+       torrus_action_printemail.pod.in \
+       torrus_action_snmptrap.pod.in \
+       torrus_buildsearchdb.pod.in \
+       torrus_cleanup.pod.in \
+       torrus_clearcache.pod.in \
+       torrus_collector.pod.in \
+       torrus_compilexml.pod.in \
+       torrus_configinfo.pod.in \
+       torrus_configsnapshot.pod.in \
+       torrus_devdiscover.pod.in \
+       torrus_flushmonitors.pod.in \
+       torrus_genddx.pod.in \
+       torrus_genlist.pod.in \
+       torrus_genreport.pod.in \
+       torrus_install_plugin.pod.in \
+       torrus_monitor.pod.in \
+       torrus_nodeid.pod.in \
+       torrus_rrddir2xml.pod.in \
+       torrus_schedulerinfo.pod.in \
+       torrus_snmpfailures.pod.in \
+       torrus_srvderive.pod.in \
+       torrus_ttproclist.pod.in
+
+POD_FILES = \
+       torrus.pod \
+       torrus_acledit.pod \
+       torrus_action_notify.pod \
+       torrus_action_printemail.pod \
+       torrus_action_snmptrap.pod \
+       torrus_buildsearchdb.pod \
+       torrus_cleanup.pod \
+       torrus_clearcache.pod \
+       torrus_collector.pod \
+       torrus_compilexml.pod \
+       torrus_configinfo.pod \
+       torrus_configsnapshot.pod \
+       torrus_devdiscover.pod \
+       torrus_flushmonitors.pod \
+       torrus_genddx.pod \
+       torrus_genlist.pod \
+       torrus_genreport.pod \
+       torrus_install_plugin.pod \
+       torrus_monitor.pod \
+       torrus_nodeid.pod \
+       torrus_rrddir2xml.pod \
+       torrus_schedulerinfo.pod \
+       torrus_snmpfailures.pod \
+       torrus_srvderive.pod \
+       torrus_ttproclist.pod
+
+PODMAN = \
+       torrus.@mansec_usercmd@ \
+       torrus_acledit.@mansec_usercmd@ \
+       torrus_action_notify.@mansec_misc@ \
+       torrus_action_printemail.@mansec_misc@ \
+       torrus_action_snmptrap.@mansec_misc@ \
+       torrus_buildsearchdb.@mansec_usercmd@ \
+       torrus_cleanup.@mansec_usercmd@ \
+       torrus_clearcache.@mansec_usercmd@ \
+       torrus_collector.@mansec_usercmd@ \
+       torrus_compilexml.@mansec_usercmd@ \
+       torrus_configinfo.@mansec_usercmd@ \
+       torrus_configsnapshot.@mansec_usercmd@ \
+       torrus_devdiscover.@mansec_usercmd@ \
+       torrus_flushmonitors.@mansec_usercmd@ \
+       torrus_genddx.@mansec_usercmd@ \
+       torrus_genlist.@mansec_usercmd@ \
+       torrus_genreport.@mansec_usercmd@ \
+       torrus_install_plugin.@mansec_misc@ \
+       torrus_monitor.@mansec_usercmd@ \
+       torrus_nodeid.@mansec_usercmd@ \
+       torrus_rrddir2xml.@mansec_usercmd@ \
+       torrus_schedulerinfo.@mansec_usercmd@ \
+       torrus_snmpfailures.@mansec_usercmd@ \
+       torrus_srvderive.@mansec_usercmd@ \
+       torrus_ttproclist.@mansec_usercmd@
+
+SUFFIXES = .pod.in .pod
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .pod.in .pod
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  doc/manpages/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  doc/manpages/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+@POD2MAN_PRESENT_FALSE@install-data-local:
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+       distclean-generic distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am \
+       install-data-local install-exec install-exec-am install-info \
+       install-info-am install-man install-strip installcheck \
+       installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+       pdf-am ps ps-am uninstall uninstall-am uninstall-info-am
+
+
+@POD2MAN_PRESENT_TRUE@install-data-local: $(POD_FILES)
+@POD2MAN_PRESENT_TRUE@ for f in $(PODMAN); do \
+@POD2MAN_PRESENT_TRUE@   base=`echo $$f | sed -e 's/\\.[0-9a-zA-Z]*$$//'`; \
+@POD2MAN_PRESENT_TRUE@   ext=`echo $$f | sed -e 's/^.*\\.//'`; \
+@POD2MAN_PRESENT_TRUE@   instdir=$(DESTDIR)$(mandir)/man$$ext; \
+@POD2MAN_PRESENT_TRUE@   echo BASE=$$base EXT=$$ext INSTDIR=$$instdir; \
+@POD2MAN_PRESENT_TRUE@   $(POD2MAN) --section=$$ext \
+@POD2MAN_PRESENT_TRUE@      --release="$(PACKAGE_STRING)" --center=torrus \
+@POD2MAN_PRESENT_TRUE@             $$base.pod > $$f || exit 1; \
+@POD2MAN_PRESENT_TRUE@   test -d $$instdir || $(mkinstalldirs) $$instdir || exit 1; \
+@POD2MAN_PRESENT_TRUE@   $(INSTALL_DATA) $$f $$instdir; \
+@POD2MAN_PRESENT_TRUE@   rm $$f; \
+@POD2MAN_PRESENT_TRUE@ done
+
+.PRECIOUS: $(POD_FILES)
+
+.pod.in.pod:
+       $(SUBST) $<  > $@
+
+pods: $(POD_FILES)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/torrus/doc/manpages/torrus.pod.in b/torrus/doc/manpages/torrus.pod.in
new file mode 100644 (file)
index 0000000..674b5ae
--- /dev/null
@@ -0,0 +1,98 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus.pod.in,v 1.1 2010-12-27 00:04:37 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+torrus - Commandline wrapper for Torrus utilities
+
+=head1 SYNOPSIS
+
+B<torrus> I<command> [I<options...>]
+
+=head1 DESCRIPTION
+
+All Torrus utilities use this common command-line wrapper, which simply
+passes all arguments to the appropriate utility.
+
+Accepted commands:
+
+=over 4
+
+=item B<acledit>
+
+=item B<cleanup>
+
+=item B<clearcache>
+
+=item B<collector>
+
+=item B<compilexml>
+
+=item B<configinfo>
+
+=item B<configsnapshot>
+
+=item B<devdiscover>
+
+=item B<genddx>
+
+=item B<genlist>
+
+=item B<install_plugin>
+
+=item B<monitor>
+
+=item B<rrddir2xml>
+
+=item B<schedulerinfo>
+
+=item B<srvderive>
+
+=back
+
+=head1 OPTIONS
+
+Refer to approproate manpages for options for each Torrus command.
+
+=head1 SEE ALSO
+
+L<torrus_acledit(@mansec_usercmd@)>,
+L<torrus_action_printemail(@mansec_misc@)>,
+L<torrus_action_snmptrap(@mansec_misc@)>,
+L<torrus_clearcache(@mansec_usercmd@)>,
+L<torrus_collector(@mansec_usercmd@)>,
+L<torrus_compilexml(@mansec_usercmd@)>,
+L<torrus_configinfo(@mansec_usercmd@)>,
+L<torrus_configsnapshot(@mansec_usercmd@)>,
+L<torrus_devdiscover(@mansec_usercmd@)>,
+L<torrus_genddx(@mansec_usercmd@)>,
+L<torrus_monitor(@mansec_usercmd@)>,
+L<torrus_rrddir2xml(@mansec_usercmd@)>,
+L<torrus_schedulerinfo(@mansec_usercmd@)>
+L<torrus_srvderive(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_acledit.pod.in b/torrus/doc/manpages/torrus_acledit.pod.in
new file mode 100644 (file)
index 0000000..eab10ac
--- /dev/null
@@ -0,0 +1,212 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_acledit.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+acledit - Manage Torrus access control lists (ACLs).
+
+=head1 SYNOPSIS
+
+B<torrus acledit> [I<options...>]
+
+=head1 DESCRIPTION
+
+This command manages the Torrus access control lists. Each user is
+identified by user ID, and has a set of attributes. Currently
+supported attributes are C<cn> (common name) and C<userPasswordMD5>
+(MD5 digest of the user's password).
+
+Each user belongs to one or several groups. Each group has its own
+set of privileges. A privilege is identified by privilege name and
+object name. Currently only one privilege name is supported:
+C<DisplayTree>, and the object name is the name of the tree that
+this group is allowed to browse.
+
+User authorization in the web interface is controlled by the
+C<$Torrus::CGI::authorizeUsers> variable in F<torrus-siteconfig.pl>.
+
+=head1 GROUP MANAGEMENT OPTIONS
+
+=over 4
+
+=item B<--addgroup>=I<GROUP>
+
+Creates a new group with the given name.
+
+=item B<--delgroup>=I<GROUP>
+
+Deletes the group with the given name.
+
+=item B<--modgroup>=I<GROUP>
+
+Modifies the given group.
+
+=item B<--permit>=I<PRIVILEGE>
+
+Grants privilege to group(s). Currently supported privileges are:
+C<DisplayTree> for displaying a datasource tree, and C<DisplayAdmInfo>
+for displaying the administrative information (all significant
+parameters for a given datasource leaf).
+
+=item B<--deny>=I<PRIVILEGE>
+
+Revokes group(s) privilege.
+
+=item B<--for>=I<OBJECT>
+
+Object for which privileges are granted or revoked. Currently it must be
+the name of the tree for which the C<DisplayTree> and  C<DisplayAdmInfo>
+privilegs are granted or revoked. The asterisk (*) instead of the object
+name assigns the privilege for all objects.
+
+=back
+
+
+=head1 USER MANAGEMENT OPTIONS
+
+=over 4
+
+=item B<--adduser>=I<UID>
+
+Creates a new user with the given user ID.
+
+=item B<--addhost>=I<HOST>
+
+Creates a new user for host-based authentication. I<HOST> should be an
+IPv4 or IPv6 address of the HTTP client. The new username is the address
+with all non-alphanumeric characters replaced with underscores.
+Host password is changed by <--hostpassword> option.
+
+=item B<--deluser>=I<UID>
+
+Deletes user with the given user ID.
+
+=item B<--moduser>=I<UID>
+
+Modifies the user attributes for the given user ID.
+
+=item B<--addtogroup>=I<GROUP>
+
+Adds user to the given group.
+
+=item B<--delfromgroup>=I<GROUP>
+
+Deletes user from the given group.
+
+=item B<--password>=I<PASSWORD>
+
+Sets user's password.
+
+=item B<--hostpassword>=I<PASSWORD>
+
+Sets the password for host-based authentication. The HTTP client should
+add C<hostauth> parameter with the password as a value.
+
+=item B<--cn>=I<NAME>
+
+Sets user's common name.
+
+=item B<--showuser>=I<UID>
+
+Displays information for a given user.
+
+=back
+
+
+=head1 GENERAL OPTIONS
+
+=over 4
+
+=item B<--export>=I<FILE>
+
+Exports ACL configuration to a given file.
+
+=item B<--template>=I<FILE>
+
+Uses the given template file when exporting. Default value is F<aclexport.xml>.
+
+=item B<--import>=I<FILE>
+
+Imports ACL configuration from the given file.
+
+=item B<--clear>
+
+Deletes all user and privileges configuration.
+
+=item B<--list>
+
+Lists all users and groups they belong to.
+
+=item B<--debug>
+
+Sets the log level to debug.
+
+=item B<--verbose>
+
+Sets the log level to info.
+
+=item B<--help>
+
+Displays a help message.
+
+=back
+
+
+=head1 EXAMPLES
+
+  torrus acledit --addgroup=staff --permit=DisplayTree \
+    --for=main --for=thecustomer
+  torrus acledit --adduser=jsmith --password=mysecretpassword \
+    --cn="John Smith" --addtogroup=staff
+  torrus acledit --addgroup=admin --permit=DisplayTree --for='*'
+
+This example creates a group I<staff> and gives all its members the permission
+to browse the datasource trees I<main> and I<thecustomer>. The next command
+creates a user I<jsmith> and addts it to this group. The user name will
+be displayed as I<John Smith>, and it will be let in with the given
+password. The third command creates a group I<admin> which is allowed
+o browse all existing trees.
+
+=head1 FILES
+
+=over 4
+
+=item F<@siteconfdir@/torrus-siteconfig.pl>
+
+Torrus site configuration script.
+
+=item F<@tmpldir@/aclexport.xml>
+
+Default template for the exports of ACL configuration.
+
+=back
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_action_notify.pod.in b/torrus/doc/manpages/torrus_action_notify.pod.in
new file mode 100644 (file)
index 0000000..386c3d9
--- /dev/null
@@ -0,0 +1,100 @@
+#  Copyright (C) 2006  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_action_notify.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+action_notify - Generic notification handler for Torrus monitor
+
+=head1 SYNOPSIS
+
+ <action name="notify">
+   <param name="action-type" value="exec" />
+   <param name="command">
+     $TORRUS_BIN/action_notify
+   </param>
+   <param name="launch-when" value="set" />
+ </action>
+
+=head1 DESCRIPTION
+
+This program is designed for usage from a monitor action only. It takes
+the arguments from environment variables, as described in action-type
+C<exec> in B<Torrus XML Configuration Guide>. 
+
+The handler reads its configuration from <notify-siteconfig.pl>, a small
+Perl file which defines the notification paths for various conditions.
+
+Example:
+
+  %Torrus::Notify::programs =
+    (
+     'mailto' => '$TORRUS_BIN/action_printemail | /usr/bin/mail $ARG1',
+     'page' => '/usr/bin/echo $TORRUS_NODEPATH:$TORRUS_MONITOR ' .
+     '>> /tmp/monitor.$ARG1.log'
+     );
+
+  %Torrus::Notify::policies =
+    (
+     'CUST_A' => {
+         'match' => sub { $ENV{'TORRUS_P_notify_policy'} eq 'A' },
+         'severity' => {
+             '3' => [ 'mailto:aaa@domain.com',
+                      'mailto:bbb@domain.com' ],
+             '5' => [ 'page:1234', 'mailto:boss@domain.com' ] } } );
+     
+
+In this example, we define two message handlers: e-mail sender and
+a dummy replacement for a pager program. Then we define the notification
+policies. For the customer I<A>, we define the policy so that
+the parameter C<notify-policy> should match the name C<A>. The parameter
+is defined in the datasource tree and marks only those leaves
+that belong to this customer.
+Then, depending on the monitor severity, different notification
+paths are defined. For severity values higher or equal 3, aaa@domain.com and
+bbb@domain.com will receive the email notifications, and for severity
+higher than or equal 5 all recipients will receive the notification.
+
+The C<match> argument is a Perl subroutine, and can depend on various
+parameters, such as time of day or day of the week, the tree name, and so on.
+
+
+=head1 FILES
+
+=over 4
+
+=item F<@siteconfdir@/notify-siteconfig.pl>
+
+Notification policies configuration
+
+
+=back
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_action_printemail.pod.in b/torrus/doc/manpages/torrus_action_printemail.pod.in
new file mode 100644 (file)
index 0000000..e63b94e
--- /dev/null
@@ -0,0 +1,101 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_action_printemail.pod.in,v 1.1 2010-12-27 00:04:38 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+action_printemail - A script for sending email from monitor action.
+
+=head1 SYNOPSIS
+
+ <action name="report-email">
+   <param name="action-type" value="exec" />
+   <param name="command">
+     $TORRUS_BIN/action_printemail | mail alarms@example.com
+   </param>
+   <param name="launch-when" value="set, clear" />
+ </action>
+
+=head1 DESCRIPTION
+
+This program is designed for usage from a monitor action only. It takes
+the arguments from environment variables, as described in action-type
+C<exec> in B<Torrus XML Configuration Guide>. In addition, some values
+may be supplied via command-line arguments (see section OPTIONS below).
+
+Site-specific variables must be specified in the file F<email-siteconfig.pl>. 
+Default values are installed by the first run of C<make install>. Subsequent 
+runs of C<make install> do not override this file.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--url>=I<GRAPHER-URL>
+
+Sets the URL of the grapher CGI script.
+
+=item B<--template>=I<TEMPLATE-FILE>
+
+Uses given file as a template. The template file must reside in @tmpldir@ 
+directory. It must be a Template-toolkit file, with the following variables 
+defined:
+
+ tree       Tree name
+ token      Leaf token
+ path       Leaf path
+ url        URL for browsing this leaf
+ ncomment   This leaf comment
+ npcomment  Leaf's parent comment
+ event      Event type
+ monitor    Monitor name
+ mcomment   Monitor comment
+ timestamp  Time and date of the event
+ env(VAR)   Environment variable VAR
+
+=back
+
+=head1 FILES
+
+=over 4
+
+=item F<@siteconfdir@/email-siteconfig.pl>
+
+Torrus site email configuration script.
+
+=item F<@tmpldir@>
+
+=item F<@tmpluserdir@>
+
+Torrus template directories.
+
+=back
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_action_snmptrap.pod.in b/torrus/doc/manpages/torrus_action_snmptrap.pod.in
new file mode 100644 (file)
index 0000000..409a910
--- /dev/null
@@ -0,0 +1,97 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_action_snmptrap.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+action_snmptrap, action_snmpv1trap - Scripts for sending 
+SNMP traps (version 2c and 1 respectively) from monitor action. 
+C<action_snmpv1trap> is obsolete as the preferred SNMP version is 2c.
+
+=head1 SYNOPSIS
+
+ <action name="snmptrap">
+   <param name="action-type" value="exec" />
+   <param name="command" value="$TORRUS_BIN/action_snmptrap" />
+   <param name="launch-when" value="set, clear" />
+ </action>
+
+=head1 DESCRIPTION
+
+This program is designed for usage from a monitor action only. It takes
+the arguments from environment variables, as described in action-type
+C<exec> in B<Torrus XML Configuration Guide>. In addition, some values
+may be supplied via command-line arguments (see section OPTIONS below).
+
+Site-specific variables must be specified in the file
+F<snmptrap-siteconfig.pl>. Default values are installed by the first run
+of C<make install>. Subsequent 
+runs of C<make install> do not override this file.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--host>=I<HOSTNAME>
+
+Sets the hostname of the destination host.
+
+=item B<--community>=I<COMMUNITY>
+
+Sets the community string to use when sending the trap.
+
+=item B<--port>=I<PORT>
+
+Sets the destination UDP port.
+
+=item B<--enterprise>=I<OID>
+
+Sets the C<enterprise> field of the SNMPv1 trap to a given OID (see
+RFC 1157 for more details). This option is only available for
+C<action_snmpv1trap> and will be ignored for C<action_snmptrap>.
+
+=item B<--severity>=I<SEVERITY>
+
+Sets the optional severity SNMP variable to some integer value.
+
+=back
+
+=head1 FILES
+
+=over 4
+
+=item F<@siteconfdir@/snmptrap-siteconfig.pl>
+
+Torrus site configuration script for SNMP traps.
+
+=back
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_buildsearchdb.pod.in b/torrus/doc/manpages/torrus_buildsearchdb.pod.in
new file mode 100644 (file)
index 0000000..a4984e6
--- /dev/null
@@ -0,0 +1,79 @@
+#  Copyright (C) 2007  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_buildsearchdb.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+buildsearchdb - Build the search database
+
+=head1 SYNOPSIS
+
+B<torrus buildsearchdb> I<options...>
+
+=head1 DESCRIPTION
+
+This command indexes the Torrus configuration objects and builds the
+search index database. One of the three options B<--tree>, B<--all> or
+B<--global> is required.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--tree>=I<TREE>
+
+Build the indexes for a given tree.
+
+=item B<--all>
+
+Builds the tree indexes for all trees.
+
+=item B<--global>
+
+Builds the global index for all trees and also the tree indexes for every
+tree. In order to use the global search database, the web user
+should have the permission to display all trees and also it should have
+the permission for GlobalSearch for all trees, for example:
+
+   torrus acledit --addgroup=staff --permit=GlobalSearch --for='*'
+
+
+=item B<--verbose>
+
+Prints extra information
+
+=item B<--help>
+
+Displays a help message.
+
+=back
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
+
diff --git a/torrus/doc/manpages/torrus_cleanup.pod.in b/torrus/doc/manpages/torrus_cleanup.pod.in
new file mode 100644 (file)
index 0000000..d01b3e8
--- /dev/null
@@ -0,0 +1,60 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_cleanup.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+cleanup - Cleans up Torrus web session data.
+
+=head1 SYNOPSIS
+
+B<torrus cleanup>
+
+=head1 DESCRIPTION
+
+This command cleans out the expired (older than 2 days) Torrus web interface
+session data.
+
+=head1 FILES
+
+=over 4
+
+=item F<@sesstordir@>
+
+Torrus session data storage directory.
+
+=item F<@seslockdir@>
+
+Torrus session data lock directory.
+
+=back
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
+
diff --git a/torrus/doc/manpages/torrus_clearcache.pod.in b/torrus/doc/manpages/torrus_clearcache.pod.in
new file mode 100644 (file)
index 0000000..a9c5a5b
--- /dev/null
@@ -0,0 +1,47 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_clearcache.pod.in,v 1.1 2010-12-27 00:04:38 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+clearcache - Clears the Torrus Renderer's cache.
+
+=head1 SYNOPSIS
+
+B<torrus clearcache>
+
+=head1 DESCRIPTION
+
+This program clears Torrus Renderer's cache. It is intended for debugging
+purposes only.
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
+
diff --git a/torrus/doc/manpages/torrus_collector.pod.in b/torrus/doc/manpages/torrus_collector.pod.in
new file mode 100644 (file)
index 0000000..071b308
--- /dev/null
@@ -0,0 +1,129 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_collector.pod.in,v 1.1 2010-12-27 00:04:38 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+collector - Torrus data Collector.
+
+=head1 SYNOPSIS
+
+B<torrus collector> --tree=I<TREENAME> [I<options...>]
+
+=head1 DESCRIPTION
+
+This command starts the Collector process for the tree I<TREENAME>. By
+default it forks into a daemon, sets the log output file to
+F<@logdir@/collector.TREENAME.log>, performs one
+Collector cycle, and sleeps until the next cycle is scheduled. In
+daemon mode the log file can be reopened by sending it a SIGHUP
+signal.
+
+Collector cycle scheduling is controlled by two parameters defined
+for each individual configuration leaf: C<collector-period> and
+C<collector-timeoffset>. See the B<Torrus Configuration Guide> for more
+details.
+
+The number of OID (Object IDentifier) variable bindings sent by 
+Collector is controlled by the datasource parameter C<snmp-oids-per-pdu>.
+It is set to a default value of 40 in F<snmp-defs.xml>, and may be
+overwritten at the host level.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--instance>=I<N>
+
+Defines the collector instance. A single tree can allow more than one
+collector instance. The number of instances is defined in C<run> hash
+in the F<torrus-siteconfig.pl>'s C<%Torrus::Global::treeConfig>.
+If the number of instances is more than one, this option is mandatory.
+The collecting job is split between the instances, and normally all
+instances should be started by the startup scripts. The tree should
+be re-compiled after the number of instances is changed in the siteconfig.
+In the example below the tree I<tree_A> will be served by three
+collector instances:
+
+  %Torrus::Global::treeConfig = (
+    'tree_A' => {
+      'description' => 'The First Tree',
+      'xmlfiles' => [qw(a1.xml a2.xml a3.xml)],
+      'run' => { 'collector' => 3, 'monitor' => 1 } },
+   );
+
+=item B<--nodaemon>
+
+Prevents the process from becoming a daemon and sets the log to STDERR.
+
+=item B<--runonce>
+
+Instructs the collector to run once and exit. Implies B<--nodaemon>.
+
+=item B<--runalways>
+
+Instructs the collector process to continue running even if no collector
+datasources are defined in the tree. In this case, the process will check
+once per hour if the configuration has changed.
+
+=item B<--debug>
+
+Sets the log level to debug.
+
+=item B<--verbose>
+
+Sets the debug level to info.
+
+=item B<--help>
+
+Displays a help message.
+
+=back
+
+=head1 FILES
+
+=over 4
+
+=item F<@siteconfdir@/torrus-siteconfig.pl>
+
+Torrus site configuration script.
+
+=item F<@logdir@/collector.TREENAME.log>
+
+Collector's log for the tree I<TREENAME>.
+
+=item F<@distxmldir@/snmp-defs.xml>
+
+Basic variable definitions for the SNMP collector.
+
+=back
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_compilexml.pod.in b/torrus/doc/manpages/torrus_compilexml.pod.in
new file mode 100644 (file)
index 0000000..281e1fb
--- /dev/null
@@ -0,0 +1,91 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_compilexml.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+compilexml - Torrus XML configuration (re)compiler.
+
+=head1 SYNOPSIS
+
+B<torrus compilexml> --tree=I<TREENAME> [I<options...>]
+
+=head1 DESCRIPTION
+
+This command compiles the Torrus's XML configuration for the tree
+I<TREENAME>. It does not require any other processes to be restarted
+after the configuration is changed. Renderer's cache is automatically
+flushed on on the next Renderer's run. Monitor automatically resets on
+the next monitoring cycle. All dynamic tokensets in the given tree are
+emptied.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--all>
+
+Instructs to compile configuration for all trees.
+
+=item B<--nods>
+
+Instructs to compile non-datasource configuration only.
+
+=item B<--noval>
+
+Disables all validation of the XML configuration. This speeds up the
+compilation up to 2 times, while adding a risk to end up with an
+unusable configuration. In addition, the first initialization cycle of
+Collector and Monitor in this case would be much longer.
+
+=item B<--force>
+
+Normally the compiler would fail to start if another compiler process
+is already running for the specific tree. In case of abnormal function,
+the running status of the previous pcompiler may stay in the database.
+This option forces the compiler to continue even if if sees the presence
+of another process.
+
+=item B<--debug>
+
+Sets the log level to debug.
+
+=item B<--verbose>
+
+Sets the debug level to info.
+
+=item B<--help>
+
+Displays a help message.
+
+=back
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_configinfo.pod.in b/torrus/doc/manpages/torrus_configinfo.pod.in
new file mode 100644 (file)
index 0000000..7c561e3
--- /dev/null
@@ -0,0 +1,46 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_configinfo.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+configinfo - Displays useful statistics for all Torrus trees.
+
+=head1 SYNOPSIS
+
+B<torrus configinfo>
+
+=head1 DESCRIPTION
+
+This command displays information on all available Torrus trees, including 
+the names of the trees, counts of leaves, subtrees, views, monitors and
+actions, and other information.
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_configsnapshot.pod.in b/torrus/doc/manpages/torrus_configsnapshot.pod.in
new file mode 100644 (file)
index 0000000..2723149
--- /dev/null
@@ -0,0 +1,144 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_configsnapshot.pod.in,v 1.1 2010-12-27 00:04:37 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+configsnapshot - Generates a configuration snapshot for a Torrus tree.
+
+=head1 SYNOPSIS
+
+B<torrus configsnapshot> --tree=I<TREENAME> [I<options...>]
+
+=head1 DESCRIPTION
+
+This command generates a configuration snapshot from current
+datasources for tree I<TREENAME>. The output is an XML file, ready for
+compilation, representing all datasources, monitors and tokensets of a
+given tree. The snapshot does not include view definitions. Templates
+and file patterns are expanded inside the file. It does not require
+any other XML configuration files, except for F<defaults.xml> and your
+custom view definitions.
+
+B<Warning:> C<configsnapshot> from RRFW release 0.1.5 will not work
+correctly with databases from previous releases. Use RRFW release
+C<0.1.4bf2> instead.  C<configsnapshot> utility from RRFW release 0.1.4bf2
+does not preserve aliases.
+
+This utility is useful in Torrus upgrade process. In case when RRD files
+structure is changing in Torrus default templates, and user(s) demand to
+preserve the historical data, the following steps could be done:
+
+=over 4
+
+=item *
+
+Stop the collector and monitor processes.
+
+=item *
+
+Install newest Torrus software and do not run C<compilexml> immediately.
+
+=item *
+
+Create snapshots of the trees that you want to preserve for historical reasons:
+
+  torrus configsnapshot --tree=myrouters \
+    --out=@sitexmldir@/myrouters-snapshot.xml
+
+=item *
+
+If needed, move the existing RRD files into different directory. Then
+change the C<data-dir> parameters in the snapshot XML accordingly.
+
+=item *
+
+Create a new tree with only the snapshot file in it. Compile the tree.
+
+=item *
+
+At this stage, it is up to the user to decide wether to continue running the
+collector and monitor daemons for this new tree. The old data may be preserved
+for historical reference, and collector may be run with the newest tree
+structure and definitions.
+
+=back
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--tree>=I<TREE>
+
+Mandatory parameter specifying the tree name.
+
+=item B<--out>=I<FILE>
+
+Sets the output file to I<FILE>. Default is F<snapshot.xml>.
+
+=item B<--param>=I<PARAM>  B<--value>=I<VALUE>
+
+Sets the filter on datasource leaves that have to be included in the snapshot.
+I<PARAM> specifies the name of the datasource parameter, and I<VALUE>
+sets the matching value. By default the numeric comparison is performed.
+
+=item B<--op>=I<OPERATOR>
+
+Sets the fiter comparison operator. Accepted values: B<=> (numeric),
+B<eq> (text string comparison), and B<re> (regular expression match). Default
+is numeric comparison.
+
+
+=item B<--verbose>
+
+Displays some extra information.
+
+=item B<--help>
+
+Displays a help message.
+
+=back 
+
+=head1 FILES
+
+=over 4
+
+=item F<@distxmldir@/defaults.xml>
+
+XML configuration file with default settings for the datasources and
+tokensets, as well as default view definitions.
+
+=item F<snapshot.xml>
+
+Default B<configsnapshot> output file.
+
+=back
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>, L<torrus_compilexml(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_devdiscover.pod.in b/torrus/doc/manpages/torrus_devdiscover.pod.in
new file mode 100644 (file)
index 0000000..4526942
--- /dev/null
@@ -0,0 +1,114 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_devdiscover.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+devdiscover - Performs SNMP discovery and generates Torrus XML
+configuration file.
+
+=head1 SYNOPSIS
+
+B<torrus devdiscover> [--in=I<XMLFILE>] [I<options...>] [I<XMLFILES>]
+
+=head1 DESCRIPTION
+
+B<devdiscover> performs SNMP discovery using the I<XMLFILE>
+for the discovery instructions. It generates a corresponding
+Torrus XML configuration file. See B<Torrus SNMP Discovery User Guide> for
+details.
+
+The generic input file, or device discovery XML (DDX), may be generated 
+by the B<genddx> utility, and then edited and maintained manually.
+Multiple input files may be specified by several instances of I<--in>
+option, or simply as arguments.
+
+Input file name is searched in the current directory, and then in
+F<@sitedir@/discovery/>.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--mkdir>
+
+Creates C<data-dir> directories.
+
+=item B<--limit>=I<REGEXP>
+
+Limits the discovery to the output files matching the regular expression
+I<REGEXP>.
+
+=item B<--forcebundle>
+
+With this option enabled, C<devdiscover> will write the bundle
+file even if some of the bundle members were not created because of errors.
+
+=item B<--fallback>=I<INTEGER>
+
+Requires B<--forcebundle>. In case if an SNMP device is not available,
+the bundle file will include an older version of the XML output file,
+provided that it exists and it is not older than the specified number of days.
+
+=item B<--threads>=I<INTEGER>
+
+If the threads are enabled in the local Perl, this option determins
+how many parallel discovery threads are to be executed.
+The discovery jobs are distributed per output files, thus it makes
+sence to use threads only when there are many output files defined in
+a single DDX file.
+
+
+=item B<--verbose>
+
+Prints extra information.
+
+=item B<--debug>
+
+Prints debugging information.
+
+=item B<--snmpdebug>
+
+Prints SNMP protocol details
+
+=back
+
+=head1 FILES
+
+=over 4
+
+=item F<@siteconfdir@/devdiscover-siteconfig.pl>
+
+B<devdiscover> site configuration file.
+
+=back
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>, L<torrus_genddx>(@mansec_usercmd@)
+
+=head1 NOTES
+
+See I<Torrus SNMP Discovery User Guide> for more details at Torrus home
+page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_flushmonitors.pod.in b/torrus/doc/manpages/torrus_flushmonitors.pod.in
new file mode 100644 (file)
index 0000000..eec9a5f
--- /dev/null
@@ -0,0 +1,68 @@
+#  Copyright (C) 2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_flushmonitors.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+flushmonitors - Flush monitor alarms and tokenset members
+
+=head1 SYNOPSIS
+
+B<torrus flushmonitors> --tree=I<TREENAME> [I<options...>]
+
+=head1 DESCRIPTION
+
+This command flushes the state of all monitor alarms for a given tree,
+and also the tokenset members which were originated by the monitor alarms.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--all>
+
+Instructs to flush all trees.
+
+=item B<--debug>
+
+Sets the log level to debug.
+
+=item B<--verbose>
+
+Sets the debug level to info.
+
+=item B<--help>
+
+Displays a help message.
+
+=back
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_genddx.pod.in b/torrus/doc/manpages/torrus_genddx.pod.in
new file mode 100644 (file)
index 0000000..8fff69e
--- /dev/null
@@ -0,0 +1,136 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_genddx.pod.in,v 1.1 2010-12-27 00:04:38 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+genddx - Generates SNMP discovery instructions file for 
+B<devdiscover>
+
+=head1 SYNOPSIS
+
+B<torrus genddx> --host=I<HOSTNAME> | --hostfile=I<HOSTFILENAME> \
+[I<options...>]
+
+=head1 DESCRIPTION
+
+B<genddx> generates the SNMP discovery instructions file, which may
+be later used as input for the B<devdiscover> utility to produce the 
+corresponding Torrus XML configuration file. The hostname(s) of router(s) to
+be included in SNMP discovery must be specified either using the 
+B<--host> (for a single router) or B<--hostfile> option.  In the latter
+case the file I<HOSTFILENAME> must contain a space-separated list of router 
+hostnames. Hostnames may have the form C<host:devname> where C<devname> is
+a symbolic device name.
+
+This utility is designed to be used only once, in order to generate
+the discovery XML canvas, for futher manual editing. It generates only
+basic set of parameters, and there are much more of those that you may
+use to customize the discovery process.
+
+See L<torrus_ttproclist(@mansec_usercmd@)> for a more flexible and
+complex DDX generator.
+
+More information is available in B<Torrus SNMP Discovery User Guide>.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--out>=I<OUTFILENAME>
+
+Sets the output file to I<OUTFILENAME>. Default is F<routers.ddx>. Without
+absolute path, the file will be placed in F<@sitedir@/discovery>.
+
+=item B<--discout>=I<FILENAME>
+
+Sets the discovery output file to I<FILENAME>. This will be the filename of
+the Torrus XML configuration file once the output file of the B<genddx>
+is processed by the B<devdiscover> utility. Default value is
+F<routers.xml>. Without absolute path, the file would be resided in
+F<@sitexmldir@>.
+
+=item B<--domain>=I<DOMAIN>
+
+Sets the DNS domain name to I<DOMAIN>.
+
+=item B<--version>=I<SNMPVERSION>
+
+Sets discovery SNMP version to SNMPVERSION. Default value is C<2c>.
+
+=item B<--community>=I<COMMUNITY>
+
+Sets discovery SNMP read community value to string I<COMMUNITY>. Default 
+is C<public>.
+
+=item B<--port>=I<PORT>
+
+Sets SNMP port to I<PORT>. Default is 161.
+
+=item B<--retries>=I<NUMRETRIES>
+
+Sets number of retries to I<NUMRETRIES>. Default value is 2.
+
+=item B<--timeout>=I<TIMEOUT>
+
+Sets SNMP timeout to I<TIMEOUT> seconds. Default value is 10.
+
+=item B<--subtree>=I<SUBTREE>
+
+Sets the subtree name to I<SUBTREE>. Default is C</Routers>.
+
+=item B<--datadir>=I<DATADIR>
+
+Sets the path of the directory where SNMP data is collected to I<DATADIR>.
+Default value is F<@defrrddir@>.
+
+=item B<--holtwinters>
+
+Enables Holt-Winters analysis.
+
+=back
+
+=head1 FILES
+
+=over 4
+
+=item F<@sitedir@/discovery/routers.ddx>
+
+Default output file of genddx.
+
+=item F<@sitexmldir@/routers.xml>
+
+Default Torrus XML configuration file which will be written once the 
+genddx output file is processed with devdiscover utility. 
+
+=back
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>, L<torrus_devdiscover(@mansec_usercmd@)>,
+L<torrus_ttproclist(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_genlist.pod.in b/torrus/doc/manpages/torrus_genlist.pod.in
new file mode 100644 (file)
index 0000000..a3e112c
--- /dev/null
@@ -0,0 +1,71 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_genlist.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+genlist - Lists Torrus objects
+
+=head1 SYNOPSIS
+
+B<torrus genlist> --tree=I<TREENAME> [I<options...>]
+
+=head1 DESCRIPTION
+
+This command generates a listing of objects in Torrus
+configuration tree I<TREENAME>. Currently it lists the RRD files only.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--path>=I<PATH>
+
+Sets the subtree path to I<PATH>. Default values is "/".
+
+=item B<--what>=I<ITEMS>
+
+Includes items I<ITEMS> in the listing. Currently only "rrdfiles" is
+a supported item.
+
+=item B<--type>=I<TYPE>
+
+Sets selection type. Currently supported values are "collector" (Collector
+leaves), "readonly" (read-only leaves) and "all" (this also happens to be
+default value).
+
+=item B<--help>
+
+Displays a help message.
+
+=back
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
+
diff --git a/torrus/doc/manpages/torrus_genreport.pod.in b/torrus/doc/manpages/torrus_genreport.pod.in
new file mode 100644 (file)
index 0000000..8b77671
--- /dev/null
@@ -0,0 +1,93 @@
+#  Copyright (C) 2007  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_genreport.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+genreport - Generate the Usage Report
+
+=head1 SYNOPSIS
+
+B<torrus genreport> --report=I<ReportName> --date=I<YYYY-MM-DD> [I<options...>]
+B<torrus genreport> --genhtml [I<options...>]
+
+
+=head1 DESCRIPTION
+
+When the Torrus Reporting engine is set up, this command is used
+to generate the reports from the collected data.
+See I<Torrus Reporting Setup Guide> for more information.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--report>=I<ReportName>
+
+The name of the report that is to be generated. Currently supported:
+C<MonthlyUsage>.
+
+=item B<--date>=I<YYYY-MM-DD>
+
+Specifies the start date of the reported period. For the monthly report,
+this should be any day within the calendar month.
+
+=item B<--time>=I<hh:mm>
+
+Specifies the start time of the reported period. This option
+is ignored for the monthly reports.
+
+=item B<--genhtml>
+
+Instructs the report engine to build the HTML output from the generated
+reports.
+
+=item B<--tree=TREE>
+
+When used with C<--genhtml>, generates the HTML reports only for
+the specified tree.
+
+=item B<--all2tree=TREE>
+
+When used with C<--genhtml>, generates the HTML reports only for
+all available service IDs in the specified tree.
+
+=item B<--verbose>
+
+Prints extra informatgion.
+
+=item B<--debug>
+
+Prints debugging information.
+
+=back
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
+
diff --git a/torrus/doc/manpages/torrus_install_plugin.pod.in b/torrus/doc/manpages/torrus_install_plugin.pod.in
new file mode 100644 (file)
index 0000000..3aeb083
--- /dev/null
@@ -0,0 +1,51 @@
+#  Copyright (C) 2007  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_install_plugin.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+install_plugin - Installs the Torrus plugin
+
+=head1 SYNOPSIS
+
+B<torrus install_plugin> I<DIRECTORY>
+
+=head1 DESCRIPTION
+
+This command installs a Torrus plugin. Prior to executing this command,
+unpack the plugin package into some directory, and then point
+C<install_plugin> to the path of the unpacked plugin distribution.
+
+The command would launch the C<./configure> script for the plugin
+and supply all options that specify the current Torrus installation paths.
+Then it would execute C<make> and C<make install>.
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
+
diff --git a/torrus/doc/manpages/torrus_monitor.pod.in b/torrus/doc/manpages/torrus_monitor.pod.in
new file mode 100644 (file)
index 0000000..dabfc01
--- /dev/null
@@ -0,0 +1,96 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_monitor.pod.in,v 1.1 2010-12-27 00:04:38 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+monitor - Torrus Monitor.
+
+=head1 SYNOPSIS
+
+B<torrus monitor> --tree=I<TREENAME> [I<options...>]
+
+=head1 DESCRIPTION
+
+This command starts the Monitor process for the tree I<TREENAME>. By
+default it forks into a daemon, sets the log output file to
+F<@logdir@/monitor.TREENAME.log>, performs one monitoring cycle, and
+sleeps until the next cycle is scheduled. In daemon mode the log file
+can be reopened by sending it a SIGHUP signal.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--nodaemon>
+
+Prevents the process from becoming a daemon and sets the log to STDERR.
+
+=item B<--runonce>
+
+Instructs the script to run once and exit. Implies B<--nodaemon>.
+
+=item B<--delay=N>
+
+Makes the daemon sleep for N minutes before starting the first cycle.
+This would happen on the daemon startup and also after each configuration
+recompilation.
+For example, when monitor and collector start simultaneously, the collector
+needs some time to retrieve the data being monitored.
+
+=item B<--debug>
+
+Sets the log level to debug.
+
+=item B<--verbose>
+
+Sets the debug level to info.
+
+=item B<--help>
+
+Displays a help message.
+
+=back
+
+=head1 FILES
+
+=over 4
+
+=item F<@siteconfdir@/torrus-siteconfig.pl>
+
+Torrus site configuration script.
+
+=item F<@logdir@/monitor.TREENAME.log>
+
+Monitor's log for the tree I<TREENAME>.
+
+=back
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_nodeid.pod.in b/torrus/doc/manpages/torrus_nodeid.pod.in
new file mode 100644 (file)
index 0000000..f80664e
--- /dev/null
@@ -0,0 +1,124 @@
+#  Copyright (C) 2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_nodeid.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+nodeid - Torrus utility
+
+=head1 SYNOPSIS
+
+B<torrus nodeid> --tree=I<TREENAME> --cmd=CMD I<options...>
+
+=head1 DESCRIPTION
+
+This command provides a way to integrate Torrus with external OSS systems.
+It operates with I<nodeid>, a unique identifier for Torrus datasource
+subtrees and leaves.
+
+The command prints the data on the standard output in JSON data format. 
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--tree=TREE>
+
+[Mandatory] Defines the datasouerce tree.
+
+
+=item B<--cmd=CMD>
+
+[Mandatory] Defines the action command. The following commands are supported:
+
+=over 8
+
+=item * info
+
+Prints information about the nodeid. Requires B<--nodeid>.
+
+=item * search
+
+Performs a prefix or substring search on node IDs and prints the results.
+Requires B<--prefix> or B<--substring>.
+
+=item * render
+
+Renders a specified datasource node and prints the resulting MIME type and the
+file name. Requires B<--nodeid> and B<--view>. Optional B<--out> defines
+a file name to copy the output to.
+
+=back
+
+
+=item B<--nodeid=NODEID>
+
+Specifies the Node ID string for the commands I<info> and I<render>.
+
+
+=item B<--details>
+
+Toggles verbose output for the commands I<info> and I<search>.
+
+
+=item B<--prefix=STR>
+
+Specifies the prefix search string for the command I<search>.
+
+
+=item B<--substring=STR>
+
+Specifies the search substring for the command I<search>.
+
+
+=item B<--view=VIEW>
+
+Specifies the view name for the command I<render>. The following views are
+defined by standard Torrus XML files and render a PNG graph:
+C<short>, C<last24h-small>, C<last24h>, C<lastweek>,
+C<lastmonth>, C<lastyear>. The following views are printing the datasource
+value in a text format: C<rrd-print-daily>, C<rrd-print-last>.
+
+
+=item B<--out=FILE>
+
+If defined, instructs the utility to copy the rendered data into a
+specified file. Otherwise the file is created in the standard renderer's cache
+directory.
+
+
+=item B<--help>
+
+Displays a help message.
+
+=back
+
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_rrddir2xml.pod.in b/torrus/doc/manpages/torrus_rrddir2xml.pod.in
new file mode 100644 (file)
index 0000000..bd78e48
--- /dev/null
@@ -0,0 +1,112 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_rrddir2xml.pod.in,v 1.1 2010-12-27 00:04:38 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+rrddir2xml - Searches a directory for RRD files and generates Torrus XML
+configuration file.
+
+=head1 SYNOPSIS
+
+B<torrus rrddir2xml> --dir=I<DIR> [I<options...>]
+
+=head1 DESCRIPTION
+
+B<rrddir2xml> searches in a given directory for RRD files and
+creates Torrus XML configuration file suitable for browsing ofthose data
+files.
+
+With default options, it is usable for RRD files generated by Torrus'
+SNMP collector, where the file name starts with the host name, separated by
+underscore from interface name or other MIB specifics. With these
+defaults, it creates a subtree per each host name, and all RRD files belonging
+top that host name are sorted alphabetically in that subtree.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--dir>=I<DIR>
+
+Absolute path to the directory for searching. The directory may contain also
+non-RRD files. Only regular files are processed, and the symlinks are ignored.
+
+=item B<--recursive>
+
+If specified, the directory will be searched recursively. All file names
+across all subdirectories must be unique. Symlinks to other directories
+are ignored.
+
+=item B<--filter>=I<Regexp>
+
+If the filter is specified, then B<rrddir2xml> lists only those files and
+subdirectories whose names match the given regular expression.
+
+=item B<--out>=I<FILE>
+
+Output XML file name. If relative path given, the file is placed in
+F<@sitexmldir@>. Default: F<rrddir.xml>.
+
+=item B<--subtree>=I<SUBTREE>
+
+Top subtree path in the generted XML. Default is the top of the tree (C</>).
+
+=item B<--split>=I<REGEXP>
+
+Regular expression used for splitting the file name into parts
+to build the subtree hierarchy. Default is a sequence of underscores (C<_+>).
+
+=item B<--levels>=I<INTEGER>
+
+Number of levels of hierarchy to build by splitting the file names.
+Default is 2 levels.
+
+=item B<--comment>=I<TEXT>
+
+Text to put as C<comment> parameter to the top subtree.
+
+=item B<--holtwinters>
+
+If specified, Holt-Winters prediciton boundaries and failures are displayed
+in the graphs.
+
+=item B<--verbose>
+
+Prints extra diagnosics.
+
+=item B<--debug>
+
+Prints debugging information.
+
+=back
+
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_schedulerinfo.pod.in b/torrus/doc/manpages/torrus_schedulerinfo.pod.in
new file mode 100644 (file)
index 0000000..e8567a1
--- /dev/null
@@ -0,0 +1,154 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_schedulerinfo.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+schedulerinfo - Displays extended scheduler tasks information.
+
+=head1 SYNOPSIS
+
+B<torrus schedulerinfo> --tree=I<TREENAME> [I<options...>]
+
+=head1 DESCRIPTION
+
+This utility displays the extended scheduler tasks information for tree
+I<TREENAME> on standard output. This might be useful for scheduler planning
+and analysis.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--config>
+
+Reports scheduler's configuration. The values are explained below.
+
+=over 8
+
+=item Total collector/monitor leaves: I<N>
+
+Total number of datasources being processed by collector or monitor daemon.
+
+=item Scheduled leaves by type
+
+Torrus supports arbitrary number of collector types, and this report
+shows how many datasources belong to every type. Currently the monitor leaves
+are not divided into types.
+
+=item Least common period: I<N> seconds
+
+The report below shows how the tasks are distributed across the time line,
+and the least common period shows the period of this time line.
+
+=item Tasks execution timeline
+
+This report tells which task and how many datasources are involved in
+each task startup event, and how these events are dispersed across the time.
+The column I<Interval> shows the time interval from each task execution
+event to the next event on the timeline.
+
+=back
+
+=item B<--runtime>
+
+Reports scheduler's runtime statistics, such as running cycle times,
+late starts etc. The meaning of the output values is as follows. Values
+that have zero values are usually not printed.
+
+=over 8
+
+=item Task: I<Name>, Period: I<N> seconds, Offset: I<M> seconds
+
+Each scheduler task is characterized by its name (usually Collector or
+Monitor), period, and timeoffset. Fore example, if period is set to 300
+seconds, and offset is 14 seconds, then the task would be executed at
+00:00:14, 00:05:14, 00:10:14, and so on for every hour in a day.
+
+=item I<N> running cycles passed
+
+How many times the task was executed since last reset. The counter
+is normally reset after L<torrus_compilexml(@mansec_usercmd@)> successfully
+compiles the configuration.
+
+=item I<N> late starts
+
+How many times the task has started with a delay from its normal schedule.
+
+=item I<N> too long runs
+
+How many times the task execution time was longer than its period.
+
+=item I<N> overrun periods
+
+How many periods have been missed because of too long executions.
+
+=item I<N> missed periods
+
+How many periods were missed because of any reason (such as other tasks
+delaying).
+
+=item Min, Max, Average, Exp Average
+
+The time values are displayed in four columns: Mimimum, Maximum and Average
+values since last reset, and Exponential decay value, which may be interpreted
+as the average for last several values. With defaults defined in
+F<torrus-config.pl>, 95% of the average is calculated from last 3 values.
+
+=item Running Time
+
+How long the task executes each period.
+
+=item Late Start
+
+How long the task start was delayed.
+
+=item Too Long
+
+How much time the too long run took.
+
+=item RRD Queue
+
+In a multithreaded environment, the RRD files are writen in a background
+thread. This value shows the length of the RRD update queue at the beginning
+of each update cycle.
+
+=back
+
+=item B<--help>
+
+Displays a help message.
+
+=back
+
+
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>,
+L<torrus_compilexml(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_snmpfailures.pod.in b/torrus/doc/manpages/torrus_snmpfailures.pod.in
new file mode 100644 (file)
index 0000000..e458b62
--- /dev/null
@@ -0,0 +1,155 @@
+#  Copyright (C) 2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_snmpfailures.pod.in,v 1.1 2010-12-27 00:04:37 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+snmpfailures - Displays SNMP collector failures.
+
+=head1 SYNOPSIS
+
+B<torrus snmpfailures> --tree=I<TREENAME> [I<options...>]
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--details>
+
+In addition to failure counters, list the failed SNMP hosts and the time
+stamps of failure events.
+
+
+=item B<--help>
+
+Displays a help message.
+
+=back
+
+=head1 DESCRIPTION
+
+This utility prints the SNMP collector failure information in JSON format.
+Without B<--details> option, it prints only the failure counters.
+
+Upon collector startup or after the tree re-compilation, the failure
+counters are reset to zero.
+
+The output is very convenient for further automatic processing in any
+scripting language.
+
+The top level of the output is a JSON object with the following name/value
+pairs:
+
+=over 4
+
+=item B<total_unreachable>: NUMBER
+
+Displays the number SNMP hosts that are currently unreachable.
+The number adds up across multiple collector instances for a given tree.
+If a host becomes reachable again, the number is decreased.
+
+=item B<total_deleted>: NUMBER
+
+Displays the number SNMP hosts that are completely removed from SNMP
+collection for the life cycle of the collector process. This happens when
+a host is unreachable for too long time and the collector gives up
+to reach it again.
+The number adds up across multiple collector instances for a given tree.
+
+=item B<total_mib_errors>: NUMBER
+
+Displays the number of MIB errors (I<noSuchObject>, I<noSuchInstance>,
+and I<endOfMibView>) during the collector life cycle.
+The number adds up across multiple collector instances for a given tree.
+
+=item B<detail_unreachable>: OBJECT, B<detail_deleted>: OBJECT
+
+If the option B<--details> is specified, these objects contain the host names
+and timestamps of the failures.
+The keys are contactenations of SNMP host, UDP port, and SNMP
+community separated by "|".
+The values are objects representing the UNIX timestamp and a human-readable
+time string.
+
+=item B<detail_mib_errors>: OBJECT
+
+If the option B<--details> is specified, this object displays the MIB error
+details: for each SNMP host, it lists the datasource leaves which had these
+errors and the event timestamps.
+
+=back
+
+=head1 EXAMPLES
+
+The following example illustrates an SNMP host unreachable:
+
+ torrus failures --tree=main --details
+ {
+    "detail_deleted" : {},
+    "detail_mib_errors" : {},
+    "detail_unreachable" : {
+       "217.101.101.101|161|public" : {
+          "time" : "Fri Jul 23 14:15:10 2010",
+          "timestamp" : 1279887310
+       }
+    },
+    "total_deleted" : 0,
+    "total_mib_errors" : 0,
+    "total_unreachable" : 1
+ }
+
+
+The following example illustrates a MIB error:
+
+ torrus failures --tree=main --details
+ {
+    "detail_deleted" : {},
+    "detail_mib_errors" : {
+       "217.101.102.102|161|public" : {
+          "count" : 1,
+          "nodes" : {
+             "/Routers/CMTS3/Temperature_Sensors/sensor_01" : {
+                "time" : "Fri Jul 23 15:26:14 2010",
+                "timestamp" : 1279891574
+             }
+          }
+       }
+    },
+    "detail_unreachable" : {},
+    "total_deleted" : 0,
+    "total_mib_errors" : 1,
+    "total_unreachable" : 0
+ }
+
+
+
+
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>,
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/manpages/torrus_srvderive.pod.in b/torrus/doc/manpages/torrus_srvderive.pod.in
new file mode 100644 (file)
index 0000000..a8c68c2
--- /dev/null
@@ -0,0 +1,136 @@
+#  Copyright (C) 2007  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_srvderive.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+srvderive - Derive a new service ID from sum or maximum of other service values
+
+=head1 SYNOPSIS
+
+B<torrus srvderive> I<TIMESPAN> I<OUTPUT> I<FUNCTION> I<SOURCES>...
+
+=head1 DESCRIPTION
+
+When the Torrus Reporting engine is set up, this command is used
+to combine several services data into a new service ID. The output data
+is either the maximum or the sum of input services.
+
+See I<Torrus Reporting Setup Guide> for more information.
+
+=head1 TIMESPAN
+
+Either --month or --end option must be defined
+
+=over 4
+
+=item B<--start>=I<YYYY-MM-DD>
+
+Sets the start date of the calculation.
+
+=item B<--end>=I<YYYY-MM-DD>
+
+Sets the next day after the eond of the period.
+
+=item B<--month>
+
+Instead of setting the end data, it is convenient to use this option. It sets
+the end data in one calendar month after the start date.
+
+=back
+
+
+=head1 OUTPUT
+
+=over 4
+
+=item B<--out>=I<SERVICEID>
+
+Sets the output service ID. This should not be a service ID used in the
+Torrus datasource trees. B<Note:> if I<srvderive> command is run twice
+with the same arguments, the produced data is doubled for the output
+service ID.
+
+=back
+
+
+
+=head1 FUNCTION
+
+=over 4
+
+=item B<--func>=C<MAX>|C<SUM>
+
+Sets the function to be used when combining the input service data.
+Currently only C<MAX> and C<SUM> are supportted.
+
+=back
+
+
+=head1 SOURCES
+
+=over 4
+
+=item B<--in>=I<SERVICEID> ...
+
+Input service IDs are specified either by B<--in> option, or as command line
+arguments. At least 2 input service IDs should be specified.
+
+=back
+
+
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--step>
+
+Default: 300. Sets the data interval for derived service ID. It is recommended
+to leave this option at default value.
+
+=item B<--verbose>
+
+Prints extra informatgion.
+
+=item B<--debug>
+
+Prints debugging information.
+
+=item B<--help>
+
+Prints command usage information.
+
+=back
+
+
+
+=head1 SEE ALSO
+
+L<torrus(@mansec_usercmd@)>
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
+
diff --git a/torrus/doc/manpages/torrus_ttproclist.pod.in b/torrus/doc/manpages/torrus_ttproclist.pod.in
new file mode 100644 (file)
index 0000000..db2100a
--- /dev/null
@@ -0,0 +1,144 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: torrus_ttproclist.pod.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 NAME
+
+ttproclist - Process a template with a nodelist 
+
+=head1 SYNOPSIS
+
+B<torrus ttproclist> --tmpl=I<TFILE> --out=I<OFILE>
+--nodes=I<NFILE> [I<options...>]
+
+=head1 DESCRIPTION
+
+This command takes a Template-Toolkit template and a list of nodes
+(usually SNMP devices) as input. The output file is a result of
+template substitution, according to the specified options.
+Command-line options B<--tmpl>, B<--out> and B<--nodes> are mandatory.
+
+This utility can be used to generate the discovery instructions XML out of
+a predefined template and a dynamically generated list of devices.
+Alternatively, it can produce Torrus XML configuration for a given list
+of objects, etc.
+
+The following variables are predefined when the template is processed:
+
+=over 4
+
+=item * C<nodes>
+
+Hash array of nodes. Hash keys are the node names. Values are symbolic
+names. If symbolic names are not defined, values are the same as keys.
+
+=item * C<param>
+
+Hash array of command-line parameters given in B<--param> option.
+
+=item * C<nodesfile>, C<creator>
+
+Informative variables. They can be used to produce the creation
+note in the resulting files. C<nodesfile> returns the file name of nodes,
+and C<creator> returns a detailed information how the file was generated,
+with timestamp and command line options.
+
+=back
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--tmpl>=I<TFILE>
+
+The file name of the input template. Relative names are looked in
+the current directory and in F<@tmpluserdir@>. The file name may also be
+an absolute path.
+
+=item B<--out>=I<OFILE>
+
+Output file name. If no absolute path given, the file is written in the current
+directory.
+
+=item B<--nodes>=I<NFILE>
+
+The name of the nodes list. Nodes should be separated by space or tab
+character or newline. Additional information, referred to as symbolic name,
+can be supplied after a colon, of the form NODENAME:SYMBOLICNAME.
+
+=item B<--param>=I<NAME:VALUE,NAME:VALUE...>
+
+List of optional parameters that may be used in the template.
+
+=back
+
+=head1 EXAMPLES
+
+The following example gerenates C<devdiscover> input file from a template.
+The template is as follows:
+
+ <?xml version="1.0" encoding="UTF8"?>
+ <snmp-discovery>
+ >>> usual DDX parameters here, like SNMP community and data-dir
+  <param name="snmp-community" value="private"/>
+  <param...
+ >>> This loop generates per-host entries
+  [% FOREACH n = nodes.keys.sort %]
+  <host>
+    <param name="snmp-host" value="[% n %]"/>
+    <param name="symbolic-name" value="[% nodes.$n %]"/>
+    <param name="output-file" value="nodes/[% n %].xml"/>
+  </host>
+  [% END %]
+ >>> Generate the bundle file, so that you need only one
+ >>> entry in torrus-site-config.pl
+  <param name="output-bundle" value="[% param.BUNDLE %].xml"/>
+ </snmp-discovery>
+
+The following command would generate F<MY.ddx> from template file F<MY.ddtmpl>
+as described above. The file F<MY.nodes> is a list of SNMP devices, one per
+line. Then C<devdiscover> is launched with F<MY.ddx> as input. Note also the
+short form of the command line wrapper.
+
+ torrus ttproclist --tmpl=MY.ddtmpl \
+   --nodes=MY.nodes \
+   --out=/usr/local/etc/torrus/discovery/MY.ddx \
+   --param=BUNDLE:MYNODES
+
+ torrus dd --in=MY.ddx --verbose
+
+In addition, you may put some common parameters in Template BLOCK
+statement in a separate file, and INCLUDE it in your templates. See the
+Template-Toolkit documentation for more detail.
+
+
+=head1 NOTES
+
+See more documentation at Torrus home page: http://torrus.org
+
+=head1 SEE ALSO
+
+Template-Toolkit documentation: http://template-toolkit.org/
+
+L<torrus(@mansec_usercmd@)>, L<torrus_devdiscover(@mansec_usercmd@)>
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/nodeid_usage.pod.in b/torrus/doc/nodeid_usage.pod.in
new file mode 100644 (file)
index 0000000..7f33a37
--- /dev/null
@@ -0,0 +1,210 @@
+#  Copyright (C) 2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: nodeid_usage.pod.in,v 1.1 2010-12-27 00:04:35 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 Torrus/OSS integration: NodeID usage guidelines
+
+=head2 Introduction
+
+Most parts of Torrus software mentioned in this document were developed under
+sponsoring by the following companies:
+
+=over 4
+
+=item * nexellent ag, Switzerland (www.nexellent.ch)
+
+NodeID concept and base implementation, host-based authentication.
+
+=item * M-net Telekommunikations GmbH, Germany (www.m-net.de)
+
+M-net plugin.
+
+=item * Fibre Noire Internet Inc, Canada (www.fibrenoire.ca)
+
+Extensions in M-Net plugin for NodeID manipulation.
+
+=back
+
+
+
+This document explains the new concept of NodeID and ways of utilizing
+it for better integration of Torrus into an OSS environment.
+
+
+=head2 NodeID concept
+
+Torrus 1.0.9 introduces a new parameter for datasource tree elements:
+C<nodeid>. This parameter is not inherited from parent subtrees to child
+subtrees or leaves. Also the XML configuration compiler verifies uniqueness
+of its values across the whole tree.
+
+The purpose of C<nodeid> is to provide persistent identifiers to the tree
+elements. Unlike the token numbers, these identifiers are not changing between
+re-compilations of the tree. Also unlike the path string, C<nodeid> would
+stay the same if a network device changes its place in the tree topology.
+
+By default, C<nodeid> value is composed of SNMP host name and device
+component name, such as IF-MIB interface. It can also be easily adapted to
+contain external identifiers, such as Asset ID or Service ID from some
+external inventory database.
+
+Once C<nodeid> values are put into the XML configuration (usually
+SNMP discovery engine does it) and compiled into the configuration database,
+they can be used for accessing the Torrus graphs from external systems.
+
+The command-line utility C<torrus nodeid> helps searching through existing
+NodeID values, and also renders the graphs on request.
+
+Another quick way to find the NodeID value is to navigate to the desired
+graph page and check the I<Bookmark> shortcut at the bottom of the page.
+For the nodes where C<nodeid> is defined, the bookmark will use it instead of
+the path in the datasource tree.
+
+
+
+=head2 Host-based authentication
+
+Many Torrus deployments have user authentication enabled. This makes it
+complicated for other OSS systems to retrieve graphs from the Torrus rendering
+engine.
+
+Torrus 1.0.9 introduces host-based authentication: a special user
+is created for requestor's IP address. The requestor specifies its unique
+password in the URL as C<hostauth> parameter. Also the Torrus WebUI does not
+send the session cookie back to the requestor.
+
+This new feature makes it easy to display Torrus graphs inside user
+self-service portals without giving direct access to the Torrus server.
+
+For example, the following command adds the host 10.0.0.5 with password
+"654321" to the I<admin> group:
+
+  torrus acl --addhost=10.0.0.5 --hostpassword=654321 --addtogroup=admin
+
+Then the following command executed from 10.0.0.5 would retrieve an
+InOut_bps graph for the last 24 hours for a given interface on I<rtr01> router:
+
+  wget -O graph.png \
+    'http://torrus/main?nodeid=if//rtr01//GigabitEthernet0/1//inoutbit&view=last24h&hostauth=654321'
+
+
+=head2 M-net plugin
+
+Details of M-net plugin are explained in the plugin documentation.
+The plugin interprets description strings on device network interfaces: 
+it catches all key-value pairs of format I<key1=val1;key2=val2;...> and
+performs various actions on them.
+
+Now assume there's an external inventory system, and each network interface is
+assigned a unique Asset ID. Our natural wish would be to use these asset IDs
+in NodeID strings, instead of hostnames and interfaces. This way we are
+secured against hardware changes and upgrades (assuming that Asset ID stays
+unchanged).
+
+In order to take advantage of M-Net plugin, the Asset ID values should be
+configured in all interface descriptions, like follows:
+
+  interface GigabitEthernet0/1
+    description bw=200M; assetid=VPNLINK00055; ct=BC
+
+In the example above, the interface description tells that this is a 200Mbps
+link, connection type is Business Customer, and the unique link identifier is
+I<VPNLINK00055>.  The format allows inserting extra spaces for better
+readability.
+
+In the corresponding Device Discovery XML (DDX) file, the following
+parameters would be set:
+
+  <host>
+    <param name="snmp-host" value="rtr01.example.com"/>
+    <param name="M_net::manage" value="yes"/>
+    <param name="M_net::nodeid-prefix-key" value="assetid"/>
+  </host>
+
+As a result, after the SNMP discovery and XML compiler finish their work,
+we get a number of NodeID values associated with this customer connection:
+  
+      assetid//VPNLINK00055
+      assetid//VPNLINK00055//inbytes
+      assetid//VPNLINK00055//indrops
+      assetid//VPNLINK00055//inerr
+      assetid//VPNLINK00055//inoutbit
+      assetid//VPNLINK00055//inpackets
+      assetid//VPNLINK00055//outbytes
+      assetid//VPNLINK00055//outdrops
+      assetid//VPNLINK00055//outerr
+      assetid//VPNLINK00055//outpackets
+
+The first NodeID refers to the interface-level subtree in Torrus
+configuration, and all other values refer to the corresponding graphs
+for this interface.
+
+So, now the customer self-service portal would retrieve the input/output
+summary graph with the following URL (wget woulld be certainly replaced by a
+corresponding command in PHP or other Web programming language):
+
+  wget -O graph.png \
+    'http://torrus/main?nodeid=assetid//VPNLINK00055//inoutbit&view=last24h&hostauth=654321'
+
+Of course, a number of additional view definitions could be created, in order
+to create graphs of needed size and time span. Also, for example, a calendar
+month's graph could be generated by specifying the followiong
+parameters in the URL: C<NOW> or C<Gend> pointing to the beginning of
+next month, and optionally C<Gstart> indicating the start of the time period.
+
+
+=head2 Setting the host identifier
+
+Alternatively to the technique explained above, the local OSS environment
+could require some custom identifiers assigned to the network devices.
+For example, CA Spectrum software uses its internal Model Handles to refer to
+devices.
+
+The discovery parameter C<nodeid-device> sets the string that would be used
+in the host part of NodeID values:
+
+  <host>
+    <param name="snmp-host" value="rtr02.example.com"/>
+    <param name="nodeid-device" value="0xC0FFEE"/>
+  </host>
+  
+The resulting NodeID values would be based on "0xC0FFEE" string instead of
+"rtr02.example.com":
+
+  if//0xC0FFEE//GigabitEthernet0/1//inoutbit
+
+
+=head2 Future development
+
+The NodeID is a relatively new concept in Torrus, and there will be other
+ways of specifying and using it in the course of Torrus development.
+
+One of the directions for future enhancement is a look-up of NodeID values
+in some external database before or during SNMP discovery.
+
+The usage of NodeID is not limited to IF-MIB interfaces. Some Torrus
+templates already assign NodeID values to, for example, environment sensors
+and DOCSIS statistics.
+
+
+
+=head1 Author
+
+Copyright (c) 2010 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/reporting_setup.pod.in b/torrus/doc/reporting_setup.pod.in
new file mode 100644 (file)
index 0000000..5ff1118
--- /dev/null
@@ -0,0 +1,365 @@
+#  webintf.pod - Torrus web interface reference
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: reporting_setup.pod.in,v 1.1 2010-12-27 00:04:34 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+
+=head1 Torrus Reporting Setup Guide
+
+In version 1.0.4, Torrus introduces a new and important functionality.
+Now it is able to produce reports that may be used in billing or
+resource planning. The reports are meant to be text output, telling
+the bandwidth usage or volume: no graphs so far.
+
+By default, the reporting functionality is not enabled, and the steps
+required are described below.
+
+
+=head2 Terminology
+
+The basic term in Torrus reporting is the B<Service ID>.
+It denotes a single datasource that is represented by a single number.
+For example, if you want to count input and output interface traffic,
+this would make two different service IDs. Do not assign service IDs
+to each and every interface in your network, as it would degrade
+the performance of your Torrus installation significantly.
+This functionality is designed for use with important datasources,
+such as your customers' connection links or and ISP's upstream channels.
+
+Each service ID must be B<unique> across the whole Torrus installation,
+and across the database that stores them (it is possible to use
+several Torrus installations with the same database).
+
+B<Devdiscover>, the SNMP discovery engine, allows now to assign
+service IDs to network interfaces of your SNMP-enabled devices.
+However, this does not prevent you from assigning them to other Torrus
+datasources, as it's done by simple configuration parameters.
+
+B<Report>, when generated, is presented by a set of numeric values
+in the SQL database. Torrus provides also tools for rendering these
+values into HTML B<output>. In the future, other output formats
+will be implemented. You can also build your own infrastructure that
+reads the values from the reports database.
+
+The produced reports may, and are primarily developed for using in
+B<billing> process. As it is stated in the GNU General Public License
+text, this program is provided "as is" and B<without warranty of any kind>.
+It is up to the users of Torrus software to rely or not to rely on
+the generated numeric data, and the Torrus software developers disclaim
+any responsibility for the data accuracy and usability.
+
+
+B<New in version 1.0.7:> You can assign the list of trees where the reports
+should be generated and shown. B<Warning:> after changing the destination tree,
+the compiler may complain about I<duplicate service IDs>. Then you need to
+stop all the torrus processes, including Apache, and then remove the file
+F<serviceid_params.db> from Torrus database directory, then recompile the
+trees and start the processes.
+
+
+=head2 Install Perl modules
+
+Install the following Perl modules from CPAN:
+
+  DBI
+  DBD::mysql or other RDBMS driver
+  DBIx::Abstract
+  DBIx::Sequence
+
+On many platforms, DBI is already pre-installed. You need to make sure
+that appropriate DBD driver is installed for your database engine.
+The setup was tested with MySQL, SQL syntax is compatible with Postgres,
+and in theory it should run also with Oracle and probably Sybase or DB2.
+No idea about MSSQL - if you're brave enough, let me know if it works :)
+
+
+=head2 Enable the External Storage and specify the SQL connection
+
+In F<torrus-siteconfig.pl>, add the following lines. The first one
+tells the collector to use the module for storing the collector results in
+SQL database. Next lines define the database connection. By default,
+it refers to the MySQL database named C<torrus> on C<localhost>,
+with username and password set to C<imiF1oih>.
+
+
+  push(@Torrus::Collector::loadModules, 'Torrus::Collector::ExternalStorage');
+  $Torrus::SQL::connections{'Default'}{'dsn'} =
+      'DBI:mysql:database=torrus;host=dbhost.example.com';
+  $Torrus::SQL::connections{'Default'}{'username'} = 'torrus';
+  $Torrus::SQL::connections{'Default'}{'password'} = 'imiF1oih';
+
+In addition to the default connection, you can specify different connections
+for different data structures: for example, keep 5-minutes samples on
+a bulky storage server, and store the reports on a high-availability cluster.
+See the comments in F<torrus-config.pl> for more details.
+
+
+=head2 Create SQL tables
+
+With your RDBMS client, create the following tables. We assume here that
+the same database is used for all tables. The SQL syntax is verified with
+MySQL 4.x and Postgres 8.x. It is brought as much as possible to
+the standard and platform-independent SQL syntax. Please let me know
+if it causes problems with your RDBMS.
+
+
+ /* Collector export table. It usually grows at several megabytes
+    per month, and is updated every 5 minutes */
+ CREATE TABLE srvexport
+ (
+  srv_date DATE NOT NULL,            /* date and time of the data sample */
+  srv_time TIME NOT NULL,  
+  serviceid VARCHAR(64) NOT NULL,    /* unique service ID per counter */
+  value DOUBLE PRECISION NOT NULL,   /* collected rate or gauge value */
+  intvl INTEGER NOT NULL             /* collection interval -
+                                        for counter volume calculation */
+  );
+ CREATE INDEX srvexp_date ON srvexport (srv_date);
+ CREATE INDEX srvexp_srvid ON srvexport (serviceid);
+
+ /* Tables for (currently monthly only) report contents.
+    These are updated usually once per month, and read at the moment of
+    rendering the report output (HTML now, PDF or XML or Excel or whatever
+    in the future) */
+
+ /* DBIx::Sequence backend, theplatform-independent inplementation
+    of sequences */
+ CREATE TABLE dbix_sequence_state
+ (
+  dataset varchar(50) NOT NULL, 
+  state_id INTEGER NOT NULL, 
+  CONSTRAINT pk_dbix_sequence PRIMARY KEY (dataset, state_id)
+  );
+
+ CREATE TABLE dbix_sequence_release
+ (
+  dataset varchar(50) NOT NULL,    
+  released_id INTEGER NOT NULL, 
+  CONSTRAINT pk_dbi_release PRIMARY KEY (dataset, released_id)
+ );
+
+
+ /* Each report is characterized by name, date and time.
+    Monthly reports are automatically assigned 00:00 of the 1st day
+    in the month. The report contains fields for every service ID
+    defined across all datasource trees. */
+ CREATE TABLE reports
+ (
+  id INTEGER PRIMARY KEY,
+  rep_date DATE NOT NULL,             /* Start date of the report */
+  rep_time TIME NOT NULL,             /* Start time of the report */
+  reportname VARCHAR(64) NOT NULL,    /* Report name, such as MonthlyUsage */
+  iscomplete INTEGER NOT NULL,        /* 0 when the report is in progress, */
+                                      /* 1 when it is ready */
+  UNIQUE(rep_date, rep_time, reportname)
+  );
+ CREATE INDEX rep_date_idx ON reports (rep_date);
+
+
+ /* Each report contains fields. For each service ID,
+    the report may contain several fields for various statistics.
+    Each field contains information about the units of the value it
+    contains */
+ CREATE TABLE reportfields
+ (
+  id INTEGER PRIMARY KEY,
+  rep_id INTEGER,
+  name VARCHAR(64) NOT NULL,       /* name of the field, such as AVG or MAX */
+  serviceid VARCHAR(64) NOT NULL,           /* service ID */
+  value DOUBLE PRECISION NOT NULL,          /* Numeric value */
+  units VARCHAR(64) NOT NULL DEFAULT '',    /* Units, such as bytes or Mbps */
+  UNIQUE (rep_id, name, serviceid)
+  );
+
+
+=head2 Devdiscover parameters
+
+Currently devdiscover allows you to assign service IDs to network interfaces'
+input and output traffic counters. Other types of datasources may be
+implemented in the future.
+
+=over 4
+
+=item * C<RFC2863_IF_MIB::external-serviceid>
+
+This discovery parameter specifies which service IDs are assigned to which
+interface names. The interface names whould be specified in the form of
+their subtree names in Torrus configuration. The example below is
+typical for a Cisco IOS router. The value of the parameter consists of
+comma-separated strings. The values in each string are separated by colons,
+and they correspond to the service ID, interface name, counter type,
+and optional destination tree names separated by the pipe symbol (|).
+The interface name can be prefixed by hostname and slash (/),
+the same way as in C<RFC2863_IF_MIB::tokenset-members>. 
+All strings are case-sensitive. Three counter types are supported: C<In>,
+C<Out>, and C<Both>. When set to C<Both>, the service ID is appended with
+C<_IN> or C<_OUT> postfix accordingly, for input and output byte counters.
+
+ <!-- global parameter that will match specific routers -->
+ <param name="RFC2863_IF_MIB::external-serviceid">
+  CUSTOMERONE:nyc01br01/GigabitEthernet9_2_1:Both,
+  CUSTOMERTWO:wdc01br02/GigabitEthernet6_3_1:Both,
+ </param>
+
+ <host>
+   <param name="snmp-host" value="lsn01br01"/>
+   <!-- host-specfic parameter  -->
+   <param name="RFC2863_IF_MIB::external-serviceid">
+     UPSTREAM1_IN:FastEthernet0_0_0:In:upstreams,
+     UPSTREAM1_OUT:FastEthernet0_0_0:Out:upstreams,
+     UPSTREAM2:GigabitEthernet0_1_1:Both:upstreams,
+     CUST1:GigabitEthernet0_2_2:Both:customers|cust1,
+   </param>
+ </host>
+
+=item * C<CiscoIOS_MacAccounting::external-serviceid>
+
+The same format as for the parameter listed above, but instead of
+interface names, you can specify the MAC accounting peer, in one
+of the following formats: AS number (I<AS12345>), IP address, or peer's MAC
+address (I<0x0003319c4200>).
+
+=back
+
+
+
+=head2 Torrus XML configuration parameters
+
+You can skip this section if Devdiscover provides all desired functionality.
+It explains parameters additional to those described in I<Torrus XML
+Configuration Guide>.
+
+The collector's ExternalStorage module is designed for storing the data to
+a generic external storage, and the default external storage is the SQL
+database.
+
+=over 4
+
+=item * C<storage-type>
+
+Mandatory parameter for datasource type C<collector>. Comma-separated list
+of storage types. The collected value is duplicated on every storage listed.
+Supported values are: C<rrd>, C<ext>. For C<ext> (external storage),
+see the I<Reporting Setup Guide>.
+
+=item * C<ext-dstype>
+
+Mandatory datasource type to be used in external storage. Accepted
+values are: C<GAUGE>, C<COUNTER32>, C<COUNTER64>.
+
+=item * C<ext-service-id>
+
+Mandatory service ID for the external storage.
+
+=item * C<ext-service-units>
+
+Optional units for the collected value. The only supported value is
+C<bytes>.
+
+=item * C<ext-service-trees>
+
+(B<New in version 1.0.7>) Optional list of comma-separated tree names.
+If specified, the report generator will produce report in corresponding trees.
+By default it's the tree which runs the collector process.
+
+=back
+
+
+
+=head2 Enable displaying of the reports in the web interface
+
+First, enable the reports displaying in <torrus-siteconfig.pl>:
+
+ $Torrus::Renderer::displayReports = 1;
+
+Second, configure the ACL for your users that are allowed to see the reports
+in the web interface:
+
+ torrus acl --modgroup=admin --permit=DisplayReports --for=mytree
+
+In this example, members of the group C<admin> will be prompted
+with the C<[Reports]> shortcut in the web interface's bottom of the page
+for a given tree. For easier setup, the tree name may be replaced with
+asterisk (*) to allow this option for all trees.
+
+
+=head2 Generate reports
+
+Report generation is usually a CPU-intensive task. A monthly report calculation
+for one service ID may take several dozens of seconds of CPU time.
+This uit's recommended to use the C<nice> command to lower the process
+priority.
+
+The C<torrus genreport> (or simply C<torrus report>) command-line utility
+is designed for two different tasks: calculation of a single report
+for the period chosen, and generation of output HTML for all reports
+available.
+
+The example below generates the monthly usage report for September 2005:
+
+ nice torrus report --report=MonthlyUsage --date=2005-09-01 --debug
+
+The next example generates HTML output for all reports that are found
+in the database:
+
+ nice torrus report --genhtml --tree=customers
+
+It makes sence to set up a monthly cron job and generate the reports on
+the first day of every month, with the command like follows:
+
+ nice torrus report --report=MonthlyUsage \
+   --date=`perl -e 'use Date::Format;    
+         print time2str("%Y-%m-%d", time()-1728000)'`
+
+The HTML output is optimized for printing, and is quite easy
+to navigate. The overview page provides the list of years. Clicking to the
+year leads you into the list of monthly reports available.
+Each monthly report consists of a table for each report name.
+For C<MonthlyUsage>, the data is organized in five columns:
+the service ID, average monthly rate, 95th percentile of the rates,
+maximum rate throughout the month, unavailable samples (how many 5-minutes
+intervals are missed in the collected data), and monthly volume (which
+is roughly less than the actual volume by the percentage of missed samples).
+Also clicking a service ID leads to its monthly report throughout the year.
+
+
+=head2 Getting the sum or maximum value from several service IDs
+
+A new utility has been sponsored by nexellent ag (www.nexellent.ch), a
+managed hosting solution provider near Zurich.
+
+The utility C<srvderive> can be used to generate a
+new service ID which would contain sum or maximum of values of other
+service IDs. You would usually run this utlity monthly, just before generating
+the monthly reports:
+
+  torrus srvderive --verbose --start=20080801 --month \
+    --out=JSMITH_SUM_OUT --func=SUM JSMITH01_OUT JSMITH02_OUT
+
+  torrus srvderive --verbose --start=20080801 --month \
+    --out=JSMITH_SUM_IN --func=SUM JSMITH01_IN JSMITH02_IN
+
+
+
+
+
+
+Copyright (c) 2005-2008 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/rpnexpr.pod.in b/torrus/doc/rpnexpr.pod.in
new file mode 100644 (file)
index 0000000..c85e636
--- /dev/null
@@ -0,0 +1,106 @@
+#  rpnexpr.pod - Torrus RPN expressions guide
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: rpnexpr.pod.in,v 1.1 2010-12-27 00:04:31 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 RPN expressions in Torrus
+
+In Torrus framework, RPN expressions are the superset of those
+in RRDtool version 1.0. See the C<rrdtool graph> manual at
+E<lt>http://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.htmlE<gt>.
+
+=head2 New functions added
+
+=over 4
+
+=item * NE
+
+Pops two arguments from stack, and pushes 0 if the arguments are equal,
+and 1 otherwise.
+
+=item * AND, OR
+
+These functions pop two arguments from stack, and push back the result of
+logical operation. Unlike C operators,
+
+=item * NOT
+
+Pops one value from stack and pushes 0 if the argument is nonzero,
+otherwise 1.
+
+=item * ABS
+
+Pops one value from stack and pushes the absolute value of it.
+
+=item * NOW
+
+Pushes the current time, in seconds since Epoch.
+
+=item * MOD
+
+Equivalent of C<%>, the modulo operator. In Torrus parameter value,
+percent sign is reserved for parameter substitution.
+
+=item * NUM
+
+Returns zero if the argument is undefined, and the argument's numeric value
+otherwise
+
+=item * INF, NEGINF
+
+Returns the positive or negative infinity.
+
+=back
+
+=head2 Data access
+
+In certain context, the values of the datasources can be evaluated
+into RPN expression.
+
+The general format for data access is following:
+
+  {FUNC@PATH(-OFFSET)}
+
+C<FUNC@> specifies a special function to be performed on the
+data being accessed.
+
+For monitor expressions, C<T@> returns the timestamp of the data source.
+
+For C<rrd-cdef> leaf types and for C<rrd-multigraph> datasource types,
+the following functions affect the graph shape: C<AVERAGE@>, C<MIN@>,
+C<MAX@>, and C<LAST@>. They cause the corresponding Consolidation Function
+being used when creating a graph.
+
+C<PATH> specifies the relative name for the data source.
+If omitted, the current leaf value is taken. If starts with C</>,
+the path is considered as absolute.
+Path starting with letter denotes the child of the parent subtree.
+Double dot (C<../>) in the beginning of the path is interpreted as
+current parent's parent subtree.
+
+C<(OFFSET)> determines the time reference, as described in C<rrdtool fetch>
+manual. In addition, the word C<LAST> refers to the latest data timestamp
+available.
+
+C<(OFFSET)> is currently supported in Monitor expressions only.
+
+=head1 Author
+
+Copyright (c) 2002-2004 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/rrfw_torrus_migration.pod.in b/torrus/doc/rrfw_torrus_migration.pod.in
new file mode 100644 (file)
index 0000000..f29b6e3
--- /dev/null
@@ -0,0 +1,238 @@
+#  webintf.pod - Torrus web interface reference
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: rrfw_torrus_migration.pod.in,v 1.1 2010-12-27 00:04:32 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 RRFW to Torrus migration guide
+
+
+
+=head2 Introduction
+
+Torrus is the new marketing name for RRFW (Round-robin Database Framework),
+a robust and flexible software package for data series processing.
+The last release of RRFW is 0.1.8. The upcoming release 1.0.0 of Torrus
+will introduce some significant changes and design improvements.
+
+The directory structure of Torrus is more standards-compliant, and more
+convenient for system adminisrators. The user files are strictly separated
+from the distribution files. The XML configurations and HTML templates
+are being searched in multiple directories, thus there will be no longer a
+mixture of site-specific files with the ones from distribution.
+
+In addition, Torrus introduces a commandline wrapper that is installed in
+a generic directory for user executables (by default, F</usr/local/bin>).
+This greatly simplifies the site administrator's tasks.
+
+The plugins infrastructure is completely redesigned.
+The plugin installation procedure is separated from the main software
+installation. In addition, plugin installers set up their initialization
+scripts in special directories, so that there's no need for plugin
+initialization in F<torrus-siteconfig.pl> and other files. 
+
+Further on, we assume that RRFW is installed in its default directory,
+F</usr/local/rrfw-0.1>, and Torrus is installed with default paths. These
+paths may differ in your installation.
+We refer to TORRUS_DISTR as the unpacked Torrus distribution path.
+
+
+
+=head2 Software installation
+
+Create a new user: C<torrus> and group: C<torrus>. The user ID that is
+used by Apache process must be a member of this group. Depending on the
+system, this user may be named as C<www>, C<httpd>, C<nobody> etc. Consult
+your Apache configuration for details.
+
+Install Torrus. If your system already runs RRFW release 0.1.8,
+all prerequisites should be already in place. Then you simply unpack
+the Torrus distribution, and from its directory execute
+
+  ./configure
+  make install
+
+If required, download and unpack the Torrus plugins. Then for each plugin,
+execute 
+
+  torrus install_plugin <UNPACKED_PLUGIN_DIR>
+
+
+
+=head2 The Perl configuration files
+
+Te distribution contains a short Shell script called
+C<TORRUS_DISTR/setup_tools/replace_rrfw.sh>. This script takes one file name
+as an argument, replaces all occurrences of I<RRFW> to I<Torrus> and I<rrfw>
+to I<torrus>, and finally replaces the specified file with the new one.
+
+Copy the site configuration files from RRFW to Torrus directory:
+
+  cd /usr/local/etc/torrus/
+  cp /usr/local/rrfw-0.1/share/rrfw/rrfw-siteconfig.pl \
+    conf/torrus-siteconfig.pl
+  TORRUS_DISTR/setup_tools/replace_rrfw.sh conf/torrus-siteconfig.pl
+
+If needed, follow the same procedure for F<devdiscover-siteconfig.pl>
+and other site configs.
+
+
+
+=head2 XML configuration files
+
+The format of XML fles has not changed, so you simply copy
+all locally defined files into F</usr/local/etc/torrus/xmlconfig>.
+
+The following Shell commands might be of help. They copy all XML files that
+do not occur in F</usr/local/torrus/xmlconfig>, the default path for
+distribution supplied files:
+
+  cd /usr/local/rrfw-0.1/share/rrfw/xmlconfig/
+
+  find . -name '*.xml' -exec test ! -f /usr/local/torrus/xmlconfig/'{}' ';' \
+    -print | cpio --create --file=/tmp/allxml.cpio
+
+  cd /usr/local/etc/torrus/xmlconfig/
+
+  cpio --extract --make-directories --preserve-modification-time \
+    --file=/tmp/allxml.cpio
+
+After copying XML files, compile them in Torrus:
+
+  torrus compilexml --all --verbose
+
+
+
+=head2 Monitor actions
+
+If you utilize the monitor daemon, you will most probably need
+to change the action statements.
+
+In the action of type C<exec>, the C<command> parameter should be edited.
+RRFW was usually referencing the email notification command as
+I<$RRFW_HOME/bin/action_printemail>. In Torrus, this command should be
+referred as I<$TORRUS_BIN/action_printemail>.
+
+
+
+=head2 SNMP discovery files
+
+  cd /usr/local/etc/torrus/
+  cp /usr/local/rrfw-0.1/share/rrfw/discovery/*.ddx discovery/
+
+The treatment of C<output-file> parameter has slightly changed.
+In RRFW, relative filename meant relative to the current working directory,
+and C<$XMLCONFIG> macro was used for referring the default XML files directory.
+In Torrus, C<$XMLCONFIG> is still supported, but it is advisory to get rid
+of it. Now the relative filenames refer to the user's XML directory,
+F</usr/local/torrus/xmlconfig>. Absolute filenames are used as they are.
+
+In addition, C<torrus devdiscover> acepts the relative input file names,
+and searches for them in F</usr/local/torrus/discovery>.
+
+
+
+=head2 Web interface ACLs
+
+  cd /usr/local/etc/torrus/
+  /usr/local/rrfw-0.1/bin/acledit --export=acl.xml
+  torrus acledit --import=acl.xml
+
+
+
+=head2 Site-specific text templates
+
+If you used some custom templates (HTML templates for the Web interface,
+or text templates for e-mail notifications), copy them to
+F</usr/local/etc/torrus/templates>. This directory should contain only
+your custom templates. Those delivered with the distribution packages are
+located in F</usr/local/torrus/templates>.
+
+
+
+=head2 Apache configuration
+
+Follow the Torrus Web interface guide and configure Apache accordingly.
+If needed, use the following Apache command to redirect the users which
+use the old URL:
+
+  Redirect /rrfw http://host.domain.com/torrus
+
+After changing the configuration, stop and start Apache.
+
+
+
+=head2 Stop RRFW collector and monitor processes
+
+Depending on your system configuration, the command would look like
+
+  /etc/init.d/rrfw stop
+
+Make sure that all old processes are stopped. Then remove the RRFW startup
+script from all rc.d directories.
+
+
+
+=head2 Change the RRD files ownership
+
+Depending on your system configuration, the paths for RRD files might be
+different.
+
+  chown torrus:torrus /var/snmpcollector/*
+
+
+
+=head2 Test and run processes
+
+For testing purposes, you might want to try launching the collector and
+monitor processes, as follows:
+
+  torrus collector --tree=mytree --runonce --debug
+
+Then copy the Torrus startup script to your system's init directory and setup
+new symbolic links, if required. The following example should work for
+Sun Solaris:
+
+  cp TORRUS_DISTR/init.d/torrus /etc/init.d
+  cd /etc/rc3.d
+  ln -s S90torrus ../init.d/torrus
+  cd /etc/rc0.d
+  ln -s K90torrus ../init.d/torrus
+
+Run the startup script and verify that RRD files get updated.
+
+
+
+=head2 Update the cron jobs
+
+RRFW's cron job F</usr/local/rrfw-0.1/bin/cleanup> should be replaced with
+the analogous job from Torrus: F</usr/local/torrus/bin/cleanup>
+
+
+
+=head2 Update documentation
+
+Update your site operational manuals to reflect the new software name,
+paths and URLs.
+
+
+
+=head1 Author
+
+Copyright (c) 2004 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/scalability.pod.in b/torrus/doc/scalability.pod.in
new file mode 100644 (file)
index 0000000..6bdd51f
--- /dev/null
@@ -0,0 +1,274 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#  Copyright (C) 2004  Christian Schnidrig
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: scalability.pod.in,v 1.1 2010-12-27 00:04:32 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 Torrus Scalability Guide
+
+=head2 Introduction
+
+Installing Torrus in big enterprise or carrier networks requires special
+planning and design measures, in order to ensure its reliable and efficient
+function.
+
+
+=head2 Hardware Platform Recommendations
+
+Hardware planning for large Torrus installations is of big importance.
+It is vital to understand the potential bottlenecks and performance limits
+before purchasing the hardware.
+
+First of all, you need to estimate the number of devices that you are
+going to monitor, with some room for future growth. It is a good practice
+first to model the situation on a test server, and then project the
+results to a bigger number of network devices. The utilities that
+would help you in assessing the requirements are C<torrus configinfo> and
+C<torrus schedulerinfo>.
+
+The resources for planning are the server CPU, RAM, and disks.
+While CPU and RAM are of great importance, it is the disk subsystem that
+often becomes the bottleneck.
+
+=head3 CPU
+
+For large installations, CPU power is one of the critical resources.
+
+One of CPU-intensive processes is XML configuration compiler. A configuration
+for few hundred of nodes may take few dozens of minutes to compile. In some
+complicated configuration, it may require few hours to recompile the whole
+datasource tree. Here CPU power means literally your time while testing the
+configuration changes or troubleshooting a problem.
+
+The SNMP collector is quite moderate in CPU usage, still when the number of
+SNMP variables reaches dozens of thousands, the CPU power becomes
+an important resource to pay attention to. In addition, the collector
+process initialization time can be quite CPU-intensive. This happens every
+time the collector process starts, or when the configuration has been
+recompiled.
+
+The empiric estimation made by Christian Schnidrig is that one SNMP counter
+collection every 5 minutes occupies approximately 1.0e-5 of the
+Intel Xeon 2.8GHz time, including the OS overhead. For example,
+the Torrus collectors running on 60'000 counters would make the server
+busy at the average of 60%.
+
+
+=head3 Memory
+
+The collector would need RAM space to store all the counters information,
+and of course it's undesirable to swap. In addition, the more RAM you have
+available for disk cache, the faster your collector may update the data files.
+
+Each update of an RRD file consists of a number of operations: open a file,
+read the header, seek to the needed offset, and then write. With enough disk
+cache, it is possible that the read operations are made solely from RAM,
+and that significantly speeds up the collector running cycle.
+
+According to Christian Schnidrig's empiric estimations, 30 KB RAM per counter
+should be enough to hold all the neccessary data, including the disk cache.
+For example, for 60'000 counters this gives 1'757 MB, thus 2 GB of server RAM
+should be enough.
+
+In addition, Apache with mod_perl occupies 20-30 MB RAM per process, so
+few hundred extra megabytes of RAM would be good to have.
+
+
+=head3 Disk storage
+
+It is not recommended to use IDE disks. They are not designed for
+continuous and intensive use. As experienced by Christian Schnidrig,
+IDE disks don't live long under such load.
+
+It is recommended to reduce the number of RRD files by grouping
+the datasources. This reduces dramatically the number of read and write
+operations during the update process.
+
+As noted by Rodrigo Cunha, reducing the size of read-ahead in the filesystem
+may lead to significant optimisation of disk cache usage. RRD update process
+reads only a short header in the beginnin of RRD file, and the rest of
+readahead data is never reused. On Linux, the following command would
+set the readahead size to 4 KB, which equals to i386 page size:
+
+ /sbin/hdparm -a 4 /dev/sda
+
+For servers with dozens of thousands RRD files, it is recommended to use
+hashed data directories. Then the data directories will form a structure of
+256 directories, with hash function based on hostnames. See I<Torrus SNMP
+Discovery User Guide> for more details.
+
+Spreading the data files over several physical disks is also a good plus.
+
+
+
+=head2 Operating System Tuning
+
+Depending on the number of trees and processes that run on a single server,
+you might require to increase the maximum number of filehandles that
+may be opened at the same time, system-wide and per process.
+See the manuals for your operating system  for more details.
+
+
+=head2 Torrus Configuration Recommendatations
+
+=head3 BerkeleyDB configuration tuniung
+
+When using lots of collectors and/or lots of HTTP processes, it is
+important to increase the size of BerkeleyDB lock region.
+The command
+
+  db_stat -h @dbhome@ -c
+
+would show you the current number of locks and lockers, and their maximum
+quantities during the database history.
+The maximum numbers of lock objects and lockers can be tuned by creating the
+file F<DB_CONFIG> in the database home directory, F<@dbhome@>.
+The following settings would work fine with about 20 collector processes
+and 5 HTTP daemon processes:
+
+   set_lk_max_lockers  6000
+   set_lk_max_locks    3000
+
+It is also recommended to increase the cache size from default 256KB to some
+bigger amount. Especially if the database has to hold large Torrus trees
+(hundreds or thousands monitored devices). The following line in
+F<DB_CONFIG> sets the cache size to 16MB:
+
+   set_cachesize        0 16777216 1
+
+After updating F<DB_CONFIG>, stop all Torrus processes,
+including HTTP server, then run
+
+  db_recover -h @dbhome@
+
+Then start the processes again. Futher info is available at:
+
+=over 4
+
+=item * General access method configuration (BDB Reference)
+
+http://tinyurl.com/ybymk7t
+
+=item * DB_CONFIG configuration file (BDB Reference)
+
+http://tinyurl.com/y9qjodv
+
+=item * Configuring locking: sizing the system (BDB Reference)
+
+http://tinyurl.com/ya6dtww
+
+=item * C API reference
+
+http://tinyurl.com/yczgnab
+
+=back
+
+
+=head3 XML compilation time
+
+For large datasource trees, XML compilation may take dozens of minutes,
+if not hours. Other processes are not suspended during the compilation, and
+they use the previous configuration version.
+
+For debugging and testing, it is recommended to create a new tree,
+separate from large production trees. That would save you a lot of time and
+would allow you to see the result of changes quickly.
+
+
+
+=head3 Collector schedule tuning
+
+The Torrus collector has a very flexible scheduling mechanism. Each data source
+has its own pair of scheduler parameters. These parameters are I<period>
+and I<timeoffset>. Period is usually set to default 300 seconds.
+The time is divided into even intervals. For the default 5-minutes period,
+each hour's intervals would start at 00, 05, 10, 15, etc. minutes.
+The timeoffset determines the moment within each interval when the data source
+should be collected. The default value for timeoffset is 10 seconds. This
+means that the collector process would try to collect the values at
+00:00:10, 00:05:10, ..., 23:55:10 every day.
+
+Data sources with the same period and timeoffset values are grouped together. 
+The SNMP collector works asynchronously, and it tries to send as many SNMP
+packets at the same time as possible. Due to the asynchronous architecture,
+the collector is able to perform thousands of queries at the same time
+with very small delay. Within the same collector process, a large number of
+datasources configured with the same schedule is usually not a problem.
+
+If you configured  several datasource trees all with the same period and
+timeoffset values, each collector process would start flooding the SNMP
+packets to the network at the same time. This may lead to packet loss and
+collector timeouts. In addition, all collector processes would try to update
+the RRD files concurrently, and this would cause overall performance
+degradation. Therefore, it is better to assign different timeoffset values
+to different trees. This may be achieved by manually specifying the
+C<collector-timeoffset> parameter in discovery configuration files.
+
+In large installations, the collector schedules need thorough planning and
+tuning to insure maximum performance and minimize load on the network devices'
+CPUs. The C<torrus schedulerinfo> utility is designed to help you in
+this planning.
+It shows two types of reports: configuration report gives you the idea
+of how many datasources are queried at which moments in time. The runtime
+report gives you realtime statistics of collector schedules, including
+average and maximum running cycle, and statistics on missed or delayed cycles.
+
+There is a feature that eases the load in large installations. With
+dispersed timeoffsets enabled, the timeoffset for each datasource is
+evenly assigned to one of allowed values, based on the name of the host,
+and name of the interface. By default, these values are: 0, 30, 60, ..., 270.
+With thousands of datasources, this feature smoothens the CPU and disk load
+on Torrus server, and avoids CPU usage peaks on network devices with big number
+of SNMP variables per device. It is recommended to analyse the current
+scheduler statistics before using this feature. If you run several large
+datasource trees, don't forget to plan and analyse the schedules for the whole
+system, not just for one tree.
+
+
+=head2 Distributed setup
+
+=head3 NFS-based setup
+
+The following setup allows you to distribute the load among several
+physical servers.
+
+Several Torrus (backend) servers which run collectors
+and store RRD files in the local storage, shared by NFS.
+The frontend server runs the Web interface, and probably some monitor
+processes, accessing the data files by NFS.
+
+It is possible to organize the directory structure so that each data file
+would be seen at the same path on every server. Then you can keep identical
+Torrus configurations on all servers, and launch the collector process only on
+one of them. XML configuration files may be shared via NFS too.
+
+Be aware that BerkeleyDB database home directory cannot be NFS-mounted.
+See the following link for more details:
+http://www.sleepycat.com/docs/ref/env/remote.html
+
+Backend servers may run near the limits of their system capacities.
+70-80% CPU usage should not be a problem. For the frontend machine,
+it is preferred that at least 50% of average CPU time is idle.
+
+
+=head1 Authors
+
+Copyright (c) 2004-2005 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
+
+Copyright (c) 2004 Christian Schnidrig E<lt>christian.schnidrig@bluewin.chE<gt>
diff --git a/torrus/doc/snmpdiscovery.pod.in b/torrus/doc/snmpdiscovery.pod.in
new file mode 100644 (file)
index 0000000..9b23382
--- /dev/null
@@ -0,0 +1,1115 @@
+#  Copyright (C) 2002-2009  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: snmpdiscovery.pod.in,v 1.1 2010-12-27 00:04:35 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 Torrus SNMP Discovery User Guide
+
+=head2 Introduction
+
+In many (but not only) cases Torrus is used for SNMP monitoring.
+It provides powerful tools which automate the process of devices' MIB
+discovery.
+
+The discovery tools consist of two programs: C<torrus devdiscover> performs
+the SNMP discovery, based on the discovery instructions XML file.
+The result of its work is a new Torrus datasource configuration file.
+Another utility, C<torrus genddx>, is a program that generates the
+basic discovery instructions file based on a set of commandline options.
+
+The device discovery XML, or as we call them DDX files, are usually
+resided in F<@siteconfdir@/discovery/> directory. This is the default
+path to search for them when the absolute path is not given.
+
+=head2 C<torrus genddx>: Discovery instructions generator
+
+  Usage: torrus genddx options...
+  Options:
+     --host=hostname         router hostname
+     --hostfile=filename     space-separated router hostnames file
+     --out=outfile           output file.         [routers.ddx]
+     --discout=filename      discovery output file [routers.xml]
+     --domain=domain         optional DNS domain name
+     --version=v             SNMP version         [2c]
+     --community=string      SNMP read community  [public]
+     --port=number           SNMP port            [161]
+     --retries=number        SNMP retries         [2]
+     --timeout=number        SNMP timeout         [10]
+     --subtree=string        Subtree name         [/Routers]
+     --datadir=path          data-dir parameter [@defrrddir@]
+     --holtwinters           Enable Holt-Winters analysis
+
+This utility generates C<devdiscover> instructions XML file (DDX) based on
+commandline options and a plain list of SNMP agents' hostnames.
+Hostnames are specified with one or many C<--host=hostname> options,
+or a plain text file with space-separated hostnames.
+
+Each host may have a symbolic name. This symbolic name is used as
+the host-level subtree name. The symbolic name follows the hostname with
+a semicolon.
+
+By default, the devices are placed into C</Routers/> subtree hierarchy.
+You may change the subtree name with the I<--subtree> option.
+Single slash as subtree name would cause host-level subtrees placed at the top
+of the datasources tree.
+
+By default, C<genddx> specifies the discovery output file as <routers.xml>,
+and it would be placed in site XML configuration directory.
+You most probably will change this by using the C<--discout> option.
+
+Examples:
+
+  torrus genddx --out=ch-langenthal.ddx \
+    --discout=ch-langenthal.xml \
+    --host=192.168.34.35:Langenthal_PE1 \
+    --host=192.168.34.36:Langenthal_PE2 \
+    --host=192.168.34.37:Langenthal_CE_Stadtverwaltung \
+    --community=blahBlah \
+    --subtree=/MPLS/CH/Bern/Langenthal
+
+  torrus devdiscover --in=ch-langenthal.ddx
+
+B<Note:> C<genddx> is designed as a one-time utility. You may run it to create
+a typical discovery file with basic set of options. Then the discovery
+configuration XML would be the primary source of information, and it should
+be maintained by manual editing, or by some other automated means.
+Alternatively you may use C<ttproclist> utility and generate highly customized
+discovery instruction files based on static templates and lists of SNMP nodes.
+See L<torrus_ttproclist(@mansec_usercmd@)> manpage for more details and
+examples.
+
+
+
+=head2 C<torrus devdiscover>: SNMP discovery tool
+
+  Usage: torrus devdiscover --in=filename.ddx options... [ddx files]
+  Options:
+   --in=filename.ddx       discovery instructions XML file(s)
+   --mkdir                 create data-dir directories
+   --limit=regexp          limit the discovery by output files
+   --forcebundle           always write the bundle file
+   --fallback=integer      maximum age of XML file to fall back to
+   --threads=integer       number of parallel discovery threads
+   --verbose               print extra information
+   --debug                 print debugging information
+   --snmpdebug             print SNMP protocol details
+
+This utility performs the SNMP discovery of devices listed in the input
+DDX file. The output XML file is the Torrus datasources configuration.
+Output file name is taken from C<output-file> parameter in the DDX.
+If the output file is not an absolute path, the file is placed
+in the site XML configuration directory (F<@sitexmldir@>).
+
+C<devdiscover> is accompanied by a number of MIB- or vendor-specific
+modules, each responsible for finding specific SNMP variables in
+the SNMP device, and for generating a piece of Torrus configuration XML
+file responsible for that specific MIB. The list of supported generic MIBs and
+vendors is constantly growing. It is quite easy to create new discovery
+modules, and the internals are documented in
+I<Torrus SNMP Device Discovery Developer's Guide>.
+
+The output file automatically includes all required prerequisite
+generic and vendor template definition files.
+
+Behaviour of C<devdiscover> is controlled by variables in
+F<@siteconfdir@/devdiscover-siteconfig.pl> file. Default values for
+those variables reside in F<@cfgdefdir@/devdiscover-config.pl>.
+
+For large installations, it is recommended to place RRD files into
+a hashed directory structure. You can enable this feature by setting
+
+  $Torrus::DevDiscover::hashDataDirEnabled = 1;
+
+in your F<devdiscover-siteconfig.pl> file.
+Then launching C<devdiscover> with C<--mkdir> option would automatically
+create the subdirectories inside C<data-dir>.
+
+The XML files produced by C<devdiscover> may be automatically changed
+with some local site-specific scripts. See XUpdate usage example in
+I<Torrus User Guide>.
+
+
+=head2 DDX, the discovery instructions file
+
+The input file for C<devdiscover> is an XML file. Its DTD is available
+in Torrus distribution in F<snmp-discovery.dtd>.
+
+A typical place to store the discovery XML is F<@siteconfdir@/discovery/>.
+
+Example:
+
+    <?xml version="1.0" encoding="UTF-8"?>
+    <snmp-discovery>
+      <file-info>
+        <format-version>
+    1.0
+        </format-version>
+      </file-info>
+      <creator-info>
+    Torrus version 0.1.4d
+    This file was generated by command:
+    /usr/local/torrus-0.1/bin/genddx \
+     --discout=share/torrus/xmlconfig/myrouters.xml \
+     --community=blahblah  --host=10.0.0.1  --host=10.0.1.1
+    On Tue Dec  2 17:43:30 2003
+      </creator-info>
+      <param name="data-dir" value="@defrrddir@"/>
+      <param name="domain-name" value=""/>
+      <param name="host-subtree" value="/Routers"/>
+      <param name="output-file" value="myrouters.xml"/>
+      <param name="rrd-hwpredict" value="no"/>
+      <param name="snmp-community" value="blahblah"/>
+      <param name="snmp-port" value="161"/>
+      <param name="snmp-retries" value="2"/>
+      <param name="snmp-timeout" value="10"/>
+      <param name="snmp-version" value="2c"/>
+      <host>
+        <param name="snmp-host" value="10.0.0.1"/>
+        <param name="symbolic-name" value="10.0.0.1"/>
+      </host>
+      <host>
+        <param name="snmp-host" value="10.0.1.1"/>
+        <param name="symbolic-name" value="10.0.1.1"/>
+      </host>
+    </snmp-discovery>
+
+=head3 XML elements
+
+=over 4
+
+=item * C<snmp-discovery>
+
+Mandatory. The top-level element.
+
+=item * C<file-info>
+
+Mandatory. It must contain the element C<format-version>.
+
+=item * C<format-version>
+
+Mandatory. It must contain a format version currently
+supported by devdiscover. Currently supported version is C<1.0>.
+
+=item * C<creator-info>
+
+Optional. May contain the information about the file creator: a human author
+name, or a program.
+
+=item * C<param>
+
+Some parameters are mandatory. This element defines a global or host-specific
+parameter. Mandatory attribute C<name> identifies the parameter,
+and the value is taken eother from C<value> attribute, or from the
+textual content of the element.
+
+C<param> element should be the child element of C<snmp-discovery> for global
+parameters or C<host> for host-level parameters. Host-level parameters
+override the values of global parameters.
+
+These parameters are for C<devdiscover> only. They are not Torrus configuration
+parameters, although some of them are directly copied into the generated
+configuration file.
+
+=item * C<host>
+
+Mandatory. Defines a host to run SNMP discovery.
+
+=back
+
+
+=head3 Common parameters
+
+=over 4
+
+=item * C<collector-period>, C<collector-timeoffset>,
+C<collector-dispersed-timeoffset>, C<collector-timeoffset-min>,
+C<collector-timeoffset-max>, C<collector-timeoffset-step>,
+C<monitor-period>, C<monitor-timeoffset>
+
+Optional. When defined, these parameters override those from C<snmp-defaults>
+template in F<snmp-defs.xml>.
+
+=item * C<output-file>
+
+Mandatory. Specifies the output filename for generated Torrus configuration.
+If it's a relative path, the file is placed in F<@sitexmldir@> directory.
+
+=item * C<output-bundle>
+
+Optional. Specifies a comma-separated list of XML file names for bundle
+output. Each bundle file will contain E<lt>includeE<gt> statement for each
+corresponding C<output-file>.
+
+=item * C<snmp-ipversion>, C<snmp-transport>, C<snmp-port>,
+        C<snmp-community>,  C<snmp-version>, C<snmp-timeout>,
+        C<snmp-retries>, C<snmp-host>, C<snmp-username>, C<snmp-authkey>,
+        C<snmp-authpassword>, C<snmp-authprotocol>, C<snmp-privkey>,
+        C<snmp-privpassword>, C<snmp-privprotocol>
+
+Mandatory SNMP session parameters. Authentication parameters depend on the
+SNMP version used. See the I<XML Configuration Guide> for details.
+These parameters define the SNMP agent properties and are
+copied one-to-one to the output configuration.
+
+=item * C<domain-name>
+
+Optional. Defines a DNS domain name to be appended to C<snmp-host>.
+
+=item * C<snmp-localaddr> and C<snmp-localport>
+
+Optional parameters specifying the local socket binding address and port.
+
+=item * C<data-dir>
+
+Mandatory. Defines the directory path where RRD files for this host
+are stored. In case if hashed directories are enabled, C<data-dir> specifies
+the base path under which the hashed subdirectories are created.
+
+=item * C<symbolic-name>
+
+Optional. Determines the host-specific subtree name. If not specified,
+the subtree is named by C<system-id>, or by C<snmp-host> if system ID is
+not defined.
+
+=item * C<system-id>
+
+Optional. If defined, it overrides the default value of system ID, which
+is equal to the value of C<snmp-host>.
+
+=item * C<nodeid-device>
+
+Optional. Defines the host-specific reference for I<nodeid>. Default value
+is equal to C<system-id>.
+
+=item * C<snmp-oids-per-pdu>
+
+Optional. When defined, these parameters overwrites the value from the
+template and vendor-specific discovery modules.
+
+=item * C<snmp-check-sysuptime>
+
+Optional. Default: C<yes>. Devdiscover sets this parameter to C<no> when it
+finds SNMPv2-MIB::sysUpTime variable unavailable in the device.
+
+=item * C<snmp-max-msg-size>
+
+Optional. If defined, it sets the SNMP maximum message size different from
+default. The default value is 1470 (defined in Net::SNMP).
+
+=item * C<host-subtree>
+
+Optional. Defines the datasourse tree path under which the host-specific
+subtree is created.
+
+=item * C<rrd-hwpredict>
+
+Optional. Valid values: C<yes>, C<no>. Determines if Holt-Winters forecasting
+should be enabled for the given host.
+
+=item * C<disable-devtypes>
+
+Optional. Comma-separated list of discovery device types that need to be
+excluded from discovery process. For example, ATMEL appliances conflict with
+Empire SystemEdge MIBs, and you need to disable C<EmpireSystemedge> module
+in order to run the discovery on those appliances.
+
+=item * C<only-devtypes>
+
+Optional comma-separated list of device types. If defined, only the specified
+types will be used for device probing.
+
+=item * C<host-aliases>
+
+Optional comma-separated list of alias paths for a given host. Aliases
+must be unique for each host.
+
+=item * C<custom-host-templates>
+
+Optional comma-separated list of template names that will be applied
+to the resulting XML configuration at the host level.
+
+=item * C<include-files>
+
+Optional comma-separated list of XML files that will be listed in C<include>
+statements in the resulting XML output.
+
+
+=item * C<host-copy-params>
+
+Optional comma-separated list of parameter names that should be copied
+from the discovery configuration file to the generated Torrus configuration
+at the host level.
+
+=item * C<selectors>
+
+Optional comma-separated list of object selectors. They are explained in more
+detail below.
+
+=item * C<disable-snmpcollector>
+
+When set to C<yes>, this parameter disables SNMP collection for this
+host. It is useful for creating custom views, in conjunction with
+C<RFC2863_IF_MIB::only-interfaces> parameter.
+
+=item * C<define-tokensets>
+
+Semicolon-separated (;) list of pairs of tokenset names and descriptions.
+Each tokenset name is followed by colon (:) and the description text:
+
+  <param name="define-tokensets">
+    important-graphs: Important Graphs;
+    unimportant-graphs: Unimportant Graphs
+  </param>
+
+=item * C<suppress-legend>
+
+if set to C<yes>, the legend is not shown. It usually has uptime,
+software version, and contact information for the SNMP device.
+
+=item * C<comment>
+
+Sets the comment string for the host.
+
+=item * C<show-recursive>
+
+Default: C<yes>. When set to C<no>, the link to the recursive view at the
+host level is omitted.
+
+=item * C<template-registry-overlays>
+
+If defined, this should be a comma-separated list of template registry
+entries that override the default template references. The overlaying
+templates should be referred in
+C<%Torrus::DevDiscover::templateOverlays>.
+For example, we want to redefine the interface counter template. Then
+in the DDX file, we set
+
+  <param name="template-registry-overlays" value="my_ifcounters"/>
+
+Then in F<devdiscover-siteconfig.pl> we set 
+
+  %Torrus::DevDiscover::templateOverlays = {
+      'my_ifcounters' => {
+          'RFC2863_IF_MIB::iftable-octets' => {
+             'name'   => 'my-iftable-octets',
+             'source' => 'mycustom-rfc2863.if-mib.xml'
+             },
+         'RFC2863_IF_MIB::ifxtable-hcoctets' => {
+             'name'   => 'my-ifxtable-hcoctets',
+             'source' => 'mycustom-rfc2863.if-mib.xml'
+             },
+         }};
+
+
+=back
+
+
+=head3 Parameters for C<RFC2863_IF_MIB>
+
+This discovery module is responsible for agent's interfaces table and
+interface counters. Recognized optional parameters are:
+
+=over 4
+
+=item * C<RFC2863_IF_MIB::suppress-hc-counters>
+
+Some agents do not implement 64-bit counters correctly. When this parameter
+is set to C<yes>, 64-bit interface counters are not used for the host.
+For Cisco IOS devices, the C<CiscoIOS> discovery module tries to detect
+such situation automatically.
+
+=item * C<RFC2863_IF_MIB::subtree-name>
+
+Defines the child subtree name within host-level subtree where interface
+counters are located. Default: C<Interface_Counters>.
+
+=item * C<RFC2863_IF_MIB::subtree-comment>
+
+Defines the comment string for interface counters subtree.
+Default: I<Interface traffic and error counters>.
+
+=item * C<RFC2863_IF_MIB::list-admindown-interfaces>
+
+If set to C<yes>, interfaces with ifAdminStatus set to other than up(1)
+are included in the discovery results.
+By default, such interfaces are not listed.
+
+=item * C<RFC2863_IF_MIB::list-notpresent-interfaces>
+
+If set to C<yes>, the interfaces with ifOperStatus status set to notPresent(6)
+are included in the discovery results. By default, such interfaces are
+not listed.
+
+=item * C<RFC2863_IF_MIB::exclude-down-interfaces>
+
+If set to C<yes>, the interfaces with ifOperStatus equal to down(2)
+are excluded from the discovery results.
+
+=item * C<RFC2863_IF_MIB::exclude-interfaces>
+
+Comma-separated list of interface names which should be excluded from
+configuration. Spaces are allowed between the names and commas.
+The names should be the ones that are used for interface subtrees.
+
+=item * C<RFC2863_IF_MIB::only-interfaces>
+
+If defined, this parameter specifies the list of interfaces that will be
+included in the discovery results. The names should match the interface
+subtree names. Caution: if specified incorrectly, this parameter may
+disable discovery for all interfaces on a device.
+
+=item * C<RFC2863_IF_MIB::tokenset-members>
+
+This parameter defines which interfaces' C<InOut_bps> leaves to add to
+which tokensets. The value is a semicolon-separated (;) list of
+entries of form I<tset:interface,interface>, where I<tset> is a name of the
+tokenset, and the I<interface> is the subtree name of the corresponding
+interface. The token sets must be defined elsewhere in Torrus configuration.
+Example:
+
+  <host>
+    <param name="snmp-host" value="192.168.49.131"/>
+    <param name="RFC2863_IF_MIB::tokenset-members">
+     clusters: 10_1, 10_2;
+     uplinks: 1_1, 1_2
+    </param>
+  </host>
+
+Alternatively, this parameter can be defined at the global level,
+and then each interface should be pretended by the SNMP host name (the same as
+in C<snmp-host> parameter) and slash sign (/):
+
+    <param name="RFC2863_IF_MIB::tokenset-members">
+     clusters: RTR01/Ethernet0_0, RTR01/FastEthernet2_1;
+    </param>
+
+
+=item * C<RFC2863_IF_MIB::copy-params>
+
+Optional comma-separated list of parameter names that would be copied
+to the output Torrus configuration at interface level.
+For each parameter I<param>, the value for a particular interface I<intf>
+will be taken from parameter C<RFC2863_IF_MIB::I<param>::I<intf>> in
+the discovery configuration file. Example:
+
+  <host>
+    <param name="snmp-host" value="192.168.49.131"/>
+    <param name="RFC2863_IF_MIB::copy-params" value="intf-error-threshold"/>
+    <param name="RFC2863_IF_MIB::intf-error-threshold::10_1" value="300"/>
+    <param name="RFC2863_IF_MIB::intf-error-threshold::2_1" value="900"/>
+  </host>
+
+=item * C<RFC2863_IF_MIB::ifindex-map-hint>
+
+Optional. For a device that doesn't have a corresponding vendor-specific
+discovery module, this parameter would advice C<devdiscover> how to build
+C<ifTable> index mapping. By default, the interfaces are mapped by
+C<ifDescr> variables. For many vendors, this would not give reliable
+mapping. Valid values are: C<ifName>, C<ifPhysAddress>, and C<ifIndex>.
+The first two suggest the mapping by corresponding SNMP variables, and
+the third one should be used for devices with fixed C<ifIndex> layout: in
+this case, the C<ifIndex> values are recorded as they are at the moment of
+discovery. This option is ignored if the device is supported by a vendor
+specific discovery module.
+
+=item * C<RFC2863_IF_MIB::subtree-name-hint>
+
+Optional. By default, per-interface subtrees are named after the values of
+C<ifDescr> SNMP variables. If this option is set to C<ifName>, this
+SNMP variable would be used for subtree naming. This option is ignored if
+the device is supported by a vendor specific discovery module.
+
+=item * C<RFC2863_IF_MIB::nodeid-hint>
+
+Optional. By default, per-interface I<nodeid> is derived from
+C<RFC2863_IF_MIB::ifindex-map-hint>. This parameter can change the
+reference table for nodeid. Valid values are:
+C<ifDescr>, C<ifName>, C<ifAlias>, C<ifIndex>.
+
+
+=item * C<RFC2863_IF_MIB::noout>
+
+If set to C<yes>, all the interface statistics are skipped from
+the XML configuration output. Still the interface table is examined and
+the results may be used by other discovery modules.
+
+=item * C<RFC2863_IF_MIB::bandwidth-usage>
+
+If set to C<yes>, the bandwidth usage percentage will be shown for those
+interfaces where two parameters are defined (in megabits per second):
+C<bandwidth-limit-in> and C<bandwidth-limit-out>. These interface
+parameters may be set by C<RFC2863_IF_MIB::bandwidth-limits> discovery
+parameter, or by selectors with the action C<Parameters>, or by
+setting C<RFC2863_IF_MIB::copy-params>.
+
+=item * C<RFC2863_IF_MIB::bandwidth-limits>
+
+Defines the values (in megabits per second) for C<bandwidth-limit-in> and
+C<bandwidth-limit-out> interface parameters. Semicolon-separated list
+of (I<Inteface name>:I<Input limit>:I<Output limit>) values, for example:
+
+  <host>
+    <param name="snmp-host" value="10.1.1.5"/>
+    <param name="symbolic-name" value="bsr2k.example.net"/>
+    <param name="output-file" value="bsr2k.example.net.xml"/>
+    <param name="RFC2863_IF_MIB::bandwidth-usage" value="yes" />
+    <param name="RFC2863_IF_MIB::bandwidth-limits">
+      ethernet0_0:10:10; ethernet0_1:20:20;
+    </param>
+  </host>
+
+
+=item * C<RFC2863_IF_MIB::traffic-summaries>,
+C<RFC2863_IF_MIB::traffic-XXX-path>, C<RFC2863_IF_MIB::traffic-XXX-comment>,
+C<RFC2863_IF_MIB::traffic-XXX-interfaces>
+
+Defines traffic summary graphs. A summary graph presents a sum of
+traffic from several interfaces. The interfaces can belong to different
+hosts, but then these hosts should have the same C<output-file> parameter
+value. C<RFC2863_IF_MIB::traffic-summaries> defines a list of summary names,
+C<RFC2863_IF_MIB::traffic-XXX-path> specifies the full path in the
+datasource tree to display the graph, optional
+C<RFC2863_IF_MIB::traffic-XXX-comment> defines a descriptive comment
+for the graph, and C<RFC2863_IF_MIB::traffic-XXX-interfaces> lists the
+interfaces that comprise this sum. The interfaces can be defined at the host
+level in the form C<name, name, ...> or at the global level in the form
+C<host/intf, host/intf, ...>. Example:
+
+  <param name="RFC2863_IF_MIB::traffic-summaries" value="sum1" />
+  <param name="RFC2863_IF_MIB::traffic-sum1-path" value="/Summary/Sum1" />
+  <param name="RFC2863_IF_MIB::traffic-sum1-comment" value="Test summary" />
+
+  <host>
+    <param name="snmp-host" value="router1.network.net"/>
+    <param name="RFC2863_IF_MIB::traffic-sum1-interfaces" 
+             value="GigabitEthernet0_2" />
+    <param name="output-file" value="TEST/core.xml"/>
+  </host>
+
+  <host>
+    <param name="snmp-host" value="router2.network.net"/>
+    <param name="RFC2863_IF_MIB::traffic-sum1-interfaces" 
+             value="GigabitEthernet1_0" />
+    <param name="output-file" value="TEST/core.xml"/>
+  </host>
+
+
+=back
+
+=head3 Other generic MIB parameters
+
+=over 4
+
+=item * C<RFC2790_HOST_RESOURCES::sysperf-subtree-name>
+
+Defines the child subtree name within host-level subtree where system CPU
+and memory statistics are located. Default: C<System_Performance>.
+
+=item * C<RFC2670_DOCS_IF::upstreams-only>
+
+If set to C<yes>, only the DOCSIS upstream statistics are enabled, and
+downstream and MAC layer stats are skipped.
+
+=back
+
+=head3 Vendor parameters
+
+=over 4
+
+=item * C<Arbor_E::disable-bundle-offer>,
+    C<Arbor_E::disable-bundle-offer-deny>,
+    C<Arbor_E::disable-bundle-offer-pktsize>,
+    C<Arbor_E::disable-bundle-offer-rate>,
+    C<Arbor_E::disable-bundle-offer-subcount>, C<Arbor_E::disable-flowdev>,
+    C<Arbor_E::enable-bundle-name-rrd>,
+    C<Arbor_E::disable-e30-buffers>, C<Arbor_E::disable-e30-bundle>,
+    C<Arbor_E::disable-e30-cpu>,
+    C<Arbor_E::disable-e30-fwdTable>,
+    C<Arbor_E::disable-e30-fwdTable-login>,
+    C<Arbor_E::disable-e30-hdd>, C<Arbor_E::enable-e30-hdd-errors>,
+    C<Arbor_E::disable-e30-hdd-logs>, C<Arbor_E::disable-e30-l2tp>,
+    C<Arbor_E::disable-e30-mem>, C<Arbor_E::enable-e30-mempool>,
+    C<Arbor_E::disable-e30-bundle>, C<Arbor_E::disable-e30-bundle-deny>, 
+    C<Arbor_E::disable-e30-bundle-rate>, C<Arbor_E::disable-e30-slowpath>
+
+When set to C<yes>, the corresponding statistics are included or excluded from
+the graphs.
+
+=item * C<Arbor_E::enable-e30-bundle-name-rrd>
+
+When set to C<yes>, the data will be written to filenames based on the name
+bundle instead of by the ID of the bundle.
+
+=item * C<Apple_AE::disable-clients-stats>
+
+When set to C<yes>, wireless client machines are not tracked.
+
+=item * C<CiscoGeneric::disable-cpu-stats>
+
+When set to C<yes>, Cisco CPU usage statistics are excluded from discovery.
+
+=item * C<CiscoGeneric::disable-memory-pools>
+
+When set to C<yes>, Cisco memory pool usage statistics are excluded from
+discovery. For Cisco series 7500, see the note in the
+I<Torrus Vendor Support List>.
+
+=item * C<CiscoGeneric::disable-sensors>
+
+When set to C<yes>, Cisco temperature sensors are excluded from discovery.
+
+=item * C<CiscoGeneric::use-fahrenheit>
+
+When set to C<yes>, Cisco temperature sensors are recorded and displayed
+in degrees Fahrenheit.
+
+=item * C<CiscoGeneric::file-per-sensor>
+
+When set to C<yes>, Cisco temperature sensor values are stored in
+a separate RRD file per sensor ID. This is useful for modular big routers
+like Cisco GSR.
+
+=item * C<CiscoGeneric::disable-psupplies>
+
+if set to C<yes>, Cisco power supply statistics are not collected.
+
+=item * C<CiscoGeneric::power-monitor>
+
+Name of the power supply monitor for Cisco devices.
+
+=item * C<CiscoIOS::enable-membuf-stats>
+
+When set to C<yes>, Cisco memory buffer statistics are included to the 
+discovery. Many IOS releases report faulty information, thus these
+stats are disabled by default.
+
+=item * C<CiscoIOS::disable-ipsec-stats>
+
+When set to C<yes>, IPSec statistics are excluded from discovery.
+
+=item * C<CiscoIOS::disable-bgp-stats>
+
+If set to C<yes>, BGP statistics are not included.
+
+=item * C<CiscoIOS::enable-vlan-interfaces>
+
+When set to C<yes>, the interfaces VlanXXX are added to statistics.
+By default they are not included, because some hardware platforms give
+irrelevant counter statistics.
+
+=item * C<CiscoIOS::enable-unrouted-vlan-interfaces>
+
+When set to C<yes>, the interfaces "unrouted Vlan XXX" are added to statistics.
+By default they are not included, because some hardware platforms provide
+no statistics for such interfaces.
+
+
+=item * C<CiscoCatOS::suppress-noname-ports>
+
+When set to C<yes>, only those Catalyst ports are included in configuration
+which have a port name (set up by C<set port name> command).
+
+=item * C<CiscoIOS_MacAccounting::bgponly>
+
+When set to C<yes>, Cisco MAC accounting statistics will be enabled for
+those MACs which correspond to BGP peers only.
+
+=item * C<bgp-as-description-NNNN>
+
+Specifies a description for an autonomous system number. Currently it's used
+with Cisco MAC accounting and Cisco BGP statistics only.
+
+=item * C<peer-ipaddr-description-AAA_AAA_AAA_AAA>
+
+Specifies a description for a peer by its IP address. Dots in IP address should
+be replaced with underscores. Currently it's used with Cisco
+MAC accounting and Cisco BGP statistics only.
+
+=item * C<CiscoIOS_MacAccounting::tokenset-members>
+
+Works the same way as C<RFC2863_IF_MIB::tokenset-members> and assigns MAC
+accounting peers to tokensets.
+
+=item * C<CiscoIOS::disable-car-stats>
+
+When set to C<yes>, the Committed Access Rate statistics are disabled
+from discovery.
+
+=item * C<CiscoIOS::disable-vpdn-stats>
+
+When set to C<yes>, the VPDN (Virtual Private Dial-up Network) statistics
+are disabled from discovery.
+
+=item * C<CiscoIOS::short-device-comment>
+
+If set to C<yes>, the Hw Serial and Revision strings are not shown in
+device comment.
+
+=item * C<CiscoSCE::disable-disk>, C<CiscoSCE::disable-gc>,
+    C<CiscoSCE::disable-qos>, C<CiscoSCE::disable-rdr>,
+    C<CiscoSCE::disable-subs>, C<CiscoSCE::disable-tp>
+
+If set to C<yes>, the corresponding statistics are excluded from Cisco SCE
+graphs.
+
+=item * C<FTOS::disable-cpu>, C<FTOS::disable-power>,
+    C<FTOS::disable-temperature>
+
+When set to C<yes>, disables the corresponding statistics category.
+
+=item * C<FTOS::use-fahrenheit>, C<FTOS::file-per-sensor>
+
+When set to C<yes>, enables the user of fahrenheit temperature, or writes
+multiple rrd files.
+
+=item * C<JunOS::disable-cos>, C<JunOS::disable-cos-red>,
+    C<JunOS::disable-cos-tail>, C<JunOS::disable-firewall>,
+    C<JunOS::disable-operating>, C<JunOS::disable-rpf>
+
+When set to C<yes>, disables the corresponding statistics category for JunOS
+devices.
+
+=item * C<Liebert::disable-temperature>, C<Liebert::disable-humidity>,
+    C<Liebert::disable-state>, C<Liebert::disable-stats>
+
+When set to C<yes>, disable the corresponding statistics category for Liebert
+devices.
+
+=item * C<Liebert::use-fahrenheit>
+
+When set to C<yes>, the temperature readings will be in fahrenheit.
+
+
+=item * C<NetBotz::temp-max>, C<NetBotz::humi-max>, C<NetBotz::dew-max>
+
+Set a numeric value for the maximum temperature, humidity, or dew point
+on NetBotz sensor graphs. The maximum is displayed with a dark red line.
+
+=item * C<Paradyne::slot-name>
+
+Mandatory for Paradyne DSLAM devices. It should uniquely identify
+the slot within the device. Any sequence of word characters is allowed.
+
+=back
+
+See also: I<Torrus Vendor Support List> for the list of supported MIBs and
+vendors.
+
+=head2 Object selectors
+
+Selectors are a common mechanism for applying customizations to
+some discovery objects. For example, you may want to apply a monitor
+to byte counters of interfaces that have a special word in the description.
+Or apply Holt-Winters prediction to a certain subset of interfaces.
+
+Selectors are defined in a DDX file as regular parameters.
+The parameter C<selectors> defines a list of selector names.
+Each selector is identifed by its name and type. The type of selector
+defines which objects will be searched: IF-MIB interfaces, or Cisco
+temperature sensors, or something else. The parameters are described
+below.
+
+=over 4
+
+=item * C<selectors>
+
+Comma-separated list of selector names. Further below we use C<S> as
+selector name, C<A> as attribute name, and C<T> as action name.
+
+=item * C<S-selector-type>
+
+Type of objects to be selected. Supported values are: C<RFC2863_IF_MIB>,
+C<CiscoCPU>, C<CiscoSensor>.
+
+=item * C<S-selector-expr>
+
+An RPN (reverse Polish notation) expression that defines the
+object attributes to be checked and relation between them. Attribute names
+should be specified in curly braces ({}). The rest of the syntax is described
+in I<RPN expressions in Torrus> guide. The attribute names are specific to the
+selector type and are described below.
+
+=item * C<S-A>
+
+For a given selector name C<S> and attribute name C<A>,
+this parameter defines the attribute value that should be compared
+to the object's properties. In most cases it defines a regular
+expression that should match the value of a corresponding object's
+property.
+
+=item * C<S-selector-actions>
+
+For a given selector name C<S>, this parameter defines a comma-separated
+list of actions to be applied for objects where C<S-selector-expr> returns
+true. The action names are specific to the selector type and are
+described below.
+
+=item * C<S-T-arg>
+
+For a given selector C<S> and action C<T>, this parameter defines
+an argument that should be passed to the action. Each action
+defines its own meaning of the argument.
+
+=back
+
+
+
+=head3 RFC2863_IF_MIB selector
+
+This type of selector selects the network interfaces on a SNMP device.
+The following attribute names are supported:
+
+=over 4
+
+=item * C<ifSubtreeName>, C<ifSubtreeName1>, ...
+
+Interface-level subtree name as you see it in the discovery results.
+You can compose a complex expression of subtree matches, by
+createing attributes with different numbers at the end.
+
+=item * C<ifComment>
+
+Comment string that is defined in C<comment> parameter. It is
+usually derived from an interface description.
+
+=item * C<ifType>
+
+Numeric IANA interface type, as returned by C<ifType> SNMP variable.
+
+=back
+
+C<ifType> is compared numerically.
+C<ifSubtreeName> and C<ifComment> are regular expressions.
+C<ifSubtreeName> accepts multiple expressions separated by space,
+and the selector matches if any of these expressions matches the subtree name.
+
+
+
+The following actions are supported:
+
+=over 4
+
+=item * C<InBytesMonitor>, C<OutBytesMonitor>
+
+The argument defines the monitor name to be applied to the input
+or output bytes counter.
+
+=item * C<InDiscardsMonitor>, C<OutDiscardsMonitor>,
+C<InErrorsMonitor>, C<OutErrorsMonitor>
+
+The argument defines the monitor name to be applied to discard and error 
+counters that are discovered for a given interface.
+
+=item * C<NotifyPolicy>
+
+The argument defines the value for C<notify-policy> parameter. See the manual
+for F<action_notify> for more details.
+
+=item * C<HoltWinters>
+
+No argument needed. This action enables Holt-Winters prediction
+for given interface's counters.
+
+=item * C<NoPacketCounters>, C<NoDiscardCounters>, C<NoErrorCounters>
+
+No argument needed. The action disables the packet, discard or error counters
+for a given interface to be collected.
+
+=item * C<TokensetMember>
+
+The argument is a comma-separated list of tokenset names where C<InOutBbs>
+graphs would be added. This action complements
+C<RFC2863_IF_MIB::tokenset-members>.
+
+=item * C<Parameters>
+
+The argument defines additional configuration parameters to be
+placed at the interface level. The value should be one
+or several C<param=value> pairs separated by semicolon (;).
+Parameters defined in C<RFC2863_IF_MIB::copy-params> may override
+the ones defined in this action.
+
+=item * C<InBytesParameters>, C<OutBytesParameters>
+
+Analagous to C<Parameters>, but the parameters are applied to InBytes and
+OutBytes leaves of the selected interface.
+
+=item * C<DocsisUpSNRMonitor>
+
+For a DOCSIS CMTS, this action assigns a new  monitor to the upstream
+Signal/Noise ratio gauge, instead of the default monitor.
+
+=item * C<DocsisUpSNRTokenset>
+
+For a DOCSIS CMTS, this action adds the Signal/Noise ratio graph to a
+specified tokenset.
+
+=item * C<DocsisUpFECCorMonitor>
+
+For a DOCSIS CMTS, this action assigns a monitor to the C<Correctable>
+counter of the upstream FEC statistics.
+
+=item * C<DocsisUpFECUncorMonitor>
+
+For a DOCSIS CMTS, this action assigns a monitor to the C<Uncorrectable>
+counter of the upstream FEC statistics.
+
+=item * C<DocsisDownUtilMonitor>
+
+For a DOCSIS CMTS, this action assigns a monitor to the downstream
+C<UsedBytes> counter.
+
+=item * C<DocsisMacModemsMonitor>
+
+For Cisco uBR, this action assigns a monitor to the C<Modems_Registered> gauge
+in the MAC layer stats.
+
+=item * C<DocsisUpUtilMonitor>, C<DocsisUpSlotsMonitor>
+
+For Cisco uBR, this action assigns a monitor to upstream utilization and
+free contention timeslots gauges correspondingly.
+
+=back
+
+
+=head3 CiscoCPU selector
+
+A selector of this type selects CPU statistics Cisco router or
+switch.
+
+The attributes supported are: C<CPUName> and C<CPUDescr>, and their
+values are regular expressions that should match the CPU name or description,
+as discovered by C<devdiscover>.
+
+The action supported is C<TokensetMember>, and its argument specifies
+the tokenset where to place the CPU statistics graph.
+
+
+=head3 CiscoSensor selector
+
+A selector of this type selects temperature sensors on a Cisco router or
+switch.
+
+The only attribute supported is C<SensorDescr>, and its value is a regular
+expression that should match the sensor description, as discovered
+by C<devdiscover>.
+
+Actions supported: C<Monitor>, C<TokensetMember>.
+
+
+=head3 ALU_SAP selector
+
+This selector type is designed for SAP entries in Alcatel-Lucent ESS and SR
+routers.
+
+Attributes supported: C<sapDescr> (regexp), C<custDescr> (regexp),
+C<sapName> (exact match), C<sapPort> (exact match).
+
+Actions supported: C<RemoveSAP> (excludes a selected SAP from the datasources).
+
+
+
+=head3 Examples
+
+The following example applies a monitor called C<temp60degrees> to all
+inlet sensors on a Cisco device:
+
+  <host>
+    <param name="snmp-host" value="router1"/>
+    <param name="output-file" value="router1.xml"/>
+    <param name="selectors" value="inlet"/>
+    <param name="inlet-selector-type" value="CiscoSensor"/>
+    <param name="inlet-selector-expr"  value="{SensorDescr}"/>
+    <param name="inlet-SensorDescr" value="Inlet"/>
+    <param name="inlet-selector-actions"  value="Monitor"/>
+    <param name="inlet-Monitor-arg" value="temp60degrees"/>
+  </host>
+
+The following example enables Holt-Winters prediction and specifies some
+parameters to all FastEthernet interfaces which have the string "SRV-ID"
+in their descriptions:
+
+  <host>
+    <param name="snmp-host" value="router2"/>
+
+    <param name="selectors"  value="FastEthHW"/>
+    <param name="FastEthHW-selector-type"     value="RFC2863_IF_MIB"/>
+
+    <param name="FastEthHW-selector-expr"    
+           value="{ifSubtreeName},{ifComment},AND"/>
+    <param name="FastEthHW-ifSubtreeName"     value="^FastEthernet"/>
+    <param name="FastEthHW-ifComment"         value="SRV-ID"/>
+
+    <param name="FastEthHW-selector-actions"
+           value="HoltWinters,Parameters"/>
+
+    <param name="FastEthHW-Parameters-arg"
+       value="rrd-create-hw-alpha=0.2; rrd-create-hw-beta=0.01"/>
+  </host>
+
+The following example sets up the monitors defined in
+F<examples/docsis-monitors.xml>:
+
+    <param name="selectors" value="docs"/>
+    <param name="docs-selector-type" value="RFC2863_IF_MIB"/>
+    <param name="docs-selector-expr"  value="{ifSubtreeName}"/>
+    <param name="docs-ifSubtreeName"  value="^Cable"/>
+    <param name="docs-selector-actions"> 
+          DocsisUpSNRMonitor,
+          DocsisUpFECCorMonitor,
+          DocsisUpFECUncorMonitor,
+          DocsisDownUtilMonitor,
+          DocsisMacModemsMonitor,
+          DocsisUpUtilMonitor,
+          DocsisUpSlotsMonitor,
+          InErrorsMonitor,
+          OutErrorsMonitor
+    </param>
+    <param name="docs-DocsisUpSNRMonitor-arg" 
+           value="docsis-snr-1,docsis-snr-2,docsis-snr-3"/>
+
+    <param name="docs-DocsisUpFECCorMonitor-arg" 
+           value="docsis-feccor-1,docsis-feccor-2"/>
+
+    <param name="docs-DocsisUpFECUncorMonitor-arg" 
+           value="docsis-fecuncor-1,docsis-fecuncor-2,docsis-fecuncor-3"/>
+
+    <param name="docs-DocsisDownUtilMonitor-arg" 
+           value="docsis-downutl-1,docsis-downutl-2,docsis-downutl-3"/>
+
+    <param name="docs-DocsisMacModemsMonitor-arg" 
+           value="docsis-modems-1,docsis-modems-2"/>
+
+    <param name="docs-DocsisUpUtilMonitor-arg" 
+           value="docsis-uputil-1,docsis-uputil-2,docsis-uputil-3"/>
+    
+    <param name="docs-DocsisUpSlotsMonitor-arg" 
+           value="docsis-upslots-1,docsis-upslots-2,docsis-upslots-3"/>
+    
+    <param name="docs-InErrorsMonitor-arg" 
+           value="docs-inerrors-1,docs-inerrors-2"/>
+
+    <param name="docs-OutErrorsMonitor-arg" 
+           value="docs-outerrors-1,docs-outerrors-2"/>
+
+
+
+=head1 Author
+
+Copyright (c) 2002-2005 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/stylingprofile.pod.in b/torrus/doc/stylingprofile.pod.in
new file mode 100644 (file)
index 0000000..b785330
--- /dev/null
@@ -0,0 +1,217 @@
+#  stylingprofile.pod - Guide to Styling Profiles
+#  Copyright (C) 2003 Shawn Ferry
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: stylingprofile.pod.in,v 1.1 2010-12-27 00:04:32 ivan Exp $
+# Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+#
+
+=head1 Torrus Styling Profile Guide
+
+=head2 Styling Profiles
+
+Styling profiles allow for symbolic names to be used in place of hard
+coded values for C<line-color> and C<line-style>.
+
+=head3 Schema Definitions
+
+The following styles are defined in the default schema.
+
+=over 3
+
+=item * Required Styles  (C<line-style>, C<line-color>)
+
+
+           SingleGraph            HWBoundary             HWFailure
+              HruleMin           HruleNormal              HruleMax
+                 BpsIn                BpsOut
+
+
+=item * Generic Symbolic styles (C<line-color> only)
+
+                    in                   out
+
+=item * Symbolic, Symbolic names, for default use in graphs that have up
+to ten items (C<line-color> only)
+
+                   one                   two                 three
+                  four                  five                   six
+                 seven                 eight                  nine
+                   ten
+
+=item * Symbolic names for combinatorial graphing (C<line-style>,
+C<line-color>)
+
+                  red1                  red2                  red3
+                  red4                green1                green2
+                green3                green4                 blue1
+                 blue2                 blue3                 blue4
+
+=item * Color definitions from the TT2 rgb example set (C<line-color> only)
+
+Defined in F<@supdir@/styling/colornames.pl>
+
+                 black                grey25                grey50
+                grey75                 white                   red
+                 red25                 red50                 red75
+                 green               green25               green50
+               green75                  blue                blue25
+                blue50                blue75                 blood
+               scarlet                  rose                orange
+                  leaf                   bud                  mint
+                marine                   sky                 mauve
+                 lilac
+
+=item * Color definitions for web html colors (C<line-color> only)
+
+Defined in F<@supdir@/styling/colornames.pl>
+
+             aliceblue          antiquewhite                  aqua
+            aquamarine                 azure                 beige
+                bisque        blanchedalmond            blueviolet
+                 brown             burlywood             cadetblue
+            chartreuse             chocolate                 coral
+        cornflowerblue              cornsilk               crimson
+                  cyan              darkblue              darkcyan
+         darkgoldenrod              darkgray             darkgreen
+             darkkhaki           darkmagenta        darkolivegreen
+            darkorange            darkorchid               darkred
+            darksalmon          darkseagreen         darkslateblue
+         darkslategray         darkturquoise            darkviolet
+              deeppink           deepskyblue               dimgray
+            dodgerblue             firebrick           floralwhite
+           forestgreen               fuchsia             gainsboro
+            ghostwhite                  gold             goldenrod
+                  gray           greenyellow              honeydew
+               hotpink             indianred                indigo
+                 ivory                 khaki              lavender
+         lavenderblush             lawngreen          lemonchiffon
+             lightblue            lightcoral             lightcyan
+  lightgoldenrodyellow            lightgreen             lightgrey
+             lightpink           lightsalmon         lightseagreen
+          lightskyblue        lightslategray        lightsteelblue
+           lightyellow                  lime             limegreen
+               magenta                maroon      mediumaquamarine
+            mediumblue          mediumorchid          mediumpurple
+        mediumseagreen       mediumslateblue     mediumspringgreen
+       mediumturquoise       mediumvioletred          midnightblue
+             mintcream             mistyrose              moccasin
+           navajowhite                  navy               oldlace
+                 olive             olivedrab             orangered
+                orchid         palegoldenrod             palegreen
+         paleturquoise         palevioletred            papayawhip
+             peachpuff                  peru                  pink
+                  plum            powderblue                purple
+             rosybrown             royalblue           saddlebrown
+                salmon            sandybrown              seagreen
+              seashell                sienna                silver
+               skyblue             slateblue             slategray
+                  snow           springgreen             steelblue
+                   tan                  teal               thistle
+                tomato             turquoise                violet
+                 wheat            whitesmoke                yellow
+
+=back
+
+=head3 Schema Overlay
+
+I<WARNING: Some styles are mandatory>
+
+Schema overlays allow the user to extend or override the styles defined in the
+default schema.  The schema overlays are formatted in the form of a hash of
+hashes.
+
+
+=over 4
+
+=item * Extending the schema:
+
+To add the styles, C<##onefish>, C<##twofish>, C<##redfish>, C<##bluefish>
+the following entries should be created in a descriptive file located
+in the C<styling> directory.
+
+C<fish-schema.pl>
+
+  $Torrus::Renderer::graphStyles{'onefish'}{'color'} = '##darkred';
+  $Torrus::Renderer::graphStyles{'onefish'}{'line'} = 'LINE1';
+
+  $Torrus::Renderer::graphStyles{'twofish'}{'color'} = '##red';
+  $Torrus::Renderer::graphStyles{'twofish'}{'line'} = 'LINE2';
+
+  $Torrus::Renderer::graphStyles{'redfish'}{'color'} = '##yellow';
+
+  $Torrus::Renderer::graphStyles{'bluefish'}{'color'} = '##deeppink';
+
+Other methods of adding to the hash of hashes are also acceptable.
+
+=item * Overriding Styles:
+
+To override specific styles in the existing schema, C<##in>, C<##out>,
+entries similar to the following should be created in a Perl file,
+preferably located in the local configuration directory.
+
+C<in_out-override-schema.pl>
+
+  $Torrus::Renderer::graphStyles{'in'}{'color'} = '##yellow';
+  $Torrus::Renderer::graphStyles{'out'}{'color'} = '##maroon';
+
+Other methods of adding to the hash of hashes are also acceptable.
+
+=item * Applying your Overlay
+
+=over 4
+
+=item 1.
+
+In the torrus-siteconfig.pl file, add the variable
+
+$Torrus::Renderer::stylingProfileOverlay = 
+    $Torrus::Global::cfgSiteDir . '/in_out-override-schema.pl';
+
+=item 2.
+
+Restart apache
+
+=back
+
+You may have to wait for the image cache to clear before the changes
+take effect.
+
+=back
+
+=head3 Schema Replacement
+
+To replace a schema, create a new schema using torrus-schema.pl as a guide.
+Remember some styles are mandatory.
+
+=over 4
+
+=item * Applying your Schema
+
+In the F<torrus-siteconfig.pl> file, add the variable
+
+  $Torrus::Renderer::stylingProfile = "Your-schema";
+
+=item 2. Restart apache
+
+=back
+
+You may have to wait for the image cache to clear before the changes
+take effect.
+
+=head1 Author
+
+Copyright (c) 2003 Shawn Ferry
diff --git a/torrus/doc/userguide.pod.in b/torrus/doc/userguide.pod.in
new file mode 100644 (file)
index 0000000..1e170c9
--- /dev/null
@@ -0,0 +1,869 @@
+#  userguide.pod - Torrus user guide
+#  Copyright (C) 2003  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: userguide.pod.in,v 1.1 2010-12-27 00:04:32 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 Torrus User Guide
+
+
+=head2 Quick start guide
+
+The steps below will explain you how to make the thing running.
+
+B<Install Torrus>. Follow the I<Torrus Installation Instructions> document,
+all prerequisits and necessary steps are described there.
+
+B<What is where>. The executables reside in 
+F<@pkgbindir@/>. You normally don't need to access this
+directory, because the commandline wrapper, C<torrus>, is installed
+in a usual execution path (F<@bindir@>).
+All site-specific behaviour is controlled by
+configuration files in F<@siteconfdir@/>.
+Usually you need to change F<torrus-siteconfig.pl> only. In this file, you
+must list your XML configuration sources. The datasource trees configuration
+is read out of XML files. They are searched in several directories,
+normally F<@distxmldir@/> and F<@sitexmldir@/>. The first one contains
+files that come with Torrus distribution, and the second one is for your local
+site-specific XML files. Global site-specific XML configuration parameters
+may be defined in F<site-global.xml>.
+XML configuration is compiled into internal database representation
+by C<torrus compilexml> command. The database itself is resided in
+F<@dbhome@/>, and must be writable by your Apache server
+(normally the installer takes care of it). It is safe to re-compile the
+configuration while the Torrus daemons are running.
+
+B<The datasource trees>. Torrus configuration consists of a number of I<trees>.
+Each tree is independent from the others. A tree may run one Collector and
+one Monitor process. Also the web interface access control lists
+differentiate the user rights by datasource trees.
+
+B<Inside the tree>. A tree defines the hierarchy of Torrus datasources.
+The structure of the tree is solely defined by XML configuration files.
+The tree consists of I<nodes>, each being either a I<subtree> or a I<leaf>.
+Subtrees contain child subtrees and/or leaves. The leaf represents a
+datasource: normally this is a numerical value that changes over time.
+The leaf is the entity that may be presented as a graph.
+There are leaves of special type: I<multigraph>.
+They are not numerical values, and are designed for
+drawing several values in one graph. Each node has I<path>, a
+string that consists of slashes and node names, and uniquely identifies this
+node. The path of a subtree always ends with slash, and the root of the tree
+has the path consisting of a single slash.
+
+B<Trees configuration>. The trees are defined in F<torrus-siteconfig.pl>.
+See I<Torrus Installation Instructions> for a basic example of tree
+configuration.
+
+B<Round-robin databases>. Currently only one type of data storage is
+supported: Round-robin database (RRD) files. See I<RRDtool> manuals
+for more details. Each leaf represents a datasource stored in an
+RRD file. Of course, several leaves may refer to different datasources within
+the same RRD file. Even more, more than one leaf may refer to the same
+datasource within an RRD file. RRD files are created and updated either by
+C<collector>, or by some other external programs.
+
+B<Define the targets>. If you only want to collect SNMP counters
+from some network devices' interfaces, there's a couple of tools
+called C<torrus genddx> and C<torrus devdisover>.
+The first one creates a basic discovery instructions file, and the second
+one uses the discovery instructions to explore the SNMP device capabilities
+and information: interface names, input/output counters,
+CPU and memory usage, temperature sensors (for Cisco devices), and many
+other vendor-specific statistics sources.
+
+Torrus is much more than just an SNMP collector. So, when you decide
+to use it in a more advanced way, you will have to read the whole bit of
+this guide, and also I<Torrus XML Configuration Guide> and probably some
+other documents too.
+
+B<Build the hierarchy>. By default, C<torrus genddx> will put all your
+devices into one hierarchy: C</Routers/E<lt>hostnameE<gt>/...>.
+The subtree name, C<Routers>, may be changed with a command line option
+of C<torrus genddx>. This program may also read the device names
+(or IP addresses in case if you don't use DNS) from space-delimited text files.
+
+  torrus genddx \
+    --hostfile=myrouters.txt \
+    --domain=example.net \
+    --community=MySecretSNMPCommunity \
+    --out=myrouters.ddx \
+    --discout=myrouters.xml \
+    --subtree=/My_Routers \
+    --datadir=/data1/torrus/collector_rrd
+
+  torrus genddx \
+    --hostfile=myswitches.txt \
+    --domain=example.net \
+    --community=MySecretSNMPCommunity \
+    --out=myswitches.ddx \
+    --discout=myswitches.xml \
+    --subtree=/My_Switches \
+    --datadir=/data1/torrus/collector_rrd
+
+  torrus devdiscover  --in=myrouters.ddx
+
+  torrus devdiscover  --in=myswitches.ddx
+
+In the example above, the routers' and switches' names are read from
+F<myrouters.txt> and F<myswitches.txt> in the user's current directory.
+They form a hierarchy with two subtrees: C</My_Routers/> and C</My_Switches/>.
+C<genddx> creates the discovery instruction XML files into
+F<myrouters.ddx> and F<myswitches.ddx> accordingly. By default,
+you would find them in F<@sitedir@/discovery/>.
+The result of C<devdiscover> is the Torrus configuration files:
+F<myrouters.xml> and F<myswitches.xml>, placed into
+F<@sitexmldir@/>. The C<collector> will place the
+RRD files into F</data1/torrus/collector_rrd>. Make sure that this directory
+exists, has enough free space, and is writable by C<torrus> user.
+
+B<Note:> the C<genddx> utility is designed as a one-time helper, so
+that you create your basic discovery instructions files from scratch.
+Further on, the discovery files should be maintained separately.
+
+Another useful utility is called C<ttproclist>. It can be used to generate 
+a DDX file from a template and a list of SNMP hosts. It is very useful if
+you want to monitor many devices of similar type or function.
+
+You can also define a I<bundle> file in your DDX file. C<Genddx> will
+create it after all devices would discovered, and it will contain 
+E<lt>includeE<gt> statements for all XML files. This makes it practical to
+use one XML file per SNMP host, and use the bundle file for inclusion
+in the tree configuration.
+
+B<Add your XML files to the tree configuration>. For each tree,
+F<@siteconfdir@/torrus-siteconfig.pl> lists the XML files that have to be
+compiled for it. In the example above, you would add F<myrouters.xml> and
+F<myswitches.xml> into C<xmlfiles> array in the tree configuration.
+
+See I<Torrus SNMP Discovery User Guide> for more details on how
+C<genddx> and C<devdisover> interact and how you can customize
+the discovery process.
+
+B<Tip>: in most cases, your hierarchy division will be different.
+It might be arranged by geographical locations, or by customer names.
+There is a configuration statement that allows you to include other
+XML files into configuration, thus giving you a big flexibility
+in building the data hierarchies.
+
+B<Compile the configuration>. After the XML configuration is prepared, 
+you need to execute the compiler:
+
+  torrus compile --tree=treename --verbose
+
+For most of the processes that you run within Torrus, you need to specify
+the tree name with C<--tree> option. Some proramms accept C<--all> option,
+which causes them to process all existing trees.
+With C<--verbose> option, the compiler tells you about the files being
+processed, and about some other actions that may take quite a long time.
+It will also tell you if there's any error in your configuration.
+
+B<Build the search database>. The search database is updated by executing
+the following command:
+
+  torrus bs --global --verbose
+
+For users that are allowed to display all the trees, you can enable the
+global search across all trees:
+
+  torrus acledit --addgroup=staff --permit=GlobalSearch --for='*'
+
+B<Launch the collector>. Assuming that compilation went smoothly,
+you may now launch the data collector:
+
+  torrus collector --tree=treename
+
+Without additional options, the collector will fork as a daemon
+process, and write only error messages in its log file,
+F<@logdir@/collector.treename.log>.
+
+There is a file that is created by C<./configure>, called F<init.d/torrus>.
+You may place it into a directory where your system looks for startup scripts
+(F</etc/init.d/> on Solaris and some Linuxes, F</usr/local/etc/rc.d/>
+on FreeBSD). Probably you need to rename and edit the script before using.
+Note that it also executes another daemon, C<monitor>.
+
+The C<monitor> daemon is used for monitoring the thresholds in the
+data files. For more details, see the I<Torrus XML configuration guide>,
+in the section about monitor definitions.
+
+B<Define the ACLs>. By default, user authentication is enabled in the web
+interface. You can change this by setting
+C<$Torrus::CGI::authorizeUsers = 0> in your F<torrus-siteconfig.pl>.
+In order to get use of user authentication, you need to create I<groups>
+and I<user> accounts. Each user belongs to one or more groups, and each group
+has access to a set of datasource trees. See
+I<Torrus Installation Instructions> for a basic example.
+
+B<Browse with your browser>. Provided that you followed the
+installation guide to the end, and your HTTP server is running,
+your Torrus hierarchy must be visible  with your favorite web browser.
+
+
+=head2 Configuration guidelines
+
+In complete detail, the XML configuration is described in
+I<Torrus XML Configuration Guide>. The guidelines below will help
+you to read that document.
+
+B<Tree structure>. The tree structure is defined by the structure of
+C<E<lt>subtreeE<gt>> and C<E<lt>leafE<gt>> XML elements. The rule is simple:
+child XML elements of a C<E<lt>subtreeE<gt>> element define the child
+nodes in the configuration tree.
+
+B<Parameters>. Each node has a number of parameters. They are defined
+by C<E<lt>paramE<gt>> XML element. Parameters are inherited:
+the child node has all its parent's parameters, some of which may be
+overridden.
+
+B<Additive configuration>. The whole XML configuration is additive.
+It means that you may define your subtree several times across
+your XML configuration, and the new parameters and child nodes will
+be added to previously defined ones.
+
+B<Templates>. Some pieces of configuration may be written as templates,
+and then re-used in multiple places.
+
+The C<configsnapshot> utility generates one large XML file back from
+the compiled configuration. Its main purpose is backup of the configuration,
+but it can also be used for studying the relationships between templates
+and input files.
+
+=head2 Handling SNMP errors
+
+During SNMP discovery process, some SNMP devices may not be reachable.
+By default, C<devdiscover> reports the error, and does not write the output
+XML file containing that device. It also skips writing the bundle files that
+contain the output file affected.
+
+When C<devdiscover> is executed with C<--forcebundle> option, the bundle
+files are written, and the output files related to the unreachable
+devices are skipped from the bundles. This ensures that we always get
+a configuration that may compile and run the collector.
+
+Another option, C<--fallback=DAYS>, if given together with C<--forcebundle>,
+tells the discovery engine to reuse old XML files if the related SNMP devices
+are not reachable and the files are not older than DAYS.
+
+If an SNMP device is unreachable by the moment of the collector initialization,
+the collector reports the error and waits for a period of time specified in
+C<$Torrus::Collector::SNMP::unreachableRetryDelay>, which is 10 minutes by
+default. It then tries to reach the device with the specified retry interval
+during some period of time, defined in
+C<$Torrus::Collector::SNMP::unreachableTimeout>, by default 6 hours.
+If the device is not available within the specified timeout, it is excluded
+from collection. It would be tried again on collector initialization
+only (at the collector process start or after recompiling the configuration).
+
+If a device is not reachable during the normal collector running cycle,
+it is retried in every collector's cycle (usually every 5 minutes),
+during the period defined in C<$Torrus::Collector::SNMP::unreachableTimeout>.
+It will be then excluded from configuration after the timeout.
+
+If a device hardware configuration changes after the C<devdiscover>
+execution, the collector may not find some values in SNMP tables,
+such as interface names in ifTable. It then excludes such datasources from
+collection immediately.
+
+
+
+
+=head2 Tips and tricks
+
+
+=head3 Comments, descriptions, and legends
+
+C<torrus devdiscover> will extract some useful information from
+your SNMP devices, and place it in the XML configuration:
+
+=over 4
+
+=item * Interface descriptions
+
+The value of the SNMP variable C<ifAlias> (C<1.3.6.1.2.1.31.1.1.1.18>)
+will be used as interface comment. In Cisco IOS, this is controlled by
+C<description> interface configuration command.
+
+=item * Location and contact
+
+Two other SNMP values: C<sysLocation> (C<1.3.6.1.2.1.1.6.0>) and
+C<sysContact> (C<1.3.6.1.2.1.1.4.0>) will be used in the legend text
+for each device. In Cisco IOS, their values are controlled by
+C<snmp-server location> and C<snmp-server contact> global configuration
+commands.
+
+=back
+
+
+=head3 Grouping the datasources alternatively
+
+In most cases, you would want to have several different groupings of
+your datasources.
+
+For instance, the default C<devdiscover> gives only one level of freedom:
+the subtree name above the host level. It's reasonable to use this name for
+grouping by geographical location . Thus, the hierarchy
+would be characterised as
+C</[location]/[hostname]/[interface]/[counter]>.
+
+Let's say you would like to have alternative grouping, such as:
+
+=over 4
+
+=item * by customer connection:
+
+Each customer is identified by name, and you'd like to see statistics
+for all interfaces connected to a given customer;
+
+=item * by service:
+
+Your network is designed to provide various services, and you'd like to
+group your devices or interfaces by service;
+
+=item * by customer and location:
+
+For each customer, group the connection by geographical location.
+
+=back
+
+Torrus provides three different ways for organising your datasources:
+
+=over 4
+
+=item * Aliases.
+
+With C<E<lt>aliasE<gt>> statement, you can add symbolic names to your
+nodes. If the new alias is defined as a reference to non-existing subtree,
+the new subtrees are created. Alias is only a symbolic link: when you click
+to the alias name in your browser, Torrus redirects it to the real datasource
+in its normal subtree. See the example in I<Torrus XML Configuration Guide>.
+
+=item * ds-type=rrd-file
+
+You can create a leaf in some arbitrary place of your hierarchy that
+points to an existing RRD file. This RRD file may be updated by
+other datasource in your hierarchy. The advantage of such approach is
+that this leaf may have its own I<legend> and I<comment> parameters,
+alternative view parameters, etc.
+
+    <leaf name="FoobarIn">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="data-file"         value="rtr01_Fa0_1.rrd" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="rrd-ds"            value="locIfInBitsSec" />
+      <param name="comment"
+             value="Foobar input traffic"/>
+      <param name="graph-legend"      value="Bits in" />
+      <param name="legend">
+         Switch name: rtr01; Interface: Fa0/1;
+      </param>
+    </leaf>
+
+In the example above, this leaf is defined somewhere in the hierarchy.
+It refers to the RRD file updated by Torrus SNMP collector.
+For more examples, see the template I<read-cisco-interface-counters>
+in F<vendor/cisco.ios.xml>.
+
+=item * Tokensets
+
+Tokenset is an arbitrary collection of datasource leaves. It is characterised
+by its name and description. There are two ways to add a leaf to a tokenset:
+by the parameter I<tokenset-member>, or by defining a monitor action.
+A tokenset is normally displayed in compact form: by default, 6-hour graphs
+are put by two in a row.
+
+=back
+
+
+=head3 Amending autogenerated XML files with XUpdate
+
+Sometimes there is a need to modify the configuration generated by
+C<devdiscover>. Modifying the generated XML files by hand would not be
+a good option: it would need some manual work every time you update
+your hardware setup. A better approach would be to have the tools
+that would automate such configuration update.
+
+One of the possibilities for such automation would be XSLT
+E<lt>http://www.w3.org/TR/xsltE<gt>. But it's rather
+complicated task to use XSLT for slight changes in XML files.
+
+A good approach has been made by XUpdate Working Group
+E<lt>http://www.xmldb.org/xupdate/E<gt>. Their Working Draft document
+describes a language for XML editing commands. It allows to perform
+small updates to an existing XML document, like insertion of elements,
+updating of existing elements, or deleting. The only drawback is
+that the specification hasn't been updated since September 2000,
+and it contains some unclear statements, which make it difficult to
+implement compatible applications. In addition, there has been
+not enough efforts to adopt XUpdate as a W3C standard.
+However, this is the only kind-of-a-standard language for such tasks as
+XML editing commands.
+
+Thanks to Petr Pajas, there is an XUpdate implementaytion in Perl.
+C<XML::XUpdate::LibXML> module is available at CPAN, and it installs
+a small commandline utility, C<xupdate>. In addition, Petr has created
+a set of utilities integrated into a single shell wrapper:
+E<lt>http://xsh.sourceforge.netE<gt>. It is very useful for many different
+things, such as XPath expressions testing, and many others.
+
+A typical XUpdate instructions file would looke like follows:
+
+ <?xml version="1.0"?>
+ <xupdate:modifications version="1.0"
+                        xmlns:xupdate="http://www.xmldb.org/xupdate">
+
+ <!-- Insert additional creator-info after the last one -->
+ <xupdate:insert-after
+   select="/configuration/creator-info[not(following-sibling::creator-info)]">
+   <creator-info>
+     This file was modified with XUpdate script setmonitor.xupdate.xml
+   </creator-info>
+ </xupdate:insert-after>
+
+ <!-- For every ifError leaf, set the monitor -->
+ <xupdate:append select="//subtree[apply-template[@name='iftable-errors']]">
+   <xupdate:element name="subtree">
+    <xupdate:attribute name="name">ifErrors</xupdate:attribute>
+     <param name="monitor" value="check-iferrors"/>
+   </xupdate:element>
+ </xupdate:append>
+
+ </xupdate:modifications>
+
+This example is part of Torrus distribution, and the file is named
+F<examples/setmonitor.xupdate.xml>. Your commands to apply these XUpdate
+instructions would be like
+
+  torrus devdiscover --in=routers.ddx --out=routers.xml
+
+  cd @sitexmldir@
+  xupdate -j @exmpdir@/setmonitor.xupdate.xml \
+    routers.xml > routers1.xml
+
+More XUpdate examples will be included in the future.
+
+
+=head3 Extracting the configuration skeleton
+
+Another aproach to amending the autogenerated confguration is as follows.
+
+Torrus distribution has a special-purpose XSLT template,
+F<extract-skeleton.xsl>, designed to strip all parameters and template
+applications from a given XML configuration, and leave the tree structure
+only. Given that F<routers.xml> is some autogenerated configuration,
+you may run
+
+  xsltproc @scriptsdir@/xml/extract-skeleton.xsl routers.xml  | \
+    xmllint --format --output routers-skeleton.xml -
+
+You can add your changes to the new file, F<routers-skeleton.xml>, and add
+it to your Torrus configuration. These changes may be performed manually
+or by means of XUpdate technique described above.
+
+
+=head3 Automating XML generation
+
+It is quite common task that you want Torrus to monitor certain set of
+devices, and C<devdiscover> does not (yet) support them. Of course,
+it's quite a pain to maintain a manually written XML file, especially if
+the there are more than one devices of the same type.
+
+In such case you may benefit from the approach suggested by
+Christian Schnidrig:
+
+Imagine you have 50 I<gizmos> which are able to speak SNMP and which you would
+like to put into some Torrus tree structure. A good designer's approach would
+be to keep the data and the presentation separately. In addition, changing
+the presentation once would produce 50 changes accordingly.
+To do that, let's create two files: F<gizmos.data> and F<gizmos.tmpl>.
+The first one would contain data about our devices:
+
+    [%
+      gizmos = [
+        {
+          name => 'atwork'
+          color => 'blue',
+          location => 'Javastrasse 2, 8604 Hegnau'
+          description => 'My gizmo @ Sun'
+          community => 'blabla',
+          hands => [
+              {name => 'Left'}
+              {name => 'Right'}
+            ],
+        }
+        {
+          name => 'athome'
+          color => 'gray',
+          location => 'Riedstrasse 120, 8604 Hegnau'
+          description => 'My gizmo @ Home'
+          community => 'blabla',
+          hands => [
+              {name => 'Upper'}
+              {name => 'Lower'}
+            ],
+        }
+      ]
+
+    %]
+
+Then F<gizmos.tmpl> would contain the XML template that would produce
+the Torrus configuration file:
+
+    [% PROCESS $data %]
+    <?xml version="1.0"?>
+    <configuration>
+      <datasources>
+        <subtree name="SNMP">
+          <subtree name="Gizmos">
+          [% FOREACH g = gizmos %]
+          <!-- ******************************************************* -->
+          <!-- [% g.name %] -->
+          <subtree name="[% g.color %]">
+              <alias>/ByName/[% g.name %]/</alias>
+
+              <param name="snmp-community"  value="[% g.community %]" />
+              <param name="comment"         value="[% g.description %]" />
+              <param name="snmp-host"       value="[% g.name %]" />
+              <param name="legend">
+                Description: [% g.description %]
+                Location:    [% g.location %]
+              </param>
+
+              [% FOREACH h=$g.hands %]
+              <leaf name="[% h.name %]Hand">
+                <!-- do something, my fantasy exhausted here -->
+              </leaf>
+          </subtree>
+          [% END %]
+        </subtree>
+      </subtree>
+    </datasources>
+    </configuration>
+
+See F<xmlconfig/examples/servers.data> and F<xmlconfig/examples/servers.tmpl>
+for a more useful example of the described approach.
+
+At the end, you will generate the Torrus config with the C<tpage> utility,
+which is the standard part of Template-Toolkit package:
+
+  tpage --define data=gizmos.data gizmos.tmpl > gizmos.xml
+
+
+=head3 Several Torrus instances on one server
+
+Sometimes it is necessary to have a separate instance of Torrus for testing
+purposes on the same server as the production installation.
+In the example below, a completely autonomous installation of Torrus is
+installed in F</usr/testtorrus> directory on a FreeBSD system.
+
+=over 4
+
+=item * Directory structure
+
+All files are located in subdirectories of F</usr/testtorrus>. No other
+directories are affected. This ensures that deinstallation would be easy
+and safe.
+
+Four subdirectories are created:
+
+=over 8
+
+=item * F</usr/testtorrus/apache>
+
+This directory contains Apache HTTP daemon configuration and logs. Create 3
+subdirectories here: F<etc>, F<htdocs>, and F<var>.
+
+=item * F</usr/testtorrus/home>
+
+This is the installation directory of Torrus. 
+
+=item * F</usr/testtorrus/etc>
+
+Directory for configuration files.
+
+=item * F</usr/testtorrus/var>
+
+Directory for logs, database and PID files.
+
+=item * F</usr/testtorrus/collector_rrd>
+
+Collector will store RRD files here.
+
+=item * F</usr/testtorrus/src>
+
+Distribution files will be stored and unpacked here.
+
+=back
+
+
+=item * Installation procedure
+
+  cd /usr/testtorrus/src
+  gzip -dc torrus-1.0.0.tar.gz | tar xvf -
+  cd torrus-1.0.0
+  ./configure pkghome=/usr/testtorrus/home \
+    sitedir=/usr/testtorrus/etc \
+    logdir=/usr/testtorrus/var/log \
+    piddir=/usr/testtorrus/var/run \
+    varprefix=/usr/testtorrus/var \
+    wrapperdir=/usr/testtorrus
+  make install
+
+=item * Devdiscover configuration
+
+Use devdiscover as usual. Place your discovery instruction files in
+F</usr/testtorrus/etc/discovery/>, and make sure that
+C<data-dir> is set to F</usr/testtorrus/collector_rrd>.
+
+=item * Apache configuration
+
+We reuse the same binaries and libraries as the main installation of Apache,
+but the daemon is launched with our special configuration.
+We assume that Apache is pre-configured for mod_perl. SSL support is not
+included in this example, but it's quite straightforward to implement
+if you need it.
+
+Create a copy of F<httpd.conf> and place it in F</usr/testtorrus/apache/etc>.
+With a text editor, replace the configutration options with the values
+given below:
+
+  # Leave server root as it was in the original config. Apache uses
+  # it for modules loading
+  ServerRoot "/usr/local"
+
+  # make sure that everything that apache writes
+  # goes into our directories
+  PidFile /usr/testtorrus/apache/var/httpd.pid
+  ScoreBoardFile /usr/testtorrus/apache/var/httpd.scoreboard
+
+  # Optional: limit the memory and CPU impact
+  MinSpareServers 2
+  MaxSpareServers 5
+  StartServers 3
+  MaxClients 10
+
+  # We open our HTTP service on TCP port 8123. Choose other
+  # port if this one is occupied
+  Port 8123
+
+  # Not really necessary, but you might want to use it someday
+  DocumentRoot "/usr/testtorrus/apache/htdocs"
+
+  # Find the Directory options for the old htdocs, and
+  # replace the path if you changed DocumentRoot above
+  <Directory "/usr/testtorrus/apache/htdocs">
+  ... some default stuff here ...
+  </Directory>
+
+  # Make sure the logs are written where we expect them to.
+  ErrorLog /usr/testtorrus/apache/var/httpd-error.log
+  CustomLog /usr/testtorrus/apache/var/httpd-access.log combined
+
+  # TCP port number as above
+  NameVirtualHost *:8123
+
+  # Quite standard virtual server configuration. Replace fake
+  # domain names with your real ones.
+  <VirtualHost *:8123>
+    ServerAdmin root@myserver.com
+    DocumentRoot /usr/testtorrus/home/web
+    ServerName torrus.myserver.com
+    CustomLog /usr/testtorrus/apache/var/torrus.myserver.com.log "combined"
+    PerlModule Apache::PerlRun
+    PerlRequire "/usr/testtorrus/home/conf_defaults/webmux.pl"
+    Alias /plain/ "/usr/testtorrus/home/sup/webplain"
+    <Location />
+      SetHandler perl-script
+      PerlHandler Torrus::ApacheHandler
+    </Location>
+    <Location /plain/>
+      SetHandler default-handler
+      Options None
+    </Location>
+  </VirtualHost>
+
+=item * Apache startup script
+
+Save the following script as F</usr/testtorrus/apache/testtorrus.sh>:
+
+  #!/bin/sh
+  case "$1" in
+  start)
+    /usr/local/sbin/httpd -f /usr/testtorrus/apache/etc/httpd.conf && \
+    echo 'apache started'
+    ;;
+  stop)
+    [ -r  /usr/testtorrus/apache/var/httpd.pid  ] && \
+    kill `cat /usr/testtorrus/apache/var/httpd.pid` && \
+    echo 'apache stopped'
+    ;;
+  *)
+    echo "Usage: `basename $0` {start|stop}" >&2
+    ;;
+  esac
+  exit 0
+
+=back
+
+
+=head3 Changing the default short graph
+
+The default small graph in overviews and tokenset listings shows last 6 hours
+of data. It might be more convenient for you to graph last 24 hours,
+or even longer. To do so, you only need to change one parameter,
+C<rrgraph-views>. You may change it on the top of the datasource tree, or
+even only for some parts of the tree.
+
+In F<defaults.xml>, there's a view defiition called C<last24h-small>. It is
+exactly the same size as the 6-hours' C<short> view, but it shows 24-hour
+graph. Somewhere in Torrus configuration, you may have:
+
+  <datasources>
+    <param name="rrgraph-views">
+      last24h-small,last24h,lastweek,lastmonth,lastyear
+    </param>
+  </datasources>
+
+The best place for this would be F<site-global.xml>.
+
+
+=head3 Watching the collector failures
+
+There is a script in Torrus distribution in F<examples/rrdup_notify.sh>,
+which provides a simple way of telling if the collector runs right: it checks
+the modification time of RRD files, and if any file is older than given
+threshold, it sends an e-mail warning.
+
+Copy the script file to some place in your system and edit it so that it fits
+your requirements: you might want to change the maximum age
+parameter (default is 1 hour), the notification e-mail address, and the
+directory paths where to look for RRD files. Then I<chmod> it so that it's
+executable, and add it to I<crontab>. Depending on your operation requirements,
+it might run every hour, or few times a day, or even at business hours only.
+
+The script writes the number of aged files in the e-mail subject, and lists
+the file names in the body. In case of relatively large installation,
+you might want to amend the script, in order to avoid too large email messages.
+
+
+=head3 Viewing external RRD files
+
+Some external program may create its own RRD files, and you
+may want to display and monitor them in Torrus. 
+
+Also some collector-generated RRDs may become outdated -- for example, after
+a module is removed from a router, and the interface counters not
+being updated any more.
+
+The easiest way to use such files would be to utilize the
+C<torrus rrddir2xml> command. It generates the XML configuration file
+that represents all RRD files found in a given directory. It can also
+scan the directory recursively.
+
+See also few examples in Torrus distribution. There are some
+templates for use with Smokeping, OpenNMS, and Flowscan.
+
+
+=head2 Torrus usage scenarios
+
+
+=head3 Scenario 1. Netflow Traffic Analyser
+
+Cisco routers are capable of exporting the traffic statistics
+data in I<Netflow> UDP packets.
+
+A I<cflowd> or I<flow-tools> daemon collects Netflow packets into flow files.
+
+I<FlowScan> software analyses the flow files and stores the
+statistics into numerous RRD files.
+
+Torrus is used to monitor the thresholds and diplay the graphs
+in convenient form.
+
+
+=head3 Scenario 2. Backbone Traffic Statistics
+
+I<CiscoWorks2000> or I<NMSTOOLS> software is used to provide
+the list of all devices in the network.
+
+Torrus's C<devdiscover> buids the XML configuration to monitor the
+router interfaces, CPU and memory usage, and temperature sensors.
+
+Data importing scripts generate configuration for alternative
+grouping of the datasources: by location; by customer connection;
+by device type; by service type; etc...
+
+
+=head2 Troubleshooting guidelines
+
+=head3 SNMP Error: Received tooBig(1)
+
+For some devices, the collector may issue the following error messages:
+
+ [27-May-2004 10:15:17*] SNMP Error for XX.XX.XX.XX:161:public: Received 
+ tooBig(1) error-status at error-index 0
+
+For better performance, SNMP collector sends several SNMP requests in one
+UDP datagram. The SNMP agent then tries to send the reply to all requests
+in a single datagram, and this error indicates the failure. In most cases,
+this is caused by the agent software limitations or bugs.
+
+The number of requests per datagram is controlled by the parameter
+C<snmp-oids-per-pdu>, and it may be set in the discovery input XML or
+in Torrus configuration XML. The default value is 40, and setting it to 10
+generally works.
+
+=head3 Database lock troubleshooting
+
+It may happen sometimes, that a process accessing Torrus database
+terminates incorrectly, and the database becomes blocked.
+A typical symptom of this is that the command
+C<torrus compilexml --all --verbose>
+does not print anything and stays running forever, occupying zero
+percent of CPU.
+
+The nice, and the preferred way to solve the problem is
+to use C<db_recover> utility from BerkeleyDB package.
+The brutal way is just to remove the databases and re-compile
+all the configuration. I<Note:> The ACL database is not automatically
+backed up, and you need to take care of its backup before deleting
+the contents of the database.
+
+  ## The nice way uses BerkeleyDB db_recover
+  ## (might be located in /usr/local/BerkeleyDB.4.1/bin/)
+  /etc/init.d/apache stop
+  /etc/init.d/torrus stop
+  db_recover -h @dbhome@
+  torrus compilexml --verbose --all
+  /etc/init.d/torrus start
+  /etc/init.d/apache start
+
+  ## The brutal way
+  /etc/init.d/apache stop
+  /etc/init.d/torrus stop
+  cd @dbhome@
+  rm -r *
+  torrus compilexml --verbose
+  /etc/init.d/torrus start
+  /etc/init.d/apache start
+
+=head1 Author
+
+Copyright (c) 2002-2007 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/vendorsupport.pod.in b/torrus/doc/vendorsupport.pod.in
new file mode 100644 (file)
index 0000000..cbc313c
--- /dev/null
@@ -0,0 +1,222 @@
+#  Copyright (C) 2004  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: vendorsupport.pod.in,v 1.1 2010-12-27 00:04:31 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 Torrus Vendor Support List
+
+=head2 Introduction
+
+This document provides a listing of vendor devices and generic MIBs
+that are suppported by Torrus'es SNMP discovery utilities and/or templates
+and other supporting files.
+
+All SNMP MIBs described below are supported through C<devdiscover>,
+the SNMP discovery utility. Where possible, the system contact, location,
+and interface descriptions are copied to the generated Torrus configuration.
+
+
+=head2 Generic SNMP MIBs
+
+=over 4
+
+=item * RFC1628 (UPS-MIB)
+
+Generic statistics covered by most UPS manufactures, including input, output,
+and bypass group information.
+
+=item * RFC1697 (RDBMS-MIB)
+
+Provides the database engine performance statistics. Tested with Oracle only.
+
+=item * RFC2662 (ADSL-LINE-MIB)
+
+ADSL DSLAM statitics and line status. Tested with Paradyne DSLAM.
+
+=item * RFC2670 (DOCS-IF-MIB)
+
+DOCSIS cable status and statistics. Tested with Cisco uBR.
+
+=item * RFC2737 (ENTITY-MIB)
+
+Used to retrieve information about chassis and temperature sensors in Cisco
+devices.
+
+=item * RFC2790 (HOST-RESOURCES-MIB)
+
+Server CPU, memory, and disk statistics. Tested with net-snmp and MS Windows.
+
+=item * RFC2863 (IF-MIB)
+
+Generic network interface statistics from C<ifTable> and C<ifXTable>.
+Most servers and network devices support this MIB. Featuring custom
+vendor-dependent indexing and interface type/name filtering.
+Tested with many different vendors.
+
+=back
+
+=head2 Vendor-specific SNMP monitoring
+
+=over 
+
+=item * Alteon content switches
+
+Application switching and performance statistics.
+
+=item * Allied Telesyn PBC18 Media converter
+
+Reports the line status for the manageable modular media converter.
+
+=item * Arbor Networks
+
+Provide statistics for Arbor eSeries devices. (e30, e100)
+
+=item * Ascend MAX
+
+Provides statistics for analog and ISDN interfaces, and the total number
+of lines used.
+
+=item * Atmel wireless access points and bridges
+
+Privides link quality and traffic statistics for wireless devices.
+The discovery process would run very slow unless you specify the
+following parameter in the discovery instructions XML:
+
+ <param name="only-devtypes" value="ATMEL"/>
+
+=item * AxxessIT Ethernet over SDH switches (aka Cisco ONS 15300)
+
+The module arranges the Ethernet interface statistics with
+such information as slot/port mapping and interface descriptions.
+
+=item * BetterNetworks EthernetBox
+
+The discovery module detects active sensors in an EthernetBox sensor module.
+
+=item * Brocade (Foundry)
+
+A variety of Foundry switches and routers is supported for memory,
+CPU, and temperature statistics.
+
+=item * CASA Systems CMTS
+
+Modem quantities per upstream, downstream, MAC domain.
+
+=item * Cisco CatOS
+
+Memory, CPU, and temperature information. Per-interface statistics may be
+limited to the ports with description only.
+
+=item * Cisco IOS
+
+Provides per-interface traffic statistics; CPU, memory, and
+temperature information; I/O buffer statistics; IPSec traffic information;
+SAA agents statistics; cbQoS monitoring (implemented in a separate plugin);
+DOCSIS uBR-specific variables (modem quantities and channel utilization);
+CISCO-ENHANCED-MEMPOOL-MIB (linecards and VIP modules memory, see notes below);
+MAC accounting statistics (associated with BGP AS numbers when applicable); LRE
+and VDSL line statistics; BGP prefix counts (http://tinyurl.com/y3ganv);
+CAR statistics; VPDN Statistics.
+
+
+B<Note:> On Cisco 7500, IOS version 12.0(26)S2 or 12.0(26)S3,
+CISCO-ENHANCED-MEMPOOL-MIB polling causes memory leak and leads to the router
+crash (Bug ID CSCef53395). The problem is fixed in IOS versions
+12.0(26)S5, 12.0(27)S3, 12.0(28)S2, and 12.0(30)S.
+
+
+=item * Cisco PIX Firewall
+
+Firewall performance statistics.
+
+=item * Cisco SCE
+
+Service Control Engine performance statistics.
+
+=item * Compaq Insite Manager
+
+Temperature and memory health information statistics for Compaq servers.
+
+=item * Empire (Concord) SystemEDGE
+
+Provides lots of statistics and information that a SystemEDGE agent
+may provide about the server health and performance.
+
+=item * F5 BigIp Load Balancer
+
+In-detail traffic statistics.
+
+=item * Force10 Networks
+
+CPU, Temperature and Power supply statistics.
+
+=item * Jacarta iMeter
+
+Humidity, Temperature, Electric current meters.
+
+=item * Juniper JunOS
+
+Class of service, firewall, operating environment, reverse path forwarding,
+and interface statistics.
+
+=item * Liebert HVAC systems
+
+Temperature, humidity and system state sensors
+
+=item * Microsoft Windows 2000/XP
+
+Sets up proper interface indexing and provides FTP and HTTP server statistics.
+
+=item * Motorola BSR CMTS (ex-Riverdelta)
+
+Displays modem quantities.
+
+=item * NetApp.com storage products
+
+Storage arrays performance and health information.
+
+=item * NetScreen Firewall
+
+Firewall performance statistics.
+
+=item * Oracle 
+
+Database engine statistics.
+
+=item * Paradyne GranDSLAM
+
+xDSL statistics and line status.
+
+=item * Symmetricom NTP appliance
+
+NTP clock statistics
+
+=item * UCD SNMP and Net-SNMP
+
+Memory, CPU, and disk usage information.
+
+=item * Xylan ethernet switches
+
+Port indexing for OmniSwitch and OmniStack ethernet switches.
+
+=back
+
+=head1 Author
+
+Copyright (c) 2004-2005 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/webintf.pod.in b/torrus/doc/webintf.pod.in
new file mode 100644 (file)
index 0000000..f85d994
--- /dev/null
@@ -0,0 +1,280 @@
+#  webintf.pod - Torrus web interface reference
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: webintf.pod.in,v 1.1 2010-12-27 00:04:33 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 Torrus Web Interface Reference
+
+B<Warning:> This documentation is relevant to Torrus version 1.0.9.
+It is incompatible with previous versions.
+
+=head2 Directory structure
+
+By default, the directory F<@webplaindir@/> is the place
+for static HTML, CSS stylesheets and images.
+
+The default CSS stylesheet files are installed in this directory.
+This directory must be configured with I<SetHandler default-handler>
+directive.
+
+=head2 CSS Stylesheets
+
+Additional user-defined stylesheet files may be added in
+F<webplain> directory.
+The default HTML templates that come with the Torrus distribution use the
+global configuration variable C<$Torrus::Renderer::stylesheet>, which is set
+in F<torrus-config.pl> and may be overwritten in F<torrus-siteconfig.pl>.
+
+=head2 Cache files
+
+All generated HTML and graphical images are cached twice: first on the server,
+and then in your browser. Thus, if you change somehow the HTML
+appearance of your Torrus installation, you need to clean both caches:
+
+   torrus clearcache
+
+This will clear the cache on the server. Then you may use your browser's
+"reload" button, or clear the whole browser cache.
+
+
+=head2 Site configuration options
+
+The following variables may need to be set in your
+F<@siteconfdir@/torrus-siteconfig.pl> file:
+
+=over 4
+
+=item * C<$Torrus::Renderer::companyName>
+
+The text that you specify here will appear in the top left corner
+of all HTML pages.
+
+=item * C<$Torrus::Renderer::companyURL>
+
+The company name text will be clickable with the URL specified in
+this variable.
+
+=item * C<$Torrus::Renderer::rendererURL>
+
+Default: C<'/torrus'>. A URL that points to Torrus renderer.
+
+=item * C<$Torrus::Renderer::plainURL>
+
+Default: C<'/torrus/plain'>. A URL that points to Torrus plain files directory.
+Normally CSS stylesheet files are resided there..
+
+=item * C<$Torrus::CGI::authorizeUsers>
+
+Default: C<1>. When true, the web interface users are required to log in.
+
+=back
+
+
+=head2 mod_perl 1.0 handler: Torrus::ApacheHandler 
+
+For more documentation, see E<lt>http://perl.apache.org/E<gt>.
+
+The whole output generation is performed by the C<Torrus::ApacheHandler> class.
+However, you still need access to the F<plain> directory where your CSS
+resides. Typical Apache configuration would look like follows. Make sure
+your configuration does not contain tab characters:
+
+  PerlRequire "@cfgdefdir@/webmux.pl"
+  <Location /torrus>
+    SetHandler perl-script
+    PerlHandler Torrus::ApacheHandler
+  </Location>
+
+The base URL would be in this case:
+
+  http://yourhost/torrus/
+
+
+=head2 mod_perl 2.0 handler: Torrus::Apache2Handler
+
+I<Note:> Apache 2.0 support in Torrus is currently in its early
+development stage.
+
+I<Note:> As of now, C<libapreq2> library is not released yet, and only the
+development version is available. You have to download and install it
+manually.
+
+mod_perl version B<1.99_15> or later is supported. To the moment,
+C<libapreq2> version C<2.04_03-dev> is tested.
+
+Make sure you use C<webmux2.pl> and C<Torrus::Apache2Handler> in your
+configuration.
+
+C<SetHandler modperl> directive should give better performance
+than C<SetHandler perl-script>. Both Perl handlers work the same way
+with Torrus.
+
+Typical Apache 2.0 configuration follows:
+
+  PerlRequire "@cfgdefdir@/webmux2.pl"
+  <Location /torrus>
+    SetHandler perl-script
+    PerlResponseHandler Torrus::Apache2Handler
+  </Location>
+
+The base URL would be in this case:
+
+  http://yourhost/torrus/
+
+
+=head2 lighttpd with FastCGI handler
+
+As of version 1.0.9, Torrus supports FastCGI server module. It is also often
+used together with B<lighttpd> HTTP server.
+
+Install FastCGI on your server, and also F<FCGI> module from CPAN.
+
+Add user "lighttpd" to group "torrus".
+
+The following configuration creates a virtual host, so that any URL which
+starts with "tor" would result in Torrus display:
+
+  # Uncomment mod_redirect and mod_fastcgi. Other modules might be needed too.
+  server.modules              = (
+                                  "mod_redirect",
+                                  "mod_fastcgi",
+                                )
+  # virtual server configuration
+  $HTTP["host"] =~ "^tor" {
+    url.redirect = ( "^/$" => "/torrus" )
+    fastcgi.server = (
+            "/torrus" => (
+                "Torrus" => (
+                    "socket"       => "/tmp/Torrus_FCGI.socket",
+                    "check-local"  => "disable",
+                    "bin-path"     => "@pkgbindir@/torrus.fcgi",
+                    "max-procs"    => 2,
+                )
+            )
+        )
+  }
+
+
+=head2 Apache 2.0.x with FastCGI handler
+
+As of version 1.0.9, Torrus supports the FastCGI server module.
+It is also often used together with B<Apache 2.x> HTTP server.
+
+The following is an example of a virtual host with four FastCGI child processes
+
+
+    <VirtualHost *:80>
+     DocumentRoot "/var/www/vhosts/test01.torrus.net"
+     ServerName test01.torrus.net
+     AddHandler fastcgi-script fcgi
+     FastCgiServer   @pkgbindir@/torrus.fcgi \
+        -processes 4
+     ScriptAlias /torrus "@pkgbindir@/torrus.fcgi"
+    <Location /torrus>
+        Order           Allow,Deny
+        Allow           from all
+    </Location>
+    </VirtualHost>
+
+
+
+=head2 Known CGI parameters
+
+The following CGI parameters are recognized by mod_perl handler:
+
+=over 4
+
+=item token
+
+Optional. Each configuration tree element is referenced by a I<token>, a short
+unique identifier. If not given, the root of the tree (C</>) is displayed.
+
+=item path
+
+Optional. Alternatively to token reference, the full path of the tree element
+may be referenced.
+
+=item nodeid
+
+Optional. A subtree which has a unique I<nodeid> can be referred
+with this parameter.
+
+=item view
+
+Optional. Specifies the C<view> name for displaying the tree element.
+If not specified, the defaul view is used.
+
+=item v
+
+Optional. Synonym for C<view> parameter.
+
+
+=item hostauth
+
+Mandatory for host-based authentication. The value is treated as a password
+and the user name is the client's IP address with non-alphanumerics
+replaced with underscores.
+
+
+=item TZ
+
+Optional. If given, specifies the timezone that you want the graphs to be
+displayed for. This must be the URL-encoded zone name which is understood by
+your server system. You may use zdump(8) for testing.
+
+=item NOW
+
+Optional. If given, presents the output for the given moment, instead of the
+current time. Must be of the form understood by C<rrdtool> (see
+RRDTool manuals).
+
+=item Gstart, Gend, Gwidth, Gheight
+
+Optional vaiables that override the ones defined in the view.
+
+=item DEBUG
+
+Optional. If true, turns on the debug level of logging. The debug messages
+are sent to HTTP server's error log.
+
+=item SHOWHIDDEN
+
+Optional. If true, makes the grapher display those subtree and leaves
+which have C<hidden> parameter set to C<yes>.
+
+=item NOHW
+
+Optional. If true, disables the displaying of Holt-Winters
+boundaries and failures.
+
+=item LOGOUT
+
+Optional. When user authorization is enabled, causes the current user
+session to log out.
+
+=back
+
+All other parameters whose name starts with capital letter, are passed
+to the HTML template as-is, and may be used for your custom purposes.
+
+
+=head1 Author
+
+Copyright (c) 2002-2005 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/doc/xmlconfig.pod.in b/torrus/doc/xmlconfig.pod.in
new file mode 100644 (file)
index 0000000..f1ae435
--- /dev/null
@@ -0,0 +1,1725 @@
+#  xmlconfig.pod - Torrus configuration guide
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: xmlconfig.pod.in,v 1.1 2010-12-27 00:04:34 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+=head1 Torrus XML Configuration Guide
+
+=head2 Common rules
+
+The Torrus configuration consists of several XML files.
+Once the XML configuration is changed, it must
+be compiled into the database by executing C<torrus compilexml>.
+In addition, when I<Renderer>, I<Collector> and I<Monitor> processes
+notice the configuration changes, they refresh their information automatically.
+
+The top-level XML element is always C<E<lt>configurationE<gt>>, with
+sub-elements defining various sections, like datasources or views:
+
+  <configuration>
+
+    <!-- Optional inclusion of other XML files -->
+    <include filename="myconfig.xml"/>
+
+    <datasources>
+      <!-- Data sources tree definition -->
+      ...
+    </datasources>
+    <views>
+      <!-- View definitions -->
+      ...
+    </views>
+    <token-sets>
+      <!-- Token sets definitions ->
+      ...
+    </token-sets>
+    <monitors>
+      <!-- Monitor definitions ->
+      ...
+    </monitors>
+  </configuration>
+
+Multiple XML files are interpreted in additive matter, i.e.
+C<E<lt>datasourcesE<gt>> section from one file is concatenated with
+the corresponding sections of previous files. If the same
+parameter is defined for the same subtree in several input files,
+the last processed value gets into the configuration.
+
+Additional XML files may be added to the compilation list by means of
+C<E<lt>includeE<gt>> statement. They will be processed recursively
+before the content of the XML file they are referenced from.
+The argument C<filename> determines the
+name of the file in standard XML files directory.
+It is safe to include the same file several times,
+Torrus compiler guarantees that files are only processed once.
+
+Some kinds of sections, like C<E<lt>datasourcesE<gt>>, allow to
+define the same elements two or more times. In this case,
+the previous parameter values are overridden by the new values.
+
+Each component of the configuration is defined by the set of I<parameters>.
+They are specified in a common manner, differentiating in parameter names only:
+
+  <view name="default-rrd-html">
+    <param name="view-type"     value="html" />
+    <param name="expires"       value="300" />
+    <param name="html-template" value="default-rrd.html" />
+  </view>
+
+The parameter value can be specified either by C<value> XML attribute,
+or by the text contents of the C<E<lt>paramE<gt>> element.
+
+Some parameter values require other parameters to be defined, like in the
+above example: a view of type C<html> cannot exist without a template.
+
+After I<all> XML files are compiled, the parameters are checked for validity
+by the compiler.
+
+=head2 Character sets
+
+By default, all XML input is treated as UTF-8 (unicode). This is important
+because all the HTML output generated by Torrus is encoded UTF-8.
+
+However, you may use Latin1 (ISO-8859-1) encoding in your XML files.
+In order to ensure correct displaying of non-ASCII characters,
+the encoding must be specified in your XML files:
+
+  <?xml version="1.0" encoding="ISO-8859-1"?>
+
+You need this only in those files containing non-ASCII characters
+in Latin1 encoding.
+
+In addition, version C<1.54_3> or higher of C<XML::LibXML> is required, and
+Torrus version 0.0.16 or above.
+
+
+=head2 Macros
+
+In the top level of the configuration tree, a number of macros may be defined.
+Currently they are used in C<snmp-object> parameter only.
+Macros are specified with C<E<lt>defE<gt>> elements, being the direct
+children of C<E<lt>definitionsE<gt>> element:
+
+  <configuration>
+    <definitions>
+      <!-- IF-MIB:ifTable  -->
+      <def name="ifDescr"           value="1.3.6.1.2.1.2.2.1.2" />
+      <def name="ifPhysAddress"     value="1.3.6.1.2.1.2.2.1.6" />
+      <def name="ifInOctets"        value="1.3.6.1.2.1.2.2.1.10" />
+      <def name="ifInUcastPkts"     value="1.3.6.1.2.1.2.2.1.11" />
+      <def name="ifInErrors"        value="1.3.6.1.2.1.2.2.1.14" />
+      <def name="ifOutOctets"       value="1.3.6.1.2.1.2.2.1.16" />
+      <def name="ifOutUcastPkts"    value="1.3.6.1.2.1.2.2.1.17" />
+      <def name="ifOutErrors"       value="1.3.6.1.2.1.2.2.1.20" />
+
+      <!-- Default Interface index lookup -->
+      <def name="IFIDX"         value="M($ifDescr, %interface-name%)" />
+    </definitions>
+    ...
+
+These definitions are global across all XML configuration files,
+and are referenced with dollar sign and the definition name, e.g.:
+
+    <leaf name="ifInErrors">
+      <param name="snmp-object" value="$ifInErrors.$IFIDX" />
+      ...
+
+
+=head2 Parameter properties
+
+Some parameters require special handling during the compilation or
+at the runtime. The parameter properties define such behaviour in the
+XML configuration.
+
+Currently two properties are recognized: "remspace" and "expand".
+
+  <configuration>
+    <param-properties>
+      <!-- Parameters where space is removed from values -->
+      <prop param="action"             prop="remspace" value="1"/>
+      <prop param="display-rpn-expr"   prop="remspace" value="1"/>
+      <prop param="ds-names"           prop="remspace" value="1"/>
+      ...
+    </param-properties>
+
+
+
+=head2 Datasource definitions
+
+Datasources are organized into a tree hierarchy. All parameters are inherited
+by the subtrees and leafs from their parents, and can be overridden on
+lower levels.
+
+The datasources tree consists of two key types of components:
+I<subtree> and I<leaf>. A subtree can have child subtrees or leaves.
+A leaf can never have children. A subtree represents logical aggregation,
+while the leaf always represends the actual datasource.
+
+In XML configuration, a child subtree or leaf belongs to the parent
+element, like the following:
+
+  <datasources>
+    <!-- This is the first child of the tree root -->
+    <subtree name="Netflow">
+      <param name="ds-type" value="rrd-file" />
+      <param name="comment"
+             value="Netfow data collected by FlowScan with CarrierIn.pm" />
+      <!-- All Flowscan-generated files reside here -->
+      <param name="data-dir" value="/var/local/flowscan/graphs" />
+      <subtree name="Exporters">
+        <param name="comment" value="Netflow exporting devices" />
+        ...
+        <!-- all exporters defined here -->
+      </subtree>
+       ...
+      <subtree name="Total">
+        <param name="data-file" value="total.rrd" />
+        <leaf name="bps">
+          <param name="comment" value="Bits per second" />
+          <param name="leaf-type" value="rrd-def" />
+          <param name="rrd-ds" value="bits" />
+          <param name="rrd-cf" value="AVERAGE" />
+        </leaf>
+        <leaf name="pps">
+          <param name="comment" value="Packets per second" />
+          <param name="leaf-type" value="rrd-def" />
+          <param name="rrd-ds" value="pkts" />
+          <param name="rrd-cf" value="AVERAGE" />
+        </leaf>
+        <leaf name="packlen">
+          <param name="comment" value="Average packet length in bytes" />
+          <param name="leaf-type" value="rrd-cdef" />
+          <param name="rpn-expr" value="{bps},8,/,{pps},/" />
+        </leaf>
+      </subtree>
+    </subtree>
+  </datasources>
+
+
+Each subtree or a leaf is identified by a I<path>, the symbolic
+notation similar to filesystem paths. In any path notation,
+subtree names always end with slash (/), and this trailing slash is
+the part of the name. In this case, any subtree is identified by a path
+ending with slash, while leaf paths always end with a word symbol.
+The top-level subtree is identified by a single slash.
+
+The other components of the datasouce definition are I<templates> and
+I<aliases>.
+
+=head3 Templates
+
+A template is used when it's needed to define multiple different pieces of
+the configuration in the same way. For instance, the definition for
+input/output octets and bits can be specified once in a template,
+and then applied where appropriate.
+
+The piece of XML configuration inside the C<E<lt>templateE<gt>>
+element is memorized under the template name, and reproduced
+in every occurrence of C<E<lt>apply-templateE<gt>> with the corresponding
+template name. The template definition must be the direct child
+element of C<E<lt>configurationE<gt>> XML element:
+
+  <datasources>
+    <!-- Default views must be defined -->
+    <param name="default-subtree-view" value="default-dir-html" />
+    <param name="default-leaf-view" value="default-rrd-html" />
+
+    <!-- Many of our RRDs have the field "bits" - let's define it here -->
+    <template name="bps">
+      <leaf name="bps">
+        <param name="comment" value="Bits per second" />
+        <param name="leaf-type" value="rrd-def" />
+        <param name="rrd-ds" value="bits" />
+        <param name="rrd-cf" value="AVERAGE" />
+      </leaf>
+    </template>
+    ...
+      <subtree name="Total">
+        <param name="data-file" value="total.rrd" />
+        <apply-template name="bps" />
+        <leaf name="pps">
+          <param name="comment" value="Packets per second" />
+          <param name="leaf-type" value="rrd-def" />
+          <param name="rrd-ds" value="pkts" />
+          <param name="rrd-cf" value="AVERAGE" />
+        </leaf>
+        <leaf name="packlen">
+          <param name="comment" value="Average packet length in bytes" />
+          <param name="leaf-type" value="rrd-cdef" />
+          <param name="rpn-expr" value="bps,8,/,pps,/" />
+        </leaf>
+      </subtree>
+
+
+=head3 Aliases
+
+Alias is the alternative symbolic name for a subtree or a leaf.
+It can be even a name from a different subtree hierarchy.
+If that alternative hierarchy does not exist, the corresponding
+subtrees are created:
+
+  <subtree name="62.3.44.55">
+    <alias>/Netflow/ExportersByName/rtrTelehouse1/</alias>
+    ...
+
+=head3 Compile-time variables
+
+Compile-time variables are those defined somewhere in datasource hierarchy,
+and valid within a given subtree and its children. It is possible to define
+pieces of XML configuration which are or are not compiled, depending on the
+value of corresponding variable.
+
+Variables are set by C<setvar> XML element, with mandatory attributes
+C<name> and C<value>. 
+
+Variable values are used in C<iftrue> and C<iffalse> XML elements.
+Mandatory parameter C<var> specifies the variable name. The child XML elements
+are compiled if the variable value is true or false, correspondingly.
+A true value is C<true> or a nonzero number. Undefined variable is identified
+as false.
+
+Example:
+
+  <template name="cisco-cbqos-classmap-meters">
+  ...
+    <iftrue var="CiscoIOS_cbQoS::CMNoBufDrop">
+      <leaf name="Dropped_No_Buffer">
+      ...
+      </leaf>
+    </iftrue>
+  </template>
+
+  <subtree name="QoS_Stats">
+    <setvar name="CiscoIOS_cbQoS::CMNoBufDrop" value="true"/>
+    ....
+  </subtree>
+  
+
+=head3 Parameter value substitution
+
+For any given leaf, some parameters may reference the other parameter values,
+by embracing the parameter name with percent signs:
+
+   <param name="data-file" value="%snmp-host%_hostaverages.rrd" />
+
+The parameter substitution is performed at runtime. The substitution formula
+may be defined at a higher subtree level, and the substitution itself will
+occur at leaf level.
+
+The parameter substitution is performed only to those paraneters
+which are defined with the property "expand".
+
+=head3 Common parameters
+
+=over 4
+
+=item * C<ds-type>
+
+Mandatory parameter for every datasource leaf. Currently, the following values
+are recongized:
+
+=over 8
+
+=item * C<rrd-file>
+
+The datasource is an RRD file generated by some external collector.
+Implies mandatory parameters: C<data-dir>, C<data-file>, C<leaf-type>.
+
+=item * C<collector>
+
+The datasource is generated by Torrus Collector.
+Implies mandatory parameters: C<collector-type>, C<storage-type>,
+C<collector-period>, C<collector-timeoffset>.
+
+=item * C<rrd-multigraph>
+
+This leaf is dedicated to displaying of multiple
+other datasources in one graph. It cannot be referenced for any
+other purpose, because there's no numeric value associated with it.
+
+=back
+
+=item * C<nodeid>
+
+Optional. If defined, it should contain a unique string identifying
+this particular leaf or subtree.
+
+
+=item * C<node-display-name>
+
+Optional. If defined, it overrides the subtree or leaf name for displaying.
+The subtree and leaf names are not allowed to have spaces and special
+characters, and this parameter helps to display strings as they are, such as
+router interface names.
+
+
+=item * C<comment>
+
+Optional. This is a string of text which is displayed when browsing through
+the tree.
+
+=item * C<help-text>
+
+Optional. This parameter is not inherited by child nodes. If defined,
+the user is offered a I<Help> shortcut in the given subtree or view.
+It allows to open a new window with the help text displayed, together with
+the current path. Some simple markup is allowed in the text, in a format
+of Template-Toolkit tool:
+C<[%em('some text')%]> would be displayed in italics, and
+C<[%strong('some text')%]> would be bold.
+
+=item * C<monitor>
+
+Optional. Comma-separated list of monitor names (spaces are allowed) that
+must be run upon periodic runs of monitor module (see I<Monitor definitions>
+section of this manual). Monitor schedule parameters must be defined
+for the monitor to run properly: C<monitor-period> and C<monitor-timeoffset>.
+
+=item * C<monitor-period>, C<monitor-timeoffset>
+
+Mandatory parameters for leaves that have C<monitor> defined.
+They define the monitor schedule for each individual datasource.
+The time for execution is determined by formula:
+
+   time + period - (time mod period) + timeoffset
+
+=item * C<monitor-vars>
+
+Required if one or more monitors requires the variables. In monitor's
+RPN expressions, the variables are referenced as C<#varname>. These
+variables are looked up in the leaf's C<monitor-vars> parameter.
+The syntax of this parameter is semicolon-delimited C<name=value> pairs:
+
+  <param name="monitor-vars" value="min=300000;max=1000000"/>
+
+=item * C<monitor-action-target>
+
+Optional. Specifies a reference to an alternative leaf which will be used
+for the monitor action. For example, you might need to see a multigraph
+leaf in the tokenset instead of one single datasource.
+
+=item * C<precedence>
+
+Optional. Default value: C<0>. When rendering, the subtree listing is
+sorted according to precedence and alphabetic order of names.
+The higher the precedence, the closer to the top of the list
+the child node is displayed.
+
+=item * C<legend>
+
+Optional. If given, produces a short listing at the top of the HTML output,
+with tabulated values. Format: C<Category1:Value1; Category2:Value2...>.
+Spaces around the delimiters are ignored.
+
+Example:
+
+  <subtree name="rtrZurich1">
+    <param name="legend">
+      Location:Zurich;
+      Contact: John Smith;
+      Telephone: 01 9911299
+    </param>
+
+=item * C<graph-title>
+
+A horizontal string at the top of the graph.
+
+=item * C<graph-legend>
+
+Optional. This legend text is printed inside the graph explaining
+the line color.
+
+=item * C<vertical-label>
+
+Optional. Text to print along Y axsis on the graph.
+
+=item * C<graph-lower-limit>, C<graph-upper-limit>
+
+Optional. Fix the upper and lower boundaries of the graph.
+
+=item * C<graph-rigid-boundaries>
+
+Optional. When set to "yes", the graph will not expand if the value is outside
+the lower or upper limit.
+
+=item * C<rrd-scaling-base>
+
+Optional. Valid values are: "1000" and "1024". Default: "1000".
+Determines the base for kilo-, mega-, and giga- scaling factor.
+Normally it should be 1000 for traffic counters, and 1024 for memory
+or storage sizes.
+
+=item * C<graph-logarithmic>
+
+Optional. When set to "yes", the graph is drawn in logarithmic y-axis scale.
+
+=item * C<line-style>, C<line-color>
+
+These optional parameters override the corresponding ones from the view
+definition.
+
+=item * C<default-subtree-view>, C<default-leaf-view>
+
+Mandatory. Determine the default view for a leaf or subtree, correspondingly.
+See I<View definitions> section of this manual.
+
+=item * C<rrgraph-views>
+
+Mandatory. Defines 5 views to display the graphs. Must contain 5
+comma-delimited view names for short-period, daily, weekly, monthly,
+and yearly view.
+
+=item * C<tokenset-member>
+
+Optional. Adds this leaf or this subtree child leaves to the specified
+token sets. Tokenset names are comma-separated, and must be defined in
+C<E<lt>token-setsE<gt>> part of configuration.
+
+=item * C<descriptive-nickname>
+
+Optional. If defined, it is used in tokenset members listing as a member
+identifier, instead of the leaf path.
+
+=item * C<hidden>
+
+Optional. Valid values: C<yes>, C<no>.
+When set to C<yes>, the leaf or subtree is not
+displayed in the subtree listing,
+unless C<SHOWHIDDEN> option is true. When C<SHOWHIDDEN> is enabled,
+the node name and comment are shown in italics.
+
+=item * C<has-overview-shortcuts>, C<overview-shortcuts>,
+C<overview-subleave-name-X>, C<overview-shortcut-text-X>,
+C<overview-shortcut-title-X>, C<overview-page-title-X>,
+C<overview-direct-link-X>, C<overview-direct-link-view-X>
+
+When C<has-overview-shortcuts> is set to C<yes> on a subtree level,
+default HTML templates expect the five parameters to be set.
+C<overview-shortcuts> is a comma-separated list of shortcut names,
+and for each name "X", C<overview-subleave-name-X> defines the
+current subtree's grandchild leaves name which would compose the overview page.
+When C<overview-direct-link-X> is set to C<yes>, the URL under the
+graph will point to the direct child subtree, and
+C<overview-direct-link-view-X> will define the view for that subtree.
+Usually this view would be C<expanded-dir-html>.
+
+=item * C<ignore-lower-limit>, C<ignore-upper-limit>, C<ignore-limits>
+
+Optional. When set to C<yes>, they make the renderer ignore
+C<graph-lower-limit>, C<graph-upper-limit>, or both, accordingly.
+In addition, C<ignore-limits> disables the C<graph-rigid-boundaries>
+parameter.
+
+=item * C<graph-ignore-decorations>
+
+Optional. When set to C<yes>, the view C<decorations> are ignored.
+
+=item * C<graph-disable-gprint>
+
+Optional. When set to C<yes>, the view parameter C<gprint-values> and other
+GPRINT-related parameters are ignored.
+
+=item * C<hrule-legend-I<name>>
+
+Optional. If a horizontal rule with the given name is defined, this parameter
+specifies the legend to be printed.
+
+=item * C<searchable>
+
+Optional. If set to C<yes>, the corresponding subtree or leaf is included
+in the search database.
+
+=back
+
+
+=head3 RRD-related parameters
+
+=over 4
+
+=item * C<data-dir>
+
+Mandatory. Specifies the filesystem directory
+path where the data files are resided.
+
+=item * C<data-file>
+
+Mandatory. Name of the data file.
+
+=item * C<leaf-type>
+
+Mandatory. Determines the type of RRD access. Recognized values are:
+
+=over 8
+
+=item * C<rrd-def>
+
+Corresponds to DEF specification in RRDgraph query. Implies two mandatory
+parameters: C<rrd-ds> and C<rrd-cf>, giving the DS name and consolidation
+function, correspondingly.
+
+=item * C<rrd-ds>
+
+Mandatory when a leaf refers to an RRD file (C<storage-type=rrd> in
+C<collector> leaves or C<leaf-type=rrd-def> in C<rrd-file> leaves). The
+parameter Specifies the RRD datasource name within a file.
+
+=item * C<rrd-ds>
+
+Mandatory when a leaf refers to an RRD file (C<storage-type=rrd> in
+C<collector> leaves or C<leaf-type=rrd-def> in C<rrd-file> leaves). The
+parameter Specifies the RRD datasource name within a file.
+
+=item * C<rrd-cf>
+
+Mandatory under the same conditios as C<rrd-ds>. Defines the default
+consolidation function which is used when retrieving the RRD data.
+
+=item * C<rrd-cdef>
+
+Supported for C<ds-type=rrd-file> only.
+Corresponds to CDEF specification in RRDgraph query. Implies one
+mandatory parameter: C<rpn-expr>, which gives the RPN expression.
+Other leaves' value references are specified in curly braces. These leaves
+can be specified as relative or absolute paths in the configuration tree.
+See I<RPN expressions in Torrus> manual for more details.
+
+=back
+
+=item * C<rrd-hwpredict>
+
+Optional. If equals to C<enabled>, then this RRD datasource
+is expected to have HWPREDICT and all the suite of
+Holt-Winters consolidation functions.
+In case of C<ds-type=collector>, C<rrd-hwpredict=enabled> indicates
+that the RRD file must be created with use of Holt-Winters RRAs.
+
+=item * C<rrd-create-dstype>
+
+Mandatory when C<ds-type=collector> and C<storage-type=rrd>.
+Specifies the datasource type for RRD creation. Valid values are:
+C<GAUGE>, C<COUNTER>, C<DERIVE>, C<ABSOLUTE>.
+
+=item * C<rrd-create-rra>
+
+Mandatory when C<ds-type=collector> and C<storage-type=rrd>.
+Space-separated list of RRA definitions for RRD creation, as they
+are passed to RRD Create command.
+Example:
+
+    <!-- Round-robin arrays to be created, separated by space.
+     In this example, we keep 5-minute details for 2 weeks,
+     30-minute average and maximum details for 6 weeks,
+     and 1-day aggregated stats for 2 years -->
+    <param name="rrd-create-rra">
+      RRA:AVERAGE:0.5:1:4032
+      RRA:AVERAGE:0.5:6:2016     RRA:MAX:0.5:6:2016
+      RRA:AVERAGE:0.5:288:732    RRA:MAX:0.5:288:732
+    </param>
+
+=item * C<rrd-create-heartbeat>
+
+Mandatory when C<ds-type=collector> and C<storage-type=rrd>.
+Heartbeat parameter as defined in RRD Create manual page.
+
+=item * C<rrd-create-min>, C<rrd-create-max>
+
+Optional minimum and maximum parameters for RRD datasource.
+
+=item * C<rrd-create-hw-rralen>
+
+Mandatory when C<ds-type=collector> and C<storage-type=rrd>
+and C<rrd-hwpredict=enabled>. Specifies the RRA length for
+Holt-Winters archives. Recommended same length as main 5-minutes RRA.
+
+=item * C<rrd-create-hw-season>, C<rrd-create-hw-alpha>,
+  C<rrd-create-hw-beta>, C<rrd-create-hw-gamma>,
+  C<rrd-create-hw-winlen>, C<rrd-create-hw-failth>
+
+Optional Holt-Winters parameters. Default values are:
+
+        season=288
+        alpha=0.1, beta=0.0035, gamma=0.1,
+        window_length=9, failure_threshold=6
+
+=back
+
+=head3 Collector-related parameters
+
+=over 4
+
+=item * C<collector-type>
+
+Mandatory parameter for datasource type C<collector>. Currently supported
+values are: C<snmp> and C<cdef>. Other valid values may be added with plugins.
+
+=item * C<storage-type>
+
+Mandatory parameter for datasource type C<collector>. Comma-separated list
+of storage types. The collected value is duplicated on every storage listed.
+Supported values are: C<rrd>, C<ext>. For C<ext> (external storage),
+see the I<Reporting Setup Guide>.
+
+=item * C<collector-period>, C<collector-timeoffset>
+
+Mandatory parameters for datasource type C<collector>.
+They define the collector schedule for each individual datasource.
+The time for execution is determined by formula:
+
+   time + period - (time mod period) + timeoffset
+
+=item * C<collector-dispersed-timeoffset>
+
+Optional. When set to C<yes>, C<compilexml> spreads the collector offsets
+among values determined from C<collector-timeoffset-min>,
+C<collector-timeoffset-max>, C<collector-timeoffset-step>,
+and C<collector-timeoffset-hashstring>.
+
+=item * C<collector-timeoffset-min>,
+C<collector-timeoffset-max>, C<collector-timeoffset-step>
+
+Mandatory when C<collector-dispersed-timeoffset> is set to C<yes>.
+They define the limits and the step for collector timeoffset dispersion.
+
+=item * C<collector-timeoffset-hashstring>
+
+Mandatory when C<collector-dispersed-timeoffset> is set to C<yes>.
+Defines the string that is used as a hash for timeoffset dispersion.
+
+=item * C<collector-instance-hashstring>
+
+Mandatory.
+Defines the string that is used as a hash to calculate the collector
+instance number for a particular leaf.
+By default it is defined as C<%system-id%>, so that
+the same collector instance deals with every remote system.
+
+=item * C<collector-instance>
+
+Mandatiry. The parameter defines the collector instance number.
+This parameter is automatically calculated by the configuration compiler.
+
+=item * C<transform-value>
+
+Optional. Defines a piece of Perl code that will be used for value
+transformation. The keyword C<DOLLAR> is replaced with the dollar sign ($),
+and C<MOD> is replaced with the percent sign (%).
+The initial value is supplied in C<$_>, which should be referenced as
+C<DOLLAR_> in your Perl code.
+The code should return a numeric value or C<U> for an undefined
+value. The returned value is then passed to the storage.
+The parameter substititions are performed on the value of the
+parameter, therefore it should not contain the percent(%) and dollar ($) signs.
+
+=item * C<value-map>
+
+Optional. Collector may return values which need translation into
+numbers. This parameter defines the mapping for such values. The
+parameter value is a comma-separated list of C<value:number> pairs.
+
+
+=item * C<collector-scale>
+
+Optional. Specifies the translation RPN formula for the data before
+being passed to RRD database. Implicitly the datasource value is appended
+to the left of the given RPN. I<Warning:> the translation works I<before>
+the RRDtool processes the data, so it makes sence to scale only non-COUNTER
+values.
+
+=item * C<snmp-ipversion>
+
+Mandatory for C<collector-type=snmp>. Valid values are C<4> and C<6>. The
+parameter defines the IP protocol version. If C<snmp-host> contains a DNS
+name, the IP address is determined by looking up A or AAAA DNS records,
+according to IP version.
+
+=item * C<snmp-transport>
+
+Mandatory for C<collector-type=snmp>. Valid values are C<tcp> and C<udp>.
+
+
+=item * C<snmp-host>
+
+Mandatory when C<collector-type=snmp>. Specifies the hostname or IP address
+of the SNMP agent.
+
+=item * C<snmp-port>
+
+Mandatory when C<collector-type=snmp>. Specifies the UDP port of the
+SNMP agent.
+
+=item * C<domain-name>
+
+Optional DNS domain name. If given, and if C<snmp-host> does not contain
+dot symbol (.), this domain name is appended to C<snmp-host>.
+
+=item * C<snmp-localaddr> and C<snmp-localport>
+
+Optional parameters specifying the local socket binding address and port.
+
+=item * C<snmp-version>
+
+Mandatory when C<collector-type=snmp>. Specifies the SNMP version for the
+given device. Valid values are: C<1>, C<2c>, C<3>.
+
+=item * C<snmp-community>
+
+Mandatory when C<collector-type=snmp> and SNMP version is
+C<1> or C<2c>. Specifies the SNMP community for the given device.
+
+=item * C<snmp-username>
+
+Mandatory when C<collector-type=snmp> and SNMP version is C<3>.
+
+=item * C<snmp-authkey>
+
+Optional authentication key for SNMPv3. If not defined, the authentication
+level is set to C<noAuthNoPriv>. If only C<snmp-authkey> or
+C<snmp-authpassword> are specified, the security level is set to
+C<authNoPriv>. The security level is set to C<authPriv> if either
+of C<snmp-privkey> or C<snmp-privpassword> is defined.
+
+=item * C<snmp-authpassword>
+
+Optional authentication password for SNMPv3. See notes for C<snmp-authkey>
+parameter.
+
+=item * C<snmp-authprotocol>
+
+Optional authentication protocol for SNMPv3. Valid values: C<md5> or C<sha>.
+Default is C<md5>.
+
+=item * C<snmp-privkey>
+
+Optional privacy key for SNMPv3. If defined, C<snmp-authkey> or
+C<snmp-authpassword> must be defined too.
+
+=item * C<snmp-privpassword>
+
+Optional privacy password for SNMPv3. If defined, C<snmp-authkey> or
+C<snmp-authpassword> must be defined too.
+
+=item * C<snmp-privprotocol>
+
+Optional privacy protocol for SNMPv3. Valid values: C<des>, C<aes128cfb>,
+or C<3desede>. Default is C<des>.
+
+=item * C<snmp-timeout>
+
+Mandatory when C<collector-type=snmp>. Specifies the SNMP session timeout
+in seconds.
+
+=item * C<snmp-retries>
+
+Mandatory when C<collector-type=snmp>. Specifies the SNMP session retry count.
+
+=item * C<snmp-oids-per-pdu>
+
+Mandatory when C<collector-type=snmp>. Specifies the number of SNMP OIDs per
+one UDP packet.
+
+=item * C<snmp-object>
+
+Mandatory when C<collector-type=snmp>. Specifies the SNMP OID to be polled
+from the agent. The object must return a single numeric value.
+
+In order to reference the dynamic instances, i.e. interface counters,
+two mapping types are supported: reverse mapping and variable value
+substitution.
+
+Reverse mapping has syntax as follows:
+
+  M(baseoid, string)
+
+The result of reverse mapping is the tail of the OID which has the head
+C<baseoid> and whose value equals the string.
+
+Variable value substitution is defined by syntax:
+
+  V(oid)
+
+The returned value must be a numeric value which is substituted in place
+of this expression.
+
+=item * C<snmp-object-type>
+
+Optional. Supported values: C<COUNTER64>, C<OTHER>. When set to C<COUNTER64>,
+the SNMP variable value is treated as 64-bit integer. Not using this
+parameter may lead to loss of precision.
+
+=item * C<snmp-check-sysuptime>
+
+Optional. Default value: C<yes>. When set to C<no>, the collector does not
+query C<SNMPv2-MIB::sysUpTime> (C<1.3.6.1.2.1.1.3.0>). By default,
+the uptime counter is used to detect if the agent was rebooted between
+the collector cycles. In this case the dynamic maps for the given host
+are automatically rebuilt. This parameter is needed for compatibility
+with some non-standard agents which don't implement this OID.
+
+=item * C<snmp-max-msg-size>
+
+Optional. If defined, it sets the SNMP maximum message size different from
+default 1472 octets (true for UDP/IPv4, see Net::SNMP documentation for more
+information).
+
+=item * C<snmp-ignore-mib-errors>
+
+Optional. If set to C<yes>, the SNMP errors C<noSuchObject>, C<noSuchInstance>,
+C<endOfMibView> are ignored, and no action is performed when such errors
+occur.
+
+=item * C<system-id>
+
+Mandatory for every collector type.
+Default value for SNMP collector: C<%snmp-host%>.
+Unique identifier of the host.
+This parameter is used in various template definitions for
+C<data-file>, C<descriptive-nickname> and C<collector-timeoffset-hashstring>.
+
+=item * C<rpn-expr>
+
+Mandatory when C<collector-type=cdef>. The RPN defines an arithmetic expression
+that is used to create a new datasource from several other ones. For example,
+it may define the sum of traffic on several different interfaces.
+
+=item * C<cdef-collector-delay>
+
+Mandatory when C<collector-type=cdef>. Defines the delay time in collector
+periods. The collector will read the data from the RPN datasources with the
+specified delay from the current time. F<cdef-collector-defs.xml> sets
+the default value to 0.
+
+=item * C<cdef-collector-tolerance>
+
+Mandatory when C<collector-type=cdef>. Delay time in collector periods that
+the collector accepts when no recent data is available.
+F<cdef-collector-defs.xml> sets the default value to 2.
+
+=back
+
+
+=head3 RRD-Multigraph leaves
+
+The leaves with C<ds-type=rrd-multigraph> are dedicated for
+displaying of several datasource values in one graph.
+Such leaves cannot be referenced for a numerical value, hence
+cannot be monitored.
+
+Example:
+
+  <subtree name="SampleMulti">
+    <leaf name="sample1">
+      <param name="ds-type" value="rrd-multigraph" />
+      <param name="ds-names" value="in,out" />
+      <param name="foobarpath"
+             value="/SNMP/Routers/213.230.38.4/FastEthernet0_0" />
+
+      <!-- parameter name tail is formed by the DS name -->
+
+      <param name="ds-expr-in"       value="{%foobarpath%/locIfInBitsSec}" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"   value="AREA" />
+      <param name="line-color-in"   value="#00FF00" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{%foobarpath%/locIfOutBitsSec}" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="LINE2" />
+      <param name="line-color-out"   value="#0000FF" />
+      <param name="line-order-out"   value="2" />
+
+    </leaf>
+  </subtree>
+
+Parameters:
+
+=over 4
+
+=item * C<ds-names>
+
+Comma-separated list of symbolic DS names. These names are
+used for other DS-specific parameter names formation.
+In the parameter descriptions below, C<X> stands for the DS name.
+
+=item * C<ds-expr-X>
+
+Datasource leaf RPN expression.
+Any other parameter values may be substituted as C<%parameter_name%>.
+
+=item * C<graph-legend-X>
+
+Short description text used as the graph legend.
+
+=item * C<line-style-X>
+
+Line specification in RRD graph. May be I<C<LINE1>>, I<C<LINE2>> etc.
+Two hashes in the beginning and a name refer to the line style from
+the styling profile, e.g. C<##BpsIn>.
+
+=item * C<line-color-X>
+
+Line color. Must have the hash symbol in the beginning, like I<C<#0000FF>>.
+Two hashes in the beginning and a name refer to the color from
+the styling profile, e.g. C<##BpsIn>.
+
+=item * C<line-order-X>
+
+Numerical order of line drawing. The lines are drawn in accending order.
+If omitted, the XML compiler issues warning, and Renderer conciders
+the order of 100.
+
+=item * C<line-stack-X>
+
+Optional. When set to C<yes>, the line is stacked on top of a previous line.
+Both areas and lines are stackable.
+
+=item * C<line-alpha-X>
+
+Optional. If specified, must be two hexademical, uppercase digits. This
+parameter defines the line (or area) transparency. Value C<FF> is
+equivalent to solid colour. Value C<7F> gives 50% transparency which should
+be suitable for most applications.
+
+=item * C<ignore-views-X>
+
+Optional comma-separated list of view names. The graph for this DS name
+will not be drawn in the views specified. The validator does not check
+it, so it's up to you to guarantee that at least one DS is always displayed
+in a multigraph.
+
+=item * C<disable-gprint-X>
+
+Optional. When set to C<yes>, this datasource is not included in GPRINT output.
+
+=back
+
+=head2 View definitions
+
+In our context, I<view> means any kind of object representation.
+The same subtree or view can be displayed in different ways and in
+different formats: HTML, graph image, plain text, etc.
+
+I<Renderer> module handles these view definitions. For any subtree
+or leaf, it renders the specified view, and keeps the cache of rendered
+files.
+
+Each subtree or leaf must have a default view. This is controlled by
+two parameters that may be defined in the root subtree:
+C<default-subtree-view> and C<default-leaf-view>.
+
+The set of views is flat, though they can inherit the parameters
+one from another. Each view is referenced by its name, and is
+defined by the set of parameters. Same way as with datasources,
+certain parameter values imply the neccessaty to define certain other
+parameters:
+
+  <views>
+    <view name="default-rrgraph">
+      <param name="view-type"     value="rrgraph" />
+      <param name="expires"       value="300" />
+      <param name="width"         value="500" />
+      <param name="height"        value="250" />
+      <param name="width-hint"    value="580" />
+      <param name="line-style"    value="##SingleGraph" />
+      <param name="line-color"    value="##SingleGraph" />
+
+      <!-- Daily graph, inherits parameters from the above -->
+      <view name="last24h">
+        <param name="start"         value="-24h" />
+      </view>
+
+      <!-- Weekly graph -->
+      <view name="lastweek">
+        <param name="start"         value="-7d" />
+      </view>
+    </view>
+  </views>
+
+Currently the view is defined by the configuration only.
+Probably, in the future additional parameters will be supplied dynamically.
+
+
+=head3 View parameters
+
+For every view, the mandatory parameters are:
+
+=over 4
+
+=item * C<view-type>
+
+Determines the processing procedure which interprets the other parameters.
+
+=item * C<expires>
+
+Gives the expiration time in seconds for the I<Renderer> cache.
+
+=back
+
+The following values of C<view-type> are recognized:
+
+=over 4
+
+=item * C<html>
+
+Defines the HTML representation of subtree or a leaf.
+One additional parameter is required: C<html-template> must contain a file
+name of the HTML template. Those templates are copied from F<templates>
+subdirectory of the installation package. We use Template-Toolkit
+E<lt>http://www.template-toolkit.orgE<gt> for HTML processing.
+The template file name is defined with the parameter C<html-template>.
+
+The following
+variables and functions are defined when the template is processed:
+
+=over 8
+
+=item * C<token>
+
+Returns the current node token.
+
+=item * C<view>
+
+Returns the name of the current view.
+
+=item * C<path(token)>
+
+Returns the full path name of the given node token.
+
+=item * C<pathToken(path)>
+
+Returns the token for the specified path.
+
+=item * C<nodeExists(path)>
+
+Returns true if the specified path points to a node.
+
+=item * C<children(path)>
+
+Returns the list of children for the given path.
+
+=item * C<isLeaf(token)>
+
+Returns true if the token is pointing to a leaf node.
+
+=item * C<sortTokens(array)>
+
+Returns the array of tokens, sorted according to C<precedence> parameter.
+
+=item * C<nodeName(token)>
+
+Returns the node name part of the node path.
+
+=item * C<parent(token)>
+
+Returns the parent's token for the specified node.
+
+=item * C<nodeParam(token, param_name)>
+
+Returns the value of the parameter for the given node.
+
+=item * C<param(entity_name, param_name)>
+
+Returns the value of the parameter for the given view, monitor, or action.
+
+=item * C<url(token, [view])>
+
+Returns the URL which displays the given node using the given view.
+If the view is omitted, use the default view.
+
+=item * C<persistentUrl(token, [view])>
+
+Same as above, but the URL is built from persistent information: nodeid
+(if available) or full path in the tree.
+
+=item * C<splitUrls(token, [view])>
+
+Returns a piece of HTML code representing the path with clickable
+node names, each referencing the corresponding view.
+
+=item * C<rrprint(token, view)>
+
+The specified view must be of type C<rrprint>. Returned is the text
+output produced by this view.
+
+=item * C<scale(text)>
+
+Interprets the given text as a floating-point number and returns
+its representation in the "metric" scale: 1000 is translated into "k",
+million into "M" etc. It may be used together with C<rrprint>
+for better formatting.
+
+=item * C<tsetMembers(tset)>
+
+Returns the array of the tokenset member tokens.
+
+=item * C<tsetList>
+
+Returns the array of the tokenset names.
+
+=item * C<stylesheet>
+
+Returns the relative URI to the default CSS stylesheet,
+as defined in C<$Torrus::Renderer::stylesheet>.
+
+=item * C<version>
+
+Returns current Torrus package version.
+
+=back
+
+=item * C<rrgraph>
+
+Generates the RRD Graph representation of the given I<leaf> (remember,
+subtrees are only logical grouping of the real data).
+
+The following parameters are mandatory for this kind of view:
+
+=over 8
+
+=item * C<width>, C<height>, C<start>
+
+Correspond to same parameters in RRD Graph command.
+C<end> can also be given, it defaults to I<C<now>>.
+
+=item * C<line-style>
+
+Line specification in RRD graph. May be I<C<LINE1>>, I<C<LINE2>> etc.
+Two hashes in the beginning and a name refer to the line style from
+the styling profile, e.g. C<##SingleGraph>.
+
+=item * C<line-color>
+
+Line color. Must have the hash symbol in the beginning, like I<C<#0000FF>>.
+Two hashes in the beginning and a name refer to the color from
+the styling profile, e.g. C<##SingleGraph>.
+
+=item * C<rrd-hwpredict>
+
+If equals to C<disabled>, HWPREDICT display is disabled for this view.
+Note that if the datasource has C<rrd-hwpredict> parameter set to C<enabled>,
+this emplies that the view would contain Holt-Winters boundaries and failures
+graph.
+
+=item * C<hw-bndr-style>
+
+Optional parameter, defaults to C<LINE1>. Specifies the line style for
+Holt-Winters boundaries.
+
+=item * C<hw-bndr-color>
+
+Optional parameter, defaults to C<#FF0000>. Specifies the color for
+Holt-Winters boundaries.
+
+=item * C<hw-fail-color>
+
+Optional parameter, defaults to C<#FFFFA0>. Specifies the color for
+Holt-Winters failure ticks.
+
+=item * C<hrules>, C<hrule-value-I<name>>, C<hrule-color-I<name>>
+
+Optional parameter C<hrules> contains a comma-separated list of
+horizontal rule names. For each name, mandatory parameter
+C<hrule-value-I<name>> defines a name of the leaf parameter that will be
+used as the horizontal rule value. The rule is not drawn if such parameter
+is not defined for the leaf. Mandatory parameter C<hrule-color-I<name>>
+defines the color for the rule, of the form C<#DDDDDD>, where C<D> corresponds
+to a hexademical digit. Two hashes in the beginning and a name refer to
+the color from the styling profile, e.g. C<##HruleMin>.
+Optional parameter C<hrule-legend-I<name>>
+defines the legend text to be displayed on the graph. The following horizontal
+rules are defined in F<defaults.xml> for all rrgraph views:
+
+    <param name="hrules"            value="min,norm,max"/>
+    <param name="hrule-color-min"   value="##HruleMin"/>
+    <param name="hrule-value-min"   value="lower-limit"/>
+    <param name="hrule-color-norm"  value="##HruleNormal"/>
+    <param name="hrule-value-norm"  value="normal-level"/>
+    <param name="hrule-color-max"   value="##HruleMax"/>
+    <param name="hrule-value-max"   value="upper-limit"/>
+
+
+=item * C<decorations>
+
+Optional. Comma-separated list of decoration names. Decoration is an RRD
+pseudo-line that does not depend on any datasource. For each decoration
+name, the following parameters must be supplied: C<dec-order-E<lt>nameE<gt>>
+determines the order of drawing. Negative order numbers correspond to
+the lines or areas behind the data line. C<dec-expr-E<lt>nameE<gt>>
+gives the RPN expression that defines the line or area.
+C<dec-style-E<lt>nameE<gt>> and C<dec-color-E<lt>nameE<gt>> define
+the style (AREA or LINE1..3) and the color of the drawing.
+Node parameter C<graph-ignore-decorations> disables the decorations.
+
+=item * C<gprint-values>, C<gprint-header>, C<gprint-format-*>
+
+Optional. These parameters define the printing of values together with legends
+below the graph. C<gprint-values> is a comma-separated list of format names,
+and for each format name, there should be a corresponding C<gprint-format-*>
+parameter. C<gprint-header> defines a string that will be printed on top of
+all orther lines. Example:
+
+    <param name="gprint-values"         value="current,average,max,min"/>
+    <param name="gprint-header"
+           value="Current    Average    Maximum    Minimum"/>
+    <param name="gprint-format-current" value="LAST:%8.2lf%s"/>
+    <param name="gprint-format-average" value="AVERAGE:%8.2lf%s"/>
+    <param name="gprint-format-max"     value="MAX:%8.2lf%s"/>
+    <param name="gprint-format-min"     value="MIN:%8.2lf%s"/>
+
+=item * C<description>
+
+Optional. Defines the text description of the graph. This description is
+usually placed as ALT HTML attribute in the generated HTML pages.
+
+=item * C<rrd-params>
+
+Optional. Supplies additional RRDtool graph comand-line options, as one
+string separated by spaces.
+
+=back
+
+=item * C<rrprint>
+
+This view produces the text output from PRINT statement in
+RRD graph command. The required parameters are C<start> and C<print-cf>.
+The first one defines the starting time. C<end> may be also optionally
+specified.
+
+C<print-cf> specifies oe or more consolidation functions, separated by comma.
+The result of the rendering is the text line with the output values
+separated by colon (:).
+
+=back
+
+=item * C<disable-legend>, C<disable-title>, C<disable-vertical-label>
+
+When set to C<yes>, the corresponding elements of the graph are not displayed.
+
+
+
+=head3 Styling Profiles
+
+Styling profiles allow symbolic names to be used for line type
+and color.
+
+Two hashes in the beginning and a name refer to the line style from
+the styling profile, e.g. C<##BpsIn>, C<##green>, C<##one>, C<##two>.
+
+      <leaf name="InOutBytes">
+        <param name="comment" value="Input and Output bits per second graphs"/>
+        <param name="ds-type" value="rrd-multigraph"/>
+        <param name="ds-names" value="in,out"/>
+        <!-- IN -->
+        <param name="ds-expr-in" value="{ifInOctets}"/>
+        <param name="graph-legend-in" value="Bytes per second in"/>
+        <param name="line-style-in" value="##BpsIn"/>
+        <param name="line-color-in" value="##BpsIn"/>
+        <param name="line-order-in" value="1"/>
+        <!-- OUT -->
+        <param name="ds-expr-out" value="{ifOutOctets}"/>
+        <param name="graph-legend-out" value="Bytes per second out"/>
+        <param name="line-style-out" value="##BpsOut"/>
+        <param name="line-color-out" value="##BpsOut"/>
+        <param name="line-order-out" value="2"/>
+      </leaf>
+
+When processed the example above effectivly becomes:
+
+      <leaf name="InOutBytes">
+        <param name="comment" value="Input and Output bits per second graphs"/>
+        <param name="ds-type" value="rrd-multigraph"/>
+        <param name="ds-names" value="in,out"/>
+        <!-- IN -->
+        <param name="ds-expr-in" value="{ifInOctets}"/>
+        <param name="graph-legend-in" value="Bytes per second in"/>
+        <param name="line-style-in" value="AREA"/>
+        <param name="line-color-in" value="#00FF00"/>
+        <param name="line-order-in" value="1"/>
+        <!-- OUT -->
+        <param name="ds-expr-out" value="{ifOutOctets}"/>
+        <param name="graph-legend-out" value="Bytes per second out"/>
+        <param name="line-style-out" value="LINE2"/>
+        <param name="line-color-out" value="#0000FF"/>
+        <param name="line-order-out" value="2"/>
+      </leaf>
+
+Schema definitions can be modified in two ways
+(see the I<Torrus Styling Profile Guide> manual for available styles
+and override details)
+
+=over 4
+
+=item * Create an overlay schema:
+
+Specify the overlay schema in torrus-siteconfig.pl using the
+$Torrus::Renderer::stylingProfileOverlay variable.
+
+=item * Create a replacement schema:
+
+Specify the replacement schema in torrus-siteconfig using the
+$Torrus::Renderer::stylingProfile variable.
+
+=back
+
+
+=head2 Token sets definitions
+
+I<Token> is a symbolic identifier for each subtree or a leaf. 
+
+A I<tokenset> is a named list of tokens. Its contents can be
+rendered, and its members can be added or removed at any time.
+
+Each tokenset can have a number of parameters defined. It also
+inherits the parameter defined in the top C<E<lt>token-setsE<gt>>
+XML element:
+
+  <token-sets>
+
+    <param name="default-tset-view" value="default-tset-html" />
+    <param name="default-tsetlist-view" value="tset-list-html" />
+
+    <token-set name="jumps">
+      <param name="comment" value="Traffic rate jumps" />
+    </token-set>
+
+    <token-set name="hw-failures">
+      <param name="comment" value="Holt-Winters prediction failures" />
+    </token-set>
+
+  </token-sets>
+
+Parameter C<default-tsetlist-view> is mandatory for tokenset list.
+It defines the default view when displaying the list of tokensets.
+
+The following parameters are mandatory for tokensets:
+
+=over 4
+
+=item * C<default-tset-view>
+
+Determines the view for displaying the tokenset contents.
+
+=item * C<comment>
+
+The text that describes this tokenset.
+
+=back
+
+=head2 Monitor definitions
+
+I<Monitor> is a named set of parameters that defines the behaviour
+of monitor module. Each leaf can be given a number of monitors
+via C<monitor> parameter.
+
+Upon monitor module run, an I<action> is launched if the alarm conditions
+of a given monitor are satisfied.
+
+  <monitors>
+    <!-- First define the actions -->
+
+    <!-- This action will put the graphs of alarmed datasources in
+         a single alarm report page -->
+    <action name="graph-hw-failures">
+      <param name="action-type" value="tset" />
+      <param name="set-name" value="hw-failures" />
+    </action>
+
+    <action name="graph-jumps">
+      <param name="action-type" value="tset" />
+      <param name="set-name" value="jumps" />
+    </action>
+
+    <monitor name="hw-failures">
+      <param name="monitor-type" value="failures" />
+      <param name="action" value="graph-hw-failures" />
+      <param name="expires" value="3600" />
+    </monitor>
+
+    <!-- alarm if 5 minutes away it was 10 times lower -->
+    <monitor name="high-jumps">
+      <param name="monitor-type" value="expression" />
+      <param name="rpn-expr" value="{(-300)},10,*,GT,{},{(-300)},10,/,LT,OR" />
+      <param name="action" value="graph-jumps" />
+      <param name="expires" value="3600" />
+      <param name="comment"
+             value="Value jumped more than 10-fold in 5 minutes" />
+    </monitor>
+
+    <monitor name="hundred-megs">
+      <param name="monitor-type" value="expression" />
+      <param name="rpn-expr" value="100,1024,1024,*,*,GT" />
+      <param name="action" value="graph-jumps" />
+      <param name="expires" value="3600" />
+      <param name="comment"
+             value="Traffic is higher than 10 mbps" />
+    </monitor>
+  </monitors>
+
+=head3 Event types
+
+Should the alarm condition occur, a series of events is happening
+in sequentional order:
+
+=over 4
+
+=item * C<set>
+
+This event type occurs the first time the alarm condition is met.
+
+=item * C<repeat>
+
+This event type means that the alarm condition still persists
+after the previous run of Monitor.
+
+=item * C<clear>
+
+Event of this type happens when the alarm condition stops.
+
+=item * C<forget>
+
+Once the alarm is cleared, this event happens after the expiration
+time of the monitor.
+
+=back
+
+=head3 Monitor parameters
+
+=over 4
+
+=item * C<monitor-type>
+
+Mandatory parameter. Specifies the monitor type. The following monitor
+types are recognized:
+
+=over 8
+
+=item * C<failures>
+
+Triggers the action when Holt-Winters FAILURES function gives value of 1.
+This requires RRDtool verion 1.1.x and aberrant behaviour parameters
+defined for te given RRD file.
+
+=item * C<expression>
+
+Triggers the action when given RPN expression returns nonzero.
+See I<RPN expressions in Torrus> manual for more details.
+This monitor type implies that the RPN expression is specified in
+C<rpn-expr> parameter. The current leaf value is prepended to the given RPN.
+
+=back
+
+=item * C<rpn-expr>
+
+Mandatory for monitor type C<expression>. Defines the RPN expression to
+evaluate. The current leaf value is prepended to the given RPN.
+The expresion may reference leaf-dependent variables: the
+constructs of the form C<#varname> are replaced with the variable
+value specified in the leaf's C<monitor-vars> parameter.
+
+=item * C<action>
+
+Mandatory parameter, comma-separated list of action names (spaces
+are allowed). Each action is triggered when the alarm condition is met.
+
+=item * C<expires>
+
+Mandatory parameter, the number of seconds of expiration period.
+After the alarm condition becomes false, this parameter determines
+the time of memorizing the event in monitor status reports.
+
+=item * C<comment>
+
+Optional but recommended parameter, specifies the string identifying
+the event that this monitor watches.
+
+=item * C<severity>
+
+Optional severity level. Used for the action type C<exec>.
+
+=item * C<display-rpn-expr>
+
+Optional RPN expression for transforming the datasource value.
+If defined, it will be applied to the value before setting
+C<TORRUS_VALUE> and C<TORRUS_DISPLAY_VALUE> environment variables.
+
+=item * C<display-format>
+
+Optional I<sprintf> format for displaying the value in
+C<TORRUS_DISPLAY_VALUE> environment variable. Default is C<%.2f>.
+
+=back
+
+
+=head3 Action parameters
+
+=over 4
+
+=item * C<action-type>
+
+Mandatory parameter, defines the type of action. Recognized
+values are:
+
+=over 8
+
+=item * C<tset>
+
+When this type of action is triggered, the leaf is added to the specified
+tokenset (see I<Token sets definitions> section in this manual).
+The leaf persists in the tokenset until the event of type C<forget>.
+This action type implies the parameter C<tset-name>.
+
+=item * C<exec>
+
+This action type defines an external program to launch. Two other parameters
+determinate its behaviour: mandatory C<command> and optional C<launch-when>.
+
+=back
+
+=item * C<tset-name>
+
+Mandatory for action type C<tset>. Defines the tokenset name
+where the leaf is added when the monitor condition is met.
+
+=item * C<command>
+
+Mandatory for action type C<exec>. Defines the external program to launch.
+The following strings are substituted in the parameter value:
+
+=over 8
+
+=item * C<E<amp>gt;>
+
+Relaced with C<E<gt>>.
+
+=item * C<E<amp>lt;>
+
+Relaced with C<E<lt>>.
+
+=back
+
+The following environment variables are passed to the child process:
+
+=over 8
+
+=item * C<$TORRUS_HOME>
+
+C<prefix> where Torrus was installed.
+
+=item * C<$TORRUS_BIN>
+
+Directory containing Torrus executables.
+
+=item * C<$TORRUS_UPTIME>
+
+Number of seconds since Monitor has started.
+
+=item * C<$TORRUS_TREE>, C<$TORRUS_TOKEN>, C<$TORRUS_NODEPATH>
+
+Tree name, token and pathname of the leaf causing the alarm.
+
+=item * C<$TORRUS_NCOMMENT>, C<$TORRUS_NPCOMMENT>
+
+C<comment> parameter of the node and its parent.
+Empty if the parameter is not defined for the given leaf.
+
+=item * C<$TORRUS_EVENT>
+
+Event type.
+
+=item * C<$TORRUS_MONITOR>
+
+Monitor name
+
+=item * C<$TORRUS_MCOMMENT>
+
+Monitor's C<comment> parameter value.
+
+=item * C<$TORRUS_TSTAMP>
+
+Timestamp (in seconds since Epoch) of the event.
+
+=item * C<$TORRUS_VALUE>
+
+For expression monitor type, this returns the last read value of the
+datasource, possibly transformed by C<display-rpn-expr> expression.
+
+=item * C<$TORRUS_DISPLAY_VALUE>
+
+For expression monitor type, it contains a human-readable form
+of the value, possibly transformed by C<display-rpn-expr> expression.
+
+=item * C<$TORRUS_SEVERITY>
+
+If the C<severity> parameter is defined in the monitor, its value
+is passed with this variable.
+
+=back
+
+=item * C<launch-when>
+
+Optional for action type C<exec>. The comma-separated list of event
+types when the given action should be launched. If not defined,
+the event type C<set> is used by default.
+
+=item * C<setenv-params>
+
+Optional for action type C<exec>. The comma-separated list of leaf parameters
+which would be passed as environment variables to the child process.
+The environment variables are of the form C<$TORRUS_P_paramname>. Hyphens ('-')
+are replaced with underscores ('_') in the parameter names.
+
+=item * C<setenv-dataexpr>
+
+Optional for action type C<exec>. Comma-separated list of C<ENV=paramname>
+pairs. C<ENV> defines the environment variable name: it is prefixed with
+C<Torrus_>. C<paramname> defines the action parameter name. This parameter
+is interpreted as RPN expression applied to the current leaf being monitored.
+The result of this RPN expression is passed to the action script
+in the environment variable.
+
+Example:
+
+  <action name="report-temperature">
+      <param name="action-type" value="exec" />
+
+      <!-- This is our proprietary reporting script -->
+      <param name="command">
+        /usr/local/bin/report_temperature
+      </param>
+      <param name="launch-when" value="set" />
+
+      <!-- We want to tell the action script the actual values
+           of the "temperature" and "humidity" leaves in the current
+           datasource tree -->
+      <param name="setenv-dataexpr" value="TEMP=expr-temp, HMD=expr-hmd" />
+      <param name="expr-temp" value="{temperature(LAST)}" />
+      <param name="expr-hmd" value="{humidity(LAST)}" />
+
+      <!-- We also want to tell the action script the parameter "monitor-vars"
+           which was configured for the current leaf. -->
+      <param name="setenv-params" value="monitor-vars" />
+  </action>
+
+
+=back
+
+
+=head1 Author
+
+Copyright (c) 2002-2005 Stanislav Sinyagin E<lt>ssinyagin@yahoo.comE<gt>
diff --git a/torrus/examples/Makefile.am b/torrus/examples/Makefile.am
new file mode 100644 (file)
index 0000000..907565a
--- /dev/null
@@ -0,0 +1,29 @@
+
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.am,v 1.1 2010-12-27 00:04:40 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+examplesdir   =  $(exmpdir)
+dist_examples_DATA = \
+       README \
+       onms.tmpl \
+       onmsInterfaces.sh \
+       torrus-siteconfig.powerbook.pl \
+       setmonitor.xupdate.xml
+
diff --git a/torrus/examples/Makefile.in b/torrus/examples/Makefile.in
new file mode 100644 (file)
index 0000000..e058505
--- /dev/null
@@ -0,0 +1,377 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.in,v 1.1 2010-12-27 00:04:40 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = examples
+DIST_COMMON = README $(dist_examples_DATA) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(examplesdir)"
+dist_examplesDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_examples_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+FIND = @FIND@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KILL = @KILL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERLINC = @PERLINC@
+POD2MAN = @POD2MAN@
+POD2MAN_PRESENT_FALSE = @POD2MAN_PRESENT_FALSE@
+POD2MAN_PRESENT_TRUE = @POD2MAN_PRESENT_TRUE@
+POD2TEXT = @POD2TEXT@
+POD2TEXT_PRESENT_FALSE = @POD2TEXT_PRESENT_FALSE@
+POD2TEXT_PRESENT_TRUE = @POD2TEXT_PRESENT_TRUE@
+RM = @RM@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SLEEP = @SLEEP@
+STRIP = @STRIP@
+SU = @SU@
+VERSION = @VERSION@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+cachedir = @cachedir@
+cfgdefdir = @cfgdefdir@
+datadir = @datadir@
+dbhome = @dbhome@
+defrrddir = @defrrddir@
+distxmldir = @distxmldir@
+enable_pkgonly = @enable_pkgonly@
+enable_varperm = @enable_varperm@
+exec_prefix = @exec_prefix@
+exmpdir = @exmpdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mansec_misc = @mansec_misc@
+mansec_usercmd = @mansec_usercmd@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+perlithreads = @perlithreads@
+perllibdir = @perllibdir@
+perllibdirs = @perllibdirs@
+piddir = @piddir@
+pkgbindir = @pkgbindir@
+pkgdocdir = @pkgdocdir@
+pkghome = @pkghome@
+plugdevdisccfgdir = @plugdevdisccfgdir@
+pluginsdir = @pluginsdir@
+plugtorruscfgdir = @plugtorruscfgdir@
+plugwrapperdir = @plugwrapperdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+reportsdir = @reportsdir@
+sbindir = @sbindir@
+scriptsdir = @scriptsdir@
+seslockdir = @seslockdir@
+sesstordir = @sesstordir@
+sharedstatedir = @sharedstatedir@
+siteconfdir = @siteconfdir@
+sitedir = @sitedir@
+sitexmldir = @sitexmldir@
+supdir = @supdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+tmpldir = @tmpldir@
+tmpluserdir = @tmpluserdir@
+torrus_user = @torrus_user@
+var_group = @var_group@
+var_mode = @var_mode@
+var_user = @var_user@
+varprefix = @varprefix@
+webplaindir = @webplaindir@
+webscriptsdir = @webscriptsdir@
+wrapperdir = @wrapperdir@
+examplesdir = $(exmpdir)
+dist_examples_DATA = \
+       README \
+       onms.tmpl \
+       onmsInterfaces.sh \
+       torrus-siteconfig.powerbook.pl \
+       setmonitor.xupdate.xml
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  examples/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  examples/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+install-dist_examplesDATA: $(dist_examples_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(examplesdir)" || $(mkdir_p) "$(DESTDIR)$(examplesdir)"
+       @list='$(dist_examples_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_examplesDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(examplesdir)/$$f'"; \
+         $(dist_examplesDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(examplesdir)/$$f"; \
+       done
+
+uninstall-dist_examplesDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_examples_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(examplesdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(examplesdir)/$$f"; \
+       done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+       for dir in "$(DESTDIR)$(examplesdir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_examplesDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_examplesDATA uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+       distclean-generic distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am \
+       install-dist_examplesDATA install-exec install-exec-am \
+       install-info install-info-am install-man install-strip \
+       installcheck installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+       pdf-am ps ps-am uninstall uninstall-am \
+       uninstall-dist_examplesDATA uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/torrus/examples/README b/torrus/examples/README
new file mode 100644 (file)
index 0000000..fa4f848
--- /dev/null
@@ -0,0 +1,12 @@
+Some useful exmples of Torrus configuration and usage.
+
+XML configuration examples reside in xmlconfig/examples.
+
+*.xupdate.xml files are examples of XUpdate usage to modify the XML files
+generated by devdiscover. See also:
+  Torrus User Guide
+  XUpdate specification: http://www.xmldb.org/xupdate/
+  XUpdate implementation in Perl by Petr Pajas: XML::XUpdate::LibXML
+  XML Editing shell by Petr Pajas: http://xsh.sourceforge.net/
+
+
diff --git a/torrus/examples/onms.tmpl b/torrus/examples/onms.tmpl
new file mode 100644 (file)
index 0000000..5a32fb7
--- /dev/null
@@ -0,0 +1,54 @@
+[%#
+  Template-Toolkit template for OpenNMS Torrus config generation.
+  Author: Gustavo Torres
+  $Id: onms.tmpl,v 1.1 2010-12-27 00:04:40 ivan Exp $
+%]
+<?xml version="1.0"?>
+<!--
+  This file is autogenerated from [% $data %]
+-->
+
+[% PROCESS $data %]
+
+<configuration>
+<datasources>
+  <template name="onms-response">
+    <param name="ds-type"            value="rrd-file" />
+    <param name="rrd-hwpredict"      value="disabled" />
+    <param name="leaf-type"          value="rrd-def" />
+    <param name="rrd-cf"             value="AVERAGE" />
+    <param name="graph-lower-limit"  value="0" />
+    <param name="vertical-label"     value="milliseconds"/>
+  </template>
+  <template name="onms-response-icmp">
+    <leaf name="ICMP">
+      <param name="comment"          value="ICMP response time"/>
+      <param name="rrd-ds"           value="icmp" />
+      <param name="data-file"        value="icmp.rrd" />
+      <param name="graph-legend"     value="ICMP" />
+      <param name="vertical-label"   value="microseconds" />
+    </leaf>
+  </template>
+  [% FOREACH interface = ifs %]
+  <!-- ********************************************************** -->
+  <!-- IP address: [% interface.addr %] -->
+
+  <subtree name="[% interface.addr %]">
+    <param name="data-dir" value="[% responcedir _ "/" _ interface.addr %]"/>
+    <apply-template name="onms-response"/>
+    [% FOREACH svc = interface.services; 
+         IF svc.name == 'icmp' %]
+    <apply-template name="icmp" />
+    [% ELSE %]
+    <leaf name="[% svc.legend %]">
+      <param name="comment" value="[% svc.legend %] response time" />
+      <param name="rrd-ds" value="[% svc.name %]" />
+      <param name="data-file" value="[% svc.name %].rrd" />
+      <param name="graph-legend" value="[% svc.legend %]" />
+    </leaf>
+    [%   END;
+       END %]
+  </subtree>
+  [% END %]
+</datasources>
+</configuration>
diff --git a/torrus/examples/onmsInterfaces.sh b/torrus/examples/onmsInterfaces.sh
new file mode 100644 (file)
index 0000000..7f8d771
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/sh
+#  Copyright (C) 2004 Gustavo Torres
+#  Copyright (C) 2004 Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: onmsInterfaces.sh,v 1.1 2010-12-27 00:04:40 ivan Exp $
+# Gustavo Torres <r3db34rd@yahoo.com>
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+# This shell script extracts OpenNMS information about interfaces
+# and builds the data file which you can use with onms.tmpl to generate
+# Torrus XML configuration.
+
+# Usage (RESPONCEDIR setting may be skipped if it's in the default path)
+#
+# RESPONCEDIR=/var/opennms/rrd/response
+# export RESPONCEDIR
+# cd /usr/local/torrus-0.1/share/torrus/
+# ./examples/onmsInterfaces.sh > onms.data
+# tpage --define data=onms.data examples/onms.tmpl > xmlconfig/onms.xml
+
+
+if test x"$RESPONCEDIR" = x""; then
+  RESPONCEDIR=/var/opennms/rrd/response
+fi
+
+echo '[% responcedir = "'$RESPONCEDIR'" %]'
+echo '[% ifs = ['
+
+for ipaddr in `ls ${RESPONCEDIR}`; do
+  echo "  { addr => '$i',";
+  echo "    services => [";
+  for service in `ls ${RESPONCEDIR}/$i | awk -F. '{print $1}'`; do
+    echo -n "      {name => '${service}', "
+    legend=`echo $j | awk '{print toupper($1)}'`
+    echo "legend => '${legend}'}"
+  done
+  echo '    ]';
+  echo '  }';
+done
+echo '] %]'
+
+# Local Variables:
+# mode: shell-script
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/examples/setmonitor.xupdate.xml b/torrus/examples/setmonitor.xupdate.xml
new file mode 100644 (file)
index 0000000..c233ee5
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: setmonitor.xupdate.xml,v 1.1 2010-12-27 00:04:40 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!--
+  Example of XUpdate postprocessor for a devdiscover generated file
+-->
+
+<xupdate:modifications version="1.0"
+                       xmlns:xupdate="http://www.xmldb.org/xupdate">
+
+<!-- Insert additional creator-info after the last one -->
+<xupdate:insert-after
+    select="/configuration/creator-info[not(following-sibling::creator-info)]">
+  <creator-info>
+    This file was modified with XUpdate script setmonitor.xupdate.xml
+  </creator-info>
+</xupdate:insert-after>
+
+<!-- For every ifError leaf, set the monitor -->
+<xupdate:append select="//subtree[apply-template[@name='iftable-errors']]">
+  <xupdate:element name="subtree">
+   <xupdate:attribute name="name">ifErrors</xupdate:attribute>
+    <param name="monitor" value="check-iferrors"/>
+  </xupdate:element>
+</xupdate:append>
+
+</xupdate:modifications>
diff --git a/torrus/examples/torrus-siteconfig.powerbook.pl b/torrus/examples/torrus-siteconfig.powerbook.pl
new file mode 100644 (file)
index 0000000..0c17042
--- /dev/null
@@ -0,0 +1,48 @@
+# Torrus Site config. Put all your site specifics here.
+# You need to stop and start Apache server every time you change this file.
+#
+# An example using the rainbow-schema overlay.
+# Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+#
+# (ssinyagin) You can use statements like these from inside your
+# XML configurations:
+#   <include filename="generic/rfc2790.host-resources.xml"/>
+# Besides, "devdiscover" discovery tool will soon support most
+# of these vendor definitions.
+
+# $Id: torrus-siteconfig.powerbook.pl,v 1.1 2010-12-27 00:04:40 ivan Exp $
+# @(#) 10/18/03 torrus-siteconfig.pl 1.3 (10/18/03 18:44:31) sferry
+
+@Torrus::Global::xmlAlwaysIncludeFirst =
+    qw(
+       defaults.xml
+       snmp-defs.xml
+       collector-periods.xml
+       vendor/cisco.ios.xml
+       generic/rfc2790.host-resources.xml
+       generic/rfc1213.xml
+       vendor/ucd-snmp.xml
+    );
+
+%Torrus::Global::treeConfig =
+    (
+    'powerbook' => {
+            'description' => 'Powerbook Laptop Tree',
+            'xmlfiles' => [qw(
+                    powerbook/powerbook-defaults.xml
+                    powerbook/powerbook-ti.xml
+                    )],
+            'run' => {
+                    'collector' => 1,
+                    }
+            },
+
+     ); # CLOSE %Torrus::Global::treeConfig
+
+
+     # Override values in the current schema with those in
+     # rainbow schema, schema changes require an apache restart
+     $Torrus::Renderer::stylingProfileOverlay = "rainbow-schema";
+
+
+1;
diff --git a/torrus/init.d/torrus.in b/torrus/init.d/torrus.in
new file mode 100644 (file)
index 0000000..91e14be
--- /dev/null
@@ -0,0 +1,211 @@
+#!@SHELL@
+#
+# init.d script for Torrus
+# Install it as /etc/init.d/torrus (most UNIXes),
+# or as /usr/local/etc/rc.d/torrus.sh (FreeBSD), or probably somewhere else.
+#
+# $Id: torrus.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+### chkconfig info
+# chkconfig: 2345 90 10
+# description: Starts/Stops Torrus collectors and monitors
+###
+#
+### BEGIN INIT INFO
+# Provides: collector monitor
+# Required-Start: $network
+# Required-Stop: $network
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 6
+# Short-Description: Torrus collectors and monitors
+# Description: Start/stop Torrus collectors and monitors
+### END INIT INFO
+
+prefix=@prefix@
+sysconfdir=@sysconfdir@
+pkghome=@pkghome@
+cmddir=@pkgbindir@
+piddir=@piddir@
+sitedir=@sitedir@
+torrus_config_pl=@cfgdefdir@/torrus-config.pl
+
+. @cfgdefdir@/initscript.conf
+if test -f @siteconfdir@/initscript.siteconf; then
+  . @siteconfdir@/initscript.siteconf
+fi
+
+if test "$TORRUS_CHANGE_UID" = yes -a \
+        "${LOGNAME:-root}" = root -a \
+        "@SU@" != "no"; then
+  user=@torrus_user@
+  su="@SU@ ${user} -c"
+else
+  su="@SHELL@ -c"
+fi
+
+
+# Second argument can be the daemon name
+if test x"$2" = x; then
+  daemons="collector monitor"
+  monitor_cmdopts="$TORRUS_MONITOR_DELAY"
+  all_daemons=yes
+else
+  daemons=$2
+    # Third and fourth arguments may be the tree name and instance
+  if test x"$3" != x -a x"$4" != x; then
+    eval trees_${daemons}=$3
+    eval col_inst_${3}=$4
+    read_treenames=no
+  fi
+fi
+
+if test x"$TORRUS_COLLECTOR_CMDOPTS" != x; then
+  collector_cmdopts="$TORRUS_COLLECTOR_CMDOPTS"
+fi
+
+if test x${read_treenames} != xno; then
+
+  # Get the names of the trees for each daemon
+  for d in ${daemons}; do
+    eval trees_${d}=\"`@PERL@ -e 'require "'$torrus_config_pl'";
+    while((my $key, $val) = each %Torrus::Global::treeConfig) {
+      print "$key " if $val->{run}{'${d}'};
+    };'`\"
+  done
+
+  # Get the collector instance numbers for each tree
+  eval trees=\"\$\{trees_collector\}\"  
+  for t in ${trees}; do
+    eval col_inst_${t}=\"`@PERL@ -e 'require "'$torrus_config_pl'";
+    print join(" ",
+    (0 .. $Torrus::Global::treeConfig{'${t}'}{run}{collector}-1))'`\"
+  done
+fi
+
+start_daemons () {
+  for d in ${daemons}; do
+    eval trees=\"\$\{trees_${d}\}\"
+    eval daemon_cmdopts=\"\$\{${d}_cmdopts\}\"
+        
+    for t in ${trees}; do
+      if test ${d} = collector; then
+        eval instances=\"\$\{col_inst_${t}\}\"
+        for i in ${instances}; do
+          echo "starting Torrus collector instance ${i} for tree ${t}"
+          ${su} "${cmddir}/${d} --tree=${t} --instance=${i} \
+               ${daemon_cmdopts} ${TORRUS_CMDOPTS}"
+        done
+      else
+        echo "starting Torrus ${d} for tree ${t} ${daemon_cmdopts}"
+        ${su} "${cmddir}/${d} --tree=${t} ${daemon_cmdopts} ${TORRUS_CMDOPTS}"
+      fi
+    done
+  done
+
+  # RHEL based systems (RHEL, CentOS, Fedora) ignore the KXXtorrus script
+  # unless the corresponding lock is present
+  if test -d /var/lock/subsys; then
+    touch /var/lock/subsys/torrus
+  fi
+}
+
+stop_daemons () {
+  tokill=""
+  for d in ${daemons}; do
+  
+    eval trees=\"\$\{trees_${d}\}\"
+    for t in ${trees}; do
+    
+      if test ${d} = collector; then
+        eval instances=\"\$\{col_inst_${t}\}\"
+        
+        for i in ${instances}; do
+          pidfile="${piddir}/${d}.${t}_${i}.pid"
+          if test -r ${pidfile}; then
+            tokill=${tokill}' t='${t}'_'${i}';d='${d}
+            echo "stopping Torrus collector instance ${i} for tree ${t}"
+            pid=`cat ${pidfile}`
+            @KILL@ ${pid} || \
+              echo "Error: Cannot kill collector instance ${i} for tree ${t}"
+          fi
+        done
+        
+      else
+            
+        pidfile="${piddir}/${d}.${t}.pid"
+        if test -r ${pidfile}; then
+          tokill=${tokill}' t='${t}';d='${d}
+          echo "stopping Torrus ${d} for tree ${t}"
+          pid=`cat ${pidfile}`
+          @KILL@ ${pid} || echo "Error: Cannot kill ${d} for tree ${t}"
+        fi
+        
+      fi
+    done
+  done
+
+  killed=`echo $tokill | wc -w`
+  notdead=1
+  kc=$TORRUS_KILL_COUNT
+  while test $killed -gt 0 -a $kc -gt 0; do
+    echo "Sleeping for $TORRUS_KILL_SLEEP seconds to allow processes to exit"
+    @SLEEP@ $TORRUS_KILL_SLEEP
+    echo "Checking for kill resistant processes [$kc/$TORRUS_KILL_COUNT]"
+    kc=`expr $kc - 1`
+    for tuple in $tokill; do
+      eval $tuple
+      pidfile="${piddir}/${d}.${t}.pid"
+      if test -r ${pidfile}; then
+        echo "  Sending kill signal to Torrus ${d} for tree ${t}"
+        pid=`cat ${pidfile}`
+        @KILL@ ${pid} || echo "Error: Cannot kill ${d} for tree ${t}"
+      else
+        echo "${d} for ${t} has stopped"
+        killed=`expr $killed - 1`
+      fi
+    done
+  done
+
+  if test \( $killed -gt 0 \); then
+    echo "  Killing Remaining Processes"
+   for tuple in $tokill; do
+     eval $tuple
+     pidfile="${piddir}/${d}.${t}.pid"
+     if test -r ${pidfile}; then
+       echo "  Sending final kill -9 to Torrus ${d} for tree ${t}"
+       pid=`cat ${pidfile}`
+       @KILL@ -9 ${pid} || echo "Error: Cannot kill ${d} for tree ${t}"
+       @RM@ -f $pidfile
+     else
+       echo "${d} for ${t} has stopped"
+     fi
+   done
+  fi
+
+  # RHEL specifics
+  if test x"$all_daemons" = xyes -a -d /var/lock/subsys; then
+    rm -f /var/lock/subsys/torrus
+  fi
+}
+
+case "$1" in
+  'start')    start_daemons
+  ;;
+
+  'stop')     stop_daemons
+  ;;
+  'restart')  stop_daemons; start_daemons
+  ;;
+
+  *)  echo "Usage: $0 [start|stop|restart] [collector|monitor] [tree]"
+  ;;
+  esac
+
+# Local Variables:
+# mode: shell-script
+# sh-shell: sh
+# indent-tabs-mode: nil
+# sh-basic-offset: 2
+# End:
diff --git a/torrus/perllib/Makefile.am b/torrus/perllib/Makefile.am
new file mode 100644 (file)
index 0000000..b1b691a
--- /dev/null
@@ -0,0 +1,48 @@
+
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.am,v 1.1 2010-12-27 00:03:37 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+
+install-data-local:
+       $(mkinstalldirs) $(DESTDIR)$(perllibdir)
+       find * -type d ! -name CVS -print >list.tmp
+       for d in `cat list.tmp`; do \
+         $(mkinstalldirs) $(DESTDIR)$(perllibdir)/$$d; done
+       find * \( -name '*.pm' \) -type f -print >list.tmp
+       for f in `cat list.tmp`; do \
+         $(INSTALL_DATA) $$f $(DESTDIR)$(perllibdir)/$$f; done
+       rm -f list.tmp
+
+
+uninstall-local:
+       find * -type d ! -name CVS -print >list.tmp
+       for d in `cat list.tmp`; do \
+         rm -r $(DESTDIR)$(perllibdir)/$$d; done
+       rm -f list.tmp
+
+
+dist-hook:
+       find * -type d ! -name CVS -print >list.tmp
+       for d in `cat list.tmp`; do \
+         mkdir $(distdir)/$$d; done
+       find * \( -name '*.pm' -o -name '*.txt' \) -type f -print >list.tmp
+       for f in `cat list.tmp`; do \
+         cp $$f $(distdir)/$$f; done
+       rm -f list.tmp
diff --git a/torrus/perllib/Makefile.in b/torrus/perllib/Makefile.in
new file mode 100644 (file)
index 0000000..81714f4
--- /dev/null
@@ -0,0 +1,366 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.in,v 1.1 2010-12-27 00:03:37 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = perllib
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+FIND = @FIND@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KILL = @KILL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERLINC = @PERLINC@
+POD2MAN = @POD2MAN@
+POD2MAN_PRESENT_FALSE = @POD2MAN_PRESENT_FALSE@
+POD2MAN_PRESENT_TRUE = @POD2MAN_PRESENT_TRUE@
+POD2TEXT = @POD2TEXT@
+POD2TEXT_PRESENT_FALSE = @POD2TEXT_PRESENT_FALSE@
+POD2TEXT_PRESENT_TRUE = @POD2TEXT_PRESENT_TRUE@
+RM = @RM@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SLEEP = @SLEEP@
+STRIP = @STRIP@
+SU = @SU@
+VERSION = @VERSION@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+cachedir = @cachedir@
+cfgdefdir = @cfgdefdir@
+datadir = @datadir@
+dbhome = @dbhome@
+defrrddir = @defrrddir@
+distxmldir = @distxmldir@
+enable_pkgonly = @enable_pkgonly@
+enable_varperm = @enable_varperm@
+exec_prefix = @exec_prefix@
+exmpdir = @exmpdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mansec_misc = @mansec_misc@
+mansec_usercmd = @mansec_usercmd@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+perlithreads = @perlithreads@
+perllibdir = @perllibdir@
+perllibdirs = @perllibdirs@
+piddir = @piddir@
+pkgbindir = @pkgbindir@
+pkgdocdir = @pkgdocdir@
+pkghome = @pkghome@
+plugdevdisccfgdir = @plugdevdisccfgdir@
+pluginsdir = @pluginsdir@
+plugtorruscfgdir = @plugtorruscfgdir@
+plugwrapperdir = @plugwrapperdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+reportsdir = @reportsdir@
+sbindir = @sbindir@
+scriptsdir = @scriptsdir@
+seslockdir = @seslockdir@
+sesstordir = @sesstordir@
+sharedstatedir = @sharedstatedir@
+siteconfdir = @siteconfdir@
+sitedir = @sitedir@
+sitexmldir = @sitexmldir@
+supdir = @supdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+tmpldir = @tmpldir@
+tmpluserdir = @tmpluserdir@
+torrus_user = @torrus_user@
+var_group = @var_group@
+var_mode = @var_mode@
+var_user = @var_user@
+varprefix = @varprefix@
+webplaindir = @webplaindir@
+webscriptsdir = @webscriptsdir@
+wrapperdir = @wrapperdir@
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  perllib/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  perllib/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+       $(MAKE) $(AM_MAKEFLAGS) \
+         top_distdir="$(top_distdir)" distdir="$(distdir)" \
+         dist-hook
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-local
+
+.PHONY: all all-am check check-am clean clean-generic dist-hook \
+       distclean distclean-generic distdir dvi dvi-am html html-am \
+       info info-am install install-am install-data install-data-am \
+       install-data-local install-exec install-exec-am install-info \
+       install-info-am install-man install-strip installcheck \
+       installcheck-am installdirs maintainer-clean \
+       maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+       pdf-am ps ps-am uninstall uninstall-am uninstall-info-am \
+       uninstall-local
+
+
+install-data-local:
+       $(mkinstalldirs) $(DESTDIR)$(perllibdir)
+       find * -type d ! -name CVS -print >list.tmp
+       for d in `cat list.tmp`; do \
+         $(mkinstalldirs) $(DESTDIR)$(perllibdir)/$$d; done
+       find * \( -name '*.pm' \) -type f -print >list.tmp
+       for f in `cat list.tmp`; do \
+         $(INSTALL_DATA) $$f $(DESTDIR)$(perllibdir)/$$f; done
+       rm -f list.tmp
+
+uninstall-local:
+       find * -type d ! -name CVS -print >list.tmp
+       for d in `cat list.tmp`; do \
+         rm -r $(DESTDIR)$(perllibdir)/$$d; done
+       rm -f list.tmp
+
+dist-hook:
+       find * -type d ! -name CVS -print >list.tmp
+       for d in `cat list.tmp`; do \
+         mkdir $(distdir)/$$d; done
+       find * \( -name '*.pm' -o -name '*.txt' \) -type f -print >list.tmp
+       for f in `cat list.tmp`; do \
+         cp $$f $(distdir)/$$f; done
+       rm -f list.tmp
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/torrus/perllib/Torrus/ACL.pm b/torrus/perllib/Torrus/ACL.pm
new file mode 100644 (file)
index 0000000..53b9f61
--- /dev/null
@@ -0,0 +1,156 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: ACL.pm,v 1.1 2010-12-27 00:03:43 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+package Torrus::ACL;
+
+use Torrus::DB;
+use Torrus::Log;
+
+use strict;
+
+BEGIN
+{
+    eval( 'require ' . $Torrus::ACL::userAuthModule );
+    die( $@ ) if $@;
+}
+
+sub new
+{
+    my $self = {};
+    my $class = shift;
+    my %options = @_;
+    bless $self, $class;
+
+    eval( '$self->{"auth"} = new ' . $Torrus::ACL::userAuthModule );
+    die( $@ ) if $@;
+
+    my $writing = $options{'-WriteAccess'};
+
+    $self->{'db_users'} = new Torrus::DB('users', -WriteAccess => $writing );
+    defined( $self->{'db_users'} ) or return( undef );
+
+    $self->{'db_acl'} = new Torrus::DB('acl', -WriteAccess => $writing );
+    defined( $self->{'db_acl'} ) or return( undef );
+
+    $self->{'is_writing'} = $writing;
+
+    return $self;
+}
+
+
+sub DESTROY
+{
+    my $self = shift;
+
+    Debug('Destroying ACL object');
+
+    undef $self->{'db_users'};
+    undef $self->{'db_acl'};
+}
+
+
+sub hasPrivilege
+{
+    my $self = shift;
+    my $uid = shift;
+    my $object = shift;
+    my $privilege = shift;
+
+    foreach my $group ( $self->memberOf( $uid ) )
+    {
+        if( $self->{'db_acl'}->get( $group.':'.$object.':'.$privilege ) )
+        {
+            Debug('User ' . $uid . ' has privilege ' . $privilege .
+                  ' for ' . $object);
+            return 1;
+        }
+    }
+
+    if( $object ne '*' )
+    {
+        return $self->hasPrivilege( $uid, '*', $privilege );
+    }
+    
+    Debug('User ' . $uid . ' has NO privilege ' . $privilege .
+          ' for ' . $object);
+    return undef;
+}
+
+
+sub memberOf
+{
+    my $self = shift;
+    my $uid = shift;
+
+    my $glist = $self->{'db_users'}->get( 'gm:' . $uid );
+    return( defined( $glist ) ? split(',', $glist) : () );
+}
+
+
+sub authenticateUser
+{
+    my $self = shift;
+    my $uid = shift;
+    my $password = shift;
+
+    my @attrList = $self->{'auth'}->getUserAttrList();
+    my $attrValues = {};
+    foreach my $attr ( @attrList )
+    {
+        $attrValues->{$attr} = $self->userAttribute( $uid, $attr );
+    }
+
+    my $ret = $self->{'auth'}->authenticateUser( $uid, $password,
+                                                 $attrValues );
+    Debug('User authentication: uid=' . $uid . ', result=' .
+          ($ret ? 'true':'false'));
+    return $ret;
+}
+
+
+sub userAttribute
+{
+    my $self = shift;
+    my $uid = shift;
+    my $attr = shift;
+
+    return $self->{'db_users'}->get( 'ua:' . $uid . ':' . $attr );
+}
+
+
+sub groupAttribute
+{
+    my $self = shift;
+    my $group = shift;
+    my $attr = shift;
+
+    return $self->{'db_users'}->get( 'ga:' . $group . ':' . $attr );
+}
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/ACL/AuthLocalMD5.pm b/torrus/perllib/Torrus/ACL/AuthLocalMD5.pm
new file mode 100644 (file)
index 0000000..b1e6a15
--- /dev/null
@@ -0,0 +1,79 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: AuthLocalMD5.pm,v 1.1 2010-12-27 00:03:59 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+package Torrus::ACL::AuthLocalMD5;
+
+use Torrus::Log;
+
+use Digest::MD5 qw(md5_hex);
+use strict;
+
+sub new
+{
+    my $self = {};
+    my $class = shift;
+    bless $self, $class;
+    return $self;
+}
+
+
+sub getUserAttrList
+{
+    return qw(userPasswordMD5);
+}
+
+sub authenticateUser
+{
+    my $self = shift;
+    my $uid = shift;
+    my $password = shift;
+    my $attrValues = shift;
+
+    if( not $password or not $attrValues->{'userPasswordMD5'} )
+    {
+        return undef;
+    }
+    my $pw_md5 = md5_hex( $password );
+    return( $pw_md5 eq $attrValues->{'userPasswordMD5'} );
+}
+
+
+sub setPassword
+{
+    my $self = shift;
+    my $uid = shift;
+    my $password = shift;
+
+    my $attrValues = {};
+    $attrValues->{'userPasswordMD5'} = md5_hex( $password );
+    return $attrValues;
+}
+
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/ACL/Edit.pm b/torrus/perllib/Torrus/ACL/Edit.pm
new file mode 100644 (file)
index 0000000..9966c9e
--- /dev/null
@@ -0,0 +1,627 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Edit.pm,v 1.1 2010-12-27 00:03:59 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+package Torrus::ACL::Edit;
+
+use Torrus::ACL;
+use Torrus::Log;
+
+use strict;
+
+@Torrus::ACL::Edit::ISA = qw(Torrus::ACL);
+
+sub new
+{
+    my $proto = shift;
+    my %options = @_;
+    my $class = ref($proto) || $proto;
+    $options{'-WriteAccess'} = 1;
+    my $self  = $class->SUPER::new( %options );
+    bless $self, $class;
+    return $self;
+}
+
+
+sub addGroups
+{
+    my $self = shift;
+    my @groups = shift;
+
+    my $ok = 1;
+    foreach my $group ( @groups )
+    {
+        if( length( $group ) == 0 or $group =~ /\W/ )
+        {
+            Error('Invalid group name: ' . $group);
+            $ok = 0;
+        }
+        elsif( $self->groupExists( $group ) )
+        {
+            Error('Cannot add group ' . $group . ': the group already exists');
+            $ok = 0;
+        }
+        else
+        {
+            $self->{'db_users'}->addToList( 'G:', $group );
+            $self->setGroupModified( $group );
+            Info('Group added: ' . $group);
+        }
+    }
+    return $ok;
+}
+
+sub deleteGroups
+{
+    my $self = shift;
+    my @groups = shift;
+
+    my $ok = 1;
+    foreach my $group ( @groups )
+    {
+        if( $self->groupExists( $group ) )
+        {
+            my $members = $self->listGroupMembers( $group );
+            foreach my $uid ( @{$members} )
+            {
+                $self->{'db_users'}->delFromList( 'gm:' . $uid, $group );
+            }
+            $self->{'db_users'}->delFromList( 'G:', $group );
+
+            my $cursor = $self->{'db_acl'}->cursor( -Write => 1 );
+            while( my ($key, $val) = $self->{'db_acl'}->next( $cursor ) )
+            {
+                my( $dbgroup, $object, $privilege ) = split( ':', $key );
+                if( $dbgroup eq $group )
+                {
+                    $self->{'db_acl'}->c_del( $cursor );
+                }
+            }
+            undef $cursor;
+
+            Info('Group deleted: ' . $group);
+        }
+        else
+        {
+            Error('Cannot delete group ' . $group .
+                  ': the group does not exist');
+            $ok = 0;
+        }
+    }
+    return $ok;
+}
+
+sub groupExists
+{
+    my $self = shift;
+    my $group = shift;
+
+    return $self->{'db_users'}->searchList( 'G:', $group );
+}
+
+
+sub listGroups
+{
+    my $self = shift;
+
+    my $list = $self->{'db_users'}->get( 'G:' );
+
+    return split( ',', $list );
+}
+
+
+sub listGroupMembers
+{
+    my $self = shift;
+    my $group = shift;
+
+    my $members = [];
+
+    my $cursor = $self->{'db_users'}->cursor();
+    while( my ($key, $val) = $self->{'db_users'}->next( $cursor ) )
+    {
+        my( $selector, $uid ) = split(':', $key);
+        if( $selector eq 'gm' )
+        {
+            if( defined($val) and length($val) > 0 and
+                grep {$group eq $_} split(',', $val) )
+            {
+                push( @{$members}, $uid );
+            }
+        }
+    }
+    undef $cursor;
+    return $members;
+}
+
+
+sub addUserToGroups
+{
+    my $self = shift;
+    my $uid = shift;
+    my @groups = @_;
+
+    my $ok = 1;
+    if( $self->userExists( $uid ) )
+    {
+        foreach my $group ( @groups )
+        {
+            if( $self->groupExists( $group ) )
+            {
+                if( not grep {$group eq $_} $self->memberOf( $uid ) )
+                {
+                    $self->{'db_users'}->addToList( 'gm:' . $uid, $group );
+                    $self->setGroupModified( $group );
+                    Info('Added ' . $uid . ' to group ' . $group);
+                }
+                else
+                {
+                    Error('Cannot add ' . $uid . ' to group ' . $group .
+                          ': user is already a member of this group');
+                    $ok = 0;
+                }
+            }
+            else
+            {
+                Error('Cannot add ' . $uid . ' to group ' . $group .
+                      ': group does not exist');
+                $ok = 0;
+            }
+        }
+    }
+    else
+    {
+        Error('Cannot add user ' . $uid .
+              'to groups: user does not exist');
+        $ok = 0;
+    }
+    return $ok;
+}
+
+
+sub delUserFromGroups
+{
+    my $self = shift;
+    my $uid = shift;
+    my @groups = shift;
+
+    my $ok = 1;
+    if( $self->userExists( $uid ) )
+    {
+        foreach my $group ( @groups )
+        {
+            if( $self->groupExists( $group ) )
+            {
+                if( grep {$group eq $_} $self->memberOf( $uid ) )
+                {
+                    $self->{'db_users'}->delFromList( 'gm:' . $uid, $group );
+                    $self->setGroupModified( $group );
+                    Info('Deleted ' . $uid . ' from group ' . $group);
+                }
+                else
+                {
+                    Error('Cannot delete ' . $uid . ' from group ' . $group .
+                          ': user is not a member of this group');
+                    $ok = 0;
+                }
+            }
+            else
+            {
+                Error('Cannot detete ' . $uid . ' from group ' . $group .
+                      ': group does not exist');
+                $ok = 0;
+            }
+        }
+    }
+    else
+    {
+        Error('Cannot delete user ' . $uid .
+              'from groups: user does not exist');
+        $ok = 0;
+    }
+    return $ok;
+}
+
+
+sub addUser
+{
+    my $self = shift;
+    my $uid = shift;
+    my $attrValues = shift;
+
+    my $ok = 1;
+    if( length( $uid ) == 0 or $uid =~ /\W/ )
+    {
+        Error('Invalid user ID: ' . $uid);
+        $ok = 0;
+    }
+    elsif( $self->userExists( $uid ) )
+    {
+        Error('Cannot add user ' . $uid . ': the user already exists');
+        $ok = 0;
+    }
+    else
+    {
+        $self->setUserAttribute( $uid, 'uid', $uid );
+        if( defined( $attrValues ) )
+        {
+            $self->setUserAttributes( $uid, $attrValues );
+        }
+        Info('User added: ' . $uid);
+    }
+    return $ok;
+}
+
+
+sub userExists
+{
+    my $self = shift;
+    my $uid = shift;
+
+    my $dbuid = $self->userAttribute( $uid, 'uid' );
+    return( defined( $dbuid ) and ( $dbuid eq $uid ) );
+}
+
+sub listUsers
+{
+    my $self = shift;
+
+    my @ret;
+
+    my $cursor = $self->{'db_users'}->cursor();
+    while( my ($key, $val) = $self->{'db_users'}->next( $cursor ) )
+    {
+        my( $selector, $uid, $attr ) = split(':', $key);
+        if( $selector eq 'ua' and $attr eq 'uid' )
+        {
+            push( @ret, $uid );
+        }
+    }
+    undef $cursor;
+    return @ret;
+}
+
+sub setUserAttribute
+{
+    my $self = shift;
+    my $uid = shift;
+    my $attr = shift;
+    my $val = shift;
+
+    my $ok = 1;
+    if( length( $attr ) == 0 or $attr =~ /\W/ )
+    {
+        Error('Invalid attribute name: ' . $attr);
+        $ok = 0;
+    }
+    else
+    {
+        $self->{'db_users'}->put( 'ua:' . $uid . ':' . $attr, $val );
+        $self->{'db_users'}->addToList( 'uA:' . $uid, $attr );
+        if( $attr ne 'modified' )
+        {
+            $self->setUserModified( $uid );
+        }
+        Debug('Set ' . $attr . ' for ' . $uid . ': ' . $val);
+    }
+    return $ok;
+}
+
+
+sub delUserAttribute
+{
+    my $self = shift;
+    my $uid = shift;
+    my @attrs = @_;
+
+    foreach my $attr ( @attrs )
+    {
+        $self->{'db_users'}->del( 'ua:' . $uid . ':' . $attr );
+        $self->{'db_users'}->delFromList( 'uA:' . $uid, $attr );
+        $self->setUserModified( $uid );
+        Debug('Deleted ' . $attr . ' from ' . $uid);
+    }
+}
+
+
+sub setUserAttributes
+{
+    my $self = shift;
+    my $uid = shift;
+    my $attrValues = shift;
+
+    my $ok = 1;
+    
+    foreach my $attr ( keys %{$attrValues} )
+    {
+        $ok = $self->setUserAttribute( $uid, $attr, $attrValues->{$attr} )
+            ? $ok:0;
+    }
+    
+    return $ok;
+}
+
+
+sub setUserModified
+{
+    my $self = shift;
+    my $uid = shift;
+
+    $self->setUserAttribute( $uid, 'modified', scalar( localtime( time() ) ) );
+}
+
+sub listUserAttributes
+{
+    my $self = shift;
+    my $uid = shift;
+
+    my $list = $self->{'db_users'}->get( 'uA:' . $uid );
+
+    return split( ',', $list );
+}
+
+
+sub setPassword
+{
+    my $self = shift;
+    my $uid = shift;
+    my $password = shift;
+
+    my $ok = 1;
+    if( $self->userExists( $uid ) )
+    {
+        if( length( $password ) < $Torrus::ACL::minPasswordLength )
+        {
+            Error('Password too short: must be ' .
+                  $Torrus::ACL::minPasswordLength . ' characters long');
+            $ok = 0;
+        }
+        else
+        {
+            my $attrValues = $self->{'auth'}->setPassword( $uid, $password );
+            $self->setUserAttributes( $uid, $attrValues );
+            Info('Password set for ' . $uid);
+        }
+    }
+    else
+    {
+        Error('Cannot change password for user ' . $uid .
+              ': user does not exist');
+        $ok = 0;
+    }
+    return $ok;
+}
+
+
+sub deleteUser
+{
+    my $self = shift;
+    my $uid = shift;
+
+    my $ok = 1;
+    if( $self->userExists( $uid ) )
+    {
+        my $cursor = $self->{'db_users'}->cursor( -Write => 1 );
+        while( my ($key, $val) = $self->{'db_users'}->next( $cursor ) )
+        {
+            my( $selector, $dbuid ) = split(':', $key);
+            if( ( $selector eq 'gm' or $selector eq 'ua' ) and
+                $dbuid eq $uid )
+            {
+                $self->{'db_users'}->c_del( $cursor );
+            }
+        }
+        undef $cursor;
+
+        Info('User deleted: ' . $uid);
+    }
+    else
+    {
+        Error('Cannot delete user ' . $uid . ': user does not exist');
+        $ok = 0;
+    }
+    return $ok;
+}
+
+
+sub setGroupAttribute
+{
+    my $self = shift;
+    my $group = shift;
+    my $attr = shift;
+    my $val = shift;
+
+    my $ok = 1;
+    if( length( $attr ) == 0 or $attr =~ /\W/ )
+    {
+        Error('Invalid attribute name: ' . $attr);
+        $ok = 0;
+    }
+    else
+    {
+        $self->{'db_users'}->put( 'ga:' . $group . ':' . $attr, $val );
+        $self->{'db_users'}->addToList( 'gA:' . $group, $attr );
+        if( $attr ne 'modified' )
+        {
+            $self->setGroupModified( $group );
+        }
+        Debug('Set ' . $attr . ' for ' . $group . ': ' . $val);
+    }
+    return $ok;
+}
+
+
+sub listGroupAttributes
+{
+    my $self = shift;
+    my $group = shift;
+
+    my $list = $self->{'db_users'}->get( 'gA:' . $group );
+
+    return split( ',', $list );
+}
+
+
+
+sub setGroupModified
+{
+    my $self = shift;
+    my $group = shift;
+
+    $self->setGroupAttribute( $group, 'modified',
+                              scalar( localtime( time() ) ) );
+}
+
+
+sub setPrivilege
+{
+    my $self = shift;
+    my $group = shift;
+    my $object = shift;
+    my $privilege = shift;
+
+    my $ok = 1;
+    if( $self->groupExists( $group ) )
+    {
+        $self->{'db_acl'}->put( $group.':'.$object.':'.$privilege, 1 );
+        $self->setGroupModified( $group );
+        Info('Privilege ' . $privilege . ' for object ' . $object .
+             ' set for group ' . $group);
+    }
+    else
+    {
+        Error('Cannot set privilege for group ' . $group .
+              ': group does not exist');
+        $ok = 0;
+    }
+    return $ok;
+}
+
+
+sub clearPrivilege
+{
+    my $self = shift;
+    my $group = shift;
+    my $object = shift;
+    my $privilege = shift;
+
+    my $ok = 1;
+    if( $self->groupExists( $group ) )
+    {
+        my $key = $group.':'.$object.':'.$privilege;
+        if( $self->{'db_acl'}->get( $key ) )
+        {
+            $self->{'db_acl'}->del( $key );
+            $self->setGroupModified( $group );
+            Info('Privilege ' . $privilege . ' for object ' . $object .
+                 ' revoked from group ' . $group);
+        }
+    }
+    else
+    {
+        Error('Cannot revoke privilege from group ' . $group .
+              ': group does not exist');
+        $ok = 0;
+    }
+    return $ok;
+}
+
+
+sub listPrivileges
+{
+    my $self = shift;
+    my $group = shift;
+
+    my $ret = {};
+
+    my $cursor = $self->{'db_acl'}->cursor();
+    while( my ($key, $val) = $self->{'db_acl'}->next( $cursor ) )
+    {
+        my( $dbgroup, $object, $privilege ) = split( ':', $key );
+        if( $dbgroup eq $group )
+        {
+            $ret->{$object}{$privilege} = 1;
+        }
+    }
+    undef $cursor;
+
+    return $ret;
+}
+
+
+sub clearConfig
+{
+    my $self = shift;
+
+    $self->{'db_acl'}->trunc();
+    $self->{'db_users'}->trunc();
+
+    Info('Cleared the ACL configuration');
+    return 1;
+}
+
+sub exportACL
+{
+    my $self = shift;
+    my $exportfile = shift;
+    my $exporttemplate = shift;
+
+    my $ok;
+    eval 'require Torrus::ACL::Export;
+          $ok = Torrus::ACL::Export::exportACL( $self, $exportfile,
+                                              $exporttemplate );';
+    if( $@ )
+    {
+        Error($@);
+        return 0;
+    }
+    else
+    {
+        return $ok;
+    }
+}
+
+sub importACL
+{
+    my $self = shift;
+    my $importfile = shift;
+
+    my $ok;
+    eval 'require Torrus::ACL::Import;
+          $ok = Torrus::ACL::Import::importACL( $self, $importfile );';
+
+    if( $@ )
+    {
+        Error($@);
+        return 0;
+    }
+    else
+    {
+        return $ok;
+    }
+}
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/ACL/Export.pm b/torrus/perllib/Torrus/ACL/Export.pm
new file mode 100644 (file)
index 0000000..a4c8c6a
--- /dev/null
@@ -0,0 +1,91 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Export.pm,v 1.1 2010-12-27 00:03:59 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+package Torrus::ACL::Export;
+
+use Torrus::ACL;
+use Torrus::ACL::Edit;
+use Torrus::Log;
+
+use Template;
+
+use strict;
+
+
+sub exportACL
+{
+    my $self = shift;
+    my $exportfile = shift;
+    my $exporttemplate = shift;
+
+    my $tt = new Template(INCLUDE_PATH => $Torrus::Global::templateDirs,
+                          TRIM => 1);
+
+    my $vars = {
+        'groups'      => sub { return $self->listGroups(); },
+        'users'       => sub { return $self->listUsers(); },
+        'memberof'    => sub { return $self->memberOf($_[0]); },
+        'uattrlist'   => sub { return $self->listUserAttributes($_[0]); },
+        'uattr'       => sub { return $self->userAttribute($_[0], $_[1]); },
+        'gattrlist'   => sub { return $self->listGroupAttributes($_[0]); },
+        'gattr'       => sub { return $self->groupAttribute($_[0], $_[1]); },
+        'privileges'  => sub { return $self->listPrivileges($_[0]); },
+        'version'    => $Torrus::Global::version,
+        'xmlnorm'     => \&xmlnormalize
+        };
+
+    my $ok = $tt->process($exporttemplate, $vars, $exportfile);
+
+    if( not $ok )
+    {
+        print STDERR "Error while processing template: ".$tt->error()."\n";
+    }
+    else
+    {
+        Info('Wrote ' . $exportfile);
+    }
+
+    return $ok;
+}
+
+
+sub xmlnormalize
+{
+    my( $txt )= @_;
+
+    $txt =~ s/\&/\&amp\;/gm;
+    $txt =~ s/\</\&lt\;/gm;
+    $txt =~ s/\>/\&gt\;/gm;
+    $txt =~ s/\'/\&apos\;/gm;
+    $txt =~ s/\"/\&quot\;/gm;
+
+    return $txt;
+}
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/ACL/Import.pm b/torrus/perllib/Torrus/ACL/Import.pm
new file mode 100644 (file)
index 0000000..5c522cf
--- /dev/null
@@ -0,0 +1,157 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Import.pm,v 1.1 2010-12-27 00:03:59 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+package Torrus::ACL::Import;
+
+use Torrus::ACL;
+use Torrus::ACL::Edit;
+use Torrus::Log;
+
+use XML::LibXML;
+use strict;
+
+my %formatsSupported = ('1.0' => 1,
+                        '1.1' => 1);
+
+sub importACL
+{
+    my $self = shift;
+    my $filename = shift;
+
+    my $ok = 1;
+    my $parser = new XML::LibXML;
+    my $doc;
+    eval { $doc = $parser->parse_file( $filename );  };
+    if( $@ )
+    {
+        Error("Failed to parse $filename: $@");
+        return 0;
+    }
+
+    my $root = $doc->documentElement();
+    if( $root->nodeName() ne 'aclexport' )
+    {
+        Error('XML root element is not "aclexport" in ' . $filename);
+        return 0;
+    }
+
+    my $format_version =
+        (($root->getElementsByTagName('file-info'))[0]->
+         getElementsByTagName('format-version'))[0]->textContent();
+    if( not $format_version or not $formatsSupported{$format_version} )
+    {
+        Error('Invalid format or format version not supported: ' . $filename);
+        return 0;
+    }
+
+    foreach my $groupnode ( ($root->getElementsByTagName('groups'))[0]->
+                            getElementsByTagName('group') )
+    {
+        my $group = $groupnode->getAttribute('name');
+        Debug('Importing group: ' . $group);
+        if( not $self->groupExists( $group ) )
+        {
+            $ok = $self->addGroups( $group ) ? $ok:0;
+        }
+        else
+        {
+            Debug('Group already exists: ' . $group);
+        }
+
+        foreach my $privnode ( $groupnode->getElementsByTagName('privilege') )
+        {
+            my $object = $privnode->getAttribute('object');
+            my $priv = $privnode->getAttribute('name');
+            Debug('Setting privilege ' . $priv . ' for ' . $object .
+                  ' to group ' . $group);
+            $ok = $self->setPrivilege( $group, $object, $priv ) ? $ok:0;
+        }
+
+        foreach my $attrnode ( $groupnode->getElementsByTagName('attribute') )
+        {
+            my $attr = $attrnode->getAttribute('name');
+            if( $attr ne 'modified' )
+            {
+                my $value = $attrnode->getAttribute('value');
+                Debug('Setting attribute ' . $attr . ' for group ' . $group .
+                      ' to ' . $value);
+                $ok = $self->setGroupAttribute( $group, $attr, $value )
+                    ? $ok:0;
+            }
+        }
+    }
+
+    foreach my $usernode ( ($root->getElementsByTagName('users'))[0]->
+                            getElementsByTagName('user') )
+    {
+        my $uid = $usernode->getAttribute('uid');
+        Debug('Importing user: ' . $uid);
+
+        if( not $self->userExists( $uid ) )
+        {
+            $ok = $self->addUser( $uid ) ? $ok:0;
+        }
+        else
+        {
+            Debug('User already exists: ' . $uid);
+        }
+
+        foreach my $membernode ( $usernode->getElementsByTagName('member-of') )
+        {
+            my $group = $membernode->getAttribute('group');
+            Debug('Adding ' . $uid . ' to group ' . $group);
+
+            if( not grep {$group eq $_} $self->memberOf( $uid ) )
+            {
+                $ok = $self->addUserToGroups( $uid, $group ) ? $ok:0;
+            }
+            else
+            {
+                Debug('User ' . $uid . ' is already in group ' . $group);
+            }
+        }
+
+        foreach my $attrnode ( $usernode->getElementsByTagName('attribute') )
+        {
+            my $attr = $attrnode->getAttribute('name');
+            if( $attr ne 'modified' )
+            {
+                my $value = $attrnode->getAttribute('value');
+                Debug('Setting attribute ' . $attr . ' for user ' . $uid .
+                      ' to ' . $value);
+                $ok = $self->setUserAttribute( $uid, $attr, $value ) ? $ok:0;
+            }
+        }
+    }
+    Debug('Import finished');
+    return $ok;
+}
+
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Apache2Handler.pm b/torrus/perllib/Torrus/Apache2Handler.pm
new file mode 100644 (file)
index 0000000..3c75443
--- /dev/null
@@ -0,0 +1,62 @@
+#  Copyright (C) 2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Apache2Handler.pm,v 1.1 2010-12-27 00:03:43 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Apache mod_perl handler. See http://perl.apache.org
+
+package Torrus::Apache2Handler;
+
+use strict;
+use Apache2::Const -compile => qw(:common);
+
+use Torrus::CGI;
+
+sub handler : method
+{
+    my($class, $r) = @_;
+
+    # Before torrus-1.0.9, Apache2 handler was designed
+    # for "SetHandler modperl". Now it should be used with perl-script
+    # handler only
+    
+    if( $r->handler() ne 'perl-script')
+    {
+        $r->content_type('text/plain');
+        $r->print("Apache configuration must be changed.\n");
+        $r->print("The current version ot Torrus is incompatible with ");
+        $r->print("\"SetHandler modperl\" statement.\n");
+        $r->print("Change it to:\n");
+        $r->print("  SetHandler perl-script\n");
+        return Apache2::Const::OK;
+    }
+    
+    my $q = CGI->new($r);
+    Torrus::CGI->process( $q );
+
+    return Apache2::Const::OK;    
+}
+
+
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/ApacheHandler.pm b/torrus/perllib/Torrus/ApacheHandler.pm
new file mode 100644 (file)
index 0000000..a133579
--- /dev/null
@@ -0,0 +1,46 @@
+#  Copyright (C) 2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: ApacheHandler.pm,v 1.1 2010-12-27 00:03:38 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Apache mod_perl handler. See http://perl.apache.org
+
+package Torrus::ApacheHandler;
+
+use strict;
+use Apache;
+
+use Torrus::CGI;
+
+sub handler
+{
+    my $r = shift;
+
+    my $q = CGI->new($r);
+    Torrus::CGI->process( $q );
+    
+    return Apache::Constants::OK;    
+}
+
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/CGI.pm b/torrus/perllib/Torrus/CGI.pm
new file mode 100644 (file)
index 0000000..574e872
--- /dev/null
@@ -0,0 +1,423 @@
+#  Copyright (C) 2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: CGI.pm,v 1.1 2010-12-27 00:03:43 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Universal CGI handler for Apache mod_perl and FastCGI
+
+package Torrus::CGI;
+
+use strict;
+use CGI;
+use IO::File;
+
+# This modue is not a part of mod_perl
+use Apache::Session::File;
+
+
+use Torrus::Log;
+use Torrus::Renderer;
+use Torrus::SiteConfig;
+use Torrus::ACL;
+
+## Torrus::CGI->process($q)
+## Expects a CGI object as input
+
+sub process
+{
+    my($class, $q) = @_;
+
+    my $path_info = $q->url(-path => 1);
+
+    # quickly give plaintext file contents
+    {
+        my $pos = index( $path_info, $Torrus::Renderer::plainURL );
+        if( $pos >= 0 )
+        {
+            my $fname = $Torrus::Global::webPlainDir . '/' .
+                substr( $path_info,
+                        $pos + length($Torrus::Renderer::plainURL) );
+
+            my $ok = 0;
+
+            my $type;
+            if( $path_info =~ /\.css$/o )
+            {
+                $type = 'text/css';
+            }
+            else
+            {
+                $type = 'text/html';
+            }
+            
+            if( -r $fname )
+            {
+                my $fh = new IO::File( $fname );
+                if( defined( $fh ) )
+                {
+                    print $q->header('-type' => $type,
+                                     '-expires' => '+1h');
+                    
+                    $fh->binmode(':raw');
+                    my $buffer;           
+                    while( $fh->read( $buffer, 65536 ) )
+                    {
+                        print( $buffer );
+                    }
+                    $fh->close();
+                    $ok = 1;
+                }
+            }
+
+            if( not $ok )
+            {
+                print $q->header(-status=>400),
+                $q->start_html('Error'),
+                $q->h2('Error'),
+                $q->strong('Cannot retrieve file: ' . $fname);
+            }
+            
+            return;
+        }
+    }
+    
+    my @paramNames = $q->param();
+
+    if( $q->param('DEBUG') and not $Torrus::Renderer::globalDebug ) 
+    {
+        &Torrus::Log::setLevel('debug');
+    }
+
+    my %options = ();
+    foreach my $name ( @paramNames )
+    {
+        if( $name =~ /^[A-Z]/ and $name ne 'SESSION_ID' )
+        {
+            $options{'variables'}->{$name} = $q->param($name);
+        }
+    }
+
+    my( $fname, $mimetype, $expires );
+    my @cookies;
+
+    my $renderer = new Torrus::Renderer();
+    if( not defined( $renderer ) )
+    {
+        return report_error($q, 'Error initializing Renderer');
+    }
+
+    my $tree = $path_info;
+    $tree =~ s/^.*\/(.*)$/$1/;
+
+    if( $Torrus::CGI::authorizeUsers )
+    {
+        $options{'acl'} = new Torrus::ACL;
+        
+        my $hostauth = $q->param('hostauth');
+        if( defined( $hostauth ) )
+        {
+            my $uid = $q->remote_addr();
+            $uid =~ s/\W/_/go;
+            my $password = $uid . '//' . $hostauth;
+
+            Debug('Host-based authentication for ' . $uid);
+            
+            if( not $options{'acl'}->authenticateUser( $uid, $password ) )
+            {
+                print $q->header(-status=>'403 Forbidden',
+                                 '-type' => 'text/plain');
+                print('Host-based authentication failed for ' . $uid);
+                Info('Host-based authentication failed for ' . $uid);
+                return;
+            }
+            
+            Info('Host authenticated: ' . $uid);
+            $options{'uid'} = $uid;
+        }
+        else
+        {
+            
+            my $ses_id = $q->cookie('SESSION_ID');
+
+            my $needs_new_session = 1;
+            my %session;
+
+            if( $ses_id )
+            {
+                # create a session object based on the cookie we got from the
+                # browser, or a new session if we got no cookie
+                eval
+                {
+                    tie %session, 'Apache::Session::File', $ses_id, {
+                        Directory     => $Torrus::Global::sesStoreDir,
+                        LockDirectory => $Torrus::Global::sesLockDir }
+                };
+                if( not $@ )
+                {
+                    if( $options{'variables'}->{'LOGOUT'} )
+                    {
+                        tied( %session )->delete();
+                    }
+                    else
+                    {
+                        $needs_new_session = 0;
+                    }
+                }
+            }
+
+            if( $needs_new_session )
+            {
+                tie %session, 'Apache::Session::File', undef, {
+                    Directory     => $Torrus::Global::sesStoreDir,
+                    LockDirectory => $Torrus::Global::sesLockDir };
+            }
+
+            # might be a new session, so lets give them their cookie back
+
+            my %cookie = (-name  => 'SESSION_ID',
+                          -value => $session{'_session_id'});
+            
+            if( $session{'uid'} )
+            {
+                $options{'uid'} = $session{'uid'};
+                if( $session{'remember_login'} )
+                {
+                    $cookie{'-expires'} = '+60d';
+                }
+            }
+            else
+            {
+                my $needsLogin = 1;
+
+                # POST form parameters
+
+                my $uid = $q->param('uid');
+                my $password = $q->param('password');
+                if( defined( $uid ) and defined( $password ) )
+                {
+                    if( $options{'acl'}->authenticateUser( $uid, $password ) )
+                    {
+                        $session{'uid'} = $options{'uid'} = $uid;
+                        $needsLogin = 0;
+                        Info('User logged in: ' . $uid);
+                        
+                        if( $q->param('remember') )
+                        {
+                            $cookie{'-expires'} = '+60d';
+                            $session{'remember_login'} = 1;
+                        }
+                    }
+                    else
+                    {
+                        $options{'authFailed'} = 1;
+                    }
+                }
+
+                if( $needsLogin )
+                {
+                    $options{'urlPassTree'} = $tree;
+                    foreach my $param ( 'token', 'path', 'nodeid',
+                                        'view', 'v' )
+                    {
+                        my $val = $q->param( $param );
+                        if( defined( $val ) and length( $val ) > 0 )
+                        {
+                            $options{'urlPassParams'}{$param} = $val;
+                        }
+                    }
+                    
+                    ( $fname, $mimetype, $expires ) =
+                        $renderer->renderUserLogin( %options );
+                    
+                    die('renderUserLogin returned undef') unless $fname;
+                }
+            }
+            untie %session;
+            
+            push(@cookies, $q->cookie(%cookie));
+        }
+    }
+
+    if( not $fname )
+    {
+        if( not $tree or not Torrus::SiteConfig::treeExists( $tree ) )
+        {
+            ( $fname, $mimetype, $expires ) =
+                $renderer->renderTreeChooser( %options );
+        }
+        else
+        {
+            if( $Torrus::CGI::authorizeUsers and
+                not $options{'acl'}->hasPrivilege( $options{'uid'}, $tree,
+                                                   'DisplayTree' ) )
+            {
+                return report_error($q, 'Permission denied');
+            }
+            
+            if( $Torrus::Renderer::displayReports and
+                defined( $q->param('htmlreport') ) )
+            {
+                if( $Torrus::CGI::authorizeUsers and
+                    not $options{'acl'}->hasPrivilege( $options{'uid'}, $tree,
+                                                       'DisplayReports' ) )
+                {
+                    return report_error($q, 'Permission denied');
+                }
+
+                my $reportfname = $q->param('htmlreport');
+                # strip off leading slashes for security
+                $reportfname =~ s/^.*\///o;
+                
+                $fname = $Torrus::Global::reportsDir . '/' . $tree .
+                    '/html/' . $reportfname;
+                if( not -f $fname )
+                {
+                    return report_error($q, 'No such file: ' . $reportfname);
+                }
+                
+                $mimetype = 'text/html';
+                $expires = '3600';
+            }
+            else
+            {
+                my $config_tree = new Torrus::ConfigTree( -TreeName => $tree );
+                if( not defined($config_tree) )
+                {
+                    return report_error($q, 'Configuration is not ready');
+                }
+                
+                my $token = $q->param('token');
+                if( not defined($token) )
+                {
+                    my $path = $q->param('path');
+                    if( not defined($path) )
+                    {
+                        my $nodeid = $q->param('nodeid');
+                        if( defined($nodeid) )
+                        {
+                            $token = $config_tree->getNodeByNodeid( $nodeid );
+                            if( not defined($token) )
+                            {
+                                return report_error
+                                    ($q, 'Cannot find nodeid:' . $nodeid);
+                            }
+                        }
+                        else
+                        {
+                            $token = $config_tree->token('/');
+                        }
+                    }
+                    else
+                    {
+                        $token = $config_tree->token($path);
+                        if( not defined($token) )
+                        {
+                            return report_error($q, 'Invalid path');
+                        }
+                    }
+                }
+                elsif( $token !~ /^S/ and
+                       not defined( $config_tree->path( $token ) ) )
+                {
+                    return report_error($q, 'Invalid token');
+                }
+                
+                my $view = $q->param('view');
+                if( not defined($view) )
+                {
+                    $view = $q->param('v');
+                }
+
+                ( $fname, $mimetype, $expires ) =
+                    $renderer->render( $config_tree, $token, $view, %options );
+                
+                undef $config_tree;
+            }
+        }
+    }
+
+    undef $renderer;
+    &Torrus::DB::cleanupEnvironment();
+
+    if( defined( $options{'acl'} ) )
+    {
+        undef $options{'acl'};
+    }
+
+    if( defined($fname) )
+    {
+        if( not -e $fname )
+        {
+            return report_error($q, 'No such file or directory: ' . $fname);
+        }
+        
+        Debug("Render returned $fname $mimetype $expires");
+
+        my $fh = new IO::File( $fname );
+        if( defined( $fh ) )
+        {
+            print $q->header('-type' => $mimetype,
+                             '-expires' => '+'.$expires.'s',
+                             '-cookie' => \@cookies);
+            
+            $fh->binmode(':raw');
+            my $buffer;           
+            while( $fh->read( $buffer, 65536 ) )
+            {
+                print( $buffer );
+            }
+            $fh->close();
+        }
+        else
+        {
+            return report_error($q, 'Cannot open file ' . $fname . ': ' . $!);
+        }
+    }
+    else
+    {
+        return report_error($q, "Renderer returned error.\n" .
+                            "Probably wrong directory permissions or " .
+                            "directory missing:\n" .
+                            $Torrus::Global::cacheDir);            
+    }
+    
+    if( not $Torrus::Renderer::globalDebug )
+    {
+        &Torrus::Log::setLevel('info');
+    }
+}
+
+
+sub report_error
+{
+    my $q = shift;
+    my $msg = shift;
+
+    print $q->header('-type' => 'text/plain',
+                     '-expires' => 'now');
+
+    print('Error: ' . $msg);
+}
+
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Collector.pm b/torrus/perllib/Torrus/Collector.pm
new file mode 100644 (file)
index 0000000..0789be0
--- /dev/null
@@ -0,0 +1,695 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Collector.pm,v 1.1 2010-12-27 00:03:38 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+package Torrus::Collector;
+@Torrus::Collector::ISA = qw(Torrus::Scheduler::PeriodicTask);
+
+use strict;
+use Torrus::ConfigTree;
+use Torrus::Log;
+use Torrus::RPN;
+use Torrus::Scheduler;
+
+BEGIN
+{
+    foreach my $mod ( @Torrus::Collector::loadModules )
+    {
+        eval( 'require ' . $mod );
+        die( $@ ) if $@;
+    }
+}
+
+# Executed once after the fork. Here modules can launch processing threads
+sub initThreads
+{
+    foreach my $key ( %Torrus::Collector::initThreadsHandlers )
+    {
+        if( ref( $Torrus::Collector::initThreadsHandlers{$key} ) )
+        {
+            &{$Torrus::Collector::initThreadsHandlers{$key}}();
+        }
+    }
+}
+
+
+## One collector module instance holds all leaf tokens which
+## must be collected at the same time.
+
+sub new
+{
+    my $proto = shift;
+    my %options = @_;
+
+    if( not $options{'-Name'} )
+    {
+        $options{'-Name'} = "Collector";
+    }
+
+    my $class = ref($proto) || $proto;
+    my $self  = $class->SUPER::new( %options );
+    bless $self, $class;
+
+    foreach my $collector_type ( keys %Torrus::Collector::collectorTypes )
+    {
+        $self->{'types'}{$collector_type} = {};
+        $self->{'types_in_use'}{$collector_type} = 0;
+    }
+
+    foreach my $storage_type ( keys %Torrus::Collector::storageTypes )
+    {
+        $self->{'storage'}{$storage_type} = {};
+        $self->{'storage_in_use'}{$storage_type} = 0;
+        
+        my $storage_string = $storage_type . '-storage';
+        if( ref( $Torrus::Collector::initStorage{$storage_string} ) )
+        {
+            &{$Torrus::Collector::initStorage{$storage_string}}($self);
+        }
+    }
+
+    $self->{'tree_name'} = $options{'-TreeName'};
+    
+    return $self;
+}
+
+
+sub addTarget
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+
+    my $ok = 1;
+    $self->{'targets'}{$token}{'path'} = $config_tree->path($token);
+
+    my $collector_type = $config_tree->getNodeParam($token, 'collector-type');
+    if( not $Torrus::Collector::collectorTypes{$collector_type} )
+    {
+        Error('Unknown collector type: ' . $collector_type);
+        return;
+    }
+
+    $self->fetchParams($config_tree, $token, $collector_type);
+
+    $self->{'targets'}{$token}{'type'} = $collector_type;
+    $self->{'types_in_use'}{$collector_type} = 1;
+    
+    my $storage_types = $config_tree->getNodeParam($token, 'storage-type');
+    foreach my $storage_type ( split( ',', $storage_types ) )
+    {
+        if( not $Torrus::Collector::storageTypes{$storage_type} )
+        {
+            Error('Unknown storage type: ' . $storage_type);
+        }
+        else
+        {
+            my $storage_string = $storage_type . '-storage';
+            if( not exists( $self->{'targets'}{$token}{'storage-types'} ) )
+            {
+                $self->{'targets'}{$token}{'storage-types'} = [];
+            }
+            push( @{$self->{'targets'}{$token}{'storage-types'}},
+                  $storage_type );
+            
+            $self->fetchParams($config_tree, $token, $storage_string);
+            $self->{'storage_in_use'}{$storage_type} = 1;
+        }
+    }
+
+    # If specified, store the value transformation code
+    my $code = $config_tree->getNodeParam($token, 'transform-value');
+    if( defined $code )
+    {
+        $self->{'targets'}{$token}{'transform'} = $code;
+    }
+    
+    # If specified, store the scale RPN
+    my $scalerpn = $config_tree->getNodeParam($token, 'collector-scale');
+    if( defined $scalerpn )
+    {
+        $self->{'targets'}{$token}{'scalerpn'} = $scalerpn;
+    }
+    
+    # If specified, store the value map
+    my $valueMap = $config_tree->getNodeParam($token, 'value-map');
+    if( defined $valueMap and length($valueMap) > 0 )
+    {
+        my $map = {};
+        foreach my $item ( split( ',', $valueMap ) )
+        {
+            my ($key, $value) = split( ':', $item );
+            $map->{$key} = $value;
+        }
+        $self->{'targets'}{$token}{'value-map'} = $map;
+    }
+
+    # Initialize local token, collectpor, and storage data
+    if( not defined $self->{'targets'}{$token}{'local'} )
+    {
+        $self->{'targets'}{$token}{'local'} = {};
+    }
+
+    if( ref( $Torrus::Collector::initTarget{$collector_type} ) )
+    {
+        $ok = &{$Torrus::Collector::initTarget{$collector_type}}($self,
+                                                                 $token);
+    }
+
+    if( $ok )
+    {
+        foreach my $storage_type
+            ( @{$self->{'targets'}{$token}{'storage-types'}} )
+        {
+            my $storage_string = $storage_type . '-storage';
+            if( ref( $Torrus::Collector::initTarget{$storage_string} ) )
+            {
+                &{$Torrus::Collector::initTarget{$storage_string}}($self,
+                                                                   $token);
+            }
+        }
+    }
+    
+    if( not $ok )
+    {
+        $self->deleteTarget( $token );
+    }
+}
+
+
+sub fetchParams
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $type = shift;
+
+    if( not defined( $Torrus::Collector::params{$type} ) )
+    {
+        Error("\%Torrus::Collector::params does not have member $type");
+        return;
+    }
+
+    my $ref = \$self->{'targets'}{$token}{'params'};
+
+    my @maps = ( $Torrus::Collector::params{$type} );
+
+    while( scalar( @maps ) > 0 )
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        my @next_maps = ();
+        foreach my $map ( @maps )
+        {
+            foreach my $param ( keys %{$map} )
+            {
+                my $value = $config_tree->getNodeParam( $token, $param );
+
+                if( ref( $map->{$param} ) )
+                {
+                    if( defined $value )
+                    {
+                        if( exists $map->{$param}->{$value} )
+                        {
+                            if( defined $map->{$param}->{$value} )
+                            {
+                                push( @next_maps,
+                                      $map->{$param}->{$value} );
+                            }
+                        }
+                        else
+                        {
+                            Error("Parameter $param has unknown value: " .
+                                  $value . " in " . $self->path($token));
+                        }
+                    }
+                }
+                else
+                {
+                    if( not defined $value )
+                    {
+                        # We know the default value
+                        $value = $map->{$param};
+                    }
+                }
+                # Finally store the value
+                if( defined $value )
+                {
+                    $$ref->{$param} = $value;
+                }
+            }
+        }
+        @maps = @next_maps;
+    }
+}
+
+
+sub fetchMoreParams
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my @params = @_;
+
+    &Torrus::DB::checkInterrupted();
+
+    my $ref = \$self->{'targets'}{$token}{'params'};
+
+    foreach my $param ( @params )
+    {
+        my $value = $config_tree->getNodeParam( $token, $param );
+        if( defined $value )
+        {
+            $$ref->{$param} = $value;
+        }
+    }
+}
+
+
+sub param
+{
+    my $self = shift;
+    my $token = shift;
+    my $param = shift;
+
+    return $self->{'targets'}{$token}{'params'}{$param};
+}
+
+sub setParam
+{
+    my $self = shift;
+    my $token = shift;
+    my $param = shift;
+    my $value = shift;
+
+    $self->{'targets'}{$token}{'params'}{$param} = $value;
+}
+
+
+sub path
+{
+    my $self = shift;
+    my $token = shift;
+
+    return $self->{'targets'}{$token}{'path'};
+}
+
+sub listCollectorTargets
+{
+    my $self = shift;
+    my $collector_type = shift;
+
+    my @ret;
+    foreach my $token ( keys %{$self->{'targets'}} )
+    {
+        if( $self->{'targets'}{$token}{'type'} eq $collector_type )
+        {
+            push( @ret, $token );
+        }
+    }
+    return @ret;
+}
+
+# A callback procedure that will be executed on deleteTarget()
+
+sub registerDeleteCallback
+{
+    my $self = shift;
+    my $token = shift;
+    my $proc = shift;
+
+    if( not ref( $self->{'targets'}{$token}{'deleteProc'} ) )
+    {
+        $self->{'targets'}{$token}{'deleteProc'} = [];
+    }
+    push( @{$self->{'targets'}{$token}{'deleteProc'}}, $proc );
+}
+
+sub deleteTarget
+{
+    my $self = shift;
+    my $token = shift;
+
+    &Torrus::DB::checkInterrupted();
+
+    Info('Deleting target: ' . $self->path($token));
+    
+    if( ref( $self->{'targets'}{$token}{'deleteProc'} ) )
+    {
+        foreach my $proc ( @{$self->{'targets'}{$token}{'deleteProc'}} )
+        {
+            &{$proc}( $self, $token );
+        }
+    }
+    delete $self->{'targets'}{$token};
+}
+
+# Returns a reference to token-specific local data
+
+sub tokenData
+{
+    my $self = shift;
+    my $token = shift;
+
+    return $self->{'targets'}{$token}{'local'};
+}
+
+# Returns a reference to collector type-specific local data
+
+sub collectorData
+{
+    my $self = shift;
+    my $type = shift;
+
+    return $self->{'types'}{$type};
+}
+
+# Returns a reference to storage type-specific local data
+
+sub storageData
+{
+    my $self = shift;
+    my $type = shift;
+
+    return $self->{'storage'}{$type};
+}
+
+
+# Runs each collector type, and then stores the values
+sub run
+{
+    my $self = shift;
+
+    undef $self->{'values'};
+
+    while( my ($collector_type, $ref) = each %{$self->{'types'}} )
+    {
+        next unless $self->{'types_in_use'}{$collector_type};
+
+        &Torrus::DB::checkInterrupted();
+        
+        if( $Torrus::Collector::needsConfigTree
+            {$collector_type}{'runCollector'} )
+        {
+            $self->{'config_tree'} =
+                new Torrus::ConfigTree( -TreeName => $self->{'tree_name'},
+                                        -Wait => 1 );
+        }
+        
+        &{$Torrus::Collector::runCollector{$collector_type}}( $self, $ref );
+        
+        if( defined( $self->{'config_tree'} ) )
+        {
+            undef $self->{'config_tree'};
+        }
+    }
+
+    while( my ($storage_type, $ref) = each %{$self->{'storage'}} )
+    {
+        next unless $self->{'storage_in_use'}{$storage_type};
+        
+        &Torrus::DB::checkInterrupted();
+        
+        if( $Torrus::Collector::needsConfigTree
+            {$storage_type}{'storeData'} )
+        {
+            $self->{'config_tree'} =
+                new Torrus::ConfigTree( -TreeName => $self->{'tree_name'},
+                                        -Wait => 1 );
+        }
+
+        &{$Torrus::Collector::storeData{$storage_type}}( $self, $ref );
+
+        if( defined( $self->{'config_tree'} ) )
+        {
+            undef $self->{'config_tree'};
+        }        
+    }
+    
+    while( my ($collector_type, $ref) = each %{$self->{'types'}} )
+    {
+        next unless $self->{'types_in_use'}{$collector_type};
+        
+        if( ref( $Torrus::Collector::postProcess{$collector_type} ) )
+        {
+            &Torrus::DB::checkInterrupted();
+            
+            if( $Torrus::Collector::needsConfigTree
+                {$collector_type}{'postProcess'} )
+            {
+                $self->{'config_tree'} =
+                    new Torrus::ConfigTree( -TreeName => $self->{'tree_name'},
+                                            -Wait => 1 );
+            }
+            
+            &{$Torrus::Collector::postProcess{$collector_type}}( $self, $ref );
+
+            if( defined( $self->{'config_tree'} ) )
+            {
+                undef $self->{'config_tree'};
+            }
+        }
+    }
+}
+
+
+# This procedure is called by the collector type-specific functions
+# every time there's a new value for a token
+sub setValue
+{
+    my $self = shift;
+    my $token = shift;
+    my $value = shift;
+    my $timestamp = shift;
+    my $uptime = shift;
+
+    if( $value ne 'U' )
+    {
+        if( defined( my $code = $self->{'targets'}{$token}{'transform'} ) )
+        {            
+            # Screen out the percent sign and $_
+            $code =~ s/DOLLAR/\$/gm;
+            $code =~ s/MOD/\%/gm;
+            Debug('Value before transformation: ' . $value);
+            $_ = $value;
+            $value = do { eval $code };
+            if( $@ )
+            {
+                Error('Fatal error in transformation code: ' . $@ );
+                $value = 'U';
+            }
+            elsif( $value !~ /^[0-9.+-eE]+$/o and $value ne 'U' )
+            {
+                Error('Non-numeric value after transformation: ' . $value);
+                $value = 'U';
+            }
+        }
+        elsif( defined( my $map = $self->{'targets'}{$token}{'value-map'} ) )
+        {
+            my $newValue;
+            if( defined( $map->{$value} ) )
+            {
+                $newValue = $map->{$value};
+            }
+            elsif( defined( $map->{'_'} ) )
+            {
+                $newValue = $map->{'_'};
+            }
+            else
+            {
+                Warn('Could not find value mapping for ' . $value .
+                     'in ' . $self->path($token));
+            }
+
+            if( defined( $newValue ) )
+            {
+                Debug('Value mapping: ' . $value . ' -> ' . $newValue);
+                $value = $newValue;
+            }
+        }
+
+        if( defined( $self->{'targets'}{$token}{'scalerpn'} ) )
+        {
+            Debug('Value before scaling: ' . $value);
+            my $rpn = new Torrus::RPN;
+            $value = $rpn->run( $value . ',' .
+                                $self->{'targets'}{$token}{'scalerpn'},
+                                sub{} );
+        }
+    }
+
+    if( isDebug() )
+    {
+        Debug('Value ' . $value . ' set for ' .
+              $self->path($token) . ' TS=' . $timestamp);
+    }
+
+    foreach my $storage_type
+        ( @{$self->{'targets'}{$token}{'storage-types'}} )
+    {
+        &{$Torrus::Collector::setValue{$storage_type}}( $self, $token,
+                                                        $value, $timestamp,
+                                                        $uptime );
+    }
+}
+
+
+sub configTree
+{
+    my $self = shift;
+
+    if( defined( $self->{'config_tree'} ) )
+    {
+        return $self->{'config_tree'};
+    }
+    else
+    {
+        Error('Cannot provide ConfigTree object');
+        return undef;
+    }
+}
+
+
+#######  Collector scheduler  ########
+
+package Torrus::CollectorScheduler;
+@Torrus::CollectorScheduler::ISA = qw(Torrus::Scheduler);
+
+use Torrus::ConfigTree;
+use Torrus::Log;
+use Torrus::Scheduler;
+use Torrus::TimeStamp;
+
+
+sub beforeRun
+{
+    my $self = shift;
+
+    &Torrus::DB::checkInterrupted();
+
+    my $tree = $self->treeName();
+    my $config_tree = new Torrus::ConfigTree(-TreeName => $tree, -Wait => 1);
+    if( not defined( $config_tree ) )
+    {
+        return undef;
+    }
+
+    my $data = $self->data();
+
+    my $instance = $self->{'options'}{'-Instance'};
+        
+    # Prepare the list of tokens, sorted by period and offset,
+    # from config tree or from cache.
+
+    my $need_new_tasks = 0;
+
+    Torrus::TimeStamp::init();
+    my $timestamp_key = $tree . ':' . $instance . ':collector_cache';
+    my $known_ts = Torrus::TimeStamp::get( $timestamp_key );
+    my $actual_ts = $config_tree->getTimestamp();
+    
+    if( $actual_ts >= $known_ts or not $data->{'targets_initialized'} )
+    {
+        Info('Initializing tasks for collector instance ' . $instance);
+        Debug("Config TS: $actual_ts, Collector TS: $known_ts");
+        my $init_start = time();
+
+        my $targets = {};
+
+        my $db_tokens =
+            new Torrus::DB('collector_tokens' . '_' . $instance . '_' .
+                           $config_tree->{'ds_config_instance'},
+                           -Subdir => $tree);
+        
+        my $cursor = $db_tokens->cursor();
+        while( my ($token, $schedule) = $db_tokens->next($cursor) )
+        {
+            my ($period, $offset) = split(/:/o, $schedule);
+            if( not exists( $targets->{$period}{$offset} ) )
+            {
+                $targets->{$period}{$offset} = [];
+            }
+            push( @{$targets->{$period}{$offset}}, $token );
+
+            &Torrus::DB::checkInterrupted();
+        }
+        undef $cursor;
+        $db_tokens->closeNow();
+        undef $db_tokens;
+
+        &Torrus::DB::checkInterrupted();
+
+        # Set the timestamp
+        &Torrus::TimeStamp::setNow( $timestamp_key );
+        
+        $self->flushTasks();
+
+        foreach my $period ( keys %{$targets} )
+        {
+            foreach my $offset ( keys %{$targets->{$period}} )
+            {
+                my $collector =
+                    new Torrus::Collector( -Period => $period,
+                                           -Offset => $offset,
+                                           -TreeName => $tree,
+                                           -Instance => $instance );
+
+                foreach my $token ( @{$targets->{$period}{$offset}} )
+                {
+                    &Torrus::DB::checkInterrupted();
+                    $collector->addTarget( $config_tree, $token );
+                }
+
+                $self->addTask( $collector );
+            }
+        }
+        Verbose(sprintf("Tasks initialization finished in %d seconds",
+                        time() - $init_start));
+
+        $data->{'targets_initialized'} = 1;        
+        Info('Tasks for collector instance ' . $instance . ' initialized');
+
+        foreach my $collector_type ( keys %Torrus::Collector::collectorTypes )
+        {
+            if( ref($Torrus::Collector::initCollectorGlobals{
+                $collector_type}) )
+            {
+                &{$Torrus::Collector::initCollectorGlobals{
+                    $collector_type}}($tree, $instance);
+                
+                Verbose('Initialized collector globals for type: ' .
+                        $collector_type);
+            }
+        }
+    }
+    
+    Torrus::TimeStamp::release();
+    
+    return 1;
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Collector/CDef.pm b/torrus/perllib/Torrus/Collector/CDef.pm
new file mode 100644 (file)
index 0000000..28dff8a
--- /dev/null
@@ -0,0 +1,120 @@
+#
+#  Copyright (C) 2004-2005  Christian Schnidrig
+#  Copyright (C) 2007  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# $Id: CDef.pm,v 1.1 2010-12-27 00:03:57 ivan Exp $
+# Christian Schnidrig <christian.schnidrig@bluewin.ch>
+
+
+# Torrus collector module for combining multiple datasources into one
+
+package Torrus::Collector::CDef;
+
+use strict;
+
+use Torrus::Collector::CDef_Params;
+use Torrus::ConfigTree;
+use Torrus::Log;
+use Torrus::RPN;
+use Torrus::DataAccess;
+use Torrus::Collector::RRDStorage;
+
+# Register the collector type
+$Torrus::Collector::collectorTypes{'cdef'} = 1;
+
+# List of needed parameters and default values
+$Torrus::Collector::params{'cdef'} = \%Torrus::Collector::CDef_Params::params;
+$Torrus::Collector::initTarget{'cdef'} = \&Torrus::Collector::CDef::initTarget;
+
+
+# get access to the configTree;
+$Torrus::Collector::needsConfigTree{'cdef'}{'runCollector'} = 1;
+
+sub initTarget
+{
+    my $collector = shift;
+    my $token = shift;
+    
+    my $cref = $collector->collectorData( 'cdef' );
+    if( not defined( $cref->{'crefTokens'} ) )
+    {
+        $cref->{'crefTokens'} = [];
+    }
+
+    push( @{$cref->{'crefTokens'}}, $token );
+    
+    return 1;
+}
+
+# This is first executed per target
+$Torrus::Collector::runCollector{'cdef'} =
+    \&Torrus::Collector::CDef::runCollector;
+
+sub runCollector
+{
+    my $collector = shift;
+    my $cref = shift;
+    my $config_tree = $collector->configTree();
+
+    my $now = time();
+    my $da = new Torrus::DataAccess;
+
+    # By default, try to get the data from one period behind
+    my $defaultAccessTime = $now -
+        ( $now % $collector->period() ) + $collector->offset();
+    
+    foreach my $token ( @{$cref->{'crefTokens'}} )
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        my $accessTime = $defaultAccessTime -
+            ( $collector->period() *
+              $collector->param( $token, 'cdef-collector-delay' ) );
+
+        # The RRDtool is non-reentrant, and we need to be careful
+        # when running multiple threads
+        Torrus::Collector::RRDStorage::semaphoreDown();
+        
+        my ($value, $timestamp) =
+            $da->read_RPN( $config_tree, $token,
+                           $collector->param( $token, 'rpn-expr' ),
+                           $accessTime );
+
+        Torrus::Collector::RRDStorage::semaphoreUp();
+
+        if( defined( $value ) )
+        {
+            if ( $timestamp <
+                 ( $accessTime -
+                   ( $collector->period() *
+                     $collector->param( $token, 'cdef-collector-tolerance' ))))
+            {
+                Error( "CDEF: Data is " . ($accessTime-$timestamp) .
+                       " seconds too old for " . $collector->path($token) );
+            }
+            else
+            {
+                $collector->setValue( $token, $value, $timestamp );
+            }
+        }
+    }
+}
+
+
+
+1;
+
diff --git a/torrus/perllib/Torrus/Collector/CDef_Params.pm b/torrus/perllib/Torrus/Collector/CDef_Params.pm
new file mode 100644 (file)
index 0000000..4bd84ba
--- /dev/null
@@ -0,0 +1,69 @@
+#
+#  Copyright (C) 2004  Christian Schnidrig
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# $Id: CDef_Params.pm,v 1.1 2010-12-27 00:03:57 ivan Exp $
+# Christian Schnidrig <christian.schnidrig@bluewin.ch>
+
+
+# Parameter definitions for CDef collector plugin
+
+package Torrus::Collector::CDef_Params;
+
+use strict;
+
+###  Initialize the configuration validator with module-specific parameters
+our %params =
+    (
+     'rpn-expr'                 => undef,
+     'cdef-collector-delay'     => undef,
+     'cdef-collector-tolerance' => undef,
+     );
+
+
+sub initValidatorLeafParams
+{
+    my $hashref = shift;
+    $hashref->{'ds-type'}{'collector'}{'collector-type'}{'cdef'} =
+        \%params;
+}
+
+
+my %admInfoParamCategories =
+    (
+     'cdef-collector-delay'        => 'CDef_Collector',
+     'cdef-collector-tolerance'    => 'CDef_Collector',
+     );     
+
+
+sub initAdmInfo
+{
+    my $map = shift;
+    my $categories = shift;
+    
+    $map->{'ds-type'}{'collector'}{'collector-type'}{'cdef'} =
+        \%params;
+    
+    while( my ($pname, $category) = each %admInfoParamCategories )
+    {
+        $categories->{$pname} = $category;
+    }
+}
+
+
+
+1;
+
diff --git a/torrus/perllib/Torrus/Collector/ExtDBI.pm b/torrus/perllib/Torrus/Collector/ExtDBI.pm
new file mode 100644 (file)
index 0000000..7d13941
--- /dev/null
@@ -0,0 +1,128 @@
+#  Copyright (C) 2005  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: ExtDBI.pm,v 1.1 2010-12-27 00:03:58 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+## Pluggable backend module for ExternalStorage
+## Stores data in a generic SQL database
+
+# We use some internals of Torrus::SQL::SrvExport, but
+# handle the SQL by ourselves, for better efficiency.
+
+package Torrus::Collector::ExtDBI;
+
+use strict;
+use DBI;
+use Date::Format;
+
+use Torrus::SQL::SrvExport;
+use Torrus::Log;
+
+$Torrus::Collector::ExternalStorage::backendInit =
+    \&Torrus::Collector::ExtDBI::backendInit;
+
+$Torrus::Collector::ExternalStorage::backendOpenSession =
+    \&Torrus::Collector::ExtDBI::backendOpenSession;
+
+$Torrus::Collector::ExternalStorage::backendStoreData =
+    \&Torrus::Collector::ExtDBI::backendStoreData;
+
+$Torrus::Collector::ExternalStorage::backendCloseSession =
+    \&Torrus::Collector::ExtDBI::backendCloseSession;
+
+
+# Optional SQL connection subtype, configurable from torrus-siteconfig.pl
+our $subtype;
+
+my $dbh;
+my $sth;
+
+sub backendInit
+{
+    my $collector = shift;
+    my $token = shift;
+}
+
+sub backendOpenSession
+{
+    $dbh = Torrus::SQL::SrvExport->dbh( $subtype );
+    
+    if( defined( $dbh ) )
+    {
+        $sth = $dbh->prepare( Torrus::SQL::SrvExport->sqlInsertStatement() );
+        if( not defined( $sth ) )
+        {
+            Error('Error preparing the SQL statement: ' . $dbh->errstr);
+        }
+    }
+}
+
+
+sub backendStoreData
+{
+    my $timestamp = shift;
+    my $serviceid = shift;
+    my $value = shift;
+    my $interval = shift;
+    
+    if( defined( $dbh ) and defined( $sth ) )
+    {
+        my $datestr = time2str('%Y-%m-%d', $timestamp);
+        my $timestr = time2str('%H:%M:%S', $timestamp);
+        if( isDebug() )
+        {
+            Debug('Updating SQL database: ' .
+                  join(', ', $datestr, $timestr,
+                       $serviceid, $value, $interval ));
+        }
+
+        if( $sth->execute( $datestr, $timestr,
+                           $serviceid, $value, $interval ) )
+        {
+            return 1;
+        }
+        else
+        {
+            Error('Error executing SQL: ' . $dbh->errstr);
+        }
+    }
+
+    return undef;
+}
+
+
+sub backendCloseSession
+{
+    undef $sth;
+    if( defined( $dbh ) )
+    {
+        $dbh->commit();
+        $dbh->disconnect();
+        undef $dbh;
+    }
+}
+
+
+    
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Collector/ExternalStorage.pm b/torrus/perllib/Torrus/Collector/ExternalStorage.pm
new file mode 100644 (file)
index 0000000..1a876fa
--- /dev/null
@@ -0,0 +1,415 @@
+#  Copyright (C) 2005  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: ExternalStorage.pm,v 1.1 2010-12-27 00:03:57 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+package Torrus::Collector::ExternalStorage;
+
+use Torrus::ConfigTree;
+use Torrus::Log;
+
+use strict;
+use Math::BigInt;
+use Math::BigFloat;
+
+# Pluggable backend module implements all storage-specific tasks
+BEGIN
+{
+    eval( 'require ' . $Torrus::Collector::ExternalStorage::backend );
+    die( $@ ) if $@;    
+}
+
+# These variables must be set by the backend module
+our $backendInit;
+our $backendOpenSession;
+our $backendStoreData;
+our $backendCloseSession;
+
+# Register the storage type
+$Torrus::Collector::storageTypes{'ext'} = 1;
+
+
+# List of needed parameters and default values
+
+$Torrus::Collector::params{'ext-storage'} = {
+    'ext-dstype' => {
+        'GAUGE' => undef,
+        'COUNTER32' => {
+            'ext-counter-max' => undef},
+        'COUNTER64' => {
+            'ext-counter-max' => undef}},
+    'ext-service-id' => undef
+    };
+
+
+
+
+$Torrus::Collector::initTarget{'ext-storage'} =
+    \&Torrus::Collector::ExternalStorage::initTarget;
+
+sub initTarget
+{
+    my $collector = shift;
+    my $token = shift;
+
+    my $sref = $collector->storageData( 'ext' );
+
+    $collector->registerDeleteCallback
+        ( $token, \&Torrus::Collector::ExternalStorage::deleteTarget );
+
+    my $serviceid =
+        $collector->param($token, 'ext-service-id');
+
+    if( defined( $sref->{'serviceid'}{$serviceid} ) )
+    {
+        Error('ext-service-id is not unique: "' . $serviceid .
+              '". External storage is not activated for ' .
+              $collector->path($token));
+        return;
+    }
+
+    $sref->{'serviceid'}{$serviceid} = 1;
+
+    my $processor;
+    my $dstype = $collector->param($token, 'ext-dstype');
+    if( $dstype eq 'GAUGE' )
+    {
+        $processor = \&Torrus::Collector::ExternalStorage::processGauge;
+    }
+    else
+    {
+        if( $dstype eq 'COUNTER32' )
+        {
+            $processor =
+                \&Torrus::Collector::ExternalStorage::processCounter32;
+        }
+        else
+        {
+            $processor =
+                \&Torrus::Collector::ExternalStorage::processCounter64;
+        }
+        
+        my $max = $collector->param( $token, 'ext-counter-max' );
+        if( defined( $max ) )
+        {
+            $sref->{'max'}{$token} = Math::BigFloat->new($max);
+        }
+    }
+
+    $sref->{'tokens'}{$token} = $processor;
+
+    &{$backendInit}( $collector, $token );
+}
+
+
+
+$Torrus::Collector::setValue{'ext'} =
+    \&Torrus::Collector::ExternalStorage::setValue;
+
+
+sub setValue
+{
+    my $collector = shift;
+    my $token = shift;
+    my $value = shift;
+    my $timestamp = shift;
+
+    my $sref = $collector->storageData( 'ext' );
+
+    my $prevTimestamp = $sref->{'prevTimestamp'}{$token};
+    if( not defined( $prevTimestamp ) )
+    {
+        $prevTimestamp = $timestamp;
+    }
+        
+    my $procvalue =
+        &{$sref->{'tokens'}{$token}}( $collector, $token, $value, $timestamp );
+    if( defined( $procvalue ) )
+    {
+        if( ref( $procvalue ) )
+        {
+            # Convert a BigFloat into a scientific notation string
+            $procvalue = $procvalue->bsstr();
+        }
+        $sref->{'values'}{$token} =
+            [$procvalue, $timestamp, $timestamp - $prevTimestamp];
+    }
+    
+    $sref->{'prevTimestamp'}{$token} = $timestamp;
+}
+
+
+sub processGauge
+{
+    my $collector = shift;
+    my $token = shift;
+    my $value = shift;
+    my $timestamp = shift;
+
+    return $value;
+}
+
+
+sub processCounter32
+{
+    my $collector = shift;
+    my $token = shift;
+    my $value = shift;
+    my $timestamp = shift;
+
+    return processCounter( 32, $collector, $token, $value, $timestamp );
+}
+
+sub processCounter64
+{
+    my $collector = shift;
+    my $token = shift;
+    my $value = shift;
+    my $timestamp = shift;
+
+    return processCounter( 64, $collector, $token, $value, $timestamp );
+}
+
+my $base32 = Math::BigInt->new(2)->bpow(32);
+my $base64 = Math::BigInt->new(2)->bpow(64);
+
+sub processCounter
+{
+    my $base = shift;
+    my $collector = shift;
+    my $token = shift;
+    my $value = shift;
+    my $timestamp = shift;
+
+    my $sref = $collector->storageData( 'ext' );
+
+    if( isDebug() )
+    {
+        Debug('ExternalStorage::processCounter: token=' . $token .
+              ' value=' . $value . ' timestamp=' . $timestamp);
+    }
+
+    if( $value eq 'U' )
+    {
+        # the agent rebooted, so we flush the counter
+        delete $sref->{'prevCounter'}{$token};
+        return undef;
+    }
+        
+    $value = Math::BigInt->new( $value );
+    my $ret;
+    
+    if( exists( $sref->{'prevCounter'}{$token} ) )
+    {
+        my $prevValue = $sref->{'prevCounter'}{$token};
+        my $prevTimestamp = $sref->{'prevTimestamp'}{$token};
+        if( isDebug() )
+        {
+            Debug('ExternalStorage::processCounter: prevValue=' . $prevValue .
+                  ' prevTimestamp=' . $prevTimestamp);
+        }
+        
+        if( $prevValue->bcmp( $value ) > 0 ) # previous is bigger
+        {
+            $ret = Math::BigFloat->new($base==32 ? $base32:$base64);
+            $ret->bsub( $prevValue );
+            $ret->badd( $value );
+        }
+        else
+        {
+            $ret = Math::BigFloat->new( $value );
+            $ret->bsub( $prevValue );
+        }
+        $ret->bdiv( $timestamp - $prevTimestamp );
+        if( defined( $sref->{'max'}{$token} ) )
+        {
+            if( $ret->bcmp( $sref->{'max'}{$token} ) > 0 )
+            {
+                Debug('Resulting counter rate is above the maximum');
+                $ret = undef;
+            }
+        }
+    }
+
+    $sref->{'prevCounter'}{$token} = $value;
+
+    if( defined( $ret ) and isDebug() )
+    {
+        Debug('ExternalStorage::processCounter: Resulting value=' . $ret);
+    }
+    return $ret;
+}
+
+
+
+$Torrus::Collector::storeData{'ext'} =
+    \&Torrus::Collector::ExternalStorage::storeData;
+
+# timestamp of last unavailable storage
+my $storageUnavailable = 0;
+
+# Last time we tried to reach it
+my $storageLastTry = 0;
+
+# how often we retry - configurable in torrus-config.pl
+our $unavailableRetry;
+
+# maximum age for backlog in case of unavailable storage.
+# We stop recording new data when maxage is reached.
+our $backlogMaxAge;
+
+sub storeData
+{
+    my $collector = shift;
+    my $sref = shift;
+
+    &Torrus::DB::checkInterrupted();
+
+    my $nTokens = scalar( keys %{$sref->{'values'}} );
+
+    if( $nTokens == 0 )
+    {
+        return;
+    }
+    
+    Verbose('Exporting data to external storage for ' .
+            $nTokens . ' tokens');
+    &{$backendOpenSession}();
+    
+    while( my($token, $valuetriple) = each( %{$sref->{'values'}} ) )
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        my( $value, $timestamp, $interval ) = @{$valuetriple};
+        my $serviceid =
+            $collector->param($token, 'ext-service-id');
+        
+        my $toBacklog = 0;
+        
+        if( $storageUnavailable > 0 and 
+            time() < $storageLastTry + $unavailableRetry )
+        {
+            $toBacklog = 1;
+        }
+        else
+        {
+            $storageUnavailable = 0;
+            $storageLastTry = time();
+            
+            if( exists( $sref->{'backlog'} ) )
+            {
+                # Try to flush the backlog first
+                Verbose('Trying to flush the backlog');
+                    
+                my $ok = 1;
+                while( scalar(@{$sref->{'backlog'}}) > 0 and $ok )
+                {
+                    my $quarter = shift @{$sref->{'backlog'}};
+                    if( not &{$backendStoreData}( @{$quarter} ) )
+                    {
+                        Warn('Unable to flush the backlog, external ' .
+                             'storage is unavailable');
+                        
+                        unshift( @{$sref->{'backlog'}}, $quarter );
+                        $ok = 0;
+                        $toBacklog = 1;
+                    }
+                }
+                if( $ok )
+                {
+                    delete( $sref->{'backlog'} );
+                    Verbose('Backlog is successfully flushed');
+                }                    
+            }
+            
+            if( not $toBacklog )
+            {
+                if( not &{$backendStoreData}( $timestamp, $serviceid,
+                                              $value, $interval ) )
+                {
+                    Warn('Unable to store data, external storage is ' .
+                         'unavailable. Saving data to backlog');
+                    
+                    $toBacklog = 1;                    
+                }
+            }
+        }
+        
+        if( $toBacklog )
+        {
+            if( $storageUnavailable == 0 )
+            {
+                $storageUnavailable = time();
+            }
+            
+            if( not exists( $sref->{'backlog'} ) )
+            {
+                $sref->{'backlog'} = [];
+                $sref->{'backlogStart'} = time();
+            }
+            
+            if( time() < $sref->{'backlogStart'} + $backlogMaxAge )
+            {
+                push( @{$sref->{'backlog'}},
+                      [ $timestamp, $serviceid, $value, $interval ] );
+            }
+            else
+            {
+                Error('Backlog has reached its maximum age, stopped storing ' .
+                      'any more data');
+            }
+        }
+    }    
+    
+    undef $sref->{'values'};
+    &{$backendCloseSession}();
+}
+
+
+
+
+
+# Callback executed by Collector
+
+sub deleteTarget
+{
+    my $collector = shift;
+    my $token = shift;
+
+    my $sref = $collector->storageData( 'ext' );
+
+    my $serviceid =
+        $collector->param($token, 'ext-service-id');
+    delete $sref->{'serviceid'}{$serviceid};
+
+    if( defined( $sref->{'prevCounter'}{$token} ) )
+    {
+        delete $sref->{'prevCounter'}{$token};
+    }
+    
+    delete $sref->{'tokens'}{$token};
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Collector/RRDStorage.pm b/torrus/perllib/Torrus/Collector/RRDStorage.pm
new file mode 100644 (file)
index 0000000..7f806fa
--- /dev/null
@@ -0,0 +1,584 @@
+#  Copyright (C) 2002-2007  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: RRDStorage.pm,v 1.1 2010-12-27 00:03:58 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+package Torrus::Collector::RRDStorage;
+
+use Torrus::ConfigTree;
+use Torrus::Log;
+
+use strict;
+use RRDs;
+
+our $useThreads;
+our $threadsInUse = 0;
+our $thrQueueLimit;
+our $thrUpdateQueue;
+our $thrErrorsQueue;
+# RRDtool is not reentrant. use this semaphore for every call to RRDs::*
+our $rrdtoolSemaphore;
+our $thrUpdateThread;
+
+our $moveConflictRRD;
+our $conflictRRDPath;
+
+# Register the storage type
+$Torrus::Collector::storageTypes{'rrd'} = 1;
+
+
+# List of needed parameters and default values
+
+$Torrus::Collector::params{'rrd-storage'} = {
+    'data-dir' => undef,
+    'data-file' => undef,
+    'rrd-create-rra' => undef,
+    'rrd-create-heartbeat' => undef,
+    'rrd-create-min'  => 'U',
+    'rrd-create-max'  => 'U',
+    'rrd-hwpredict'   => {
+        'enabled' => {
+            'rrd-create-hw-alpha' => 0.1,
+            'rrd-create-hw-beta'  => 0.0035,
+            'rrd-create-hw-gamma' => 0.1,
+            'rrd-create-hw-winlen' => 9,
+            'rrd-create-hw-failth' => 6,
+            'rrd-create-hw-season' => 288,
+            'rrd-create-hw-rralen' => undef },
+        'disabled' => undef },
+    'rrd-create-dstype' => undef,
+    'rrd-ds' => undef
+    };
+
+
+$Torrus::Collector::initThreadsHandlers{'rrd-storage'} =
+    \&Torrus::Collector::RRDStorage::initThreads;
+
+sub initThreads
+{
+    if( $useThreads and not defined( $thrUpdateThread ) )
+    {
+        Verbose('RRD storage is configured for multithreading. Initializing ' .
+                'the background thread');
+        require threads;
+        require threads::shared;
+        require Thread::Queue;
+        require Thread::Semaphore;
+
+        $thrUpdateQueue = new Thread::Queue;
+        $thrErrorsQueue = new Thread::Queue;
+        $rrdtoolSemaphore = new Thread::Semaphore;
+        
+        $thrUpdateThread = threads->create( \&rrdUpdateThread );
+        $thrUpdateThread->detach();
+        $threadsInUse = 1;
+    }
+}
+
+
+
+$Torrus::Collector::initTarget{'rrd-storage'} =
+    \&Torrus::Collector::RRDStorage::initTarget;
+
+sub initTarget
+{
+    my $collector = shift;
+    my $token = shift;
+
+    my $sref = $collector->storageData( 'rrd' );
+
+    $collector->registerDeleteCallback
+        ( $token, \&Torrus::Collector::RRDStorage::deleteTarget );
+
+    my $filename =
+        $collector->param($token, 'data-dir') . '/' .
+        $collector->param($token, 'data-file');
+
+    $sref->{'byfile'}{$filename}{$token} = 1;
+    $sref->{'filename'}{$token} = $filename;
+}
+
+
+
+$Torrus::Collector::setValue{'rrd'} =
+    \&Torrus::Collector::RRDStorage::setValue;
+
+
+sub setValue
+{
+    my $collector = shift;
+    my $token = shift;
+    my $value = shift;
+    my $timestamp = shift;
+    my $uptime = shift;
+
+    my $sref = $collector->storageData( 'rrd' );
+
+    $sref->{'values'}{$token} = [$value, $timestamp, $uptime];
+}
+
+
+$Torrus::Collector::storeData{'rrd'} =
+    \&Torrus::Collector::RRDStorage::storeData;
+
+sub storeData
+{
+    my $collector = shift;
+    my $sref = shift;
+
+    if( $threadsInUse )
+    {
+        $collector->setStatValue( 'RRDQueue', $thrUpdateQueue->pending() );
+    }
+    
+    if( $threadsInUse and $thrUpdateQueue->pending() > $thrQueueLimit )
+    {
+        Error('Cannot enqueue RRD files for updating: ' .
+              'queue size is above limit');
+    }
+    else
+    {
+        while( my ($filename, $tokens) = each %{$sref->{'byfile'}} )
+        {
+            &Torrus::DB::checkInterrupted();
+            
+            if( not -e $filename )
+            {
+                createRRD( $collector, $sref, $filename, $tokens );
+            }
+            
+            if( -e $filename )
+            {
+                updateRRD( $collector, $sref, $filename, $tokens );
+            }
+        }
+    }
+
+    delete $sref->{'values'};
+}
+
+
+sub semaphoreDown
+{    
+    if( $threadsInUse )
+    {
+        $rrdtoolSemaphore->down();
+    }
+}
+
+sub semaphoreUp
+{
+    if( $threadsInUse )
+    {
+        $rrdtoolSemaphore->up();
+    }
+}
+
+
+sub createRRD
+{
+    my $collector = shift;
+    my $sref = shift;
+    my $filename = shift;
+    my $tokens  = shift;
+
+    # We use hashes here, in order to make the superset of RRA
+    # definitions, and unique RRD names
+    my %DS_hash;
+    my %RRA_hash;
+
+    # Holt-Winters parameters
+    my $needs_hw = 0;
+    my %hwparam;
+
+    my $timestamp = time();
+
+    foreach my $token ( keys %{$tokens} )
+    {
+        my $ds_string =
+            sprintf('DS:%s:%s:%d:%s:%s',
+                    $collector->param($token, 'rrd-ds'),
+                    $collector->param($token, 'rrd-create-dstype'),
+                    $collector->param($token, 'rrd-create-heartbeat'),
+                    $collector->param($token, 'rrd-create-min'),
+                    $collector->param($token, 'rrd-create-max'));
+        $DS_hash{$ds_string} = 1;
+
+        foreach my $rra_string
+            ( split(/\s+/, $collector->param($token, 'rrd-create-rra')) )
+        {
+            $RRA_hash{$rra_string} = 1;
+        }
+
+        if( $collector->param($token, 'rrd-hwpredict') eq 'enabled' )
+        {
+            $needs_hw = 1;
+
+            foreach my $param ( 'alpha', 'beta', 'gamma', 'winlen', 'failth',
+                                'season', 'rralen' )
+            {
+                my $value = $collector->param($token, 'rrd-create-hw-'.$param);
+
+                if( defined( $hwparam{$param} ) and
+                    $hwparam{$param} != $value )
+                {
+                    my $paramname = 'rrd-create-hw-'.$param;
+                    Warn("Parameter " . $paramname . " was already defined " .
+                         "with differentr value for " . $filename);
+                }
+
+                $hwparam{$param} = $value;
+            }
+        }
+
+        if( ref $sref->{'values'}{$token} )
+        {
+            my $new_ts = $sref->{'values'}{$token}[1];
+            if( $new_ts > 0 and $new_ts < $timestamp )
+            {
+                $timestamp = $new_ts;
+            }
+        }
+    }
+
+    my @DS = sort keys %DS_hash;
+    my @RRA = sort keys %RRA_hash;
+
+    if( $needs_hw )
+    {
+        ## Define the RRAs for Holt-Winters prediction
+
+        my $hwpredict_rran   = scalar(@RRA) + 1;
+        my $seasonal_rran    = $hwpredict_rran + 1;
+        my $devseasonal_rran = $hwpredict_rran + 2;
+        my $devpredict_rran  = $hwpredict_rran + 3;
+        my $failures_rran    = $hwpredict_rran + 4;
+
+        push( @RRA, sprintf('RRA:HWPREDICT:%d:%e:%e:%d:%d',
+                            $hwparam{'rralen'},
+                            $hwparam{'alpha'},
+                            $hwparam{'beta'},
+                            $hwparam{'season'},
+                            $seasonal_rran));
+
+        push( @RRA, sprintf('RRA:SEASONAL:%d:%e:%d',
+                            $hwparam{'season'},
+                            $hwparam{'gamma'},
+                            $hwpredict_rran));
+
+        push( @RRA, sprintf('RRA:DEVSEASONAL:%d:%e:%d',
+                            $hwparam{'season'},
+                            $hwparam{'gamma'},
+                            $hwpredict_rran));
+
+        push( @RRA, sprintf('RRA:DEVPREDICT:%d:%d',
+                            $hwparam{'rralen'},
+                            $devseasonal_rran));
+
+        push( @RRA, sprintf('RRA:FAILURES:%d:%d:%d:%d',
+                            $hwparam{'rralen'},
+                            $hwparam{'failth'},
+                            $hwparam{'winlen'},
+                            $devseasonal_rran));
+    }
+
+    my $step = $collector->period();
+    my $start = $timestamp - $step;
+
+    my @OPT = ( sprintf( '--start=%d', $start ),
+                sprintf( '--step=%d', $step ) );
+
+    &Torrus::DB::checkInterrupted();
+    
+    Debug("Creating RRD $filename: " . join(" ", @OPT, @DS, @RRA));
+
+    semaphoreDown();
+    
+    RRDs::create($filename,
+                 @OPT,
+                 @DS,
+                 @RRA);
+
+    my $err = RRDs::error();
+
+    semaphoreUp();
+
+    Error("ERROR creating $filename: $err") if $err;
+    
+    delete $sref->{'rrdinfo_ds'}{$filename};
+}
+
+
+sub updateRRD
+{
+    my $collector = shift;
+    my $sref = shift;
+    my $filename = shift;
+    my $tokens  = shift;
+
+    if( not defined( $sref->{'rrdinfo_ds'}{$filename} ) )
+    {
+        my $ref = {};
+        $sref->{'rrdinfo_ds'}{$filename} = $ref;
+
+        semaphoreDown();
+        
+        my $rrdinfo = RRDs::info( $filename );
+
+        semaphoreUp();
+
+        foreach my $prop ( keys %$rrdinfo )
+        {
+            if( $prop =~ /^ds\[(\S+)\]\./o )
+            {
+                $ref->{$1} = 1;
+            }
+        }
+        
+        &Torrus::DB::checkInterrupted();
+    }
+
+    # First we compare the sets of datasources in our memory and in RRD file
+    my %ds_updating = ();
+    my $ds_conflict = 0;
+
+    foreach my $token ( keys %{$tokens} )
+    {
+        $ds_updating{ $collector->param($token, 'rrd-ds') } = $token;
+    }
+
+    # Check if we update all datasources in RRD file
+    foreach my $ds ( keys %{$sref->{'rrdinfo_ds'}{$filename}} )
+    {
+        if( not $ds_updating{$ds} )
+        {
+            Warn('Datasource exists in RRD file, but it is not updated: ' .
+                 $ds . ' in ' . $filename);
+            $ds_conflict = 1;
+        }
+    }
+
+    # Check if all DS that we update are defined in RRD
+    foreach my $ds ( keys %ds_updating )
+    {
+        if( not $sref->{'rrdinfo_ds'}{$filename}{$ds} )
+        {
+            Error("Datasource being updated does not exist: $ds in $filename");
+            delete $ds_updating{$ds};
+            $ds_conflict = 1;
+        }
+    }
+
+    if( $ds_conflict and $moveConflictRRD )
+    {
+        if( not -f $filename )
+        {
+            Error($filename . 'is not a regular file');
+            return;
+        }
+        
+        my( $sec, $min, $hour, $mday, $mon, $year) = localtime( time() );
+        my $destfile = sprintf('%s_%04d%02d%02d%02d%02d',
+                               $filename,
+                               $year + 1900, $mon+1, $mday, $hour, $min);
+        
+        my $destdir = $conflictRRDPath;
+        if( defined( $destdir ) and -d $destdir )
+        {
+            my @fpath = split('/', $destfile);
+            my $fname = pop( @fpath );
+            $destfile = $destdir . '/' . $fname;
+        }
+
+        Warn('Moving the conflicted RRD file ' . $filename .
+             ' to ' . $destfile);
+        rename( $filename, $destfile ) or
+            Error("Cannot rename $filename to $destfile: $!");
+        
+        delete $sref->{'rrdinfo_ds'}{$filename};
+        
+        createRRD( $collector, $sref, $filename, $tokens );
+    }
+        
+    if( scalar( keys %ds_updating ) == 0 )
+    {
+        Error("No datasources to update in $filename");
+        return;
+    }
+
+    &Torrus::DB::checkInterrupted();
+
+    # Build the arguments for RRDs::update.
+    my $template;
+    my $values;
+
+    # We will use the average timestamp
+    my @timestamps;
+    my $max_ts = 0;
+    my $min_ts = time();
+
+    my $step = $collector->period();
+
+    foreach my $ds ( keys %ds_updating )
+    {
+        my $token = $ds_updating{$ds};
+        if( length($template) > 0 )
+        {
+            $template .= ':';
+        }
+        $template .= $ds;
+
+        my $now = time();
+        my ( $value, $timestamp, $uptime ) = ( 'U', $now, $now );
+        if( ref $sref->{'values'}{$token} )
+        {
+            ($value, $timestamp, $uptime) = @{$sref->{'values'}{$token}};
+        }
+
+        push( @timestamps, $timestamp );
+        if( $timestamp > $max_ts )
+        {
+            $max_ts = $timestamp;
+        }
+        if( $timestamp < $min_ts )
+        {
+            $min_ts = $timestamp;
+        }
+
+        # The plus sign generated by BigInt is not a problem for rrdtool
+        $values .= ':'. $value;
+    }
+
+    # Get the average timestamp
+    my $sum = 0;
+    map {$sum += $_} @timestamps;
+    my $avg_ts = $sum / scalar( @timestamps );
+
+    if( ($max_ts - $avg_ts) > $Torrus::Global::RRDTimestampTolerance )
+    {
+        Error("Maximum timestamp value is beyond the tolerance in $filename");
+    }
+    if( ($avg_ts - $min_ts) > $Torrus::Global::RRDTimestampTolerance )
+    {
+        Error("Minimum timestamp value is beyond the tolerance in $filename");
+    }
+
+    my @cmd = ( "--template=" . $template,
+                sprintf("%d%s", $avg_ts, $values) );
+
+    &Torrus::DB::checkInterrupted();
+
+    if( $threadsInUse )
+    {
+        # Process errors from RRD update thread
+        my $errfilename;
+        while( defined( $errfilename = $thrErrorsQueue->dequeue_nb() ) )
+        {
+            delete $sref->{'rrdinfo_ds'}{$errfilename};
+        }
+
+        Debug('Enqueueing update job for ' . $filename);
+        
+        my $cmdlist = &threads::shared::share([]);
+        push( @{$cmdlist}, $filename, @cmd );
+        $thrUpdateQueue->enqueue( $cmdlist );
+    }
+    else
+    {
+        if( isDebug )
+        {
+            Debug("Updating $filename: " . join(' ', @cmd));
+        }
+        RRDs::update( $filename, @cmd );
+        my $err = RRDs::error();
+        if( $err )
+        {
+            Error("ERROR updating $filename: $err");
+            delete $sref->{'rrdinfo_ds'}{$filename};
+        }
+    }
+}
+
+
+# A background thread that updates RRD files
+sub rrdUpdateThread
+{
+    &Torrus::DB::setSafeSignalHandlers();
+    $| = 1;
+    &Torrus::Log::setTID( threads->tid() );
+    
+    my $cmdlist;
+    &threads::shared::share( \$cmdlist );
+    
+    while(1)
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        $cmdlist = $thrUpdateQueue->dequeue();
+        
+        if( isDebug )
+        {
+            Debug("Updating RRD: " . join(' ', @{$cmdlist}));
+        }
+
+        $rrdtoolSemaphore->down();
+
+        RRDs::update( @{$cmdlist} );
+        my $err = RRDs::error();
+
+        $rrdtoolSemaphore->up();
+
+        if( $err )
+        {
+            Error('ERROR updating' . $cmdlist->[0] . ': ' . $err);
+            $thrErrorsQueue->enqueue( $cmdlist->[0] );
+        }
+    }
+}
+
+
+
+# Callback executed by Collector
+
+sub deleteTarget
+{
+    my $collector = shift;
+    my $token = shift;
+
+    my $sref = $collector->storageData( 'rrd' );
+    my $filename = $sref->{'filename'}{$token};
+
+    delete $sref->{'filename'}{$token};
+
+    delete $sref->{'byfile'}{$filename}{$token};
+    if( scalar( keys %{$sref->{'byfile'}{$filename}} ) == 0 )
+    {
+        delete $sref->{'byfile'}{$filename};
+    }
+
+    delete $sref->{'values'}{$token};
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Collector/SNMP.pm b/torrus/perllib/Torrus/Collector/SNMP.pm
new file mode 100644 (file)
index 0000000..5d3d8cd
--- /dev/null
@@ -0,0 +1,1261 @@
+#  Copyright (C) 2002-2007  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: SNMP.pm,v 1.1 2010-12-27 00:03:58 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+package Torrus::Collector::SNMP;
+
+use Torrus::Collector::SNMP_Params;
+use Torrus::ConfigTree;
+use Torrus::Log;
+use Torrus::SNMP_Failures;
+
+use strict;
+use Net::hostent;
+use Socket;
+use Net::SNMP qw(:snmp);
+use Math::BigInt;
+
+
+# Register the collector type
+$Torrus::Collector::collectorTypes{'snmp'} = 1;
+
+
+# List of needed parameters and default values
+
+$Torrus::Collector::params{'snmp'} = {
+    'snmp-ipversion'    => undef,
+    'snmp-transport'    => undef,
+    'snmp-version'      => undef,
+    'snmp-port'         => undef,
+    'snmp-community'    => undef,
+    'snmp-username'     => undef,
+    'snmp-authkey'      => undef,
+    'snmp-authpassword' => undef,
+    'snmp-authprotocol' => 'md5',
+    'snmp-privkey'      => undef,
+    'snmp-privpassword' => undef,
+    'snmp-privprotocol' => 'des',
+    'snmp-timeout'      => undef,
+    'snmp-retries'      => undef,
+    'domain-name'       => undef,
+    'snmp-host'         => undef,
+    'snmp-localaddr'    => undef,
+    'snmp-localport'    => undef,
+    'snmp-object'       => undef,
+    'snmp-oids-per-pdu' => undef,
+    'snmp-object-type'  => 'OTHER',
+    'snmp-check-sysuptime' => 'yes',
+    'snmp-max-msg-size' => undef,
+    'snmp-ignore-mib-errors' => undef,
+    };
+
+my $sysUpTime = '1.3.6.1.2.1.1.3.0';
+
+# Hosts that are running SNMPv1. We do not reresh maps on them, as
+# they are too slow
+my %snmpV1Hosts;
+
+# SNMP tables lookup maps
+my %maps;
+
+# Old lookup maps, used temporarily during refresh cycle
+my %oldMaps;
+
+# How frequent we refresh the SNMP mapping
+our $mapsRefreshPeriod;
+
+# Random factor in refresh period
+our $mapsRefreshRandom;
+
+# Time period after configuration re-compile when we refresh existing mappings
+our $mapsUpdateInterval;
+
+# how often we check for expired maps
+our $mapsExpireCheckPeriod;
+
+# expiration time for each map
+my %mapsExpire;
+
+# Lookups scheduled for execution
+my %mapLookupScheduled;
+
+# SNMP session objects for map lookups
+my @mappingSessions;
+
+
+# Timestamps of hosts last found unreachable
+my %hostUnreachableSeen;
+
+# Last time we tried to reach an unreachable host
+my %hostUnreachableRetry;
+
+# Hosts that were deleted because of unreachability for too long
+my %unreachableHostDeleted;
+
+
+our $db_failures;
+
+# Flush stats after a restart or recompile
+$Torrus::Collector::initCollectorGlobals{'snmp'} =
+    \&Torrus::Collector::SNMP::initCollectorGlobals;
+
+sub initCollectorGlobals
+{
+    my $tree = shift;
+    my $instance = shift;
+    
+    if( not defined( $db_failures ) )
+    {
+        $db_failures =
+            new Torrus::SNMP_Failures( -Tree => $tree,
+                                       -Instance => $instance,
+                                       -WriteAccess => 1 );
+    }
+
+    if( defined( $db_failures ) )
+    {
+        $db_failures->init();
+    }
+
+    # re-init counters and collect garbage
+    %oldMaps = ();
+    %hostUnreachableSeen = ();
+    %hostUnreachableRetry = ();
+    %unreachableHostDeleted = ();
+    
+    # Configuration re-compile was probably caused by new object instances
+    # appearing on the monitored devices. Here we force the maps to refresh
+    # soon enough in order to catch up with the changes
+
+    my $now = time();    
+    foreach my $maphash ( keys %mapsExpire )
+    {
+        $mapsExpire{$maphash} = int( $now + rand( $mapsUpdateInterval ) );
+    }    
+}
+
+
+# This is first executed per target
+
+$Torrus::Collector::initTarget{'snmp'} = \&Torrus::Collector::SNMP::initTarget;
+
+
+
+sub initTarget
+{
+    my $collector = shift;
+    my $token = shift;
+
+    my $tref = $collector->tokenData( $token );
+    my $cref = $collector->collectorData( 'snmp' );
+
+    $collector->registerDeleteCallback
+        ( $token, \&Torrus::Collector::SNMP::deleteTarget );
+
+    my $hostname = getHostname( $collector, $token );
+    if( not defined( $hostname ) )
+    {
+        return 0;
+    }
+
+    $tref->{'hostname'} = $hostname;
+    
+    return Torrus::Collector::SNMP::initTargetAttributes( $collector, $token );
+}
+
+
+sub initTargetAttributes
+{
+    my $collector = shift;
+    my $token = shift;
+
+    &Torrus::DB::checkInterrupted();
+
+    my $tref = $collector->tokenData( $token );
+    my $cref = $collector->collectorData( 'snmp' );
+
+    my $hostname = $tref->{'hostname'};
+    my $port = $collector->param($token, 'snmp-port');
+    my $version = $collector->param($token, 'snmp-version');
+
+    my $community;
+    if( $version eq '1' or $version eq '2c' )
+    {
+        $community = $collector->param($token, 'snmp-community');
+    }
+    else
+    {
+        # We use community string to identify the agent.
+        # For SNMPv3, it's the user name
+        $community = $collector->param($token, 'snmp-username');
+    }
+
+    my $hosthash = join('|', $hostname, $port, $community);
+    $tref->{'hosthash'} = $hosthash;
+
+    if( $version eq '1' )
+    {
+        $snmpV1Hosts{$hosthash} = 1;
+    }
+    
+    # If the object is defined as a map, retrieve the whole map
+    # and cache it.
+
+    if( isHostDead( $collector, $hosthash ) )
+    {
+        return 0;
+    }
+        
+    if( not checkUnreachableRetry( $collector, $hosthash ) )
+    {
+        $cref->{'needsRemapping'}{$token} = 1;
+        return 1;
+    }
+    
+    my $oid = $collector->param($token, 'snmp-object');
+    $oid = expandOidMappings( $collector, $token, $hosthash, $oid );
+
+    if( not $oid )
+    {
+        if( $unreachableHostDeleted{$hosthash} )
+        {
+            # we tried our best, but the target is dead
+            return 0;
+        }
+        else
+        {
+            # we return OK status, to let the storage initiate
+            $cref->{'needsRemapping'}{$token} = 1;
+            return 1;
+        }
+    }
+    elsif( $oid eq 'notfound' )
+    {
+        return 0;
+    }
+
+    # Collector should be able to find the target
+    # by host, port, community, and oid.
+    # There can be several targets with the same host|port|community+oid set.
+
+    $cref->{'targets'}{$hosthash}{$oid}{$token} = 1;
+    $cref->{'activehosts'}{$hosthash} = 1;
+
+    $tref->{'oid'} = $oid;
+
+    $cref->{'oids_per_pdu'}{$hosthash} =
+        $collector->param($token, 'snmp-oids-per-pdu');
+
+    if( $collector->param($token, 'snmp-object-type') eq 'COUNTER64' )
+    {
+        $cref->{'64bit_oid'}{$oid} = 1;
+    }
+
+    if( $collector->param($token, 'snmp-check-sysuptime') eq 'no' )
+    {
+        $cref->{'nosysuptime'}{$hosthash} = 1;
+    }
+
+    if( $collector->param($token, 'snmp-ignore-mib-errors') eq 'yes' )
+    {
+        $cref->{'ignoremiberrors'}{$hosthash}{$oid} = 1;
+    }
+    
+    return 1;
+}
+
+
+sub getHostname
+{
+    my $collector = shift;
+    my $token = shift;
+
+    my $cref = $collector->collectorData( 'snmp' );
+
+    my $hostname = $collector->param($token, 'snmp-host');
+    my $domain = $collector->param($token, 'domain-name');
+    
+    if( length( $domain ) > 0 and
+        index($hostname, '.') < 0 and
+        index($hostname, ':') < 0 )
+    {
+        $hostname .= '.' . $domain;
+    }
+    
+    return $hostname;
+}
+
+
+sub snmpSessionArgs
+{
+    my $collector = shift;
+    my $token = shift;
+    my $hosthash = shift;
+
+    my $cref = $collector->collectorData( 'snmp' );
+    if( defined( $cref->{'snmpargs'}{$hosthash} ) )
+    {
+        return $cref->{'snmpargs'}{$hosthash};
+    }
+
+    my $transport = $collector->param($token, 'snmp-transport') . '/ipv' .
+        $collector->param($token, 'snmp-ipversion');
+    
+    my ($hostname, $port, $community) = split(/\|/o, $hosthash);
+
+    my $version = $collector->param($token, 'snmp-version');
+    my $ret = [ -domain       => $transport,
+                -hostname     => $hostname,
+                -port         => $port,
+                -timeout      => $collector->param($token, 'snmp-timeout'),
+                -retries      => $collector->param($token, 'snmp-retries'),
+                -version      => $version ];
+    
+    foreach my $arg ( qw(-localaddr -localport) )
+    {
+        if( defined( $collector->param($token, 'snmp' . $arg) ) )
+        {
+            push( @{$ret}, $arg, $collector->param($token, 'snmp' . $arg) );
+        }
+    }
+            
+    if( $version eq '1' or $version eq '2c' )
+    {
+        push( @{$ret}, '-community', $community );
+    }
+    else
+    {
+        push( @{$ret}, -username, $community);
+
+        foreach my $arg ( qw(-authkey -authpassword -authprotocol
+                             -privkey -privpassword -privprotocol) )
+        {
+            if( defined( $collector->param($token, 'snmp' . $arg) ) )
+            {
+                push( @{$ret},
+                      $arg, $collector->param($token, 'snmp' . $arg) );
+            }
+        }
+    }
+
+    $cref->{'snmpargs'}{$hosthash} = $ret;
+    return $ret;
+}
+              
+
+
+sub openBlockingSession
+{
+    my $collector = shift;
+    my $token = shift;
+    my $hosthash = shift;
+
+    my $args = snmpSessionArgs( $collector, $token, $hosthash );
+    my ($session, $error) =
+        Net::SNMP->session( @{$args},
+                            -nonblocking  => 0,
+                            -translate    => ['-all', 0, '-octetstring', 1] );
+    if( not defined($session) )
+    {
+        Error('Cannot create SNMP session for ' . $hosthash . ': ' . $error);
+    }
+    else
+    {
+        my $maxmsgsize = $collector->param($token, 'snmp-max-msg-size');
+        if( defined( $maxmsgsize ) and $maxmsgsize > 0 )
+        {
+            $session->max_msg_size( $maxmsgsize );
+        }
+    }
+    
+    return $session;
+}
+
+sub openNonblockingSession
+{
+    my $collector = shift;
+    my $token = shift;
+    my $hosthash = shift;
+
+    my $args = snmpSessionArgs( $collector, $token, $hosthash );
+    
+    my ($session, $error) =
+        Net::SNMP->session( @{$args},
+                            -nonblocking  => 0x1,
+                            -translate    => ['-timeticks' => 0] );
+    if( not defined($session) )
+    {
+        Error('Cannot create SNMP session for ' . $hosthash . ': ' . $error);
+        return undef;
+    }
+    
+    if( $collector->param($token, 'snmp-transport') eq 'udp' )
+    {
+        # We set SO_RCVBUF only once, because Net::SNMP shares
+        # one UDP socket for all sessions.
+        
+        my $sock_name = $session->transport()->sock_name();
+        my $refcount = $Net::SNMP::Transport::SOCKETS->{
+            $sock_name}->[&Net::SNMP::Transport::_SHARED_REFC()];
+                                                                      
+        if( $refcount == 1 )
+        {
+            my $buflen = int($Torrus::Collector::SNMP::RxBuffer);
+            my $socket = $session->transport()->socket();
+            my $ok = $socket->sockopt( SO_RCVBUF, $buflen );
+            if( not $ok )
+            {
+                Error('Could not set SO_RCVBUF to ' .
+                      $buflen . ': ' . $!);
+            }
+            else
+            {
+                Debug('Set SO_RCVBUF to ' . $buflen);
+            }
+        }
+    }
+
+    my $maxmsgsize = $collector->param($token, 'snmp-max-msg-size');
+    if( defined( $maxmsgsize ) and $maxmsgsize > 0 )
+    {
+        $session->max_msg_size( $maxmsgsize );
+        
+    }
+    
+    return $session;
+}
+
+
+sub expandOidMappings
+{
+    my $collector = shift;
+    my $token = shift;
+    my $hosthash = shift;
+    my $oid_in = shift;
+        
+    my $cref = $collector->collectorData( 'snmp' );
+
+    my $oid = $oid_in;
+
+    # Process Map statements
+
+    while( index( $oid, 'M(' ) >= 0 )
+    {
+        if( not $oid =~ /^(.*)M\(\s*([0-9\.]+)\s*,\s*([^\)]+)\)(.*)$/o )
+        {
+            Error("Error in OID mapping syntax: $oid");
+            return undef;
+        }
+
+        my $head = $1;
+        my $map = $2;
+        my $key = $3;
+        my $tail = $4;
+
+        # Remove trailing space from key
+        $key =~ s/\s+$//o;
+
+        my $value =
+            lookupMap( $collector, $token, $hosthash, $map, $key );
+
+        if( defined( $value ) )
+        {
+            if( $value eq 'notfound' )
+            {
+                return 'notfound';
+            }
+            else
+            {
+                $oid = $head . $value . $tail;
+            }
+        }
+        else
+        {
+            return undef;
+        }
+    }
+
+    # process value lookups
+
+    while( index( $oid, 'V(' ) >= 0 )
+    {
+        if( not $oid =~ /^(.*)V\(\s*([0-9\.]+)\s*\)(.*)$/o )
+        {
+            Error("Error in OID value lookup syntax: $oid");
+            return undef;
+        }
+
+        my $head = $1;
+        my $key = $2;
+        my $tail = $4;
+
+        my $value;
+
+        if( not defined( $cref->{'value-lookups'}
+                         {$hosthash}{$key} ) )
+        {
+            # Retrieve the OID value from host
+
+            my $session = openBlockingSession( $collector, $token, $hosthash );
+            if( not defined($session) )
+            {
+                return undef;
+            }
+
+            my $result = $session->get_request( -varbindlist => [$key] );
+            $session->close();
+            if( defined $result and defined($result->{$key}) )
+            {
+                $value = $result->{$key};
+                $cref->{'value-lookups'}{$hosthash}{$key} = $value;
+            }
+            else
+            {
+                Error("Error retrieving $key from $hosthash: " .
+                      $session->error());
+                probablyDead( $collector, $hosthash );
+                return undef;
+            }
+        }
+        else
+        {
+            $value =
+                $cref->{'value-lookups'}{$hosthash}{$key};
+        }
+        if( defined( $value ) )
+        {
+            $oid = $head . $value . $tail;
+        }
+        else
+        {
+            return 'notfound';
+        }
+    }
+
+    # Debug('OID expanded: ' . $oid_in . ' -> ' . $oid');
+    return $oid;
+}
+
+# Look up table index in a map by value
+
+sub lookupMap
+{
+    my $collector = shift;
+    my $token = shift;
+    my $hosthash = shift;
+    my $map = shift;
+    my $key = shift;
+
+    my $cref = $collector->collectorData( 'snmp' );
+    my $maphash = join('#', $hosthash, $map);
+    
+    if( not defined( $maps{$hosthash}{$map} ) )
+    {
+        my $ret;
+
+        if( defined( $oldMaps{$hosthash}{$map} ) and
+            defined( $key ) )
+        {
+            $ret = $oldMaps{$hosthash}{$map}{$key};
+        }
+        
+        if( $mapLookupScheduled{$maphash} )
+        {
+            return $ret;
+        }
+
+        if( scalar(@mappingSessions) >=
+            $Torrus::Collector::SNMP::maxSessionsPerDispatcher )
+        {
+            snmp_dispatcher();
+            @mappingSessions = ();
+            %mapLookupScheduled = ();
+        }
+
+        # Retrieve map from host
+        Debug('Retrieving map ' . $map . ' from ' . $hosthash);
+
+        my $session = openNonblockingSession( $collector, $token, $hosthash );
+        if( not defined($session) )
+        {
+            return $ret;
+        }
+        else
+        {
+            push( @mappingSessions, $session );
+        }
+
+        # Retrieve the map table
+
+        $session->get_table( -baseoid => $map,
+                             -callback => [\&mapLookupCallback,
+                                           $collector, $hosthash, $map] );
+
+        $mapLookupScheduled{$maphash} = 1;
+
+        if( not $snmpV1Hosts{$hosthash} )
+        {
+            $mapsExpire{$maphash} =
+                int( time() + $mapsRefreshPeriod +
+                     rand( $mapsRefreshPeriod * $mapsRefreshRandom ) );
+        }
+        
+        return $ret;
+    }
+
+    if( defined( $key ) )
+    {
+        my $value = $maps{$hosthash}{$map}{$key};
+        if( not defined $value )
+        {
+            Error("Cannot find value $key in map $map for $hosthash in ".
+                  $collector->path($token));
+            if( defined ( $maps{$hosthash}{$map} ) )
+            {
+                Error("Current map follows");
+                while( my($key, $val) = each
+                       %{$maps{$hosthash}{$map}} )
+                {
+                    Error("'$key' => '$val'");
+                }
+            }
+            return 'notfound';
+        }
+        else
+        {
+            if( not $snmpV1Hosts{$hosthash} )
+            {
+                $cref->{'mapsDependentTokens'}{$maphash}{$token} = 1;
+                $cref->{'mapsRelatedMaps'}{$token}{$maphash} = 1;
+            }
+            
+            return $value;
+        }
+    }
+    else
+    {
+        return undef;
+    }
+}
+
+
+sub mapLookupCallback
+{
+    my $session = shift;
+    my $collector = shift;
+    my $hosthash = shift;
+    my $map = shift;
+
+    &Torrus::DB::checkInterrupted();
+    
+    Debug('Received mapping PDU from ' . $hosthash);
+
+    my $result = $session->var_bind_list();
+    if( defined $result )
+    {
+        my $preflen = length($map) + 1;
+        
+        while( my( $oid, $key ) = each %{$result} )
+        {
+            my $val = substr($oid, $preflen);
+            $maps{$hosthash}{$map}{$key} = $val;
+            # Debug("Map $map discovered: '$key' -> '$val'");
+        }
+    }
+    else
+    {
+        Error("Error retrieving table $map from $hosthash: " .
+              $session->error());
+        $session->close();
+        probablyDead( $collector, $hosthash );
+        return undef;
+    }    
+}
+
+sub activeMappingSessions
+{
+    return scalar( @mappingSessions );
+}
+    
+# The target host is unreachable. We try to reach it few more times and
+# give it the final diagnose.
+
+sub probablyDead
+{
+    my $collector = shift;
+    my $hosthash = shift;
+
+    my $cref = $collector->collectorData( 'snmp' );
+
+    # Stop all collection for this host, until next initTargetAttributes
+    # is successful
+    delete $cref->{'activehosts'}{$hosthash};
+
+    my $probablyAlive = 1;
+
+    if( defined( $hostUnreachableSeen{$hosthash} ) )
+    {
+        if( $Torrus::Collector::SNMP::unreachableTimeout > 0 and
+            time() -
+            $hostUnreachableSeen{$hosthash} >
+            $Torrus::Collector::SNMP::unreachableTimeout )
+        {
+            $probablyAlive = 0;
+        }
+    }
+    else
+    {
+        $hostUnreachableSeen{$hosthash} = time();
+
+        if( defined( $db_failures ) )
+        {
+            $db_failures->host_failure('unreachable', $hosthash);
+            $db_failures->set_counter('unreachable',
+                                      scalar( keys %hostUnreachableSeen));
+        }
+    }
+
+    if( $probablyAlive )
+    {
+        Info('Target host is unreachable. Will try again later: ' . $hosthash);
+    }
+    else
+    {
+        # It is dead indeed. Delete all tokens associated with this host
+        Info('Target host is unreachable during last ' .
+             $Torrus::Collector::SNMP::unreachableTimeout .
+             ' seconds. Giving it up: ' . $hosthash);
+        my @deleteTargets = ();
+        while( my ($oid, $ref1) =
+               each %{$cref->{'targets'}{$hosthash}} )
+        {
+            while( my ($token, $dummy) = each %{$ref1} )
+            {
+                push( @deleteTargets, $token );
+            }
+        }
+        
+        Debug('Deleting ' . scalar( @deleteTargets ) . ' tokens');
+        foreach my $token ( @deleteTargets )
+        {
+            $collector->deleteTarget($token);
+        }
+                
+        delete $hostUnreachableSeen{$hosthash};
+        delete $hostUnreachableRetry{$hosthash};
+        $unreachableHostDeleted{$hosthash} = 1;
+
+        if( defined( $db_failures ) )
+        {
+            $db_failures->host_failure('deleted', $hosthash);
+            $db_failures->set_counter('unreachable',
+                                      scalar( keys %hostUnreachableSeen));
+            $db_failures->set_counter('deleted',
+                                      scalar( keys %unreachableHostDeleted));
+        }
+    }
+    
+    return $probablyAlive;
+}
+
+# Return false if the try is too early
+
+sub checkUnreachableRetry
+{
+    my $collector = shift;
+    my $hosthash = shift;
+
+    my $cref = $collector->collectorData( 'snmp' );
+
+    my $ret = 1;
+    if( $hostUnreachableSeen{$hosthash} )
+    {
+        my $lastRetry = $hostUnreachableRetry{$hosthash};
+
+        if( not defined( $lastRetry ) )
+        {
+            $lastRetry = $hostUnreachableSeen{$hosthash};
+        }
+            
+        if( time() < $lastRetry +
+            $Torrus::Collector::SNMP::unreachableRetryDelay )
+        {
+            $ret = 0;
+        }
+        else
+        {
+            $hostUnreachableRetry{$hosthash} = time();
+        }            
+    }
+    
+    return $ret;
+}
+
+
+sub isHostDead
+{
+    my $collector = shift;
+    my $hosthash = shift;
+
+    my $cref = $collector->collectorData( 'snmp' );
+    return $unreachableHostDeleted{$hosthash};
+}
+
+
+sub hostReachableAgain
+{
+    my $collector = shift;
+    my $hosthash = shift;
+    
+    my $cref = $collector->collectorData( 'snmp' );
+    if( exists( $hostUnreachableSeen{$hosthash} ) )
+    {
+        delete $hostUnreachableSeen{$hosthash};
+        if( defined( $db_failures ) )
+        {
+            $db_failures->remove_host($hosthash);            
+            $db_failures->set_counter('unreachable',
+                                      scalar( keys %hostUnreachableSeen));
+        }
+    }
+}
+
+
+# Callback executed by Collector
+
+sub deleteTarget
+{
+    my $collector = shift;
+    my $token = shift;
+
+    my $tref = $collector->tokenData( $token );
+    my $cref = $collector->collectorData( 'snmp' );
+
+    my $hosthash = $tref->{'hosthash'};    
+    my $oid = $tref->{'oid'};
+
+    delete $cref->{'targets'}{$hosthash}{$oid}{$token};
+    if( not %{$cref->{'targets'}{$hosthash}{$oid}} )
+    {
+        delete $cref->{'targets'}{$hosthash}{$oid};
+
+        if( not %{$cref->{'targets'}{$hosthash}} )
+        {
+            delete $cref->{'targets'}{$hosthash};
+        }
+    }
+
+    delete $cref->{'needsRemapping'}{$token};
+    
+    foreach my $maphash ( keys %{$cref->{'mapsRelatedMaps'}{$token}} )
+    {
+        delete $cref->{'mapsDependentTokens'}{$maphash}{$token};
+    }
+    delete $cref->{'mapsRelatedMaps'}{$token};
+}
+
+# Main collector cycle
+
+$Torrus::Collector::runCollector{'snmp'} =
+    \&Torrus::Collector::SNMP::runCollector;
+
+sub runCollector
+{
+    my $collector = shift;
+    my $cref = shift;
+
+    # Info(sprintf('runCollector() Offset: %d, active hosts: %d, maps: %d',
+    #              $collector->offset(),
+    #              scalar( keys %{$cref->{'activehosts'}} ),
+    #              scalar(keys %maps)));
+    
+    # Create one SNMP session per host address.
+    # We assume that version, timeout and retries are the same
+    # within one address
+
+    # We limit the number of sessions per snmp_dispatcher run
+    # because of some strange bugs: with more than 400 sessions per
+    # dispatcher, some requests are not sent out
+
+    my @hosts = keys %{$cref->{'activehosts'}};
+    
+    while( scalar(@mappingSessions) + scalar(@hosts) > 0 )
+    {
+        my @batch = ();
+        while( ( scalar(@mappingSessions) + scalar(@batch) <
+                 $Torrus::Collector::SNMP::maxSessionsPerDispatcher )
+               and
+               scalar(@hosts) > 0 )
+        {
+            push( @batch, pop( @hosts ) );
+        }
+
+        &Torrus::DB::checkInterrupted();
+
+        my @sessions;
+
+        foreach my $hosthash ( @batch )
+        {
+            my @oids = sort keys %{$cref->{'targets'}{$hosthash}};
+
+            # Info(sprintf('Host %s: %d OIDs',
+            #              $hosthash,
+            #              scalar(@oids)));
+            
+            # Find one representative token for the host
+            
+            if( scalar( @oids ) == 0 )
+            {
+                next;
+            }
+        
+            my @reptokens = keys %{$cref->{'targets'}{$hosthash}{$oids[0]}};
+            if( scalar( @reptokens ) == 0 )
+            {
+                next;
+            }
+            my $reptoken = $reptokens[0];
+            
+            my $session =
+                openNonblockingSession( $collector, $reptoken, $hosthash );
+            
+            &Torrus::DB::checkInterrupted();
+            
+            if( not defined($session) )
+            {
+                next;
+            }
+            else
+            {
+                Debug('Created SNMP session for ' . $hosthash);
+                push( @sessions, $session );
+            }
+            
+            my $oids_per_pdu = $cref->{'oids_per_pdu'}{$hosthash};
+
+            my @pdu_oids = ();
+            my $delay = 0;
+            
+            while( scalar( @oids ) > 0 )
+            {
+                my $oid = shift @oids;
+                push( @pdu_oids, $oid );
+
+                if( scalar( @oids ) == 0 or
+                    ( scalar( @pdu_oids ) >= $oids_per_pdu ) )
+                {
+                    if( not $cref->{'nosysuptime'}{$hosthash} )
+                    {
+                        # We insert sysUpTime into every PDU, because
+                        # we need it in further processing
+                        push( @pdu_oids, $sysUpTime );
+                    }
+                    
+                    if( Torrus::Log::isDebug() )
+                    {
+                        Debug('Sending SNMP PDU to ' . $hosthash . ':');
+                        foreach my $oid ( @pdu_oids )
+                        {
+                            Debug($oid);
+                        }
+                    }
+
+                    # Generate the list of tokens that form this PDU
+                    my $pdu_tokens = {};
+                    foreach my $oid ( @pdu_oids )
+                    {
+                        if( defined( $cref->{'targets'}{$hosthash}{$oid} ) )
+                        {
+                            foreach my $token
+                                ( keys %{$cref->{'targets'}{$hosthash}{$oid}} )
+                            {
+                                $pdu_tokens->{$oid}{$token} = 1;
+                            }
+                        }
+                    }
+                    my $result =
+                        $session->
+                        get_request( -delay => $delay,
+                                     -callback =>
+                                     [ \&Torrus::Collector::SNMP::callback,
+                                       $collector, $pdu_tokens, $hosthash ],
+                                     -varbindlist => \@pdu_oids );
+                    if( not defined $result )
+                    {
+                        Error("Cannot create SNMP request: " .
+                              $session->error);
+                    }
+                    @pdu_oids = ();
+                    $delay += 0.01;
+                }
+            }
+        }
+        
+        &Torrus::DB::checkInterrupted();
+        
+        snmp_dispatcher();
+
+        # Check if there were pending map lookup sessions
+        
+        if( scalar( @mappingSessions ) > 0 )
+        {
+            @mappingSessions = ();
+            %mapLookupScheduled = ();
+        }
+    }
+}
+
+
+sub callback
+{
+    my $session = shift;
+    my $collector = shift;
+    my $pdu_tokens = shift;
+    my $hosthash = shift;
+
+    &Torrus::DB::checkInterrupted();
+    
+    my $cref = $collector->collectorData( 'snmp' );
+
+    Debug('SNMP Callback executed for ' . $hosthash);
+
+    if( not defined( $session->var_bind_list() ) )
+    {
+        Error('SNMP Error for ' . $hosthash . ': ' . $session->error() .
+              ' when retrieving ' . join(' ', sort keys %{$pdu_tokens}));
+
+        probablyDead( $collector, $hosthash );
+        
+        # Clear the mapping
+        delete $maps{$hosthash};
+        foreach my $oid ( keys %{$pdu_tokens} )
+        {
+            foreach my $token ( keys %{$pdu_tokens->{$oid}} )
+            {
+                $cref->{'needsRemapping'}{$token} = 1;
+            }
+        }
+        return;
+    }
+    else
+    {
+        hostReachableAgain( $collector, $hosthash );
+    }
+
+    my $timestamp = time();
+
+    my $checkUptime = not $cref->{'nosysuptime'}{$hosthash};
+    my $doSetValue = 1;
+    
+    my $uptime = 0;
+
+    if( $checkUptime )
+    {
+        my $uptimeTicks = $session->var_bind_list()->{$sysUpTime};
+        if( defined $uptimeTicks )
+        {
+            $uptime = $uptimeTicks / 100;
+            Debug('Uptime: ' . $uptime);
+        }
+        else
+        {
+            Error('Did not receive sysUpTime for ' . $hosthash);
+        }
+
+        if( $uptime < $collector->period() or
+            ( defined($cref->{'knownUptime'}{$hosthash})
+              and
+              $uptime + $collector->period() <
+              $cref->{'knownUptime'}{$hosthash} ) )
+        {
+            # The agent has reloaded. Clean all maps and push UNDEF
+            # values to the storage
+            
+            Info('Agent rebooted: ' . $hosthash);
+            delete $maps{$hosthash};
+
+            $timestamp -= $uptime;
+            foreach my $oid ( keys %{$pdu_tokens} )
+            {
+                foreach my $token ( keys %{$pdu_tokens->{$oid}} )
+                {
+                    $collector->setValue( $token, 'U', $timestamp, $uptime );
+                    $cref->{'needsRemapping'}{$token} = 1;
+                }
+            }
+            
+            $doSetValue = 0;
+        }
+        $cref->{'knownUptime'}{$hosthash} = $uptime;
+    }
+    
+    if( $doSetValue )
+    {
+        while( my ($oid, $value) = each %{ $session->var_bind_list() } )
+        {
+            # Debug("OID=$oid, VAL=$value");
+            if( $value eq 'noSuchObject' or
+                $value eq 'noSuchInstance' or
+                $value eq 'endOfMibView' )
+            {
+                if( not $cref->{'ignoremiberrors'}{$hosthash}{$oid} )
+                {
+                    Error("Error retrieving $oid from $hosthash: $value");
+                    
+                    foreach my $token ( keys %{$pdu_tokens->{$oid}} )
+                    {
+                        if( defined( $db_failures ) )
+                        {
+                            $db_failures->mib_error
+                                ($hosthash, $collector->path($token));
+                        }
+
+                        $collector->deleteTarget($token);
+                    }
+                }
+            }
+            else
+            {
+                if( $cref->{'64bit_oid'}{$oid} )
+                {
+                    $value = Math::BigInt->new($value);
+                }
+
+                foreach my $token ( keys %{$pdu_tokens->{$oid}} )
+                {
+                    $collector->setValue( $token, $value,
+                                          $timestamp, $uptime );
+                }
+            }
+        }
+    }
+}
+
+
+# Execute this after the collector has finished
+
+$Torrus::Collector::postProcess{'snmp'} =
+    \&Torrus::Collector::SNMP::postProcess;
+
+sub postProcess
+{
+    my $collector = shift;
+    my $cref = shift;
+
+    # It could happen that postProcess is called for a collector which
+    # has no targets, and therefore it's the only place where we can
+    # initialize these variables
+    
+    if( not defined( $cref->{'mapsLastExpireChecked'} ) )
+    {
+        $cref->{'mapsLastExpireChecked'} = 0;
+    }
+
+    if( not defined( $cref->{'mapsRefreshed'} ) )
+    {
+        $cref->{'mapsRefreshed'} = [];
+    }
+    
+    # look if some maps are ready after last expiration check
+    if( scalar( @{$cref->{'mapsRefreshed'}} ) > 0 )
+    {
+        foreach my $maphash ( @{$cref->{'mapsRefreshed'}} )
+        {
+            foreach my $token
+                ( keys %{$cref->{'mapsDependentTokens'}{$maphash}} )
+            {
+                $cref->{'needsRemapping'}{$token} = 1;
+            }
+        }
+        $cref->{'mapsRefreshed'} = [];
+    }
+
+    my $now = time();
+    
+    if( $cref->{'mapsLastExpireChecked'} + $mapsExpireCheckPeriod <= $now )
+    {
+        $cref->{'mapsLastExpireChecked'} = $now;
+        
+        # Check the maps expiration and arrange lookup for expired
+        
+        while( my ( $maphash, $expire ) = each %mapsExpire )
+        {
+            if( $expire <= $now and not $mapLookupScheduled{$maphash} )
+            {
+                &Torrus::DB::checkInterrupted();
+
+                my ( $hosthash, $map ) = split( /\#/o, $maphash );
+
+                if( $unreachableHostDeleted{$hosthash} )
+                {
+                    # This host is no longer polled. Remove the leftovers
+                    
+                    delete $mapsExpire{$maphash};
+                    delete $maps{$hosthash};
+                }
+                else
+                {
+                    # Find one representative token for the map
+                    my @tokens =
+                        keys %{$cref->{'mapsDependentTokens'}{$maphash}};
+                    if( scalar( @tokens ) == 0 )
+                    {
+                        next;
+                    }
+                    my $reptoken = $tokens[0];
+
+                    # save the map for the time of refresh                    
+                    $oldMaps{$hosthash}{$map} = $maps{$hosthash}{$map};
+                    delete $maps{$hosthash}{$map};
+
+                    # this will schedule the map retrieval for the next
+                    # collector cycle
+                    Debug('Refreshing map: ' . $maphash);
+                
+                    lookupMap( $collector, $reptoken,
+                               $hosthash, $map, undef );
+
+                    # After the next collector period, the maps will be
+                    # ready and tokens may be updated without losing the data
+                    push( @{$cref->{'mapsRefreshed'}}, $maphash );
+                }
+            }                
+        }
+    }
+    
+    foreach my $token ( keys %{$cref->{'needsRemapping'}} )
+    {
+        &Torrus::DB::checkInterrupted();
+
+        delete $cref->{'needsRemapping'}{$token};
+        if( not Torrus::Collector::SNMP::initTargetAttributes
+            ( $collector, $token ) )
+        {
+            $collector->deleteTarget($token);
+        }
+    }    
+}
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Collector/SNMP_Params.pm b/torrus/perllib/Torrus/Collector/SNMP_Params.pm
new file mode 100644 (file)
index 0000000..8b05264
--- /dev/null
@@ -0,0 +1,149 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: SNMP_Params.pm,v 1.1 2010-12-27 00:03:57 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+package Torrus::Collector::SNMP_Params;
+
+###  Initialize the configuration validator with module-specific parameters
+###  Moved to a separate module to speed up the compiler initialization
+
+my %validatorLeafParams =
+    (
+     'snmp-ipversion'     => {'4'   => undef, '6'   => undef},
+     'snmp-transport'     => {'udp' => undef, 'tcp' => undef},
+     'snmp-host'          => undef,
+     'snmp-port'          => undef,
+     '+snmp-localaddr'    => undef,
+     '+snmp-localport'    => undef,
+     '+domain-name'       => undef,     
+     'snmp-object'        => undef,
+     'snmp-version'       => { '1'  => { 'snmp-community'     => undef },
+                               '2c' => { 'snmp-community'     => undef },
+                               '3'  => {
+                                   'snmp-username' => undef,
+                                   '+snmp-authkey' => undef,
+                                   '+snmp-authpassword' => undef,
+                                   '+snmp-authprotocol' => {
+                                       'md5' => undef,
+                                       'sha' => undef },
+                                   '+snmp-privkey' => undef,
+                                   '+snmp-privpassword' => undef,
+                                   '+snmp-privprotocol' => {
+                                       'des'       => undef,
+                                       'aes128cfb' => undef,
+                                       '3desede'   => undef } } },
+     'snmp-timeout'       => undef,
+     'snmp-retries'       => undef,
+     'snmp-oids-per-pdu'  => undef,
+     '+snmp-object-type'  => { 'OTHER'     => undef,
+                               'COUNTER64' => undef },
+     '+snmp-check-sysuptime' => { 'yes' => undef,
+                                   'no'  => undef },
+     '+snmp-max-msg-size' => undef,
+     '+snmp-ignore-mib-errors' => undef,
+     );
+
+sub initValidatorLeafParams
+{
+    my $hashref = shift;
+    $hashref->{'ds-type'}{'collector'}{'collector-type'}{'snmp'} =
+        \%validatorLeafParams;
+}
+
+
+my %admInfoLeafParams =
+    (
+     'snmp-ipversion'     => undef,
+     'snmp-transport'     => undef,
+     'snmp-host'          => undef,
+     'snmp-port'          => undef,
+     'snmp-localaddr'     => undef,
+     'snmp-localport'     => undef,
+     'domain-name'        => undef,
+     'snmp-community'     => undef,
+     'snmp-username'      => undef,
+     'snmp-authkey'       => undef,
+     'snmp-authpassword'  => undef,
+     'snmp-authprotocol'  => undef,
+     'snmp-privkey'       => undef,
+     'snmp-privpassword'  => undef,
+     'snmp-privprotocol'  => undef,
+     'snmp-object'        => undef,
+     'snmp-version'       => undef,
+     'snmp-timeout'       => undef,
+     'snmp-retries'       => undef,
+     'snmp-oids-per-pdu'  => undef,
+     'snmp-object-type'   => undef,
+     'snmp-check-sysuptime' => undef,
+     'snmp-max-msg-size' => undef,
+     'snmp-ignore-mib-errors' => undef,
+     );
+
+
+my %admInfoParamCategories =
+    (
+     'snmp-ipversion'     => 'SNMP',
+     'snmp-transport'     => 'SNMP',
+     'snmp-host'          => 'SNMP',
+     'snmp-port'          => 'SNMP',
+     'snmp-localaddr'     => 'SNMP',
+     'snmp-localport'     => 'SNMP',
+     'domain-name'        => 'SNMP',
+     'snmp-community'     => 'SNMP',
+     'snmp-username'      => 'SNMP',
+     'snmp-authkey'       => 'SNMP',
+     'snmp-authpassword'  => 'SNMP',
+     'snmp-authprotocol'  => 'SNMP',
+     'snmp-privkey'       => 'SNMP',
+     'snmp-privpassword'  => 'SNMP',
+     'snmp-privprotocol'  => 'SNMP',     
+     'snmp-object'        => 'SNMP',
+     'snmp-version'       => 'SNMP',
+     'snmp-timeout'       => 'SNMP',
+     'snmp-retries'       => 'SNMP',
+     'snmp-oids-per-pdu'  => 'SNMP',
+     'snmp-object-type'   => 'SNMP',
+     'snmp-check-sysuptime' => 'SNMP',
+     'snmp-max-msg-size'  => 'SNMP',
+     'snmp-ignore-mib-errors' => 'SNMP'
+     );
+
+
+sub initAdmInfo
+{
+    my $map = shift;
+    my $categories = shift;
+    
+    $map->{'ds-type'}{'collector'}{'collector-type'}{'snmp'} =
+        \%admInfoLeafParams;
+    
+    while( ($pname, $category) = each %admInfoParamCategories )
+    {
+        $categories->{$pname} = $category;
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/ConfigBuilder.pm b/torrus/perllib/Torrus/ConfigBuilder.pm
new file mode 100644 (file)
index 0000000..7762c00
--- /dev/null
@@ -0,0 +1,529 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: ConfigBuilder.pm,v 1.1 2010-12-27 00:03:40 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# XML configuration builder
+
+package Torrus::ConfigBuilder;
+
+use strict;
+use XML::LibXML;
+use IO::File;
+
+use Torrus::Log;
+
+sub new
+{
+    my $self = {};
+    my $class = shift;
+    bless $self, $class;
+
+    my $doc = XML::LibXML->createDocument( "1.0", "UTF-8" );
+    my $root = $doc->createElement('configuration');
+    $doc->setDocumentElement( $root );
+    $self->{'doc'} = $doc;
+    $self->{'docroot'} = $root;
+
+    $root->appendChild($doc->createComment('DO NOT EDIT THIS FILE'));
+
+    my $dsnode = $doc->createElement('datasources');
+    $self->{'docroot'}->appendChild( $dsnode );
+    $self->{'datasources'} = $dsnode;
+
+    $self->{'required_templates'} = {};
+
+    $self->{'statistics'} = {};
+
+    $self->{'registry_overlays'} = [];
+    
+    return $self;
+}
+
+
+sub setRegistryOverlays
+{
+    my $self = shift;
+    
+    $self->{'registry_overlays'} = [];
+    push( @{$self->{'registry_overlays'}}, @_ );
+}
+
+
+sub lookupRegistry
+{
+    my $self = shift;
+    my $template = shift;
+
+    my $ret = undef;
+
+    foreach my $regOverlay ( @{$self->{'registry_overlays'}} )
+    {
+        if( defined( $regOverlay->{$template} ) )
+        {
+            $ret = $regOverlay->{$template};
+        }
+    }
+    
+    if( not defined( $ret ) and
+        defined( $Torrus::ConfigBuilder::templateRegistry{$template} ) )
+    {
+        $ret = $Torrus::ConfigBuilder::templateRegistry{$template};
+    }
+    
+    if( not defined( $ret ) )
+    {
+        if( scalar( %Torrus::ConfigBuilder::templateRegistry ) > 0 )
+        {
+            Warn('Template ' . $template .
+                 ' is not listed in ConfigBuilder template registry');
+        }
+    }
+
+    return $ret;
+}
+    
+
+
+
+sub addCreatorInfo
+{
+    my $self = shift;
+    my $creatorInfo = shift;
+
+    my $creatorNode = $self->{'doc'}->createElement('creator-info');
+    $creatorNode->appendText( $creatorInfo );
+    $self->{'docroot'}->insertBefore( $creatorNode, $self->{'datasources'} );
+}
+
+
+sub addRequiredFiles
+{
+    my $self = shift;
+
+    foreach my $file ( $self->requiredFiles() )
+    {
+        $self->addFileInclusion( $file );
+    }
+}
+
+
+sub addFileInclusion
+{
+    my $self = shift;
+    my $file = shift;
+
+    my $node = $self->{'doc'}->createElement('include');
+    $node->setAttribute( 'filename', $file );
+    $self->{'docroot'}->insertBefore( $node, $self->{'datasources'} );
+}
+
+
+sub startDefinitions
+{
+    my $self = shift;
+
+    my $node = $self->{'doc'}->createElement('definitions');
+    $self->{'docroot'}->insertBefore( $node, $self->{'datasources'} );
+    return $node;
+}
+
+
+sub addDefinition
+{
+    my $self = shift;
+    my $definitionsNode = shift;;
+    my $name = shift;
+    my $value = shift;
+
+    my $node = $self->{'doc'}->createElement('def');
+    $node->setAttribute( 'name', $name );
+    $node->setAttribute( 'value', $value );
+    $definitionsNode->appendChild( $node );
+}
+
+
+sub startParamProps
+{
+    my $self = shift;
+
+    my $node = $self->{'doc'}->createElement('param-properties');
+    $self->{'docroot'}->insertBefore( $node, $self->{'datasources'} );
+    return $node;
+}
+
+
+sub addParamProp
+{
+    my $self = shift;
+    my $propsNode = shift;;
+    my $param = shift;
+    my $prop = shift;
+    my $value = shift;
+
+    my $node = $self->{'doc'}->createElement('prop');
+    $node->setAttribute( 'param', $param );
+    $node->setAttribute( 'prop', $prop );
+    $node->setAttribute( 'value', $value );
+    $propsNode->appendChild( $node );
+}
+
+
+
+sub addSubtree
+{
+    my $self = shift;
+    my $parentNode = shift;
+    my $subtreeName = shift;
+    my $params = shift;      # hash reference with param name-value pairs
+    my $templates = shift;   # array reference with template names
+
+    return $self->addChildElement( 0, $parentNode, $subtreeName,
+                                   $params, $templates );
+}
+
+
+sub addLeaf
+{
+    my $self = shift;
+    my $parentNode = shift;
+    my $leafName = shift;
+    my $params = shift;      # hash reference with param name-value pairs
+    my $templates = shift;   # array reference with template names
+
+    return $self->addChildElement( 1, $parentNode, $leafName,
+                                   $params, $templates );
+}
+
+
+sub addChildElement
+{
+    my $self = shift;
+    my $isLeaf = shift;
+    my $parentNode = shift;
+    my $childName = shift;
+    my $params = shift;
+    my $templates = shift;
+
+    my $doc = $self->{'doc'};
+
+    if( not ref( $parentNode ) )
+    {
+        $parentNode = $self->{'datasources'};
+    }
+
+    my $childNode = $doc->createElement( $isLeaf ? 'leaf' : 'subtree' );
+    $childNode->setAttribute( 'name', $childName );
+    $childNode = $parentNode->appendChild( $childNode );
+
+    if( ref( $templates ) )
+    {
+        foreach my $tmpl ( sort @{$templates} )
+        {
+            $self->addTemplateApplication( $childNode, $tmpl );
+        }
+    }
+
+    $self->addParams( $childNode, $params );
+
+    return $childNode;
+}
+
+
+sub getChildSubtree
+{
+    my $self = shift;
+    my $parentNode = shift;
+    my $childName = shift;
+
+    if( not ref( $parentNode ) )
+    {
+        $parentNode = $self->{'datasources'};
+    }
+    
+    my @subtrees =
+        $parentNode->findnodes( 'subtree[@name="' . $childName . '"]' );
+    if( not @subtrees )
+    {
+        Error('Cannot find subtree named ' . $childName);
+        return undef;
+    }
+    return $subtrees[0];
+}
+
+
+# Reconstruct the path to the given subtree or leaf
+sub getElementPath
+{
+    my $self = shift;
+    my $node = shift;
+
+    my $path = '';
+    if( $node->nodeName() eq 'subtree' )
+    {
+        $path = '/';
+    }
+
+    while( not $node->isSameNode( $self->{'datasources'} ) )
+    {
+        $path = '/' . $node->getAttribute( 'name' ) . $path;
+        $node = $node->parentNode();
+    }
+    
+    return $path;
+}
+
+
+sub getTopSubtree
+{
+    my $self = shift;
+    return $self->{'datasources'};
+}
+
+
+sub addTemplateApplication
+{
+    my $self = shift;
+    my $parentNode = shift;
+    my $template = shift;
+
+    if( not ref( $parentNode ) )
+    {
+        $parentNode = $self->{'datasources'};
+    }
+
+    my $found = 0;
+
+    my $reg = $self->lookupRegistry( $template );
+    if( defined( $reg ) )
+    {
+        $self->{'required_templates'}{$template} = 1;
+        my $name = $reg->{'name'};
+        if( defined( $name ) )
+        {
+            $template = $name;
+        }
+    }
+    
+    my $tmplNode = $self->{'doc'}->createElement( 'apply-template' );
+    $tmplNode->setAttribute( 'name', $template );
+    $parentNode->appendChild( $tmplNode );
+}
+
+
+sub addParams
+{
+    my $self = shift;
+    my $parentNode = shift;
+    my $params = shift;
+
+    if( ref( $params ) )
+    {
+        foreach my $paramName ( sort keys %{$params} )
+        {
+            $self->addParam( $parentNode, $paramName, $params->{$paramName} );
+        }
+    }
+}
+
+
+sub addParam
+{
+    my $self = shift;
+    my $parentNode = shift;
+    my $param = shift;
+    my $value = shift;
+
+    if( not ref( $parentNode ) )
+    {
+        $parentNode = $self->{'datasources'};
+    }
+
+    my $paramNode = $self->{'doc'}->createElement( 'param' );
+    $paramNode->setAttribute( 'name', $param );
+    $paramNode->setAttribute( 'value', $value );
+    $parentNode->appendChild( $paramNode );
+}
+
+
+sub addAlias
+{
+    my $self = shift;
+    my $parentNode = shift;
+    my $aliasPath = shift;
+
+    if( not ref( $parentNode ) ) # I hope nobody would need this
+    {
+        $parentNode = $self->{'datasources'};
+    }
+
+    my $aliasNode = $self->{'doc'}->createElement( 'alias' );
+    $aliasNode->appendText( $aliasPath );
+    $parentNode->appendChild( $aliasNode );
+}
+
+
+sub setVar
+{
+    my $self = shift;
+    my $parentNode = shift;
+    my $name = shift;
+    my $value = shift;
+
+    my $setvarNode = $self->{'doc'}->createElement( 'setvar' );
+    $setvarNode->setAttribute( 'name', $name );
+    $setvarNode->setAttribute( 'value', $value );
+    $parentNode->appendChild( $setvarNode );
+}
+    
+    
+
+sub startMonitors
+{
+    my $self = shift;
+
+    my $node = $self->{'doc'}->createElement('monitors');
+    $self->{'docroot'}->appendChild( $node );
+    return $node;
+}
+
+
+sub addMonitorAction
+{
+    my $self = shift;
+    my $monitorsNode = shift;;
+    my $name = shift;
+    my $params = shift;
+
+    my $node = $self->{'doc'}->createElement('action');
+    $node->setAttribute( 'name', $name );
+    $monitorsNode->appendChild( $node );
+
+    $self->addParams( $node, $params );
+}
+
+
+sub addMonitor
+{
+    my $self = shift;
+    my $monitorsNode = shift;;
+    my $name = shift;
+    my $params = shift;
+
+    my $node = $self->{'doc'}->createElement('monitor');
+    $node->setAttribute( 'name', $name );
+    $monitorsNode->appendChild( $node );
+
+    $self->addParams( $node, $params );
+}
+
+
+sub startTokensets
+{
+    my $self = shift;
+
+    my $node = $self->{'doc'}->createElement('token-sets');
+    $self->{'docroot'}->appendChild( $node );
+    return $node;
+}
+
+
+sub addTokenset
+{
+    my $self = shift;
+    my $tsetsNode = shift;;
+    my $name = shift;
+    my $params = shift;
+
+    my $node = $self->{'doc'}->createElement('token-set');
+    $node->setAttribute( 'name', $name );
+    $tsetsNode->appendChild( $node );
+
+    $self->addParams( $node, $params );
+}
+
+
+sub addStatistics
+{
+    my $self = shift;
+
+    foreach my $stats ( sort keys %{$self->{'statistics'}} )
+    {
+        my $node = $self->{'doc'}->createElement('configbuilder-statistics');
+        $node->setAttribute( 'category', $stats );
+        $node->setAttribute( 'value', $self->{'statistics'}{$stats} );
+        $self->{'docroot'}->appendChild( $node );
+    }
+}
+
+
+
+sub requiredFiles
+{
+    my $self = shift;
+
+    my %files;
+    foreach my $template ( keys %{$self->{'required_templates'}} )
+    {
+        my $file;
+        my $reg = $self->lookupRegistry( $template );
+        if( defined( $reg ) )
+        {
+            $file = $reg->{'source'};
+        }
+        
+        if( defined( $file ) )
+        {
+            $files{$file} = 1;
+        }
+        else
+        {
+            Error('Source file is not defined for template ' . $template .
+                  ' in ConfigBuilder template registry');
+        }
+    }
+    return( sort keys %files );
+}
+
+
+
+sub toFile
+{
+    my $self = shift;
+    my $filename = shift;
+
+    my $fh = new IO::File('> ' . $filename);
+    if( defined( $fh ) )
+    {
+        my $ok = $self->{'doc'}->toFH( $fh, 2 );
+        $fh->close();
+        return $ok;
+    }
+    else
+    {
+        return undef;
+    }
+}
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/ConfigTree.pm b/torrus/perllib/Torrus/ConfigTree.pm
new file mode 100644 (file)
index 0000000..efa4aaf
--- /dev/null
@@ -0,0 +1,1158 @@
+#  Copyright (C) 2002-2007  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: ConfigTree.pm,v 1.1 2010-12-27 00:03:41 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+package Torrus::ConfigTree;
+
+use Torrus::DB;
+use Torrus::Log;
+use Torrus::TimeStamp;
+
+use strict;
+
+
+
+sub new
+{
+    my $self = {};
+    my $class = shift;
+    my %options = @_;
+    bless $self, $class;
+
+    $self->{'treename'} = $options{'-TreeName'};
+    die('ERROR: TreeName is mandatory') if not $self->{'treename'};
+
+    $self->{'db_config_instances'} =
+        new Torrus::DB( 'config_instances', -WriteAccess => 1 );
+    defined( $self->{'db_config_instances'} ) or return( undef );
+
+    my $i = $self->{'db_config_instances'}->get('ds:' . $self->{'treename'});
+    if( not defined($i) )
+    {
+        $i = 0;
+        $self->{'first_time_created'} = 1;
+    }
+
+    my $dsConfInstance = sprintf( '%d', $i );
+
+    $i = $self->{'db_config_instances'}->get('other:' . $self->{'treename'});
+    $i = 0 unless defined( $i );
+
+    my $otherConfInstance = sprintf( '%d', $i );
+
+    if( $options{'-WriteAccess'} )
+    {
+        $self->{'is_writing'} = 1;
+        
+        # Acquire exlusive lock on the database and set the compiling flag
+        {
+            my $ok = 1;
+            my $key = 'compiling:' . $self->{'treename'};
+            my $cursor = $self->{'db_config_instances'}->cursor( -Write => 1 );
+            my $compilingFlag =
+                $self->{'db_config_instances'}->c_get( $cursor, $key );
+            if( $compilingFlag )
+            {
+                if( $options{'-ForceWriter'} )
+                {
+                    Warn('Another compiler process is probably still ' .
+                         'running. This may lead to an unusable ' .
+                         'database state');
+                }
+                else
+                {
+                    Error('Another compiler is running for the tree ' .
+                          $self->{'treename'});
+                    $ok = 0;
+                }
+            }
+            else
+            {
+                $self->{'db_config_instances'}->c_put( $cursor, $key, 1 );
+            }
+            undef $cursor;
+            if( not $ok )
+            {
+                return undef;
+            }
+            $self->{'iam_writer'} = 1;
+        }
+
+        if( not $options{'-NoDSRebuild'} )
+        {
+            $dsConfInstance = sprintf( '%d', ( $dsConfInstance + 1 ) % 2 );
+        }
+        $otherConfInstance = sprintf( '%d', ( $otherConfInstance + 1 ) % 2 );
+    }
+
+    $self->{'ds_config_instance'} = $dsConfInstance;
+    $self->{'other_config_instance'} = $otherConfInstance;
+
+    $self->{'db_readers'} = new Torrus::DB('config_readers',
+                                           -Subdir => $self->{'treename'},
+                                           -WriteAccess => 1 );
+    defined( $self->{'db_readers'} ) or return( undef );
+
+    $self->{'db_dsconfig'} =
+        new Torrus::DB('ds_config_' . $dsConfInstance,
+                       -Subdir => $self->{'treename'},  -Btree => 1,
+                       -WriteAccess => $options{'-WriteAccess'});
+    defined( $self->{'db_dsconfig'} ) or return( undef );
+    
+    $self->{'db_otherconfig'} =
+        new Torrus::DB('other_config_' . $otherConfInstance,
+                       -Subdir => $self->{'treename'}, -Btree => 1,
+                       -WriteAccess => $options{'-WriteAccess'});
+    defined( $self->{'db_otherconfig'} ) or return( undef );
+    
+    $self->{'db_aliases'} =
+        new Torrus::DB('aliases_' . $dsConfInstance,
+                       -Subdir => $self->{'treename'},  -Btree => 1,
+                       -WriteAccess => $options{'-WriteAccess'});
+    defined( $self->{'db_aliases'} ) or return( undef );
+
+    if( $options{'-WriteAccess'} )
+    {
+        $self->setReady(0);
+        $self->waitReaders();
+
+        if( $options{'-Rebuild'} )
+        {
+            $self->{'db_otherconfig'}->trunc();
+            if( not $options{'-NoDSRebuild'} )
+            {
+                $self->{'db_dsconfig'}->trunc();
+                $self->{'db_aliases'}->trunc();
+            }
+        }
+    }
+    else
+    {
+        $self->setReader();
+
+        if( not $self->isReady() )
+        {
+            if( $options{'-Wait'} )
+            {
+                Warn('Configuration is not ready');
+
+                my $waitingTimeout =
+                    time() + $Torrus::Global::ConfigReadyTimeout;
+                my $success = 0;
+
+                while( not $success and time() < $waitingTimeout )
+                {
+                    $self->clearReader();
+
+                    Info('Sleeping ' .
+                         $Torrus::Global::ConfigReadyRetryPeriod .
+                         ' seconds');
+                    sleep $Torrus::Global::ConfigReadyRetryPeriod;
+
+                    $self->setReader();
+
+                    if( $self->isReady() )
+                    {
+                        $success = 1;
+                        Info('Now configuration is ready');
+                    }
+                    else
+                    {
+                        Info('Configuration is still not ready');
+                    }
+                }
+                if( not $success )
+                {
+                    Error('Configuration wait timed out');
+                    $self->clearReader();
+                    return undef;
+                }
+            }
+            else
+            {
+                Error('Configuration is not ready');
+                $self->clearReader();
+                return undef;
+            }
+        }
+    }
+
+    # Read the parameter properties into memory
+    $self->{'db_paramprops'} =
+        new Torrus::DB('paramprops_' . $dsConfInstance,
+                       -Subdir => $self->{'treename'},  -Btree => 1,
+                       -WriteAccess => $options{'-WriteAccess'});
+    defined( $self->{'db_paramprops'} ) or return( undef );
+    
+    if( $options{'-Rebuild'} )
+    {
+        $self->{'db_paramprops'}->trunc();
+    }
+    else
+    {
+        my $cursor = $self->{'db_paramprops'}->cursor();
+        while( my ($key, $val) =
+               $self->{'db_paramprops'}->next( $cursor ) )
+        {
+            my( $param, $prop ) = split( /:/o, $key );
+            $self->{'paramprop'}{$prop}{$param} = $val;
+        }
+        undef $cursor;
+        $self->{'db_paramprops'}->closeNow();
+        delete $self->{'db_paramprops'};
+    }
+
+    
+    $self->{'db_sets'} =
+        new Torrus::DB('tokensets_' . $dsConfInstance,
+                       -Subdir => $self->{'treename'}, -Btree => 0,
+                       -WriteAccess => 1, -Truncate => $options{'-Rebuild'});
+    defined( $self->{'db_sets'} ) or return( undef );
+
+
+    $self->{'db_nodepcache'} =
+        new Torrus::DB('nodepcache_' . $dsConfInstance,
+                       -Subdir => $self->{'treename'}, -Btree => 1,
+                       -WriteAccess => 1,
+                       -Truncate => ($options{'-Rebuild'} and
+                                     not $options{'-NoDSRebuild'}));
+    defined( $self->{'db_nodepcache'} ) or return( undef );
+
+
+    $self->{'db_nodeid'} =
+        new Torrus::DB('nodeid_' . $dsConfInstance,
+                       -Subdir => $self->{'treename'}, -Btree => 1,
+                       -WriteAccess => 1,
+                       -Truncate => ($options{'-Rebuild'} and
+                                     not $options{'-NoDSRebuild'}));
+    defined( $self->{'db_nodeid'} ) or return( undef );
+
+    return $self;
+}
+
+
+sub DESTROY
+{
+    my $self = shift;
+
+    Debug('Destroying ConfigTree object');
+
+    if( $self->{'iam_writer'} )
+    {
+        # Acquire exlusive lock on the database and clear the compiling flag
+        my $cursor = $self->{'db_config_instances'}->cursor( -Write => 1 );
+        $self->{'db_config_instances'}->c_put
+            ( $cursor, 'compiling:' . $self->{'treename'}, 0 );
+        undef $cursor;
+    }
+    else
+    {
+        $self->clearReader();
+    }
+
+    undef $self->{'db_dsconfig'};
+    undef $self->{'db_otherconfig'};
+    undef $self->{'db_aliases'};
+    undef $self->{'db_sets'};
+    undef $self->{'db_nodepcache'};
+    undef $self->{'db_readers'};
+}
+
+# Manage the readinness flag
+
+sub setReady
+{
+    my $self = shift;
+    my $ready = shift;
+    $self->{'db_otherconfig'}->put( 'ConfigurationReady', $ready ? 1:0 );
+}
+
+sub isReady
+{
+    my $self = shift;
+    return $self->{'db_otherconfig'}->get( 'ConfigurationReady' );
+}
+
+# Manage the readers database
+
+sub setReader
+{
+    my $self = shift;
+
+    my $readerId = 'pid=' . $$ . ',rand=' . sprintf('%.10d', rand(1e9));
+    Debug('Setting up reader: ' . $readerId);
+    $self->{'reader_id'} = $readerId;
+    $self->{'db_readers'}->put( $readerId,
+                                sprintf('%d:%d:%d',
+                                        time(),
+                                        $self->{'ds_config_instance'},
+                                        $self->{'other_config_instance'}) );
+}
+
+sub clearReader
+{
+    my $self = shift;
+
+    if( defined( $self->{'reader_id'} ) )
+    {
+        Debug('Clearing reader: ' . $self->{'reader_id'});
+        $self->{'db_readers'}->del( $self->{'reader_id'} );
+        delete $self->{'reader_id'};
+    }
+}
+
+
+sub waitReaders
+{
+    my $self = shift;
+
+    # Let the active readers finish their job
+    my $noReaders = 0;
+    while( not $noReaders )
+    {
+        my @readers = ();
+        my $cursor = $self->{'db_readers'}->cursor();
+        while( my ($key, $val) = $self->{'db_readers'}->next( $cursor ) )
+        {
+            my( $timestamp, $dsInst, $otherInst ) = split( /:/o, $val );
+            if( $dsInst == $self->{'ds_config_instance'} or
+                $otherInst == $self->{'other_config_instance'} )
+            {
+                push( @readers, {
+                    'reader' => $key,
+                    'timestamp' => $timestamp } );
+            }
+        }
+        undef $cursor;
+        if( @readers > 0 )
+        {
+            Info('Waiting for ' . scalar(@readers) . ' readers:');
+            my $recentTS = 0;
+            foreach my $reader ( @readers )
+            {
+                Info($reader->{'reader'} . ', timestamp: ' .
+                     localtime( $reader->{'timestamp'} ));
+                if( $reader->{'timestamp'} > $recentTS )
+                {
+                    $recentTS = $reader->{'timestamp'};
+                }
+            }
+            if( $recentTS + $Torrus::Global::ConfigReadersWaitTimeout >=
+                time() )
+            {
+                Info('Sleeping ' . $Torrus::Global::ConfigReadersWaitPeriod  .
+                     ' seconds');
+                sleep( $Torrus::Global::ConfigReadersWaitPeriod );
+            }
+            else
+            {
+                # the readers are too long active. we ignore them now
+                Warn('Readers wait timed out. Flushing the readers list for ' .
+                     'DS config instance ' . $self->{'ds_config_instance'} .
+                     ' and Other config instance ' .
+                     $self->{'other_config_instance'});
+
+                my $cursor = $self->{'db_readers'}->cursor( -Write => 1 );
+                while( my ($key, $val) =
+                       $self->{'db_readers'}->next( $cursor ) )
+                {
+                    my( $timestamp, $dsInst, $otherInst ) =
+                        split( /:/o, $val );
+                    if( $dsInst == $self->{'ds_config_instance'} or
+                        $otherInst == $self->{'other_config_instance'} )
+                    {
+                        $self->{'db_readers'}->c_del( $cursor );
+                    }
+                }
+                undef $cursor;
+                $noReaders = 1;
+            }
+        }
+        else
+        {
+            $noReaders = 1;
+        }
+    }
+}
+
+
+
+# This should be called after Torrus::TimeStamp::init();
+
+sub getTimestamp
+{
+    my $self = shift;
+    return Torrus::TimeStamp::get($self->{'treename'} . ':configuration');
+}
+
+sub treeName
+{
+    my $self = shift;
+    return $self->{'treename'};
+}
+
+
+# Returns array with path components
+
+sub splitPath
+{
+    my $self = shift;
+    my $path = shift;
+    my @ret = ();
+    while( length($path) > 0 )
+    {
+        my $node;
+        $path =~ s/^([^\/]*\/?)//o; $node = $1;
+        push(@ret, $node);
+    }
+    return @ret;
+}
+
+sub nodeName
+{
+    my $self = shift;
+    my $path = shift;
+    $path =~ s/.*\/([^\/]+)\/?$/$1/o;
+    return $path;
+}
+
+sub token
+{
+    my $self = shift;
+    my $path = shift;
+
+    my $token = $self->{'db_dsconfig'}->get( 'pt:'.$path );
+    if( not defined( $token ) )
+    {
+        my $prefixLen = 1; # the leading slash is anyway there
+        my $pathLen = length( $path );
+        while( not defined( $token ) and $prefixLen < $pathLen )
+        {
+            my $result = $self->{'db_aliases'}->getBestMatch( $path );
+            if( not defined( $result ) )
+            {
+                $prefixLen = $pathLen; # exit the loop
+            }
+            else
+            {
+                # Found a partial match
+                $prefixLen = length( $result->{'key'} );
+                my $aliasTarget = $self->path( $result->{'value'} );
+                $path = $aliasTarget . substr( $path, $prefixLen );
+                $token = $self->{'db_dsconfig'}->get( 'pt:'.$path );
+            }
+        }
+    }
+    return $token;
+}
+
+sub path
+{
+    my $self = shift;
+    my $token = shift;
+    return $self->{'db_dsconfig'}->get( 'tp:'.$token );
+}
+
+sub nodeExists
+{
+    my $self = shift;
+    my $path = shift;
+
+    return defined( $self->{'db_dsconfig'}->get( 'pt:'.$path ) );
+}
+
+
+sub nodeType
+{
+    my $self = shift;
+    my $token = shift;
+
+    my $type = $self->{'nodetype_cache'}{$token};
+    if( not defined( $type ) )
+    {
+        $type = $self->{'db_dsconfig'}->get( 'n:'.$token );
+        $self->{'nodetype_cache'}{$token} = $type;
+    }
+    return $type;
+}
+    
+
+sub isLeaf
+{
+    my $self = shift;
+    my $token = shift;
+
+    return ( $self->nodeType($token) == 1 );
+}
+
+
+sub isSubtree
+{
+    my $self = shift;
+    my $token = shift;
+
+    return( $self->nodeType($token) == 0 );
+}
+
+# Returns the real token or undef
+sub isAlias
+{
+    my $self = shift;
+    my $token = shift;
+
+    return( ( $self->nodeType($token) == 2 ) ?
+            $self->{'db_dsconfig'}->get( 'a:'.$token ) : undef );
+}
+
+# Returns the list of tokens pointing to this one as an alias
+sub getAliases
+{
+    my $self = shift;
+    my $token = shift;
+
+    return $self->{'db_dsconfig'}->getListItems('ar:'.$token);
+}
+
+
+sub getParam
+{
+    my $self = shift;
+    my $name = shift;
+    my $param = shift;
+    my $fromDS = shift;
+
+    if( exists( $self->{'paramcache'}{$name}{$param} ) )
+    {
+        return $self->{'paramcache'}{$name}{$param};
+    }
+    else
+    {
+        my $db = $fromDS ? $self->{'db_dsconfig'} : $self->{'db_otherconfig'};
+        my $val = $db->get( 'P:'.$name.':'.$param );
+        $self->{'paramcache'}{$name}{$param} = $val;
+        return $val;
+    }
+}
+
+sub retrieveNodeParam
+{
+    my $self = shift;
+    my $token = shift;
+    my $param = shift;
+
+    # walk up the tree and save the grandparent's value at parent's cache
+    
+    my $value;    
+    my $currtoken = $token;
+    my @ancestors;
+    my $walked = 0;
+    
+    while( not defined($value) and defined($currtoken) )
+    {
+        $value = $self->getParam( $currtoken, $param, 1 );
+        if( not defined $value )
+        {
+            if( $walked )
+            {
+                push( @ancestors, $currtoken );
+            }
+            else
+            {
+                $walked = 1;
+            }
+            # walk up to the parent
+            $currtoken = $self->getParent($currtoken);
+        }
+    }
+
+    foreach my $ancestor ( @ancestors )
+    {
+        $self->{'paramcache'}{$ancestor}{$param} = $value;
+    }
+    
+    return $self->expandNodeParam( $token, $param, $value );
+}
+
+
+sub expandNodeParam
+{
+    my $self = shift;
+    my $token = shift;
+    my $param = shift;
+    my $value = shift;
+
+    # %parameter_substitutions% in ds-path-* in multigraph leaves
+    # are expanded by the Writer post-processing
+    if( defined $value and $self->getParamProperty( $param, 'expand' ) )
+    {
+        $value = $self->expandSubstitutions( $token, $param, $value );
+    }
+    return $value;
+}
+
+
+sub expandSubstitutions
+{
+    my $self = shift;
+    my $token = shift;
+    my $param = shift;
+    my $value = shift;
+
+    my $ok = 1;
+    my $changed = 1;
+
+    while( $changed and $ok )
+    {
+        $changed = 0;
+
+        # Substitute definitions
+        if( index($value, '$') >= 0 )
+        {
+            if( not $value =~ /\$(\w+)/o )
+            {
+                my $path = $self->path($token);
+                Error("Incorrect definition reference: $value in $path");
+                $ok = 0;
+            }
+            else
+            {
+                my $dname = $1;
+                my $dvalue = $self->getDefinition($dname);
+                if( not defined( $dvalue ) )
+                {
+                    my $path = $self->path($token);
+                    Error("Cannot find definition $dname in $path");
+                    $ok = 0;
+                }
+                else
+                {
+                    $value =~ s/\$$dname/$dvalue/g;
+                    $changed = 1;
+                }
+            }
+        }
+
+        # Substitute parameter references
+        if( index($value, '%') >= 0 and $ok )
+        {
+            if( not $value =~ /\%([a-zA-Z0-9\-_]+)\%/o )
+            {
+                Error("Incorrect parameter reference: $value");
+                $ok = 0;
+            }
+            else
+            {
+                my $pname = $1;
+                my $pval = $self->getNodeParam( $token, $pname );
+
+                if( not defined( $pval ) )
+                {
+                    my $path = $self->path($token);
+                    Error("Cannot expand parameter reference %".
+                          $pname."% in ".$path);
+                    $ok = 0;
+                }
+                else
+                {
+                    $value =~ s/\%$pname\%/$pval/g;
+                    $changed = 1;
+                }
+            }
+        }
+    }
+
+    if( ref( $Torrus::ConfigTree::nodeParamHook ) )
+    {
+        $value = &{$Torrus::ConfigTree::nodeParamHook}( $self, $token,
+                                                        $param, $value );
+    }
+
+    return $value;
+}
+
+
+sub getNodeParam
+{
+    my $self = shift;
+    my $token = shift;
+    my $param = shift;
+    my $noclimb = shift;
+
+    my $value;
+    if( $noclimb )
+    {
+        $value = $self->getParam( $token, $param, 1 );
+        return $self->expandNodeParam( $token, $param, $value );
+    }
+
+    if( $self->{'is_writing'} )
+    {
+        return $self->retrieveNodeParam( $token, $param );
+    }
+
+    my $cachekey = $token.':'.$param;
+    my $cacheval = $self->{'db_nodepcache'}->get( $cachekey );
+    if( defined( $cacheval ) )
+    {
+        my $status = substr( $cacheval, 0, 1 );
+        if( $status eq 'U' )
+        {
+            return undef;
+        }
+        else
+        {
+            return substr( $cacheval, 1 );
+        }
+    }
+
+    $value = $self->retrieveNodeParam( $token, $param );
+
+    if( defined( $value ) )
+    {
+        $self->{'db_nodepcache'}->put( $cachekey, 'D'.$value );
+    }
+    else
+    {
+        $self->{'db_nodepcache'}->put( $cachekey, 'U' );
+    }
+
+    return $value;
+}
+
+
+sub getParamNames
+{
+    my $self = shift;
+    my $name = shift;
+    my $fromDS = shift;
+
+    my $db = $fromDS ? $self->{'db_dsconfig'} : $self->{'db_otherconfig'};
+
+    return $db->getListItems('Pl:'.$name);
+}
+
+
+sub getParams
+{
+    my $self = shift;
+    my $name = shift;
+    my $fromDS = shift;
+
+    my $ret = {};
+    foreach my $param ( $self->getParamNames( $name, $fromDS ) )
+    {
+        $ret->{$param} = $self->getParam( $name, $param, $fromDS );
+    }
+    return $ret;
+}
+
+sub getParent
+{
+    my $self = shift;
+    my $token = shift;
+    if( exists( $self->{'parentcache'}{$token} ) )
+    {
+        return $self->{'parentcache'}{$token};
+    }
+    else
+    {
+        my $parent = $self->{'db_dsconfig'}->get( 'p:'.$token );
+        $self->{'parentcache'}{$token} = $parent;
+        return $parent;
+    }
+}
+
+
+sub getChildren
+{
+    my $self = shift;
+    my $token = shift;
+
+    if( (my $alias = $self->isAlias($token)) )
+    {
+        return $self->getChildren($alias);
+    }
+    else
+    {
+        return $self->{'db_dsconfig'}->getListItems( 'c:'.$token );
+    }
+}
+
+sub getParamProperty
+{
+    my $self = shift;
+    my $param = shift;
+    my $prop = shift;
+
+    return $self->{'paramprop'}{$prop}{$param};
+}
+
+
+sub getParamProperties
+{
+    my $self = shift;
+
+    return $self->{'paramprop'};
+}
+
+# Recognize the regexp patterns within a path,
+# like /Netflow/Exporters/.*/.*/bps.
+# Each pattern is applied against direct child names only.
+#
+sub getNodesByPattern
+{
+    my $self = shift;
+    my $pattern = shift;
+
+    if( $pattern !~ /^\//o )
+    {
+        Error("Incorrect pattern: $pattern");
+        return undef;
+    }
+
+    my @retlist = ();
+    foreach my $nodepattern ( $self->splitPath($pattern) )
+    {
+        my @next_retlist = ();
+
+        # Cut the trailing slash, if any
+        my $patternname = $nodepattern;
+        $patternname =~ s/\/$//o;
+
+        if( $patternname =~ /\W/o )
+        {
+            foreach my $candidate ( @retlist )
+            {
+                # This is a pattern, let's get all matching children
+                foreach my $child ( $self->getChildren( $candidate ) )
+                {
+                    # Cut the trailing slash and leading path
+                    my $childname = $self->path($child);
+                    $childname =~ s/\/$//o;
+                    $childname =~ s/.*\/([^\/]+)$/$1/o;
+                    if( $childname =~ $patternname )
+                    {
+                        push( @next_retlist, $child );
+                    }
+                }
+            }
+
+        }
+        elsif( length($patternname) == 0 )
+        {
+            @next_retlist = ( $self->token('/') );
+        }
+        else
+        {
+            foreach my $candidate ( @retlist )
+            {
+                my $proposal = $self->path($candidate).$nodepattern;
+                if( defined( my $proptoken = $self->token($proposal) ) )
+                {
+                    push( @next_retlist, $proptoken );
+                }
+            }
+        }
+        @retlist = @next_retlist;
+    }
+    return @retlist;
+}
+
+#
+# Recognizes absolute or relative path, '..' as the parent subtree
+#
+sub getRelative
+{
+    my $self = shift;
+    my $token = shift;
+    my $relPath = shift;
+
+    if( $relPath =~ /^\//o )
+    {
+        return $self->token( $relPath );
+    }
+    else
+    {
+        if( length( $relPath ) > 0 )
+        {
+            $token = $self->getParent( $token );
+        }
+
+        while( length( $relPath ) > 0 )
+        {
+            if( $relPath =~ /^\.\.\//o )
+            {
+                $relPath =~ s/^\.\.\///o;
+                if( $token ne $self->token('/') )
+                {
+                    $token = $self->getParent( $token );
+                }
+            }
+            else
+            {
+                my $childName;
+                $relPath =~ s/^([^\/]*\/?)//o; $childName = $1;
+                my $path = $self->path( $token );
+                $token = $self->token( $path . $childName );
+                if( not defined $token )
+                {
+                    return undef;
+                }
+            }
+        }
+        return $token;
+    }
+}
+
+
+sub getNodeByNodeid
+{
+    my $self = shift;
+    my $nodeid = shift;
+
+    return $self->{'db_nodeid'}->get( $nodeid );
+}
+
+# Returns arrayref or undef.
+# Each element is an arrayref to [nodeid, token] pair
+sub searchNodeidPrefix
+{
+    my $self = shift;
+    my $prefix = shift;
+
+    return $self->{'db_nodeid'}->searchPrefix( $prefix );
+}
+
+
+# Returns arrayref or undef.
+# Each element is an arrayref to [nodeid, token] pair
+sub searchNodeidSubstring
+{
+    my $self = shift;
+    my $substring = shift;
+
+    return $self->{'db_nodeid'}->searchSubstring( $substring );
+}
+
+
+
+sub getDefaultView
+{
+    my $self = shift;
+    my $token = shift;
+
+    my $view;
+    if( $self->isTset($token) )
+    {
+        if( $token eq 'SS' )
+        {
+            $view = $self->getParam('SS', 'default-tsetlist-view');
+        }
+        else
+        {
+            $view = $self->getParam($token, 'default-tset-view');
+            if( not defined( $view ) )
+            {
+                $view = $self->getParam('SS', 'default-tset-view');
+            }
+        }
+    }
+    elsif( $self->isSubtree($token) )
+    {
+        $view = $self->getNodeParam($token, 'default-subtree-view');
+    }
+    else
+    {
+        # This must be leaf
+        $view = $self->getNodeParam($token, 'default-leaf-view');
+    }
+
+    if( not defined( $view ) )
+    {
+        Error("Cannot find default view for $token");
+    }
+    return $view;
+}
+
+
+sub getInstanceParam
+{
+    my $self = shift;
+    my $type = shift;
+    my $name = shift;
+    my $param = shift;
+
+    if( $type eq 'node' )
+    {
+        return $self->getNodeParam($name, $param);
+    }
+    else
+    {
+        return $self->getParam($name, $param);
+    }
+}
+
+
+sub getViewNames
+{
+    my $self = shift;
+    return $self->{'db_otherconfig'}->getListItems( 'V:' );
+}
+
+
+sub viewExists
+{
+    my $self = shift;
+    my $vname = shift;
+    return $self->searchOtherList('V:', $vname);
+}
+
+
+sub getMonitorNames
+{
+    my $self = shift;
+    return $self->{'db_otherconfig'}->getListItems( 'M:' );
+}
+
+sub monitorExists
+{
+    my $self = shift;
+    my $mname = shift;
+    return $self->searchOtherList('M:', $mname);
+}
+
+
+sub getActionNames
+{
+    my $self = shift;
+    return $self->{'db_otherconfig'}->getListItems( 'A:' );
+}
+
+
+sub actionExists
+{
+    my $self = shift;
+    my $mname = shift;
+    return $self->searchOtherList('A:', $mname);
+}
+
+
+# Search for a value in comma-separated list
+sub searchOtherList
+{
+    my $self = shift;
+    my $key = shift;
+    my $name = shift;
+
+    return $self->{'db_otherconfig'}->searchList($key, $name);
+}
+
+# Token sets manipulation
+
+sub isTset
+{
+    my $self = shift;
+    my $token = shift;
+    return substr($token, 0, 1) eq 'S';
+}
+
+sub addTset
+{
+    my $self = shift;
+    my $tset = shift;
+    $self->{'db_sets'}->addToList('S:', $tset);
+}
+
+
+sub tsetExists
+{
+    my $self = shift;
+    my $tset = shift;
+    return $self->{'db_sets'}->searchList('S:', $tset);
+}
+
+sub getTsets
+{
+    my $self = shift;
+    return $self->{'db_sets'}->getListItems('S:');
+}
+
+sub tsetMembers
+{
+    my $self = shift;
+    my $tset = shift;
+
+    return $self->{'db_sets'}->getListItems('s:'.$tset);
+}
+
+sub tsetMemberOrigin
+{
+    my $self = shift;
+    my $tset = shift;
+    my $token = shift;
+    
+    return $self->{'db_sets'}->get('o:'.$tset.':'.$token);
+}
+
+sub tsetAddMember
+{
+    my $self = shift;
+    my $tset = shift;
+    my $token = shift;
+    my $origin = shift;
+
+    $self->{'db_sets'}->addToList('s:'.$tset, $token);
+    $self->{'db_sets'}->put('o:'.$tset.':'.$token, $origin);
+}
+
+
+sub tsetDelMember
+{
+    my $self = shift;
+    my $tset = shift;
+    my $token = shift;
+
+    $self->{'db_sets'}->delFromList('s:'.$tset, $token);
+    $self->{'db_sets'}->del('o:'.$tset.':'.$token);
+}
+
+# Definitions manipulation
+
+sub getDefinition
+{
+    my $self = shift;
+    my $name = shift;
+    return $self->{'db_dsconfig'}->get( 'd:'.$name );
+}
+
+sub getDefinitionNames
+{
+    my $self = shift;
+    return $self->{'db_dsconfig'}->getListItems( 'D:' );
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/ConfigTree/Validator.pm b/torrus/perllib/Torrus/ConfigTree/Validator.pm
new file mode 100644 (file)
index 0000000..96923d0
--- /dev/null
@@ -0,0 +1,969 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Validator.pm,v 1.1 2010-12-27 00:03:45 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+package Torrus::ConfigTree::Validator;
+
+use Torrus::ConfigTree;
+use Torrus::Log;
+use Torrus::RPN;
+use Torrus::SiteConfig;
+use strict;
+
+Torrus::SiteConfig::loadStyling();
+
+%Torrus::ConfigTree::Validator::reportedErrors = ();
+
+my %rrd_params =
+    (
+     'leaf-type' => {'rrd-def' => {'rrd-ds' => undef,
+                                   'rrd-cf' => {'AVERAGE' => undef,
+                                                'MIN'     => undef,
+                                                'MAX'     => undef,
+                                                'LAST'    => undef},
+                                   'data-file' => undef,
+                                   'data-dir'  => undef},
+                     'rrd-cdef' => {'rpn-expr' => undef}},
+     );
+
+my %rrdmulti_params = ( 'ds-names' => undef );
+
+# Plugins might need to add a new storage type
+our %collector_params =
+    (
+     'collector-type'  => undef,
+     '@storage-type'   => {
+         'rrd' => {
+             'data-file'              => undef,
+             'data-dir'               => undef,
+             'leaf-type'              => {
+                 'rrd-def'  => {'rrd-ds' => undef,
+                                'rrd-cf' => {'AVERAGE' => undef,
+                                             'MIN'     => undef,
+                                             'MAX'     => undef,
+                                             'LAST'    => undef},
+                                'rrd-create-dstype' => {'GAUGE' => undef,
+                                                        'COUNTER' => undef,
+                                                        'DERIVE'  => undef,
+                                                        'ABSOLUTE' => undef },
+                                'rrd-create-rra'         => undef,
+                                'rrd-create-heartbeat'   => undef,
+                                '+rrd-hwpredict'         => {
+                                    'enabled' => {
+                                        'rrd-create-hw-rralen' => undef},
+                                    'disabled' => undef,
+                                }}}},
+         'ext' => {
+             'ext-dstype' => {
+                 'GAUGE' => undef,
+                 'COUNTER32' => undef,
+                 'COUNTER64' => undef },
+             'ext-service-id' => undef,
+             '+ext-service-units' => {
+                 'bytes' => undef }}},
+     'collector-period'      => undef,
+     'collector-timeoffset'  => undef,
+     '+collector-scale'      => undef,
+     '+collector-dispersed-timeoffset' => {
+         'no' => undef,
+         'yes' => undef }
+     # collector-timeoffset-min, max, step, and hashstring are validated
+     # during post-processing
+     );
+
+
+# Plugins might in theory create new datasource types
+our %leaf_params =
+    ('ds-type' => {'rrd-file' => \%rrd_params,
+                   'rrd-multigraph' => \%rrdmulti_params,
+                   'collector' => \%collector_params},
+     'rrgraph-views'             => undef,
+     '+rrd-scaling-base'         => {'1000' => undef, '1024' => undef},
+     '+graph-logarithmic'        => {'yes'  => undef, 'no' => undef},
+     '+graph-rigid-boundaries'   => {'yes'  => undef, 'no' => undef},
+     '+graph-ignore-decorations' => {'yes'  => undef, 'no' => undef});
+
+
+my %monitor_params =
+    ('monitor-type' => {'expression' => {'rpn-expr' => undef},
+                        'failures' => undef},
+     'action'       => undef,
+     'expires'      => undef
+     );
+
+my %action_params =
+    ('action-type' => {'tset' => {'tset-name' => undef},
+                       'exec' => {'command' => undef} }
+     );
+
+my %view_params =
+    ('expires' => undef,
+     'view-type' => {'rrgraph' => {'width' => undef,
+                                   'height' => undef,
+                                   'start' => undef,
+                                   'line-style' => undef,
+                                   'line-color' => undef,
+                                   '+ignore-limits' => {
+                                       'yes'=>undef, 'no'=>undef },
+                                   '+ignore-lower-limit' => {
+                                       'yes'=>undef, 'no'=>undef },
+                                   '+ignore-upper-limit' => {
+                                       'yes'=>undef, 'no'=>undef }},
+                     'rrprint' => {'start' => undef,
+                                   'print-cf' => undef},
+                     'html' => {'html-template' => undef},
+                     'adminfo' => undef}
+     );
+
+
+# Load additional validation, configurable from
+# torrus-config.pl and torrus-siteconfig.pl
+
+foreach my $mod ( @Torrus::Validator::loadLeafValidators )
+{
+    eval( 'require ' . $mod );
+    die( $@ ) if $@;
+    eval( '&' . $mod . '::initValidatorLeafParams( \%leaf_params )' );
+    die( $@ ) if $@;
+}
+
+
+sub validateNodes
+{
+    my $config_tree = shift;
+    my $token = $config_tree->token('/');
+
+    if( defined($token) )
+    {
+        return validateNode($config_tree, $token);
+    }
+    else
+    {
+        Error("The datasource tree is empty");
+        return 0;
+    }
+}
+
+sub validateNode
+{
+    my $config_tree = shift;
+    my $token = shift;
+
+    &Torrus::DB::checkInterrupted();
+
+    my $ok = 1;
+
+    if( $config_tree->isLeaf($token) )
+    {
+        # Verify the default view
+        my $view = $config_tree->getNodeParam( $token, 'default-leaf-view' );
+        if( not defined( $view ) )
+        {
+            my $path = $config_tree->path( $token );
+            Error("Default view is not defined for leaf $path");
+            $ok = 0;
+        }
+        elsif( not $config_tree->{'validator'}{'viewExists'}{$view} and
+               not $config_tree->viewExists( $view ) )
+        {
+            my $path = $config_tree->path( $token );
+            Error("Non-existent view is defined as default for leaf $path");
+            $ok = 0;
+        }
+        else
+        {
+            # Cache the view name
+            $config_tree->{'validator'}{'viewExists'}{$view} = 1;
+        }
+
+        # Verify parameters
+        $ok = validateInstanceParams($config_tree, $token,
+                                     'node', \%leaf_params);
+
+        if( $ok )
+        {
+            my $rrviewslist =
+                $config_tree->getNodeParam( $token, 'rrgraph-views' );
+
+            # Check the cache first
+            if( not $config_tree->{'validator'}{'graphviews'}{$rrviewslist} )
+            {
+                my @rrviews = split( ',', $rrviewslist );
+
+                if( scalar(@rrviews) != 5 )
+                {
+                    my $path = $config_tree->path( $token );
+                    Error('rrgraph-views sould refer 5 views in' . $path);
+                    $ok = 0;
+                }
+                else
+                {
+                    foreach my $view ( @rrviews )
+                    {
+                        if( not $config_tree->viewExists( $view ) )
+                        {
+                            my $path = $config_tree->path( $token );
+                            Error("Non-existent view ($view) is defined in " .
+                                  "rrgraph-views for $path");
+                            $ok = 0;
+                        }
+                        elsif( $config_tree->getParam($view, 'view-type') ne
+                               'rrgraph' )
+                        {
+                            my $path = $config_tree->path( $token );
+                            Error("View $view is not of type rrgraph in " .
+                                  "rrgraph-views for $path");
+                            $ok = 0;
+                        }
+                    }
+                }
+
+                if( $ok )
+                {
+                    # Store the cache
+                    $config_tree->{'validator'}{'graphviews'}{$rrviewslist}=1;
+                }
+            }
+        }
+
+        # Verify monitor references
+        my $mlist = $config_tree->getNodeParam( $token, 'monitor' );
+        if( defined $mlist )
+        {
+            foreach my $param ( 'monitor-period', 'monitor-timeoffset' )
+            {
+                if( not defined( $config_tree->getNodeParam( $token,
+                                                             $param ) ) )
+                {
+                    my $path = $config_tree->path( $token );
+                    Error('Mandatory parameter ' . $param .
+                          ' is not defined in ' . $path);
+                    $ok = 0;
+                }
+            }
+            
+            foreach my $monitor ( split(',', $mlist) )
+            {
+                if( not $config_tree->{'validator'}{'monitorExists'}{$monitor}
+                    and
+                    not $config_tree->monitorExists( $monitor ) )
+                {
+                    my $path = $config_tree->path( $token );
+                    Error("Non-existent monitor: $monitor in $path");
+                    $ok = 0;
+                }
+                else
+                {
+                    $config_tree->{'validator'}{'monitorExists'}{$monitor} = 1;
+                }
+            }
+            
+            my $varstring =
+                $config_tree->getNodeParam( $token, 'monitor-vars' );
+            if( defined $varstring )
+            {
+                foreach my $pair ( split( '\s*;\s*', $varstring ) )
+                {
+                    if( $pair !~ /^\w+\s*\=\s*[0-9\-+.eU]+$/o )
+                    {
+                        Error("Syntax error in monitor variables: $pair");
+                        $ok = 0;
+                    }
+                }
+            }
+
+            my $action_target =
+                $config_tree->getNodeParam($token, 'monitor-action-target');
+            if( defined( $action_target ) )
+            {
+                my $target = $config_tree->getRelative($token, $action_target);
+                if( not defined( $target ) )
+                {
+                    my $path = $config_tree->path( $token );
+                    Error('monitor-action-target points to an invalid path: ' .
+                          $action_target . ' in ' . $path);
+                    $ok = 0;
+                }
+                elsif( not $config_tree->isLeaf( $target ) )
+                {
+                    my $path = $config_tree->path( $token );
+                    Error('monitor-action-target must point to a leaf: ' .
+                          $action_target . ' in ' . $path);
+                    $ok = 0;
+                }
+            }
+        }
+
+        # Verify if the data-dir exists
+        my $datadir = $config_tree->getNodeParam( $token, 'data-dir' );
+        if( defined $datadir )
+        {
+            if( not $config_tree->{'validator'}{'dirExists'}{$datadir} and
+                not ( -d $datadir ) and
+                not $Torrus::ConfigTree::Validator::reportedErrors{$datadir} )
+            {
+                my $path = $config_tree->path( $token );
+                Error("Directory does not exist: $datadir in $path");
+                $ok = 0;
+                $Torrus::ConfigTree::Validator::reportedErrors{$datadir} = 1;
+            }
+            else
+            {
+                # Store the cache
+                $config_tree->{'validator'}{'dirExists'}{$datadir} = 1;
+            }
+        }
+
+        # Verify type-specific parameters
+        my $dsType = $config_tree->getNodeParam( $token, 'ds-type' );
+        if( not defined( $dsType ) )
+        {
+            # Writer has already complained
+            return 0;
+        }
+
+        if( $dsType eq 'rrd-multigraph' )
+        {
+            my @dsNames =
+                split(',', $config_tree->getNodeParam( $token, 'ds-names' ) );
+
+            if( scalar(@dsNames) == 0 )
+            {
+                my $path = $config_tree->path( $token );
+                Error("ds-names list is empty in $path");
+                $ok = 0;
+            }
+            foreach my $dname ( @dsNames )
+            {
+                my $param = 'ds-expr-' . $dname;
+                my $expr = $config_tree->getNodeParam( $token, $param );
+                if( not defined( $expr ) )
+                {
+                    my $path = $config_tree->path( $token );
+                    Error("Parameter $param is not defined in $path");
+                    $ok = 0;
+                }
+                else
+                {
+                    $ok = validateRPN( $token, $expr, $config_tree ) ? $ok : 0;
+                }
+
+                foreach my $paramprefix ( 'graph-legend-', 'line-style-',
+                                          'line-color-', 'line-order-' )
+                {
+                    my $param = $paramprefix.$dname;
+                    my $value = $config_tree->getNodeParam($token, $param);
+                    if( not defined( $value ) )
+                    {
+                        my $path = $config_tree->path( $token );
+                        Error('Parameter ' . $param .
+                              ' is not defined in ' . $path);
+                        $ok = 0;
+                    }
+                    elsif( $param eq 'line-style-' and
+                           not validateLine( $value ) )
+                    {
+                        my $path = $config_tree->path( $token );
+                        Error('Parameter ' . $param .
+                              ' is defined incorrectly in ' . $path);
+                        $ok = 0;
+                    }
+                    elsif( $param eq 'line-color-' and
+                           not validateColor( $value ) )
+                    {
+                        my $path = $config_tree->path( $token );
+                        Error('Parameter ' . $param .
+                              ' is defined incorrectly in ' . $path);
+                        $ok = 0;
+                    }
+                }
+            }
+        }
+        elsif( $dsType eq 'rrd-file' and
+               $config_tree->getNodeParam( $token, 'leaf-type' ) eq 'rrd-cdef')
+        {
+            my $expr = $config_tree->getNodeParam( $token, 'rpn-expr' );
+            if( defined( $expr ) )
+            {
+                $ok = validateRPN( $token, $expr, $config_tree ) ? $ok : 0;
+            }
+            # Otherwise already reported by  validateInstanceParams()
+        }
+        elsif($dsType eq 'collector' and
+              $config_tree->getNodeParam( $token, 'collector-type' ) eq 'snmp')
+        {
+            # Check the OID syntax
+            my $oid = $config_tree->getNodeParam( $token, 'snmp-object' );
+            if( defined($oid) and $oid =~ /^\./o )
+            {
+                my $path = $config_tree->path( $token );
+                Error("Invalid syntax for snmp-object in " .
+                      $path . ": OID must not start with dot");
+                $ok = 0;
+            }
+        }
+    }
+    else
+    {
+        # This is subtree
+        my $view = $config_tree->getNodeParam( $token,
+                                               'default-subtree-view' );
+
+        if( not defined( $view ) )
+        {
+            my $path = $config_tree->path( $token );
+            Error("Default view is not defined for subtree $path");
+            $ok = 0;
+        }
+        elsif( not $config_tree->{'validator'}{'viewExists'}{$view} and
+               not $config_tree->viewExists( $view ) )
+        {
+            my $path = $config_tree->path( $token );
+            Error("Non-existent view is defined as default for subtree $path");
+            $ok = 0;
+        }
+        else
+        {
+            # Store the cache
+            $config_tree->{'validator'}{'viewExists'}{$view} = 1;
+        }
+
+        foreach my $ctoken ( $config_tree->getChildren($token) )
+        {
+            if( not $config_tree->isAlias($ctoken) )
+            {
+                $ok = validateNode($config_tree, $ctoken)
+                    ? $ok:0;
+            }
+        }
+    }
+    return $ok;
+}
+
+my %validFuntcionNames =
+    ( 'AVERAGE' => 1,
+      'MIN'     => 1,
+      'MAX'     => 1,
+      'LAST'    => 1,
+      'T'       => 1 );
+
+
+sub validateRPN
+{
+    my $token = shift;
+    my $expr  = shift;
+    my $config_tree = shift;
+    my $timeoffset_supported = shift;
+
+    &Torrus::DB::checkInterrupted();
+    
+    my $ok = 1;
+
+    # There must be at least one DS reference
+    my $ds_couter = 0;
+
+    my $rpn = new Torrus::RPN;
+
+    # The callback for RPN translation
+    my $callback = sub
+    {
+        my ($noderef, $timeoffset) = @_;
+
+        my $function;
+        if( $noderef =~ s/^(.+)\@//o )
+        {
+            $function = $1;
+        }
+
+        if( defined( $function ) and not $validFuntcionNames{$function} )
+        {
+            my $path = $config_tree->path($token);
+            Error('Invalid function name ' . $function .
+                  ' in node reference at ' . $path);
+            $ok = 0;
+            return undef;
+        }            
+        
+        my $leaf = length($noderef) > 0 ?
+            $config_tree->getRelative($token, $noderef) : $token;
+
+        if( not defined $leaf )
+        {
+            my $path = $config_tree->path($token);
+            Error("Cannot find relative reference $noderef at $path");
+            $ok = 0;
+            return undef;
+        }
+        if( not $config_tree->isLeaf( $leaf ) )
+        {
+            my $path = $config_tree->path($token);
+            Error("Relative reference $noderef at $path is not a leaf");
+            $ok = 0;
+            return undef;
+        }
+        if( $config_tree->getNodeParam($leaf, 'leaf-type') ne 'rrd-def' )
+        {
+            my $path = $config_tree->path($token);
+            Error("Relative reference $noderef at $path must point to a ".
+                  "leaf of type rrd-def");
+            $ok = 0;
+            return undef;
+        }
+        if( defined( $timeoffset ) and not $timeoffset_supported )
+        {
+            my $path = $config_tree->path($token);
+            Error("Time offsets are not supported at $path");
+            $ok = 0;
+            return undef;
+        }
+
+        $ds_couter++;
+        return 'TESTED';
+    };
+
+    $rpn->translate( $expr, $callback );
+    if( $ok and $ds_couter == 0 )
+    {
+        my $path = $config_tree->path($token);
+        Error("RPN must contain at least one DS reference at $path");
+        $ok = 0;
+    }
+    return $ok;
+}
+
+
+
+sub validateViews
+{
+    my $config_tree = shift;
+    my $ok = 1;
+
+    foreach my $view ($config_tree->getViewNames())
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        $ok = validateInstanceParams($config_tree, $view,
+                                     'view', \%view_params) ? $ok:0;
+        if( $ok and $config_tree->getParam($view, 'view-type') eq 'rrgraph' )
+        {
+            my $hrulesList = $config_tree->getParam($view, 'hrules');
+            if( defined( $hrulesList ) )
+            {
+                foreach my $hrule ( split(',', $hrulesList ) )
+                {
+                    my $valueParam =
+                        $config_tree->getParam($view, 'hrule-value-' . $hrule);
+                    if( not defined( $valueParam ) or $valueParam !~ /^\S+$/o )
+                    {
+                        Error('Mandatory parameter hrule-value-' . $hrule .
+                              ' is not defined or incorrect for view ' .
+                              $view);
+                        $ok = 0;
+                    }
+                    my $color =
+                        $config_tree->getParam($view, 'hrule-color-'.$hrule);
+                    if( not defined( $color ) )
+                    {
+                        Error('Mandatory parameter hrule-color-' . $hrule .
+                              ' is not defined for view ' . $view);
+                        $ok = 0;
+                    }
+                    else
+                    {
+                        $ok = validateColor( $color ) ? $ok:0;
+                    }
+                }
+            }
+
+            my $decorList = $config_tree->getParam($view, 'decorations');
+            if( defined( $decorList ) )
+            {
+                foreach my $decorName ( split(',', $decorList ) )
+                {
+                    foreach my $paramName ( qw(order style color expr) )
+                    {
+                        my $param = 'dec-' . $paramName . '-' . $decorName;
+                        if( not defined( $config_tree->
+                                         getParam($view, $param) ) )
+                        {
+                            Error('Missing parameter: ' . $param .
+                                  ' in view ' . $view);
+                            $ok = 0;
+                        }
+                    }
+
+                    $ok = validateLine( $config_tree->
+                                        getParam($view,
+                                                 'dec-style-' . $decorName) )
+                        ? $ok:0;
+                    $ok = validateColor( $config_tree->
+                                         getParam($view,
+                                                  'dec-color-' . $decorName) )
+                        ? $ok:0;
+                }
+            }
+
+            $ok = validateColor( $config_tree->getParam($view, 'line-color') )
+                ? $ok:0;
+            $ok = validateLine( $config_tree->getParam($view, 'line-style') )
+                ? $ok:0;
+
+            my $gprintValues = $config_tree->getParam($view, 'gprint-values');
+            if( defined( $gprintValues ) and length( $gprintValues ) > 0 )
+            {
+                foreach my $gprintVal ( split(',', $gprintValues ) )
+                {
+                    my $format =
+                        $config_tree->getParam($view,
+                                               'gprint-format-' . $gprintVal);
+                    if( not defined( $format ) or length( $format ) == 0 )
+                    {
+                        Error('GPRINT format for ' . $gprintVal .
+                              ' is not defined for view ' .  $view);
+                        $ok = 0;
+                    }
+                }
+            }
+        }
+    }
+    return $ok;
+}
+
+
+sub validateColor
+{
+    my $color = shift;
+    my $ok = 1;
+
+    if( $color !~ /^\#[0-9a-fA-F]{6}$/o )
+    {
+        if( $color =~ /^\#\#(\S+)$/o )
+        {
+            if( not $Torrus::Renderer::graphStyles{$1}{'color'} )
+            {
+                Error('Incorrect color reference: ' . $color);
+                $ok = 0;
+            }
+        }
+        else
+        {
+            Error('Incorrect color syntax: ' . $color);
+            $ok = 0;
+        }
+    }
+
+    return $ok;
+}
+
+
+sub validateLine
+{
+    my $line = shift;
+    my $ok = 1;
+
+    if( $line =~ /^\#\#(\S+)$/o )
+    {
+        if( not $Torrus::Renderer::graphStyles{$1}{'line'} )
+        {
+            Error('Incorrect line style reference: ' . $line);
+            $ok = 0;
+        }
+    }
+    elsif( not $Torrus::SiteConfig::validLineStyles{$line} )
+    {
+        Error('Incorrect line syntax: ' . $line);
+        $ok = 0;
+    }
+
+    return $ok;
+}
+
+
+sub validateMonitors
+{
+    my $config_tree = shift;
+    my $ok = 1;
+
+    foreach my $action ($config_tree->getActionNames())
+    {        
+        $ok = validateInstanceParams($config_tree, $action,
+                                     'action', \%action_params) ? $ok:0;
+        my $atype = $config_tree->getParam($action, 'action-type');
+        if( $atype eq 'tset' )
+        {
+            my $tset = $config_tree->getParam($action, 'tset-name');
+            if( defined $tset )
+            {
+                $tset = 'S'.$tset;
+                if( not $config_tree->tsetExists( $tset ) )
+                {
+                    Error("Token-set does not exist: $tset in action $action");
+                    $ok = 0;
+                }
+            }
+            # Otherwise the error is already reported by validateInstanceParams
+        }
+        elsif( $atype eq 'exec' )
+        {
+            my $launch_when = $config_tree->getParam($action, 'launch-when');
+            if( defined $launch_when )
+            {
+                foreach my $when ( split(',', $launch_when) )
+                {
+                    my $matched = 0;
+                    foreach my $event ('set', 'repeat', 'clear', 'forget')
+                    {
+                        if( $when eq $event )
+                        {
+                            $matched = 1;
+                        }
+                    }
+                    if( not $matched )
+                    {
+                        if( $when eq 'throw' )
+                        {
+                            Error('Event type "throw" is no longer ' .
+                                  'supported. Replace with "set".');
+                        }
+                        else
+                        {
+                            Error("Invalid value in parameter launch-when " .
+                                  "in action $action: $when");
+                        }
+                        $ok = 0;
+                    }
+                }
+            }
+
+            my $setenv_dataexpr =
+                $config_tree->getParam( $action, 'setenv-dataexpr' );
+
+            if( defined( $setenv_dataexpr ) )
+            {
+                # <param name="setenv_dataexpr"
+                #        value="ENV1=expr1, ENV2=expr2"/>
+
+                foreach my $pair ( split( ',', $setenv_dataexpr ) )
+                {
+                    my ($env, $param) = split( '=', $pair );
+                    if( not $param )
+                    {
+                        Error("Syntax error in setenv-dataexpr in action " .
+                              $action . ": \"" . $pair . "\"");
+                        $ok = 0;
+                    }
+                    elsif( $env =~ /\W/o )
+                    {
+                        Error("Illegal characters in environment variable ".
+                              "name in setenv-dataexpr in action " . $action .
+                              ": \"" . $env . "\"");
+                        $ok = 0;
+                    }
+                    elsif( not defined ($config_tree->getParam( $action,
+                                                                $param ) ) )
+                    {
+                        Error("Parameter referenced in setenv-dataexpr is " .
+                              "not defined in action " .
+                              $action . ": " . $param);
+                        $ok = 0;
+                    }
+                }
+            }
+        }
+    }
+
+    foreach my $monitor ($config_tree->getMonitorNames())
+    {
+        $ok = validateInstanceParams($config_tree, $monitor,
+                                     'monitor', \%monitor_params) ? $ok:0;
+        my $alist = $config_tree->getParam( $monitor, 'action' );
+        foreach my $action ( split(',', $alist ) )
+        {
+            if( not $config_tree->actionExists( $action ) )
+            {
+                Error("Non-existent action: $action in monitor $monitor");
+                $ok = 0;
+            }
+        }
+    }
+    return $ok;
+}
+
+
+sub validateTokensets
+{
+    my $config_tree = shift;
+    my $ok = 1;
+
+    my $view = $config_tree->getParam( 'SS', 'default-tsetlist-view' );
+    if( not defined( $view ) )
+    {
+        Error("View is not defined for tokensets list");
+        $ok = 0;
+    }
+    elsif( not $config_tree->viewExists( $view ) )
+    {
+        Error("Non-existent view is defined for tokensets list");
+        $ok = 0;
+    }
+
+    foreach my $tset ($config_tree->getTsets())
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        $view = $config_tree->getParam($tset, 'default-tset-view');
+        if( not defined( $view ) )
+        {
+            $view = $config_tree->getParam('SS', 'default-tset-view');
+        }
+
+        if( not defined( $view ) )
+        {
+            Error("Default view is not defined for tokenset $tset");
+            $ok = 0;
+        }
+        elsif( not $config_tree->viewExists( $view ) )
+        {
+            Error("Non-existent view is defined for tokenset $tset");
+            $ok = 0;
+        }
+    }
+    return $ok;
+}
+
+
+
+
+sub validateInstanceParams
+{
+    my $config_tree = shift;
+    my $inst_name = shift;
+    my $inst_type = shift;
+    my $mapref = shift;
+
+    &Torrus::DB::checkInterrupted();
+    
+    # Debug("Validating $inst_type $inst_name");
+
+    my $ok = 1;
+    my @namemaps = ($mapref);
+
+    while( $ok and scalar(@namemaps) > 0 )
+    {
+        my @next_namemaps = ();
+
+        foreach my $namemap (@namemaps)
+        {
+            foreach my $paramkey (keys %{$namemap})
+            {
+                # Debug("Checking param: $pname");
+
+                my $pname = $paramkey;
+                my $mandatory = 1;
+                if( $pname =~ s/^\+//o )
+                {
+                    $mandatory = 0;
+                }
+
+                my $listval = 0;
+                if( $pname =~ s/^\@//o )
+                {
+                    $listval = 1;
+                }
+                
+                my $pvalue =
+                    $config_tree->getInstanceParam($inst_type,
+                                                   $inst_name, $pname);
+
+                my @pvalues;
+                if( $listval )
+                {
+                    @pvalues = split(',', $pvalue);
+                }
+                else
+                {
+                    @pvalues = ( $pvalue );
+                }
+                
+                if( not defined( $pvalue ) )
+                {
+                    if( $mandatory )
+                    {
+                        my $msg;
+                        if( $inst_type eq 'node' )
+                        {
+                            $msg = $config_tree->path( $inst_name );
+                        }
+                        else
+                        {
+                            $msg = "$inst_type $inst_name";
+                        }
+                        Error("Mandatory parameter $pname is not ".
+                              "defined for $msg");
+                        $ok = 0;
+                    }
+                }
+                else
+                {
+                    if( ref( $namemap->{$paramkey} ) )
+                    {
+                        foreach my $pval ( @pvalues )
+                        {
+                            if( exists $namemap->{$paramkey}->{$pval} )
+                            {
+                                if( defined $namemap->{$paramkey}->{$pval} )
+                                {
+                                    push( @next_namemaps,
+                                          $namemap->{$paramkey}->{$pval} );
+                                }
+                            }
+                            else
+                            {
+                                my $msg;
+                                if( $inst_type eq 'node' )
+                                {
+                                    $msg = $config_tree->path( $inst_name );
+                                }
+                                else
+                                {
+                                    $msg = "$inst_type $inst_name";
+                                }
+                                Error("Parameter $pname has ".
+                                      "unknown value: $pval for $msg");
+                                $ok = 0;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        @namemaps = @next_namemaps;
+    }
+    return $ok;
+}
+
+
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/ConfigTree/Writer.pm b/torrus/perllib/Torrus/ConfigTree/Writer.pm
new file mode 100644 (file)
index 0000000..9c1af8f
--- /dev/null
@@ -0,0 +1,755 @@
+#  Copyright (C) 2002-2007  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Writer.pm,v 1.1 2010-12-27 00:03:45 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+#
+# Write access for ConfigTree
+#
+
+package Torrus::ConfigTree::Writer;
+
+use Torrus::ConfigTree;
+our @ISA=qw(Torrus::ConfigTree);
+
+use Torrus::Log;
+use Torrus::TimeStamp;
+use Torrus::SiteConfig;
+use Torrus::ServiceID;
+    
+use strict;
+use Digest::MD5 qw(md5); # needed as hash function
+
+
+our %multigraph_remove_space =
+    ('ds-expr-' => 1,
+     'graph-legend-' => 0);
+
+
+# instance of Torrus::ServiceID object, if needed
+my $srvIdParams;
+
+# tree names where we initialized service IDs
+my %srvIdInitialized;
+
+
+sub new
+{
+    my $proto = shift;
+    my %options = @_;
+    my $class = ref($proto) || $proto;
+    $options{'-WriteAccess'} = 1;
+    my $self  = $class->SUPER::new( %options );
+    if( not defined( $self ) )
+    {
+        return undef;
+    }
+    
+    bless $self, $class;
+
+    $self->{'viewparent'} = {};
+    $self->{'mayRunCollector'} =
+        Torrus::SiteConfig::mayRunCollector( $self->treeName() );
+
+    $self->{'collectorInstances'} =
+        Torrus::SiteConfig::collectorInstances( $self->treeName() );
+
+    $self->{'db_collectortokens'} = [];
+    foreach my $instance ( 0 .. ($self->{'collectorInstances'} - 1) )
+    {
+        $self->{'db_collectortokens'}->[$instance] =
+            new Torrus::DB( 'collector_tokens' . '_' .
+                            $instance . '_' . $self->{'ds_config_instance'},
+                            -Subdir => $self->treeName(),
+                            -WriteAccess => 1,
+                            -Truncate    => 1 );
+    }
+
+    # delay writing of frequently changed values
+    $self->{'db_dsconfig'}->delay();
+    $self->{'db_otherconfig'}->delay();    
+    return $self;
+}
+
+
+sub newToken
+{
+    my $self = shift;
+    my $token = $self->{'next_free_token'};
+    $token = 1 unless defined( $token );
+    $self->{'next_free_token'} = $token + 1;
+    return sprintf('T%.4d', $token);
+}
+
+
+sub setParam
+{
+    my $self  = shift;
+    my $name  = shift;
+    my $param = shift;
+    my $value = shift;
+
+    if( $self->getParamProperty( $param, 'remspace' ) )
+    {
+        $value =~ s/\s+//go;
+    }
+
+    $self->{'paramcache'}{$name}{$param} = $value;
+    $self->{'db_otherconfig'}->put( 'P:'.$name.':'.$param, $value );
+    $self->{'db_otherconfig'}->addToList('Pl:'.$name, $param);
+}
+
+sub setNodeParam
+{
+    my $self  = shift;
+    my $name  = shift;
+    my $param = shift;
+    my $value = shift;
+
+    if( $self->getParamProperty( $param, 'remspace' ) )
+    {
+        $value =~ s/\s+//go;
+    }
+
+    $self->{'paramcache'}{$name}{$param} = $value;
+    $self->{'db_dsconfig'}->put( 'P:'.$name.':'.$param, $value );
+    $self->{'db_dsconfig'}->addToList('Pl:'.$name, $param);
+}
+
+
+sub setParamProperty
+{
+    my $self = shift;
+    my $param = shift;
+    my $prop = shift;
+    my $value = shift;
+
+    $self->{'paramprop'}{$prop}{$param} = $value;
+    $self->{'db_paramprops'}->put( $param . ':' . $prop, $value );
+}
+
+
+sub initRoot
+{
+    my $self  = shift;
+    if( not defined( $self->token('/') ) )
+    {
+        my $token = $self->newToken();
+        $self->{'db_dsconfig'}->put( 'pt:/', $token );
+        $self->{'db_dsconfig'}->put( 'tp:'.$token, '/' );
+        $self->{'db_dsconfig'}->put( 'n:'.$token, 0 );
+        $self->{'nodetype_cache'}{$token} = 0;
+    }
+}
+
+sub addChild
+{
+    my $self = shift;
+    my $token = shift;
+    my $childname = shift;
+    my $isAlias = shift;
+
+    if( not $self->isSubtree( $token ) )
+    {
+        Error('Cannot add a child to a non-subtree node: ' .
+              $self->path($token));
+        return undef;
+    }
+
+    my $path = $self->path($token) . $childname;
+
+    # If the child already exists, do nothing
+
+    my $ctoken = $self->token($path);
+    if( not defined($ctoken) )
+    {
+        $ctoken = $self->newToken();
+
+        $self->{'db_dsconfig'}->put( 'pt:'.$path, $ctoken );
+        $self->{'db_dsconfig'}->put( 'tp:'.$ctoken, $path );
+
+        $self->{'db_dsconfig'}->addToList( 'c:'.$token, $ctoken );
+        $self->{'db_dsconfig'}->put( 'p:'.$ctoken, $token );
+        $self->{'parentcache'}{$ctoken} = $token;
+
+        my $nodeType;
+        if( $isAlias )
+        {
+            $nodeType = 2; # alias
+        }
+        elsif( $childname =~ /\/$/o )
+        {
+            $nodeType = 0; # subtree
+        }
+        else
+        {
+            $nodeType = 1; # leaf
+        }
+        $self->{'db_dsconfig'}->put( 'n:'.$ctoken, $nodeType );
+        $self->{'nodetype_cache'}{$ctoken} = $nodeType;
+    }
+    return $ctoken;
+}
+
+sub setAlias
+{
+    my $self = shift;
+    my $token = shift;
+    my $apath = shift;
+
+    my $ok = 1;
+
+    my $iamLeaf = $self->isLeaf($token);
+
+    # TODO: Add more verification here
+    if( not defined($apath) or $apath !~ /^\//o or
+        ( not $iamLeaf and $apath !~ /\/$/o ) or
+        ( $iamLeaf and $apath =~ /\/$/o ) )
+    {
+        my $path = $self->path($token);
+        Error("Incorrect alias at $path: $apath"); $ok = 0;
+    }
+    elsif( $self->token( $apath ) )
+    {
+        my $path = $self->path($token);
+        Error("Alias already exists: $apath at $path"); $ok = 0;
+    }
+    else
+    {
+        # Go through the alias and create subtrees if neccessary
+
+        my @pathelements = $self->splitPath($apath);
+        my $aliasChildName = pop @pathelements;
+
+        my $nodepath = '';
+        my $parent_token = $self->token('/');
+
+        foreach my $nodename ( @pathelements )
+        {
+            $nodepath .= $nodename;
+            my $child_token = $self->token( $nodepath );
+            if( not defined( $child_token ) )
+            {
+                $child_token = $self->addChild( $parent_token, $nodename );
+                if( not defined( $child_token ) )
+                {
+                    return 0;
+                }
+            }
+            $parent_token = $child_token;
+        }
+
+        my $alias_token = $self->addChild( $parent_token, $aliasChildName, 1 );
+        if( not defined( $alias_token ) )
+        {
+            return 0;
+        }
+
+        $self->{'db_dsconfig'}->put( 'a:'.$alias_token, $token );
+        $self->{'db_dsconfig'}->addToList( 'ar:'.$token, $alias_token );
+        $self->{'db_aliases'}->put( $apath, $token );
+    }
+    return $ok;
+}
+
+sub addView
+{
+    my $self = shift;
+    my $vname = shift;
+    my $parent = shift;
+    $self->{'db_otherconfig'}->addToList('V:', $vname);
+    if( defined( $parent ) )
+    {
+        $self->{'viewparent'}{$vname} = $parent;
+    }
+}
+
+
+sub addMonitor
+{
+    my $self = shift;
+    my $mname = shift;
+    $self->{'db_otherconfig'}->addToList('M:', $mname);
+}
+
+
+sub addAction
+{
+    my $self = shift;
+    my $aname = shift;
+    $self->{'db_otherconfig'}->addToList('A:', $aname);
+}
+
+
+sub addDefinition
+{
+    my $self = shift;
+    my $name = shift;
+    my $value = shift;
+    $self->{'db_dsconfig'}->put( 'd:'.$name, $value );
+    $self->{'db_dsconfig'}->addToList('D:', $name);
+}
+
+
+sub setVar
+{
+    my $self = shift;
+    my $token = shift;
+    my $name = shift;
+    my $value = shift;
+    
+    $self->{'setvar'}{$token}{$name} = $value;
+}
+
+
+sub isTrueVar
+{
+    my $self = shift;
+    my $token = shift;
+    my $name = shift;
+
+    my $ret = 0;
+
+    while( defined( $token ) and
+           not defined( $self->{'setvar'}{$token}{$name} ) )
+    {
+        $token = $self->getParent( $token );
+    }
+
+    if( defined( $token ) )
+    {
+        my $value = $self->{'setvar'}{$token}{$name};
+        if( defined( $value ) )
+        {
+            if( $value eq 'true' or
+                $value =~ /^\d+$/o and $value )
+            {
+                $ret = 1;
+            }
+        }
+    }
+    
+    return $ret;
+}
+
+sub finalize
+{
+    my $self = shift;
+    my $status = shift;
+
+    if( $status )
+    {
+        # write delayed data
+        $self->{'db_dsconfig'}->commit();
+        $self->{'db_otherconfig'}->commit();    
+        
+        Verbose('Configuration has compiled successfully. Switching over to ' .
+             'DS config instance ' . $self->{'ds_config_instance'} .
+             ' and Other config instance ' .
+             $self->{'other_config_instance'} );
+
+        $self->setReady(1);
+        if( not $self->{'-NoDSRebuild'} )
+        {
+            $self->{'db_config_instances'}->
+                put( 'ds:' . $self->treeName(),
+                     $self->{'ds_config_instance'} );
+        }
+
+        $self->{'db_config_instances'}->
+            put( 'other:' . $self->treeName(),
+                 $self->{'other_config_instance'} );
+
+        Torrus::TimeStamp::init();
+        Torrus::TimeStamp::setNow($self->treeName() . ':configuration');
+        Torrus::TimeStamp::release();
+    }
+}
+
+
+sub postProcess
+{
+    my $self = shift;
+
+    my $ok = $self->postProcessNodes();
+
+    # Propagate view inherited parameters
+    $self->{'viewParamsProcessed'} = {};
+    foreach my $vname ( $self->getViewNames() )
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        $self->propagateViewParams( $vname );
+    }
+    return $ok;
+}
+
+
+
+sub postProcessNodes
+{
+    my $self = shift;
+    my $token = shift;
+
+    &Torrus::DB::checkInterrupted();
+
+    my $ok = 1;
+
+    if( not defined( $token ) )
+    {
+        $token = $self->token('/');
+    }
+
+    my $nodeid = $self->getNodeParam( $token, 'nodeid', 1 );
+    if( defined( $nodeid ) )
+    {
+        # verify the uniqueness of nodeid
+        
+        my $oldToken = $self->{'db_nodeid'}->get($nodeid);
+        if( defined($oldToken) )
+        {
+            Error('Non-unique nodeid ' . $nodeid .
+                  ' in ' . $self->path($token) .
+                  ' and ' . $self->path($oldToken));
+            $ok = 0;
+        }
+        else
+        {
+            $self->{'db_nodeid'}->put($nodeid, $token);
+        }
+    }
+
+    
+    if( $self->isLeaf($token) )
+    {
+        # Process static tokenset members
+
+        my $tsets = $self->getNodeParam( $token, 'tokenset-member' );
+        if( defined( $tsets ) )
+        {
+            foreach my $tset ( split(/,/o, $tsets) )
+            {
+                my $tsetName = 'S'.$tset;
+                if( not $self->tsetExists( $tsetName ) )
+                {
+                    my $path = $self->path( $token );
+                    Error("Referenced undefined token set $tset in $path");
+                    $ok = 0;
+                }
+                else
+                {
+                    $self->tsetAddMember( $tsetName, $token, 'static' );
+                }
+            }
+        }
+
+        my $dsType = $self->getNodeParam( $token, 'ds-type' );
+        if( defined( $dsType ) )
+        {
+            if( $dsType eq 'rrd-multigraph' )
+            {
+                # Expand parameter substitutions in multigraph leaves
+                
+                my @dsNames =
+                    split(/,/o, $self->getNodeParam($token, 'ds-names') );
+                
+                foreach my $dname ( @dsNames )
+                {
+                    foreach my $param ( 'ds-expr-', 'graph-legend-' )
+                    {
+                        my $dsParam = $param . $dname;
+                        my $value = $self->getNodeParam( $token, $dsParam );
+                        if( defined( $value ) )
+                        {
+                            my $newValue = $value;
+                            if( $multigraph_remove_space{$param} )
+                            {
+                                $newValue =~ s/\s+//go;
+                            }
+                            $newValue =
+                                $self->expandSubstitutions( $token, $dsParam,
+                                                            $newValue );
+                            if( $newValue ne $value )
+                            {
+                                $self->setNodeParam( $token, $dsParam,
+                                                     $newValue );
+                            }
+                        }
+                    }
+                }
+            }
+            elsif( $dsType eq 'collector' and $self->{'mayRunCollector'} )
+            {
+                # Split the collecting job between collector instances
+                my $instance = 0;
+                my $nInstances = $self->{'collectorInstances'};
+
+                my $oldOffset =
+                    $self->getNodeParam($token, 'collector-timeoffset');
+                my $newOffset = $oldOffset;
+                
+                my $period =
+                    $self->getNodeParam($token, 'collector-period');
+                
+                if( $nInstances > 1 )
+                {
+                    my $hashString =
+                        $self->getNodeParam($token,
+                                            'collector-instance-hashstring');
+                    if( not defined( $hashString ) )
+                    {
+                        Error('collector-instance-hashstring is not defined ' .
+                              'in ' . $self->path( $token ));
+                        $hashString = '';
+                    }
+                    
+                    $instance =
+                        unpack( 'N', md5( $hashString ) ) % $nInstances;
+                }          
+
+                $self->setNodeParam( $token,
+                                     'collector-instance',
+                                     $instance );
+                
+                my $dispersed =
+                    $self->getNodeParam($token,
+                                        'collector-dispersed-timeoffset');
+                if( defined( $dispersed ) and $dispersed eq 'yes' )
+                {
+                    # Process dispersed collector offsets
+                    
+                    my %p;
+                    foreach my $param ( 'collector-timeoffset-min',
+                                        'collector-timeoffset-max',
+                                        'collector-timeoffset-step',
+                                        'collector-timeoffset-hashstring' )
+                    {
+                        my $val = $self->getNodeParam( $token, $param );
+                        if( not defined( $val ) )
+                        {
+                            Error('Mandatory parameter ' . $param . ' is not '.
+                                  ' defined in ' . $self->path( $token ));
+                            $ok = 0;
+                        }
+                        else
+                        {
+                            $p{$param} = $val;
+                        }
+                    }
+
+                    if( $ok )
+                    {
+                        my $min = $p{'collector-timeoffset-min'};
+                        my $max = $p{'collector-timeoffset-max'};
+                        if( $max < $min )
+                        {
+                            Error('collector-timeoffset-max is less than ' .
+                                  'collector-timeoffset-min in ' .
+                                  $self->path( $token ));
+                            $ok = 0;
+                        }
+                        else
+                        {
+                            my $step = $p{'collector-timeoffset-step'};
+                            my $hashString =
+                                $p{'collector-timeoffset-hashstring'};
+                            
+                            my $bucketSize = int( ($max - $min) / $step );
+                            $newOffset =
+                                $min
+                                +
+                                $step * ( unpack( 'N', md5( $hashString ) ) %
+                                          $bucketSize )
+                                +
+                                $instance * int( $step / $nInstances );
+                        }
+                    }
+                }
+                else
+                {
+                    $newOffset += $instance * int( $period / $nInstances ); 
+                } 
+
+                $newOffset %= $period;
+                
+                if( $newOffset != $oldOffset )
+                {
+                    $self->setNodeParam( $token,
+                                         'collector-timeoffset',
+                                         $newOffset );
+                }
+
+                $self->{'db_collectortokens'}->[$instance]->put
+                    ( $token, sprintf('%d:%d', $period, $newOffset) );
+
+                my $storagetypes =
+                    $self->getNodeParam( $token, 'storage-type' );
+                foreach my $stype ( split(/,/o, $storagetypes) )
+                {
+                    if( $stype eq 'ext' )
+                    {
+                        if( not defined( $srvIdParams ) )
+                        {
+                            $srvIdParams =
+                                new Torrus::ServiceID( -WriteAccess => 1 );
+                        }
+
+                        my $srvTrees =
+                            $self->getNodeParam($token, 'ext-service-trees');
+
+                        if( not defined( $srvTrees ) or
+                            length( $srvTrees ) == 0 )
+                        {
+                            $srvTrees = $self->treeName();
+                        }
+                                                
+                        my $serviceid =
+                            $self->getNodeParam($token, 'ext-service-id');
+
+                        foreach my $srvTree (split(/\s*,\s*/o, $srvTrees))
+                        {
+                            if( not Torrus::SiteConfig::treeExists($srvTree) )
+                            {
+                                Error
+                                    ('Error processing ext-service-trees' .
+                                     'for ' . $self->path( $token ) .
+                                     ': tree ' . $srvTree .
+                                     ' does not exist');
+                                $ok = 0;
+                            }
+                            else
+                            {
+                                if( not $srvIdInitialized{$srvTree} )
+                                {
+                                    $srvIdParams->cleanAllForTree
+                                        ( $srvTree );
+                                    $srvIdInitialized{$srvTree} = 1;
+                                }
+                                else
+                                {
+                                    if( $srvIdParams->idExists( $serviceid,
+                                                                $srvTree ) )
+                                    {
+                                        Error('Duplicate ServiceID: ' .
+                                              $serviceid . ' in tree ' .
+                                              $srvTree);
+                                        $ok = 0;
+                                    }
+                                }
+                            }
+                        }
+
+                        if( $ok )
+                        {
+                            # sorry for ackward Emacs auto-indent
+                            my $params = {
+                                'trees' => $srvTrees,
+                                'token' => $token,
+                                'dstype' =>
+                                    $self->getNodeParam($token,
+                                                        'ext-dstype'),
+                                    'units' =>
+                                    $self->getNodeParam
+                                    ($token, 'ext-service-units')
+                                };
+                            
+                            $srvIdParams->add( $serviceid, $params );
+                        }
+                    }
+                }
+            }
+        }
+        else
+        {
+            my $path = $self->path( $token );
+            Error("Mandatory parameter 'ds-type' is not defined for $path");
+            $ok = 0;
+        }            
+    }
+    else
+    {
+        foreach my $ctoken ( $self->getChildren( $token ) )
+        {
+            if( not $self->isAlias( $ctoken ) )
+            {
+                $ok = $self->postProcessNodes( $ctoken ) ? $ok:0;
+            }
+        }
+    }
+    return $ok;
+}
+
+
+sub propagateViewParams
+{
+    my $self = shift;
+    my $vname = shift;
+
+    # Avoid processing the same view twice
+    if( $self->{'viewParamsProcessed'}{$vname} )
+    {
+        return;
+    }
+
+    # First we do the same for parent
+    my $parent = $self->{'viewparent'}{$vname};
+    if( defined( $parent ) )
+    {
+        $self->propagateViewParams( $parent );
+
+        my $parentParams = $self->getParams( $parent );
+        foreach my $param ( keys %{$parentParams} )
+        {
+            if( not defined( $self->getParam( $vname, $param ) ) )
+            {
+                $self->setParam( $vname, $param, $parentParams->{$param} );
+            }
+        }
+    }
+
+    # mark this view as processed
+    $self->{'viewParamsProcessed'}{$vname} = 1;
+}
+
+
+sub validate
+{
+    my $self = shift;
+
+    my $ok = 1;
+
+    $self->{'is_writing'} = undef;
+
+    if( not $self->{'-NoDSRebuild'} )
+    {
+        $ok = Torrus::ConfigTree::Validator::validateNodes($self);
+    }
+    $ok = Torrus::ConfigTree::Validator::validateViews($self) ? $ok:0;
+    $ok = Torrus::ConfigTree::Validator::validateMonitors($self) ? $ok:0;
+    $ok = Torrus::ConfigTree::Validator::validateTokensets($self) ? $ok:0;
+
+    return $ok;
+}
+
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/ConfigTree/XMLCompiler.pm b/torrus/perllib/Torrus/ConfigTree/XMLCompiler.pm
new file mode 100644 (file)
index 0000000..0874270
--- /dev/null
@@ -0,0 +1,548 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: XMLCompiler.pm,v 1.1 2010-12-27 00:03:45 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+package Torrus::ConfigTree::XMLCompiler;
+
+use Torrus::ConfigTree::Writer;
+our @ISA=qw(Torrus::ConfigTree::Writer);
+
+use Torrus::ConfigTree;
+use Torrus::ConfigTree::Validator;
+use Torrus::SiteConfig;
+use Torrus::Log;
+use Torrus::TimeStamp;
+
+use XML::LibXML;
+use strict;
+
+sub new
+{
+    my $proto = shift;
+    my %options = @_;
+    my $class = ref($proto) || $proto;
+
+    $options{'-Rebuild'} = 1;
+
+    my $self  = $class->SUPER::new( %options );
+    if( not defined( $self ) )
+    {
+        return undef;
+    }
+
+    bless $self, $class;
+
+    if( $options{'-NoDSRebuild'} )
+    {
+        $self->{'-NoDSRebuild'} = 1;
+    }
+
+    $self->{'files_processed'} = {};
+
+    return $self;
+}
+
+
+sub compile
+{
+    my $self = shift;
+    my $filename = shift;
+
+    &Torrus::DB::checkInterrupted();
+    
+    $filename = Torrus::SiteConfig::findXMLFile($filename);
+    if( not defined( $filename ) )
+    {
+        return 0;
+    }
+                    
+    # Make sure we process each file only once
+    if( $self->{'files_processed'}{$filename} )
+    {
+        return 1;
+    }
+    else
+    {
+        $self->{'files_processed'}{$filename} = 1;
+    }
+
+    Verbose('Compiling ' . $filename);
+
+    my $ok = 1;
+    my $parser = new XML::LibXML;
+    my $doc;
+    eval { $doc = $parser->parse_file( $filename );  };
+    if( $@ )
+    {
+        Error("Failed to parse $filename: $@");
+        return 0;
+    }
+
+    my $root = $doc->documentElement();
+
+    # Initialize the '/' element
+    $self->initRoot();
+
+    my $node;
+
+    # First of all process all pre-required files
+    foreach $node ( $root->getElementsByTagName('include') )
+    {
+        my $incfile = $node->getAttribute('filename');
+        if( not $incfile )
+        {
+            Error("No filename given in include statement in $filename");
+            $ok = 0;
+        }
+        else
+        {
+            $ok = $self->compile( $incfile ) ? $ok:0;
+        }
+    }
+
+    foreach $node ( $root->getElementsByTagName('param-properties') )
+    {
+        $ok = $self->compile_paramprops( $node ) ? $ok:0;
+    }
+
+    if( not $self->{'-NoDSRebuild'} )
+    {
+        foreach $node ( $root->getElementsByTagName('definitions') )
+        {
+            $ok = $self->compile_definitions( $node ) ? $ok:0;
+        }
+
+        foreach $node ( $root->getElementsByTagName('datasources') )
+        {
+            $ok = $self->compile_ds( $node ) ? $ok:0;
+        }
+    }
+
+    foreach $node ( $root->getElementsByTagName('monitors') )
+    {
+        $ok = $self->compile_monitors( $node ) ? $ok:0;
+    }
+
+    foreach $node ( $root->getElementsByTagName('token-sets') )
+    {
+        $ok = $self->compile_tokensets( $node ) ? $ok:0;
+    }
+
+    foreach $node ( $root->getElementsByTagName('views') )
+    {
+        $ok = $self->compile_views( $node ) ? $ok:0;
+    }
+
+    return $ok;
+}
+
+
+sub compile_definitions
+{
+    my $self = shift;
+    my $node = shift;
+    my $ok = 1;
+
+    foreach my $def ( $node->getChildrenByTagName('def') )
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        my $name = $def->getAttribute('name');
+        my $value = $def->getAttribute('value');
+        if( not $name )
+        {
+            Error("Definition without a name"); $ok = 0;
+        }
+        elsif( not $value )
+        {
+            Error("Definition without value: $name"); $ok = 0;
+        }
+        elsif( defined $self->getDefinition($name) )
+        {
+            Error("Duplicate definition: $name"); $ok = 0;
+        }
+        else
+        {
+            $self->addDefinition($name, $value);
+        }
+    }
+    return $ok;
+}
+
+
+sub compile_paramprops
+{
+    my $self = shift;
+    my $node = shift;
+    my $ok = 1;
+
+    foreach my $def ( $node->getChildrenByTagName('prop') )
+    {
+        &Torrus::DB::checkInterrupted();
+          
+        my $param = $def->getAttribute('param'); 
+        my $prop = $def->getAttribute('prop');
+        my $value = $def->getAttribute('value');
+        if( not $param or not $prop or not defined($value) )
+        {
+            Error("Property definition error"); $ok = 0;
+        }
+        else
+        {
+            $self->setParamProperty($param, $prop, $value);
+        }
+    }
+    return $ok;
+}
+
+
+
+# Process <param name="name" value="value"/> and put them into DB.
+# Usage: $self->compile_params($node, $name);
+
+sub compile_params
+{
+    my $self = shift;
+    my $node = shift;
+    my $name = shift;
+    my $isDS = shift;
+
+    &Torrus::DB::checkInterrupted();
+          
+    my $ok = 1;
+    foreach my $p_node ( $node->getChildrenByTagName('param') )
+    {
+        my $param = $p_node->getAttribute('name');
+        my $value = $p_node->getAttribute('value');
+        if( not defined($value) )
+        {
+            $value = $p_node->textContent();
+        }
+        if( not $param )
+        {
+            Error("Parameter without name in $name"); $ok = 0;
+        }
+        else
+        {
+            # Remove spaces in the head and tail.
+            $value =~ s/^\s+//om;
+            $value =~ s/\s+$//om;
+
+            if( $isDS )
+            {
+                $self->setNodeParam($name, $param, $value);
+            }
+            else
+            {
+                $self->setParam($name, $param, $value);
+            }
+        }
+    }
+    return $ok;
+}
+
+
+sub compile_ds
+{
+    my $self = shift;
+    my $ds_node = shift;
+    my $ok = 1;
+
+    # First, process templates. We expect them to be direct children of
+    # <datasources>
+
+    foreach my $template ( $ds_node->getChildrenByTagName('template') )
+    {
+        my $name = $template->getAttribute('name');
+        if( not $name )
+        {
+            Error("Template without a name"); $ok = 0;
+        }
+        elsif( defined $self->{'Templates'}->{$name} )
+        {
+            Error("Duplicate template names: $name"); $ok = 0;
+        }
+        else
+        {
+            $self->{'Templates'}->{$name} = $template;
+        }
+    }
+
+    # Recursively traverse the tree
+    $ok = $self->compile_subtrees( $ds_node, $self->token('/') ) ? $ok:0;
+
+    return $ok;
+}
+
+
+
+
+sub validate_nodename
+{
+    my $self = shift;
+    my $name = shift;
+
+    return ( $name =~ /^[0-9A-Za-z_\-\.\:]+$/o and
+             $name !~ /\.\./o );
+}
+
+sub compile_subtrees
+{
+    my $self = shift;
+    my $node = shift;
+    my $token = shift;
+    my $iamLeaf = shift;
+    
+    my $ok = 1;
+
+    # Apply templates
+
+    foreach my $templateapp ( $node->getChildrenByTagName('apply-template') )
+    {
+        my $name = $templateapp->getAttribute('name');
+        if( not $name )
+        {
+            my $path = $self->path($token);
+            Error("Template application without a name at $path"); $ok = 0;
+        }
+        else
+        {
+            my $template = $self->{'Templates'}->{$name};
+            if( not defined $template )
+            {
+                my $path = $self->path($token);
+                Error("Cannot find template named $name at $path"); $ok = 0;
+            }
+            else
+            {
+                $ok = $self->compile_subtrees
+                    ($template, $token, $iamLeaf) ? $ok:0;
+            }
+        }
+    }
+
+    $ok = $self->compile_params($node, $token, 1);
+
+    # Handle aliases -- we are still in compile_subtrees()
+
+    foreach my $alias ( $node->getChildrenByTagName('alias') )
+    {
+        my $apath = $alias->textContent();
+        $apath =~ s/\s+//mgo;
+        $ok = $self->setAlias($token, $apath) ? $ok:0;
+    }
+
+    foreach my $setvar ( $node->getChildrenByTagName('setvar') )        
+    {
+        my $name = $setvar->getAttribute('name');
+        my $value = $setvar->getAttribute('value');
+        if( not defined( $name ) or not defined( $value ) )
+        {
+            my $path = $self->path($token);
+            Error("Setvar statement without name or value in $path"); $ok = 0;
+        }
+        else
+        {
+            $self->setVar( $token, $name, $value );
+        }
+    }
+
+    # Compile-time variables
+    
+    foreach my $iftrue ( $node->getChildrenByTagName('iftrue') )        
+    {
+        my $var = $iftrue->getAttribute('var');
+        if( not defined( $var ) )
+        {
+            my $path = $self->path($token);
+            Error("Iftrue statement without variable name in $path"); $ok = 0;
+        }
+        elsif( $self->isTrueVar( $token, $var ) )
+        {
+            $ok = $self->compile_subtrees( $iftrue, $token, $iamLeaf ) ? $ok:0;
+        }
+    }
+
+    foreach my $iffalse ( $node->getChildrenByTagName('iffalse') )        
+    {
+        my $var = $iffalse->getAttribute('var');
+        if( not defined( $var ) )
+        {
+            my $path = $self->path($token);
+            Error("Iffalse statement without variable name in $path"); $ok = 0;
+        }
+        elsif( not $self->isTrueVar( $token, $var ) )
+        {
+            $ok = $self->compile_subtrees
+                ( $iffalse, $token, $iamLeaf ) ? $ok:0;
+        }
+    }
+
+    
+    # Compile child nodes -- the last part of compile_subtrees()
+
+    if( not $iamLeaf )
+    {
+        foreach my $subtree ( $node->getChildrenByTagName('subtree') )
+        {
+            my $name = $subtree->getAttribute('name');
+            if( not defined( $name ) or length( $name ) == 0 )
+            {
+                my $path = $self->path($token);
+                Error("Subtree without a name at $path"); $ok = 0;
+            }
+            else
+            {
+                if( $self->validate_nodename( $name ) )
+                {
+                    my $stoken = $self->addChild($token, $name.'/');
+                    $ok = $self->compile_subtrees( $subtree, $stoken ) ? $ok:0;
+                }
+                else
+                {
+                    my $path = $self->path($token);
+                    Error("Invalid subtree name: $name at $path"); $ok = 0;
+                }
+            }
+        }
+
+        foreach my $leaf ( $node->getChildrenByTagName('leaf') )
+        {
+            my $name = $leaf->getAttribute('name');
+            if( not defined( $name ) or length( $name ) == 0 )
+            {
+                my $path = $self->path($token);
+                Error("Leaf without a name at $path"); $ok = 0;
+            }
+            else
+            {
+                if( $self->validate_nodename( $name ) )
+                {
+                    my $ltoken = $self->addChild($token, $name);
+                    $ok = $self->compile_subtrees( $leaf, $ltoken, 1 ) ? $ok:0;
+                }
+                else
+                {
+                    my $path = $self->path($token);
+                    Error("Invalid leaf name: $name at $path"); $ok = 0;
+                }
+            }
+        }
+    }
+    return $ok;
+}
+
+
+sub compile_monitors
+{
+    my $self = shift;
+    my $mon_node = shift;
+    my $ok = 1;
+
+    foreach my $monitor ( $mon_node->getChildrenByTagName('monitor') )
+    {
+        my $mname = $monitor->getAttribute('name');
+        if( not $mname )
+        {
+            Error("Monitor without a name"); $ok = 0;
+        }
+        else
+        {
+            $ok = $self->addMonitor( $mname );
+            $ok = $self->compile_params($monitor, $mname) ? $ok:0;
+        }
+    }
+
+    foreach my $action ( $mon_node->getChildrenByTagName('action') )
+    {
+        my $aname = $action->getAttribute('name');
+        if( not $aname )
+        {
+            Error("Action without a name"); $ok = 0;
+        }
+        else
+        {
+            $self->addAction( $aname );
+            $ok = $self->compile_params($action, $aname);
+        }
+    }
+    return $ok;
+}
+
+
+sub compile_tokensets
+{
+    my $self = shift;
+    my $tsets_node = shift;
+    my $ok = 1;
+
+    $ok = $self->compile_params($tsets_node, 'SS') ? $ok:0;
+
+    foreach my $tokenset ( $tsets_node->getChildrenByTagName('token-set') )
+    {
+        my $sname = $tokenset->getAttribute('name');
+        if( not $sname )
+        {
+            Error("Token-set without a name"); $ok = 0;
+        }
+        else
+        {
+            $sname = 'S'. $sname;
+            $ok = $self->addTset( $sname );
+            $ok = $self->compile_params($tokenset, $sname) ? $ok:0;
+        }
+    }
+    return $ok;
+}
+
+
+sub compile_views
+{
+    my $self = shift;
+    my $vw_node = shift;
+    my $parentname = shift;
+    my $ok = 1;
+
+    foreach my $view ( $vw_node->getChildrenByTagName('view') )
+    {
+        my $vname = $view->getAttribute('name');
+        if( not $vname )
+        {
+            Error("View without a name"); $ok = 0;
+        }
+        else
+        {
+            $self->addView( $vname, $parentname );
+            $ok = $self->compile_params( $view, $vname ) ? $ok:0;
+            # Process child views
+            $ok = $self->compile_views( $view, $vname ) ? $ok:0;
+        }
+    }
+    return $ok;
+}
+
+
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DB.pm b/torrus/perllib/Torrus/DB.pm
new file mode 100644 (file)
index 0000000..4d600f9
--- /dev/null
@@ -0,0 +1,703 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: DB.pm,v 1.1 2010-12-27 00:03:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+package Torrus::DB;
+
+use Torrus::Log;
+use BerkeleyDB;
+use strict;
+
+
+# This is an abstraction layer for BerkeleyDB database operations
+#
+# Database opening:
+#    my $db = new Torrus::DB('db_name',
+#                          [ -Btree => 1, ]
+#                          [ -WriteAccess => 1, ]
+#                          [ -Truncate    => 1, ]
+#                          [ -Subdir      => 'dirname' ]);
+#    Defaults: Hash, read-only, no truncate.
+#
+# Database closing:
+#    undef $db;
+#
+# Database cleaning:
+#    $status = $db->trunc();
+#
+
+END
+{
+    &Torrus::DB::cleanupEnvironment();
+}
+
+sub new
+{
+    my $self = {};
+    my $class = shift;
+    my $dbname = shift;
+    my %options = @_;
+    bless $self, $class;
+
+    if( not defined($Torrus::DB::env) )
+    {
+        if( not defined $Torrus::Global::dbHome )
+        {
+            Error('$Torrus::Global::dbHome must be defined ' .
+                  'in torrus_config.pl');
+            return undef;
+        }
+        elsif( not -d $Torrus::Global::dbHome )
+        {
+            Error("No such directory: $Torrus::Global::dbHome" );
+            return undef;
+        }
+        else
+        {
+            $Torrus::DB::dbEnvErrFile =
+                $Torrus::Global::logDir . '/dbenv_errlog_' . $$;
+            
+            Debug("Creating BerkeleyDB::Env");
+            umask 0002;
+            $Torrus::DB::env =
+                new BerkeleyDB::Env(-Home  => $Torrus::Global::dbHome,
+                                    -Flags => (DB_CREATE |
+                                               DB_INIT_CDB | DB_INIT_MPOOL),
+                                    -Mode  => 0664,
+                                    -ErrFile => $Torrus::DB::dbEnvErrFile);
+            if( not defined($Torrus::DB::env) )
+            {
+                Error("Cannot create BerkeleyDB Environment: ".
+                      $BerkeleyDB::Error);
+                return undef;
+            }
+        }
+    }
+
+    my $filename = $dbname.'.db';
+
+    if( $options{'-Subdir'} )
+    {
+        my $dirname = $Torrus::Global::dbHome . '/' . $Torrus::DB::dbSub;
+        if( not -d $dirname and not mkdir( $dirname ) )
+        {
+            Error("Cannot create directory $dirname: $!");
+            return undef;
+        }
+        $dirname .= '/' . $options{'-Subdir'};
+        if( not -d $dirname and not mkdir( $dirname ) )
+        {
+            Error("Cannot create directory $dirname: $!");
+            return undef;
+        }
+        $filename =
+            $Torrus::DB::dbSub . '/' . $options{'-Subdir'} . '/' . $filename;
+    }
+
+    # we need this in DESTROY debug message
+    $self->{'dbname'} = $filename;
+
+    my %hash;
+
+    my $accmethod = $options{'-Btree'} ?
+        'BerkeleyDB::Btree':'BerkeleyDB::Hash';
+
+    my $flags = DB_RDONLY;
+
+    if( $options{'-WriteAccess'} )
+    {
+        $flags = DB_CREATE;
+    }
+
+    my $property = 0;
+    if( $options{'-Duplicates'} )
+    {
+        $property = DB_DUP | DB_DUPSORT;
+    }
+        
+    if( not exists( $Torrus::DB::dbPool{$filename} ) )
+    {
+        Debug('Opening ' . $self->{'dbname'});
+
+        my $dbh = new $accmethod (
+                                  -Filename => $filename,
+                                  -Flags    => $flags,
+                                  -Property => $property,
+                                  -Mode     => 0664,
+                                  -Env      => $Torrus::DB::env );
+        if( not $dbh )
+        {
+            Error("Cannot open database $filename: $! $BerkeleyDB::Error");
+            return undef;
+        }
+
+        $Torrus::DB::dbPool{$filename} = { 'dbh'        => $dbh,
+                                           'accmethod'  => $accmethod,
+                                           'flags'      => $flags };
+
+        $self->{'dbh'} = $dbh;
+    }
+    else
+    {
+        my $ref = $Torrus::DB::dbPool{$filename};
+        if( $ref->{'accmethod'} eq $accmethod and $ref->{'flags'} eq $flags )
+        {
+            $self->{'dbh'} = $ref->{'dbh'};
+        }
+        else
+        {
+            Error('Database in dbPool has different flags: ' .
+                  $self->{'dbname'});
+            return undef;
+        }
+    }
+
+    if( $options{'-Truncate'} )
+    {
+        $self->trunc();
+    }
+
+    if( $options{'-Delayed'} )
+    {
+        $self->{'delay_list_commit'} = 1;
+    }
+
+    return $self;
+}
+
+
+# It is strongly inadvisable to do anything inside a signal handler when DB
+# operation is in progress
+
+our $interrupted = 0;
+
+my $signalHandlersSet = 0;
+my $safeSignals = 0;
+
+
+
+
+
+sub setSignalHandlers
+{
+    if( $signalHandlersSet )
+    {
+        return;
+    }
+    
+    $SIG{'TERM'} = sub {
+        if( $safeSignals )
+        {
+            Warn('Received SIGTERM. Scheduling to exit.');
+            $interrupted = 1;
+        }
+        else
+        {
+            Warn('Received SIGTERM. Stopping the process.');
+            exit(1);
+        }            
+    };
+
+    $SIG{'INT'} = sub {
+        if( $safeSignals )
+        {
+            Warn('Received SIGINT. Scheduling to exit.');
+            $interrupted = 1;
+        }
+        else
+        {
+            Warn('Received SIGINT. Stopping the process');
+            exit(1);
+        }            
+    };
+    
+
+    $SIG{'PIPE'} = sub {
+        if( $safeSignals )
+        {
+            Warn('Received SIGPIPE. Scheduling to exit.');
+            $interrupted = 1;
+        }
+        else
+        {
+            Warn('Received SIGPIPE. Stopping the process');
+            exit(1);
+        }            
+    };
+    
+    $SIG{'QUIT'} = sub {
+        if( $safeSignals )
+        {
+            Warn('Received SIGQUIT. Scheduling to exit.');
+            $interrupted = 1;
+        }
+        else
+        {
+            Warn('Received SIGQUIT. Stopping the process');
+            exit(1);
+        }            
+    };
+
+    $signalHandlersSet = 1;
+}
+
+
+sub setSafeSignalHandlers
+{
+    setSignalHandlers();
+    $safeSignals = 1;
+}
+
+
+sub setUnsafeSignalHandlers
+{
+    setSignalHandlers();
+    $safeSignals = 0;
+}
+    
+
+# If we were previously interrupted, gracefully exit now
+
+sub checkInterrupted
+{
+    if( $interrupted )
+    {
+        Warn('Stopping the process');
+        exit(1);
+    }
+}
+
+
+
+sub closeNow
+{
+    my $self = shift;
+
+    my $filename = $self->{'dbname'};
+    Debug('Explicitly closing ' . $filename);
+    delete $Torrus::DB::dbPool{$filename};
+    $self->{'dbh'}->db_close();
+    delete $self->{'dbh'};
+}
+
+sub cleanupEnvironment
+{
+    if( defined( $Torrus::DB::env ) )
+    {
+        foreach my $filename ( sort keys %Torrus::DB::dbPool )
+        {
+            Debug('Closing ' . $filename);
+            $Torrus::DB::dbPool{$filename}->{'dbh'}->db_close();
+            delete $Torrus::DB::dbPool{$filename};
+        }
+        
+        Debug("Destroying BerkeleyDB::Env");
+        $Torrus::DB::env->close();
+        $Torrus::DB::env = undef;
+
+        if( -z $Torrus::DB::dbEnvErrFile )
+        {
+            unlink $Torrus::DB::dbEnvErrFile;
+        }
+    }
+}
+
+
+sub delay
+{
+    my $self = shift;
+    $self->{'delay_list_commit'} = 1;
+}
+
+    
+
+sub trunc
+{
+    my $self = shift;
+
+    Debug('Truncating ' . $self->{'dbname'});
+    my $count = 0;
+    return $self->{'dbh'}->truncate($count) == 0;
+}
+
+
+sub put
+{
+    my $self = shift;
+    my $key = shift;
+    my $val = shift;
+
+    ref( $self->{'dbh'} ) or die( 'Fatal error: ' . $self->{'dbname'} );
+    return $self->{'dbh'}->db_put($key, $val) == 0;
+}
+
+sub get
+{
+    my $self = shift;
+    my $key = shift;
+    my $val = undef;
+
+    $self->{'dbh'}->db_get($key, $val);
+    return $val;
+}
+
+
+sub del
+{
+    my $self = shift;
+    my $key = shift;
+    my $val = undef;
+
+    return $self->{'dbh'}->db_del($key) == 0;
+}
+
+
+sub cursor
+{
+    my $self = shift;
+    my %options = @_;
+    
+    return $self->{'dbh'}->db_cursor( $options{'-Write'} ? DB_WRITECURSOR:0 );
+}
+
+
+sub next
+{
+    my $self = shift;
+    my $cursor = shift;
+    my $key = '';
+    my $val = '';
+
+    if( $cursor->c_get($key, $val, DB_NEXT) == 0 )
+    {
+        return ($key, $val);
+    }
+    else
+    {
+        return ();
+    }
+}
+
+sub c_del
+{
+    my $self = shift;
+    my $cursor = shift;
+
+    my $cnt = 0;
+    $cursor->c_del( $cnt );
+}
+
+
+sub c_get
+{
+    my $self = shift;
+    my $cursor = shift;
+    my $key = shift;
+    my $val = undef;
+
+    if( $cursor->c_get( $key, $val, DB_SET ) == 0 )
+    {
+        return $val;
+    }
+    else
+    {
+        return undef;
+    }
+}
+
+sub c_put
+{
+    my $self = shift;
+    my $cursor = shift;
+    my $key = shift;
+    my $val = shift;
+
+    return ( $cursor->c_put( $key, $val, DB_KEYFIRST ) == 0 );
+}
+
+
+
+# Btree best match. We assume that the searchKey is longer or equal
+# than the matched key in the database.
+#
+# If none found, returns undef.
+# If found, returns a hash with keys
+# "exact" => true when exact match found
+# "key"   => key as is stored in the database
+# "value" => value from the matched database entry
+# The found key is shorter or equal than searchKey, and is a prefix
+# of the searchKey
+
+sub getBestMatch
+{
+    my $self = shift;
+    my $searchKey = shift;
+
+    my $key = $searchKey;
+    my $searchLen = length( $searchKey );
+    my $val = '';
+    my $ret = {};
+    my $ok = 0;
+
+    my $cursor = $self->{'dbh'}->db_cursor();
+
+    if( $cursor->c_get( $key, $val, DB_SET_RANGE ) == 0 )
+    {
+        if( $key eq $searchKey )
+        {
+            $ok = 1;
+            $ret->{'exact'} = 1;
+        }
+        else
+        {
+            # the returned key/data pair is the smallest data item greater
+            # than or equal to the specified data item.
+            # The previous entry should be what we search for.
+            if( $cursor->c_get( $key, $val, DB_PREV ) == 0 )
+            {
+                if( length( $key ) < $searchLen and
+                    index( $searchKey, $key ) == 0 )
+                {
+                    $ok = 1;
+                    $ret->{'key'} = $key;
+                    $ret->{'value'} = $val;
+                }
+            }
+        }
+    }
+    else
+    {
+        if ( $cursor->c_get( $key, $val, DB_LAST ) == 0 )
+        {
+            if( length( $key ) < $searchLen and
+                index( $searchKey, $key ) == 0 )
+            {
+                $ok = 1;
+                $ret->{'key'} = $key;
+                $ret->{'value'} = $val;
+            }
+        }
+    }
+
+    return( $ok ? $ret : undef );
+}
+
+
+# Search the keys that match the specified prefix.
+# Return value is an array of [key,val] pairs or undef
+# Returned keys may be duplicated if the DB is created with -Duplicates
+
+sub searchPrefix
+{
+    my $self = shift;
+    my $prefix = shift;
+
+    my $ret = [];
+    my $ok = 0;
+
+    my $key = $prefix;
+    my $val = '';
+
+    my $cursor = $self->{'dbh'}->db_cursor();
+
+    if( $cursor->c_get( $key, $val, DB_SET_RANGE ) == 0 )
+    {
+        # the returned key/data pair is the smallest data item greater
+        # than or equal to the specified data item.
+        my $finished = 0;
+        while( not $finished )
+        {
+            if( index( $key, $prefix ) == 0 )
+            {
+                $ok = 1;
+                push( @{$ret}, [ $key, $val ] );
+
+                if( $cursor->c_get($key, $val, DB_NEXT) != 0 )
+                {
+                    $finished = 1;
+                }
+            }
+            else
+            {
+                $finished = 1;
+            }
+        }
+    }
+
+    undef $cursor;
+
+    return( $ok ? $ret : undef );    
+}
+    
+
+# Search the keys that match the specified substring.
+# Return value is an array of [key,val] pairs or undef
+# Returned keys may be duplicated if the DB is created with -Duplicates
+
+sub searchSubstring
+{
+    my $self = shift;
+    my $substring = shift;
+
+    my $ret = [];
+    my $ok = 0;
+
+    my $key = '';
+    my $val = '';
+
+    my $cursor = $self->{'dbh'}->db_cursor();
+
+    while( $cursor->c_get($key, $val, DB_NEXT) == 0 )
+    {
+        if( index( $key, $substring ) >= 0 )
+        {
+            $ok = 1;
+            push( @{$ret}, [ $key, $val ] );
+        }
+    }
+    
+    undef $cursor;
+    
+    return( $ok ? $ret : undef );    
+}
+    
+
+
+
+
+# Comma-separated list manipulation
+
+sub _populateListCache
+{
+    my $self = shift;
+    my $key = shift;
+
+    if( not exists( $self->{'listcache'}{$key} ) )
+    {
+        my $ref = {};        
+        my $values = $self->get($key);
+        if( defined( $values ) )
+        {
+            foreach my $val (split(/,/o, $values))
+            {
+                $ref->{$val} = 1;
+            }
+        }
+        $self->{'listcache'}{$key} = $ref;
+    }
+}
+
+
+sub _storeListCache
+{
+    my $self = shift;
+    my $key = shift;
+
+    if( not $self->{'delay_list_commit'} )
+    {
+        $self->put($key, join(',', keys %{$self->{'listcache'}{$key}}));
+    }
+}
+
+    
+sub addToList
+{
+    my $self = shift;
+    my $key = shift;
+    my $newval = shift;
+
+    $self->_populateListCache($key);
+    
+    $self->{'listcache'}{$key}{$newval} = 1;
+    
+    $self->_storeListCache($key);
+}
+
+
+sub searchList
+{
+    my $self = shift;
+    my $key = shift;
+    my $name = shift;
+
+    $self->_populateListCache($key);
+    return $self->{'listcache'}{$key}{$name};
+}
+
+
+sub delFromList
+{
+    my $self = shift;
+    my $key = shift;
+    my $name = shift;
+
+    $self->_populateListCache($key);
+    if( $self->{'listcache'}{$key}{$name} )
+    {
+        delete $self->{'listcache'}{$key}{$name};
+    }
+    
+    $self->_storeListCache($key);
+}
+
+
+sub getListItems
+{
+    my $self = shift;
+    my $key = shift;
+
+    $self->_populateListCache($key);
+    return keys %{$self->{'listcache'}{$key}};
+}
+
+    
+
+sub deleteList
+{
+    my $self = shift;
+    my $key = shift;
+
+    delete $self->{'listcache'}{$key};
+    $self->del($key);
+}
+
+
+sub commit
+{
+    my $self = shift;
+    
+    if( $self->{'delay_list_commit'} and
+        defined( $self->{'listcache'} ) )
+    {
+        while( my($key, $list) = each %{$self->{'listcache'}} )
+        {
+            $self->put($key, join(',', keys %{$list}));
+        }
+    }
+}
+            
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DataAccess.pm b/torrus/perllib/Torrus/DataAccess.pm
new file mode 100644 (file)
index 0000000..e03fda1
--- /dev/null
@@ -0,0 +1,317 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: DataAccess.pm,v 1.1 2010-12-27 00:03:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+package Torrus::DataAccess;
+
+use Torrus::ConfigTree;
+use Torrus::Log;
+use Torrus::RPN;
+
+use strict;
+use RRDs;
+
+# The Torrus::DataAccess object contains cached values, and it does not
+# check the cache validity. We assume that a Torrus::DataAccess object
+# lifetime is within a short period of time, such as one monitor cycle.
+
+sub new
+{
+    my $self = {};
+    my $class = shift;
+    bless $self, $class;
+    return $self;
+}
+
+# Read the data from datasource file, depending on its type.
+# If time is not specified, reads the latest available data.
+# In case of rrd-cdef leaf type, the returned timestamp is the
+# earliest timestamp of the data sources involved.
+#
+# ($value, $timestamp) = $da->read( $config_tree, $leaf_token )
+#
+# ($value, $timestamp) = $da->read( $config_tree, $leaf_token, $end_time )
+#
+# ($value, $timestamp) = $da->read( $config_tree, $leaf_token,
+#                                   $end_time, $start_time )
+
+
+sub read
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $t_end = shift;
+    my $t_start = shift;
+
+    my $cachekey = $token .
+        ':' . (defined($t_end)?$t_end:'') .
+        ':' . (defined($t_start)?$t_start:'');
+    
+    if( exists( $self->{'cache_read'}{$cachekey} ) )
+    {
+        return @{$self->{'cache_read'}{$cachekey}};
+    }
+    
+    if( not $config_tree->isLeaf( $token ) )
+    {
+        my $path = $config_tree->path( $token );
+        Error("Torrus::DataAccess::readLast: $path is not a leaf");
+        return undef;
+    }
+
+    my $ret_val;
+    my $ret_time;
+    
+    my $ds_type = $config_tree->getNodeParam( $token, 'ds-type' );
+    if( $ds_type eq 'rrd-file' or
+        $ds_type eq 'collector' )
+    {
+        my $leaf_type = $config_tree->getNodeParam( $token, 'leaf-type' );
+
+        if( $leaf_type eq 'rrd-def' )
+        {
+            my $file = $config_tree->getNodeParam( $token, 'data-file' );
+            my $dir = $config_tree->getNodeParam( $token, 'data-dir' );
+            my $ds = $config_tree->getNodeParam( $token, 'rrd-ds' );
+            my $cf = $config_tree->getNodeParam( $token, 'rrd-cf' );
+            ( $ret_val, $ret_time ) =
+                $self->read_RRD_DS( $dir.'/'.$file,
+                                    $cf, $ds, $t_end, $t_start );
+        }
+        elsif( $leaf_type eq 'rrd-cdef' )
+        {
+            my $expr = $config_tree->getNodeParam( $token, 'rpn-expr' );
+            ( $ret_val, $ret_time ) =
+                $self->read_RPN( $config_tree, $token, $expr,
+                                 $t_end, $t_start );
+
+        }
+        else
+        {
+            my $path = $config_tree->path( $token );
+            Error("$path: leaf-type $leaf_type is not supported ".
+                  "for data access");
+        }
+    }
+    else
+    {
+        my $path = $config_tree->path( $token );
+        Error("$path: ds-type $ds_type is not supported ".
+              "for data access");
+    }
+    
+    $self->{'cache_read'}{$cachekey} = [ $ret_val, $ret_time ];
+    return ( $ret_val, $ret_time );
+}
+
+
+sub read_RRD_DS
+{
+    my $self = shift;
+    my $filename = shift;
+    my $cf = shift;
+    my $ds = shift;
+    my $t_end = shift;
+    my $t_start = shift;
+
+    my $cachekey = $filename . ':' . $cf .
+        ':' . (defined($t_end)?$t_end:'') .
+        ':' . (defined($t_start)?$t_start:'');
+
+    if( exists( $self->{'cache_RRD'}{$cachekey}{$ds} ) )
+    {
+        return @{$self->{'cache_RRD'}{$cachekey}{$ds}};
+    }
+                                         
+    my $rrdinfo = RRDs::info( $filename );
+    my $ERR = RRDs::error;
+    if( $ERR )
+    {
+        Error("Error during RRD info for $filename: $ERR");
+        return undef;
+
+    }
+    my $step = $rrdinfo->{'step'};
+    my $last_available = $rrdinfo->{'last_update'};
+    $last_available -= $last_available % $step;
+
+    if( not defined $t_end )
+    {
+        $t_end = $last_available;
+    }
+    elsif( index( $t_end, 'LAST' ) >= 0 )
+    {
+        $t_end =~ s/LAST/$last_available/g;
+    }
+
+    if( not defined $t_start )
+    {
+        $t_start = $t_end . '-' . int($step * 3);
+    }
+    elsif( index( $t_start, 'LAST' ) >= 0 )
+    {
+        $t_start =~ s/LAST/$last_available/g;
+    }
+
+    # From here on, f_ prefix means fetch results
+    my( $f_start, $f_step, $f_names, $f_data ) =
+        RRDs::fetch( $filename, $cf, '--start', $t_start, '--end', $t_end );
+    $ERR = RRDs::error;
+    if( $ERR )
+    {
+        Error("Error during RRD fetch for $filename: $ERR");
+        return undef;
+
+    }
+
+    # Memorize the DS names in cache
+    
+    for( my $i = 0; $i < @{$f_names}; $i++ )
+    {
+        $self->{'cache_RRD'}{$cachekey}{$f_names->[$i]} = [];
+    }
+    
+    # Get the last available data and store in cache
+    
+    foreach my $f_line ( @{$f_data} )
+    {
+        for( my $i = 0; $i < @{$f_names}; $i++ )
+        {
+            if( defined $f_line->[$i] )
+            {
+                $self->{'cache_RRD'}{$cachekey}{$f_names->[$i]} =
+                    [ $f_line->[$i], $f_start ];
+            }
+        }
+        $f_start += $f_step;
+    }
+    
+    if( not exists( $self->{'cache_RRD'}{$cachekey}{$ds} ) )
+    {
+        Error("DS name $ds is not found in $filename");
+        return undef;
+    }
+    else
+    {
+        if( scalar( @{$self->{'cache_RRD'}{$cachekey}{$ds}} ) == 0 )
+        {
+            Warn("Value undefined for ",
+                 "DS=$ds, CF=$cf, start=$t_start, end=$t_end in $filename");
+            return undef;
+        }
+        else
+        {
+            return @{$self->{'cache_RRD'}{$cachekey}{$ds}};
+        }
+    }
+}
+
+
+
+# Data access for other CF than defined for the leaf doesn't make much
+# sense. So we ignore the CF in DataAccess and leave it for the
+# sake of Renderer compatibility
+my %cfNames =
+    ( 'AVERAGE' => 1,
+      'MIN'     => 1,
+      'MAX'     => 1,
+      'LAST'    => 1 );
+
+
+sub read_RPN
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $expr = shift;
+    my $t_end = shift;
+    my $t_start = shift;
+
+    my @expr_list = split(',', $expr);
+    my @eval_expr;
+    my $timestamp = $t_end > 0 ? $t_end : time();
+
+    my $rpn = new Torrus::RPN;
+
+    my $callback = sub
+    {
+        my ($noderef, $timeoffset) = @_;
+
+        my $function;
+        if( $noderef =~ s/^(.)\@// )
+        {
+            $function = $1;
+        }
+
+        my $leaf = length($noderef) > 0 ?
+            $config_tree->getRelative($token, $noderef) : $token;
+
+        if( not defined $leaf )
+        {
+            my $path = $config_tree->path($token);
+            Error("Cannot find relative reference $noderef at $path");
+            return undef;
+        }
+
+        my ($rval, $var_tstamp) = $self->read($config_tree,
+                                              $leaf,
+                                              $timeoffset,
+                                              $t_start);
+        if( defined $rval )
+        {
+            if( $var_tstamp == 0 )
+            {
+                Warn("Torrus::DataAccess::read retirned zero timestamp ".
+                     "for $leaf");
+            }
+
+            if( $var_tstamp < $timestamp )
+            {
+                $timestamp = $var_tstamp;
+            }
+        }
+
+        if( defined( $function ) )
+        {
+            if( $function eq 'T' )
+            {
+                return $var_tstamp;
+            }
+            elsif( not $cfNames{$function} )
+            {
+                Error("Function not supported in RPN: $function");
+                return undef;
+            }
+        }
+        return $rval;
+    };
+
+    my $result = $rpn->run( $expr, $callback );
+
+    return ( $result, $timestamp );
+}
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover.pm b/torrus/perllib/Torrus/DevDiscover.pm
new file mode 100644 (file)
index 0000000..b6ee8ee
--- /dev/null
@@ -0,0 +1,1106 @@
+#  Copyright (C) 2002-2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: DevDiscover.pm,v 1.1 2010-12-27 00:03:43 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Core SNMP device discovery module
+
+package Torrus::DevDiscover::DevDetails;
+
+package Torrus::DevDiscover;
+
+use strict;
+use POSIX qw(strftime);
+use Net::SNMP qw(:snmp :asn1);
+use Digest::MD5 qw(md5);
+
+use Torrus::Log;
+
+BEGIN
+{
+    foreach my $mod ( @Torrus::DevDiscover::loadModules )
+    {
+        eval( 'require ' . $mod );
+        die( $@ ) if $@;
+    }
+}
+
+# Custom overlays for templates
+# overlayName ->
+#     'Module::templateName' -> { 'name' => 'templateName',
+#                                 'source' => 'filename.xml' }
+our %templateOverlays;
+
+our @requiredParams =
+    (
+     'snmp-port',
+     'snmp-version',
+     'snmp-timeout',
+     'snmp-retries',
+     'data-dir',
+     'snmp-host'
+     );
+
+our %defaultParams;
+
+$defaultParams{'rrd-hwpredict'} = 'no';
+$defaultParams{'domain-name'} = '';
+$defaultParams{'host-subtree'} = '';
+$defaultParams{'snmp-check-sysuptime'} = 'yes';
+$defaultParams{'show-recursive'} = 'yes';
+$defaultParams{'snmp-ipversion'} = '4';
+$defaultParams{'snmp-transport'} = 'udp';
+
+our @copyParams =
+    ( 'collector-period',
+      'collector-timeoffset',
+      'collector-dispersed-timeoffset',
+      'collector-timeoffset-min',
+      'collector-timeoffset-max',
+      'collector-timeoffset-step',
+      'comment',
+      'domain-name',
+      'monitor-period',
+      'monitor-timeoffset',
+      'nodeid-device',
+      'show-recursive',
+      'snmp-host',
+      'snmp-port',
+      'snmp-localaddr',
+      'snmp-localport',
+      'snmp-ipversion',
+      'snmp-transport',
+      'snmp-community',
+      'snmp-version',
+      'snmp-username',
+      'snmp-authkey',
+      'snmp-authpassword',
+      'snmp-authprotocol',
+      'snmp-privkey',
+      'snmp-privpassword',
+      'snmp-privprotocol',
+      'snmp-timeout',
+      'snmp-retries',
+      'snmp-oids-per-pdu',
+      'snmp-check-sysuptime',
+      'snmp-max-msg-size',
+      'system-id' );
+
+
+%Torrus::DevDiscover::oiddef =
+    (
+     'system'         => '1.3.6.1.2.1.1',
+     'sysDescr'       => '1.3.6.1.2.1.1.1.0',
+     'sysObjectID'    => '1.3.6.1.2.1.1.2.0',
+     'sysUpTime'      => '1.3.6.1.2.1.1.3.0',
+     'sysContact'     => '1.3.6.1.2.1.1.4.0',
+     'sysName'        => '1.3.6.1.2.1.1.5.0',
+     'sysLocation'    => '1.3.6.1.2.1.1.6.0'
+     );
+
+my @systemOIDs = ('sysDescr', 'sysObjectID', 'sysUpTime', 'sysContact',
+                  'sysName', 'sysLocation');
+
+sub new
+{
+    my $self = {};
+    my $class = shift;
+    my %options = @_;
+    bless $self, $class;
+
+    $self->{'oiddef'} = {};
+    $self->{'oidrev'} = {};
+
+    # Combine all %MODULE::oiddef hashes into one
+    foreach my $module ( 'Torrus::DevDiscover',
+                         @Torrus::DevDiscover::loadModules )
+    {
+        while( my($name, $oid) = each %{eval('\%'.$module.'::oiddef')} )
+        {
+            die( $@ ) if $@;
+            $self->{'oiddef'}->{$name} = $oid;
+            $self->{'oidrev'}->{$oid} = $name;
+        }
+    }
+
+    $self->{'datadirs'} = {};
+    $self->{'globalData'} = {};
+
+    return $self;
+}
+
+
+
+sub globalData
+{
+    my $self = shift;
+    return $self->{'globalData'};
+}
+
+
+sub discover
+{
+    my $self = shift;
+    my @paramhashes = @_;
+
+    my $devdetails = new Torrus::DevDiscover::DevDetails();
+
+    foreach my $params ( \%defaultParams, @paramhashes )
+    {
+        $devdetails->setParams( $params );
+    }
+
+    foreach my $param ( @requiredParams )
+    {
+        if( not defined( $devdetails->param( $param ) ) )
+        {
+            Error('Required parameter not defined: ' . $param);
+            return 0;
+        }
+    }
+
+    my %snmpargs;
+    my $community;
+    
+    my $version = $devdetails->param( 'snmp-version' );
+    $snmpargs{'-version'} = $version;    
+
+    foreach my $arg ( qw(-port -localaddr -localport -timeout -retries) )
+    {
+        if( defined( $devdetails->param( 'snmp' . $arg ) ) )
+        {
+            $snmpargs{$arg} = $devdetails->param( 'snmp' . $arg );
+        }
+    }
+    
+    $snmpargs{'-domain'} = $devdetails->param('snmp-transport') . '/ipv' .
+        $devdetails->param('snmp-ipversion');
+
+    if( $version eq '1' or $version eq '2c' )
+    {
+        $community = $devdetails->param( 'snmp-community' );
+        if( not defined( $community ) )
+        {
+            Error('Required parameter not defined: snmp-community');
+            return 0;
+        }
+        $snmpargs{'-community'} = $community;
+
+        # set maxMsgSize to a maximum value for better compatibility
+        
+        my $maxmsgsize = $devdetails->param('snmp-max-msg-size');
+        if( defined( $maxmsgsize ) )
+        {
+            $devdetails->setParam('snmp-max-msg-size', $maxmsgsize);
+            $snmpargs{'-maxmsgsize'} = $maxmsgsize;
+        }        
+    }
+    elsif( $version eq '3' )        
+    {
+        foreach my $arg ( qw(-username -authkey -authpassword -authprotocol
+                             -privkey -privpassword -privprotocol) )
+        {
+            if( defined $devdetails->param( 'snmp' . $arg ) )
+            {
+                $snmpargs{$arg} = $devdetails->param( 'snmp' . $arg );
+            }
+        }
+        $community = $snmpargs{'-username'};
+        if( not defined( $community ) )
+        {
+            Error('Required parameter not defined: snmp-user');
+            return 0;
+        }        
+    }
+    else
+    {
+        Error('Illegal value for snmp-version parameter: ' . $version);
+        return 0;
+    }
+
+    my $hostname = $devdetails->param('snmp-host');
+    my $domain = $devdetails->param('domain-name');
+
+    if( $domain and index($hostname, '.') < 0 and index($hostname, ':') < 0 )
+    {
+         $hostname .= '.' . $domain;
+    }
+    $snmpargs{'-hostname'} = $hostname;
+
+    my $port = $snmpargs{'-port'};
+    Debug('Discovering host: ' . $hostname . ':' . $port . ':' . $community);
+
+    my ($session, $error) =
+        Net::SNMP->session( %snmpargs,
+                            -nonblocking => 0,
+                            -translate   => ['-all', 0, '-octetstring', 1] );
+    if( not defined($session) )
+    {
+        Error('Cannot create SNMP session: ' . $error);
+        return undef;
+    }
+    
+    my @oids = ();
+    foreach my $var ( @systemOIDs )
+    {
+        push( @oids, $self->oiddef( $var ) );
+    }
+
+    # This is the only checking if the remote agent is alive
+
+    my $result = $session->get_request( -varbindlist => \@oids );
+    if( defined $result )
+    {
+        $devdetails->storeSnmpVars( $result );
+    }
+    else
+    {
+        # When the remote agent is reacheable, but system objecs are
+        # not implemented, we get a positive error_status
+        if( $session->error_status() == 0 )
+        {
+            Error("Unable to communicate with SNMP agent on " . $hostname .
+                  ':' . $port . ':' . $community . " - " . $session->error());
+            return undef;
+        }
+    }
+
+    my $data = $devdetails->data();
+    $data->{'param'} = {};
+
+    $data->{'templates'} = [];
+    my $customTmpl = $devdetails->param('custom-host-templates');
+    if( length( $customTmpl ) > 0 )
+    {
+        push( @{$data->{'templates'}}, split( /\s*,\s*/, $customTmpl ) );
+    }
+    
+    # Build host-level legend
+    my %legendValues =
+        (
+         10 => {
+             'name'  => 'Location',
+             'value' => $devdetails->snmpVar($self->oiddef('sysLocation'))
+             },
+         20 => {
+             'name'  => 'Contact',
+             'value' => $devdetails->snmpVar($self->oiddef('sysContact'))
+             },
+         30 => {
+             'name'  => 'System ID',
+             'value' => $devdetails->param('system-id')
+             },
+         50 => {
+             'name'  => 'Description',
+             'value' => $devdetails->snmpVar($self->oiddef('sysDescr'))
+             }
+         );
+
+    if( defined( $devdetails->snmpVar($self->oiddef('sysUpTime')) ) )
+    {
+        $legendValues{40}{'name'} = 'Uptime';
+        $legendValues{40}{'value'} =
+            sprintf("%d days since %s",
+                    $devdetails->snmpVar($self->oiddef('sysUpTime')) /
+                    (100*3600*24),
+                    strftime($Torrus::DevDiscover::timeFormat,
+                             localtime(time())));
+    }
+     
+    my $legend = '';
+    foreach my $key ( sort keys %legendValues )
+    {
+        my $text = $legendValues{$key}{'value'};
+        if( length( $text ) > 0 )
+        {
+            $text = $devdetails->screenSpecialChars( $text );
+            $legend .= $legendValues{$key}{'name'} . ':' . $text . ';';
+        }
+    }
+    
+    if( $devdetails->param('suppress-legend') ne 'yes' )
+    {
+        $data->{'param'}{'legend'} = $legend;
+    }
+
+    # some parameters need just one-to-one copying
+
+    my @hostCopyParams =
+        split('\s*,\s*', $devdetails->param('host-copy-params'));
+    
+    foreach my $param ( @copyParams, @hostCopyParams )
+    {
+        my $val = $devdetails->param( $param );
+        if( length( $val ) > 0 )
+        {
+            $data->{'param'}{$param} = $val;
+        }
+    }
+
+    # If snmp-host is ipv6 address, system-id needs to be adapted to
+    # remove colons
+    
+    if( not defined( $data->{'param'}{'system-id'} ) and
+        index($data->{'param'}{'snmp-host'}, ':') >= 0 )
+    {
+        my $systemid = $data->{'param'}{'snmp-host'};
+        $systemid =~ s/:/_/g;
+        $data->{'param'}{'system-id'} = $systemid;
+    }
+
+    if( not defined( $devdetails->snmpVar($self->oiddef('sysUpTime')) ) )
+    {
+        Debug('Agent does not support sysUpTime');
+        $data->{'param'}{'snmp-check-sysuptime'} = 'no';
+    }
+
+    $data->{'param'}{'data-dir'} =
+        $self->genDataDir( $devdetails->param('data-dir'), $hostname );
+
+    # Register the directory for listDataDirs()
+    $self->{'datadirs'}{$devdetails->param('data-dir')} = 1;
+
+    $self->{'session'} = $session;
+
+    # some discovery modules need to be disabled on per-device basis
+
+    my %onlyDevtypes;
+    my $useOnlyDevtypes = 0;
+    foreach my $devtype ( split('\s*,\s*',
+                                $devdetails->param('only-devtypes') ) )
+    {
+        $onlyDevtypes{$devtype} = 1;
+        $useOnlyDevtypes = 1;
+    }
+
+    my %disabledDevtypes;
+    foreach my $devtype ( split('\s*,\s*',
+                                $devdetails->param('disable-devtypes') ) )
+    {
+        $disabledDevtypes{$devtype} = 1;
+    }
+
+    # 'checkdevtype' procedures for each known device type return true
+    # when it's their device. They also research the device capabilities.
+    my $reg = \%Torrus::DevDiscover::registry;
+    foreach my $devtype
+        ( sort {$reg->{$a}{'sequence'} <=> $reg->{$b}{'sequence'}}
+          keys %{$reg} )
+    {
+        if( ( not $useOnlyDevtypes or $onlyDevtypes{$devtype} ) and
+            not $disabledDevtypes{$devtype} and
+            &{$reg->{$devtype}{'checkdevtype'}}($self, $devdetails) )
+        {
+            $devdetails->setDevType( $devtype );
+            Debug('Found device type: ' . $devtype);
+        }
+    }
+
+    my @devtypes = sort {
+        $reg->{$a}{'sequence'} <=> $reg->{$b}{'sequence'}
+    } $devdetails->getDevTypes();
+    $data->{'param'}{'devdiscover-devtypes'} = join(',', @devtypes);
+
+    $data->{'param'}{'devdiscover-nodetype'} = '::device';
+
+    # Do the detailed discovery and prepare data
+    my $ok = 1;
+    foreach my $devtype ( @devtypes )
+    {
+        $ok = &{$reg->{$devtype}{'discover'}}($self, $devdetails) ? $ok:0;
+    }
+
+    delete $self->{'session'};
+    $session->close();
+
+    $devdetails->applySelectors();
+        
+    my $subtree = $devdetails->param('host-subtree');
+    if( not defined( $self->{'devdetails'}{$subtree} ) )
+    {
+        $self->{'devdetails'}{$subtree} = [];
+    }
+    push( @{$self->{'devdetails'}{$subtree}}, $devdetails );
+
+    my $define_tokensets = $devdetails->param('define-tokensets');
+    if( defined( $define_tokensets ) and length( $define_tokensets ) > 0 )
+    {
+        foreach my $pair ( split(/\s*;\s*/, $define_tokensets ) )
+        {
+            my( $tset, $description ) = split( /\s*:\s*/, $pair );
+            if( $tset !~ /^[a-z][a-z0-9-_]*$/ )
+            {
+                Error('Invalid name for tokenset: ' . $tset);
+                $ok = 0;
+            }
+            elsif( length( $description ) == 0 )
+            {
+                Error('Missing description for tokenset: ' . $tset);
+                $ok = 0;
+            }
+            else
+            {
+                $self->{'define-tokensets'}{$tset} = $description;
+            }
+        }
+    }
+    return $ok;
+}
+
+
+sub buildConfig
+{
+    my $self = shift;
+    my $cb = shift;
+
+    my $reg = \%Torrus::DevDiscover::registry;
+        
+    foreach my $subtree ( sort keys %{$self->{'devdetails'}} )
+    {
+        # Chop the first and last slashes
+        my $path = $subtree;
+        $path =~ s/^\///;
+        $path =~ s/\/$//;
+
+        # generate subtree path XML
+        my $subtreeNode = undef;
+        foreach my $subtreeName ( split( '/', $path ) )
+        {
+            $subtreeNode = $cb->addSubtree( $subtreeNode, $subtreeName );
+        }
+
+        foreach my $devdetails
+            ( sort {$a->param('snmp-host') cmp $b->param('snmp-host')}
+              @{$self->{'devdetails'}{$subtree}} )
+        {
+
+            my $data = $devdetails->data();
+
+            my @registryOverlays = ();
+            if( defined( $devdetails->param('template-registry-overlays' ) ) )
+            {
+                my @overlayNames = 
+                    split(/\s*,\s*/,
+                          $devdetails->param('template-registry-overlays' ));
+                foreach my $overlayName ( @overlayNames )
+                {
+                    if( defined( $templateOverlays{$overlayName}) )
+                    {
+                        push( @registryOverlays,
+                              $templateOverlays{$overlayName} );
+                    }
+                    else
+                    {
+                        Error('Cannot find the template overlay named ' .
+                              $overlayName);
+                    }
+                }
+            }
+
+            # we should call this anyway, in order to flush the overlays
+            # set by previous host
+            $cb->setRegistryOverlays( @registryOverlays );            
+            
+            if( $devdetails->param('disable-snmpcollector' ) eq 'yes' )
+            {
+                push( @{$data->{'templates'}}, '::viewonly-defaults' );
+            }
+            else
+            {
+                push( @{$data->{'templates'}}, '::snmp-defaults' );
+            }
+
+            if( $devdetails->param('rrd-hwpredict' ) eq 'yes' )
+            {
+                push( @{$data->{'templates'}}, '::holt-winters-defaults' );
+            }
+
+            
+            my $devNodeName = $devdetails->param('symbolic-name');
+            if( length( $devNodeName ) == 0 )
+            {
+                $devNodeName = $devdetails->param('system-id');
+                if( length( $devNodeName ) == 0 )
+                {
+                    $devNodeName = $devdetails->param('snmp-host');
+                }
+            }                
+                
+            my $devNode = $cb->addSubtree( $subtreeNode, $devNodeName,
+                                           $data->{'param'},
+                                           $data->{'templates'} );
+
+            my $aliases = $devdetails->param('host-aliases');
+            if( length( $aliases ) > 0 )
+            {
+                foreach my $alias ( split( '\s*,\s*', $aliases ) )
+                {
+                    $cb->addAlias( $devNode, $alias );
+                }
+            }
+
+            my $includeFiles = $devdetails->param('include-files');
+            if( length( $includeFiles ) > 0 )
+            {
+                foreach my $file ( split( '\s*,\s*', $includeFiles ) )
+                {
+                    $cb->addFileInclusion( $file );
+                }
+            }
+                    
+
+            # Let the device type-specific modules add children
+            # to the subtree
+            foreach my $devtype
+                ( sort {$reg->{$a}{'sequence'} <=> $reg->{$b}{'sequence'}}
+                  $devdetails->getDevTypes() )
+            {
+                &{$reg->{$devtype}{'buildConfig'}}
+                ( $devdetails, $cb, $devNode, $self->{'globalData'} );
+            }
+
+            $cb->{'statistics'}{'hosts'}++;
+        }
+    }
+
+    foreach my $devtype
+        ( sort {$reg->{$a}{'sequence'} <=> $reg->{$b}{'sequence'}}
+          keys %{$reg} )
+    {
+        if( defined( $reg->{$devtype}{'buildGlobalConfig'} ) )
+        {
+            &{$reg->{$devtype}{'buildGlobalConfig'}}($cb,
+                                                     $self->{'globalData'});
+        }
+    }
+    
+    if( defined( $self->{'define-tokensets'} ) )
+    {
+        my $tsetsNode = $cb->startTokensets();
+        foreach my $tset ( sort keys %{$self->{'define-tokensets'}} )
+        {
+            $cb->addTokenset( $tsetsNode, $tset, {
+                'comment' => $self->{'define-tokensets'}{$tset} } );
+        }
+    }
+}
+
+
+
+sub session
+{
+    my $self = shift;
+    return $self->{'session'};
+}
+
+sub oiddef
+{
+    my $self = shift;
+    my $var = shift;
+
+    my $ret = $self->{'oiddef'}->{$var};
+    if( not $ret )
+    {
+        Error('Undefined OID definition: ' . $var);
+    }
+    return $ret;
+}
+
+
+sub oidref
+{
+    my $self = shift;
+    my $oid = shift;
+    return $self->{'oidref'}->{$oid};
+}
+
+
+sub genDataDir
+{
+    my $self = shift;
+    my $basedir = shift;
+    my $hostname = shift;
+
+    if( $Torrus::DevDiscover::hashDataDirEnabled )
+    {
+        return $basedir . '/' .
+            sprintf( $Torrus::DevDiscover::hashDataDirFormat,
+                     unpack('N', md5($hostname)) %
+                     $Torrus::DevDiscover::hashDataDirBucketSize );
+    }
+    else
+    {
+        return $basedir;
+    }
+}
+
+
+sub listDataDirs
+{
+    my $self = shift;
+
+    my @basedirs = keys %{$self->{'datadirs'}};
+    my @ret = @basedirs;
+
+    if( $Torrus::DevDiscover::hashDataDirEnabled )
+    {
+        foreach my $basedir ( @basedirs )
+        {
+            for( my $i = 0;
+                 $i < $Torrus::DevDiscover::hashDataDirBucketSize;
+                 $i++ )
+            {
+                push( @ret, $basedir . '/' .
+                      sprintf( $Torrus::DevDiscover::hashDataDirFormat, $i ) );
+            }
+        }
+    }
+    return @ret;
+}
+
+##
+# Check if SNMP table is present, without retrieving the whole table
+
+sub checkSnmpTable
+{
+    my $self = shift;
+    my $oidname = shift;
+
+    my $session = $self->session();
+    my $oid = $self->oiddef( $oidname );
+
+    my $result = $session->get_next_request( -varbindlist => [ $oid ] );
+    if( defined( $result ) )
+    {
+        # check if the returned oid shares the base of the query
+        my $firstOid = (keys %{$result})[0];
+        if( Net::SNMP::oid_base_match( $oid, $firstOid ) and
+            length( $result->{$firstOid} ) > 0 )
+        {
+            return 1;
+        }
+    }
+    return 0;
+}
+
+
+##
+# Check if given OID is present
+
+sub checkSnmpOID
+{
+    my $self = shift;
+    my $oidname = shift;
+
+    my $session = $self->session();
+    my $oid = $self->oiddef( $oidname );
+
+    my $result = $session->get_request( -varbindlist => [ $oid ] );
+    if( $session->error_status() == 0 and
+        defined($result) and
+        defined($result->{$oid}) and
+        length($result->{$oid}) > 0 )
+    {
+        return 1;
+    }
+    return 0;
+}
+
+
+##
+# retrieve the given OIDs by names and return hash with values
+
+sub retrieveSnmpOIDs
+{
+    my $self = shift;
+    my @oidnames = @_;
+
+    my $session = $self->session();
+    my $oids = [];
+    foreach my $oidname ( @oidnames )
+    {
+        push( @{$oids}, $self->oiddef( $oidname ) );
+    }                   
+
+    my $result = $session->get_request( -varbindlist => $oids );
+    if( $session->error_status() == 0 and defined( $result ) )
+    {
+        my $ret = {};
+        foreach my $oidname ( @oidnames )
+        {
+            $ret->{$oidname} = $result->{$self->oiddef( $oidname )};
+        }
+        return $ret;
+    }
+    return undef;
+}
+
+##
+# Simple wrapper for Net::SNMP::oid_base_match
+
+sub oidBaseMatch
+{
+    my $self = shift;
+    my $base_oid = shift;
+    my $oid = shift;
+
+    if( $base_oid =~ /^\D/ )
+    {
+        $base_oid = $self->oiddef( $base_oid );
+    }
+    return Net::SNMP::oid_base_match( $base_oid, $oid );
+}
+
+##
+# some discovery modules need to adjust max-msg-size
+
+sub setMaxMsgSize
+{
+    my $self = shift;
+    my $devdetails = shift;
+    my $msgsize = shift;
+    my $opt = shift;
+
+    $opt = {} unless defined($opt);
+
+    if( (not $opt->{'only_v1_and_v2'}) or $self->session()->version() != 3 )
+    {
+        $self->session()->max_msg_size($msgsize);
+        $devdetails->data()->{'param'}{'snmp-max-msg-size'} = $msgsize;
+    }
+}
+
+    
+
+
+###########################################################################
+####  Torrus::DevDiscover::DevDetails: the information container for a device
+####
+
+package Torrus::DevDiscover::DevDetails;
+
+use strict;
+use Torrus::RPN;
+use Torrus::Log;
+
+sub new
+{
+    my $self = {};
+    my $class = shift;
+    bless $self, $class;
+
+    $self->{'params'}   = {};
+    $self->{'snmpvars'} = {}; # SNMP results stored here
+    $self->{'devtype'}  = {}; # Device types
+    $self->{'caps'}     = {}; # Device capabilities
+    $self->{'data'}     = {}; # Discovery data
+
+    return $self;
+}
+
+
+sub setParams
+{
+    my $self = shift;
+    my $params = shift;
+
+    while( my ($param, $value) = each %{$params} )
+    {
+        $self->{'params'}->{$param} = $value;
+    }
+}
+
+
+sub setParam
+{
+    my $self = shift;
+    my $param = shift;
+    my $value = shift;
+
+    $self->{'params'}->{$param} = $value;
+}
+
+
+sub param
+{
+    my $self = shift;
+    my $name = shift;
+    return $self->{'params'}->{$name};
+}
+
+
+##
+# store the query results for later use
+
+sub storeSnmpVars
+{
+    my $self = shift;
+    my $vars = shift;
+
+    while( my( $oid, $value ) = each %{$vars} )
+    {
+        if( $oid !~ /^\d[0-9.]+\d$/o )
+        {
+            Error("Invalid OID syntax: '$oid'");
+        }
+        else
+        {
+            $self->{'snmpvars'}{$oid} = $value;
+            
+            while( length( $oid ) > 0 )
+            {
+                $oid =~ s/\d+$//o;
+                $oid =~ s/\.$//o;
+                if( not exists( $self->{'snmpvars'}{$oid} ) )
+                {
+                    $self->{'snmpvars'}{$oid} = undef;
+                }
+            }
+        }
+    }
+
+    # Clean the cache of sorted OIDs
+    $self->{'sortedoids'} = undef;
+}
+
+##
+# check if the stored query results have such OID prefix
+
+sub hasOID
+{
+    my $self = shift;
+    my $oid = shift;
+
+    my $found = 0;
+    if( exists( $self->{'snmpvars'}{$oid} ) )
+    {
+        $found = 1;
+    }
+    return $found;
+}
+
+##
+# get the value of stored SNMP variable
+
+sub snmpVar
+{
+    my $self = shift;
+    my $oid = shift;
+    return $self->{'snmpvars'}{$oid};
+}
+
+##
+# get the list of table indices for the specified prefix
+
+sub getSnmpIndices
+{
+    my $self = shift;
+    my $prefix = shift;
+
+    # Remember the sorted OIDs, as sorting is quite expensive for large
+    # arrays.
+    
+    if( not defined( $self->{'sortedoids'} ) )
+    {
+        $self->{'sortedoids'} = [];
+        push( @{$self->{'sortedoids'}},
+              Net::SNMP::oid_lex_sort( keys %{$self->{'snmpvars'}} ) );
+    }
+        
+    my @ret;
+    my $prefixLen = length( $prefix ) + 1;
+    my $matched = 0;
+
+    foreach my $oid ( @{$self->{'sortedoids'}} )
+    {
+        if( defined($self->{'snmpvars'}{$oid} ) )
+        {
+            if( Net::SNMP::oid_base_match( $prefix, $oid ) )
+            {
+                # Extract the index from OID
+                my $index = substr( $oid, $prefixLen );
+                push( @ret, $index );
+                $matched = 1;
+            }
+            elsif( $matched )
+            {
+                last;
+            }
+        }
+    }
+    return @ret;
+}
+
+
+##
+# device type is the registered discovery module name
+
+sub setDevType
+{
+    my $self = shift;
+    my $type = shift;
+    $self->{'devtype'}{$type} = 1;
+}
+
+sub isDevType
+{
+    my $self = shift;
+    my $type = shift;
+    return $self->{'devtype'}{$type};
+}
+
+sub getDevTypes
+{
+    my $self = shift;
+    return keys %{$self->{'devtype'}};
+}
+
+##
+# device capabilities. Each discovery module may define its own set of
+# capabilities and use them for information exchange between checkdevtype(),
+# discover(), and buildConfig() of its own and dependant modules
+
+sub setCap
+{
+    my $self = shift;
+    my $cap = shift;
+    Debug('Device capability: ' . $cap);
+    $self->{'caps'}{$cap} = 1;
+}
+
+sub hasCap
+{
+    my $self = shift;
+    my $cap = shift;
+    return $self->{'caps'}{$cap};
+}
+
+sub clearCap
+{
+    my $self = shift;
+    my $cap = shift;
+    Debug('Clearing device capability: ' . $cap);
+    if( exists( $self->{'caps'}{$cap} ) )
+    {
+        delete $self->{'caps'}{$cap};
+    }
+}
+
+
+
+sub data
+{
+    my $self = shift;
+    return $self->{'data'};
+}
+
+
+sub screenSpecialChars
+{
+    my $self = shift;
+    my $txt = shift;
+
+    $txt =~ s/:/{COLON}/gm;
+    $txt =~ s/;/{SEMICOL}/gm;
+    $txt =~ s/%/{PERCENT}/gm;
+
+    return $txt;
+}
+
+
+sub applySelectors
+{
+    my $self = shift;
+
+    my $selList = $self->param('selectors');
+    return if not defined( $selList );
+
+    my $reg = \%Torrus::DevDiscover::selectorsRegistry;
+    
+    foreach my $sel ( split('\s*,\s*', $selList) )
+    {
+        my $type = $self->param( $sel . '-selector-type' );
+        if( not defined( $type ) )
+        {
+            Error('Parameter ' . $sel . '-selector-type must be defined ' .
+                  'for ' . $self->param('snmp-host'));
+        }
+        elsif( not exists( $reg->{$type} ) )
+        {
+            Error('Unknown selector type: ' . $type .
+                  ' for ' . $self->param('snmp-host'));
+        }
+        else
+        {
+            Debug('Initializing selector: ' . $sel);
+            
+            my $treg = $reg->{$type};
+            my @objects = &{$treg->{'getObjects'}}( $self, $type );
+
+            foreach my $object ( @objects )
+            {
+                Debug('Checking object: ' .
+                      &{$treg->{'getObjectName'}}( $self, $object, $type ));
+
+                my $expr = $self->param( $sel . '-selector-expr' );
+                $expr = '1' if length( $expr ) == 0;
+
+                my $callback = sub
+                {
+                    my $attr = shift;
+                    my $checkval = $self->param( $sel . '-' . $attr );
+                    
+                    Debug('Checking attribute: ' . $attr .
+                          ' and value: ' . $checkval);
+                    my $ret = &{$treg->{'checkAttribute'}}( $self,
+                                                            $object, $type,
+                                                            $attr, $checkval );
+                    Debug(sprintf('Returned value: %d', $ret));
+                    return $ret;                    
+                };
+                
+                my $rpn = new Torrus::RPN;
+                my $result = $rpn->run( $expr, $callback );
+                Debug('Selector result: ' . $result);
+                if( $result )
+                {
+                    my $actions = $self->param( $sel . '-selector-actions' );
+                    foreach my $action ( split('\s*,\s*', $actions) )
+                    {
+                        my $arg =
+                            $self->param( $sel . '-' . $action . '-arg' );
+                        $arg = 1 if not defined( $arg );
+                        
+                        Debug('Applying action: ' . $action .
+                              ' with argument: ' . $arg);
+                        &{$treg->{'applyAction'}}( $self, $object, $type,
+                                                   $action, $arg );
+                    }
+                }
+            }
+        }
+    }
+}    
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/ALU_Timetra.pm b/torrus/perllib/Torrus/DevDiscover/ALU_Timetra.pm
new file mode 100644 (file)
index 0000000..d1bba75
--- /dev/null
@@ -0,0 +1,567 @@
+#
+#  Discovery module for Alcatel-Lucent ESS and SR routers
+#
+#  Copyright (C) 2009 Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: ALU_Timetra.pm,v 1.1 2010-12-27 00:03:49 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+# Currently tested with following Alcatel-Lucent devices:
+#  * ESS 7450
+
+
+package Torrus::DevDiscover::ALU_Timetra;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'ALU_Timetra'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+
+our %oiddef =
+    (
+     # TIMETRA-CHASSIS-MIB
+     'tmnxChassisTotalNumber'     => '1.3.6.1.4.1.6527.3.1.2.2.1.1.0',
+     
+     # TIMETRA-GLOBAL-MIB
+     'timetraReg'                 => '1.3.6.1.4.1.6527.1',
+     'timetraServiceRouters'      => '1.3.6.1.4.1.6527.1.3',
+     'timetraServiceSwitches'     => '1.3.6.1.4.1.6527.1.6',
+     'alcatel7710ServiceRouters'  => '1.3.6.1.4.1.6527.1.9',
+
+     # TIMETRA-SERV-MIB
+     'custDescription'  => '1.3.6.1.4.1.6527.3.1.2.4.1.3.1.3',
+     'svcCustId'        => '1.3.6.1.4.1.6527.3.1.2.4.2.2.1.4',
+     'svcDescription'   => '1.3.6.1.4.1.6527.3.1.2.4.2.2.1.6',
+     'sapDescription'   => '1.3.6.1.4.1.6527.3.1.2.4.3.2.1.5',
+
+     # TIMETRA-PORT-MIB (chassis ID hardcoded to 1)
+     'tmnxPortDescription' => '1.3.6.1.4.1.6527.3.1.2.2.4.2.1.5.1',
+     'tmnxPortEncapType'   => '1.3.6.1.4.1.6527.3.1.2.2.4.2.1.12.1',     
+     );
+
+
+my %essInterfaceFilter =
+    (
+     'system'  => {
+         'ifType'  => 24,                     # softwareLoopback
+         'ifName' => '^system'
+         },
+     );
+
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $objectID = $devdetails->snmpVar( $dd->oiddef('sysObjectID') );
+    
+    if( $dd->oidBaseMatch( 'timetraReg', $objectID ) )
+    {
+        my $session = $dd->session();
+        my $oid = $dd->oiddef('tmnxChassisTotalNumber');
+        my $result = $session->get_request( $oid );
+        if( $result->{$oid} != 1 )
+        {
+            Error('Multi-chassis ALU 7x50 equipment is not yet supported');
+            return 0;
+        }
+            
+        if( $dd->oidBaseMatch( 'timetraServiceSwitches', $objectID ) )
+        {
+            $devdetails->setCap('ALU_ESS7450');
+            
+            $devdetails->setCap('interfaceIndexingManaged');
+            $devdetails->setCap('interfaceIndexingPersistent');
+            
+            &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+                ($devdetails, \%essInterfaceFilter);
+
+            $dd->setMaxMsgSize($devdetails, 65535, {'only_v1_and_v2' => 1});
+            
+            return 1;
+        }
+        else
+        {
+            # placeholder for future developments
+            Error('This model of Alcatel-Lucent equipment ' .
+                  'is not yet supported');
+            return 0;
+        }
+    }
+    
+    return 0;
+}
+
+
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    # WARNING: This code is tested only with ESS7450
+
+    # Get port descriptions
+    {
+        my $oid = $dd->oiddef('tmnxPortDescription');
+        
+        my $portDescrTable = $session->get_table( -baseoid => $oid );        
+        my $prefixLen = length( $oid ) + 1;
+
+        while( my( $oid, $descr ) = each %{$portDescrTable} )
+        {
+            my $ifIndex = substr( $oid, $prefixLen );
+            if( defined( $data->{'interfaces'}{$ifIndex} ) )
+            {
+                $data->{'interfaces'}{$ifIndex}{'tmnxPortDescription'} =
+                    $descr;
+            }
+        }
+    }
+    
+    # Amend RFC2863_IF_MIB references
+    $data->{'nameref'}{'ifSubtreeName'}    = 'ifNameT';
+    $data->{'nameref'}{'ifReferenceName'}  = 'ifName';
+    $data->{'nameref'}{'ifNick'} = 'ifNameT';
+    $data->{'nameref'}{'ifComment'} = 'tmnxPortDescription';
+    
+    # Get customers
+    {
+        my $oid = $dd->oiddef('custDescription');
+        my $custDescrTable = $session->get_table( -baseoid => $oid );        
+        my $prefixLen = length( $oid ) + 1;
+        
+        while( my( $oid, $descr ) = each %{$custDescrTable} )
+        {
+            my $custId = substr( $oid, $prefixLen );
+            $data->{'timetraCustDescr'}{$custId} = $descr;
+        }
+    }
+        
+    
+    # Get Service Descriptions
+    {
+        my $oid = $dd->oiddef('svcDescription');
+        my $svcDescrTable = $session->get_table( -baseoid => $oid );        
+        my $prefixLen = length( $oid ) + 1;
+
+        while( my( $oid, $descr ) = each %{$svcDescrTable} )
+        {
+            my $svcId = substr( $oid, $prefixLen );
+            $data->{'timetraSvc'}{$svcId} = {
+                'description' => $descr,
+                'sap' => [],
+            };
+        }
+    }
+
+    # Get mapping of Services to Customers
+    {
+        my $oid = $dd->oiddef('svcCustId');
+        my $svcCustIdTable = $session->get_table( -baseoid => $oid );        
+        my $prefixLen = length( $oid ) + 1;
+        
+        while( my( $oid, $custId ) = each %{$svcCustIdTable} )
+        {
+            my $svcId = substr( $oid, $prefixLen );
+            
+            $data->{'timetraCustSvc'}{$custId}{$svcId} = 1;
+            $data->{'timetraSvcCust'}{$svcId} = $custId;
+        }
+    }
+
+    
+    # Get port encapsulations
+    {
+        my $oid = $dd->oiddef('tmnxPortEncapType');
+        
+        my $portEncapTable = $session->get_table( -baseoid => $oid );        
+        my $prefixLen = length( $oid ) + 1;
+
+        while( my( $oid, $encap ) = each %{$portEncapTable} )
+        {
+            my $ifIndex = substr( $oid, $prefixLen );
+            if( defined( $data->{'interfaces'}{$ifIndex} ) )
+            {
+                $data->{'interfaces'}{$ifIndex}{'tmnxPortEncapType'} = $encap;
+            }
+        }
+    }
+
+    
+    # Get SAP information
+    {
+        my $oid = $dd->oiddef('sapDescription');
+        
+        my $sapDescrTable = $session->get_table( -baseoid => $oid );        
+        my $prefixLen = length( $oid ) + 1;
+
+        while( my( $oid, $descr ) = each %{$sapDescrTable} )
+        {
+            my $sapFullID = substr( $oid, $prefixLen );
+
+            my ($svcId, $ifIndex, $sapEncapValue) =
+                split(/\./o, $sapFullID);
+
+            my $svcSaps = $data->{'timetraSvc'}{$svcId}{'sap'};
+            if( not defined( $svcSaps ) )
+            {
+                Error('Cannot find Service ID ' . $svcId);
+                next;
+            }
+
+            if( not defined( $data->{'interfaces'}{$ifIndex} ) )
+            {
+                Warn('IfIndex ' . $ifIndex . ' is not in interfaces table, ' .
+                     'skipping SAP');
+                next;
+            }
+            
+            my $encap = $data->{'interfaces'}{$ifIndex}{'tmnxPortEncapType'};
+
+            # Compose the SAP name depending on port encapsulation.
+            
+            my $sapName = $data->{'interfaces'}{$ifIndex}{'ifName'};
+
+            if( $encap == 1 )  # nullEncap
+            {
+                # do nothing
+            }
+            elsif( $encap == 2 )  # qEncap
+            {
+                # sapEncapValue is equal to VLAN ID
+                $sapName .= ':' . $sapEncapValue;
+            }
+            elsif( $encap == 10 )  # qinqEncap
+            {
+                # sapEncapValue contains inner and outer VLAN IDs
+                
+                my $outer = $sapEncapValue & 0xffff;
+                my $inner = $sapEncapValue >> 16;
+                if( $inner == 4095 )
+                {
+                    # default SAP
+                    $inner = '*';
+                }
+
+                $sapName .= ':' . $outer . '.' . $inner;
+            }
+            elsif( $encap == 3 ) # mplsEncap
+            {
+                # sapEncapValue contains the 20-bit LSP ID
+                # we should probably do something more here
+                $sapName .= ':' . $sapEncapValue;
+            }
+            else
+            {
+                Warn('Encapsulation type ' . $encap . ' is not supported yet');
+                $sapName .= ':' . $sapEncapValue;
+            }
+
+            $data->{'timetraSap'}{$sapFullID} =  {
+                'description' => $descr,
+                'port' => $ifIndex,
+                'name' => $sapName,
+                'encval' => $sapEncapValue,
+                'svc' => $svcId,
+            };
+
+            push( @{$svcSaps}, $sapFullID );
+        }
+    }
+    
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+
+    if( defined( $data->{'timetraSvc'} ) )
+    {
+        my $customersNode = $cb->addSubtree( $devNode, 'Customers' );
+
+        foreach my $custId (sort {$a <=> $b} keys %{$data->{'timetraCustSvc'}})
+        {
+            # count the number of SAPs
+            my $nSaps = 0;
+            foreach my $svcId ( keys %{$data->{'timetraCustSvc'}{$custId}} )
+            {
+                my $svcSaps = $data->{'timetraSvc'}{$svcId}{'sap'};
+                if( defined( $svcSaps ) )
+                {
+                    foreach my $sapID ( @{$svcSaps} )
+                    {
+                        if( not $data->{'timetraSap'}{$sapID}{'excluded'} )
+                        {               
+                            $nSaps++;
+                        }
+                    }
+                }
+            }
+
+            if( $nSaps == 0 )
+            {
+                next;
+            }
+            
+            my $param = {
+                'precedence' => 100000 - $custId,
+                'comment'    => $data->{'timetraCustDescr'}{$custId},
+                'timetra-customer-id' => $custId,
+            };
+            
+            my $custNode =
+                $cb->addSubtree( $customersNode, $custId, $param,
+                                 ['ALU_Timetra::alu-timetra-customer']);
+            
+            my $precedence = 10000;
+            
+            foreach my $svcId
+                ( keys %{$data->{'timetraCustSvc'}{$custId}} )
+            {
+                my $svcSaps = $data->{'timetraSvc'}{$svcId}{'sap'};
+                
+                if( defined($svcSaps ) )
+                {                    
+                    foreach my $sapID
+                        ( sort {sapCompare($data->{'timetraSap'}{$a},
+                                           $data->{'timetraSap'}{$b})}
+                          @{$svcSaps} )
+                    {
+                        my $sap = $data->{'timetraSap'}{$sapID};
+
+                        if( $sap->{'excluded'} )
+                        {
+                            next;
+                        }
+                        
+                        my $sapDescr = $sap->{'description'};
+                        if( length( $sapDescr ) == 0 )
+                        {
+                            $sapDescr = $data->{'timetraSvc'}{$svcId}->{
+                                'description'};
+                        }
+
+                        my $subtreeName = $sap->{'name'};
+                        $subtreeName =~ s/\W/_/go;
+
+                        my $comment = '';
+                        if( length( $sapDescr ) > 0 )
+                        {
+                            $comment = $sapDescr;
+                        }
+
+                        my $legend = '';                        
+                        
+                        if( length($data->{'timetraCustDescr'}{$custId}) > 0 )
+                        {
+                            $legend .= 'Customer:' .
+                                $devdetails->screenSpecialChars
+                                ( $data->{'timetraCustDescr'}{$custId} ) . ';';
+                        }
+                        
+                        if( length($data->{'timetraSvc'}{$svcId}->{
+                            'description'}) > 0 )
+                        {
+                            $legend .= 'Service:' .
+                                $devdetails->screenSpecialChars
+                                ( $data->{'timetraSvc'}{$svcId}->{
+                                    'description'} ) . ';';
+                        }
+                        
+                        $legend .= 'SAP: ' .
+                            $devdetails->screenSpecialChars( $sap->{'name'} );
+                        
+                        
+                        my $param = {
+                            'comment'          => $comment,
+                            'timetra-sap-id'   => $sapID,
+                            'timetra-sap-name' => $sap->{'name'},
+                            'node-display-name' => $sap->{'name'},
+                            'precedence'       => $precedence--,
+                            'legend'           => $legend,
+                        };
+
+                        $cb->addSubtree( $custNode, $subtreeName, $param,
+                                         ['ALU_Timetra::alu-timetra-sap']);
+                    }
+                }
+            }                            
+        }
+    }    
+}
+
+
+sub sapCompare
+{
+    my $a = shift;
+    my $b = shift;
+
+    if( $a->{'port'} == $b->{'port'} )
+    {
+        return ( $a->{'encval'} <=> $b->{'encval'} );
+    }
+    else
+    {
+        return ( $a->{'port'} <=> $b->{'port'} );
+    }
+}
+      
+
+
+#######################################
+# Selectors interface
+#
+
+
+$Torrus::DevDiscover::selectorsRegistry{'ALU_SAP'} = {
+    'getObjects'      => \&getSelectorObjects,
+    'getObjectName'   => \&getSelectorObjectName,
+    'checkAttribute'  => \&checkSelectorAttribute,
+    'applyAction'     => \&applySelectorAction,
+};
+
+## Objects are full SAP indexes: svcId.sapPortId.sapEncapValue
+
+sub getSelectorObjects
+{
+    my $devdetails = shift;
+    my $objType = shift;
+
+    my $data = $devdetails->data();
+    my @ret = keys %{$data->{'timetraSap'}};
+
+    return( sort {$a<=>$b} @ret );
+}
+
+
+sub checkSelectorAttribute
+{
+    my $devdetails = shift;
+    my $object = shift;
+    my $objType = shift;
+    my $attr = shift;
+    my $checkval = shift;
+
+    my $data = $devdetails->data();
+    
+    my $value;
+    my $operator = '=~';
+    
+    my $sap = $data->{'timetraSap'}{$object};
+    
+    if( $attr eq 'sapDescr' )
+    {
+        $value = $sap->{'description'};
+    }
+    elsif( $attr eq 'custDescr' )
+    {
+        my $svcId = $sap->{'svc'};
+        my $custId = $data->{'timetraSvcCust'}{$svcId};
+        $value = $data->{'timetraCustDescr'}{$custId};
+    }
+    elsif( $attr eq 'sapName' )
+    {
+        $value = $sap->{'name'};
+        $operator = 'eq';
+    }
+    elsif( $attr eq 'sapPort' )
+    {
+        my $ifIndex = $sap->{'port'};
+        $value = $data->{'interfaces'}{$ifIndex}{'ifName'};
+        $operator = 'eq';
+    }    
+    else
+    {
+        Error('Unknown ALU_SAP selector attribute: ' . $attr);
+        $value = '';
+    }        
+        
+    
+    return eval( '$value' . ' ' . $operator . '$checkval' ) ? 1:0;
+}
+
+
+sub getSelectorObjectName
+{
+    my $devdetails = shift;
+    my $object = shift;
+    my $objType = shift;
+    
+    my $data = $devdetails->data();
+
+    return $data->{'timetraSap'}{$object}{'name'};
+}
+
+
+my %knownSelectorActions =
+    (
+     'RemoveSAP' => 1,
+     );
+
+                            
+sub applySelectorAction
+{
+    my $devdetails = shift;
+    my $object = shift;
+    my $objType = shift;
+    my $action = shift;
+    my $arg = shift;
+
+    my $data = $devdetails->data();
+    my $objref;
+    
+    if( not $knownSelectorActions{$action} )
+    {
+        Error('Unknown ALU_SAP selector action: ' . $action);
+        return;
+    }
+
+    if( $action eq 'RemoveSAP' )
+    {
+        $data->{'timetraSap'}{$object}{'excluded'} = 1;
+    }
+}   
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/ATMEL.pm b/torrus/perllib/Torrus/DevDiscover/ATMEL.pm
new file mode 100644 (file)
index 0000000..e45c7eb
--- /dev/null
@@ -0,0 +1,167 @@
+#  Copyright (C) 2004  Scott Brooks
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# Scott Brooks <sbrooks@binary-solutions.net>
+
+# ATMEL based access points/bridges
+
+package Torrus::DevDiscover::ATMEL;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'ATMEL'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # Check to see if we can get the list of running WSS ports
+     'sysDeviceInfo'           => '1.3.6.1.4.1.410.1.1.1.5.0',
+     'bridgeOperationalMode'   => '1.3.6.1.4.1.410.1.1.4.1.0',
+     'operAccessPointName'     => '1.3.6.1.4.1.410.1.2.1.10.0',
+     'bridgeRemoteBridgeBSSID' => '1.3.6.1.4.1.410.1.1.4.2.0'
+     );
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->checkSnmpOID('sysDeviceInfo') )
+    {
+        return 0;
+    }
+       
+    return 1;
+}
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+
+    my $info = $dd->retrieveSnmpOIDs('sysDeviceInfo',
+                                     'operAccessPointName',
+                                     'bridgeOperationalMode',
+                                     'bridgeRemoteBridgeBSSID',
+                                     );
+
+    my $deviceInfo = substr($info->{'sysDeviceInfo'},2);    
+    my $bridgeName = $info->{'operAccessPointName'};
+    
+    #Get rid of all the nulls returned.
+    $bridgeName =~ s/\000//g;
+    
+    $data->{'param'}{'comment'} = $bridgeName;
+
+    my $bridgeMode = $info->{'bridgeOperationalMode'};
+
+    my $remoteMac = substr($info->{'bridgeRemoteBridgeBSSID'},2);
+    
+    $remoteMac =~ s/(\w\w)/$1-/g;
+    $remoteMac = substr($remoteMac,0,-1);
+
+    my $bridge=0;
+
+    my ($version,$macaddr,$reserved,$regdomain,$producttype,$oemname,$oemid,
+        $productname,$hardwarerev) = unpack("LH12SLLA32LA32L",
+                                            pack("H*", $deviceInfo));
+    
+    $macaddr =~ s/(\w\w)/$1-/g;
+    $macaddr = substr($macaddr,0,-1);
+    
+    $data->{'param'}{'comment'} = $bridgeName;
+    
+    if ($productname =~ m/airPoint/)
+    {
+        #we have an access point
+        if ($bridgeMode == 3)
+        {
+            #we have an access point in client bridge mode.
+            $bridge=1;
+        }
+    }
+    else
+    {
+        #we have a bridge
+        $bridge=1;
+    }
+    if (!$bridge)
+    {
+        $devdetails->setCap('ATMEL::accessPoint');
+        my $legend =
+            "AP: " . $bridgeName .";" .
+            "Mac: " . $macaddr.";";
+        $data->{'param'}{'legend'} .= $legend;
+
+    }
+    else
+    {
+        my $legend =
+            "Bridge: " . $bridgeName .";" .
+            "Mac: " . $macaddr.";";
+        $data->{'param'}{'legend'} .= $legend;
+
+        $data->{'param'}{'legend'} .= "AP Mac: " . $remoteMac . ";";
+    }
+    #disable SNMP uptime check
+    $data->{'param'}{'snmp-check-sysuptime'} = 'no';
+    
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    my @templates = ('ATMEL::atmel-device-subtree');
+
+    if( $devdetails->hasCap('ATMEL::accessPoint') )
+    {
+        push (@templates, 'ATMEL::atmel-accesspoint-stats');
+    }
+    else
+    {
+        push (@templates, 'ATMEL::atmel-client-stats');
+    }
+
+    foreach my $tmpl ( @templates )
+    {
+        $cb->addTemplateApplication( $devNode, $tmpl );
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/AlliedTelesyn_PBC18.pm b/torrus/perllib/Torrus/DevDiscover/AlliedTelesyn_PBC18.pm
new file mode 100644 (file)
index 0000000..4da1862
--- /dev/null
@@ -0,0 +1,284 @@
+#  Copyright (C) 2004 Marc Haber
+#  Copyright (C) 2005 Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# $Id: AlliedTelesyn_PBC18.pm,v 1.1 2010-12-27 00:03:49 ivan Exp $
+# Marc Haber <mh+torrus-devel@zugschlus.de>
+# Redesigned by Stanislav Sinyagin
+
+# Allied Telesyn 18-Slot Media Converter Chassis
+
+package Torrus::DevDiscover::AlliedTelesyn_PBC18;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'AlliedTelesyn_PBC18'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     'ATMCCommon-MIB::mediaconverter'    => '1.3.6.1.4.1.207.1.12',
+     'ATMCCommon-MIB::mcModuleName'      => '1.3.6.1.4.1.207.8.41.1.1.1.1.1.2',
+     'ATMCCommon-MIB::mcModuleType'      => '1.3.6.1.4.1.207.8.41.1.1.1.1.1.3',
+     'ATMCCommon-MIB::mcModuleState'     => '1.3.6.1.4.1.207.8.41.1.1.1.1.1.4',
+     'ATMCCommon-MIB::mcModuleAportLinkState' =>
+     '1.3.6.1.4.1.207.8.41.1.1.1.1.1.10',
+     'ATMCCommon-MIB::mcModuleBportLinkState' =>
+     '1.3.6.1.4.1.207.8.41.1.1.1.1.1.11',
+     'ATMCCommon-MIB::mcModuleCportLinkState' =>
+     '1.3.6.1.4.1.207.8.41.1.1.1.1.1.12',
+     'ATMCCommon-MIB::mcModuleDportLinkState' =>
+     '1.3.6.1.4.1.207.8.41.1.1.1.1.1.13',
+     
+     );
+
+
+our %knownModuleTypes =
+    (
+     8 => 'AT-PB103/1 (1x100Base-TX, 1x100Base-FX Single-Mode Fibre SC, 15km)',
+     );
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'ATMCCommon-MIB::mediaconverter',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+    
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+    
+    # Modules table
+
+    my $oid = $dd->oiddef('ATMCCommon-MIB::mcModuleType');
+    
+    my $table = $session->get_table( -baseoid => $oid );    
+    if( not defined( $table ) )
+    {
+        return 0;
+    }
+    
+    $devdetails->storeSnmpVars( $table );
+    
+    foreach my $INDEX ( $devdetails->getSnmpIndices($oid) )
+    {
+        my $moduleType = $devdetails->snmpVar( $oid . '.' . $INDEX );
+        if( $moduleType == 0 )
+        {
+            next;
+        }
+
+        $data->{'PBC18'}{$INDEX} = {};
+        if( defined( $knownModuleTypes{$moduleType} ) )
+        {
+            $data->{'PBC18'}{$INDEX}{'moduleDesc'} =
+                $knownModuleTypes{$moduleType};
+        }
+        else
+        {
+            Warn('Unknown PBC18 module type: ' . $moduleType);
+        }
+    }
+
+    foreach my $INDEX ( keys %{$data->{'PBC18'}} )
+    {
+        my $oids = [];
+        foreach my $oidname ( 'ATMCCommon-MIB::mcModuleName',
+                              'ATMCCommon-MIB::mcModuleState',
+                              'ATMCCommon-MIB::mcModuleAportLinkState',
+                              'ATMCCommon-MIB::mcModuleBportLinkState',
+                              'ATMCCommon-MIB::mcModuleCportLinkState',
+                              'ATMCCommon-MIB::mcModuleDportLinkState' )
+        {
+            push( @{$oids}, $dd->oiddef( $oidname ) . '.' . $INDEX );
+        }
+    
+        my $result = $session->get_request( -varbindlist => $oids );
+        if( $session->error_status() == 0 and defined( $result ) )
+        {
+            $devdetails->storeSnmpVars( $result );
+        }
+        else
+        {
+            Error('Error retrieving PBC18 module information');
+            return 0;
+        }
+    }
+
+    foreach my $INDEX ( keys %{$data->{'PBC18'}} )
+    {
+        if( $devdetails->snmpVar
+            ( $dd->oiddef('ATMCCommon-MIB::mcModuleState') .'.'.$INDEX )
+            != 1 )
+        {
+            delete $data->{'PBC18'}{$INDEX};
+            next;
+        }
+
+        my $name = $devdetails->snmpVar
+            ( $dd->oiddef('ATMCCommon-MIB::mcModuleName') .'.'.$INDEX );
+
+        if( length( $name ) > 0 )
+        {
+            $data->{'PBC18'}{$INDEX}{'moduleName'} = $name;
+        }
+
+        foreach my $portName ('A', 'B', 'C', 'D')
+        {
+            my $oid = $dd->oiddef
+                ('ATMCCommon-MIB::mcModule'.$portName.'portLinkState').
+                '.'.$INDEX;
+            
+            my $portState = $devdetails->snmpVar ( $oid );
+            if( $portState == 1 or $portState == 2 )
+            {
+                $data->{'PBC18'}{$INDEX}{'portAvailable'}{$portName} = $oid;
+            }
+        }        
+    }
+
+    return 1;
+}           
+
+
+our %portLineColors =
+    (
+     'A' => '##green',
+     'B' => '##blue',
+     'C' => '##red',
+     'D' => '##gold'
+     );
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    my $data = $devdetails->data();
+
+    my $param = {
+        'data-file' => '%system-id%_pbc18_%pbc-module-index%.rrd',
+        'collector-scale' => '-1,*,2,+',
+        'graph-lower-limit' => 0,
+        'graph-upper-limit' => 1,
+        'rrd-cf' => 'MAX',
+        'rrd-create-dstype' => 'GAUGE',
+        'rrd-create-rra' =>
+            'RRA:MAX:0:1:4032 RRA:MAX:0.17:6:2016 RRA:MAX:0.042:288:732',
+
+            'has-overview-shortcuts' => 'yes',
+            'overview-shortcuts' => 'links',
+            'overview-subleave-name-links' => 'AllPorts',
+            'overview-shortcut-text-links' => 'All modules',
+            'overview-shortcut-title-links' => 'All converter modules',
+            'overview-page-title-links' => 'All converter modules',            
+        };
+
+    $cb->addParams( $devNode, $param );
+        
+    foreach my $INDEX ( sort {$a<=>$b} keys %{$data->{'PBC18'}} )
+    {
+        my $param = { 'pbc-module-index' => $INDEX };
+        
+        if( defined( $data->{'PBC18'}{$INDEX}{'moduleDesc'} ) )
+        {
+            $param->{'legend'} =
+                'Module type: ' . $data->{'PBC18'}{$INDEX}{'moduleDesc'};
+        }
+
+        if( defined( $data->{'PBC18'}{$INDEX}{'moduleName'} ) )
+        {
+            $param->{'comment'} =
+                $data->{'PBC18'}{$INDEX}{'moduleName'};
+        }
+        
+        my $modNode = $cb->addSubtree( $devNode, 'Module_' . $INDEX, $param );
+
+        my $mgParam = {
+            'ds-type'              => 'rrd-multigraph',
+            'ds-names'             => '',
+            'graph-lower-limit'    => '0',
+            'precedence'           => '1000',
+            'comment'              => 'Ports status',                
+            'vertical-label'       => 'Status',                
+        };
+        
+        my $n = 1;
+        foreach my $portName
+            ( sort keys %{$data->{'PBC18'}{$INDEX}{'portAvailable'}} )
+        {
+            if( $n > 1 )
+            {
+                $mgParam->{'ds-names'} .= ',';
+            }
+
+            my $dsname = 'port' . $portName;
+            $mgParam->{'ds-names'} .= $dsname;
+
+            $mgParam->{'graph-legend-' . $dsname} = 'Port ' . $portName;
+            $mgParam->{'line-style-' . $dsname} = 'LINE2';
+            $mgParam->{'line-color-' . $dsname} = $portLineColors{$portName};
+            $mgParam->{'line-order-' . $dsname} = $n;
+            $mgParam->{'ds-expr-' . $dsname} = '{Port_' . $portName . '}';
+            
+            my $param = {
+                'rrd-ds' => 'Port' . $portName,
+                'snmp-object' =>
+                    $data->{'PBC18'}{$INDEX}{'portAvailable'}{$portName},
+                };
+
+            $cb->addLeaf( $modNode, 'Port_' . $portName, $param );
+            $n++;
+        }
+
+        $cb->addLeaf( $modNode, 'AllPorts', $mgParam );        
+    }
+}
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/Alteon.pm b/torrus/perllib/Torrus/DevDiscover/Alteon.pm
new file mode 100644 (file)
index 0000000..d8ea6ed
--- /dev/null
@@ -0,0 +1,169 @@
+#
+#  Discovery module for Alteon devices
+#
+#  Copyright (C) 2007 Jon Nistor
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Alteon.pm,v 1.1 2010-12-27 00:03:55 ivan Exp $
+# Jon Nistor <nistor at snickers dot org>
+#
+
+
+package Torrus::DevDiscover::Alteon;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'Alteon'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+# pmodule-dependend OIDs are presented for module #1 only.
+# currently devices with more than one module do not exist
+
+our %oiddef =
+    (
+     # ALTEON-PRIVATE-MIBS
+     'alteonOID'                 => '1.3.6.1.4.1.1872.1',
+     'hwPartNumber'              => '1.3.6.1.4.1.1872.2.1.1.1.0',
+     'hwRevision'                => '1.3.6.1.4.1.1872.2.1.1.2.0',
+     'agSoftwareVersion'         => '1.3.6.1.4.1.1872.2.1.2.1.7.0',
+     'agEnabledSwFeatures'       => '1.3.6.1.4.1.1872.2.1.2.1.25.0',
+     'slbCurCfgRealServerName'   => '1.3.6.1.4.1.1872.2.1.5.2.1.12',
+     'slbNewCfgRealServerName'   => '1.3.6.1.4.1.1872.2.1.5.3.1.13',
+     'slbCurCfgGroupName'        => '1.3.6.1.4.1.1872.2.1.5.10.1.7',
+     'slbNewCfgGroupName'        => '1.3.6.1.4.1.1872.2.1.5.11.1.10',
+     'slbStatPortMaintPortIndex' => '1.3.6.1.4.1.1872.2.1.8.2.1.1.1',
+     'slbStatVServerIndex'       => '1.3.6.1.4.1.1872.2.1.8.2.7.1.3',
+     );
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'alteonOID',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+    
+    $devdetails->setCap('interfaceIndexingPersistent');
+
+    return 1;
+}
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    # Get the system info and display it in the comment
+    my $alteonInfo = $dd->retrieveSnmpOIDs
+        ( 'hwPartNumber', 'hwRevision', 'agSoftwareVersion',
+          'agEnabledSwFeatures', 'sysDescr' );
+
+    $data->{'param'}{'comment'} =
+        $alteonInfo->{'sysDescr'} . ", Hw Serial#: " .
+        $alteonInfo->{'hwPartNumber'} . ", Hw Revision: " .
+        $alteonInfo->{'hwRevision'} .  ", " .
+        $alteonInfo->{'agEnabledSwFeatures'} . ", Version: " .
+        $alteonInfo->{'agSoftwareVersion'};
+
+    # PROG: Discover slbStatVServerIndex (Virtual Server index)
+    my $virtTable = $session->get_table ( -baseoid =>
+                                          $dd->oiddef('slbStatVServerIndex') );
+    $devdetails->storeSnmpVars( $virtTable ); 
+    foreach my $virtIndex
+        ( $devdetails->getSnmpIndices( $dd->oiddef('slbStatVServerIndex') ) )
+    {
+        Debug("Alteon::vserver  Found index $virtIndex");
+        $data->{'VSERVER'}{$virtIndex} = 1;
+    }
+
+    # PROG: SLB Port Maintenance Statistics Table
+    my $maintTable =
+        $session->get_table ( -baseoid =>
+                              $dd->oiddef('slbStatPortMaintPortIndex') );
+    $devdetails->storeSnmpVars( $maintTable );
+    
+    foreach my $mIndex
+        ( $devdetails->getSnmpIndices
+          ( $dd->oiddef('slbStatPortMaintPortIndex') ) )
+    {
+        Debug("Alteon::maintTable  Index: $mIndex");
+        $data->{'MAINT'}{$mIndex} = 1;
+    }
+    
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+    $cb->addTemplateApplication($devNode, 'Alteon::alteon-cpu');
+    $cb->addTemplateApplication($devNode, 'Alteon::alteon-mem');
+    $cb->addTemplateApplication($devNode, 'Alteon::alteon-packets');
+    $cb->addTemplateApplication($devNode, 'Alteon::alteon-sensor');
+
+    # PROG: Virtual Server information
+    my $virtNode =
+        $cb->addSubtree( $devNode, 'VirtualServer_Stats',
+                         { 'comment' => 'Stats per Virtual Server' },
+                         [ 'Alteon::alteon-vserver-subtree'] );
+
+    foreach my $virtIndex ( sort {$a <=> $b } keys %{$data->{'VSERVER'}} )
+    {
+        $cb->addSubtree( $virtNode, 'VirtualHost_' . $virtIndex,
+                         { 'alteon-vserver-index' => $virtIndex },
+                         [ 'Alteon::alteon-vserver'] ); 
+    } 
+
+    # PROG: SLB Port Maintenance Statistics Table
+    my $maintNode =
+        $cb->addSubtree( $devNode, 'Port_Maintenance_Stats',
+                         { 'comment' => 'SLB port maintenance statistics' },
+                         [ 'Alteon::alteon-maint-subtree'] );
+    
+    foreach my $mIndex ( sort {$a <=> $b } keys %{$data->{'MAINT'}} )
+    {
+        $cb->addSubtree( $maintNode, 'Port_' . $mIndex,
+                         { 'alteon-maint-index' => $mIndex },
+                         [ 'Alteon::alteon-maint'] ); 
+    }
+
+}
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/Apple_AE.pm b/torrus/perllib/Torrus/DevDiscover/Apple_AE.pm
new file mode 100644 (file)
index 0000000..ab5fe08
--- /dev/null
@@ -0,0 +1,180 @@
+#
+#  Copyright (C) 2007  Jon Nistor
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Apple_AE.pm,v 1.1 2010-12-27 00:03:55 ivan Exp $
+# Jon Nistor <nistor at snickers.org>
+
+# Apple Airport Extreme Discovery Module
+#
+# NOTE: Options for this module:
+#       Apple_AE::disable-clients
+
+package Torrus::DevDiscover::Apple_AE;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'Apple_AE'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+};
+
+
+our %oiddef =
+    (
+     # Apple Airport Extreme
+     'airportObject'        => '1.3.6.1.4.1.63.501',
+     'baseStation3'         => '1.3.6.1.4.1.63.501.3',
+
+     # Airport Information
+     'sysConfName'            => '1.3.6.1.4.1.63.501.3.1.1.0',
+     'sysConfContact'         => '1.3.6.1.4.1.63.501.3.1.2.0',
+     'sysConfLocation'        => '1.3.6.1.4.1.63.501.3.1.3.0',
+     'sysConfFirmwareVersion' => '1.3.6.1.4.1.63.501.3.1.5.0',
+
+     'wirelessNumber'         => '1.3.6.1.4.1.63.501.3.2.1.0',
+     'wirelessPhysAddress'    => '1.3.6.1.4.1.63.501.3.2.2.1.1'
+    );
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    # PROG: Standard sysObject does not work on Airport devices
+    #       So we will match on the specific OID
+    if( not $dd->checkSnmpOID('sysConfName') )
+    {
+        return 0;
+    }
+
+    $devdetails->setCap('interfaceIndexingPersistent');
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    # NOTE: Comments and Serial number of device
+    my $chassisInfo =
+        $dd->retrieveSnmpOIDs( 'sysConfName', 'sysConfLocation',
+                               'sysConfFirmwareVersion' );
+
+    if( defined( $chassisInfo ) )
+    {
+        if( not $chassisInfo->{'sysConfLocation'} )
+        {
+            $chassisInfo->{'sysConfLocation'} = "unknown";
+        }
+
+        $data->{'param'}{'comment'} = "Apple Airport Extreme, " .
+            "Fw#: " . $chassisInfo->{'sysConfFirmwareVersion'} . ", " .
+            $chassisInfo->{'sysConfName'} . " located at " .
+            $chassisInfo->{'sysConfLocation'};
+    } else {
+        $data->{'param'}{'comment'} = "Apple Airport Extreme";
+    }
+
+
+    # PROG: Find wireless clients
+    if( $devdetails->param('Apple_AE::disable-clients') ne 'yes' )
+    {
+        my $numWireless = $dd->retrieveSnmpOIDs('wirelessNumber');
+
+        my $tableClients =
+            $session->get_table( -baseoid =>
+                                 $dd->oiddef('wirelessPhysAddress') );
+        $devdetails->storeSnmpVars( $tableClients );
+
+        if( $tableClients && ($numWireless->{'wirelessNumber'} > 0) )
+        {
+            # PROG: setCap that we actually have clients ...
+            $devdetails->setCap('AE_clients');
+
+            foreach my $wClient ( $devdetails->getSnmpIndices
+                                  ($dd->oiddef('wirelessPhysAddress')) )
+            {
+                my $wMAC = $devdetails->snmpVar(
+                    $dd->oiddef('wirelessPhysAddress') . "." . $wClient);
+
+                # Construct data
+                $data->{'Apple_AE'}{'wClients'}{$wClient} = undef;
+                $data->{'Apple_AE'}{'wClients'}{$wClient}{'wMAC'} = $wMAC;
+
+                Debug("Apple_AE::  Client $wMAC / $wClient");
+            }
+        } 
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+
+    # Wireless Client information
+    if( $devdetails->hasCap('AE_clients') )
+    {
+        my $nodeTop =
+            $cb->addSubtree( $devNode, 'Wireless_Clients', undef,
+                             [ 'Apple_AE::ae-wireless-clients-subtree'] );
+
+        foreach my $wClient ( keys %{$data->{'Apple_AE'}{'wClients'}} )
+        {
+            my $airport = $data->{'Apple_AE'}{'wClients'}{$wClient};
+            my $wMAC    = $airport->{'wMAC'};
+            my $wMACfix = $wMAC;
+            $wMACfix =~ s/:/_/g;
+
+            my $nodeWireless =
+                $cb->addSubtree( $nodeTop, $wMACfix,
+                                 { 'wireless-mac'    => $wMAC,
+                                   'wireless-macFix' => $wMACfix,
+                                   'wireless-macOid' => $wClient },
+                                 [ 'Apple_AE::ae-wireless-clients-leaf' ] );
+        }
+    }
+
+    # PROG: Adding global statistics
+    $cb->addTemplateApplication( $devNode, 'Apple_AE::ae-global-stats');
+}
+
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/Arbor_E.pm b/torrus/perllib/Torrus/DevDiscover/Arbor_E.pm
new file mode 100644 (file)
index 0000000..076d798
--- /dev/null
@@ -0,0 +1,1150 @@
+#
+#  Discovery module for Arbor|e Series devices
+#  Formerly Ellacoya Networks
+#
+#  Copyright (C) 2008 Jon Nistor
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+#
+# $Id: Arbor_E.pm,v 1.1 2010-12-27 00:03:52 ivan Exp $
+# Jon Nistor <nistor at snickers.org>
+#
+# NOTE: This module has been tested against v7.5.x, v7.6.x, v9.0.x, v9.1.x
+#
+# -- Common
+#      Arbor_E::disable-bundle-offer
+#      Arbor_E::disable-bundle-offer-deny
+#      Arbor_E::disable-bundle-offer-pktsize
+#      Arbor_E::disable-bundle-offer-rate
+#      Arbor_E::disable-bundle-offer-subcount
+#      Arbor_E::enable-bundle-name-rrd
+#      Arbor_E::disable-flowdev
+#
+# -- e30 specific
+#      Arbor_E::disable-e30-buffers
+#      Arbor_E::disable-e30-bundle
+#      Arbor_E::disable-e30-cpu
+#      Arbor_E::disable-e30-fwdTable
+#      Arbor_E::disable-e30-fwdTable-login
+#      Arbor_E::disable-e30-hdd
+#      Arbor_E::enable-e30-hdd-errors
+#      Arbor_E::disable-e30-hdd-logs
+#      Arbor_E::disable-e30-l2tp
+#      Arbor_E::disable-e30-mem
+#      Arbor_E::enable-e30-mempool
+#      Arbor_E::disable-e30-bundle
+#      Arbor_E::disable-e30-bundle-deny
+#      Arbor_E::disable-e30-bundle-rate
+#      Arbor_E::disable-e30-slowpath 
+#
+# -- e100 specific
+#      Arbor_E::disable-e100-cpu
+#      Arbor_E::disable-e100-hdd
+#      Arbor_E::disable-e100-mem
+#      Arbor_E::disable-e100-policymgmt
+#      Arbor_E::disable-e100-submgmt
+#
+
+# Arbor_E devices discovery
+package Torrus::DevDiscover::Arbor_E;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'Arbor_E'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+our %oiddef =
+    (
+     # ELLACOYA-MIB
+     'eProducts'            => '1.3.6.1.4.1.3813.2',
+     'codeVer'               => '1.3.6.1.4.1.3813.1.4.1.1.0',
+     'sysIdSerialNum'       => '1.3.6.1.4.1.3813.1.4.1.5.2.0',
+     'memPoolNameIndex'      => '1.3.6.1.4.1.3813.1.4.2.5.1.1',
+     'hDriveErrModel'        => '1.3.6.1.4.1.3813.1.4.2.10.16.0',
+     'hDriveErrSerialNum'    => '1.3.6.1.4.1.3813.1.4.2.10.17.0',
+     'partitionName'         => '1.3.6.1.4.1.3813.1.4.2.11.1.2', # e100
+     'cpuSdramIndex'         => '1.3.6.1.4.1.3813.1.4.2.12.1.1', # e100
+     'hDriveDailyLogSize'    => '1.3.6.1.4.1.3813.1.4.2.13.0',
+     'cpuUtilization'       => '1.3.6.1.4.1.3813.1.4.4.1.0',
+     'cpuUtilTable'          => '1.3.6.1.4.1.3813.1.4.4.2',      # e100
+     'cpuIndex'                     => '1.3.6.1.4.1.3813.1.4.4.2.1.1',  # e100
+     'cpuName'               => '1.3.6.1.4.1.3813.1.4.4.2.1.2',  # e100
+     'loginRespOkStatsIndex' => '1.3.6.1.4.1.3813.1.4.3.15.1.1',
+
+     # ELLACOYA-MIB::cpuCounters, e30 (available in 7.5.x -- slowpath counters)
+     'cpuCounters'           => '1.3.6.1.4.1.3813.1.4.4.10',
+     'slowpathCounters'      => '1.3.6.1.4.1.3813.1.4.4.10.1',
+     'sigCounters'           => '1.3.6.1.4.1.3813.1.4.4.10.2',
+
+     # ELLACOYA-MIB::flow
+     'flowPoolNameD1'        => '1.3.6.1.4.1.3813.1.4.5.1.1.1.2',
+     'flowPoolNameD2'        => '1.3.6.1.4.1.3813.1.4.5.2.1.1.2',
+
+     # ELLACOYA-MIB::bundleStatsTable
+     'bundleName'                    => '1.3.6.1.4.1.3813.1.4.12.1.1.2',
+     'bundleBytesSentDenyPolicyDrop' => '1.3.6.1.4.1.3813.1.4.12.1.1.6',
+     'bundleBytesSentRateLimitDrop'  => '1.3.6.1.4.1.3813.1.4.12.1.1.8',
+     'boBundleID'                    => '1.3.6.1.4.1.3813.1.4.12.2.1.1',
+     'boBundleName'                  => '1.3.6.1.4.1.3813.1.4.12.2.1.3',
+     'boOfferName'                   => '1.3.6.1.4.1.3813.1.4.12.2.1.4',
+     'boBundleSubCount'              => '1.3.6.1.4.1.3813.1.4.12.2.1.7',
+     'boPacketsSent64'               => '1.3.6.1.4.1.3813.1.4.12.2.1.8',
+     'boBundleBytesSentDenyPolicyDrop' => '1.3.6.1.4.1.3813.1.4.12.2.1.22',
+     'boBundleBytesSentRateLimitDrop'  => '1.3.6.1.4.1.3813.1.4.12.2.1.24',
+
+     # ELLACOYA-MIB::policyMgmt, e100
+     'policyMgmt'                    => '1.3.6.1.4.1.3813.1.4.16',
+
+     # ELLACOYA-MIB::subscriberMgmt, e100
+     'subscriberMgmt'                => '1.3.6.1.4.1.3813.1.4.17',
+     'subscriberStateName'           => '1.3.6.1.4.1.3813.1.4.17.7.1.2',
+
+     # ELLACOYA-MIB::l2tp, e30 (available in 7.5.x)
+     'l2tpConfigEnabled'             => '1.3.6.1.4.1.3813.1.4.18.1.1.0',
+     'l2tpSecureEndpointIpAddress'   => '1.3.6.1.4.1.3813.1.4.18.3.2.1.1.1',
+     'l2tpSecureEndpointOverlapping' => '1.3.6.1.4.1.3813.1.4.18.3.2.1.1.3',
+
+     );
+
+our %eChassisName =
+    (
+        '1'  => 'e16k',
+        '2'  => 'e4k',
+        '3'  => 'e30 Revision: R',
+        '4'  => 'e30 Revision: S',
+        '5'  => 'e30 Revision: T',
+        '6'  => 'e30 Revision: U',
+        '7'  => 'e30 Revision: V',
+       '8'  => 'Ellacoya e100',
+        '9'  => 'e100'
+    );
+
+our %eCpuName =
+    (
+        '1'  => 'Control Module',
+        '3'  => 'DPI Module 1 CPU 1',
+        '4'  => 'DPI Module 1 CPU 2',
+        '5'  => 'DPI Module 2 CPU 1',
+        '6'  => 'DPI Module 2 CPU 2',
+        '7'  => 'I/O Module'
+    );
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'eProducts', $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+   
+    $devdetails->setCap('interfaceIndexingPersistent');
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    # PROG: Grab versions, serials and type of chassis.
+    my $eInfo = $dd->retrieveSnmpOIDs
+                   ( 'codeVer', 'sysIdSerialNum', 'sysObjectID' );
+    $eInfo->{'modelNum'} = $eInfo->{'sysObjectID'};
+    $eInfo->{'modelNum'} =~ s/.*(\d)$/$1/; # Last digit
+
+    # SNMP: System comment
+    $data->{'param'}{'comment'} =
+            "Arbor " . $eChassisName{$eInfo->{'modelNum'}} .
+            ", Hw Serial#: " . $eInfo->{'sysIdSerialNum'} .
+            ", Version: " .  $eInfo->{'codeVer'};
+
+    # ------------------------------------------------------------------------
+    # Arbor_E e30 related material here
+    if( $eInfo->{'modelNum'} < 8 )
+    {
+        Debug("Arbor_E: Found " . $eChassisName{$eInfo->{'modelNum'}} );
+
+        # PROG: Set Capability to be the e30 device
+        $devdetails->setCap('e30');
+
+        # PROG: Check status oids
+        if( $devdetails->param('Arbor_E::disable-e30-buffers') ne 'yes' )
+       {
+            $devdetails->setCap('e30-buffers');
+        }
+
+        if( $devdetails->param('Arbor_E::disable-e30-cpu') ne 'yes' )
+        {
+            $devdetails->setCap('e30-cpu');
+        }
+
+        if( $devdetails->param('Arbor_E::disable-e30-fwdTable') ne 'yes' )
+        {
+            $devdetails->setCap('e30-fwdTable');
+
+            if( $devdetails->param('Arbor_E::disable-e30-fwdTable-login')
+                ne 'yes' )
+            {
+                my $loginTable = $session->get_table(
+                       -baseoid => $dd->oiddef('loginRespOkStatsIndex') );
+                $devdetails->storeSnmpVars( $loginTable );
+
+                if( defined( $loginTable ) )
+                {
+                    $devdetails->setCap('e30-fwdTable-login');
+
+                    foreach my $statsIdx ( $devdetails->getSnmpIndices(
+                                      $dd->oiddef('loginRespOkStatsIndex') ) )
+                    {
+                        push(@{$data->{'e30'}{'loginResp'}}, $statsIdx);
+                    }
+                }
+            } # END hasCap disable-e30-fwdTable-login
+        }
+
+        if( $devdetails->param('Arbor_E::disable-e30-hdd') ne 'yes' )
+        {
+            $devdetails->setCap('e30-hdd');
+
+            # SNMP: Add harddrive comment information
+            $eInfo = $dd->retrieveSnmpOIDs( 'hDriveErrModel',
+                                            'hDriveErrSerialNum' );
+
+            $data->{'e30'}{'hddModel'}  = $eInfo->{'hDriveErrModel'};
+            $data->{'e30'}{'hddSerial'} = $eInfo->{'hDriveErrSerialNum'};
+
+            # PROG: Do we want errors as well?
+            if( $devdetails->param('Arbor_E::enable-e30-hdd-errors') eq 'yes' )
+            {
+                $devdetails->setCap('e30-hdd-errors');
+            }
+
+            # PROG: Do we want to look at daily log files? (New in 7.6)
+            if( $devdetails->param('Arbor_E::disable-e30-hdd-logs') ne 'yes' )
+            {
+                $eInfo = $dd->retrieveSnmpOIDs( 'hDriveDailyLogSize' );
+
+                if( $eInfo->{'hDriveDailyLogSize'} )
+                {
+                    $devdetails->setCap('e30-hdd-logs');
+                }
+            }
+        } # END: if disable-e30-hdd
+
+        if( $devdetails->param('Arbor_E::disable-e30-l2tp') ne 'yes' )
+        {
+            # 1 - disabled, 2 - enabled, 3 - session aware
+            $eInfo = $dd->retrieveSnmpOIDs('l2tpConfigEnabled');
+
+            if( $eInfo->{'l2tpConfigEnabled'} > 1 )
+            {
+                $devdetails->setCap('e30-l2tp');
+
+                my $l2tpSecEndTable = $session->get_table(
+                       -baseoid => $dd->oiddef('l2tpSecureEndpointIpAddress') );
+               $devdetails->storeSnmpVars( $l2tpSecEndTable );
+
+                Debug("e30: L2TP secure endpoints found:");
+                foreach my $SEP ( $devdetails->getSnmpIndices(
+                                  $dd->oiddef('l2tpSecureEndpointIpAddress') ) )
+               {
+                       next if( ! $SEP );
+                       $data->{'e30'}{'l2tpSEP'}{$SEP} = 0;
+                        Debug("e30:    $SEP");
+               }
+            } # END: if l2tpConfigEnabled
+        }
+
+        # Memory usage on system
+        if( $devdetails->param('Arbor_E::disable-e30-mem') ne 'yes' )
+        {
+            $devdetails->setCap('e30-mem');
+        }
+
+        # Memory usage / individual blocks
+        if( $devdetails->param('Arbor_E::enable-e30-mempool') eq 'yes' )
+        {
+            my $mempoolTable = $session->get_table(
+                                 -baseoid => $dd->oiddef('memPoolNameIndex') );
+            $devdetails->storeSnmpVars( $mempoolTable );
+
+            if( defined( $mempoolTable ) )
+            {
+                $devdetails->setCap('e30-mempool');
+
+                foreach my $memOID (
+                           $devdetails->getSnmpIndices(
+                                $dd->oiddef('memPoolNameIndex') ) )
+                {
+                    my $memName = $mempoolTable->{
+                               $dd->oiddef('memPoolNameIndex') . '.' . $memOID};
+
+                    Debug("e30:  Mempool: $memName");
+                    $data->{'e30'}{'mempool'}{$memOID} = $memName;
+                }
+            }
+        }
+
+        # Traffic statistics per Bundle
+        if( $devdetails->param('Arbor_E::disable-e30-bundle') ne 'yes' )
+        {
+            # Set capability 
+            $devdetails->setCap('e30-bundle');
+
+            # Pull table information
+            my $bundleTable = $session->get_table(
+                                -baseoid => $dd->oiddef('bundleName') );
+            $devdetails->storeSnmpVars( $bundleTable );
+
+            Debug("e30: Bundle Information id:name");
+            foreach my $bundleID (
+                       $devdetails->getSnmpIndices( $dd->oiddef('bundleName') ))
+            {
+                    my $bundleName = $bundleTable->{$dd->oiddef('bundleName') .
+                                        '.' . $bundleID};
+                    $data->{'e30'}{'bundleID'}{$bundleID} = $bundleName;
+       
+                    Debug("e30:    $bundleID $bundleName");
+            } # END foreache my $bundleID
+
+            if( $devdetails->param('Arbor_E::disable-e30-bundle-deny') ne 'yes')
+            {
+                my $bundleDenyTable = $session->get_table(
+                     -baseoid => $dd->oiddef('bundleBytesSentDenyPolicyDrop') );
+                $devdetails->storeSnmpVars( $bundleDenyTable );
+
+                if( $bundleDenyTable )
+                {
+                    $devdetails->setCap('e30-bundle-denyStats');
+                }
+            }
+
+            if( $devdetails->param('Arbor_E::disable-e30-bundle-rate') ne 'yes')
+            {
+                my $bundleRateLimitTable = $session->get_table(
+                     -baseoid => $dd->oiddef('bundleBytesSentRateLimitDrop') );
+                $devdetails->storeSnmpVars( $bundleRateLimitTable );
+
+                if( $bundleRateLimitTable )
+                {
+                    $devdetails->setCap('e30-bundle-rateLimitStats');
+                }
+            }
+
+        } # END if Arbor_E::disable-e30-bundle
+
+        # PROG: Counters
+        if( $devdetails->param('Arbor_E::disable-e30-slowpath') ne 'yes' )
+        {
+            # Slowpath counters are available as of 7.5.x
+            my $counters = $session->get_table(
+                            -baseoid => $dd->oiddef('slowpathCounters') );
+            $devdetails->storeSnmpVars( $counters );
+
+            if( defined( $counters ) )
+            {
+                $devdetails->setCap('e30-slowpath');
+            }
+        }
+    }
+
+
+    # ------------------------------------------------------------------------
+    #
+    # Arbor E100 related material here
+
+    if( $eInfo->{'modelNum'} >= 8 )
+    {
+        Debug("Arbor_E: Found " . $eChassisName{$eInfo->{'modelNum'}} );
+
+        # PROG: Set Capability to be the e100 device
+        $devdetails->setCap('e100');
+
+        # CPU parameters ...
+        if( $devdetails->param('Arbor_E::disable-e100-cpu') ne 'yes' )
+        {
+          my $cpuNameTable = $session->get_table(
+                            -baseoid => $dd->oiddef('cpuName') );
+          $devdetails->storeSnmpVars( $cpuNameTable );
+
+          if( defined( $cpuNameTable ) )
+          {
+            $devdetails->setCap('e100-cpu');
+
+            # PROG: Find all the CPU's ..
+            foreach my $cpuIndex ( $devdetails->getSnmpIndices(
+                                   $dd->oiddef('cpuName') ) )
+            {
+              my $cpuName = $cpuNameTable->{$dd->oiddef('cpuName') .
+                                                   '.' . $cpuIndex};
+
+              Debug("  CPU found: $cpuIndex, $cpuName");
+              $data->{'e100'}{'cpu'}{$cpuIndex} = $cpuName;
+            }
+          }
+        }
+
+        # HDD Parameters
+        if( $devdetails->param('Arbor_E::disable-e100-hdd') ne 'yes' )
+        {
+          my $hddTable = $session->get_table(
+                           -baseoid => $dd->oiddef('partitionName') );
+          $devdetails->storeSnmpVars( $hddTable );
+
+          if( defined( $hddTable ) )
+          {
+            $devdetails->setCap('e100-hdd');
+
+            # PROG: Find all the paritions and names ..
+            foreach my $hddIndex ( $devdetails->getSnmpIndices(
+                                   $dd->oiddef('partitionName') ) )
+            {
+              my $partitionName = $hddTable->{$dd->oiddef('partitionName') .
+                                              '.' . $hddIndex};
+              Debug("HDD Partition: $hddIndex, $partitionName");
+              $data->{'e100'}{'hdd'}{$hddIndex} = $partitionName;
+            }
+          }
+        }
+
+        # MEM Parameters
+        if( $devdetails->param('Arbor_E::disable-e100-mem') ne 'yes' )
+        {
+          my $cpuSdramTable = $session->get_table(
+                             -baseoid => $dd->oiddef('cpuSdramIndex') );
+          $devdetails->storeSnmpVars( $cpuSdramTable );
+
+          if( defined( $cpuSdramTable ) )
+          {
+            $devdetails->setCap('e100-mem');
+
+            # PROG: Find all memory indexes
+            foreach my $memIndex ( $devdetails->getSnmpIndices(
+                                   $dd->oiddef('cpuSdramIndex') ) )
+            {
+              my $memName = $data->{'e100'}{'cpu'}{$memIndex};
+              Debug("MEM found: $memIndex, $memName");
+              $data->{'e100'}{'mem'}{$memIndex} = $memName;
+            }
+          }
+        }
+
+        # Policy Mgmt parameters
+        if( $devdetails->param('Arbor_E::disable-e100-policymgmt') ne 'yes' )
+        {
+          my $policyTable = $session->get_table(
+                              -baseoid => $dd->oiddef('policyMgmt')
+                            );
+          $devdetails->storeSnmpVars( $policyTable );
+
+          if( defined( $policyTable ) )
+          {
+            $devdetails->setCap('e100-policymgmt');
+          }
+        }
+
+        # Subscriber Mgmt parameters
+        if( $devdetails->param('Arbor_E::disable-e100-submgmt') ne 'yes' )
+        {
+          my $subTable = $session->get_table(
+                            -baseoid => $dd->oiddef('subscriberStateName')
+                         );
+          $devdetails->storeSnmpVars( $subTable );
+
+          if( defined( $subTable ) )
+          {
+            $devdetails->setCap('e100-submgmt');
+
+            # Sub: Find state name entries
+            foreach my $stateIDX ( $devdetails->getSnmpIndices( $dd->oiddef(
+                                       'subscriberStateName') ) )
+            {
+               my $state = $subTable->{
+                              $dd->oiddef('subscriberStateName') .
+                              '.' .  $stateIDX
+                           };
+               
+               Debug("  State index: $stateIDX, name: $state");
+               $data->{'e100'}{'submgmt'}{$stateIDX} = $state;
+            }
+          }
+        }
+    }
+
+
+    # ------------------------------------------------------------------------
+    #
+    # Common information between e30 and e100
+
+    if( $devdetails->param('Arbor_E::disable-flowdev') ne 'yes' )
+    {
+        $devdetails->setCap('arbor-flowLookup');
+
+        # Flow Lookup Device information
+        # Figure out what pools exist for the 2 flow switching modules
+        # ------------------------------------------------------------
+        my $switchingModules = 2;
+
+        foreach my $flowModule (1 .. $switchingModules) {
+            Debug("common:  Flow Lookup Device " . $flowModule);
+
+            my $flowPoolOid  = 'flowPoolNameD' . $flowModule;
+            my $flowModTable = $session->get_table (
+                              -baseoid => $dd->oiddef($flowPoolOid) );
+            $devdetails->storeSnmpVars ( $flowModTable );
+
+            # PROG: Look for pool names and indexes and store them.
+            if( $flowModTable ) {
+                foreach my $flowPoolIDX ( $devdetails->getSnmpIndices(
+                                            $dd->oiddef($flowPoolOid) ) )
+                {
+                    my $flowPoolName = $flowModTable->{
+                           $dd->oiddef($flowPoolOid) . '.' . $flowPoolIDX};
+
+                    $data->{'arbor_e'}{'flowModule'}{$flowModule}{$flowPoolIDX}
+                          = $flowPoolName;
+
+                    Debug("common:    IDX: $flowPoolIDX  Pool: $flowPoolName");
+
+                } # END: foreach my $flowPoolIDX
+            } # END: if $flowModTable
+        } # END: foreach my $flowModule
+    }
+
+
+    if( $devdetails->param('Arbor_E::disable-bundle-offer') ne 'yes' )
+    {
+        my $boOfferNameTable = $session->get_table(
+                            -baseoid => $dd->oiddef('boOfferName') );
+        $devdetails->storeSnmpVars( $boOfferNameTable );
+
+        my $boBundleNameTable = $session->get_table(
+                            -baseoid => $dd->oiddef('boBundleName') );
+        $devdetails->storeSnmpVars( $boBundleNameTable );
+
+        if( defined( $boOfferNameTable ) )
+        {
+            $devdetails->setCap('arbor-bundle');
+
+            foreach my $boOfferNameID ( $devdetails->getSnmpIndices(
+                                $dd->oiddef('boOfferName') ) )
+            {
+               my ($bundleID,$offerNameID) = split( /\./, $boOfferNameID );
+
+                my $offerName = $boOfferNameTable->{
+                                    $dd->oiddef('boOfferName')
+                                    . '.' . $boOfferNameID };
+                my $bundleName = $boBundleNameTable->{
+                                    $dd->oiddef('boBundleName')
+                                    . '.' . $boOfferNameID };
+
+                $data->{'arbor_e'}{'offerName'}{$offerNameID} = $offerName;
+                $data->{'arbor_e'}{'bundleName'}{$bundleID}   = $bundleName;
+
+                push( @{$data->{'arbor_e'}{'boOfferBundle'}{$offerNameID}},
+                      $bundleID );
+            }
+        }
+
+        # PROG: Subscribers using the bundle
+        if( $devdetails->param('Arbor_E::disable-bundle-offer-subcount')
+            ne 'yes' )
+        {
+            my $oidSubcount = $dd->oiddef('boBundleSubCount');
+
+            if( defined $session->get_table( -baseoid => $oidSubcount ) )
+            {
+                $devdetails->setCap('arbor-bundle-subcount');
+            }
+        }
+
+        # PROG: Packets sent on this bundle with a size
+        if( $devdetails->param('Arbor_E::disable-bundle-offer-pktsize')
+            ne 'yes' )
+        {
+            my $oidPktsize = $dd->oiddef('boPacketsSent64');
+
+            if( defined $session->get_table( -baseoid => $oidPktsize ) )
+            {
+                $devdetails->setCap('arbor-bundle-pktsize');
+            }
+        }
+
+        # PROG: Bytes sent on this bundle for deny policy drop
+        if( $devdetails->param('Arbor_E::disable-bundle-offer-deny')
+            ne 'yes' )
+        {
+            my $oidDenypolicy = $dd->oiddef('boBundleBytesSentDenyPolicyDrop');
+
+            if( defined $session->get_table( -baseoid => $oidDenypolicy ) )
+            {
+                $devdetails->setCap('arbor-bundle-deny');
+            }
+        }
+
+        # PROG: Bytes sent on this bundle for rate limit drop
+        if( $devdetails->param('Arbor_E::disable-bundle-offer-rate')
+            ne 'yes' )
+        {
+            my $oidRatelimit = $dd->oiddef('boBundleBytesSentRateLimitDrop');
+
+            if( defined $session->get_table( -baseoid => $oidRatelimit ) )
+            {
+                $devdetails->setCap('arbor-bundle-ratelimit');
+            }
+        }
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+    # PROG: Lets do e30 first ...
+    if( $devdetails->hasCap('e30') )
+    {
+        # e30 buffer information
+        if( $devdetails->hasCap('e30-buffers') )
+        {
+            $cb->addTemplateApplication($devNode, 'Arbor_E::e30-buffers');
+        }
+
+        if( $devdetails->hasCap('e30-bundle') )
+        {
+            # Create topLevel subtree
+            my $bundleNode = $cb->addSubtree( $devNode, 'Bundle_Stats',
+                                    { 'comment' => 'Bundle statistics' },
+                                    [ 'Arbor_E::e30-bundle-subtree' ] );
+
+            foreach my $bundleID
+                ( sort {$a <=> $b} keys %{$data->{'e30'}{'bundleID'} } )
+            {
+                my $srvName     =  $data->{'e30'}{'bundleID'}{$bundleID};
+                my $subtreeName =  $srvName;
+                   $subtreeName =~ s/\W/_/g; 
+                my $bundleRRD  = $bundleID;
+                my @templates   = ( 'Arbor_E::e30-bundle' );
+
+                if( $devdetails->param('Arbor_E::enable-e30-bundle-name-rrd')
+                    eq 'yes' )
+                {
+                    # Filenames written out as the bundle name
+                    $bundleRRD =  lc($srvName);
+                    $bundleRRD =~ s/\W/_/g;
+                }
+
+                if( $devdetails->hasCap('e30-bundle-denyStats') )
+                {
+                    push( @templates, 'Arbor_E::e30-bundle-deny' );
+                }
+
+                if( $devdetails->hasCap('e30-bundle-rateLimitStats') )
+                {
+                    push( @templates, 'Arbor_E::e30-bundle-ratelimit' );
+                }
+
+                $cb->addSubtree( $bundleNode, $subtreeName,
+                                 { 'comment'          => $srvName,
+                                   'e30-bundle-index' => $bundleID,
+                                   'e30-bundle-name'  => $srvName,
+                                   'e30-bundle-rrd'   => $bundleRRD,
+                                   'precedence'       => 1000 - $bundleID },
+                                 \@templates );
+            } # END foreach my $bundleID
+        }
+
+        # e30 cpu
+        if( $devdetails->hasCap('e30-cpu') )
+        {
+            $cb->addTemplateApplication($devNode, 'Arbor_E::e30-cpu');
+        }
+
+        # e30 forwarding table
+        if( $devdetails->hasCap('e30-fwdTable') )
+        {
+            $cb->addTemplateApplication($devNode, 'Arbor_E::e30-fwdTable');
+
+            if( $devdetails->hasCap('e30-fwdTable-login') )
+            {
+                my $subtree  = "Forwarding_Table_Login_Stats";
+                my $comment  = "Discovery attempts statistics";
+                my $nodeTree = $cb->addSubtree( $devNode, $subtree, 
+                                              { 'comment' => $comment },
+                                                undef );
+
+                my @colors =
+                    ('##one', '##two', '##three', '##four', '##five',
+                     '##six', '##seven', '##eight', '##nine', '##ten'
+                    );
+
+                my $multiParam = {
+                    'precedence'        => 1000,
+                    'comment'           => 'Summary of login attempt responses',
+                    'graph-lower-limit' => 0,
+                    'graph-title'       => 'Summary of login attempt responses',
+                    'rrd-hwpredict'     => 'disabled',
+                    'vertical-label'    => 'Responses',
+                    'ds-type'           => 'rrd-multigraph'
+                    };
+                my $dsList;
+
+                foreach my $sindex ( sort { $a <=> $b } 
+                                     @{$data->{'e30'}{'loginResp'}} )
+                {
+               
+                    $cb->addLeaf( $nodeTree, 'Login_' . $sindex,
+                                { 'comment'    => 'Login attempt #' . $sindex,
+                                  'login-idx'  => $sindex,
+                                  'precedence' => 100 - $sindex },
+                                [ 'Arbor_E::e30-fwdTable-login' ] );
+
+                    # Addition for multi-graph
+                    my $dsName  = "Login_$sindex";
+                    my $color   = shift @colors;
+                       $dsList .= $dsName . ',';
+
+                    $multiParam->{"ds-expr-$dsName"}      = "{$dsName}";
+                    $multiParam->{"graph-legend-$dsName"} = "Attempt $sindex";
+                    $multiParam->{"line-style-$dsName"}   = "LINE1";
+                    $multiParam->{"line-color-$dsName"}   = $color;
+                    $multiParam->{"line-order-$dsName"}   = $sindex;
+
+                    Debug("  loginReps: $sindex, color: $color");
+                } # END: foreach $sindex
+
+                $dsList =~ s/,$//o;    # Remove final comma
+                $multiParam->{'ds-names'} = $dsList;
+
+                $cb->addLeaf($nodeTree, 'Summary', $multiParam, undef );
+
+            } # END: hasCap e30-fwdTable-login
+        } # END: hasCap e30-fwdTable
+
+        # e30 hard drive
+        if( $devdetails->hasCap('e30-hdd') )
+        {
+            my $comment = "Model: "  . $data->{'e30'}{'hddModel'} . ", " .
+                          "Serial: " . $data->{'e30'}{'hddSerial'};
+            my $subtree = "Hard_Drive";
+            my @templates;
+            push( @templates, 'Arbor_E::e30-hdd-subtree' );
+            push( @templates, 'Arbor_E::e30-hdd' );
+
+            # PROG: Process hdd errors
+            if( $devdetails->hasCap('e30-hdd-errors') )
+            {
+                push( @templates, 'Arbor_E::e30-hdd-errors' );
+            }
+
+            # PROG: Process hdd daily logs
+            if( $devdetails->hasCap('e30-hdd-logs') )
+            {
+                push( @templates, 'Arbor_E::e30-hdd-logs' );
+            }
+
+            my $hdNode = $cb->addSubtree($devNode, $subtree,
+                                        { 'comment' => $comment },
+                                        \@templates);
+        }
+
+        # e30 L2TP tunnel information
+        if( $devdetails->hasCap('e30-l2tp') )
+        {
+            # PROG: First add the appropriate template
+            my $l2tpNode = $cb->addSubtree( $devNode, 'L2TP', undef,
+                                          [ 'Arbor_E::e30-l2tp-subtree' ]);
+
+            # PROG: Cycle through the SECURE EndPoint devices
+            if( $data->{'e30'}{'l2tpSEP'} )
+            {
+                # PROG: Add the assisting template first
+                my $l2tpEndNode = $cb->addSubtree( $l2tpNode, 'Secure_Endpoint',
+                             { 'comment' => 'Secure endpoint parties' },
+                             [ 'Arbor_E::e30-l2tp-secure-endpoints-subtree' ] );
+
+                foreach my $SEP ( keys %{$data->{'e30'}{'l2tpSEP'}} )
+                {
+                  my $endPoint =  $SEP;
+                     $endPoint =~ s/\W/_/g;
+
+                  $cb->addSubtree($l2tpEndNode, $endPoint,
+                              { 'e30-l2tp-ep'   => $SEP,
+                                'e30-l2tp-file' => $endPoint },
+                              [ 'Arbor_E::e30-l2tp-secure-endpoints-leaf' ]);
+                } # END: foreach
+            }
+        }
+
+        # e30 memory
+        if( $devdetails->hasCap('e30-mem') )
+        {
+            $cb->addTemplateApplication($devNode, 'Arbor_E::e30-mem');
+        }
+
+        # e30 memory pool
+        if( $devdetails->hasCap('e30-mempool') )
+        {
+            my $subtreeName = "Memory_Pool";
+            my $param       = { 'comment' => 'Memory Pool Statistics' };
+            my $templates   = [ 'Arbor_E::e30-mempool-subtree' ];
+            my $memIndex    = $data->{'e30'}{'mempool'};
+
+            my $nodeTop     = $cb->addSubtree( $devNode, $subtreeName,
+                                               $param, $templates );
+
+            foreach my $memIDX ( keys %{$memIndex} )
+            {
+                my $leafName = $memIndex->{$memIDX};
+                my $dataFile = "%snmp-host%_mempool_" . $leafName . '.rrd';
+
+                my $nodeMem = $cb->addSubtree( $nodeTop, $leafName, 
+                                            { 'data-file'         => $dataFile,
+                                              'e30-mempool-index' => $memIDX,
+                                              'e30-mempool-name'  => $leafName
+                                            },
+                                            [ 'Arbor_E::e30-mempool' ] );
+            }
+        }
+
+        # e30 slowpath counters
+        if( $devdetails->hasCap('e30-slowpath') )
+        {
+            my $slowNode = $cb->addSubtree( $devNode, 'SlowPath', undef,
+                                          [ 'Arbor_E::e30-slowpath' ] );
+        }
+    } # END: if e30 device
+
+
+    # -----------------------------------------------------
+    #
+    # E100 series...
+
+    if( $devdetails->hasCap('e100') )
+    {
+        # CPU: per-cpu information
+        if( $devdetails->hasCap('e100-cpu') )
+        {
+            my @colors  = ( '##one', '##two', '##three', '##four', '##five',
+                            '##six', '##seven', '##eight', '##nine', '##ten'
+                          );
+            my $subtree = "CPU_Usage";
+            my $cpuTree = $cb->addSubtree( $devNode, $subtree, undef,
+                                         [ 'Arbor_E::e100-cpu-subtree' ] );
+            my $multiParam = {
+                'precedence'        => 1000,
+                'comment'           => 'Summary of all CPU utilization',
+                'graph-lower-limit' => 0,
+                'graph-title'       => 'Summary of all CPU utilization',
+                'rrd-hwpredict'     => 'disabled',
+                'vertical-label'    => 'Percent',
+                'ds-type'           => 'rrd-multigraph'
+                };
+            my $dsList;
+
+            foreach my $cpuIndex ( sort keys %{$data->{'e100'}{'cpu'}} )
+            {
+                my $cpuName = $data->{'e100'}{'cpu'}{$cpuIndex};
+  
+                # Is there proper desc for the CPU index?
+                my $comment;
+                if( $eCpuName{$cpuIndex} )
+                {
+                    $comment = $eCpuName{$cpuIndex};
+                } else {
+                    $comment = "CPU: $cpuName";
+                }
+  
+                $cb->addLeaf( $cpuTree, $cpuName,
+                            { 'comment'    => $comment,
+                              'cpu-index'  => $cpuIndex,
+                              'cpu-name'   => $cpuName,
+                              'precedence' => 1000 - $cpuIndex },
+                            [ 'Arbor_E::e100-cpu' ] );
+  
+                # Multi-graph additions
+                my $color   = shift @colors;
+                   $dsList .= $cpuName . ',';
+                $multiParam->{"ds-expr-$cpuName"}      = "{$cpuName}";
+                $multiParam->{"graph-legend-$cpuName"} = "$cpuName";
+                $multiParam->{"line-style-$cpuName"}   = "LINE1";
+                $multiParam->{"line-color-$cpuName"}   = $color;
+                $multiParam->{"line-order-$cpuName"}   = $cpuIndex;
+            } # END: foreach $cpuIndex
+
+            $dsList =~ s/,$//o;     # Remove final comma
+            $multiParam->{'ds-names'} = $dsList;
+            $cb->addLeaf($cpuTree, 'Summary', $multiParam, undef );
+
+        } # END: hasCap e100-cpu
+
+        # HDD: Partition sizes / usage
+        if( $devdetails->hasCap('e100-hdd') )
+        {
+            my $subtree = "HDD_Usage";
+            my $hddTree = $cb->addSubtree( $devNode, $subtree, undef,
+                                         [ 'Arbor_E::e100-hdd-subtree' ] );
+
+            foreach my $hddIndex ( sort keys %{$data->{'e100'}{'hdd'}} )
+            {
+              my $hddName = $data->{'e100'}{'hdd'}{$hddIndex};
+              $cb->addSubtree( $hddTree, $hddName,
+                             { 'comment'    => 'HDD: ' . $hddName,
+                               'hdd-index'  => $hddIndex,
+                               'hdd-name'   => $hddName,
+                               'precedence' => 1000 - $hddIndex },
+                             [ 'Arbor_E::e100-hdd' ] );
+            }
+        }
+
+        # MEM: per-cpu memory usage
+        if( $devdetails->hasCap('e100-mem') )
+        {
+            my $subtree = "Memory_Usage";
+            my $memTree = $cb->addSubtree( $devNode, $subtree, undef,
+                                         [ 'Arbor_E::e100-mem-subtree' ] );
+            foreach my $memIndex ( sort keys %{$data->{'e100'}{'mem'}} )
+            {
+              my $memName = $data->{'e100'}{'cpu'}{$memIndex};
+
+              my $comment = "Memory for $memName CPU";
+              $cb->addSubtree( $memTree, $memName,
+                             { 'comment'    => $comment,
+                               'mem-index'  => $memIndex,
+                               'mem-name'   => $memName,
+                               'precedence' => 1000 - $memIndex },
+                             [ 'Arbor_E::e100-mem' ] );
+            }
+        }
+
+        # PolicyMmgt: Information regarding delta, service bundles, subnets
+        if( $devdetails->hasCap('e100-policymgmt') )
+        {
+            $cb->addTemplateApplication($devNode, 'Arbor_E::e100-policymgmt');
+        }
+
+        # SubscriberMgmt: Information regarding subscriber counts, states, etc.
+        if( $devdetails->hasCap('e100-submgmt') )
+        {
+            my $subMgmtTree = $cb->addSubtree( $devNode, 'Subscribers', undef,
+                                      [ 'Arbor_E::e100-submgmt-subtree' ]
+                             );
+
+            my $stateTree  = $cb->addSubtree( $subMgmtTree, 'Subscriber_State',
+                                        undef,
+                                      [ 'Arbor_E::e100-submgmt-state-subtree' ]
+                             );
+
+            # State: Multigraph display
+            my @colors =
+                ('##one', '##two', '##three', '##four', '##five',
+                 '##six', '##seven', '##eight', '##nine', '##ten'
+                );
+            my $multiParam = {
+                'precedence'        => 1000,
+                'graph-lower-limit' => 0,
+                'graph-title'       => 'Summary of subscriber states',
+                'rrd-hwpredict'     => 'disabled',
+                'vertical-label'    => 'Subscribers',
+                'comment'           => 'Summary of all states',
+                'ds-type'           => 'rrd-multigraph'
+            };
+            my $dsList;
+
+            foreach my $stateIDX ( sort keys %{$data->{'e100'}{'submgmt'}} )
+            {
+                my $color        =  shift @colors;
+                my $stateName    =  $data->{'e100'}{'submgmt'}{$stateIDX};
+                my $stateNameRRD =  $stateName;
+                   $stateNameRRD =~ s/[^a-zA-Z_]/_/o;
+
+                my $stateNode = $cb->addLeaf( $stateTree, $stateName,
+                                   { 'comment'    => "State: $stateName",
+                                     'state-idx'  => $stateIDX,
+                                     'state-name' => $stateName,
+                                     'state-rrd'  => $stateNameRRD,
+                                     'precedence' => 100 - $stateIDX },
+                                   [ 'Arbor_E::e100-submgmt-state' ] );
+                $dsList .= $stateName . ',';
+
+                $multiParam->{"ds-expr-$stateName"}      = "{$stateName}";
+                $multiParam->{"graph-legend-$stateName"} = "$stateName";
+                $multiParam->{"line-style-$stateName"}   = "LINE1";
+                $multiParam->{"line-color-$stateName"}   = $color,
+                $multiParam->{"line-order-$stateName"}   = $stateIDX;
+            }
+            $dsList =~ s/,$//o;
+            $multiParam->{'ds-names'} = $dsList;
+
+            $cb->addLeaf($stateTree, 'Summary', $multiParam, undef );
+
+        }
+    }
+
+    # -------------------------------------------------------------------------
+    #
+    # Common information between e30 and e100
+
+    if( $devdetails->hasCap('arbor-bundle') )
+    {
+        my $subtreeName = "Bundle_Offer_Stats";
+        my $param       = { 'comment'    => 'Byte counts for each bundle ' . 
+                                            'per Offer' };
+        my $templates   = [ ];
+        my $nodeTop     = $cb->addSubtree( $devNode, $subtreeName,
+                                           $param, $templates );
+
+        foreach my $offerNameID ( keys %{$data->{'arbor_e'}{'offerName'}} )
+        {
+            my $offerName   =  $data->{'arbor_e'}{'offerName'}{$offerNameID};
+               $offerName   =~ s/\W/_/g;
+            my $offerBundle =  $data->{'arbor_e'}{'boOfferBundle'};
+            my $offerRRD    =  $offerNameID;
+
+            if( $devdetails->param('Arbor_E::enable-bundle-name-rrd')
+                eq 'yes' )
+            {
+                # Filename will now be written as offer name
+                $offerRRD = lc($offerName);
+            }
+
+            # Build tree
+            my $oparam = { 'comment'   => 'Offer: ' . $offerName,
+                           'offer-id'  => $offerNameID,
+                           'offer-rrd' => $offerRRD };
+            my $otemplates = [ 'Arbor_E::arbor-bundle-subtree' ];
+            my $offerTop = $cb->addSubtree( $nodeTop, $offerName, $oparam,
+                                            $otemplates );
+
+            Debug("    Offer: $offerName");
+
+            foreach my $bundleID ( @{%{$offerBundle}->{$offerNameID}} )
+            {
+                my @btemplates;
+                my $bundleName =  $data->{'arbor_e'}{'bundleName'}{$bundleID};
+                   $bundleName =~ s/\W/_/g;
+                my $bundleRRD  =  $bundleID;
+
+                Debug("      $bundleID: $bundleName");
+
+                if( $devdetails->param('Arbor_E::enable-bundle-name-rrd')
+                    eq 'yes' )
+                {
+                    # Filename will now be written as bundle name
+                    $bundleRRD = lc($bundleName);
+                }
+
+                my $bparam     = { 'comment'     => 'Bundle ID: ' . $bundleID,
+                                   'data-file'   => '%system-id%_bo_' .
+                                                    '%offer-rrd%_' .
+                                                    '%bundle-rrd%.rrd',
+                                   'bundle-id'   => $bundleID,
+                                   'bundle-name' => $bundleName,
+                                   'bundle-rrd'  => $bundleRRD };
+                push( @btemplates, 'Arbor_E::arbor-bundle' );
+
+                # PROG: Subscribers using the bundle
+                if( $devdetails->hasCap('arbor-bundle-subcount') )
+                {
+                    push( @btemplates, 'Arbor_E::arbor-bundle-subcount' );
+                }
+
+                # PROG: Packets sent on this bundle per size
+                if( $devdetails->hasCap('arbor-bundle-pktsize') )
+                {
+                    push( @btemplates, 'Arbor_E::arbor-bundle-pktsize' );
+                }
+
+                # PROG: Bytes sent on this bundle for deny policy drop
+                if( $devdetails->hasCap('arbor-bundle-deny') )
+                {
+                    push( @btemplates, 'Arbor_E::arbor-bundle-deny' );
+                }
+
+                # PROG: Bytes sent on this bundle for rate limit drop
+                if( $devdetails->hasCap('arbor-bundle-ratelimit') )
+                {
+                    push( @btemplates, 'Arbor_E::arbor-bundle-ratelimit' );
+                }
+
+                # Build tree
+                $cb->addSubtree( $offerTop, $bundleName,
+                                 $bparam, \@btemplates );
+            } # END: foreach $bundleID
+        } # END: foreach $offerNameID
+    } # END: hasCap arbor-bundle
+
+    # Flow device lookups
+    if( $devdetails->hasCap('arbor-flowLookup') )
+    {
+        # PROG: Flow Lookup Device (pool names)
+        my $flowNode = $cb->addSubtree( $devNode, 'Flow_Lookup',
+                                      { 'comment' => 'Switching modules' },
+                                        undef );
+
+        my $flowLookup = $data->{'arbor_e'}{'flowModule'};
+
+        foreach my $flowDevIdx ( keys %{$flowLookup} )
+        {
+            my $flowNodeDev = $cb->addSubtree( $flowNode,
+                              'Flow_Lookup_' .  $flowDevIdx,
+                              { 'comment' => 'Switching module '
+                                              . $flowDevIdx },
+                              [ 'Arbor_E::arbor-flowlkup-subtree' ] );
+
+            # PROG: Find all the pool names and add Subtree
+            foreach my $flowPoolIdx ( keys %{$flowLookup->{$flowDevIdx}} )
+            {
+                my $poolName = $flowLookup->{$flowDevIdx}{$flowPoolIdx};
+
+                my $poolNode = $cb->addSubtree( $flowNodeDev, $poolName,
+                               { 'comment'        => 'Flow Pool: ' . $poolName,
+                                 'flowdev-index'  => $flowDevIdx,
+                                 'flowpool-index' => $flowPoolIdx,
+                                 'flowpool-name'  => $poolName,
+                                 'precedence'     => 1000 - $flowPoolIdx},
+                               [ 'Arbor_E::arbor-flowlkup-leaf' ] );
+            } # END: foreach my $flowPoolIdx
+        } # END: foreach my $flowDevIdx
+    } # END: hasCap arbor-flowLookup
+
+}
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/Arista.pm b/torrus/perllib/Torrus/DevDiscover/Arista.pm
new file mode 100644 (file)
index 0000000..bd18029
--- /dev/null
@@ -0,0 +1,144 @@
+#
+#  Copyright (C) 2009  Jon Nistor
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Arista.pm,v 1.1 2010-12-27 00:03:49 ivan Exp $
+# Jon Nistor <nistor at snickers.org>
+
+# Force10 Networks Real Time Operating System Software
+#
+# NOTE: Arista::x
+
+package Torrus::DevDiscover::Arista;
+
+use strict;
+use Torrus::Log;
+
+$Torrus::DevDiscover::registry{'Arista'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     'sysDescr'                => '1.3.6.1.2.1.1.1.0',
+     # Arista
+     'aristaProducts'  => '1.3.6.1.4.1.30065.1'
+
+     );
+
+
+# Not all interfaces are normally needed to monitor.
+# You may override the interface filtering in devdiscover-siteconfig.pl:
+# redefine $Torrus::DevDiscover::Arista::interfaceFilter
+# or define $Torrus::DevDiscover::Arista::interfaceFilterOverlay
+
+our $interfaceFilter;
+our $interfaceFilterOverlay;
+my %aristaInterfaceFilter;
+
+if( not defined( $interfaceFilter ) )
+{
+    $interfaceFilter = \%aristaInterfaceFilter;
+}
+
+
+# Key is some unique symbolic name, does not mean anything
+#  ifType is the number to match the interface type
+# ifDescr is the regexp to match the interface description
+%aristaInterfaceFilter =
+    (
+     'other' => {
+         'ifType'  => 1,                     # other
+     },
+     'lag'      => {
+         'ifType'  => 161,                   # ieee 802.3ad LAG groups
+                                             # added due to index too high
+     },
+     'loopback' => {
+         'ifType'  => 24,                    # softwareLoopback
+     },
+     'vlan' => {
+         'ifType'  => 136,                   # vlan
+                                             # added due to index too high
+     },
+
+    );
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'aristaProducts',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+
+    &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+        ($devdetails, $interfaceFilter);
+    
+    if( defined( $interfaceFilterOverlay ) )
+    {
+        &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+            ($devdetails, $interfaceFilterOverlay);
+    }
+
+    $devdetails->setCap('interfaceIndexingPersistent');
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    # PROG: Add comment for sysDescr
+    my $desc   = $dd->retrieveSnmpOIDs('sysDescr');
+    $data->{'param'}{'comment'} = $desc->{'sysDescr'};
+    
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+}
+
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/AscendMax.pm b/torrus/perllib/Torrus/DevDiscover/AscendMax.pm
new file mode 100644 (file)
index 0000000..4bf2bd8
--- /dev/null
@@ -0,0 +1,207 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: AscendMax.pm,v 1.1 2010-12-27 00:03:53 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Ascend (Lucent) MAX device discovery.
+
+# Tested with:
+#
+# MAX 4000, TAOS version 7.0.26
+
+# NOTE: SNMP version 1 is only supported. Because of version 1 and numerous
+# WAN DS0 interfaces, the discovery process may take few minutes.
+
+package Torrus::DevDiscover::AscendMax;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'AscendMax'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # ASCEND-MIB
+     'ASCEND-MIB::max' => '1.3.6.1.4.1.529.1.2',
+     # ASCEND-ADVANCED-AGENT-MIB
+     'ASCEND-ADVANCED-AGENT-MIB::wanLineTable' =>
+     '1.3.6.1.4.1.529.4.21',
+     'ASCEND-ADVANCED-AGENT-MIB::wanLineState' =>
+     '1.3.6.1.4.1.529.4.21.1.5',
+     'ASCEND-ADVANCED-AGENT-MIB::wanLineActiveChannels' =>
+     '1.3.6.1.4.1.529.4.21.1.7',
+     'ASCEND-ADVANCED-AGENT-MIB::wanLineSwitchedChannels' =>
+     '1.3.6.1.4.1.529.4.21.1.13'
+     );
+
+# Not all interfaces are normally needed to monitor.
+# You may override the interface filtering in devdiscover-siteconfig.pl:
+# redefine $Torrus::DevDiscover::AscendMax::interfaceFilter
+# or define $Torrus::DevDiscover::AscendMax::interfaceFilterOverlay
+
+our $interfaceFilter;
+our $interfaceFilterOverlay;
+my %ascMaxInterfaceFilter;
+
+if( not defined( $interfaceFilter ) )
+{
+    $interfaceFilter = \%ascMaxInterfaceFilter;
+}
+
+
+# Key is some unique symbolic name, does not mean anything
+# ifType is the number to match the interface type
+# ifDescr is the regexp to match the interface description
+%ascMaxInterfaceFilter =
+    (
+     'Console' => {
+         'ifType'  => 33                      # rs232
+         },
+     'E1' => {
+         'ifType'  => 19                      # e1
+         },
+     'wan_activeN' => {
+         'ifType'  => 23,                     # ppp
+         'ifDescr'  => '^wan\d+'
+         },
+     'wan_inactiveN' => {
+         'ifType'  => 1,                      # other
+         'ifDescr'  => '^wan\d+'
+         },
+     'wanidleN' => {
+         'ifType'  => 1,                      # other
+         'ifDescr'  => '^wanidle\d+'
+         },
+     'loopbacks' => {
+         'ifType'  => 24                      # softwareLoopback
+         }
+     );
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'ASCEND-MIB::max',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+
+    &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+        ($devdetails, $interfaceFilter);
+
+    if( defined( $interfaceFilterOverlay ) )
+    {
+        &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+            ($devdetails, $interfaceFilterOverlay);
+    }
+
+    $devdetails->setCap('interfaceIndexingPersistent');
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+
+    my $wanTableOid = $dd->oiddef('ASCEND-ADVANCED-AGENT-MIB::wanLineTable' );
+    my $stateOid =
+        $dd->oiddef('ASCEND-ADVANCED-AGENT-MIB::wanLineState' );
+    my $totalOid =
+        $dd->oiddef('ASCEND-ADVANCED-AGENT-MIB::wanLineSwitchedChannels' );
+
+    my $wanTable =  $session->get_table( -baseoid => $wanTableOid );
+    if( defined( $wanTable ) )
+    {
+        $devdetails->storeSnmpVars( $wanTable );
+        $devdetails->setCap('wanLineTable');
+
+        $data->{'ascend_wanLines'} = {};
+
+        foreach my $ifIndex ( $devdetails->getSnmpIndices( $stateOid ) )
+        {
+            # Check if the line State is 13(active)
+            if( $devdetails->snmpVar( $stateOid . '.' . $ifIndex) == 13 )
+            {
+                my $descr = $devdetails->snmpVar($dd->oiddef('ifDescr') .
+                                                 '.' . $ifIndex);
+
+                $data->{'ascend_wanLines'}{$ifIndex}{'description'} = $descr;
+                $data->{'ascend_wanLines'}{$ifIndex}{'channels'} =
+                    $devdetails->snmpVar( $totalOid . '.' . $ifIndex );
+            }
+        }
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    my $data = $devdetails->data();
+
+    my $callStatsNode = $cb->addSubtree( $devNode, 'Call_Statistics', undef,
+                                         ['AscendMax::ascend-totalcalls']);
+
+    foreach my $ifIndex ( sort {$a<=>$b} keys %{$data->{'ascend_wanLines'}} )
+    {
+        my $param = {};
+        $param->{'precedence'} = sprintf('%d', -10000 - $ifIndex);
+        $param->{'ascend-ifidx'} = $ifIndex;
+
+        my $nChannels = $data->{'ascend_wanLines'}{$ifIndex}{'channels'};
+        $param->{'upper-limit'} = $nChannels;
+        $param->{'graph-upper-limit'} = $nChannels;
+
+        my $subtreeName = $data->{'ascend_wanLines'}{$ifIndex}{'description'};
+        $subtreeName =~ s/\W/_/g;
+
+        $cb->addLeaf( $callStatsNode, $subtreeName, $param,
+                      ['AscendMax::ascend-line-stats']);
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/AxxessIT.pm b/torrus/perllib/Torrus/DevDiscover/AxxessIT.pm
new file mode 100644 (file)
index 0000000..12dc059
--- /dev/null
@@ -0,0 +1,351 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: AxxessIT.pm,v 1.1 2010-12-27 00:03:55 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# AxxessIT Ethernet over SDH switches, also known as
+# Cisco ONS 15305 and 15302 (by January 2005)
+# Probably later Cisco will update the software and it will need
+# another Torrus discovery module.
+# Company website: http://www.axxessit.no/
+
+# Tested with:
+#
+# Cisco ONS 15305 software release 1.1.1
+# Cisco ONS 15302
+
+
+    
+
+package Torrus::DevDiscover::AxxessIT;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'AxxessIT'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # AXXEDGE-MIB
+     'axxEdgeTypes'                  => '1.3.6.1.4.1.7546.1.4.1.1',
+     
+     'axxEdgeWanPortMapTable'         => '1.3.6.1.4.1.7546.1.4.1.2.5.1.2',
+     'axxEdgeWanPortMapSlotNumber'    => '1.3.6.1.4.1.7546.1.4.1.2.5.1.2.1.1',
+     'axxEdgeWanPortMapPortNumber'    => '1.3.6.1.4.1.7546.1.4.1.2.5.1.2.1.2',
+
+     'axxEdgeWanXPortMapTable'        => '1.3.6.1.4.1.7546.1.4.1.2.5.1.11',
+     'axxEdgeWanXPortMapSlotNumber'   => '1.3.6.1.4.1.7546.1.4.1.2.5.1.11.1.1',
+     'axxEdgeWanXPortMapPortNumber'   => '1.3.6.1.4.1.7546.1.4.1.2.5.1.11.1.2',
+     
+     'axxEdgeWanPortDescription'      => '1.3.6.1.4.1.7546.1.4.1.2.5.1.3.1.4',
+     'axxEdgeWanXPortDescription'     => '1.3.6.1.4.1.7546.1.4.1.2.5.1.12.1.4',
+     
+     'axxEdgeEthPortMapTable'         => '1.3.6.1.4.1.7546.1.4.1.2.6.1.2',
+     'axxEdgeEthPortMapSlotNumber'    => '1.3.6.1.4.1.7546.1.4.1.2.6.1.2.1.1',
+     'axxEdgeEthPortMapPortNumber'    => '1.3.6.1.4.1.7546.1.4.1.2.6.1.2.1.2',
+
+     'axxEdgeEthLanXPortMapTable'     => '1.3.6.1.4.1.7546.1.4.1.2.6.1.4',
+     'axxEdgeEthLanXPortMapSlotNumber' => '1.3.6.1.4.1.7546.1.4.1.2.6.1.4.1.1',
+     'axxEdgeEthLanXPortMapPortNumber' => '1.3.6.1.4.1.7546.1.4.1.2.6.1.4.1.2',
+     
+     'axxEdgeEthPortDescription'      => '1.3.6.1.4.1.7546.1.4.1.2.6.1.3.1.4',
+     'axxEdgeEthLanXPortDescription'  => '1.3.6.1.4.1.7546.1.4.1.2.6.1.5.1.4',
+     
+     'axxEdgeDcnManagementPortMode'    => '1.3.6.1.4.1.7546.1.4.1.2.3.2.1.0',
+     'axxEdgeDcnManagementPortIfIndex' => '1.3.6.1.4.1.7546.1.4.1.2.3.2.2.0',
+
+     # AXX155E-MIB (ONS 15302)
+     'axx155EDevices'                 => '1.3.6.1.4.1.7546.1.5.1.1',
+
+     'axx155EEthPortTable'            => '1.3.6.1.4.1.7546.1.5.1.2.6.1.2',
+     'axx155EEthPortIfIndex'          => '1.3.6.1.4.1.7546.1.5.1.2.6.1.2.1.2',
+     'axx155EEthPortName'             => '1.3.6.1.4.1.7546.1.5.1.2.6.1.2.1.3',
+     'axx155EEthPortType'             => '1.3.6.1.4.1.7546.1.5.1.2.6.1.2.1.4',
+
+     'axx155EDcnManagementPortMode'   => '1.3.6.1.4.1.7546.1.5.1.2.2.2.2.0',
+     'axx155EDcnManagementPortIfIndex' => '1.3.6.1.4.1.7546.1.5.1.2.2.2.3.0'
+     );
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $sysObjID = $devdetails->snmpVar( $dd->oiddef('sysObjectID') );
+    if( index( $sysObjID, $dd->oiddef('axxEdgeTypes') ) == 0 )
+    {
+        $devdetails->setCap('axxEdge');
+    }
+    elsif( index( $sysObjID, $dd->oiddef('axx155EDevices') ) == 0 )
+    {
+        $devdetails->setCap('axx155E');
+    }
+    else
+    {
+        return 0;
+    }
+
+    $devdetails->setCap('interfaceIndexingManaged');
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+
+    $data->{'param'}{'ifindex-map'} = '$IFIDX_IFINDEX';
+    
+    $data->{'nameref'}{'ifNick'}        = 'axxInterfaceNick';
+    $data->{'nameref'}{'ifSubtreeName'} = 'axxInterfaceNick';
+    $data->{'nameref'}{'ifComment'}     = 'axxInterfaceComment';
+    $data->{'nameref'}{'ifReferenceName'}  = 'axxInterfaceHumanName';
+
+    if( $devdetails->hasCap('axxEdge') )
+    {
+        my %map =
+            ( 'Wan' => {
+                'MapTable'      => 'axxEdgeWanPortMapTable',
+                'MapSlotNumber' => 'axxEdgeWanPortMapSlotNumber',
+                'MapPortNumber' => 'axxEdgeWanPortMapPortNumber',
+                'Description'   => 'axxEdgeWanPortDescription',
+                'ifNick'        => 'Wan_%d_%d',
+                'ifHuman'       => 'WAN %d/%d',
+                'ifComment'     => 'WAN slot %d, port %d' },
+
+              'WanX' => {
+                'MapTable'      => 'axxEdgeWanXPortMapTable',
+                'MapSlotNumber' => 'axxEdgeWanXPortMapSlotNumber',
+                'MapPortNumber' => 'axxEdgeWanXPortMapPortNumber',
+                'Description'   => 'axxEdgeWanXPortDescription',
+                'ifNick'        => 'WanX_%d_%d',
+                'ifHuman'       => 'WANX %d/%d',
+                'ifComment'     => 'WANX slot %d, port %d'  },
+              
+              'Eth' => {
+                'MapTable'      => 'axxEdgeEthPortMapTable',
+                'MapSlotNumber' => 'axxEdgeEthPortMapSlotNumber',
+                'MapPortNumber' => 'axxEdgeEthPortMapPortNumber',
+                'Description'   => 'axxEdgeEthPortDescription',
+                'ifNick'        => 'Eth_%d_%d',
+                'ifHuman'       => 'Ethernet %d/%d',
+                'ifComment'     => 'Ethernet interface: slot %d, port %d' },
+              
+              'EthLanX' => {
+                'MapTable'      => 'axxEdgeEthLanXPortMapTable',
+                'MapSlotNumber' => 'axxEdgeEthLanXPortMapSlotNumber',
+                'MapPortNumber' => 'axxEdgeEthLanXPortMapPortNumber',
+                'Description'   => 'axxEdgeEthLanXPortDescription',
+                'ifNick'        => 'EthLanX_%d_%d',
+                'ifHuman'       => 'Ethernet LANX %d/%d',
+                'ifComment'  => 'Ethernet LANX interface: slot %d, port %d' }
+              );
+
+        foreach my $type ( keys %map )
+        {
+            my $mapTable =
+                $session->get_table( -baseoid =>
+                                     $dd->oiddef($map{$type}{'MapTable'}) );
+            $devdetails->storeSnmpVars( $mapTable );
+            
+            my $descTable =
+                $session->get_table( -baseoid =>
+                                     $dd->oiddef($map{$type}{'Description'}) );
+            $devdetails->storeSnmpVars( $descTable );
+        
+            foreach my $ifIndex
+                ( $devdetails->
+                  getSnmpIndices($dd->oiddef($map{$type}{'MapSlotNumber'})) )
+            {
+                my $interface = $data->{'interfaces'}{$ifIndex};
+                next if not defined( $interface );
+
+                my $slot =
+                    $devdetails->snmpVar
+                    ($dd->oiddef($map{$type}{'MapSlotNumber'}) .'.'. $ifIndex);
+                my $port =
+                    $devdetails->snmpVar
+                    ($dd->oiddef($map{$type}{'MapPortNumber'}) .'.'. $ifIndex);
+            
+                my $desc =
+                    $devdetails->snmpVar
+                    ($dd->oiddef($map{$type}{'Description'}) .'.'.
+                     $slot .'.'. $port);
+                
+                $interface->{'param'}{'interface-index'} = $ifIndex;
+
+                $interface->{'axxInterfaceNick'} =
+                    sprintf( $map{$type}{'ifNick'}, $slot, $port );
+                
+                $interface->{'axxInterfaceHumanName'} =
+                    sprintf( $map{$type}{'ifHuman'}, $slot, $port );
+
+                $interface->{'axxInterfaceComment'} =
+                    sprintf( $map{$type}{'ifComment'}, $slot, $port );
+                if( length( $desc ) > 0 )
+                {
+                    $interface->{'axxInterfaceComment'} .= ' (' . $desc . ')';
+                }
+            }
+        }
+        
+        # Management interface
+        {
+            my $result = $dd->retrieveSnmpOIDs
+                ( 'axxEdgeDcnManagementPortMode',
+                  'axxEdgeDcnManagementPortIfIndex');
+
+            if( defined( $result ) )
+            {
+                if( $result->{'axxEdgeDcnManagementPortMode'} != 2 )
+                {
+                    Warning('Non-IP mode of Management port is not supported');
+                }
+                else
+                {
+                    my $ifIndex = $result->{'axxEdgeDcnManagementPortIfIndex'};
+                    
+                    my $interface = $data->{'interfaces'}{$ifIndex};
+            
+                    $interface->{'param'}{'interface-index'} = $ifIndex;
+
+                    $interface->{'axxInterfaceNick'} = 'Management';
+
+                    $interface->{'axxInterfaceHumanName'} = 'Management';
+
+                    $interface->{'axxInterfaceComment'} = 'Management port';
+                }
+            }
+        }
+    }
+    
+    if( $devdetails->hasCap('axx155E') )
+    {
+        my $ethTable =
+            $session->get_table( -baseoid =>
+                                 $dd->oiddef('axx155EEthPortTable') );
+        $devdetails->storeSnmpVars( $ethTable );
+
+        foreach my $port
+            ( $devdetails->
+              getSnmpIndices($dd->oiddef('axx155EEthPortIfIndex')) )
+        {
+            my $ifIndex =
+                $devdetails->snmpVar
+                ($dd->oiddef('axx155EEthPortIfIndex') .'.'. $port);
+
+            my $interface = $data->{'interfaces'}{$ifIndex};
+            next if not defined( $interface );
+
+            my $portName =
+                $devdetails->snmpVar
+                ($dd->oiddef('axx155EEthPortName') .'.'. $port);
+            
+            my $portType =
+                $devdetails->snmpVar
+                ($dd->oiddef('axx155EEthPortType') .'.'. $port);
+
+            $interface->{'param'}{'interface-index'} = $ifIndex;
+            
+            my $type = $portType == 1 ? 'Eth':'Wan';
+            
+            $interface->{'axxInterfaceNick'} =
+                sprintf( '%s_%d', $type, $port );
+            
+            $interface->{'axxInterfaceHumanName'} =
+                sprintf( '%s %d', $type, $port );
+            
+            $interface->{'axxInterfaceComment'} = '';
+            if( length( $portName ) > 0 )
+            {
+                $interface->{'axxInterfaceComment'} = $portName;
+            }
+        }
+        
+        # Management interface
+        {
+            my $result = $dd->retrieveSnmpOIDs
+                ( 'axx155EDcnManagementPortMode',
+                  'axx155EDcnManagementPortIfIndex');
+
+            if( defined( $result ) )
+            {
+                if( $result->{'axx155EDcnManagementPortMode'} != 2 )
+                {
+                    Warning('Non-IP mode of Management port is not supported');
+                }
+                else
+                {
+                    my $ifIndex = $result->{'axx155EDcnManagementPortIfIndex'};
+                    
+                    my $interface = $data->{'interfaces'}{$ifIndex};
+                    
+                    $interface->{'param'}{'interface-index'} = $ifIndex;
+                    
+                    $interface->{'axxInterfaceNick'} = 'Management';
+                    
+                    $interface->{'axxInterfaceHumanName'} = 'Management';
+                    
+                    $interface->{'axxInterfaceComment'} = 'Management port';
+                }
+            }
+        }
+    }
+    
+    foreach my $ifIndex ( keys %{$data->{'interfaces'}} )
+    {
+        if( not defined( $data->{'interfaces'}{$ifIndex}->
+                         {'param'}{'interface-index'} ) )
+        {
+            delete $data->{'interfaces'}{$ifIndex};
+        }
+    }    
+    
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/BetterNetworks.pm b/torrus/perllib/Torrus/DevDiscover/BetterNetworks.pm
new file mode 100644 (file)
index 0000000..c718799
--- /dev/null
@@ -0,0 +1,238 @@
+#  Copyright (C) 2004 Marc Haber
+#  Copyright (C) 2005 Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# $Id: BetterNetworks.pm,v 1.1 2010-12-27 00:03:55 ivan Exp $
+# Marc Haber <mh+torrus-devel@zugschlus.de>
+# Redesigned by Stanislav Sinyagin
+
+# Better Networks Ethernet Box
+
+package Torrus::DevDiscover::BetterNetworks;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'BetterNetworks'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     'BNEversion'          => '1.3.6.1.4.1.14848.2.1.1.1.0',
+     'BNElocation'         => '1.3.6.1.4.1.14848.2.1.1.2.0',
+     'BNEtempunit'         => '1.3.6.1.4.1.14848.2.1.1.3.0',
+     'BNEuptime'           => '1.3.6.1.4.1.14848.2.1.1.7.0',
+     'BNEsensorTable'      => '1.3.6.1.4.1.14848.2.1.2',
+     'BNEsensorName'       => '1.3.6.1.4.1.14848.2.1.2.1.2',
+     'BNEsensorType'       => '1.3.6.1.4.1.14848.2.1.2.1.3',
+     'BNEsensorValid'      => '1.3.6.1.4.1.14848.2.1.2.1.7',
+     );
+
+
+our %sensorTypes =
+    (
+     1 => {
+         'comment' => 'Temperature sensor',
+     },
+     2 => {
+         'comment' => 'Brightness sensor',
+         'label' => 'Lux',
+     },
+     3 => {
+         'comment' => 'Humidity sensor',
+         'label' => 'Percent RH',
+     },
+     4 => {
+         'comment' => 'Switch contact',
+     },
+     5 => {
+         'comment' => 'Voltage meter',
+     },
+     6 => {
+         'comment' => 'Smoke sensor',
+     },
+     );
+
+our %tempUnits =
+    (
+     0 => 'Celsius',
+     1 => 'Fahrenheit',
+     2 => 'Kelvin'
+     );
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->checkSnmpOID( 'BNEuptime' ) )
+    {
+        return 0;
+    }
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+
+    my $unitInfo = $dd->retrieveSnmpOIDs('BNEversion',
+                                         'BNElocation',
+                                         'BNEtempunit');
+    if( not defined( $unitInfo ) )
+    {
+        Error('Error retrieving Better Networks Ethernet Box device details');
+        return 0;
+    }
+    
+    # sensor support
+    my $sensorTable = $session->get_table( -baseoid =>
+                                           $dd->oiddef('BNEsensorTable') );
+    if( defined( $sensorTable ) )
+    {
+        $devdetails->storeSnmpVars( $sensorTable );
+
+        # store the sensor names to guarantee uniqueness
+        my %sensorNames;
+            
+        foreach my $INDEX
+            ( $devdetails->getSnmpIndices($dd->oiddef('BNEsensorName') ) )
+        {
+            if( $devdetails->snmpVar( $dd->oiddef('BNEsensorValid') .
+                                      '.' . $INDEX ) == 0 )
+            {
+                next;
+            }
+                
+            my $type = $devdetails->snmpVar( $dd->oiddef('BNEsensorType') .
+                                             '.' . $INDEX );
+            my $name = $devdetails->snmpVar( $dd->oiddef('BNEsensorName')
+                                             . '.' . $INDEX );
+
+            if( $sensorNames{$name} )
+            {
+                Warn('Duplicate sensor names: ' . $name);
+                $sensorNames{$name}++;
+            }
+            else
+            {
+                $sensorNames{$name} = 1;
+            }
+
+            if( $sensorNames{$name} > 1 )
+            {
+                $name .= sprintf(' %d', $sensorNames{$name});
+            }
+            
+            my $leafName = $name;
+            $leafName =~ s/\W/_/g;
+
+            my $param = {
+                'bne-sensor-index' => $INDEX,
+                'node-display-name' => $name,
+                'precedence' => sprintf('%d', 1000 - $INDEX)
+                };
+            
+            if( defined( $sensorTypes{$type} ) )
+            {
+                $param->{'comment'} =
+                    sprintf('%s: %s', $sensorTypes{$type}{'comment'}, $name);
+                if( $type != 1 )
+                {
+                    if( defined( $sensorTypes{$type}{'label'} ) )
+                    {
+                        $param->{'vertical-label'} =
+                            $sensorTypes{$type}{'label'};
+                    }
+                }
+                else
+                {
+                    $param->{'vertical-label'} =
+                        $tempUnits{$unitInfo->{'BNEtempunit'}};
+                }
+            }
+            else
+            {
+                $param->{'comment'} = 'Unknown sensor type';
+            }
+
+            $data->{'BNEsensor'}{$INDEX}{'param'} = $param;
+            $data->{'BNEsensor'}{$INDEX}{'leafName'} = $leafName;            
+        }
+
+        if( scalar( %{$data->{'BNEsensor'}} ) > 0 )
+        {
+            $devdetails->setCap('BNEsensor');
+
+            my $devComment = 
+                'BetterNetworks EthernetBox, ' . $unitInfo->{'BNEversion'};
+            if( $unitInfo->{'BNElocation'} =~ /\w/ )
+            {
+                $devComment .= ', Location: ' . 
+                    $unitInfo->{'BNElocation'};
+            }
+            $data->{'param'}{'comment'} = $devComment;
+        }
+    }
+    
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    my $data = $devdetails->data();
+
+    if( $devdetails->hasCap('BNEsensor') )
+    {
+        foreach my $INDEX ( sort {$a<=>$b} keys %{$data->{'BNEsensor'}} )
+        {
+            my $param = $data->{'BNEsensor'}{$INDEX}{'param'};
+            my $leafName = $data->{'BNEsensor'}{$INDEX}{'leafName'};
+            
+            $cb->addLeaf( $devNode, $leafName, $param,
+                          ['BetterNetworks::betternetworks-sensor'] );
+        }
+    }
+}
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/CasaCMTS.pm b/torrus/perllib/Torrus/DevDiscover/CasaCMTS.pm
new file mode 100644 (file)
index 0000000..90b4163
--- /dev/null
@@ -0,0 +1,268 @@
+#  Copyright (C) 2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: CasaCMTS.pm,v 1.1 2010-12-27 00:03:47 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# DOCSIS interface, CASA specific
+
+package Torrus::DevDiscover::CasaCMTS;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'CasaCMTS'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+$Torrus::DevDiscover::RFC2863_IF_MIB::knownSelectorActions{
+    'DocsisMacModemsMonitor'} = 'CasaCMTS';
+
+
+our %oiddef =
+    (
+     'casaProducts' => '1.3.6.1.4.1.20858.2',
+     );
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+    
+    if( not $dd->oidBaseMatch
+        ( 'casaProducts',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) or
+        not $devdetails->isDevType('RFC2670_DOCS_IF') )
+    {
+        return 0;
+    }
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    
+    push( @{$data->{'docsConfig'}{'docsCableMaclayer'}{'templates'}},
+          'CasaCMTS::casa-docsis-mac-subtree' );
+    
+    foreach my $ifIndex ( @{$data->{'docsCableMaclayer'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+
+        push( @{$interface->{'docsTemplates'}},
+              'CasaCMTS::casa-docsis-mac-util' );
+    }
+
+    foreach my $ifIndex ( @{$data->{'docsCableUpstream'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+
+        push( @{$interface->{'docsTemplates'}},
+              'CasaCMTS::casa-docsis-upstream-util' );
+    }
+    
+    foreach my $ifIndex ( @{$data->{'docsCableDownstream'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+        
+        push( @{$interface->{'docsTemplates'}},
+              'CasaCMTS::casa-docsis-downstream-util' );
+    }
+    
+    
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    my $data = $devdetails->data();
+
+
+    if( scalar( @{$data->{'docsCableMaclayer'}} ) > 0 )
+    {
+        # Build All_Modems summary graph
+        my $param = {
+            'ds-type'              => 'rrd-multigraph',
+            'ds-names'             => 'total,active,registered',        
+            'graph-lower-limit'    => '0',
+            'precedence'           => '1000',                          
+            'vertical-label'       => 'Modems',
+                
+            'graph-legend-total'   => 'Total',
+            'line-style-total'     => '##totalresource',
+            'line-color-total'     => '##totalresource',
+            'line-order-total'     => '1',
+            
+            'graph-legend-active'  => 'Active',
+            'line-style-active'    => '##resourcepartusage',
+            'line-color-active'    => '##resourcepartusage',
+            'line-order-active'    => '2',
+            
+            'graph-legend-registered'  => 'Registered',
+            'line-style-registered'    => '##resourceusage',
+            'line-color-registered'    => '##resourceusage',
+            'line-order-registered'    => '3',
+            'descriptive-nickname'     => '%system-id%: All modems'
+            };
+
+        # for the sake of better Emacs formatting
+        $param->{'comment'} =
+            'Registered, Active and Total modems on CMTS';
+        
+        $param->{'nodeid'} =
+            $data->{'docsConfig'}{'docsCableMaclayer'}{'nodeidCategory'} .
+            '//%nodeid-device%//modems';
+        
+        my $first = 1;
+        foreach my $ifIndex ( @{$data->{'docsCableMaclayer'}} )
+        {
+            my $interface = $data->{'interfaces'}{$ifIndex};
+            
+            my $intf = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
+            
+            if( $first )
+            {
+                $param->{'ds-expr-total'} =
+                    '{' . $intf . '/Modems_Total}';
+                $param->{'ds-expr-active'} =
+                    '{' . $intf . '/Modems_Active}';
+                $param->{'ds-expr-registered'} =
+                    '{' . $intf . '/Modems_Registered}';
+                $first = 0;
+            }
+            else
+            {
+                $param->{'ds-expr-total'} .=
+                    ',{' . $intf . '/Modems_Total},+';
+                $param->{'ds-expr-active'} .=
+                    ',{' . $intf . '/Modems_Active},+';
+                $param->{'ds-expr-registered'} .=
+                    ',{' . $intf . '/Modems_Registered},+';
+            }
+        }
+
+        my $macNode =
+            $cb->getChildSubtree( $devNode,
+                                  $data->{'docsConfig'}{
+                                      'docsCableMaclayer'}{
+                                          'subtreeName'} );
+        if( defined( $macNode ) )
+        {
+            $cb->addLeaf( $macNode, 'All_Modems', $param, [] );
+        }
+        else
+        {
+            Error('Could not find the MAC layer subtree');
+            exit 1;
+        }
+        
+        # Apply selector actions
+        foreach my $ifIndex ( @{$data->{'docsCableMaclayer'}} )
+        {
+            my $interface = $data->{'interfaces'}{$ifIndex};
+            
+            my $intf = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
+            
+            my $monitor =
+                $interface->{'selectorActions'}{'DocsisMacModemsMonitor'};
+            if( defined( $monitor ) )
+            {
+                my $intfNode = $cb->getChildSubtree( $macNode, $intf );
+                $cb->addLeaf( $intfNode, 'Modems_Registered',
+                              {'monitor' => $monitor } );
+            }
+        }
+    }
+
+    if( scalar( @{$data->{'docsCableUpstream'}} ) > 0 )
+    {
+        my $upstrNode =
+            $cb->getChildSubtree( $devNode,
+                                  $data->{'docsConfig'}{'docsCableUpstream'}{
+                                      'subtreeName'} );
+        
+        # Override the overview shortcus defined in rfc2670.docsis-if.xml
+        
+        my $shortcuts = 'snr,fec,freq,modems';
+        
+        my $param = {        
+            'overview-shortcuts' =>
+                $shortcuts,
+                
+                'overview-subleave-name-modems' => 'Modems',
+                'overview-direct-link-modems' => 'yes',
+                'overview-direct-link-view-modems' => 'expanded-dir-html',
+                'overview-shortcut-text-modems' => 'All modems',
+                'overview-shortcut-title-modems'=>
+                'Show modem quantities in one page',
+                'overview-page-title-modems' => 'Modem quantities',
+            };
+        
+        $cb->addParams( $upstrNode, $param );
+    }
+    
+    if( scalar( @{$data->{'docsCableDownstream'}} ) > 0 )
+    {
+        my $downstrNode =
+            $cb->getChildSubtree( $devNode,
+                                  $data->{'docsConfig'}{'docsCableDownstream'}{
+                                      'subtreeName'} );
+        
+        # Override the overview shortcus defined in rfc2670.docsis-if.xml
+        
+        my $shortcuts = 'util,modems';
+        
+        my $param = {        
+            'overview-shortcuts' => $shortcuts,
+            'overview-subleave-name-modems' => 'Modems',
+            'overview-direct-link-modems' => 'yes',
+            'overview-direct-link-view-modems' => 'expanded-dir-html',
+            'overview-shortcut-text-modems' => 'All modems',
+            'overview-shortcut-title-modems' =>
+                'Show modem quantities in one page',
+            'overview-page-title-modems' => 'Modem quantities',
+            };
+        
+        $cb->addParams( $downstrNode, $param );
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/CiscoCatOS.pm b/torrus/perllib/Torrus/DevDiscover/CiscoCatOS.pm
new file mode 100644 (file)
index 0000000..411d72f
--- /dev/null
@@ -0,0 +1,193 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: CiscoCatOS.pm,v 1.1 2010-12-27 00:03:55 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Cisco CatOS devices discovery
+# To do:
+#    Power supply and temperature monitoring
+#    RAM monitoring
+
+package Torrus::DevDiscover::CiscoCatOS;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'CiscoCatOS'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # CISCO-SMI
+     'ciscoWorkgroup'                    => '1.3.6.1.4.1.9.5',
+     # CISCO-STACK-MIB
+     'CISCO-STACK-MIB::portName'         => '1.3.6.1.4.1.9.5.1.4.1.1.4',
+     'CISCO-STACK-MIB::portIfIndex'      => '1.3.6.1.4.1.9.5.1.4.1.1.11',
+     'CISCO-STACK-MIB::chassisSerialNumberString' =>
+     '1.3.6.1.4.1.9.5.1.2.19.0'
+     );
+
+
+# Not all interfaces are normally needed to monitor.
+# You may override the interface filtering in devdiscover-siteconfig.pl:
+# redefine $Torrus::DevDiscover::CiscoCatOS::interfaceFilter
+# or define $Torrus::DevDiscover::CiscoCatOS::interfaceFilterOverlay
+
+our $interfaceFilter;
+our $interfaceFilterOverlay;
+my %catOsInterfaceFilter;
+
+if( not defined( $interfaceFilter ) )
+{
+    $interfaceFilter = \%catOsInterfaceFilter;
+}
+
+
+# Key is some unique symbolic name, does not mean anything
+# ifType is the number to match the interface type
+# ifDescr is the regexp to match the interface description
+%catOsInterfaceFilter =
+    (
+     'VLAN N' => {
+         'ifType'  => 53,                     # propVirtual
+         'ifDescr' => '^VLAN\s+\d+'
+         },
+     );
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'ciscoWorkgroup',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+
+    &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+        ($devdetails, $interfaceFilter);
+
+    if( defined( $interfaceFilterOverlay ) )
+    {
+        &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+            ($devdetails, $interfaceFilterOverlay);
+    }
+
+    $devdetails->setCap('interfaceIndexingManaged');
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    $data->{'nameref'}{'ifReferenceName'} = 'ifName';
+    $data->{'nameref'}{'ifSubtreeName'} = 'ifNameT';
+    $data->{'param'}{'ifindex-table'} = '$ifName';
+
+    $data->{'nameref'}{'ifComment'} = 'portName';
+    
+    # Retrieve port descriptions from CISCO-STACK-MIB
+
+    my $portIfIndexOID = $dd->oiddef('CISCO-STACK-MIB::portIfIndex');
+    my $portNameOID = $dd->oiddef('CISCO-STACK-MIB::portName');
+
+    my $portIfIndex = $session->get_table( -baseoid => $portIfIndexOID );
+    if( defined $portIfIndex )
+    {
+        $devdetails->storeSnmpVars( $portIfIndex );
+
+        my $portName = $session->get_table( -baseoid => $portNameOID );
+        if( defined $portName )
+        {
+            foreach my $portIndex
+                ( $devdetails->getSnmpIndices( $portIfIndexOID ) )
+            {
+                my $ifIndex =
+                    $devdetails->snmpVar( $portIfIndexOID .'.'. $portIndex );
+                my $interface = $data->{'interfaces'}{$ifIndex};
+
+                $interface->{'portName'} =
+                    $portName->{$portNameOID .'.'. $portIndex};
+            }
+        }        
+    }
+
+    # In large installations, only named ports may be of interest
+    if( $devdetails->param('CiscoCatOS::suppress-noname-ports') eq 'yes' )
+    {
+        my $nExcluded = 0;
+        foreach my $ifIndex ( keys %{$data->{'interfaces'}} )
+        {
+            my $interface = $data->{'interfaces'}{$ifIndex};
+            if( not defined( $interface->{'portName'} ) or
+                length( $interface->{'portName'} ) == 0 )
+            {
+                $interface->{'excluded'} = 1;
+                $nExcluded++;
+            }            
+        }
+        Debug('Excluded ' . $nExcluded . ' catalyst ports with empty names');
+    }
+
+    my $chassisSerial =
+        $dd->retrieveSnmpOIDs( 'CISCO-STACK-MIB::chassisSerialNumberString' );
+    if( defined( $chassisSerial ) )
+    {
+        if( defined( $data->{'param'}{'comment'} ) )
+        {
+            $data->{'param'}{'comment'} .= ', ';
+        }
+        $data->{'param'}{'comment'} .= 'Hw Serial#: ' .
+            $chassisSerial->{'CISCO-STACK-MIB::chassisSerialNumberString'};
+    }
+    
+    return 1;
+}
+
+
+# Nothing really to do yet
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/CiscoFirewall.pm b/torrus/perllib/Torrus/DevDiscover/CiscoFirewall.pm
new file mode 100644 (file)
index 0000000..b27cfb4
--- /dev/null
@@ -0,0 +1,142 @@
+#  Copyright (C) 2003  Shawn Ferry
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: CiscoFirewall.pm,v 1.1 2010-12-27 00:03:56 ivan Exp $
+# Shawn Ferry <lalartu at obscure dot org> <sferry at sevenspace dot com>
+
+# Cisco Firewall devices discovery
+
+package Torrus::DevDiscover::CiscoFirewall;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'CiscoFirewall'} = {
+    'sequence'     => 510,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # CISCO-FIREWALL
+     'ciscoFirewallMIB'            => '1.3.6.1.4.1.9.9.147',
+     'cfwBasicEventsTableLastRow'  => '1.3.6.1.4.1.9.9.147.1.1.4',
+     'cfwConnectionStatTable'      => '1.3.6.1.4.1.9.9.147.1.2.2.2.1',
+     'cfwConnectionStatMax'        => '1.3.6.1.4.1.9.9.147.1.2.2.2.1.5.40.7',
+     );
+
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    if( $devdetails->isDevType('CiscoGeneric') and
+        $dd->checkSnmpTable('ciscoFirewallMIB') )
+    {
+        $devdetails->setCap('interfaceIndexingManaged');
+        return 1;
+    }
+
+    return 0;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+
+    $data->{'nameref'}{'ifReferenceName'} = 'ifName';
+    $data->{'nameref'}{'ifSubtreeName'} = 'ifNameT';
+    $data->{'param'}{'ifindex-table'} = '$ifName';
+
+    if( not defined( $data->{'param'}{'snmp-oids-per-pdu'} ) )
+    {
+        my $oidsPerPDU =
+            $devdetails->param('CiscoFirewall::snmp-oids-per-pdu');
+        if( $oidsPerPDU == 0 )
+        {
+            $oidsPerPDU = 10;
+        }
+        $data->{'param'}{'snmp-oids-per-pdu'} = $oidsPerPDU;
+    }
+
+    if( $dd->checkSnmpOID('cfwConnectionStatMax') )
+    {
+        $devdetails->setCap('CiscoFirewall::connections');
+    }
+    
+    # I have not seen a system that supports this.
+    if( $dd->checkSnmpOID('cfwBasicEventsTableLastRow') )
+    {
+        $devdetails->setCap('CiscoFirewall::events');
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+    my $fwStatsTree = "Firewall_Stats";
+    my $fwStatsParam = {
+        'precedence' => '-1000',
+        'comment'    => 'Firewall Stats',
+    };
+
+    my @templates = ('CiscoFirewall::cisco-firewall-subtree');
+    
+    if( $devdetails->hasCap('CiscoFirewall::connections') )
+    {
+        push( @templates, 'CiscoFirewall::connections');
+    }
+
+    if( $devdetails->hasCap('CiscoFirewall::events') )
+    {
+        push( @templates, 'CiscoFirewall::events');
+    }
+
+    $cb->addSubtree( $devNode, $fwStatsTree, $fwStatsParam, \@templates );
+}
+
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/CiscoGeneric.pm b/torrus/perllib/Torrus/DevDiscover/CiscoGeneric.pm
new file mode 100644 (file)
index 0000000..4262bdd
--- /dev/null
@@ -0,0 +1,743 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: CiscoGeneric.pm,v 1.1 2010-12-27 00:03:48 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Common Cisco MIBs, supported by many IOS and CatOS devices
+
+package Torrus::DevDiscover::CiscoGeneric;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'CiscoGeneric'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # CISCO-SMI
+     'cisco'                             => '1.3.6.1.4.1.9',
+
+     # CISCO-ENVMON-MIB
+     'ciscoEnvMonTemperatureStatusDescr' => '1.3.6.1.4.1.9.9.13.1.3.1.2',
+     'ciscoEnvMonTemperatureStatusValue' => '1.3.6.1.4.1.9.9.13.1.3.1.3',
+     'ciscoEnvMonTemperatureThreshold'   => '1.3.6.1.4.1.9.9.13.1.3.1.4',
+     'ciscoEnvMonTemperatureStatusState' => '1.3.6.1.4.1.9.9.13.1.3.1.6',
+     'ciscoEnvMonSupplyState'            => '1.3.6.1.4.1.9.9.13.1.5.1.3',
+
+     # CISCO-ENHANCED-MEMPOOL-MIB
+     'cempMemPoolName'                   => '1.3.6.1.4.1.9.9.221.1.1.1.1.3',
+     
+     # CISCO-MEMORY-POOL-MIB
+     'ciscoMemoryPoolName'               => '1.3.6.1.4.1.9.9.48.1.1.1.2',
+
+     # CISCO-PROCESS-MIB
+     'cpmCPUTotalTable'                  => '1.3.6.1.4.1.9.9.109.1.1.1.1',
+     'cpmCPUTotalPhysicalIndex'          => '1.3.6.1.4.1.9.9.109.1.1.1.1.2',
+     'cpmCPUTotal1minRev'                => '1.3.6.1.4.1.9.9.109.1.1.1.1.7',
+     'cpmCPUTotal1min'                   => '1.3.6.1.4.1.9.9.109.1.1.1.1.4',
+
+     # OLD-CISCO-CPU-MIB
+     'avgBusy1'                          => '1.3.6.1.4.1.9.2.1.57.0'
+     );
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'cisco', $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+    
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    if( $devdetails->param('CiscoGeneric::disable-sensors') ne 'yes' )
+    {
+        # Check if temperature sensors are supported
+
+        my $oidTempDescr = $dd->oiddef('ciscoEnvMonTemperatureStatusDescr');
+        my $oidTempValue = $dd->oiddef('ciscoEnvMonTemperatureStatusValue');
+        my $oidTempThrsh = $dd->oiddef('ciscoEnvMonTemperatureThreshold');
+        my $oidTempState = $dd->oiddef('ciscoEnvMonTemperatureStatusState');
+
+        if( defined $session->get_table( -baseoid => $oidTempValue ) )
+        {
+            $devdetails->setCap('ciscoTemperatureSensors');
+            $data->{'ciscoTemperatureSensors'} = {};
+
+            my $tempDescr = $session->get_table( -baseoid => $oidTempDescr );
+            my $tempThrsh = $session->get_table( -baseoid => $oidTempThrsh );
+
+            # Get the sensor states and ignore those notPresent(5)
+
+            my $tempState = $session->get_table( -baseoid => $oidTempState );
+
+            my $prefixLen = length( $oidTempDescr ) + 1;
+            while( my( $oid, $descr ) = each %{$tempDescr} )
+            {
+                # Extract the sensor index from OID
+                my $sIndex = substr( $oid, $prefixLen );
+
+                if( $tempState->{$oidTempState.'.'.$sIndex} != 5 )
+                {
+                    $data->{'ciscoTemperatureSensors'}{$sIndex}{
+                        'description'} = $descr;
+                    $data->{'ciscoTemperatureSensors'}{$sIndex}{
+                        'threshold'} = $tempThrsh->{$oidTempThrsh.'.'.$sIndex};
+                }
+            }
+        }
+    }
+
+    if( $devdetails->param('CiscoGeneric::disable-psupplies') ne 'yes' )
+    {
+        # Check if power supply status is supported
+
+        my $oidSupply = $dd->oiddef('ciscoEnvMonSupplyState');
+
+        my $supplyTable = $session->get_table( -baseoid => $oidSupply );
+        if( defined( $supplyTable ) )
+        {
+            $devdetails->setCap('ciscoPowerSupplies');
+            $data->{'ciscoPowerSupplies'} = [];
+            
+            my $prefixLen = length( $oidSupply ) + 1;
+            while( my( $oid, $val ) = each %{$supplyTable} )
+            {
+                # Extract the supply index from OID
+                my $sIndex = substr( $oid, $prefixLen );
+                
+                #check if the value is not notPresent(5)
+                if( $val != 5 )
+                {
+                    push( @{$data->{'ciscoPowerSupplies'}}, $sIndex );
+                }
+            }
+        }
+    }
+    
+    if( $devdetails->param('CiscoGeneric::disable-memory-pools') ne 'yes' )
+    {
+        my $eMemPool =
+            $session->get_table( -baseoid =>
+                                 $dd->oiddef('cempMemPoolName') );
+        if( defined $eMemPool and scalar( %{$eMemPool} ) > 0 and
+            $devdetails->isDevType('RFC2737_ENTITY_MIB') )
+        {
+            $devdetails->storeSnmpVars( $eMemPool );
+            $devdetails->setCap('cempMemPool');
+            $data->{'cempMemPool'} = {};
+
+            foreach my $INDEX
+                ( $devdetails->
+                  getSnmpIndices($dd->oiddef('cempMemPoolName') ) )
+            {
+                # $INDEX is a pair entPhysicalIndex . cempMemPoolIndex
+                my ( $phyIndex, $poolIndex ) = split('\.', $INDEX);
+
+                my $poolName = $devdetails->
+                    snmpVar($dd->oiddef('cempMemPoolName') . '.' . $INDEX );
+
+                $poolName = 'Processor' unless $poolName;
+                
+                my $phyDescr = $data->{'entityPhysical'}{$phyIndex}{'descr'};
+                my $phyName = $data->{'entityPhysical'}{$phyIndex}{'name'};
+                
+                $phyDescr = 'Processor' unless $phyDescr;
+                $phyName = ('Chassis #' .
+                            $phyIndex) unless $phyName;
+               
+                $data->{'cempMemPool'}{$INDEX} = {
+                    'phyIndex'     => $phyIndex,
+                    'poolIndex'    => $poolIndex,
+                    'poolName'     => $poolName,                    
+                    'phyDescr' => $phyDescr,
+                    'phyName'  => $phyName
+                    };
+            }
+        }
+        else
+        {
+            my $MemoryPool =
+                $session->get_table( -baseoid =>
+                                     $dd->oiddef('ciscoMemoryPoolName') );
+
+            if( defined $MemoryPool and scalar( %{$MemoryPool} ) > 0 )
+            {
+                $devdetails->storeSnmpVars( $MemoryPool );
+                $devdetails->setCap('ciscoMemoryPool');
+                
+                $data->{'ciscoMemoryPool'} = {};
+                
+                foreach my $memType
+                    ( $devdetails->
+                      getSnmpIndices($dd->oiddef('ciscoMemoryPoolName')) )
+                {
+                    # According to CISCO-MEMORY-POOL-MIB, only types 1 to 5
+                    # are static, and the rest are dynamic
+                    # (of which none ever seen)
+                    if( $memType <= 5 )
+                    {
+                        my $name =
+                            $devdetails->
+                            snmpVar($dd->oiddef('ciscoMemoryPoolName') .
+                                    '.' . $memType );
+
+                        $data->{'ciscoMemoryPool'}{$memType} = $name;
+                    }
+                }
+            }
+        }
+    }
+
+    if( $devdetails->param('CiscoGeneric::disable-cpu-stats') ne 'yes' )
+    {
+        my $ciscoCpuStats =
+            $session->get_table( -baseoid => $dd->oiddef('cpmCPUTotalTable') );
+
+        if( defined $ciscoCpuStats )
+        {
+            $devdetails->setCap('ciscoCpuStats');
+            $devdetails->storeSnmpVars( $ciscoCpuStats );
+
+            $data->{'ciscoCpuStats'} = {};
+
+            # Find multiple CPU entries pointing to the same Phy index
+            my %phyReferers = ();            
+            foreach my $INDEX
+                ( $devdetails->
+                  getSnmpIndices($dd->oiddef('cpmCPUTotalPhysicalIndex') ) )
+            {
+                my $phyIndex = $devdetails->
+                    snmpVar($dd->oiddef('cpmCPUTotalPhysicalIndex') .
+                            '.' . $INDEX );
+                $phyReferers{$phyIndex}++;
+            }
+                
+            foreach my $INDEX
+                ( $devdetails->
+                  getSnmpIndices($dd->oiddef('cpmCPUTotalPhysicalIndex') ) )
+            {
+                $data->{'ciscoCpuStats'}{$INDEX} = {};
+
+                my $phyIndex = $devdetails->
+                    snmpVar($dd->oiddef('cpmCPUTotalPhysicalIndex') .
+                            '.' . $INDEX );
+                
+                my $phyDescr;
+                my $phyName;
+                
+                if( $phyIndex > 0 and
+                    $devdetails->isDevType('RFC2737_ENTITY_MIB') )
+                {
+                    $phyDescr = $data->{'entityPhysical'}{$phyIndex}{'descr'};
+                    $phyName = $data->{'entityPhysical'}{$phyIndex}{'name'};
+                }
+                
+                $phyDescr = 'Central Processor' unless $phyDescr;
+                $phyName = ('Chassis #' . $phyIndex) unless $phyName;
+                    ;
+                my $cpuNick = $phyName;
+                $cpuNick =~ s/^\///;
+                $cpuNick =~ s/\W/_/g;
+                $cpuNick =~ s/_+/_/g;
+
+                if( $phyReferers{$phyIndex} > 1 )
+                {
+                    $phyDescr .= ' (' . $INDEX . ')';
+                    $cpuNick .= '_' . $INDEX;
+                }
+                
+                $data->{'ciscoCpuStats'}{$INDEX} = {
+                    'phy-index'  => $phyIndex,
+                    'phy-name'   => $phyName,
+                    'phy-descr'  => $phyDescr,
+                    'phy-referers' => $phyReferers{$phyIndex},
+                    'cpu-nick'   => $cpuNick };
+                
+                if( $devdetails->hasOID( $dd->oiddef('cpmCPUTotal1minRev') .
+                                         '.' .  $INDEX ) )
+                {
+                    $data->{'ciscoCpuStats'}{$INDEX}{'stats-type'} = 'revised';
+                }
+            }
+        }
+        else
+        {
+            # Although OLD-CISCO-CPU-MIB is implemented in IOS only,
+            # it is easier to leave it here in Generic
+
+            if( $dd->checkSnmpOID('avgBusy1') )
+            {
+                $devdetails->setCap('old-ciscoCpuStats');
+                push( @{$data->{'templates'}}, 'CiscoGeneric::old-cisco-cpu' );
+            }
+        }
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    
+    my $data = $devdetails->data();
+
+    # Temperature Sensors
+
+    if( $devdetails->hasCap('ciscoTemperatureSensors') )
+    {
+        # Create a subtree for the sensors
+        my $subtreeName = 'Temperature_Sensors';
+
+        my $fahrenheit =
+            $devdetails->param('CiscoGeneric::use-fahrenheit') eq 'yes';
+
+        my $param = {
+            'node-display-name' => 'Temperature Sensors',
+        };
+        my $templates = [ 'CiscoGeneric::cisco-temperature-subtree' ];
+        
+        my $filePerSensor =
+            $devdetails->param('CiscoGeneric::file-per-sensor') eq 'yes';
+        
+        $param->{'data-file'} = '%snmp-host%_sensors' .
+            ($filePerSensor ? '_%sensor-index%':'') .
+            ($fahrenheit ? '_fahrenheit':'') . '.rrd';
+
+        my $subtreeNode = $cb->addSubtree( $devNode, $subtreeName,
+                                           $param, $templates );
+        
+        foreach my $sIndex ( sort {$a<=>$b} keys
+                             %{$data->{'ciscoTemperatureSensors'}} )
+        {
+            my $leafName = sprintf( 'sensor_%.2d', $sIndex );
+
+            my $desc =
+                $data->{'ciscoTemperatureSensors'}{$sIndex}{'description'};
+            my $threshold =
+                $data->{'ciscoTemperatureSensors'}{$sIndex}{'threshold'};
+
+            if( $fahrenheit )
+            {
+                $threshold = $threshold * 1.8 + 32;
+            }
+
+            my $param = {
+                'sensor-index'       => $sIndex,
+                'sensor-description' => $desc,
+                'upper-limit'        => $threshold
+                };
+
+            my $templates = ['CiscoGeneric::cisco-temperature-sensor' .
+                             ($fahrenheit ? '-fahrenheit':'')];
+
+            my $monitor = $data->{'ciscoTemperatureSensors'}{$sIndex}->{
+                'selectorActions'}{'Monitor'};
+            if( defined( $monitor ) )
+            {
+                $param->{'monitor'} = $monitor;
+            }
+
+            my $tset = $data->{'ciscoTemperatureSensors'}{$sIndex}->{
+                'selectorActions'}{'TokensetMember'};
+            if( defined( $tset ) )
+            {
+                $param->{'tokenset-member'} = $tset;
+            }
+
+            $cb->addLeaf( $subtreeNode, $leafName, $param, $templates );
+        }
+    }
+
+    # Power supplies
+
+    if( $devdetails->hasCap('ciscoPowerSupplies') )
+    {
+        # Create a subtree for the power supplies
+        my $subtreeName = 'Power_Supplies';
+
+        my $param = {
+            'node-display-name' => 'Power Supplies',
+            'comment' => 'Power supplies status',
+            'precedence' => -600,
+        };
+        my $templates = [];
+                
+        $param->{'data-file'} = '%system-id%_power.rrd';
+
+        my $monitor = $devdetails->param('CiscoGeneric::power-monitor');
+        if( length( $monitor ) > 0 )
+        {
+            $param->{'monitor'} = $monitor;
+        }
+
+        my $subtreeNode = $cb->addSubtree( $devNode, $subtreeName,
+                                           $param, $templates );
+        
+        foreach my $sIndex ( sort {$a<=>$b} @{$data->{'ciscoPowerSupplies'}} )
+        {
+            my $leafName = sprintf( 'power_%.2d', $sIndex );
+
+            my $param = {
+                'power-index'       => $sIndex
+                };
+
+            my $templates = ['CiscoGeneric::cisco-power-supply'];
+
+            $cb->addLeaf( $subtreeNode, $leafName, $param, $templates );
+        }
+    }
+
+    
+    # Memory Pools
+
+    if( $devdetails->hasCap('cempMemPool') or
+        $devdetails->hasCap('ciscoMemoryPool') )
+    {
+        my $subtreeName = 'Memory_Usage';
+
+        my $param = {
+            'node-display-name' => 'Memory Usage',
+            'precedence'        => '-100',
+            'comment'           => 'Router memory utilization'
+            };
+
+        my $subtreeNode =
+            $cb->addSubtree( $devNode, $subtreeName, $param,
+                             ['CiscoGeneric::cisco-memusage-subtree']);
+
+        if( $devdetails->hasCap('cempMemPool') )
+        {
+            foreach my $INDEX ( sort {
+                $data->{'cempMemPool'}{$a}{'phyIndex'} <=>
+                    $data->{'cempMemPool'}{$b}{'phyIndex'} or
+                    $data->{'cempMemPool'}{$a}{'poolIndex'} <=>
+                    $data->{'cempMemPool'}{$b}{'poolIndex'} }
+                                keys %{$data->{'cempMemPool'}} )
+            {
+                my $pool = $data->{'cempMemPool'}{$INDEX};
+
+                # Chop off the long chassis description, like
+                # uBR7246VXR chassis, Hw Serial#: XXXXX, Hw Revision: A
+                my $phyName = $pool->{'phyName'};                
+                if( $phyName =~ /chassis/ )
+                {
+                    $phyName =~ s/,.+//;
+                }
+                
+                my $poolSubtreeName =
+                    $phyName . '_' . $pool->{'poolName'};
+                $poolSubtreeName =~ s/^\///;
+                $poolSubtreeName =~ s/\W/_/g;
+                $poolSubtreeName =~ s/_+/_/g;
+                
+                my $param = {};
+
+                $param->{'comment'} =
+                    $pool->{'poolName'} . ' memory of ';
+                if( $pool->{'phyDescr'} eq $pool->{'phyName'} )
+                {
+                    $param->{'comment'} .= $phyName;
+                }
+                else
+                {
+                    $param->{'comment'} .= 
+                        $pool->{'phyDescr'} . ' in ' . $phyName;
+                }
+                
+                $param->{'mempool-index'} = $INDEX;
+                $param->{'mempool-phyindex'} = $pool->{'phyIndex'};
+                $param->{'mempool-poolindex'} = $pool->{'poolIndex'};
+                
+                $param->{'mempool-name'} =  $pool->{'poolName'};
+                $param->{'precedence'} =
+                    sprintf("%d", 1000 -
+                            $pool->{'phyIndex'} * 100 - $pool->{'poolIndex'});
+                
+                $cb->addSubtree( $subtreeNode, $poolSubtreeName, $param,
+                                 [ 'CiscoGeneric::cisco-enh-mempool' ]);
+            }
+        }
+        else
+        {
+            foreach my $memType
+                ( sort {$a<=>$b} keys %{$data->{'ciscoMemoryPool'}} )
+            {
+                my $poolName = $data->{'ciscoMemoryPool'}{$memType};
+                
+                my $poolSubtreeName = $poolName;
+                $poolSubtreeName =~ s/^\///;
+                $poolSubtreeName =~ s/\W/_/g;
+                $poolSubtreeName =~ s/_+/_/g;
+                
+                my $param = {
+                    'comment'      => 'Memory Pool: ' . $poolName,
+                    'mempool-type' => $memType,
+                    'mempool-name' => $poolName,
+                    'precedence'   => sprintf("%d", 1000 - $memType)
+                    };
+
+                $cb->addSubtree( $subtreeNode, $poolSubtreeName,
+                                 $param, [ 'CiscoGeneric::cisco-mempool' ]);
+            }
+        }
+    }
+
+    if( $devdetails->hasCap('ciscoCpuStats') )
+    {
+        my $subtreeName = 'CPU_Usage';
+        my $param = {
+            'node-display-name' => 'CPU Usage',
+            'precedence'         => '-500',
+            'comment'            => 'Overall CPU busy percentage'
+            };
+
+        my $subtreeNode =
+            $cb->addSubtree( $devNode, $subtreeName, $param,
+                             ['CiscoGeneric::cisco-cpu-usage-subtree']);
+        
+        foreach my $INDEX ( sort {$a<=>$b} keys %{$data->{'ciscoCpuStats'}} )
+        {
+            my $cpu = $data->{'ciscoCpuStats'}{$INDEX};
+
+            my $param = {
+                'comment' => $cpu->{'phy-descr'} . ' in ' . $cpu->{'phy-name'}
+                };
+
+            # On newer dual-CPU routers, several (two seen) CPU entries
+            # refer to the same physical entity. For such entries,
+            # we map them directly to cpmCPUTotalTable index.
+            if( $cpu->{'phy-referers'} > 1 )
+            {
+                $param->{'cisco-cpu-indexmap'} = $INDEX;
+                $param->{'cisco-cpu-ref'} = $INDEX;
+            }
+            else
+            {
+                $param->{'entity-phy-index'} = $cpu->{'phy-index'};
+                $param->{'cisco-cpu-ref'} = '%entity-phy-index%';
+            }
+            
+            my @templates;
+
+            if( $cpu->{'stats-type'} eq 'revised' )
+            {
+                push( @templates, 'CiscoGeneric::cisco-cpu-revised' );
+            }
+            else
+            {
+                push( @templates, 'CiscoGeneric::cisco-cpu' );
+            }
+            
+            my $cpuNode = $cb->addSubtree( $subtreeNode, $cpu->{'cpu-nick'},
+                                           $param, \@templates );
+            
+            my $tset = $cpu->{'selectorActions'}{'TokensetMember'};
+            if( defined( $tset ) )
+            {
+                $cb->addLeaf( $cpuNode, 'CPU_Total_1min',
+                              { 'tokenset-member' => $tset } );
+            }
+        }
+    }
+}
+
+
+
+#######################################
+# Selectors interface
+#
+
+$Torrus::DevDiscover::selectorsRegistry{'CiscoSensor'} = {
+    'getObjects'      => \&getSelectorObjects,
+    'getObjectName'   => \&getSelectorObjectName,
+    'checkAttribute'  => \&checkSelectorAttribute,
+    'applyAction'     => \&applySelectorAction,
+};
+
+$Torrus::DevDiscover::selectorsRegistry{'CiscoCPU'} = {
+    'getObjects'      => \&getSelectorObjects,
+    'getObjectName'   => \&getSelectorObjectName,
+    'checkAttribute'  => \&checkSelectorAttribute,
+    'applyAction'     => \&applySelectorAction,
+};
+
+## Objects are interface indexes
+
+sub getSelectorObjects
+{
+    my $devdetails = shift;
+    my $objType = shift;
+
+    my $data = $devdetails->data();
+    my @ret;
+    
+    if( $objType eq 'CiscoSensor' )
+    {
+        @ret = keys( %{$data->{'ciscoTemperatureSensors'}} );
+    }
+    elsif( $objType eq 'CiscoCPU' )
+    {
+        @ret = keys( %{$data->{'ciscoCpuStats'}} );
+    }
+
+    return( sort {$a<=>$b} @ret );
+}
+
+
+sub checkSelectorAttribute
+{
+    my $devdetails = shift;
+    my $object = shift;
+    my $objType = shift;
+    my $attr = shift;
+    my $checkval = shift;
+
+    my $data = $devdetails->data();
+    
+    my $value;
+    my $operator = '=~';
+    
+    if( $objType eq 'CiscoSensor' )
+    {
+        my $sensor = $data->{'ciscoTemperatureSensors'}{$object};
+        if( $attr eq 'SensorDescr' )
+        {
+            $value = $sensor->{'description'};
+        }
+        else
+        {
+            Error('Unknown CiscoSensor selector attribute: ' . $attr);
+            $value = '';
+        }
+    }
+    elsif( $objType eq 'CiscoCPU' )
+    {
+        my $cpu = $data->{'ciscoCpuStats'}{$object};
+        if( $attr eq 'CPUName' )
+        {
+            $value = $cpu->{'cpu-nick'};
+        }
+        elsif( $attr eq 'CPUDescr' )
+        {
+            $value = $cpu->{'cpu-descr'};
+        }
+        else
+        {
+            Error('Unknown CiscoCPU selector attribute: ' . $attr);
+            $value = '';
+        }        
+    }        
+    
+    return eval( '$value' . ' ' . $operator . '$checkval' ) ? 1:0;
+}
+
+
+sub getSelectorObjectName
+{
+    my $devdetails = shift;
+    my $object = shift;
+    my $objType = shift;
+    
+    my $data = $devdetails->data();
+    my $name;
+
+    if( $objType eq 'CiscoSensor' )
+    {
+        $name = $data->{'ciscoTemperatureSensors'}{$object}{'description'};
+    }
+    elsif( $objType eq 'CiscoCPU' )
+    {
+        $name = $data->{'ciscoCpuStats'}{$object}{'cpu-nick'};
+    }
+    return $name;
+}
+
+
+my %knownSelectorActions =
+    (
+     'CiscoSensor' => {
+         'Monitor' => 1,
+         'TokensetMember' => 1 },
+     'CiscoCPU' => {
+         'TokensetMember' => 1 }
+     );
+
+                            
+sub applySelectorAction
+{
+    my $devdetails = shift;
+    my $object = shift;
+    my $objType = shift;
+    my $action = shift;
+    my $arg = shift;
+
+    my $data = $devdetails->data();
+    my $objref;
+    if( $objType eq 'CiscoSensor' )
+    {
+        $objref = $data->{'ciscoTemperatureSensors'}{$object};
+    }
+    elsif( $objType eq 'CiscoCPU' )
+    {
+        $objref = $data->{'ciscoCpuStats'}{$object};
+    }
+    
+    if( $knownSelectorActions{$objType}{$action} )
+    {
+        $objref->{'selectorActions'}{$action} = $arg;
+    }
+    else
+    {
+        Error('Unknown Cisco selector action: ' . $action);
+    }
+}   
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/CiscoIOS.pm b/torrus/perllib/Torrus/DevDiscover/CiscoIOS.pm
new file mode 100644 (file)
index 0000000..6bd6d91
--- /dev/null
@@ -0,0 +1,687 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: CiscoIOS.pm,v 1.1 2010-12-27 00:03:47 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Cisco IOS devices discovery
+# To do:
+#   SA Agent MIB
+#   DiffServ MIB
+
+package Torrus::DevDiscover::CiscoIOS;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'CiscoIOS'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # CISCO-SMI
+     'ciscoProducts'                     => '1.3.6.1.4.1.9.1',
+     # CISCO-PRODUCTS-MIB
+     'ciscoLS1010'                       => '1.3.6.1.4.1.9.1.107',
+     # CISCO-IMAGE-MIB
+     'ciscoImageTable'                   => '1.3.6.1.4.1.9.9.25.1.1',
+     # CISCO-ENHANCED-IMAGE-MIB
+     'ceImageTable'                      => '1.3.6.1.4.1.9.9.249.1.1.1',
+     # OLD-CISCO-MEMORY-MIB
+     'bufferElFree'                      => '1.3.6.1.4.1.9.2.1.9.0',
+     # CISCO-IPSEC-FLOW-MONITOR-MIB
+     'cipSecGlobalHcInOctets'            => '1.3.6.1.4.1.9.9.171.1.3.1.4.0',
+     # CISCO-BGP4-MIB
+     'cbgpPeerAddrFamilyName'            => '1.3.6.1.4.1.9.9.187.1.2.3.1.3',
+     'cbgpPeerAcceptedPrefixes'          => '1.3.6.1.4.1.9.9.187.1.2.4.1.1',
+     'cbgpPeerPrefixAdminLimit'          => '1.3.6.1.4.1.9.9.187.1.2.4.1.3',
+     # CISCO-CAR-MIB
+     'ccarConfigTable'                   => '1.3.6.1.4.1.9.9.113.1.1.1',
+     'ccarConfigType'                    => '1.3.6.1.4.1.9.9.113.1.1.1.1.3',
+     'ccarConfigAccIdx'                  => '1.3.6.1.4.1.9.9.113.1.1.1.1.4',
+     'ccarConfigRate'                    => '1.3.6.1.4.1.9.9.113.1.1.1.1.5',
+     'ccarConfigLimit'                   => '1.3.6.1.4.1.9.9.113.1.1.1.1.6',
+     'ccarConfigExtLimit'                => '1.3.6.1.4.1.9.9.113.1.1.1.1.7',
+     'ccarConfigConformAction'           => '1.3.6.1.4.1.9.9.113.1.1.1.1.8',
+     'ccarConfigExceedAction'            => '1.3.6.1.4.1.9.9.113.1.1.1.1.9',
+     # CISCO-VPDN-MGMT-MIB
+     'cvpdnSystemTunnelTotal'            => '1.3.6.1.4.1.9.10.24.1.1.4.1.2'
+     );
+
+
+# Not all interfaces are normally needed to monitor.
+# You may override the interface filtering in devdiscover-siteconfig.pl:
+# redefine $Torrus::DevDiscover::CiscoIOS::interfaceFilter
+# or define $Torrus::DevDiscover::CiscoIOS::interfaceFilterOverlay
+
+our $interfaceFilter;
+our $interfaceFilterOverlay;
+my %ciscoInterfaceFilter;
+
+if( not defined( $interfaceFilter ) )
+{
+    $interfaceFilter = \%ciscoInterfaceFilter;
+}
+
+
+# Key is some unique symbolic name, does not mean anything
+# ifType is the number to match the interface type
+# ifDescr is the regexp to match the interface description
+%ciscoInterfaceFilter =
+    (
+     'Null0' => {
+         'ifType'  => 1,                      # other
+         'ifDescr' => '^Null'
+         },
+
+     'E1 N/N/N' => {
+         'ifType'  => 18,                     # ds1
+         'ifDescr' => '^E1'
+         },
+
+     'Virtual-AccessN' => {
+         'ifType'  => 23,                     # ppp
+         'ifDescr' => '^Virtual-Access'
+         },
+     
+     'DialerN' => {
+         'ifType'  => 23,                     # ppp
+         'ifDescr' => '^Dialer'
+         },
+
+     'LoopbackN'  => {
+         'ifType'  => 24,                     # softwareLoopback
+         'ifDescr' => '^Loopback'
+         },
+
+     'SerialN:N-Bearer Channel' => {
+         'ifType'  => 81,                     #  ds0, Digital Signal Level 0
+         'ifDescr' => '^Serial.*Bearer\s+Channel'
+         },
+
+     'Voice Encapsulation (POTS) Peer: N' => {
+         'ifType'  => 103                     # voiceEncap
+         },
+
+     'Voice Over IP Peer: N' => {
+         'ifType'  => 104                     # voiceOverIp
+         },
+
+     'ATMN/N/N.N-atm subif' => {
+         'ifType'  => 134,                    # atmSubInterface
+         'ifDescr' => '^ATM[0-9\/]+\.[0-9]+\s+subif'
+         },
+     
+     'BundleN' => {
+         'ifType'  => 127,                    # docsCableMaclayer
+         'ifDescr' => '^Bundle'
+         },
+
+     'EOBCN/N' => {
+         'ifType'  => 53,                     # propVirtual
+         'ifDescr' => '^EOBC'
+         },
+
+     'FIFON/N' => {
+         'ifType'  => 53,                     # propVirtual
+         'ifDescr' => '^FIFO'
+         },
+     );
+
+our %tunnelType =
+    (
+     # CISCO-VPDN-MGMT-MIB Tunnel Types
+     '1' => 'L2F',
+     '2' => 'L2TP',
+     '3' => 'PPTP'
+    );
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'ciscoProducts',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+
+    my $session = $dd->session();
+    if( not $dd->checkSnmpTable('ciscoImageTable') )
+    {
+        if( $dd->checkSnmpTable('ceImageTable') )
+        {
+            # IOS XR has a new MIB for software image management
+            $devdetails->setCap('CiscoIOSXR');            
+        }
+        else
+        {
+            return 0;
+        }
+    }
+
+    # On some Layer3 switching devices, VlanXXX interfaces give some
+    # useful stats, while on others the stats are not relevant at all
+    
+    if( $devdetails->param('CiscoIOS::enable-vlan-interfaces') ne 'yes' )
+    {
+        $interfaceFilter->{'VlanN'} = {
+            'ifType'  => 53,                     # propVirtual
+            'ifDescr' => '^Vlan\d+'
+            };
+    }
+
+    # same thing with unrouted VLAN interfaces
+    if( $devdetails->param('CiscoIOS::enable-unrouted-vlan-interfaces')
+        ne 'yes' )
+    {
+        $interfaceFilter->{'unrouted VLAN N'} => {
+            'ifType'  => 53,                     # propVirtual
+            'ifDescr' => '^unrouted\s+VLAN\s+\d+'
+            };
+    }
+    
+    &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+        ($devdetails, $interfaceFilter);
+
+    if( defined( $interfaceFilterOverlay ) )
+    {
+        &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+            ($devdetails, $interfaceFilterOverlay);
+    }
+
+    $devdetails->setCap('interfaceIndexingManaged');
+
+    return 1;
+}
+
+
+my %ccarConfigType =
+    ( 1 => 'all',
+      2 => 'quickAcc',
+      3 => 'standardAcc' );
+
+my %ccarAction =
+    ( 1 => 'drop',
+      2 => 'xmit',
+      3 => 'continue',
+      4 => 'precedXmit',
+      5 => 'precedCont' );
+                      
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    # Old mkroutercfg used cisco-interface-counters
+    if( $Torrus::DevDiscover::CiscoIOS::useCiscoInterfaceCounters )
+    {
+        foreach my $interface ( values %{$data->{'interfaces'}} )
+        {
+            $interface->{'hasHCOctets'} = 0;
+            $interface->{'hasOctets'} = 0;
+            push( @{$interface->{'templates'}},
+                  'CiscoIOS::cisco-interface-counters' );
+        }
+    }
+    else
+    {
+        # This is a well-known bug in IOS: HC counters are implemented,
+        # but always zero. We can catch this only for active interfaces.
+
+        foreach my $ifIndex ( sort {$a<=>$b} keys %{$data->{'interfaces'}} )
+        {
+            my $interface = $data->{'interfaces'}{$ifIndex};
+
+            if( $interface->{'hasHCOctets'} and
+                ( (
+                   $devdetails->snmpVar( $dd->oiddef('ifHCInOctets')
+                                         . '.' . $ifIndex ) == 0 and
+                   $devdetails->snmpVar( $dd->oiddef('ifInOctets')
+                                         . '.' . $ifIndex ) > 0
+                   )
+                  or
+                  (
+                   $devdetails->snmpVar( $dd->oiddef('ifHCOutOctets')
+                                         . '.' . $ifIndex ) == 0 and
+                   $devdetails->snmpVar( $dd->oiddef('ifOutOctets')
+                                         . '.' . $ifIndex ) > 0
+                   ) ) )
+            {
+                Debug('Disabling HC octets for ' . $ifIndex . ': ' .
+                      $interface->{'ifDescr'});
+
+                $interface->{'hasHCOctets'} = 0;
+                $interface->{'hasHCUcastPkts'} = 0;
+            }
+        }
+    }
+
+    if( $devdetails->param('CiscoIOS::enable-membuf-stats') eq 'yes' )
+    {
+        # Old Memory Buffers, if we have bufferElFree we assume
+        # the rest as they are "required"
+
+        if( $dd->checkSnmpOID('bufferElFree') )
+        {
+            $devdetails->setCap('old-ciscoMemoryBuffers');
+            push( @{$data->{'templates'}},
+                  'CiscoIOS::old-cisco-memory-buffers' );
+        }
+    }
+
+    if( $devdetails->param('CiscoIOS::disable-ipsec-stats') ne 'yes' )
+    {
+        if( $dd->checkSnmpOID('cipSecGlobalHcInOctets') )
+        {
+            $devdetails->setCap('ciscoIPSecGlobalStats');
+            push( @{$data->{'templates'}},
+                  'CiscoIOS::cisco-ipsec-flow-globals' );
+        }
+        
+        if( $dd->oidBaseMatch
+            ( 'ciscoLS1010',
+              $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+        {
+            $data->{'param'}{'snmp-oids-per-pdu'} = 10;
+        }
+    }
+
+    if( $devdetails->param('CiscoIOS::disable-bgp-stats') ne 'yes' )
+    {
+        my $peerTable =
+            $session->get_table( -baseoid =>
+                                 $dd->oiddef('cbgpPeerAcceptedPrefixes') );
+        if( defined( $peerTable ) and scalar( %{$peerTable} ) > 0 )
+        {
+            $devdetails->storeSnmpVars( $peerTable );
+            $devdetails->setCap('CiscoBGP');
+
+            my $limitsTable =
+                $session->get_table( -baseoid =>
+                                     $dd->oiddef('cbgpPeerPrefixAdminLimit') );
+            $limitsTable = {} if not defined( $limitsTable );
+            
+            $data->{'cbgpPeers'} = {};
+            
+            # retrieve AS numbers for neighbor peers
+            Torrus::DevDiscover::RFC1657_BGP4_MIB::discover($dd, $devdetails);
+            
+            # list of indices for peers that are not IPv4 Unicast
+            my @nonV4Unicast;
+
+            # Number of peers for each AS
+            my %asNumbers;    
+
+            foreach my $INDEX
+                ( $devdetails->
+                  getSnmpIndices( $dd->oiddef('cbgpPeerAcceptedPrefixes') ) )
+            {
+                my ($a1, $a2, $a3, $a4, $afi, $safi) = split(/\./, $INDEX);
+                my $peerIP = join('.', $a1, $a2, $a3, $a4);
+
+                my $peer = {
+                    'peerIP' => $peerIP,
+                    'addrFamily' => 'IPv4 Unicast'
+                    };
+                
+                if( $afi != 1 and $safi != 1 )
+                {
+                    push( @nonV4Unicast, $INDEX );
+                }
+
+                my $desc =
+                    $devdetails->param('peer-ipaddr-description-' .
+                                       join('_', split('\.', $peerIP)));
+                if( length( $desc ) > 0 )
+                {
+                    $peer->{'description'} = $desc;
+                }        
+                
+                my $peerAS = $data->{'bgpPeerAS'}{$peerIP};
+                if( defined( $peerAS ) )
+                {
+                    $peer->{'peerAS'} = $data->{'bgpPeerAS'}{$peerIP};
+                    $asNumbers{$peer->{'peerAS'}}++;
+
+                    my $desc =
+                        $devdetails->param('bgp-as-description-' . $peerAS);
+                    if( length( $desc ) > 0 )
+                    {
+                        if( defined( $peer->{'description'} ) )
+                        {
+                            Warn('Conflicting descriptions for peer ' .
+                                 $peerIP);
+                        }
+                        $peer->{'description'} = $desc;
+                    }
+                }
+                else
+                {
+                    Error('Cannot find AS number for BGP peer ' . $peerIP);
+                    next;
+                }
+
+                if( defined( $peer->{'description'} ) )
+                {
+                    $peer->{'description'} .= ' ';
+                }
+                $peer->{'description'} .= '[' . $peerIP . ']';
+
+                $peer->{'prefixLimit'} =
+                    $limitsTable->{$dd->oiddef('cbgpPeerPrefixAdminLimit') .
+                                       '.' . $INDEX};
+                    
+                $data->{'cbgpPeers'}{$INDEX} = $peer;                
+            }
+
+            if( scalar( @nonV4Unicast ) > 0 )
+            {
+                my $addrFamTable =
+                    $session->get_table
+                    ( -baseoid => $dd->oiddef('cbgpPeerAddrFamilyName') );
+                
+                foreach my $INDEX ( @nonV4Unicast )
+                {
+                    my $peer = $data->{'cbgpPeers'}{$INDEX};
+
+                    my $fam = $addrFamTable->{
+                        $dd->oiddef('cbgpPeerAddrFamilyName') .
+                            '.' . $INDEX};
+
+                    $peer->{'addrFamily'} = $fam;
+                    $peer->{'otherAddrFamily'} = 1;
+                    $peer->{'description'} .= ' ' . $fam;
+                }
+            }
+
+            # Construct the subtree names from AS, peer IP, and address
+            # family
+            foreach my $INDEX ( keys %{$data->{'cbgpPeers'}} )
+            {
+                my $peer = $data->{'cbgpPeers'}{$INDEX};
+                
+                my $subtreeName = 'AS' . $peer->{'peerAS'};
+                if( $asNumbers{$peer->{'peerAS'}} > 1 )
+                {
+                    $subtreeName .= '_' . $peer->{'peerIP'};
+                }
+                
+                if( $peer->{'otherAddrFamily'} )
+                {
+                    my $fam = $data->{'cbgpPeers'}{$INDEX}{'addrFamily'};
+                    $fam =~ s/\W/_/g;
+                    $subtreeName .= '_' . $fam;
+                }
+                
+                $peer->{'subtreeName'} = $subtreeName;
+            }
+        }
+    }
+
+    
+    if( $devdetails->param('CiscoIOS::disable-car-stats') ne 'yes' )
+    {
+        my $carTable =
+            $session->get_table( -baseoid =>
+                                 $dd->oiddef('ccarConfigTable') );
+        if( defined( $carTable ) and scalar( %{$carTable} ) > 0 )
+        {
+            $devdetails->storeSnmpVars( $carTable );
+            $devdetails->setCap('CiscoCAR');
+
+            $data->{'ccar'} = {};
+
+            foreach my $INDEX
+                ( $devdetails->
+                  getSnmpIndices( $dd->oiddef('ccarConfigType') ) )
+            {
+                my ($ifIndex, $dir, $carIndex) = split(/\./, $INDEX);
+                my $interface = $data->{'interfaces'}{$ifIndex};
+
+                my $car = {
+                    'ifIndex'   => $ifIndex,
+                    'direction' => $dir,
+                    'carIndex'  => $carIndex };
+
+                $car->{'configType'} =
+                    $ccarConfigType{ $carTable->{$dd->oiddef
+                                                     ('ccarConfigType') .
+                                                     '.' . $INDEX} };
+
+                $car->{'accIdx'} = $carTable->{$dd->oiddef
+                                                   ('ccarConfigAccIdx') .
+                                                   '.' . $INDEX};
+                
+                $car->{'rate'} = $carTable->{$dd->oiddef
+                                                 ('ccarConfigRate') .
+                                                 '.' . $INDEX};
+
+                
+                $car->{'limit'} = $carTable->{$dd->oiddef
+                                                  ('ccarConfigLimit') .
+                                                  '.' . $INDEX};
+                
+                $car->{'extLimit'} = $carTable->{$dd->oiddef
+                                                     ('ccarConfigExtLimit') .
+                                                     '.' . $INDEX};
+                $car->{'conformAction'} =
+                    $ccarAction{ $carTable->{$dd->oiddef
+                                                 ('ccarConfigConformAction') .
+                                                 '.' . $INDEX} };
+                
+                $car->{'exceedAction'} =
+                    $ccarAction{ $carTable->{$dd->oiddef
+                                                 ('ccarConfigExceedAction') .
+                                                 '.' . $INDEX} };
+
+                $data->{'ccar'}{$INDEX} = $car;
+            }
+        }
+    }
+
+
+    if( $devdetails->param('CiscoIOS::disable-vpdn-stats') ne 'yes' )
+    {
+        if( $dd->checkSnmpTable( 'cvpdnSystemTunnelTotal' ) )
+        {
+            # Find the Tunnel type
+            my $tableTun = $session->get_table(
+                            -baseoid => $dd->oiddef('cvpdnSystemTunnelTotal') );
+
+            if( $tableTun )
+            {
+                $devdetails->setCap('ciscoVPDN');
+
+                $devdetails->storeSnmpVars( $tableTun );
+
+                # VPDN indexing: 1: l2f, 2: l2tp, 3: pptp
+                foreach my $typeIndex (
+                            $devdetails->getSnmpIndices(
+                              $dd->oiddef('cvpdnSystemTunnelTotal') ) )
+                {
+                    Debug("CISCO-VPDN-MGMT-MIB: found Tunnel type " .
+                           $tunnelType{$typeIndex} );
+
+                    $data->{'ciscoVPDN'}{$typeIndex} = $tunnelType{$typeIndex};
+                }
+            }
+        }
+    }
+
+    if( $devdetails->param('CiscoIOS::short-device-comment') eq 'yes' )
+    {
+        # Remove serials from device comment
+        # 1841 chassis, Hw Serial#: 3625140487, Hw Revision: 6.0
+        
+        $data->{'param'}{'comment'} =~ s/, Hw.*//o;        
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    my $data = $devdetails->data();
+
+    if( $devdetails->hasCap('CiscoBGP') )
+    {
+        my $countersNode =
+            $cb->addSubtree( $devNode, 'BGP_Prefixes',
+                             {
+                                 'node-display-name' => 'BGP Prefixes',
+                                 'comment' => 'Accepted prefixes',
+                             } );
+
+        foreach my $INDEX ( sort
+                            { $data->{'cbgpPeers'}{$a}{'subtreeName'} <=>
+                                  $data->{'cbgpPeers'}{$b}{'subtreeName'} }
+                            keys %{$data->{'cbgpPeers'}} )
+        {
+            my $peer = $data->{'cbgpPeers'}{$INDEX};
+
+            my $param = {
+                'peer-index'           => $INDEX,
+                'peer-ipaddr'          => $peer->{'peerIP'},
+                'comment'              => $peer->{'description'},
+                'descriptive-nickname' => $peer->{'subtreeName'},
+                'precedence'           => 65000 - $peer->{'peerAS'}
+            };
+
+            if( defined( $peer->{'prefixLimit'} ) and
+                $peer->{'prefixLimit'} > 0 )
+            {
+                $param->{'upper-limit'} = $peer->{'prefixLimit'};
+                $param->{'graph-upper-limit'} = $peer->{'prefixLimit'} * 1.03;
+            }
+            
+            $cb->addLeaf
+                ( $countersNode, $peer->{'subtreeName'}, $param,
+                  ['CiscoIOS::cisco-bgp'] );
+        }
+    }
+
+    
+    if( $devdetails->hasCap('CiscoCAR') )
+    {
+        my $countersNode =
+            $cb->addSubtree( $devNode, 'CAR_Stats', {
+                'comment' => 'Committed Access Rate statistics',
+                'node-display-name' => 'CAR', },
+                             ['CiscoIOS::cisco-car-subtree']);
+        
+        foreach my $INDEX ( sort keys %{$data->{'ccar'}} )
+        {
+            my $car = $data->{'ccar'}{$INDEX};
+            my $interface = $data->{'interfaces'}{$car->{'ifIndex'}};
+            
+            my $subtreeName =
+                $interface->{$data->{'nameref'}{'ifSubtreeName'}};
+
+            $subtreeName .= ($car->{'direction'} == 1) ? '_IN':'_OUT';
+            if( $car->{'carIndex'} > 1 )
+            {
+                $subtreeName .= '_' . $car->{'carIndex'};
+            }
+               
+            my $param = {
+                'searchable' => 'yes',
+                'car-direction' => $car->{'direction'},
+                'car-index' => $car->{'carIndex'} };
+                
+            $param->{'interface-name'} =
+                $interface->{'param'}{'interface-name'};            
+            $param->{'interface-nick'} =
+                $interface->{'param'}{'interface-nick'};            
+            $param->{'comment'} =
+                $interface->{'param'}{'comment'};
+
+            my $legend = sprintf("Type: %s;", $car->{'configType'});
+            if( $car->{'accIdx'} > 0 )
+            {
+                $legend .= sprintf("Access list: %d;", $car->{'accIdx'});
+            }
+            
+            $legend .=
+                sprintf("Rate: %d bps; Limit: %d bytes; Ext limit: %d bytes;" .
+                        "Conform action: %s; Exceed action: %s",
+                        $car->{'rate'},
+                        $car->{'limit'},
+                        $car->{'extLimit'},
+                        $car->{'conformAction'},
+                        $car->{'exceedAction'});
+
+            $param->{'legend'} = $legend;
+
+            $cb->addSubtree
+                ( $countersNode,
+                  $subtreeName,
+                  $param, 
+                  ['CiscoIOS::cisco-car']);
+        }
+    }
+
+
+    if( $devdetails->hasCap('ciscoVPDN') )
+    { 
+        my $tunnelNode = $cb->addSubtree
+            ( $devNode, 'VPDN_Statistics',
+              {'node-display-name' => 'VPDN Statistics'},
+              [ 'CiscoIOS::cisco-vpdn-subtree' ] );
+
+        foreach my $INDEX ( sort keys %{$data->{'ciscoVPDN'}} )
+        {
+            my $tunnelProtocol = $data->{'ciscoVPDN'}{$INDEX};
+
+            $cb->addSubtree( $tunnelNode, $tunnelProtocol,
+                { 'comment'  => $tunnelProtocol . ' information',
+                  'tunIndex' => $INDEX,
+                  'tunFile'  => lc($tunnelProtocol) },
+                [ 'CiscoIOS::cisco-vpdn-leaf' ] );
+        }
+    }
+}
+
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/CiscoIOS_Docsis.pm b/torrus/perllib/Torrus/DevDiscover/CiscoIOS_Docsis.pm
new file mode 100644 (file)
index 0000000..8118a65
--- /dev/null
@@ -0,0 +1,285 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: CiscoIOS_Docsis.pm,v 1.1 2010-12-27 00:03:46 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# DOCSIS interface, Cisco specific
+
+package Torrus::DevDiscover::CiscoIOS_Docsis;
+
+use strict;
+use Torrus::Log;
+
+# Sequence number is 600 - we depend on RFC2670_DOCS_IF and CiscoIOS
+
+$Torrus::DevDiscover::registry{'CiscoIOS_Docsis'} = {
+    'sequence'     => 600,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+$Torrus::DevDiscover::RFC2863_IF_MIB::knownSelectorActions{
+    'DocsisMacModemsMonitor'} = 'CiscoIOS_Docsis';
+
+$Torrus::DevDiscover::RFC2863_IF_MIB::knownSelectorActions{
+    'DocsisUpUtilMonitor'} = 'CiscoIOS_Docsis';
+$Torrus::DevDiscover::RFC2863_IF_MIB::knownSelectorActions{
+    'DocsisUpSlotsMonitor'} = 'CiscoIOS_Docsis';
+
+
+our %oiddef =
+    (
+     # CISCO-DOCS-EXT-MIB:cdxIfUpstreamChannelExtTable
+     'cdxIfUpChannelMaxUGSLastFiveMins' => '1.3.6.1.4.1.9.9.116.1.4.1.1.14'
+     );
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( $devdetails->isDevType('CiscoIOS') and
+        $devdetails->isDevType('RFC2670_DOCS_IF') )
+    {
+        return 1;
+    }
+
+    return 0;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    
+    if( $dd->checkSnmpTable( 'cdxIfUpChannelMaxUGSLastFiveMins' ) )
+    {
+        $devdetails->setCap('cdxIfUpChannelMaxUGSLastFiveMins');
+    }
+
+    push( @{$data->{'docsConfig'}{'docsCableMaclayer'}{'templates'}},
+          'CiscoIOS_Docsis::cisco-docsis-mac-subtree' );
+
+    foreach my $ifIndex ( @{$data->{'docsCableMaclayer'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+
+        push( @{$interface->{'docsTemplates'}},
+              'CiscoIOS_Docsis::cisco-docsis-mac-util' );
+    }
+
+    foreach my $ifIndex ( @{$data->{'docsCableUpstream'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+
+        push( @{$interface->{'docsTemplates'}},
+              'CiscoIOS_Docsis::cisco-docsis-upstream-util' );
+    }
+    
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    my $data = $devdetails->data();
+
+    if( $devdetails->hasCap('cdxIfUpChannelMaxUGSLastFiveMins') )
+    {
+        $cb->setVar( $devNode, 'CiscoIOS_Docsis::ugs-supported', 'true' );
+    }
+
+    if( scalar( @{$data->{'docsCableMaclayer'}} ) > 0 )
+    {
+        # Build All_Modems summary graph
+        my $param = {
+            'ds-type'              => 'rrd-multigraph',
+            'ds-names'             => 'total,active,registered',
+            'graph-lower-limit'    => '0',
+            'precedence'           => '1000',
+            'comment'              =>
+                'Registered, Active and Total modems on CMTS',
+                
+                'vertical-label'       => 'Modems',
+                
+                'graph-legend-total'   => 'Total',
+                'line-style-total'     => '##totalresource',
+                'line-color-total'     => '##totalresource',
+                'line-order-total'     => '1',
+                
+                'graph-legend-active'  => 'Active',
+                'line-style-active'    => '##resourcepartusage',
+                'line-color-active'    => '##resourcepartusage',
+                'line-order-active'    => '2',
+                
+                'graph-legend-registered'  => 'Registered',
+                'line-style-registered'    => '##resourceusage',
+                'line-color-registered'    => '##resourceusage',
+                'line-order-registered'    => '3',
+                'descriptive-nickname'     => '%system-id%: All modems'
+            };
+        
+        my $first = 1;
+        foreach my $ifIndex ( @{$data->{'docsCableMaclayer'}} )
+        {
+            my $interface = $data->{'interfaces'}{$ifIndex};
+            
+            my $intf = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
+            
+            if( $first )
+            {
+                $param->{'ds-expr-total'} =
+                    '{' . $intf . '/Modems_Total}';
+                $param->{'ds-expr-active'} =
+                    '{' . $intf . '/Modems_Active}';
+                $param->{'ds-expr-registered'} =
+                    '{' . $intf . '/Modems_Registered}';
+                $first = 0;
+            }
+            else
+            {
+                $param->{'ds-expr-total'} .=
+                    ',{' . $intf . '/Modems_Total},+';
+                $param->{'ds-expr-active'} .=
+                    ',{' . $intf . '/Modems_Active},+';
+                $param->{'ds-expr-registered'} .=
+                    ',{' . $intf . '/Modems_Registered},+';
+            }
+        }
+
+        my $macNode =
+            $cb->getChildSubtree( $devNode,
+                                  $data->{'docsConfig'}{
+                                      'docsCableMaclayer'}{
+                                          'subtreeName'} );
+        if( defined( $macNode ) )
+        {
+            $cb->addLeaf( $macNode, 'All_Modems', $param, [] );
+        }
+        else
+        {
+            Error('Could not find the MAC layer subtree');
+            exit 1;
+        }
+        
+        # Apply selector actions
+        foreach my $ifIndex ( @{$data->{'docsCableMaclayer'}} )
+        {
+            my $interface = $data->{'interfaces'}{$ifIndex};
+            
+            my $intf = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
+            
+            my $monitor =
+                $interface->{'selectorActions'}{'DocsisMacModemsMonitor'};
+            if( defined( $monitor ) )
+            {
+                my $intfNode = $cb->getChildSubtree( $macNode, $intf );
+                $cb->addLeaf( $intfNode, 'Modems_Registered',
+                              {'monitor' => $monitor } );
+            }
+        }
+    }
+
+    if( scalar( @{$data->{'docsCableUpstream'}} ) > 0 )
+    {
+        my $upstrNode =
+            $cb->getChildSubtree( $devNode,
+                                  $data->{'docsConfig'}{'docsCableUpstream'}{
+                                      'subtreeName'} );
+        
+        foreach my $ifIndex ( @{$data->{'docsCableUpstream'}} )
+        {
+            my $interface = $data->{'interfaces'}{$ifIndex};
+            
+            my $intf = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
+            
+            my $monitor =
+                $interface->{'selectorActions'}{'DocsisUpUtilMonitor'};
+            if( defined( $monitor ) )
+            {
+                my $intfNode = $cb->getChildSubtree( $upstrNode, $intf );
+                $cb->addLeaf( $intfNode, 'Util',
+                              {'monitor' => $monitor } );
+            }
+
+            $monitor =
+                $interface->{'selectorActions'}{'DocsisUpSlotsMonitor'};
+            if( defined( $monitor ) )
+            {
+                my $intfNode = $cb->getChildSubtree( $upstrNode, $intf );
+                $cb->addLeaf( $intfNode, 'ContSlots',
+                              {'monitor' => $monitor } );
+            }
+        }
+
+        # Override the overview shortcus defined in rfc2670.docsis-if.xml
+        
+        my $shortcuts = 'snr,fec,freq,modems,util';
+        if( $devdetails->hasCap('cdxIfUpChannelMaxUGSLastFiveMins') )
+        {
+            $shortcuts .= ',ugs';
+        }
+        
+        my $param = {        
+            'overview-shortcuts' =>
+                $shortcuts,
+                
+                'overview-subleave-name-modems' => 'Modems',
+                'overview-direct-link-modems' => 'yes',
+                'overview-direct-link-view-modems' => 'expanded-dir-html',
+                'overview-shortcut-text-modems' => 'All modems',
+                'overview-shortcut-title-modems'=>
+                'Show modem quantities in one page',
+                'overview-page-title-modems' => 'Modem quantities',
+                
+                'overview-subleave-name-util' => 'Util_Summary',
+                'overview-direct-link-util' => 'yes',
+                'overview-direct-link-view-util' => 'expanded-dir-html',
+                'overview-shortcut-text-util' => 'All utilization',
+                'overview-shortcut-title-util' => 'All upstream utilization',
+                'overview-page-title-util' => 'Upstream utilization',
+                
+                'overview-subleave-name-ugs' => 'Active_UGS',
+                'overview-direct-link-ugs' => 'yes',
+                'overview-direct-link-view-ugs' => 'expanded-dir-html',
+                'overview-shortcut-text-ugs' => 'All UGS',
+                'overview-shortcut-title-ugs' => 'Show all UGS in one page',
+                'overview-page-title-ugs' => 'UGS Statistics'
+            };
+
+        $cb->addParams( $upstrNode, $param );
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/CiscoIOS_MacAccounting.pm b/torrus/perllib/Torrus/DevDiscover/CiscoIOS_MacAccounting.pm
new file mode 100644 (file)
index 0000000..841a575
--- /dev/null
@@ -0,0 +1,388 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: CiscoIOS_MacAccounting.pm,v 1.1 2010-12-27 00:03:46 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Cisco IOS MAC accounting
+
+package Torrus::DevDiscover::CiscoIOS_MacAccounting;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'CiscoIOS_MacAccounting'} = {
+    'sequence'     => 510,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # CISCO-IP-STAT-MIB
+     'cipMacHCSwitchedBytes'        => '1.3.6.1.4.1.9.9.84.1.2.3.1.2',
+     
+     );
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+
+    if( $devdetails->isDevType('CiscoIOS') and
+        $dd->checkSnmpTable('cipMacHCSwitchedBytes') )
+    {
+        return 1;
+    }
+    
+    return 0;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    my $table = $session->get_table( -baseoid =>
+                                     $dd->oiddef('cipMacHCSwitchedBytes'));
+    
+    if( not defined( $table ) or scalar( %{$table} ) == 0 )
+    {
+        return 0;
+    }
+    $devdetails->storeSnmpVars( $table );
+
+    # External storage serviceid assignment
+    my $extSrv =
+        $devdetails->param('CiscoIOS_MacAccounting::external-serviceid');
+    if( defined( $extSrv ) and length( $extSrv ) > 0 )
+    {
+        my $extStorage = {};
+        my $extStorageTrees = {};
+
+        foreach my $srvDef ( split( /\s*,\s*/, $extSrv ) )
+        {
+            my ( $serviceid, $peerName, $direction, $trees ) =
+                split( /\s*:\s*/, $srvDef );
+
+            if( defined( $trees ) )
+            {
+                # Trees are listed with '|' as separator,
+                # whereas compiler expects commas
+                
+                $trees =~ s/\s*\|\s*/,/g;
+            }
+            
+            if( $direction eq 'Both' )
+            {
+                $extStorage->{$peerName}{'In'} = $serviceid . '_IN';
+                $extStorageTrees->{$serviceid . '_IN'} = $trees;
+                
+                $extStorage->{$peerName}{'Out'} = $serviceid . '_OUT';
+                $extStorageTrees->{$serviceid . '_OUT'} = $trees;
+            }
+            else
+            {
+                $extStorage->{$peerName}{$direction} = $serviceid;
+                $extStorageTrees->{$serviceid} = $trees;
+            }
+        }
+        $data->{'cipMacExtStorage'} = $extStorage;
+        $data->{'cipMacExtStoragetrees'} = $extStorageTrees;
+    }
+
+
+    # tokenset members
+    # Format: tokenset:ASXXXX,ASXXXX; tokenset:ASXXXX,ASXXXX;
+    # Peer MAC or IP addresses could be used too
+    my $tsetMembership =
+        $devdetails->param('CiscoIOS_MacAccounting::tokenset-members');
+    if( defined( $tsetMembership ) and length( $tsetMembership ) > 0 )
+    {
+        my $tsetMember = {};
+        foreach my $memList ( split( /\s*;\s*/, $tsetMembership ) )
+        {
+            my ($tset, $list) = split( /\s*:\s*/, $memList );
+            foreach my $peerName ( split( /\s*,\s*/, $list ) )
+            {
+                $tsetMember->{$peerName}{$tset} = 1;
+            }
+        }
+        $data->{'cipTokensetMember'} = $tsetMember;
+    }
+    
+    Torrus::DevDiscover::RFC2011_IP_MIB::discover($dd, $devdetails);
+    Torrus::DevDiscover::RFC1657_BGP4_MIB::discover($dd, $devdetails);
+    
+    foreach my $INDEX
+        ( $devdetails->
+          getSnmpIndices( $dd->oiddef('cipMacHCSwitchedBytes') ) )
+    {
+        my( $ifIndex, $direction, @phyAddrOctets ) = split( '\.', $INDEX );
+
+        my $interface = $data->{'interfaces'}{$ifIndex};
+        next if not defined( $interface );
+
+        my $phyAddr = '0x';
+        my $macAddrString = '';
+        foreach my $byte ( @phyAddrOctets )
+        {
+            $phyAddr .= sprintf('%.2x', $byte);
+            if( length( $macAddrString ) > 0 )
+            {
+                $macAddrString .= ':';
+            }
+            $macAddrString .= sprintf('%.2x', $byte);
+        }
+
+        next if ( $phyAddr eq '0xffffffffffff' );
+        
+        my $peerIP = $interface->{'mediaToIpNet'}{$phyAddr};
+        if( not defined( $peerIP ) )
+        {
+            # Try in the global table, as the ARP is stored per subinterface,
+            # and MAC accounting is on main interface
+            $peerIP = $data->{'mediaToIpNet'}{$phyAddr};
+        }
+        
+        if( not defined( $peerIP ) )
+        {
+            # high logging level, because who cares about staled entries?
+            Debug('Cannot determine IP address for MAC accounting ' .
+                  'entry: ' . $macAddrString);            
+            next;
+        }
+
+        # There should be two entries per IP: in and out.
+        if( defined( $data->{'cipMac'}{$ifIndex . ':' . $phyAddr} ) )
+        {
+            $data->{'cipMac'}{$ifIndex . ':' . $phyAddr}{'nEntries'}++;
+            next;
+        }
+        
+        my $peer = {
+            'peerIP' => $peerIP,
+            'phyAddr' => $phyAddr,
+            'macAddrString' => $macAddrString,
+            'ifIndex' => $ifIndex,
+            'nEntries' => 1
+        };
+
+        $peer->{'macAddrOID'} = join('.', @phyAddrOctets);
+
+        $peer->{'ifReferenceName'} =
+            $interface->{$data->{'nameref'}{'ifReferenceName'}};
+        $peer->{'ifNick'} =
+            $interface->{$data->{'nameref'}{'ifNick'}};
+        
+        my $desc =
+            $devdetails->param('peer-ipaddr-description-' .
+                               join('_', split('\.', $peerIP)));
+        if( length( $desc ) > 0 )
+        {
+            $peer->{'description'} = $desc;
+        }        
+        
+        if( $devdetails->hasCap('bgpPeerTable') )
+        {
+            my $peerAS = $data->{'bgpPeerAS'}{$peerIP};
+            if( defined( $peerAS ) )
+            {
+                $peer->{'peerAS'} = $data->{'bgpPeerAS'}{$peerIP};
+                
+                my $desc =
+                    $devdetails->param('bgp-as-description-' . $peerAS);
+                if( length( $desc ) > 0 )
+                {
+                    if( defined( $peer->{'description'} ) )
+                    {
+                        Warn('Conflicting descriptions for peer ' .
+                             $peerIP);
+                    }
+                    $peer->{'description'} = $desc;
+                }
+            }
+            elsif( $devdetails->
+                    param('CiscoIOS_MacAccounting::bgponly') eq 'yes' )
+            {
+                next;
+            }
+        }
+
+        if( defined( $peer->{'description'} ) )
+        {
+            $peer->{'description'} .= ' ';
+        }
+        $peer->{'description'} .= '[' . $peerIP . ']';
+                    
+        $data->{'cipMac'}{$ifIndex . ':' . $phyAddr} = $peer;
+    }
+
+    my %asNumbers;    
+    foreach my $INDEX ( keys %{$data->{'cipMac'}} )
+    {        
+        my $peer = $data->{'cipMac'}{$INDEX};
+
+        if( $peer->{'nEntries'} != 2 )
+        {
+            delete $data->{'cipMac'}{$INDEX};
+        }
+        else
+        {
+            if( defined( $peer->{'peerAS'} ) )
+            {
+                $asNumbers{$peer->{'peerAS'}}++;
+            }
+        }
+    }
+    
+    foreach my $INDEX ( keys %{$data->{'cipMac'}} )
+    {
+        my $peer = $data->{'cipMac'}{$INDEX};
+        
+        my $subtreeName = $peer->{'peerIP'};
+        my $asNum = $peer->{'peerAS'};
+        if( defined( $asNum ) )
+        {
+            $subtreeName = 'AS' . $asNum; 
+            if( $asNumbers{$asNum} > 1 )
+            {
+                $subtreeName .= '_' . $peer->{'peerIP'};
+            }
+        }
+        $peer->{'subtreeName'} = $subtreeName;
+    }
+    
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    my $data = $devdetails->data();
+
+    my $countersNode =
+        $cb->addSubtree( $devNode, 'MAC_Accounting',
+                         {'node-display-name' => 'MAC Accounting'},
+                         ['CiscoIOS_MacAccounting::cisco-macacc-subtree']);
+    
+    foreach my $INDEX ( sort { $data->{'cipMac'}{$a}{'subtreeName'} <=>
+                                   $data->{'cipMac'}{$b}{'subtreeName'} }
+                        keys %{$data->{'cipMac'}} )
+    {
+        my $peer = $data->{'cipMac'}{$INDEX};
+    
+        my $param = {
+            'peer-macaddr'         => $peer->{'phyAddr'},
+            'peer-macoid'          => $peer->{'macAddrOID'},
+            'peer-ipaddr'          => $peer->{'peerIP'},
+            'interface-name'       => $peer->{'ifReferenceName'},
+            'interface-nick'       => $peer->{'ifNick'},
+            'comment'              => $peer->{'description'},
+            'descriptive-nickname' => $peer->{'subtreeName'},
+            'precedence'           => 65000 - $peer->{'peerAS'},
+            'searchable'           => 'yes'
+            };
+
+        my $peerNode = $cb->addSubtree
+            ( $countersNode, $peer->{'subtreeName'}, $param,
+              ['CiscoIOS_MacAccounting::cisco-macacc'] );
+
+        if( defined( $data->{'cipMacExtStorage'} ) or
+            defined( $data->{'cipTokensetMember'} ) )
+        {
+            my $extStorageApplied = 0;
+            my $tsetMemberApplied = 0;
+            
+            foreach my $peerName ( 'AS'.$peer->{'peerAS'}, $peer->{'peerIP'},
+                                   $peer->{'phyAddr'} )
+            {
+                if( defined( $peerName ) )
+                {
+                    if( not $extStorageApplied and
+                        defined( $data->{'cipMacExtStorage'}{$peerName} ) )
+                    {
+                        my $extStorage =
+                            $data->{'cipMacExtStorage'}{$peerName};
+                        foreach my $dir ( 'In', 'Out' )
+                        {
+                            if( defined( $extStorage->{$dir} ) )
+                            {
+                                my $serviceid = $extStorage->{$dir};
+                                
+                                my $params = {
+                                    'storage-type' => 'rrd,ext',
+                                    'ext-service-units' => 'bytes',
+                                    'ext-service-id' => $serviceid };
+                                
+                                if( defined( $data->{'cipMacExtStoragetrees'}{
+                                    $serviceid}) and
+                                    length( $data->{'cipMacExtStoragetrees'}{
+                                        $serviceid}) > 0 )
+                                {
+                                    $params->{'ext-service-trees'} =
+                                        $data->{'cipMacExtStoragetrees'}{
+                                            $serviceid};
+                                }
+                                
+                                $cb->addLeaf
+                                    ( $peerNode, 'Bytes_' . $dir,
+                                      $params );
+                            }
+                        }
+                        $extStorageApplied = 1;
+                    }
+
+                    if( not $tsetMemberApplied and
+                        defined( $data->{'cipTokensetMember'}{$peerName} ) )
+                    {
+                        my $tsetList =
+                            join( ',', sort keys
+                                  %{$data->{'cipTokensetMember'}{$peerName}} );
+
+                        $cb->addLeaf
+                            ( $peerNode, 'InOut_bps',
+                              { 'tokenset-member' => $tsetList } );
+                    }                        
+                }
+            }
+        }
+    }
+}
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/CiscoIOS_SAA.pm b/torrus/perllib/Torrus/DevDiscover/CiscoIOS_SAA.pm
new file mode 100644 (file)
index 0000000..6d136a9
--- /dev/null
@@ -0,0 +1,382 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: CiscoIOS_SAA.pm,v 1.1 2010-12-27 00:03:50 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Cisco IOS Service Assurance Agent
+# TODO:
+#   should really consider rtt-type and rtt-echo-protocol when applying
+#   per-rtt templates
+#
+#   translate TOS bits into DSCP values
+
+package Torrus::DevDiscover::CiscoIOS_SAA;
+
+use strict;
+use Socket qw(inet_ntoa);
+
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'CiscoIOS_SAA'} = {
+    'sequence'     => 510,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # CISCO-RTTMON-MIB
+     'rttMonCtrlAdminTable'               => '1.3.6.1.4.1.9.9.42.1.2.1',
+     'rttMonCtrlAdminOwner'               => '1.3.6.1.4.1.9.9.42.1.2.1.1.2',
+     'rttMonCtrlAdminTag'                 => '1.3.6.1.4.1.9.9.42.1.2.1.1.3',
+     'rttMonCtrlAdminRttType'             => '1.3.6.1.4.1.9.9.42.1.2.1.1.4',
+     'rttMonCtrlAdminFrequency'           => '1.3.6.1.4.1.9.9.42.1.2.1.1.6',
+     'rttMonCtrlAdminStatus'              => '1.3.6.1.4.1.9.9.42.1.2.1.1.9',
+     'rttMonEchoAdminTable'               => '1.3.6.1.4.1.9.9.42.1.2.2',
+     'rttMonEchoAdminProtocol'            => '1.3.6.1.4.1.9.9.42.1.2.2.1.1',
+     'rttMonEchoAdminTargetAddress'       => '1.3.6.1.4.1.9.9.42.1.2.2.1.2',
+     'rttMonEchoAdminPktDataRequestSize'  => '1.3.6.1.4.1.9.9.42.1.2.2.1.3',
+     'rttMonEchoAdminTargetPort'          => '1.3.6.1.4.1.9.9.42.1.2.2.1.5',
+     'rttMonEchoAdminTOS'                 => '1.3.6.1.4.1.9.9.42.1.2.2.1.9',
+     'rttMonEchoAdminTargetAddressString' => '1.3.6.1.4.1.9.9.42.1.2.2.1.11',
+     'rttMonEchoAdminNameServer'          => '1.3.6.1.4.1.9.9.42.1.2.2.1.12',
+     'rttMonEchoAdminURL'                 => '1.3.6.1.4.1.9.9.42.1.2.2.1.15',
+     'rttMonEchoAdminInterval'            => '1.3.6.1.4.1.9.9.42.1.2.2.1.17',
+     'rttMonEchoAdminNumPackets'          => '1.3.6.1.4.1.9.9.42.1.2.2.1.18'
+     );
+
+
+
+our %adminInterpret =
+    (
+     'rttMonCtrlAdminOwner' => {
+         'order'   => 10,
+         'legend'  => 'Owner: %s;',
+         'param'   => 'rtt-owner'
+         },
+
+     'rttMonCtrlAdminTag' => {
+         'order'   => 20,
+         'legend'  => 'Tag: %s;',
+         'comment' => '%s: ',
+         'param'   => 'rtt-tag'
+         },
+
+     'rttMonCtrlAdminRttType' => {
+         'order'   => 30,
+         'legend'  => 'Type: %s;',
+         'translate' => \&translateRttType,
+         'param'   => 'rtt-type'
+         },
+
+     'rttMonCtrlAdminFrequency' => {
+         'order'   => 40,
+         'legend'  => 'Frequency: %d seconds;',
+         'param'   => 'rtt-frequency'
+         },
+
+     'rttMonEchoAdminProtocol' => {
+         'order'   => 50,
+         'legend'  => 'Protocol: %s;',
+         'translate' => \&translateRttEchoProtocol,
+         'param'   => 'rtt-echo-protocol'
+         },
+
+     'rttMonEchoAdminTargetAddress' => {
+         'order'   => 60,
+         'legend'  => 'Target: %s;',
+         'comment' => 'Target=%s ',
+         'translate' => \&translateRttTargetAddr,
+         'param'   => 'rtt-echo-target-addr',
+         'ignore-text' => '0.0.0.0'
+         },
+
+     'rttMonEchoAdminPktDataRequestSize' => {
+         'order'   => 70,
+         'legend'  => 'Packet size: %d octets;',
+         'param'   => 'rtt-echo-request-size'
+         },
+
+     'rttMonEchoAdminTargetPort' => {
+         'order'   => 80,
+         'legend'  => 'Port: %d;',
+         'param'   => 'rtt-echo-port',
+         'ignore-numeric' => 0
+         },
+
+     'rttMonEchoAdminTOS' => {
+         'order'   => 90,
+         'legend'  => 'TOS: %d;',
+         'comment' => 'TOS=%d ',
+         'param'   => 'rtt-echo-tos',
+         'ignore-numeric' => 0
+         },
+
+     'rttMonEchoAdminTargetAddressString' => {
+         'order'   => 100,
+         'legend'  => 'Address string: %s;',
+         'param'   => 'rtt-echo-addr-string'
+         },
+
+     'rttMonEchoAdminNameServer' => {
+         'order'   => 110,
+         'legend'  => 'NameServer: %s;',
+         'translate' => \&translateRttTargetAddr,
+         'param'   => 'rtt-echo-name-server',
+         'ignore-text' => '0.0.0.0'
+         },
+
+     'rttMonEchoAdminURL' => {
+         'order'   => 120,
+         'legend'  => 'URL: %s;',
+         'param'   => 'rtt-echo-url'
+         },
+
+     'rttMonEchoAdminInterval' => {
+         'order'   => 130,
+         'legend'  => 'Interval: %d milliseconds;',
+         'param'   => 'rtt-echo-interval',
+         'ignore-numeric' => 0
+         },
+
+     'rttMonEchoAdminNumPackets' => {
+         'order'   => 140,
+         'legend'  => 'Packets: %d;',
+         'param'   => 'rtt-echo-num-packets',
+         'ignore-numeric' => 0
+         }
+     );
+
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+
+    if( $devdetails->isDevType('CiscoIOS') )
+    {
+        my $rttAdminTable =
+            $session->get_table( -baseoid =>
+                                 $dd->oiddef('rttMonCtrlAdminTable') );
+        if( defined $rttAdminTable and scalar( %{$rttAdminTable} ) > 0 )
+        {
+            $devdetails->storeSnmpVars( $rttAdminTable );
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    my $rttEchoAdminTable =
+        $session->get_table( -baseoid =>
+                             $dd->oiddef('rttMonEchoAdminTable') );
+    if( defined $rttEchoAdminTable )
+    {
+        $devdetails->storeSnmpVars( $rttEchoAdminTable );
+        undef $rttEchoAdminTable;
+    }
+
+    $data->{'rtt_entries'} = {};
+
+    foreach my $rttIndex
+        ( $devdetails->getSnmpIndices( $dd->oiddef('rttMonCtrlAdminOwner') ) )
+    {
+        # we're interested in Active agents only
+        if( $devdetails->snmpVar($dd->oiddef('rttMonCtrlAdminStatus') .
+                                 '.' . $rttIndex) != 1 )
+        {
+            next;
+        }
+
+        my $ref = {};
+        $data->{'rtt_entries'}{$rttIndex} = $ref;
+        $ref->{'param'} = {};
+
+        my $comment = '';
+        my $legend = '';
+
+        foreach my $adminField
+            ( sort {$adminInterpret{$a}{'order'} <=>
+                        $adminInterpret{$b}{'order'}}
+              keys %adminInterpret )
+        {
+            my $value = $devdetails->snmpVar( $dd->oiddef( $adminField ) .
+                                              '.' . $rttIndex );
+            if( defined( $value ) and length( $value ) > 0 )
+            {
+                my $intrp = $adminInterpret{$adminField};
+                if( ref( $intrp->{'translate'} ) )
+                {
+                    $value = &{$intrp->{'translate'}}( $value );
+                }
+
+                if( ( defined( $intrp->{'ignore-numeric'} ) and
+                      $value == $intrp->{'ignore-numeric'} )
+                    or
+                    ( defined( $intrp->{'ignore-text'} ) and
+                      $value eq $intrp->{'ignore-text'} ) )
+                {
+                    next;
+                }
+
+                if( defined( $intrp->{'param'} ) )
+                {
+                    $ref->{'param'}{$intrp->{'param'}} = $value;
+                }
+
+                if( defined( $intrp->{'comment'} ) )
+                {
+                    $comment .= sprintf( $intrp->{'comment'}, $value );
+                }
+
+                if( defined( $intrp->{'legend'} ) )
+                {
+                    $legend .= sprintf( $intrp->{'legend'}, $value );
+                }
+            }
+        }
+
+        $ref->{'param'}{'rtt-index'} = $rttIndex;
+        $ref->{'param'}{'comment'} = $comment;
+        $ref->{'param'}{'legend'} = $legend;
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    my $data = $devdetails->data();
+
+    my $subtreeNode =
+        $cb->addSubtree( $devNode, 'SAA', undef,
+                         ['CiscoIOS_SAA::cisco-saa-subtree']);
+
+    foreach my $rttIndex ( sort {$a<=>$b} keys %{$data->{'rtt_entries'}} )
+    {
+        my $subtreeName = 'rtt_' . $rttIndex;
+        my $param = $data->{'rtt_entries'}{$rttIndex}{'param'};
+        $param->{'precedence'} = sprintf('%d', 10000 - $rttIndex);
+
+        # TODO: should really consider rtt-type and rtt-echo-protocol
+
+        $cb->addSubtree( $subtreeNode, $subtreeName, $param,
+                         ['CiscoIOS_SAA::cisco-rtt-echo-subtree']);
+    }
+}
+
+
+our %rttType =
+    (
+     '1'  => 'echo',
+     '2'  => 'pathEcho',
+     '3'  => 'fileIO',
+     '4'  => 'script',
+     '5'  => 'udpEcho',
+     '6'  => 'tcpConnect',
+     '7'  => 'http',
+     '8'  => 'dns',
+     '9'  => 'jitter',
+     '10' => 'dlsw',
+     '11' => 'dhcp',
+     '12' => 'ftp'
+     );
+
+sub translateRttType
+{
+    my $value = shift;
+    return $rttType{$value};
+}
+
+
+our %rttEchoProtocol =
+    (
+     '1'   =>  'notApplicable',
+     '2'   =>  'ipIcmpEcho',
+     '3'   =>  'ipUdpEchoAppl',
+     '4'   =>  'snaRUEcho',
+     '5'   =>  'snaLU0EchoAppl',
+     '6'   =>  'snaLU2EchoAppl',
+     '7'   =>  'snaLU62Echo',
+     '8'   =>  'snaLU62EchoAppl',
+     '9'   =>  'appleTalkEcho',
+     '10'  =>  'appleTalkEchoAppl',
+     '11'  =>  'decNetEcho',
+     '12'  =>  'decNetEchoAppl',
+     '13'  =>  'ipxEcho',
+     '14'  =>  'ipxEchoAppl',
+     '15'  =>  'isoClnsEcho',
+     '16'  =>  'isoClnsEchoAppl',
+     '17'  =>  'vinesEcho',
+     '18'  =>  'vinesEchoAppl',
+     '19'  =>  'xnsEcho',
+     '20'  =>  'xnsEchoAppl',
+     '21'  =>  'apolloEcho',
+     '22'  =>  'apolloEchoAppl',
+     '23'  =>  'netbiosEchoAppl',
+     '24'  =>  'ipTcpConn',
+     '25'  =>  'httpAppl',
+     '26'  =>  'dnsAppl',
+     '27'  =>  'jitterAppl',
+     '28'  =>  'dlswAppl',
+     '29'  =>  'dhcpAppl',
+     '30'  =>  'ftpAppl'
+     );
+
+sub translateRttEchoProtocol
+{
+    my $value = shift;
+    return $rttEchoProtocol{$value};
+}
+
+sub translateRttTargetAddr
+{
+    my $value = shift;
+    $value =~ s/^0x//;
+    return inet_ntoa( pack( 'H8', $value ) );
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/CiscoSCE.pm b/torrus/perllib/Torrus/DevDiscover/CiscoSCE.pm
new file mode 100644 (file)
index 0000000..e9d2003
--- /dev/null
@@ -0,0 +1,418 @@
+#
+#  Discovery module for Cisco Service Control Engine (formely PCube)
+#
+#  Copyright (C) 2007 Jon Nistor
+#  Copyright (C) 2007 Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: CiscoSCE.pm,v 1.1 2010-12-27 00:03:56 ivan Exp $
+# Jon Nistor <nistor at snickers dot org>
+#
+# NOTE: Options for this module
+#       CiscoSCE::disable-disk
+#       CiscoSCE::disable-gc
+#       CiscoSCE::disable-qos
+#       CiscoSCE::disable-rdr
+#       CiscoSCE::disable-subs
+#       CiscoSCE::disable-tp
+#
+
+# Cisco SCE devices discovery
+package Torrus::DevDiscover::CiscoSCE;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'CiscoSCE'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+};
+
+# pmodule-dependend OIDs are presented for module #1 only.
+# currently devices with more than one module do not exist
+
+our %oiddef =
+    (
+     # PCUBE-SE-MIB
+     'pcubeProducts'        => '1.3.6.1.4.1.5655.1',
+     'pchassisSysType'      => '1.3.6.1.4.1.5655.4.1.2.1.0',
+     'pchassisNumSlots'     => '1.3.6.1.4.1.5655.4.1.2.6.0',
+     'pmoduleType'          => '1.3.6.1.4.1.5655.4.1.3.1.1.2.1',
+     'pmoduleNumLinks'      => '1.3.6.1.4.1.5655.4.1.3.1.1.7.1',
+     'pmoduleSerialNumber'  => '1.3.6.1.4.1.5655.4.1.3.1.1.9.1',
+     'pmoduleNumTrafficProcessors'   => '1.3.6.1.4.1.5655.4.1.3.1.1.3.1',
+     'rdrFormatterEnable'            => '1.3.6.1.4.1.5655.4.1.6.1.0',
+     'rdrFormatterCategoryName'      => '1.3.6.1.4.1.5655.4.1.6.11.1.2',
+     'subscribersNumIpAddrMappings'  => '1.3.6.1.4.1.5655.4.1.8.1.1.3.1',
+     'subscribersNumIpRangeMappings' => '1.3.6.1.4.1.5655.4.1.8.1.1.5.1',
+     'subscribersNumVlanMappings'    => '1.3.6.1.4.1.5655.4.1.8.1.1.7.1',
+     'subscribersNumAnonymous'       => '1.3.6.1.4.1.5655.4.1.8.1.1.16.1',
+     'pportNumTxQueues'     => '1.3.6.1.4.1.5655.4.1.10.1.1.4.1',
+     'pportIfIndex'         => '1.3.6.1.4.1.5655.4.1.10.1.1.5.1',
+     'txQueuesDescription'  => '1.3.6.1.4.1.5655.4.1.11.1.1.4.1',
+
+     # CISCO-SCAS-BB-MIB (PCUBE-ENGAGE-MIB)
+     'globalScopeServiceCounterName' => '1.3.6.1.4.1.5655.4.2.5.1.1.3.1',
+     
+    );
+
+our %sceChassisNames =
+    (
+     '1'    => 'unknown',
+     '2'    => 'SE 1000',
+     '3'    => 'SE 100',
+     '4'    => 'SE 2000',
+    );
+
+our %sceModuleDesc =
+    (
+     '1'    => 'unknown',
+     '2'    => '2xGBE + 1xFE Mgmt',
+     '3'    => '2xFE + 1xFE Mgmt',
+     '4'    => '4xGBE + 1 or 2 FastE Mgmt',
+     '5'    => '4xFE + 1xFE Mgmt',
+     '6'    => '4xOC-12 + 1 or 2 FastE Mgmt',
+     '7'    => '16xFE + 2xGBE, 2 FastE Mgmt',
+    );
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'pcubeProducts',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+    
+    my $result = $dd->retrieveSnmpOIDs('pchassisNumSlots');
+    if( $result->{'pchassisNumSlots'} > 1 )
+    {
+        Error('This SCE device has more than one module on the chassis.' .
+              'The current version of DevDiscover does not support such ' .
+              'devices');
+        return 0;
+    }
+    
+    $devdetails->setCap('interfaceIndexingPersistent');
+
+    return 1;
+}
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    # Get the system info and display it in the comment
+    my $sceInfo = $dd->retrieveSnmpOIDs
+        ( 'pchassisSysType', 'pmoduleType', 'pmoduleNumLinks',
+          'pmoduleSerialNumber', 'pmoduleNumTrafficProcessors',
+          'rdrFormatterEnable',
+          'subscribersNumIpAddrMappings', 'subscribersNumIpRangeMappings',
+          'subscribersNumVlanMappings', 'subscribersNumAnonymous' );
+
+    $data->{'sceInfo'} = $sceInfo;
+    
+    $data->{'param'}{'comment'} =
+        $sceChassisNames{$sceInfo->{'pchassisSysType'}} .
+        " chassis, " . $sceModuleDesc{$sceInfo->{'pmoduleType'}} .
+        ", Hw Serial#: " . $sceInfo->{'pmoduleSerialNumber'};
+    
+    # TP: Traffic Processor
+    if( $devdetails->param('CiscoSCE::disable-tp') ne 'yes' )
+    { 
+        $devdetails->setCap('sceTP');
+
+        $data->{'sceTrafficProcessors'} =
+            $sceInfo->{'pmoduleNumTrafficProcessors'};
+    }
+
+    # HDD: Disk Usage
+    if( $devdetails->param('CiscoSCE::disable-disk') ne 'yes' )
+    {
+        $devdetails->setCap('sceDisk');
+    }
+
+    # SUBS: subscriber aware configuration
+    if( $devdetails->param('CiscoSCE::disable-subs') ne 'yes' )
+    {
+        if( $sceInfo->{'subscribersNumIpAddrMappings'}  > 0 or
+            $sceInfo->{'subscribersNumIpRangeMappings'} > 0 or
+            $sceInfo->{'subscribersNumVlanMappings'}    > 0 or
+            $sceInfo->{'subscribersNumAnonymous'}       > 0 )
+        {
+            $devdetails->setCap('sceSubscribers');
+        }
+    }
+    
+    
+    # QOS: TX Queues Names
+    if( $devdetails->param('CiscoSCE::disable-qos') ne 'yes' )
+    { 
+        $devdetails->setCap('sceQos');
+
+        # Get the names of TX queues
+        my $txQueueNum = $session->get_table
+            ( -baseoid => $dd->oiddef('pportNumTxQueues') );
+        $devdetails->storeSnmpVars( $txQueueNum );
+        
+        my $ifIndexTable = $session->get_table
+            ( -baseoid => $dd->oiddef('pportIfIndex') );
+
+        my $txQueueDesc = $session->get_table
+            ( -baseoid => $dd->oiddef('txQueuesDescription') );
+        
+        $devdetails->storeSnmpVars( $txQueueDesc );
+        
+        foreach my $pIndex
+            ( $devdetails->getSnmpIndices( $dd->oiddef('pportNumTxQueues') ) )
+        {
+            # We take ports with more than one queue and add queueing
+            # statistics to interface counters
+            if( $txQueueNum->{$dd->oiddef('pportNumTxQueues') .
+                                  '.' . $pIndex} > 1 )
+            {
+                # We need the ifIndex to retrieve the interface name
+                
+                my $ifIndex =
+                    $ifIndexTable->{$dd->oiddef('pportIfIndex') . '.'
+                                        . $pIndex};
+
+                $data->{'scePortIfIndex'}{$pIndex} = $ifIndex;
+                
+                foreach my $qIndex
+                    ( $devdetails->getSnmpIndices
+                      ( $dd->oiddef('txQueuesDescription') . '.' . $pIndex ) )
+                {
+                    my $oid = $dd->oiddef('txQueuesDescription') . '.' .
+                        $pIndex . '.' . $qIndex;
+                    
+                    $data->{'sceQueues'}{$pIndex}{$qIndex} =
+                        $txQueueDesc->{$oid};
+                }
+            }
+        }
+    }
+
+
+    # GC: Global Service Counters
+    if( $devdetails->param('CiscoSCE::disable-gc') ne 'yes' )
+    {
+        # Set the Capability for the Global Counters
+        $devdetails->setCap('sceGlobalCounters');
+
+        my $counterNames = $session->get_table
+            ( -baseoid => $dd->oiddef('globalScopeServiceCounterName') );
+        
+        $devdetails->storeSnmpVars( $counterNames );
+        
+        foreach my $gcIndex
+            ( $devdetails->getSnmpIndices
+              ( $dd->oiddef('globalScopeServiceCounterName') ) )
+        {
+            my $oid =
+                $dd->oiddef('globalScopeServiceCounterName') . '.' . $gcIndex;
+            if( length( $counterNames->{$oid} ) > 0 )
+            {
+                $data->{'sceGlobalCounters'}{$gcIndex} = $counterNames->{$oid};
+            }
+        }
+    }
+
+
+    # RDR: Raw Data Record
+    if( $devdetails->param('CiscoSCE::disable-rdr') ne 'yes' )
+    {   
+        if( $sceInfo->{'rdrFormatterEnable'} > 0 )
+        {
+            # Set Capability for the RDR section of XML
+            $devdetails->setCap('sceRDR');
+            
+            # Get the names of the RDR Category
+            my $categoryNames = $session->get_table
+                ( -baseoid => $dd->oiddef('rdrFormatterCategoryName') );
+            
+            $devdetails->storeSnmpVars( $categoryNames );
+            
+            foreach my $categoryIndex
+                ( $devdetails->getSnmpIndices
+                  ( $dd->oiddef('rdrFormatterCategoryName') ) )
+            {
+                my $oid = $dd->oiddef('rdrFormatterCategoryName') . '.'
+                    . $categoryIndex;
+                $data->{'sceRDR'}{$categoryIndex} = $categoryNames->{$oid};
+            }
+        }
+    }
+    
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+    # Disk Usage information
+    if( $devdetails->hasCap('sceDisk') )
+    {
+        $cb->addTemplateApplication($devNode, 'CiscoSCE::cisco-sce-disk');
+    }
+
+    if( $devdetails->hasCap('sceSubscribers') )
+    {
+        $cb->addTemplateApplication($devNode,
+                                    'CiscoSCE::cisco-sce-subscribers');
+    }
+
+    # Traffic processors subtree
+    if( $devdetails->hasCap('sceTP') )
+    {   
+        my $tpNode = $cb->addSubtree( $devNode, 'SCE_TrafficProcessors',
+                                      { 'comment' => 'TP usage statistics' },
+                                      [ 'CiscoSCE::cisco-sce-tp-subtree']);
+
+        foreach my $tp ( 1 .. $data->{'sceTrafficProcessors'} )
+        {
+            $cb->addSubtree( $tpNode, sprintf('TP_%d', $tp),
+                             { 'sce-tp-index' => $tp },
+                             ['CiscoSCE::cisco-sce-tp'] );
+        }
+    }
+
+
+    # QoS queues
+    if( $devdetails->hasCap('sceQos') )
+    { 
+        # Queues subtree
+        my $qNode =
+            $cb->addSubtree( $devNode, 'SCE_Queues',
+                             { 'comment' => 'TX queues usage statistics' },
+                             [ 'CiscoSCE::cisco-sce-queues-subtree']);
+        
+        foreach my $pIndex ( sort {$a <=> $b}
+                             keys %{$data->{'scePortIfIndex'}} )
+        {
+            my $ifIndex = $data->{'scePortIfIndex'}{$pIndex};
+            my $interface = $data->{'interfaces'}{$ifIndex};
+
+            my $portNode =
+                $cb->addSubtree
+                ( $qNode,
+                  $interface->{$data->{'nameref'}{'ifSubtreeName'}},
+                  { 'sce-port-index' => $pIndex,
+                    'precedence' => 1000 - $pIndex });
+            
+            foreach my $qIndex ( sort {$a <=> $b} keys 
+                                 %{$data->{'sceQueues'}{$pIndex}} )
+            {
+                my $qName = $data->{'sceQueues'}{$pIndex}{$qIndex};
+                my $subtreeName = 'Q' . $qIndex;
+                
+                $cb->addLeaf( $portNode, $subtreeName,
+                              { 'sce-queue-index' => $qIndex,
+                                'comment' => $qName,
+                                'precedence' => 1000 - $qIndex });
+            }
+        }
+    } # hasCap sceQos
+
+
+    # Global counters
+    if( $devdetails->hasCap('sceGlobalCounters') )
+    {
+        foreach my $linkIndex ( 1 .. $data->{'sceInfo'}{'pmoduleNumLinks'} )
+        {
+            my $gcNode =
+                $cb->addSubtree( $devNode,
+                                 'SCE_Global_Counters_L' . $linkIndex,
+                                 { 'comment' =>
+                                       'Global service counters for link #'
+                                       . $linkIndex
+                                 },
+                                 [ 'CiscoSCE::cisco-sce-gc-subtree']);
+            
+            foreach my $gcIndex
+                ( sort {$a <=> $b} keys %{$data->{'sceGlobalCounters'}} )
+            {
+                my $srvName = $data->{'sceGlobalCounters'}{$gcIndex};
+                my $subtreeName = $srvName;
+                $subtreeName =~ s/\W/_/g;
+                
+                $cb->addSubtree( $gcNode, $subtreeName,
+                                 { 'sce-link-index'   => $linkIndex,
+                                   'sce-gc-index'     => $gcIndex,
+                                   'comment'          => $srvName,
+                                   'sce-service-name' => $srvName,
+                                   'precedence'       => 1000 - $gcIndex,
+                                   'searchable'       => 'yes'},
+                                 [ 'CiscoSCE::cisco-sce-gcounter' ]);
+            }
+        }
+    } # END hasCap sceGlobalCounters
+
+
+    # RDR Formatter reports
+    if( $devdetails->hasCap('sceRDR') )
+    {
+        $cb->addTemplateApplication($devNode, 'CiscoSCE::cisco-sce-rdr');
+
+        # Add a Subtree for "SCE_RDR_Categories"
+        my $rdrNode =
+            $cb->addSubtree( $devNode, 'SCE_RDR_Categories',
+                             { 'comment' => 'Raw Data Records per Category' },
+                             [ 'CiscoSCE::cisco-sce-rdr-category-subtree' ]);
+        
+        foreach my $cIndex ( sort {$a <=> $b} keys %{$data->{'sceRDR'}} )
+        {
+            my $categoryName;
+            if ( $data->{'sceRDR'}{$cIndex} )
+            {
+                $categoryName = $data->{'sceRDR'}{$cIndex};
+            }
+            else
+            {
+                $categoryName = 'Category_' . $cIndex;
+            }
+            
+            $cb->addSubtree( $rdrNode, 'Category_' . $cIndex,
+                             { 'precedence'      => 1000 - $cIndex,
+                               'sce-rdr-index'   => $cIndex,
+                               'sce-rdr-comment' => $categoryName },
+                             ['CiscoSCE::cisco-sce-rdr-category'] );
+        }
+    } # END hasCap sceRDR    
+}
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/CiscoVDSL.pm b/torrus/perllib/Torrus/DevDiscover/CiscoVDSL.pm
new file mode 100644 (file)
index 0000000..01d4975
--- /dev/null
@@ -0,0 +1,130 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: CiscoVDSL.pm,v 1.1 2010-12-27 00:03:53 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Cisco VDSL Line statistics.
+# Tested with Catalyst 2950 LRE
+
+package Torrus::DevDiscover::CiscoVDSL;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'CiscoVDSL'} = {
+    'sequence'     => 600,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # CISCO-IETF-VDSL-LINE-MIB
+     'cvdslCurrSnrMgn'  => '1.3.6.1.4.1.9.10.87.1.1.2.1.5',
+     );
+
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    if( $devdetails->isDevType('CiscoGeneric') )
+    {
+        my $snrTable =
+            $session->get_table( -baseoid => $dd->oiddef('cvdslCurrSnrMgn') );
+        if( defined $snrTable )
+        {
+            $devdetails->storeSnmpVars( $snrTable );
+            return 1;
+        }
+    }
+
+    return 0;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+
+    $data->{'cvdsl'} = [];
+
+    foreach my $ifIndex ( keys %{$data->{'interfaces'}} )
+    {
+        my $oid = $dd->oiddef('cvdslCurrSnrMgn') . '.' . $ifIndex;
+        if( $devdetails->hasOID( $oid . '.1' ) and
+            $devdetails->hasOID( $oid . '.2' ) )
+        {
+            push( @{$data->{'cvdsl'}}, $ifIndex );
+        }
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    my $subtreeName = 'VDSL_Line_Stats';
+
+    my $subtreeNode = $cb->addSubtree( $devNode, $subtreeName, {},
+                                       ['CiscoVDSL::cvdsl-subtree']);
+
+    my $data = $devdetails->data();
+
+    foreach my $ifIndex ( sort {$a<=>$b} @{$data->{'cvdsl'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+
+        my $ifSubtreeName = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
+
+        my $templates = ['CiscoVDSL::cvdsl-interface'];
+
+        my $param = {
+            'interface-name' => $interface->{'param'}{'interface-name'},
+            'interface-nick' => $interface->{'param'}{'interface-nick'},
+            'comment'        => $interface->{'param'}{'comment'}
+        };
+
+        $cb->addSubtree( $subtreeNode, $ifSubtreeName, $param, $templates );
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/CompaqCIM.pm b/torrus/perllib/Torrus/DevDiscover/CompaqCIM.pm
new file mode 100644 (file)
index 0000000..f055a18
--- /dev/null
@@ -0,0 +1,212 @@
+#  Copyright (C) 2003  Shawn Ferry
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: CompaqCIM.pm,v 1.1 2010-12-27 00:03:47 ivan Exp $
+# Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+
+# Compaq Insight Manager
+# MIB files available at
+# http://h18023.www1.hp.com/support/files/server/us/download/19885.html
+
+package Torrus::DevDiscover::CompaqCIM;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'CompaqCIM'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+our %oiddef =
+    (
+     # Compaq Insite Manager
+     'cpqcim'                           => '1.3.6.1.4.1.232',
+
+     # CPQHLTH-MIB
+     'cpqHeTemperatureTable'            => '1.3.6.1.4.1.232.6.2.6.8',
+     'cpqHeTemperatureChassis'          => '1.3.6.1.4.1.232.6.2.6.8.1.1',
+     'cpqHeTemperatureIndex'            => '1.3.6.1.4.1.232.6.2.6.8.1.2',
+     'cpqHeTemperatureLocale'           => '1.3.6.1.4.1.232.6.2.6.8.1.3',
+     'cpqHeTemperatureCelsius'          => '1.3.6.1.4.1.232.6.2.6.8.1.4',
+     'cpqHeTemperatureHwLocation'       => '1.3.6.1.4.1.232.6.2.6.8.1.8',
+
+     'cpqHeCorrMemTotalErrs'            => '1.3.6.1.4.1.232.6.2.3.3.0',
+
+     # This is not a complete implementation  of the HLTH MIB
+
+     );
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    return $dd->checkSnmpTable( 'cpqcim' );
+}
+
+my $enumLocale = {
+    1   => 'other',
+    2   => 'unknown',
+    3   => 'system',
+    4   => 'systemBoard',
+    5   => 'ioBoard',
+    6   => 'cpu',
+    7   => 'memory',
+    8   => 'storage',
+    9   => 'removableMedia',
+    10  => 'powerSupply',
+    11  => 'ambient',
+    12  => 'chassis',
+    13  => 'bridgeCard',
+};
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    my @checkOids = ( 'cpqHeCorrMemTotalErrs' );
+
+    foreach my $oid ( @checkOids )
+    {
+        if( $dd->checkSnmpOID($oid) )
+        { 
+            $devdetails->setCap( $oid );
+        }
+    }
+
+    my $TemperatureTable =
+        $session->get_table( -baseoid =>
+                             $dd->oiddef('cpqHeTemperatureTable') );
+
+    if( defined( $TemperatureTable ) )
+    {
+        $devdetails->storeSnmpVars( $TemperatureTable );
+        $devdetails->setCap( 'cpqHeTemperatureTable' );
+
+        my $ref = {};
+        $ref->{'indices'} = [];
+        $data->{'TemperatureTable'} = $ref;
+
+        # Index is Chassis . Index
+        foreach my $INDEX
+            ( $devdetails->
+              getSnmpIndices( $dd->oiddef('cpqHeTemperatureIndex') ) )
+        {
+            next if ( $devdetails->snmpVar
+                      ( $dd->oiddef('cpqHeTemperatureCelsius') .
+                        '.' . $INDEX ) < 0 );
+
+            push( @{$ref->{'indices'}}, $INDEX );
+
+            my $chassis = $devdetails->snmpVar
+                ( $dd->oiddef('cpqHeTemperatureChassis') . '.' . $INDEX );
+
+            my $sensorIdx = $devdetails->snmpVar
+                ( $dd->oiddef('cpqHeTemperatureIndex') . '.' . $INDEX );
+
+            my $locale = $devdetails->snmpVar
+                ( $dd->oiddef('cpqHeTemperatureLocale') . '.' . $INDEX );
+            $locale = $enumLocale->{$locale} if $enumLocale->{$locale};
+
+            my $location = $devdetails->snmpVar
+                ( $dd->oiddef('cpqHeTemperatureHwLocation') . '.' . $INDEX );
+
+            my $nick = sprintf('Chassis%d_%s_%d',
+                               $chassis, $locale, $sensorIdx);
+
+            my $param = {};
+            $ref->{$INDEX}->{'param'} = $param;
+            $param->{'cpq-cim-sensor-index'} = $INDEX;
+            $param->{'cpq-cim-sensor-nick'} = $nick;
+            $param->{'comment'} =
+                sprintf('Chassis: %s Location: %s Index: %s',
+                        $chassis, $locale, $sensorIdx);
+            $param->{'precedence'} = 1000 - $sensorIdx;
+        }
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+    my $cimParam = {
+        'comment'           => 'Compaq Insight Manager',
+        'precedence'        => '-500',
+    };
+
+    my $cimNode = $cb->addSubtree( $devNode, 'CompaqCIM', $cimParam );
+
+    my $healthParam = {
+        'comment'           => 'Compaq CIM Health',
+        'precedence'        => '-500'
+        };
+
+    my @healthTemplates;
+    if( $devdetails->hasCap('cpqHeCorrMemTotalErrs') )
+    {
+        push( @healthTemplates, 'CompaqCIM::cpq-cim-corr-mem-errs' );
+    }
+
+    my $Health = $cb->addSubtree( $cimNode, 'Health', $healthParam,
+                                  \@healthTemplates);
+
+    if( $devdetails->hasCap('cpqHeTemperatureTable') )
+    {
+        my $tempParam = {
+            'precedence' => '-100',
+            'comment' => 'Compaq Temperature Sensors',
+            'rrd-create-dstype' => 'GAUGE',
+        };
+
+        my $tempNode =
+            $cb->addSubtree(  $Health, 'Temperature_Sensors', $tempParam );
+
+        my $ref = $data->{'TemperatureTable'};
+
+        foreach my $INDEX ( @{ $ref->{'indices'} } )
+        {
+            my $param = $ref->{$INDEX}->{'param'};
+            $cb->addLeaf( $tempNode, $param->{'cpq-cim-sensor-nick'}, $param,
+                          [ 'CompaqCIM::cpq-cim-temperature-sensor' ] );
+        }
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/EmpireSystemedge.pm b/torrus/perllib/Torrus/DevDiscover/EmpireSystemedge.pm
new file mode 100644 (file)
index 0000000..f796920
--- /dev/null
@@ -0,0 +1,798 @@
+#  Copyright (C) 2003 Shawn Ferry
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: EmpireSystemedge.pm,v 1.1 2010-12-27 00:03:55 ivan Exp $
+# Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+
+package Torrus::DevDiscover::EmpireSystemedge;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'EmpireSystemedge'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+# define the oids that are needed to determine support,
+# capabilities and information about the device
+our %oiddef =
+    (
+     'empire'                   => '1.3.6.1.4.1.546',
+
+     'sysedge_opmode'           => '1.3.6.1.4.1.546.1.1.1.17.0',
+     'empireSystemType'         => '1.3.6.1.4.1.546.1.1.1.12.0',
+
+     # Empire Cpu Table
+     'empireCpuStatsTable'      => '1.3.6.1.4.1.546.13.1.1',
+     'empireCpuStatsIndex'      => '1.3.6.1.4.1.546.13.1.1.1',
+     'empireCpuStatsDescr'      => '1.3.6.1.4.1.546.13.1.1.2',
+
+     # Empire Cpu Totals
+     'empireCpuTotalWait'       => '1.3.6.1.4.1.546.13.5.0',
+
+     # Empire Swap Counters
+     'empireNumPageSwapIns'      => '1.3.6.1.4.1.546.1.1.7.8.18.0',
+
+     # Empire Load Average
+     'empireLoadAverage'        => '1.3.6.1.4.1.546.1.1.7.8.26.0',
+
+     # Empire Device Table and Oids
+     'empireDevTable'           => '1.3.6.1.4.1.546.1.1.1.7.1',
+     'empireDevIndex'           => '1.3.6.1.4.1.546.1.1.1.7.1.1',
+     'empireDevMntPt'           => '1.3.6.1.4.1.546.1.1.1.7.1.3',
+     'empireDevBsize'           => '1.3.6.1.4.1.546.1.1.1.7.1.4',
+     'empireDevTblks'           => '1.3.6.1.4.1.546.1.1.1.7.1.5',
+     'empireDevType'            => '1.3.6.1.4.1.546.1.1.1.7.1.10',
+     'empireDevDevice'          => '1.3.6.1.4.1.546.1.1.1.7.1.2',
+
+     # Empire Device Stats Table and Oids
+     'empireDiskStatsTable'      => '1.3.6.1.4.1.546.12.1.1',
+     'empireDiskStatsIndex'      => '1.3.6.1.4.1.546.12.1.1.1',
+     'empireDiskStatsHostIndex'  => '1.3.6.1.4.1.546.12.1.1.9',
+     'hrDeviceDescr'             => '1.3.6.1.2.1.25.3.2.1.3',
+
+     # Empire Performance and related oids
+     'empirePerformance'        => '1.3.6.1.4.1.546.1.1.7',
+     'empireNumTraps'           => '1.3.6.1.4.1.546.1.1.7.8.15.0',
+
+     # Empire Process Stats
+     'empireRunq'               => '1.3.6.1.4.1.546.1.1.7.8.4.0',
+     'empireDiskWait'           => '1.3.6.1.4.1.546.1.1.7.8.5.0',
+     'empirePageWait'           => '1.3.6.1.4.1.546.1.1.7.8.6.0',
+     'empireSwapActive'         => '1.3.6.1.4.1.546.1.1.7.8.7.0',
+     'empireSleepActive'        => '1.3.6.1.4.1.546.1.1.7.8.8.0',
+
+     # Empire Extensions NTREGPERF
+     'empireNTREGPERF'          => '1.3.6.1.4.1.546.5.7',
+
+     'empireDnlc'               => '1.3.6.1.4.1.546.1.1.11',
+     'empireRpc'                => '1.3.6.1.4.1.546.8.1',
+     'empireNfs'                => '1.3.6.1.4.1.546.8.2',
+     'empireMon'                => '1.3.6.1.4.1.546.6.1.1',
+     'empirePmon'               => '1.3.6.1.4.1.546.15.1.1',
+     'empireLog'                => '1.3.6.1.4.1.546.11.1.1',
+     );
+
+our %storageDescTranslate =  ( '/' => {'subtree' => 'root' } );
+
+# template => 1 if specific templates for the name explicitly exist,
+# othewise the template used is based on ident
+#
+# Generally only hosts that have been directly observed should have
+# templates, the "unix" and "nt" templates are generally aiming for the
+# lowest common denominator.
+#
+# templates also need to be added to devdiscover-config.pl
+#
+#    Templated "names" require a specific template for each of the
+#    following base template types:
+#    <template name="empire-swap-counters-NAME">
+#    <template name="empire-counters-NAME">
+#    <template name="empire-total-cpu-NAME">
+#    <template name="empire-total-cpu-raw-NAME">
+#    <template name="empire-cpu-NAME">
+#    <template name="empire-cpu-raw-NAME">
+#    <template name="empire-disk-stats-NAME">
+#
+#    i.e.
+#    <template name="empire-swap-counters-solarisSparc">
+#    <template name="empire-counters-solarisSparc">
+#    <template name="empire-total-cpu-solarisSparc">
+#    <template name="empire-total-cpu-raw-solarisSparc">
+#    <template name="empire-cpu-solarisSparc">
+#    <template name="empire-cpu-raw-solarisSparc">
+#    <template name="empire-disk-stats-solarisSparc">
+#
+
+
+our %osTranslate =
+    (
+     1  => { 'name' => 'unknown',   'ident' => 'unknown', 'template' => 0, },
+     2  => { 'name' => 'solarisSparc', 'ident' => 'unix', 'template' => 1, },
+     3  => { 'name' => 'solarisIntel', 'ident' => 'unix', 'template' => 0, },
+     4  => { 'name' => 'solarisPPC',   'ident' => 'unix', 'template' => 0, },
+     5  => { 'name' => 'sunosSparc',   'ident' => 'unix', 'template' => 0, },
+     6  => { 'name' => 'hpux9Parisc',  'ident' => 'unix', 'template' => 0, },
+     7  => { 'name' => 'hpux10Parisc', 'ident' => 'unix', 'template' => 0, },
+     8  => { 'name' => 'nt351Intel',   'ident' => 'nt',   'template' => 0, },
+     9  => { 'name' => 'nt351Alpha',   'ident' => 'nt',   'template' => 0, },
+     10 => { 'name' => 'nt40Intel',    'ident' => 'nt',   'template' => 1, },
+     11 => { 'name' => 'nt40Alpha',    'ident' => 'nt',   'template' => 0, },
+     12 => { 'name' => 'irix62Mips',   'ident' => 'unix', 'template' => 0, },
+     13 => { 'name' => 'irix63Mips',   'ident' => 'unix', 'template' => 0, },
+     14 => { 'name' => 'irix64Mips',   'ident' => 'unix', 'template' => 0, },
+     15 => { 'name' => 'aix41RS6000',  'ident' => 'unix', 'template' => 0, },
+     16 => { 'name' => 'aix42RS6000',  'ident' => 'unix', 'template' => 0, },
+     17 => { 'name' => 'aix43RS6000',  'ident' => 'unix', 'template' => 0, },
+     18 => { 'name' => 'irix65Mips',   'ident' => 'unix', 'template' => 0, },
+     19 => { 'name' => 'digitalUNIX',  'ident' => 'unix', 'template' => 0, },
+     20 => { 'name' => 'linuxIntel',   'ident' => 'unix', 'template' => 1, },
+     21 => { 'name' => 'hpux11Parisc', 'ident' => 'unix', 'template' => 0, },
+     22 => { 'name' => 'nt50Intel',    'ident' => 'nt',   'template' => 1, },
+     23 => { 'name' => 'nt50Alpha',    'ident' => 'nt',   'template' => 0, },
+     25 => { 'name' => 'aix5RS6000',   'ident' => 'unix', 'template' => 1, },
+     26 => { 'name' => 'nt52Intel',    'ident' => 'nt',   'template' => 0, },
+     );
+
+# Solaris Virtual Interface Filtering
+our $interfaceFilter;
+my %solarisVirtualInterfaceFilter;
+
+%solarisVirtualInterfaceFilter = (
+    'Virtual Interface (iana 62)' => {
+        'ifType'    =>  62,             # Obsoleted
+        'ifDescr'   =>  '^\w+:\d+$',    # Virtual Interface in the form xxx:1
+                                        # e.g. eri:1 eri1:2
+        },
+
+    'Virtual Interface' => {
+        'ifType'    =>  6,
+        'ifDescr'   =>  '^\w+:\d+$',    # Virtual Interface in the form xxx:1
+                                        # e.g. eri:1 eri1:2
+        },
+    );
+
+our $storageGraphTop;
+our $storageHiMark;
+our $shortTemplate;
+our $longTemplate;
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    my $session = $dd->session();
+
+    if( not $dd->checkSnmpTable( 'empire' ) )
+    {
+        return 0;
+    }
+
+    my $result = $dd->retrieveSnmpOIDs( 'sysedge_opmode',
+                                        'empireSystemType' );
+    if( $result->{'sysedge_opmode'} == 2 )
+    {
+        Error("Sysedge Agent NOT Licensed");
+        $devdetails->setCap('SysedgeNotLicensed');
+    }
+
+    # Empire OS Type (Needed here for interface filtering)
+    
+    my $empireOsType = $result->{'empireSystemType'};
+    if( defined($empireOsType) and $empireOsType > 0 )
+    {
+        $devdetails->setCap('EmpireSystemedge::' .
+                            $osTranslate{$empireOsType}{ident} );
+        
+        $devdetails->{'os_ident'} = $osTranslate{$empireOsType}{ident};
+
+        
+        $devdetails->setCap('EmpireSystemedge::' .
+                            $osTranslate{$empireOsType}{name} );
+        
+        $devdetails->{'os_name'} = $osTranslate{$empireOsType}{name};
+
+        $devdetails->{'os_name_template'} =
+            $osTranslate{$empireOsType}{template};
+    }
+
+    # Exclude Virtual Interfaces on Solaris
+    if( $devdetails->{'os_name'} =~ /solaris/i ) {
+
+        $interfaceFilter = \%solarisVirtualInterfaceFilter;
+        &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+            ($devdetails, $interfaceFilter);
+    }
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+
+
+    if( $dd->checkSnmpOID('empireCpuTotalWait') )
+    {
+        $devdetails->setCap('EmpireSystemedge::CpuTotal::Wait');
+    }
+
+    # Empire Dev Stats Table
+
+    my $empireDiskStatsTable =
+        $session->get_table( -baseoid =>
+                             $dd->oiddef('empireDiskStatsTable') );
+
+    my $hrDeviceDescr = $session->get_table( -baseoid =>
+                                             $dd->oiddef('hrDeviceDescr') );
+
+    if( defined($empireDiskStatsTable) and defined($hrDeviceDescr) )
+    {
+        $devdetails->setCap('EmpireSystemedge::DiskStats');
+        $devdetails->storeSnmpVars( $empireDiskStatsTable );
+        $devdetails->storeSnmpVars( $hrDeviceDescr );
+
+        my $ref= {'indices' => []};
+        $data->{'empireDiskStats'} = $ref;
+
+        foreach my $INDEX
+            ( $devdetails->
+              getSnmpIndices( $dd->oiddef('empireDiskStatsIndex') ) )
+        {
+            next if( $INDEX < 1 );
+
+            my $hrindex =
+                $devdetails->snmpVar( $dd->oiddef('empireDiskStatsHostIndex') .
+                                      '.' . $INDEX );
+
+            next if( $hrindex < 1 );
+
+            push( @{ $ref->{'indices'} }, $INDEX );
+
+            my $descr = $devdetails->snmpVar($dd->oiddef('hrDeviceDescr') .
+                                             '.' . $hrindex );
+
+            my $ref = { 'param' => {}, 'templates' => [] };
+            $data->{'empireDiskStats'}{$INDEX} = $ref;
+            my $param = $ref->{'param'};
+
+
+            $param->{'comment'} = $descr;
+
+            $param->{'HRINDEX'} = $hrindex;
+
+            if ( not defined $descr )
+            {
+                $descr = "Index $hrindex";
+            }
+            $param->{'disk-stats-description'} = $descr;
+
+            $descr =~ s/^\///;
+            $descr =~ s/\W/_/g;
+            $param->{'disk-stats-nick'} = $descr;
+
+        }
+    } # end empireDiskStatsTable
+
+    # Empire Dev Table
+
+    my $empireDevTable = $session->get_table( -baseoid =>
+                                              $dd->oiddef('empireDevTable') );
+
+    if( defined( $empireDevTable ) )
+    {
+
+        $devdetails->setCap('EmpireSystemedge::Devices');
+        $devdetails->storeSnmpVars( $empireDevTable );
+
+        my $ref= {};
+        $data->{'empireDev'} = $ref;
+
+        foreach my $INDEX
+            ( $devdetails->getSnmpIndices($dd->oiddef('empireDevIndex') ) )
+        {
+            next if( $INDEX < 1 );
+
+
+            my $type = $devdetails->snmpVar( $dd->oiddef('empireDevType') .
+                                             '.' . $INDEX );
+
+            my $descr = $devdetails->snmpVar($dd->oiddef('empireDevMntPt') .
+                                             '.' . $INDEX );
+
+            my $bsize =  $devdetails->snmpVar($dd->oiddef('empireDevBsize') .
+                                              '.' . $INDEX );
+
+            # NFS has a block size of 0, it will be skipped
+            if( $bsize and defined( $descr ) )
+            {
+                push( @{ $data->{'empireDev'}->{'indices'} }, $INDEX);
+
+                my $ref = { 'param' => {}, 'templates' => [] };
+                $data->{'empireDev'}{$INDEX} = $ref;
+                my $param = $ref->{'param'};
+
+                $param->{'storage-description'} = $descr;
+                $param->{'storage-device'} =
+                    $devdetails->snmpVar($dd->oiddef('empireDevDevice')
+                                         . '.' . $INDEX );
+
+                my $comment = $type;
+                if( $descr =~ /^\// )
+                {
+                    $comment .= ' (' . $descr . ')';
+                }
+                $param->{'comment'} = $comment;
+
+                if( $storageDescTranslate{$descr}{'subtree'} )
+                {
+                    $descr = $storageDescTranslate{$descr}{'subtree'};
+                }
+                $descr =~ s/^\///;
+                $descr =~ s/\W/_/g;
+                $param->{'storage-nick'} = $descr;
+
+                my $units = $bsize;
+
+                $param->{'collector-scale'} = sprintf('%d,*', $units);
+
+                my $size =
+                    $devdetails->snmpVar
+                    ($dd->oiddef('empireDevTblks') . '.' . $INDEX);
+
+                if( $size )
+                {
+                    if( $storageGraphTop > 0 )
+                    {
+                        $param->{'graph-upper-limit'} =
+                            sprintf('%e',
+                                    $units * $size * $storageGraphTop / 100 );
+                    }
+
+                    if( $storageHiMark > 0 )
+                    {
+                        $param->{'upper-limit'} =
+                            sprintf('%e',
+                                    $units * $size * $storageHiMark / 100 );
+                    }
+                }
+
+            }
+        }
+
+        $devdetails->clearCap( 'hrStorage' );
+
+    } # end empireDevTable
+
+
+    # Empire Per - Cpu Table
+
+    my $empireCpuStatsTable =
+        $session->get_table( -baseoid =>
+                             $dd->oiddef('empireCpuStatsTable') );
+
+    if( defined( $empireCpuStatsTable ) )
+    {
+        $devdetails->setCap('EmpireSystemedge::CpuStats');
+        $devdetails->storeSnmpVars( $empireCpuStatsTable );
+
+        my $ref= {};
+        $data->{'empireCpuStats'} = $ref;
+
+        foreach my $INDEX
+            ( $devdetails->
+              getSnmpIndices( $dd->oiddef('empireCpuStatsIndex') ) )
+        {
+            next if( $INDEX < 1 );
+
+            push( @{ $ref->{'indices'} }, $INDEX);
+
+            my $descr =
+                $devdetails->snmpVar( $dd->oiddef('empireCpuStatsDescr') .
+                                      '.' . $INDEX );
+
+            my $ref = { 'param' => {}, 'templates' => [] };
+            $data->{'empireCpuStats'}{$INDEX} = $ref;
+            my $param = $ref->{'param'};
+
+            $param->{'cpu'} = 'CPU' . $INDEX;
+            $param->{'descr'} = $descr;
+            $param->{'INDEX'} = $INDEX;
+            $param->{'comment'} = $descr . ' (' . 'CPU ' . $INDEX . ')';
+        }
+    }
+
+    # Empire Load Average
+
+    if( $dd->checkSnmpOID('empireLoadAverage') )
+    {
+        $devdetails->setCap('EmpireSystemedge::LoadAverage');
+    }
+
+    # Empire Swap Counters
+
+    if( $dd->checkSnmpOID('empireNumPageSwapIns') )
+    {
+        $devdetails->setCap('EmpireSystemedge::SwapCounters');
+    }
+
+    # Empire Counter Traps
+
+    if( $dd->checkSnmpOID('empireNumTraps') )
+    {
+        $devdetails->setCap('EmpireSystemedge::CounterTraps');
+    }
+
+    # Empire Performance
+
+    my $empirePerformance =
+        $session->get_table( -baseoid => $dd->oiddef('empirePerformance') );
+
+    if( defined( $empirePerformance ) )
+    {
+        $devdetails->setCap('EmpireSystemedge::Performance');
+        $devdetails->storeSnmpVars( $empirePerformance );
+
+        if( defined $devdetails->snmpVar($dd->oiddef('empireRunq') ) )
+        {
+            $devdetails->setCap('EmpireSystemedge::RunQ');
+        }
+
+        if( defined $devdetails->snmpVar($dd->oiddef('empireDiskWait') ) )
+        {
+            $devdetails->setCap('EmpireSystemedge::DiskWait');
+        }
+
+        if( defined $devdetails->snmpVar($dd->oiddef('empirePageWait') ) )
+        {
+            $devdetails->setCap('EmpireSystemedge::PageWait');
+        }
+
+        if( defined $devdetails->snmpVar($dd->oiddef('empireSwapActive') ) )
+        {
+            $devdetails->setCap('EmpireSystemedge::SwapActive');
+        }
+
+        if( defined $devdetails->snmpVar($dd->oiddef('empireSleepActive') ) )
+        {
+            $devdetails->setCap('EmpireSystemedge::SleepActive');
+        }
+    }
+
+    my $empireNTREGPERF =
+        $session->get_table( -baseoid => $dd->oiddef('empireNTREGPERF') );
+    if( defined $empireNTREGPERF )
+    {
+        $devdetails->setCap('empireNTREGPERF');
+        $devdetails->storeSnmpVars( $empireNTREGPERF );
+
+        my $ref = {};
+        $data->{'empireNTREGPERF'} = $ref;
+        foreach my $INDEX
+            ( $devdetails->getSnmpIndices($dd->oiddef('empireNTREGPERF') ) )
+        {
+            # This is all configured on a per site basis.
+            # The xml will be site specific
+            push( @{ $ref->{'indices'} }, $INDEX);
+            my $template = {};
+            $Torrus::ConfigBuilder::templateRegistry->
+            {'EmpireSystemedge::NTREGPERF_' . $INDEX} = $template;
+            $template->{'name'}='EmpireSystemedge::NTREGPERF_' . $INDEX;
+            $template->{'source'}='vendor/empire.systemedge.ntregperf.xml';
+
+        }
+    }
+
+#NOT CONFIGURED## Empire DNLC
+#NOT CONFIGURED#    my $empireDnlc = $session->get_table( -baseoid =>
+#NOT CONFIGURED#        $dd->oiddef('empireDnlc') );
+#NOT CONFIGURED#    if( defined $empirePerformance )
+#NOT CONFIGURED#    {
+#NOT CONFIGURED#        # don't do this until we use the data
+#NOT CONFIGURED#        #$devdetails->setCap('empirednlc');
+#NOT CONFIGURED#        #$devdetails->storeSnmpVars( $empireDnlc );
+#NOT CONFIGURED#    }
+#NOT CONFIGURED#
+#NOT CONFIGURED## Empire RPC
+#NOT CONFIGURED#    my $empireRpc = $session->get_table( -baseoid =>
+#NOT CONFIGURED#        $dd->oiddef('empireRpc') );
+#NOT CONFIGURED#    if( defined $empireRpc )
+#NOT CONFIGURED#    {
+#NOT CONFIGURED#        # don't do this until we use the data
+#NOT CONFIGURED#        #$devdetails->setCap('empirerpc');
+#NOT CONFIGURED#        #$devdetails->storeSnmpVars( $empireRpc );
+#NOT CONFIGURED#    }
+#NOT CONFIGURED#
+#NOT CONFIGURED## Empire NFS
+#NOT CONFIGURED#    my $empireNfs = $session->get_table( -baseoid =>
+#NOT CONFIGURED#        $dd->oiddef('empireNfs') );
+#NOT CONFIGURED#    if( defined $empireRpc )
+#NOT CONFIGURED#    {
+#NOT CONFIGURED#        # don't do this until we use the data
+#NOT CONFIGURED#        #$devdetails->setCap('empirenfs');
+#NOT CONFIGURED#        #$devdetails->storeSnmpVars( $empireNfs );
+#NOT CONFIGURED#    }
+#NOT CONFIGURED#
+#NOT CONFIGURED## Empire Mon Entries
+#NOT CONFIGURED#    my $empireMon = $session->get_table( -baseoid =>
+#NOT CONFIGURED#        $dd->oiddef('empireMon') );
+#NOT CONFIGURED#    if( ref( $empireMon ) )
+#NOT CONFIGURED#    {
+#NOT CONFIGURED#        # don't do this until we use the data
+#NOT CONFIGURED#        #$devdetails->setCap('empiremon');
+#NOT CONFIGURED#        #$devdetails->storeSnmpVars( $empireMon );
+#NOT CONFIGURED#    }
+#NOT CONFIGURED#
+#NOT CONFIGURED## Empire Process Monitor Entries
+#NOT CONFIGURED#    my $empirePmon = $session->get_table( -baseoid =>
+#NOT CONFIGURED#        $dd->oiddef('empirePmon') );
+#NOT CONFIGURED#    if( ref( $empirePmon ) )
+#NOT CONFIGURED#    {
+#NOT CONFIGURED#        # don't do this until we use the data
+#NOT CONFIGURED#        #$devdetails->setCap('empirePmon');
+#NOT CONFIGURED#        #$devdetails->storeSnmpVars( $empirePmon );
+#NOT CONFIGURED#    }
+#NOT CONFIGURED#
+#NOT CONFIGURED## Empire Log Monitor Entries
+#NOT CONFIGURED#    my $empireLog = $session->get_table( -baseoid =>
+#NOT CONFIGURED#        $dd->oiddef('empireLog') );
+#NOT CONFIGURED#    if( ref( $empireLog ) )
+#NOT CONFIGURED#    {
+#NOT CONFIGURED#        # don't do this until we use the data
+#NOT CONFIGURED#        #$devdetails->setCap('empireLog');
+#NOT CONFIGURED#        #$devdetails->storeSnmpVars( $empireLog );
+#NOT CONFIGURED#    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+    my $mononlyTree = "Mon_Only";
+    my $monParam = {
+        'precedence'    => '-100000',
+        'comment'       => 'Place to Stash Monitoring Data ',
+        'hidden'        => 'yes',
+    };
+
+    my $monNode = $cb->addSubtree( $devNode, $mononlyTree, $monParam );
+    $cb->addTemplateApplication
+        ( $monNode, 'EmpireSystemedge::sysedge_opmode' );
+
+    if( $devdetails->hasCap('SysedgeNotLicensed') )
+    {
+        return 1;
+    }
+
+    my $os_target;
+    if( $devdetails->{'os_name_template'} )
+    {
+        $os_target = $devdetails->{'os_name'};
+    }
+    else
+    {
+        $os_target = $devdetails->{'os_ident'};
+        Warn("Using Generic OS Templates '$os_target' for os: "
+             .  $devdetails->{'os_name'} );
+    }
+
+    my $subtreeName = "Storage";
+
+    my $param = {
+        'precedence'    => '-1000',
+        'comment'       => 'Storage Information',
+    };
+
+    my $StorageNode = $cb->addSubtree( $devNode, $subtreeName, $param );
+
+    # Empire Devices(Storage)
+    if( $devdetails->hasCap('EmpireSystemedge::Devices') )
+    {
+        my $subtreeName = "VolumeInfo";
+
+        my $param = {
+            'precedence'    => '-1000',
+            'comment'       => 'Physical/Logical Volume Information',
+        };
+
+        my $subtreeNode =
+            $cb->addSubtree( $StorageNode, $subtreeName, $param,
+                             [ 'EmpireSystemedge::empire-device-subtree' ] );
+
+        foreach my $INDEX ( sort {$a<=>$b} @{$data->{'empireDev'}{'indices'}} )
+        {
+            my $ref = $data->{'empireDev'}{$INDEX};
+
+            # Display in index order
+            $ref->{'param'}->{'precedence'} = sprintf("%d", 2000 - $INDEX);
+
+            $cb->addSubtree( $subtreeNode, $ref->{'param'}{'storage-nick'},
+                             $ref->{'param'},
+                             [ 'EmpireSystemedge::empire-device' ] );
+        }
+    }
+
+    # Empire Device Stats
+    if( $devdetails->hasCap('EmpireSystemedge::DiskStats') )
+    {
+        my $subtreeName = "DiskInfo";
+
+        my $param = {
+            'precedence'    => '-1000',
+            'comment'       => 'Physical/Logical Disk Information',
+        };
+
+        my $subtreeNode =
+            $cb->addSubtree( $StorageNode, $subtreeName, $param,
+                             ['EmpireSystemedge::empire-disk-stats-subtree']);
+
+        foreach my $INDEX
+            ( sort {$a<=>$b} @{$data->{'empireDiskStats'}{'indices'}} )
+        {
+            my $ref = $data->{'empireDiskStats'}{$INDEX};
+            # Display in index order
+            $ref->{'param'}->{'precedence'} = sprintf("%d", 1000 - $INDEX);
+
+            $cb->addSubtree( $subtreeNode, $ref->{'param'}{'disk-stats-nick'},
+                             $ref->{'param'},
+                             [ 'EmpireSystemedge::empire-disk-stats-' .
+                               $os_target, ] );
+        }
+    }
+
+
+    # Performance Subtree
+    my $subtreeName= "System_Performance";
+
+    my $param = {
+        'precedence'     => '-900',
+        'comment'        => 'System, CPU and memory statistics'
+        };
+
+    my @perfTemplates = ();
+
+    # Empire Load Average
+    if( $devdetails->hasCap('EmpireSystemedge::LoadAverage') )
+    {
+        push( @perfTemplates, 'EmpireSystemedge::empire-load' );
+    }
+
+    # Empire Performance
+    if( $devdetails->hasCap('EmpireSystemedge::Performance') )
+    {
+        push( @perfTemplates, 'EmpireSystemedge::empire-memory' );
+    }
+
+    push( @perfTemplates,
+          'EmpireSystemedge::empire-counters-' . $os_target,
+          'EmpireSystemedge::empire-swap-counters-' . $os_target,
+          'EmpireSystemedge::empire-total-cpu-' .  $os_target,
+          'EmpireSystemedge::empire-total-cpu-raw-' .  $os_target,
+          );
+
+    if( $devdetails->hasCap('EmpireSystemedge::RunQ') )
+    {
+        push( @perfTemplates, 'EmpireSystemedge::empire-runq' );
+    }
+
+    if( $devdetails->hasCap('EmpireSystemedge::DiskWait') )
+    {
+        push( @perfTemplates, 'EmpireSystemedge::empire-diskwait' );
+    }
+
+    if( $devdetails->hasCap('EmpireSystemedge::PageWait') )
+    {
+        push( @perfTemplates, 'EmpireSystemedge::empire-pagewait' );
+    }
+
+    if( $devdetails->hasCap('EmpireSystemedge::SwapActive') )
+    {
+        push( @perfTemplates, 'EmpireSystemedge::empire-swapactive' );
+    }
+
+    if( $devdetails->hasCap('EmpireSystemedge::SleepActive') )
+    {
+        push( @perfTemplates, 'EmpireSystemedge::empire-sleepactive' );
+    }
+
+    my $PerformanceNode = $cb->addSubtree( $devNode, $subtreeName,
+                                           $param, \@perfTemplates   );
+
+    # Empire CPU Stats
+    if( $devdetails->hasCap('EmpireSystemedge::CpuStats') )
+    {
+        my $ref = $data->{'empireCpuStats'};
+
+        my $subtreeName = "CpuStats";
+
+        my $param = {
+            'precedence'    => '-1100',
+            'comment'       => 'Per-CPU Statistics',
+        };
+
+        my $subtreeNode =
+            $cb->addSubtree( $PerformanceNode, $subtreeName, $param,
+                             [ 'EmpireSystemedge::empire-cpu-subtree' ] );
+
+        foreach my $INDEX
+            ( sort {$a<=>$b} @{$data->{'empireCpuStats'}{'indices'} } )
+        {
+            my $ref = $data->{'empireCpuStats'}{$INDEX};
+
+            # Display in index order
+            $ref->{'param'}->{'precedence'} = sprintf("%d", 1000 - $INDEX);
+
+            $cb->addSubtree
+                ( $subtreeNode, $ref->{'param'}{'cpu'},
+                  $ref->{'param'},
+                  ['EmpireSystemedge::empire-cpu-' . $os_target,
+                   'EmpireSystemedge::empire-cpu-raw-' . $os_target],
+                  );
+        }
+    }
+
+    if( $devdetails->hasCap('empireNTREGPERF') )
+    {
+        Debug("NTREGPERF");
+        my $ntregTree = "NT_REG_PERF";
+        my $ntregParam = {
+            'precedence'    => '-10000',
+            'comment'       => 'NT Reg Perf',
+        };
+        my $ntregnode =
+            $cb->addSubtree( $devNode, $ntregTree, $ntregParam );
+
+        foreach my $INDEX
+            ( sort {$a<=>$b} @{$data->{'empireNTREGPERF'}{'indices'} } )
+        {
+            my $ref = $data->{'empireNTREGPERF'}{$INDEX};
+            $cb->addTemplateApplication
+                ( $ntregnode, 'EmpireSystemedge::NTREGPERF_' . $INDEX );
+
+        }
+
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/F5BigIp.pm b/torrus/perllib/Torrus/DevDiscover/F5BigIp.pm
new file mode 100644 (file)
index 0000000..e0d0770
--- /dev/null
@@ -0,0 +1,543 @@
+#  Copyright (C) 2003  Shawn Ferry
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: F5BigIp.pm,v 1.1 2010-12-27 00:03:48 ivan Exp $
+# Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+
+# F5 BigIp Load Balancer
+
+package Torrus::DevDiscover::F5BigIp;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'F5BigIp'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+our %oiddef =
+    (
+     # F5
+     'f5'                           => '1.3.6.1.4.1.3375',
+
+     '4.x_globalStatUptime'         => '1.3.6.1.4.1.3375.1.1.1.2.1.0',
+     '3.x_uptime'                   => '1.3.6.1.4.1.3375.1.1.50.0',
+
+     '4.x_globalAttrProductCode'    => '1.3.6.1.4.1.3375.1.1.1.1.5.0',
+
+     '4.x_virtualServer'            => '1.3.6.1.4.1.3375.1.1.3',
+     '4.x_virtualServerNumber'      => '1.3.6.1.4.1.3375.1.1.3.1.0',
+     '4.x_virtualServerTable'       => '1.3.6.1.4.1.3375.1.1.3.2',
+     '4.x_virtualServerIp'          => '1.3.6.1.4.1.3375.1.1.3.2.1.1',
+     '4.x_virtualServerPort'        => '1.3.6.1.4.1.3375.1.1.3.2.1.2',
+     '4.x_virtualServerPool'        => '1.3.6.1.4.1.3375.1.1.3.2.1.30',
+
+     '4.x_poolTable'                => '1.3.6.1.4.1.3375.1.1.7.2',
+     '4.x_poolName'                 => '1.3.6.1.4.1.3375.1.1.7.2.1.1',
+
+     '4.x_poolMemberTable'          => '1.3.6.1.4.1.3375.1.1.8.2',
+     '4.x_poolMemberPoolName'       => '1.3.6.1.4.1.3375.1.1.8.2.1.1',
+     '4.x_poolMemberIpAddress'      => '1.3.6.1.4.1.3375.1.1.8.2.1.2',
+     '4.x_poolMemberPort'           => '1.3.6.1.4.1.3375.1.1.8.2.1.3',
+
+     '4.x_sslProxyTable'            => '1.3.6.1.4.1.3375.1.1.9.2.1',
+     '4.x_sslProxyOrigIpAddress'    => '1.3.6.1.4.1.3375.1.1.9.2.1.1',
+     '4.x_sslProxyOrigPort'         => '1.3.6.1.4.1.3375.1.1.9.2.1.2',
+     '4.x_sslProxyDestIpAddress'    => '1.3.6.1.4.1.3375.1.1.9.2.1.3',
+     '4.x_sslProxyDestPort'         => '1.3.6.1.4.1.3375.1.1.9.2.1.4',
+     '4.x_sslProxyConnLimit'        => '1.3.6.1.4.1.3375.1.1.9.2.1.23',
+
+     );
+
+# from https://secure.f5.com/validate/help.jsp
+#HA (BIG-IP high availability software)
+#3DNS (3-DNS software)
+#LC (BIG-IP Link Controller software)
+#LB (BIG-IP Load Balancer 520)
+#FLB (BIG-IP FireGuard 520)
+#CLB (BIG-IP Cache Load Balancer 520)
+#SSL (BIG-IP eCommerce Load Balancer 520)
+#XLB (BIG-IP user-defined special purpose product for 520 platforms)
+#ISMAN (iControl Services Manager)
+
+our %f5_product = (
+    '1'     => { 'product' => 'indeterminate',  'supported' => 0, },
+    '2'     => { 'product' => 'ha',             'supported' => 1, },
+    '3'     => { 'product' => 'lb',             'supported' => 1, },
+    '4'     => { 'product' => 'threedns',       'supported' => 0, },
+    '5'     => { 'product' => 'flb',            'supported' => 0, },
+    '6'     => { 'product' => 'clb',            'supported' => 0, },
+    '7'     => { 'product' => 'xlb',            'supported' => 0, },
+    '8'     => { 'product' => 'ssl',            'supported' => 1, },
+    '10'    => { 'product' => 'test',           'supported' => 0, },
+    '99'    => { 'product' => 'unsupported',    'supported' => 0, },
+    );
+
+our %f5_sslGatewayLevel = (
+    '1'     => 'none',
+    '3'     => 'tps200',
+    '4'     => 'tps400',
+    '5'     => 'tps600',
+    '6'     => 'tps800',
+    '7'     => 'tps1000',
+    '9'     => 'tps500',
+    '10'    => 'tps1500',
+    '11'    => 'tps2000',
+    '99'    => 'unsupported',
+    );
+
+
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+    my $data = $devdetails->data();
+
+    # You would think globalAttrProductCode would work well
+    # I need more examples to see if ha(2) is specific to
+    # BipIP HA or any ha f5 product
+
+    if( not $dd->checkSnmpTable( 'f5' ) )
+    {
+        return 0;
+    }
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    # SNMP on F5 boxes will become unresponsive over time with large
+    # enough oids-per-pdu values.  10 appears to work for everything however
+    # no exhaustive testing has been done to determine if a higer number
+    # could be used.
+    if( not defined( $data->{'param'}{'snmp-oids-per-pdu'} ) )
+    {
+        my $oidsPerPDU = $devdetails->param('F5BigIp::snmp-oids-per-pdu');
+        if( $oidsPerPDU == 0 )
+        {
+            $oidsPerPDU = 10;
+        }
+        $data->{'param'}{'snmp-oids-per-pdu'} = $oidsPerPDU;
+    }
+
+    # this is rather basic, per-capability checking
+    # may be required in the future
+
+    if( $dd->checkSnmpOID('4.x_globalStatUptime') )
+    {
+        $devdetails->setCap('BigIp_4.x');
+    }
+    elsif( $dd->checkSnmpOID('3.x_uptime') )
+    {
+        # for v3.x we are not supporting detailed stats, so don't check
+        # anything else
+        $devdetails->setCap('BigIp_3.x');
+        return 1;
+    }
+
+    my $product_name;
+    my $product_name;
+    my $result = $dd->retrieveSnmpOIDs( '4.x_globalAttrProductCode' );
+    my $product_code = $result->{'4.x_globalAttrProductCode'};
+
+    $product_name = %f5_product->{$product_code}->{'product'};
+    if( %f5_product->{$product_code}->{'supported'} )
+    {
+        $devdetails->setCap( 'BigIp_' . $product_name );
+    }
+    else
+    {
+        if( defined($product_name) )
+        {
+            Debug("Found an unsupported F5 product '$product_name'");
+        }
+        else
+        {
+            Debug("Found an unknown F5 product");
+        }
+        return 0;
+    }
+
+    my $poolTable = $session->get_table( -baseoid =>
+                                 $dd->oiddef('4.x_poolTable') );
+
+    if( defined( $poolTable ) )
+    {
+        $devdetails->storeSnmpVars( $poolTable );
+        $devdetails->setCap('BigIp_4.x_PoolTable');
+
+        my $ref = {};
+        $ref->{'indices'} = [];
+        $data->{'poolTable'} = $ref;
+
+        foreach my $INDEX ( $devdetails->
+                            getSnmpIndices( $dd->oiddef('4.x_poolName') ) )
+        {
+            push( @{$ref->{'indices'}}, $INDEX );
+            my $pool = $devdetails->snmpVar($dd->oiddef('4.x_poolName') .
+                                            '.' . $INDEX );
+
+            my $nick = $pool;
+            $nick =~ s/\W/_/g;
+            $nick =~ s/_+/_/g;
+
+            my $param = {};
+            $ref->{$INDEX}->{'param'} = $param;
+            $param->{'nick'} = $nick;
+            $param->{'pool'} = $pool;
+            $param->{'descr'} = "Stats for Pool $pool";
+            $param->{'INDEX'} = $INDEX;
+        }
+
+    }
+
+    my $poolMemberTable =
+        $session->get_table( -baseoid =>
+                             $dd->oiddef('4.x_poolMemberTable') );
+
+    if( defined( $poolMemberTable ) )
+    {
+        $devdetails->storeSnmpVars( $poolMemberTable );
+        $devdetails->setCap('BigIp_4.x_PoolMemberTable');
+
+        my $ref = {};
+        $data->{'poolMemberTable'} = $ref;
+
+        foreach my $INDEX
+            ( $devdetails->
+              getSnmpIndices( $dd->oiddef('4.x_poolMemberPoolName') ) )
+        {
+            push( @{ $ref->{'indices'} }, $INDEX );
+            my $pool =
+                $devdetails->snmpVar($dd->oiddef('4.x_poolMemberPoolName') .
+                                     '.' . $INDEX );
+            my $ip =
+                $devdetails->snmpVar($dd->oiddef('4.x_poolMemberIpAddress') .
+                                     '.' . $INDEX );
+            my $port =
+                $devdetails->snmpVar($dd->oiddef('4.x_poolMemberPort') .
+                                     '.' . $INDEX );
+
+            my $nick = "MEMBER_${pool}_${ip}_${port}";
+            $nick =~ s/\W/_/g;
+            $nick =~ s/_+/_/g;
+
+            my $param = {};
+            $ref->{$INDEX}->{'param'} = $param;
+            $param->{'nick'} = $nick;
+            $param->{'pool'} = $pool;
+            $param->{'descr'} = "Member of Pool $pool IP: $ip Port: $port";
+            $param->{'INDEX'} = $INDEX;
+        }
+
+    }
+
+    my $virtServerNumber = $dd->retrieveSnmpOIDs( '4.x_virtualServerNumber' );
+    if( $virtServerNumber->{'4.x_virtualServerNumber'} > 0 )
+    {
+        my $virtServer = $session->get_table( -baseoid =>
+                                          $dd->oiddef('4.x_virtualServer') );
+        if( defined( $virtServer ) )
+        {
+            $devdetails->storeSnmpVars( $virtServer );
+            $devdetails->setCap('BigIp_4.x_VirtualServer');
+
+            my $ref = {};
+            $data->{'virtualServer'} = $ref;
+
+            foreach my $INDEX
+                ( $devdetails->
+                  getSnmpIndices( $dd->oiddef('4.x_virtualServerIp') ) )
+            {
+                push( @{ $ref->{'indices'} }, $INDEX);
+                my $pool = $devdetails->snmpVar(
+                                $dd->oiddef('4.x_virtualServerPool') .
+                                '.' . $INDEX );
+                my $ip = $devdetails->snmpVar(
+                                $dd->oiddef('4.x_virtualServerIp') .
+                                '.' . $INDEX );
+                my $port = $devdetails->snmpVar(
+                                $dd->oiddef('4.x_virtualServerPort') .
+                                '.' . $INDEX );
+
+                my $param = {};
+                $ref->{$INDEX}->{'param'} = $param;
+
+                my $descr = "Virtual Server Pool: $pool IP: $ip Port: $port";
+                my $nick = "VIP_${pool}_${ip}_${port}";
+                $nick =~ s/\W/_/g;
+                $nick =~ s/_+/_/g;
+
+                $param->{'INDEX'} = $INDEX;
+                $param->{'descr'} = $descr;
+                $param->{'nick'} = $nick;
+                $param->{'pool'} = $pool;
+            }
+        }
+        else
+        {
+            Debug("Virtual Servers Defined but not able to be configured");
+        }
+    }
+
+    my $sslProxyTable = $session->get_table( -baseoid =>
+                            $dd->oiddef('4.x_sslProxyTable') );
+
+    if( defined( $sslProxyTable ) )
+    {
+        $devdetails->storeSnmpVars( $sslProxyTable );
+        $devdetails->setCap('BigIp_4.x_sslProxyTable');
+
+        my $ref = {};
+        $ref->{'indices'} = [];
+        $data->{'sslProxyTable'} = $ref;
+
+        foreach my $INDEX ( $devdetails->
+            getSnmpIndices( $dd->oiddef('4.x_sslProxyOrigIpAddress') ) )
+        {
+            push( @{$ref->{'indices'}}, $INDEX );
+
+            my $origIp = $devdetails->snmpVar(
+                    $dd->oiddef('4.x_sslProxyOrigIpAddress')
+                    . '.' .  $INDEX );
+
+            my $origPort = $devdetails->snmpVar(
+                    $dd->oiddef('4.x_sslProxyOrigPort')
+                    . '.' .  $INDEX );
+
+            my $destIp = $devdetails->snmpVar(
+                    $dd->oiddef('4.x_sslProxyDestIpAddress')
+                    . '.' .  $INDEX );
+
+            my $destPort = $devdetails->snmpVar(
+                    $dd->oiddef('4.x_sslProxyDestPort')
+                    . '.' .  $INDEX );
+
+            my $connLimit = $devdetails->snmpVar(
+                    $dd->oiddef('4.x_sslProxyConnLimit')
+                    . '.' .  $INDEX );
+
+
+
+            my $nick = $origIp . '_' . $origPort . '_' . $destIp .
+                    '_' . $destPort;
+
+            my $param = {};
+            $ref->{$INDEX}->{'param'} = $param;
+            $param->{'nick'} = $nick;
+            $param->{'descr'} = "Stats for SSL Proxy Address: " .
+                    "${origIp}:${origPort} -> ${destIp}:${destPort}";
+            $param->{'INDEX'} = $INDEX;
+            $param->{'connLimit'} = $connLimit;
+
+        }
+
+
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+
+    my $bigIpName = 'BigIp_Global_Stats';
+
+    my $bigIpParam = {
+        'precedence'         => '-100',
+        'comment'            => 'BigIp Global Stats',
+        'rrd-create-dstype'  => 'GAUGE', };
+
+    if( $devdetails->hasCap('BigIp_4.x') )
+    {
+        my $bigIpStatsNode = $cb->addSubtree( $devNode, $bigIpName,
+                $bigIpParam, [ 'F5BigIp::BigIp_4.x' ]);
+
+        if( $devdetails->hasCap('BigIp_ssl') )
+        {
+            $cb->addTemplateApplication
+                ( $bigIpStatsNode , 'F5BigIp::BigIp_4.x_sslProxy_Global' );
+        }
+    }
+    elsif( $devdetails->hasCap('BigIp_3.x') )
+    {
+        $cb->addSubtree( $devNode, $bigIpName, $bigIpParam,
+                         [ 'F5BigIp::BigIp_3.x' ]);
+    }
+
+    my $virtName = 'BigIp_VirtualServers';
+
+    my $virtParam = {
+        'precedence'        => '-200',
+        'comment'           => 'Virtual Server(VIP) Stats',
+    };
+
+    my $virtTree;
+
+    if( $devdetails->hasCap('BigIp_4.x_VirtualServer') )
+    {
+        my @templates =
+            ( 'F5BigIp::BigIp_4.x_virtualServer-actvconn-overview' );
+        #    'F5BigIp::BigIp_4.x_virtualServer-connrate-overview');
+
+        $virtTree =
+            $cb->addSubtree( $devNode, $virtName, $virtParam, \@templates );
+
+        my $ref = $data->{'virtualServer'};
+
+        foreach my $INDEX ( @{ $ref->{'indices'} } )
+        {
+            my $server = $ref->{$INDEX}->{'param'};
+
+            $server->{'precedence'} = '-100';
+
+            $cb->addSubtree( $virtTree, $server->{'nick'}, $server,
+                          [ 'F5BigIp::BigIp_4.x_virtualServer' ] );
+        }
+    }
+
+    my $poolName = 'BigIp_Pools';
+    my $poolParam = {
+        'precedence'        => '-300',
+        'comment'           => 'Pool Stats',
+    };
+
+    my $poolTree;
+
+    if( $devdetails->hasCap('BigIp_4.x_PoolTable') )
+    {
+        $poolTree =
+            $cb->addSubtree( $devNode, $poolName, $poolParam,
+                             ['F5BigIp::BigIp_4.x_pool-actvconn-overview']);
+        my $ref = $data->{'poolTable'};
+
+        foreach my $INDEX ( @{ $ref->{'indices'} } )
+        {
+            my $pool = $ref->{$INDEX}->{'param'};
+
+            $pool->{'precedence'} = '-100';
+
+            $cb->addSubtree( $poolTree, $pool->{'pool'}, $pool,
+                          [ 'F5BigIp::BigIp_4.x_pool' ] );
+        }
+
+    }
+
+    my $poolMemberName = 'BigIp_Pool_Members';
+
+    my $poolMemberParam = {
+        'precedence'        => '-400',
+        'comment'           => 'Pool Member Stats',
+    };
+
+    my $poolMemberTree;
+
+    if( $devdetails->hasCap('BigIp_4.x_PoolMemberTable') )
+    {
+        $poolMemberTree =
+            $cb->addSubtree( $devNode, $poolMemberName, $poolMemberParam );
+        my $ref = $data->{'poolMemberTable'};
+
+        foreach my $INDEX ( @{ $ref->{'indices'} } )
+        {
+            my $poolMemberPoolTree;
+            my $lastPoolTree;
+            my $server = $ref->{$INDEX}->{'param'};
+
+            my $poolMemberPoolName = $server->{'pool'};
+            my $poolMemberPoolParam = {
+                'precidence'    => '-100',
+                'comment'       => "Members of the $server->{'pool'} Pool",
+            };
+
+
+            if( not defined( $lastPoolTree ) or
+                $poolMemberPoolName !~ /\b$lastPoolTree\b/ )
+            {
+                my @templates =
+                    ( 'F5BigIp::BigIp_4.x_poolMember-actvconn-overview' );
+                $poolMemberPoolTree =
+                    $cb->addSubtree( $poolMemberTree, $poolMemberPoolName,
+                                     $poolMemberPoolParam, \@templates );
+
+                $lastPoolTree = $poolMemberPoolName;
+
+                $server->{'precedence'} = '-100';
+
+                $cb->addSubtree( $poolMemberPoolTree, $server->{'nick'}, $server,
+                              [ 'F5BigIp::BigIp_4.x_poolMember' ] );
+            }
+        }
+    }
+
+
+    # BigIP SSL Product Support
+    if( $devdetails->hasCap('BigIp_4.x_sslProxyTable') )
+    {
+
+        my $bigIpSSLProxies = 'BigIp_SSL_Proxies';
+
+        my $bigIpSSLParam = {
+            'comment'            => 'BigIp SSL Proxies',
+            'rrd-create-dstype'  => 'COUNTER', };
+
+        my $sslProxyTree = $cb->addSubtree(
+                    $devNode, $bigIpSSLProxies, $bigIpSSLParam,
+                    [ 'F5BigIp::BigIp_4.x_sslProxy-currconn-overview' ]);
+
+        my $ref = $data->{'sslProxyTable'};
+
+        foreach my $INDEX ( @{ $ref->{'indices'} } )
+        {
+            my $proxy = $ref->{$INDEX}->{'param'};
+
+            $cb->addSubtree( $sslProxyTree, $proxy->{'nick'}, $proxy,
+                    [ 'F5BigIp::BigIp_4.x_sslProxy' ] );
+        }
+
+    }
+
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/FTOS.pm b/torrus/perllib/Torrus/DevDiscover/FTOS.pm
new file mode 100644 (file)
index 0000000..82629e2
--- /dev/null
@@ -0,0 +1,378 @@
+#
+#  Copyright (C) 2009  Jon Nistor
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: FTOS.pm,v 1.1 2010-12-27 00:03:54 ivan Exp $
+# Jon Nistor <nistor at snickers.org>
+
+# Force10 Networks Real Time Operating System Software
+#
+# NOTE: FTOS::disable-cpu
+#       FTOS::disable-power
+#       FTOS::disable-temperature
+#       FTOS::use-fahrenheit
+#       FTOS::file-per-sensor (affects both power and temperature)
+
+package Torrus::DevDiscover::FTOS;
+
+use strict;
+use Torrus::Log;
+
+$Torrus::DevDiscover::registry{'FTOS'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # FORCE10-SMI
+     'f10Products'           => '1.3.6.1.4.1.6027.1',
+
+     # F10-CHASSIS-MIB
+     'chType'                => '1.3.6.1.4.1.6027.3.1.1.1.1.0',
+     'chSerialNumber'        => '1.3.6.1.4.1.6027.3.1.1.1.2.0',
+     'chSysPowerSupplyIndex' => '1.3.6.1.4.1.6027.3.1.1.2.1.1.1',
+     'chSysCardSlotIndex'    => '1.3.6.1.4.1.6027.3.1.1.2.3.1.1',
+     'chSysCardNumber'       => '1.3.6.1.4.1.6027.3.1.1.2.3.1.3',
+     'chRpmCpuIndex'         => '1.3.6.1.4.1.6027.3.1.1.3.7.1.1',
+
+     # FORCE10-SYSTEM-COMPONENT-MIB
+     'camUsagePartDesc'      => '1.3.6.1.4.1.6027.3.7.1.1.1.1.4'
+     );
+
+
+our %f10ChassisType =
+    (
+     '1'   => 'Force10 E1200 16-slot switch/router',
+     '2'   => 'Force10 E600 9-slot switch/router',
+     '3'   => 'Force10 E300 8-slot switch/router',
+     '4'   => 'Force10 E150 8-slot switch/router',
+     '5'   => 'Force10 E610 9-slot switch/router',
+     '6'   => 'Force10 C150 6-slot switch/router',
+     '7'   => 'Force10 C300 10-slot switch/router',
+     '8'   => 'Force10 E1200i 16-slot switch/router',
+     '9'   => 'Force10 S2410 10GbE switch',
+     '10'  => 'Force10 S2410 10GbE switch',
+     '11'  => 'Force10 S50 access switch',
+     '12'  => 'Force10 S50e access switch',
+     '13'  => 'Force10 S50v access switch',
+     '14'  => 'Force10 S50nac access switch',
+     '15'  => 'Force10 S50ndc access switch',
+     '16'  => 'Force10 S25pdc access switch',
+     '17'  => 'Force10 S25pac access switch',
+     '18'  => 'Force10 S25v access switch',
+     '19'  => 'Force10 S25n access switch'
+     );
+
+our %f10CPU =
+    (
+     '1'   => 'Control Processor',
+     '2'   => 'Routing Processor #1',
+     '3'   => 'Routing Processor #2'
+     );
+
+
+# Not all interfaces are normally needed to monitor.
+# You may override the interface filtering in devdiscover-siteconfig.pl:
+# redefine $Torrus::DevDiscover::FTOS::interfaceFilter
+# or define $Torrus::DevDiscover::FTOS::interfaceFilterOverlay
+
+our $interfaceFilter;
+our $interfaceFilterOverlay;
+my %ftosInterfaceFilter;
+
+if( not defined( $interfaceFilter ) )
+{
+    $interfaceFilter = \%ftosInterfaceFilter;
+}
+
+
+# Key is some unique symbolic name, does not mean anything
+#  ifType is the number to match the interface type
+# ifDescr is the regexp to match the interface description
+%ftosInterfaceFilter =
+    (
+     'other' => {
+         'ifType'  => 1,                     # other
+     },
+     'loopback' => {
+         'ifType'  => 24,                    # softwareLoopback
+     },
+     
+     );
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'f10Products',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+    
+    # Systems running FTOS will have chassisType, SFTOS will not.
+    if( not $dd->checkSnmpOID('chType') )
+    {
+        return 0;
+    }
+    
+    &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+        ($devdetails, $interfaceFilter);
+    
+    if( defined( $interfaceFilterOverlay ) )
+    {
+        &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+            ($devdetails, $interfaceFilterOverlay);
+    }
+
+    $devdetails->setCap('interfaceIndexingPersistent');
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    # NOTE: Comments and Serial number of device
+    my $chassisSerial = $dd->retrieveSnmpOIDs( 'chType', 'chSerialNumber' );
+
+    if( defined( $chassisSerial ) )
+    {
+        $data->{'param'}{'comment'} =
+            %f10ChassisType->{$chassisSerial->{'chType'}} .
+            ', Hw Serial#: ' . $chassisSerial->{'chSerialNumber'};
+    }
+    else
+    {
+        $data->{'param'}{'comment'} = "Force10 Networks switch/router";
+    }
+
+    # PROG: CPU statistics
+    if( $devdetails->param('FTOS::disable-cpu') ne 'yes' )
+    {
+        # Poll table to translate the CPU Index to a Name
+        my $ftosCpuTable =
+            $session->get_table( -baseoid => $dd->oiddef('chRpmCpuIndex') );
+
+        $devdetails->storeSnmpVars( $ftosCpuTable );
+
+        if( defined( $ftosCpuTable ) )
+        {
+            $devdetails->setCap('ftosCPU');
+
+            # Find the index of the CPU
+            foreach my $ftosCPUidx ( $devdetails->getSnmpIndices
+                                     ( $dd->oiddef('chRpmCpuIndex') ) )
+            {
+                my $cpuType = $dd->oiddef('chRpmCpuIndex') . "." . $ftosCPUidx;
+                my $cpuName = %f10CPU->{$ftosCpuTable->{$cpuType}};
+
+                Debug("FTOS::CPU index $ftosCPUidx, $cpuName");
+
+                # Construct the data ...
+                $data->{'ftosCPU'}{$ftosCPUidx} = $cpuName;
+            }
+        }
+        else
+        {
+            Debug("FTOS::CPU No CPU information found, old sw?");
+        }
+    } # END: CPU
+
+
+    # PROG: Power Supplies
+    if( $devdetails->param('FTOS::disable-power') ne 'yes' )
+    {
+        # Poll table of power supplies
+        my $ftosPSUTable =
+            $session->get_table( -baseoid =>
+                                 $dd->oiddef('chSysPowerSupplyIndex') );
+
+        $devdetails->storeSnmpVars( $ftosPSUTable );
+
+        if( defined( $ftosPSUTable ) )
+        {
+            $devdetails->setCap('ftosPSU');
+
+            # Find the Index of the Power Supplies
+            foreach my $ftosPSUidx ( $devdetails->getSnmpIndices
+                                     ($dd->oiddef('chSysPowerSupplyIndex')) )
+            {
+                Debug("FTOS::PSU index $ftosPSUidx");
+
+                push( @{$data->{'ftosPSU'}}, $ftosPSUidx );
+            }
+        }
+    } # END: PSU
+
+
+    # PROG: Temperature
+    if( $devdetails->param('FTOS::disable-sensors') ne 'yes' )
+    {
+        # Check if temperature sensors are supported
+        my $sensorTable =
+            $session->get_table( -baseoid =>
+                                 $dd->oiddef('chSysCardSlotIndex') );
+        $devdetails->storeSnmpVars( $sensorTable );
+
+        my $sensorCard =
+            $session->get_table( -baseoid => $dd->oiddef('chSysCardNumber') );
+        $devdetails->storeSnmpVars( $sensorCard );
+
+
+        if( defined( $sensorTable ) )
+        {
+            $devdetails->setCap('ftosSensor');
+            
+            foreach my $sensorIdx ( $devdetails->getSnmpIndices
+                                    ( $dd->oiddef('chSysCardSlotIndex') ) )
+            {
+                my $sensorCard =
+                    $devdetails->snmpVar( $dd->oiddef('chSysCardNumber') .
+                                          '.' . $sensorIdx );
+
+                $data->{'ftosSensor'}{$sensorIdx} = $sensorCard;
+
+                Debug("FTOS::Sensor index $sensorIdx, card $sensorCard");
+            }
+        } # END if: $sensorTable
+    } # END: disable-sensors
+
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+
+    # PROG: CPU processing
+    if( $devdetails->hasCap('ftosCPU') )
+    {
+        my $nodeTop = $cb->addSubtree( $devNode, 'CPU_Usage', undef,
+                                       [ 'FTOS::ftos-cpu-subtree'] );
+
+        foreach my $CPUidx ( sort {$a <=> $b} keys %{$data->{'ftosCPU'}} )
+        {
+            my $CPUName = $data->{'ftosCPU'}{$CPUidx};
+            my $subName = sprintf( 'CPU_%.2d', $CPUidx );
+
+            my $nodeCPU = $cb->addSubtree( $nodeTop, $subName,
+                                           { 'comment'   => $CPUName,
+                                             'cpu-index' => $CPUidx,
+                                             'cpu-name'  => $CPUName },
+                                           [ 'FTOS::ftos-cpu' ] );
+        }
+    } # END if ftosCPU
+
+
+    # PROG: Power supplies
+    if( $devdetails->hasCap('ftosPSU') )
+    {
+        my $subtreeName = "Power_Supplies";
+        my $param       = { 'comment'    => 'Power supplies status',
+                            'precedence' => -600 };
+        my $filePerSensor 
+            = $devdetails->param('FTOS::file-per-sensor') eq 'yes';
+        my $templates   = [];
+
+        $param->{'data-file'} = '%snmp-host%_power' .
+            ($filePerSensor ? '_%power-index%':'') .
+            '.rrd';
+
+        my $nodeTop = $cb->addSubtree( $devNode, $subtreeName,
+                                       $param, $templates );
+
+
+        foreach my $PSUidx ( sort {$a <=> $b} @{$data->{'ftosPSU'}} )
+        {
+            my $leafName = sprintf( 'power_%.2d', $PSUidx );
+
+            my $nodePSU = $cb->addLeaf( $nodeTop, $leafName, 
+                                        { 'power-index' => $PSUidx },
+                                        [ 'FTOS::ftos-power-supply-leaf' ]);
+        }
+    }
+
+
+    # PROG: Temperature sensors
+    if( $devdetails->hasCap('ftosSensor') )
+    {
+        my $subtreeName = "Temperature_Sensors";
+        my $param       = {};
+        my $fahrenheit  = $devdetails->param('FTOS::use-fahrenheit') eq 'yes';
+        my $filePerSensor 
+            = $devdetails->param('FTOS::file-per-sensor') eq 'yes';
+        my $templates   = [ 'FTOS::ftos-temperature-subtree' ];
+
+        $param->{'data-file'} = '%snmp-host%_sensors' .
+            ($filePerSensor ? '_%sensor-index%':'') .
+            ($fahrenheit ? '_fahrenheit':'') . '.rrd';
+
+        my $subtreeNode = $cb->addSubtree( $devNode, $subtreeName,
+                                           $param, $templates );
+
+        foreach my $sIndex ( sort {$a<=>$b} keys %{$data->{'ftosSensor'}} )
+        {
+            my $leafName   = sprintf( 'sensor_%.2d', $sIndex );
+            my $threshold  = 60;  # Forced value for the time being, 60 degC
+            my $sensorCard = $data->{'ftosSensor'}{$sIndex};
+
+            if( $fahrenheit )
+            {
+                $threshold = $threshold * 1.8 + 32;
+            }
+
+            my $param = {
+                'sensor-index'       => $sIndex,
+                'sensor-description' => 'Module ' . $sensorCard,
+                'upper-limit'        => $threshold
+                };
+
+            my $templates = ['FTOS::ftos-temperature-sensor' .
+                             ($fahrenheit ? '-fahrenheit':'')];
+
+            $cb->addLeaf( $subtreeNode, $leafName, $param, $templates );
+        } 
+    }
+}
+
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/Foundry.pm b/torrus/perllib/Torrus/DevDiscover/Foundry.pm
new file mode 100644 (file)
index 0000000..8c9ef2c
--- /dev/null
@@ -0,0 +1,566 @@
+#  Copyright (C) 2008 Roman Hochuli
+#  Copyright (C) 2010 Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Foundry.pm,v 1.1 2010-12-27 00:03:48 ivan Exp $
+# Roman Hochuli <roman@hochu.li>
+
+# Common Foundry MIBs, supported by IronWare-Devices
+
+package Torrus::DevDiscover::Foundry;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'Foundry'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # FOUNDRY-SN-ROOT-MIB
+     'fdry'                              => '1.3.6.1.4.1.1991',
+     
+     # FOUNDRY-SN-AGENT-MIB
+     'fdrySnChasSerNum'                  => '1.3.6.1.4.1.1991.1.1.1.1.2.0',
+     'fdrySnChasGen'                     => '1.3.6.1.4.1.1991.1.1.1.1.13',
+     'fdrySnChasIdNumber'                => '1.3.6.1.4.1.1991.1.1.1.1.17.0',
+     'fdrySnChasArchitectureType'        => '1.3.6.1.4.1.1991.1.1.1.1.25.0',
+     'fdrySnChasProductType'             => '1.3.6.1.4.1.1991.1.1.1.1.26.0',
+
+     # FOUNDRY-SN-AGENT-MIB
+     'fdrySnChasActualTemperature'       => '1.3.6.1.4.1.1991.1.1.1.1.18.0',
+     'fdrySnChasWarningTemperature'      => '1.3.6.1.4.1.1991.1.1.1.1.19.0',
+     'fdrySnChasShutdownTemperature'     => '1.3.6.1.4.1.1991.1.1.1.1.20.0',
+     'fdrySnAgImgVer'                    => '1.3.6.1.4.1.1991.1.1.2.1.11',
+     'fdrySnAgentTempTable'              => '1.3.6.1.4.1.1991.1.1.2.13.1',
+     'fdrySnAgentTempSensorDescr'        => '1.3.6.1.4.1.1991.1.1.2.13.1.1.3',
+     'fdrySnAgentTempValue'              => '1.3.6.1.4.1.1991.1.1.2.13.1.1.4',
+
+     # FOUNDRY-SN-AGENT-MIB
+     'fdrySnAgGblCpuUtilData'            => '1.3.6.1.4.1.1991.1.1.2.1.35',
+     'fdrySnAgGblCpuUtil1SecAvg'         => '1.3.6.1.4.1.1991.1.1.2.1.50',
+     'fdrySnAgGblCpuUtil5SecAvg'         => '1.3.6.1.4.1.1991.1.1.2.1.51',
+     'fdrySnAgGblCpuUtil1MinAvg'         => '1.3.6.1.4.1.1991.1.1.2.1.52',
+     'fdrySnAgentCpuUtilValue'           => '1.3.6.1.4.1.1991.1.1.2.11.1.1.4',
+     'fdrySnAgentCpuUtil100thPercent'    => '1.3.6.1.4.1.1991.1.1.2.11.1.1.6',
+
+     # FOUNDRY-SN-AGENT-MIB
+     'fdrySnAgentBrdTbl'                 => '1.3.6.1.4.1.1991.1.1.2.2.1.1',
+     'fdrySnAgentBrdMainBrdDescription'  => '1.3.6.1.4.1.1991.1.1.2.2.1.1.2',
+     'fdrySnAgentBrdMainPortTotal'       => '1.3.6.1.4.1.1991.1.1.2.2.1.1.4',
+     'fdrySnAgentBrdModuleStatus'        => '1.3.6.1.4.1.1991.1.1.2.2.1.1.12',
+     # Not listed in FOUNDRY-SN-AGENT-MIB, but in release notes
+     'fdrySnAgentBrdMemoryTotal'         => '1.3.6.1.4.1.1991.1.1.2.2.1.1.24',
+     'fdrySnAgentBrdMemoryAvailable'     => '1.3.6.1.4.1.1991.1.1.2.2.1.1.25',
+     );
+
+
+# Not all interfaces are normally needed to monitor.
+# You may override the interface filtering in devdiscover-siteconfig.pl:
+# redefine $Torrus::DevDiscover::Foundry::interfaceFilter
+# or define $Torrus::DevDiscover::Foundry::interfaceFilterOverlay
+
+our $interfaceFilter;
+our $interfaceFilterOverlay;
+my %fdryInterfaceFilter;
+
+if( not defined( $interfaceFilter ) )
+{
+    $interfaceFilter = \%fdryInterfaceFilter;
+}
+
+# Key is some unique symbolic name, does not mean anything
+# ifType is the number to match the interface type
+# ifDescr is the regexp to match the interface description
+%fdryInterfaceFilter =
+    (
+     'lb' => {
+         'ifType'  => 24,                    # softwareLoopback
+     },
+     
+     'v' => {
+         'ifType'  => 135,                   # l2vlan
+     },
+
+     'tnl' => {
+         'ifType'  => 150,                   # mplsTunnel
+     },
+     );
+
+
+
+my %productTypeAttr =
+    (
+     1 => {
+         'desc' => 'BigIron MG8',
+     },
+
+     2 => {
+         'desc' => 'NetIron 40G',
+     },
+
+     3 => {
+         'desc' => 'NetIron IMR 640',
+     },
+     
+     4 => {
+         'desc' => 'NetIron RX 800',
+     },
+     
+     5 => {
+         'desc' => 'NetIron XMR 16000',
+     },
+
+     6 => {
+         'desc' => 'NetIron RX 400',
+     },
+     
+     7 => {
+         'desc' => 'NetIron XMR 8000',
+     },
+
+     8 => {
+         'desc' => 'NetIron RX 200',
+     },
+
+     9 => {
+         'desc' => 'NetIron XMR 4000',
+     },
+     
+     13 => {
+         'desc' => 'NetIron MLX-32',
+     },
+
+     14 => {
+         'desc' => 'NetIron XMR 32000',
+     },
+
+     15 => {
+         'desc' => 'NetIron RX-32',
+     },
+
+     78 => {
+         'desc' => 'FastIron',
+     },
+
+     0 => {
+         'desc' => 'device',
+     },
+     );  
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+    my $retval = 0;
+
+    if( $dd->oidBaseMatch
+        ( 'fdry', $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        $retval = 1;
+
+        &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+            ($devdetails, $interfaceFilter);
+
+        if( defined( $interfaceFilterOverlay ) )
+        {
+            &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+                ($devdetails, $interfaceFilterOverlay);
+        }
+
+        $devdetails->setCap('interfaceIndexingPersistent');
+
+    }
+    
+    return $retval;
+}
+
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    # NOTE: Comments and Serial number of device
+    
+    my $chassis = $dd->retrieveSnmpOIDs( 'fdrySnChasSerNum',
+                                         'fdrySnChasIdNumber',
+                                         'fdrySnChasArchitectureType',
+                                         'fdrySnChasProductType' );
+    
+    Debug('fdrySnChasSerNum=' . $chassis->{'fdrySnChasSerNum'});
+    Debug('fdrySnChasIdNumber=' . $chassis->{'fdrySnChasIdNumber'});
+    Debug('fdrySnChasArchitectureType=' .
+          $chassis->{'fdrySnChasArchitectureType'});
+    Debug('fdrySnChasProductType=' . $chassis->{'fdrySnChasProductType'});
+    
+    my $productType = 0;
+
+    if( defined( $chassis ) and
+        defined( $productTypeAttr{$chassis->{'fdrySnChasProductType'}} ) )
+    {
+        $productType = $chassis->{'fdrySnChasProductType'};
+    }
+
+    my $deviceComment = 'Brocade ' . $productTypeAttr{$productType}{'desc'};
+        
+    if( defined( $chassis ) )
+    {
+        if( defined( $chassis->{'fdrySnChasSerNum'} ) )
+        {
+            $deviceComment .= ', Chassis S/N: ' .
+                $chassis->{'fdrySnChasSerNum'};
+        }
+        
+        if( defined( $chassis->{'fdrySnChasIdNumber'} ) and
+            $chassis->{'fdrySnChasIdNumber'} ne '' )
+        {
+            $deviceComment .= ', Chassis ID: ' .
+                $chassis->{'fdrySnChasIdNumber'};
+        }
+    }
+
+    $data->{'param'}{'comment'} = $deviceComment;
+
+    
+    my $chasTemp = $dd->retrieveSnmpOIDs( 'fdrySnChasActualTemperature',
+                                          'fdrySnChasWarningTemperature',
+                                          'fdrySnChasShutdownTemperature');
+
+    if( defined($chasTemp) and
+        defined($chasTemp->{'fdrySnChasActualTemperature'}) )
+    {
+        $devdetails->setCap('snChasActualTemperature');
+
+        $data->{'fdryChasTemp'}{'warning'} =
+            $chasTemp->{'fdrySnChasWarningTemperature'};
+        $data->{'fdryChasTemp'}{'shutdown'} =
+            $chasTemp->{'fdrySnChasShutdownTemperature'};        
+    }
+       
+    if( $dd->checkSnmpTable('fdrySnAgentBrdTbl') )
+    {
+        $devdetails->setCap('fdryBoardStats'); 
+        $data->{'fdryBoard'} = {};
+
+        # get only the modules with
+        # snAgentBrdModuleStatus = moduleRunning(10)
+        {
+            my $base = $dd->oiddef('fdrySnAgentBrdModuleStatus');
+            my $table = $session->get_table( -baseoid => $base );        
+            my $prefixLen = length( $base ) + 1;
+            
+            while( my( $oid, $status ) = each %{$table} )
+            {
+                if( $status == 10 )
+                {
+                    my $brdIndex = substr( $oid, $prefixLen );
+                    $data->{'fdryBoard'}{$brdIndex}{'moduleRunning'} = 1;
+                }
+            }
+        }
+        
+        # get module descriptions
+        {
+            my $oid = $dd->oiddef('fdrySnAgentBrdMainBrdDescription');
+            my $table = $session->get_table( -baseoid => $oid );        
+            my $prefixLen = length( $oid ) + 1;
+            
+            while( my( $oid, $descr ) = each %{$table} )
+            {
+                if( length($descr) > 0 )
+                {
+                    my $brdIndex = substr( $oid, $prefixLen );
+                    
+                    if( $data->{'fdryBoard'}{$brdIndex}{'moduleRunning'} )
+                    {
+                        $data->{'fdryBoard'}{$brdIndex}{'description'} =
+                            $descr;
+                    }
+                }
+            }
+        }
+
+        # Non-chassis Foundry products set the description to "Invalid Module"
+        if( scalar(keys %{$data->{'fdryBoard'}}) == 1 and
+            $data->{'fdryBoard'}{1}{'moduleRunning'} )
+        {
+            $data->{'fdryBoard'}{1}{'description'} = 'Management';
+        }
+
+        # check if memory statistics are available
+        {
+            my $base = $dd->oiddef('fdrySnAgentBrdMemoryTotal');
+            my $table = $session->get_table( -baseoid => $base );        
+            my $prefixLen = length( $base ) + 1;
+            
+            while( my( $oid, $memory ) = each %{$table} )
+            {
+                if( $memory > 0 )
+                {
+                    my $brdIndex = substr( $oid, $prefixLen );
+                    
+                    if( $data->{'fdryBoard'}{$brdIndex}{'moduleRunning'} )
+                    {
+                        $data->{'fdryBoard'}{$brdIndex}{'memory'} = 1;
+                    }
+                }
+            }
+        }
+
+        # check if CPU stats are available
+        # FOUNDRY-SN-AGENT-MIB::snAgentCpuUtilValue.1.1.1 = Gauge32: 1
+        # FOUNDRY-SN-AGENT-MIB::snAgentCpuUtilValue.1.1.5 = Gauge32: 1
+        # FOUNDRY-SN-AGENT-MIB::snAgentCpuUtilValue.1.1.60 = Gauge32: 1
+        # FOUNDRY-SN-AGENT-MIB::snAgentCpuUtilValue.1.1.300 = Gauge32: 1
+        {
+            my $base = $dd->oiddef('fdrySnAgentCpuUtilValue');
+            my $table = $session->get_table( -baseoid => $base );
+            my $prefixLen = length( $base ) + 1;
+                
+            while( my( $oid, $val ) = each %{$table} )
+            {
+                my $brdIndex = substr( $oid, $prefixLen );
+                $brdIndex =~ s/\.(.+)$//o;
+                if( $1 eq '1.1' and
+                    $data->{'fdryBoard'}{$brdIndex}{'moduleRunning'} )
+                {
+                    $data->{'fdryBoard'}{$brdIndex}{'cpu'} = 1;
+                }
+            }
+        }
+
+        # snAgentCpuUtil100thPercent: supported on NetIron XMR and NetIron
+        # MLX devices running software release 03.9.00 and later, FGS release
+        # 04.3.01 and later, and FSX 04.3.00 and later.
+        # snAgentCpuUtilValue is deprecated in these releases
+        {
+            my $base = $dd->oiddef('fdrySnAgentCpuUtil100thPercent');
+            my $table = $session->get_table( -baseoid => $base );
+            my $prefixLen = length( $base ) + 1;
+                
+            while( my( $oid, $val ) = each %{$table} )
+            {
+                my $brdIndex = substr( $oid, $prefixLen );
+                $brdIndex =~ s/\.(.+)$//o;
+                if( $1 eq '1.1' and
+                    $data->{'fdryBoard'}{$brdIndex}{'moduleRunning'} )
+                {
+                    $data->{'fdryBoard'}{$brdIndex}{'cpu-new'} = 1;
+                }
+            }
+        }        
+        
+        # check if temperature stats are available
+        # exclude the sensors which show zero
+        {
+            my $base = $dd->oiddef('fdrySnAgentTempSensorDescr');
+            my $table = $session->get_table( -baseoid => $base );        
+            my $prefixLen = length( $base ) + 1;
+
+            my $baseVal = $dd->oiddef('fdrySnAgentTempValue');
+            my $values = $session->get_table( -baseoid => $baseVal );
+            
+            while( my( $oid, $descr ) = each %{$table} )
+            {
+                my $index = substr( $oid, $prefixLen );
+                my ($brdIndex, $sensor) = split(/\./, $index);
+                
+                if( $data->{'fdryBoard'}{$brdIndex}{'moduleRunning'} and
+                    $values->{$baseVal . '.' . $index} > 0 )
+                {
+                    $data->{'fdryBoard'}{$brdIndex}{'temperature'}{$sensor} =
+                        $descr;
+                    $devdetails->setCap('fdryBoardTemperature'); 
+                }
+            }
+        }                    
+    }
+    
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    my $data = $devdetails->data();
+
+    # Chassis Temperature Sensors
+    if( $devdetails->hasCap('snChasActualTemperature') and not
+        $devdetails->hasCap('fdryBoardTemperature') )
+    {
+        my $param = {
+            'fdry-chastemp-warning' => $data->{'fdryChasTemp'}{'warning'}/2,
+            'fdry-chastemp-shutdown' => $data->{'fdryChasTemp'}{'shutdown'}/2,
+        };
+                         
+        my $templates = [ 'Foundry::fdry-chass-temperature' ];
+
+        $cb->addLeaf( $devNode, 'Chassis_Temperature',
+                      $param, $templates );
+    }
+    
+    # Board Stats
+    if( $devdetails->hasCap('fdryBoardStats') )
+    {
+        my $brdNode = $devNode;
+        if( scalar(keys %{$data->{'fdryBoard'}}) > 1 )
+        {
+            my $param = {
+                'node-display-name' => 'Linecard Statistics',
+                'comment' => 'CPU, Memory, and Temperature information',
+            };
+            
+            $brdNode =
+                $cb->addSubtree( $devNode, 'Linecard_Statistics', $param );
+        }
+       
+        $cb->addTemplateApplication( $brdNode,
+                                     'Foundry::fdry-board-overview' );
+        
+            
+        foreach my $brdIndex ( sort {$a <=> $b} keys %{$data->{'fdryBoard'}} )
+        {
+            my $descr = $data->{'fdryBoard'}{$brdIndex}{'description'};
+            my $param = {
+                'comment'  => $descr,
+                'fdry-board-index' => $brdIndex,
+                'fdry-board-descr' => $descr,
+                'nodeid' => 'module//%nodeid-device%//' . $brdIndex,
+            };
+            
+            my $linecardNode =
+                $cb->addSubtree( $brdNode, 'Linecard_' . $brdIndex,
+                                 $param,
+                                 [ 'Foundry::fdry-board-subtree' ]);
+            
+            if( $data->{'fdryBoard'}{$brdIndex}{'memory'} )
+            {
+                $cb->addSubtree( $linecardNode, 'Memory_Statistics', {},
+                                 [ 'Foundry::fdry-board-memstats' ]);
+            }
+            
+
+            my $cpuOid;            
+            if( $data->{'fdryBoard'}{$brdIndex}{'cpu-new'} )
+            {
+                $cpuOid = '$fdrySnAgentCpuUtil100thPercent';
+            }
+            elsif( $data->{'fdryBoard'}{$brdIndex}{'cpu'} )                
+            {
+                $cpuOid = '$fdrySnAgentCpuUtilValue';
+            }
+
+            if( defined( $cpuOid ) )
+            {
+                
+                $cb->addSubtree
+                    ( $linecardNode, 'CPU_Statistics',
+                      {
+                          'fdry-cpu-base' => $cpuOid,
+                          'nodeid' => 'cpu//%nodeid-device%//' . $brdIndex,
+                      },
+                      [ 'Foundry::fdry-board-cpustats' ]);
+            }
+            
+            if( defined( $data->{'fdryBoard'}{$brdIndex}{'temperature'} ) )
+            {
+                my $tempNode =
+                    $cb->addSubtree( $linecardNode, 'Temperature_Statistics',
+                                     {}, ['Foundry::fdry-board-tempstats']);
+
+                # Build a multi-graph for all sensors
+                
+                my @colors =
+                    ('##one', '##two', '##three', '##four', '##five',
+                     '##six', '##seven', '##eight', '##nine', '##ten');
+
+                my $mgParam = {
+                    'comment' => 'Board temperature sensors combined',
+                    'ds-type' => 'rrd-multigraph',
+                    'vertical-label' => 'Degrees Celcius',
+                    'nodeid' => 'temp//%nodeid-device%//' . $brdIndex,
+                };
+
+                my @sensors;
+                
+                foreach my $sensor
+                    ( sort {$a <=> $b}
+                      keys %{$data->{'fdryBoard'}{$brdIndex}{'temperature'}} )
+                {
+                    my $leafName = 'sensor_' . $sensor;
+                    
+                    my $descr = $data->{'fdryBoard'}{$brdIndex}{
+                        'temperature'}{$sensor};
+
+                    my $short = 'Temperature sensor ' . $sensor;
+                    
+                    my $param = {
+                        'comment'            => $descr,
+                        'precedence'         => 1000 - $sensor,
+                        'sensor-index'       => $sensor,
+                        'sensor-short'       => $short,
+                        'sensor-description' => $descr,                        
+                    };
+                    
+                    $cb->addLeaf
+                        ( $tempNode, $leafName, $param,
+                          ['Foundry::fdry-board-temp-sensor-halfcelsius'] );
+                    
+                    push(@sensors, $leafName);
+                    
+                    $mgParam->{'ds-expr-' . $leafName} =
+                        '{' . $leafName . '}';
+                    $mgParam->{'graph-legend-' . $leafName} = $short;
+                    $mgParam->{'line-style-' . $leafName} = 'LINE2';
+
+                    my $color = shift @colors;
+                    if( not defined( $color ) )
+                    {
+                        Error('Too many sensors on one Foundry board');
+                        $color = '##black';
+                    }                    
+                    $mgParam->{'line-color-' . $leafName} = $color;
+                    
+                    $mgParam->{'line-order-' . $leafName} = $sensor;
+                }
+
+                $mgParam->{'ds-names'} = join(',', @sensors);
+
+                $cb->addLeaf( $tempNode, 'Temperature_Overview', $mgParam );
+            }
+        }
+    }
+}
+
+
+
+1;
diff --git a/torrus/perllib/Torrus/DevDiscover/Jacarta.pm b/torrus/perllib/Torrus/DevDiscover/Jacarta.pm
new file mode 100644 (file)
index 0000000..fdd6ee9
--- /dev/null
@@ -0,0 +1,210 @@
+#  Copyright (C) 2010 Roman Hochuli
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# $Id: Jacarta.pm,v 1.1 2010-12-27 00:03:55 ivan Exp $
+
+# Sensor-MIBs of Jacarta iMeter-Products
+
+
+package Torrus::DevDiscover::Jacarta;
+
+use strict;
+use Torrus::Log;
+use Switch;
+use Data::Dumper;
+
+
+$Torrus::DevDiscover::registry{'Jacarta'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     'jacarta'             => '1.3.6.1.4.1.19011',
+     'sensorEntry'         => '1.3.6.1.4.1.19011.2.3.1.1',
+     'sensorIndex'         => '1.3.6.1.4.1.19011.2.3.1.1.1',
+     'sensorDescription'   => '1.3.6.1.4.1.19011.2.3.1.1.2',
+     'sensorType'          => '1.3.6.1.4.1.19011.2.3.1.1.3',
+     'sensorValue'         => '1.3.6.1.4.1.19011.2.3.1.1.4',
+     'sensorUnit'          => '1.3.6.1.4.1.19011.2.3.1.1.5',
+     );
+
+
+our %sensor_types =
+    (
+     2 => {
+         'template' => 'Jacarta::imeter-humi-sensor',
+         'max' => 'NetBotz::humi-max',
+     },
+     3 => {
+         'template' => 'Jacarta::imeter-temp-sensor',
+         'max' => 'NetBotz::dew-max',
+     },
+     5 => {
+         'template' => 'Jacarta::imeter-amps-sensor',
+         'max' => 'NetBotz::dew-max',
+     },     
+     
+     );
+
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'jacarta',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+    
+    $devdetails->setCap('interfaceIndexingPersistent');
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+
+    $data->{'Jacarta'} = {};
+    
+    my $sensorTable =
+        $session->get_table( -baseoid => $oiddef{'sensorEntry'} );
+
+    if( not defined( $sensorTable ) )
+    {
+        return 1;
+    }
+    
+    $devdetails->storeSnmpVars( $sensorTable );
+        
+    # store the sensor names to guarantee uniqueness
+    my %sensorNames;
+    
+    foreach my $INDEX
+        ($devdetails->getSnmpIndices( $oiddef{'sensorIndex'} ))
+    {
+        my $sensorType =
+            $devdetails->snmpVar( $oiddef{'sensorType'} . '.' .
+                                  $INDEX);
+        my $sensorName =
+            $devdetails->snmpVar( $oiddef{'sensorDescription'} . '.' .
+                                  $INDEX);
+        
+        if( not defined( $sensor_types{$sensorType} ) )
+        {
+            Error('Sensor ' . $INDEX . ' of unknown type: ' . $sensorType);
+            next;
+        }
+        
+        if( $sensorNames{$sensorName} )
+        {
+            Warn('Duplicate sensor names: ' . $sensorName);
+            $sensorNames{$sensorName}++;
+        }
+        else
+        {
+            $sensorNames{$sensorName} = 1;
+        }
+        
+        if( $sensorNames{$sensorName} > 1 )
+        {
+            $sensorName .= sprintf(' %d', $INDEX);
+        }
+        
+        my $leafName = $sensorName;
+        $leafName =~ s/\W/_/g;
+        
+        my $param = {
+            'imeter-sensor-index' => $INDEX,
+            'node-display-name' => $sensorName,
+            'graph-title' => $sensorName,
+            'precedence' => sprintf('%d', 1000 - $INDEX)
+            };
+
+        
+        if( defined( $sensor_types{$sensorType}{'max'} ) )
+        {
+            my $max =
+                $devdetails->param($sensor_types{$sensorType}{'max'});
+            
+            if( defined($max) and $max > 0 )
+            {
+                $param->{'upper-limit'} = $max;
+            }
+        }
+                
+        $data->{'Jacarta'}{$INDEX} = {
+            'param'    => $param,
+            'leafName' => $leafName,
+            'template' => $sensor_types{$sensorType}{'template'}};
+        
+        Debug('Found Sensor ' . $INDEX . ' of type ' . $sensorType .
+              ', named ' . $sensorName );
+    }
+    
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    
+    my $data = $devdetails->data();
+    
+    my $param = {
+        'node-display-name' => 'Sensors',
+        'comment' => 'All sensors connected via this iMeter Master',
+    };
+    
+    my $sensorTree =
+        $cb->addSubtree( $devNode, 'Sensors', $param );
+
+    foreach my $INDEX ( sort {$a<=>$b} keys %{$data->{'Jacarta'}} )
+    {
+        my $ref = $data->{'Jacarta'}{$INDEX};
+        
+        $cb->addLeaf( $sensorTree, $ref->{'leafName'}, $ref->{'param'},
+                      [$ref->{'template'}] );
+    }
+}
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/JunOS.pm b/torrus/perllib/Torrus/DevDiscover/JunOS.pm
new file mode 100644 (file)
index 0000000..ff5c3f8
--- /dev/null
@@ -0,0 +1,657 @@
+#
+#  Copyright (C) 2007  Jon Nistor
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: JunOS.pm,v 1.1 2010-12-27 00:03:53 ivan Exp $
+# Jon Nistor <nistor at snickers.org>
+
+# Juniper JunOS Discovery Module
+#
+# NOTE: For Class of service, if you are noticing that you are not seeing
+#       all of your queue names show up, this is by design of Juniper.
+#       Solution: Put place-holder names for those queues such as:
+#                 "UNUSED-queue-#"
+#       This is in reference to JunOS 7.6
+#
+# NOTE: Options for this module:
+#       JunOS::disable-cos
+#       JunOS::disable-cos-red
+#       JunOS::disable-cos-tail
+#       JunOS::disable-firewall
+#       JunOS::disable-operating
+#       JunOS::disable-rpf
+
+package Torrus::DevDiscover::JunOS;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'JunOS'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+};
+
+
+our %oiddef =
+    (
+     # JUNIPER-SMI
+     'jnxProducts'          => '1.3.6.1.4.1.2636.1',
+     'jnxBoxDescr'          => '1.3.6.1.4.1.2636.3.1.2.0',
+     'jnxBoxSerialNo'       => '1.3.6.1.4.1.2636.3.1.3.0',
+
+     # Operating status
+     'jnxOperatingDescr'    => '1.3.6.1.4.1.2636.3.1.13.1.5',
+     'jnxOperatingTemp'     => '1.3.6.1.4.1.2636.3.1.13.1.7',
+     'jnxOperatingCPU'      => '1.3.6.1.4.1.2636.3.1.13.1.8',
+     'jnxOperatingISR'      => '1.3.6.1.4.1.2636.3.1.13.1.9',
+     'jnxOperatingDRAMSize' => '1.3.6.1.4.1.2636.3.1.13.1.10', # deprecated
+     'jnxOperatingBuffer'   => '1.3.6.1.4.1.2636.3.1.13.1.11',
+     'jnxOperatingMemory'   => '1.3.6.1.4.1.2636.3.1.13.1.15',
+
+     # Firewall filter
+     'jnxFWCounterDisplayFilterName' => '1.3.6.1.4.1.2636.3.5.2.1.6',
+     'jnxFWCounterDisplayName'       => '1.3.6.1.4.1.2636.3.5.2.1.7',
+     'jnxFWCounterDisplayType'       => '1.3.6.1.4.1.2636.3.5.2.1.8',
+
+     # Class of Service (jnxCosIfqStatsTable deprecated, use jnxCosQstatTable)
+     #             COS  - Class Of Service
+     #             RED  - Random Early Detection
+     #             PLP  - Packet Loss Priority
+     #             DSCP - Differential Service Code Point
+
+     'jnxCosFcIdToFcName'   => '1.3.6.1.4.1.2636.3.15.3.1.2',
+     'jnxCosQstatQedPkts'   => '1.3.6.1.4.1.2636.3.15.4.1.3',
+
+     # Reverse path forwarding
+     'jnxRpfStatsPackets'   => '1.3.6.1.4.1.2636.3.17.1.1.1.3'
+
+    );
+
+
+# Not all interfaces are normally needed to monitor.
+# You may override the interface filtering in devdiscover-siteconfig.pl:
+# redefine $Torrus::DevDiscover::JunOS::interfaceFilter
+# or define $Torrus::DevDiscover::JunOS::interfaceFilterOverlay
+
+our $interfaceFilter;
+our $interfaceFilterOverlay;
+my %junosInterfaceFilter;
+
+if( not defined( $interfaceFilter ) )
+{
+    $interfaceFilter = \%junosInterfaceFilter;
+}
+
+
+# Key is some unique symbolic name, does not mean anything
+# ifType is the number to match the interface type
+# ifDescr is the regexp to match the interface description
+%junosInterfaceFilter =
+    (
+     'lsi' => {
+         'ifType'  => 150,                   # mplsTunnel
+         'ifDescr' => '^lsi$'
+     },
+     
+     'other' => {
+         'ifType'  => 1,                     # other
+     },
+     
+     'loopback' => {
+         'ifType'  => 24,                    # softwareLoopback
+     },
+     
+     'propVirtual' => {
+         'ifType'  => 53,                    # propVirtual
+     },
+     
+     'gre_ipip_pime_pimd_mtun'  => {
+         'ifType'  => 131,                     # tunnel
+         'ifDescr' => '^(gre)|(ipip)|(pime)|(pimd)|(mtun)$'
+     },
+
+     'pd_pe_gr_ip_mt_lt' => {
+         'ifType'  => 131,                     # tunnel
+         'ifDescr' => '^(pd)|(pe)|(gr)|(ip)|(mt)|(lt)-\d+\/\d+\/\d+$'
+     },
+     
+     'ls' => {
+         'ifType'  => 108,                     # pppMultilinkBundle
+         'ifDescr' => '^ls-\d+\/\d+\/\d+$'
+     },
+    );
+
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'jnxProducts',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) )
+        )
+    {
+        return 0;
+    }
+
+    &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+        ($devdetails, $interfaceFilter);
+    
+    if( defined( $interfaceFilterOverlay ) )
+    {
+        &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+            ($devdetails, $interfaceFilterOverlay);
+    }
+
+    $devdetails->setCap('interfaceIndexingPersistent');
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    # NOTE: Comments and Serial number of device
+    my $chassisSerial =
+        $dd->retrieveSnmpOIDs( 'jnxBoxDescr', 'jnxBoxSerialNo' );
+
+    if( defined( $chassisSerial ) )
+    {
+        $data->{'param'}{'comment'} = $chassisSerial->{'jnxBoxDescr'} .
+            ', Hw Serial#: ' . $chassisSerial->{'jnxBoxSerialNo'};
+    } else
+    {
+        $data->{'param'}{'comment'} = "Juniper router";
+    }
+
+
+    # PROG: Class of Service
+    #
+    if( $devdetails->param('JunOS::disable-cos') ne 'yes' )
+    {
+        # Poll table to translate the CoS Index to a Name
+        my $cosQueueNumTable =
+            $session->get_table( -baseoid =>
+                                 $dd->oiddef('jnxCosFcIdToFcName') );
+        $devdetails->storeSnmpVars( $cosQueueNumTable );
+
+        if( $cosQueueNumTable )
+        {
+            $devdetails->setCap('jnxCoS');
+
+            # Find the index of the CoS queue name    
+            foreach my $cosFcIndex ( $devdetails->getSnmpIndices
+                                     ($dd->oiddef('jnxCosFcIdToFcName')) )
+            {
+                my $cosFcNameOid = $dd->oiddef('jnxCosFcIdToFcName') . "." .
+                    $cosFcIndex;
+                my $cosFcName    = $cosQueueNumTable->{$cosFcNameOid};
+
+                Debug("JunOS::CoS  FC index: $cosFcIndex  name: $cosFcName");
+
+                # Construct the data ...
+                $data->{'jnxCos'}{'queue'}{$cosFcIndex} = $cosFcName;
+            }
+
+            # We need to find out all the interfaces that have CoS enabled
+            # on them. We will use jnxCosQstatQedPkts as our reference point.
+            my $cosIfIndex =
+                $session->get_table( -baseoid =>
+                                     $dd->oiddef('jnxCosQstatQedPkts') );
+            $devdetails->storeSnmpVars( $cosIfIndex );
+
+           if( $cosIfIndex )            
+            {
+               foreach my $INDEX ( $devdetails->getSnmpIndices
+                                ($dd->oiddef('jnxCosQstatQedPkts')) )
+               {
+                       my( $ifIndex, $cosQueueIndex ) = split( '\.', $INDEX );
+                       $data->{'jnxCos'}{'ifIndex'}{$ifIndex} = 1;
+                       } 
+            }
+        }
+    } # END JunOS::disable-cos
+
+
+    # PROG: Grab and store description of parts
+    #
+    if( $devdetails->param('JunOS::disable-operating') ne 'yes' )
+    {
+        my $tableDesc = $session->get_table( -baseoid =>
+                                             $dd->oiddef('jnxOperatingDescr'));
+        $devdetails->storeSnmpVars( $tableDesc );
+
+        if ( $tableDesc )
+        {
+            # PROG: Set Capability flag
+            $devdetails->setCap('jnxOperating');
+
+            # PROG: Poll tables for more info to match and index on
+            my $tableCPU =
+                $session->get_table( -baseoid =>
+                                     $dd->oiddef('jnxOperatingCPU'));
+            $devdetails->storeSnmpVars( $tableCPU );
+
+            my $tableISR =
+                $session->get_table( -baseoid =>
+                                     $dd->oiddef('jnxOperatingISR'));
+            $devdetails->storeSnmpVars( $tableISR );
+
+            my $tableMEM =
+                $session->get_table( -baseoid =>
+                                     $dd->oiddef('jnxOperatingMemory'));
+            $devdetails->storeSnmpVars( $tableMEM );
+
+            my $tableTemp =
+                $session->get_table( -baseoid =>
+                                     $dd->oiddef('jnxOperatingTemp'));
+            $devdetails->storeSnmpVars( $tableTemp );
+
+            # PROG: Build tables for all the oids
+            #       We are using the Descr oid base for matching. (cheap hack)
+            foreach my $opIndex ( $devdetails->getSnmpIndices
+                                  ($dd->oiddef('jnxOperatingDescr')) )
+            {
+                my $opCPU  = $devdetails->snmpVar
+                    ($dd->oiddef('jnxOperatingCPU') . '.' . $opIndex);
+                my $opDesc = $devdetails->snmpVar
+                    ($dd->oiddef('jnxOperatingDescr') . '.' . $opIndex);
+                my $opMem  = $devdetails->snmpVar
+                    ($dd->oiddef('jnxOperatingMemory') . '.' . $opIndex);
+                my $opISR  = $devdetails->snmpVar
+                    ($dd->oiddef('jnxOperatingISR') . '.' . $opIndex);
+                my $opTemp = $devdetails->snmpVar
+                    ($dd->oiddef('jnxOperatingTemp')  . '.' . $opIndex);
+
+                Debug("JunOS:: opIdx: $opIndex  Desc: $opDesc");
+                Debug("JunOS::   CPU: $opCPU, CPU: $opISR, MEM: $opMem");
+                Debug("JunOS::   Temp: $opTemp");
+
+                # Construct the data
+                $data->{'jnxOperating'}{$opIndex}{'index'} = $opIndex;
+                $data->{'jnxOperating'}{$opIndex}{'cpu'}   = $opCPU;
+                $data->{'jnxOperating'}{$opIndex}{'desc'}  = $opDesc;
+                $data->{'jnxOperating'}{$opIndex}{'isr'}   = $opISR;
+                $data->{'jnxOperating'}{$opIndex}{'mem'}   = $opMem;
+                $data->{'jnxOperating'}{$opIndex}{'temp'}  = $opTemp;
+            }
+        } # END: if $tableDesc
+    } # END: JunOS::disable-operating
+
+
+    # PROG: Firewall statistics
+    if( $devdetails->param('JunOS::disable-firewall') ne 'yes' )
+    {
+        my $tableFWFilter =
+            $session->get_table( -baseoid =>
+                                 $dd->oiddef('jnxFWCounterDisplayFilterName'));
+        $devdetails->storeSnmpVars( $tableFWFilter );
+
+        if( $tableFWFilter )
+        {
+            # PROG: Set Capability flag
+            $devdetails->setCap('jnxFirewall');
+
+            # PROG: Poll tables for more info to match and index on
+            my $tableFWCounter =
+                $session->get_table( -baseoid =>
+                                     $dd->oiddef('jnxFWCounterDisplayName') );
+            $devdetails->storeSnmpVars( $tableFWCounter );
+
+            # Firewall Type (counter = 2, policer = 3)
+            my $tableFWType  =
+                $session->get_table( -baseoid =>
+                                     $dd->oiddef('jnxFWCounterDisplayType') );
+            $devdetails->storeSnmpVars( $tableFWType );
+
+            # PROG: Build tables for all the oids
+            #       We are using the FW Filter name as the Indexing
+            foreach my $fwIndex ( $devdetails->getSnmpIndices
+                                  ($dd->oiddef('jnxFWCounterDisplayName')) )
+            {
+                my $fwFilter = $devdetails->snmpVar
+                    ($dd->oiddef('jnxFWCounterDisplayFilterName') .
+                     '.' . $fwIndex);
+                my $fwCounter  = $devdetails->snmpVar
+                    ($dd->oiddef('jnxFWCounterDisplayName') .
+                     '.' . $fwIndex);
+                my $fwType = $devdetails->snmpVar
+                    ($dd->oiddef('jnxFWCounterDisplayType') .
+                     '.' . $fwIndex);
+                Debug("JunOS::fw Filter: $fwFilter");
+                Debug("JunOS::fw         Counter: $fwCounter");
+                Debug("JunOS::fw            Type: $fwType");
+
+                # Construct the data
+                $data->{'jnxFirewall'}{$fwFilter}{$fwCounter}{'oid'} =
+                    $fwIndex;
+                $data->{'jnxFirewall'}{$fwFilter}{$fwCounter}{'type'} =
+                    $fwType;
+            }
+        } # END: if $tableFWfilter
+    } # END: JunOS::diable-firewall
+
+
+    # PROG: Check for RPF availability
+    if( $devdetails->param('JunOS::disable-rpf') ne 'yes' )
+    {
+        my $tableRPF =
+            $session->get_table( -baseoid =>
+                                 $dd->oiddef('jnxRpfStatsPackets') );
+        $devdetails->storeSnmpVars( $tableRPF );
+
+        if( $tableRPF )
+        {
+            # PROG: Set capability flag
+            $devdetails->setCap('jnxRPF');
+
+            # PROG: Find all the relevent interfaces
+            foreach my $rpfIndex ( $devdetails->getSnmpIndices
+                                   ($dd->oiddef('jnxRpfStatsPackets')) )
+            {
+                my ($ifIndex,$addrFamily) = split('\.',$rpfIndex);
+                if( defined( $data->{'interfaces'}{$ifIndex} ) )
+                {
+                    my $ifAddrFam = $addrFamily == 1 ? 'ipv4' : 'ipv6';
+                    my $intName   = $data->{'interfaces'}{$ifIndex}{'ifName'};
+                    my $intNameT  = $data->{'interfaces'}{$ifIndex}{'ifNameT'};
+                    
+                    # Construct data
+                    $data->{'jnxRPF'}{$ifIndex}{'ifName'}  = $intName;
+                    $data->{'jnxRPF'}{$ifIndex}{'ifNameT'} = $intNameT;
+                    
+                    if( $addrFamily == 1 )
+                    {
+                        $data->{'jnxRPF'}{$ifIndex}{'ipv4'} = 1;
+                    }
+                    if( $addrFamily == 2 )
+                    {
+                        $data->{'jnxRPF'}{$ifIndex}{'ipv6'} = 2;
+                    }                    
+                }
+            }
+        }
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+
+    # PROG: Class of Service information
+    if( $devdetails->hasCap('jnxCoS') &&
+       ( keys %{$data->{'jnxCos'}{'ifIndex'}} > 0 )
+       )
+    {
+       # PROG: Add CoS information if it exists.
+       my $nodeTop = $cb->addSubtree( $devNode, 'CoS', undef,
+                                  [ 'JunOS::junos-cos-subtree']);
+
+        foreach my $ifIndex ( sort {$a <=> $b} keys
+                              %{$data->{'jnxCos'}{'ifIndex'}} )
+        {
+            my $interface = $data->{'interfaces'}{$ifIndex};
+            my $ifAlias   = $interface->{'ifAlias'};
+            my $ifDescr   = $interface->{'ifDescr'};
+            my $ifName    = $interface->{'ifNameT'};
+
+            next if( not $ifName );  # Skip since port is likely 'disabled'
+            # This might be better to match against ifType
+            # as well since not all of them support Q's.
+
+            # Add Subtree per port
+            my $nodePort =
+                $cb->addSubtree( $nodeTop, $ifName,
+                                 { 'comment'    => $ifAlias,
+                                   'precedence' => 1000 - $ifIndex },
+                                 [ 'JunOS::junos-cos-subtree-interface' ]);
+
+            # Loop to create subtree's for each QueueName/ID pair
+            foreach my $cosIndex ( sort keys %{$data->{'jnxCos'}{'queue'}} )
+            {
+                my $cosName  = $data->{'jnxCos'}{'queue'}{$cosIndex};
+                
+                # Add Leaf for each one
+                Debug("JunOS::CoS  ifIndex: $ifIndex ($ifName -> $cosName)");
+                my $nodeIFCOS =
+                    $cb->addSubtree( $nodePort, $cosName,
+                                     { 'comment'    => "Class: " . $cosName,
+                                       'cos-index'  => $cosIndex,
+                                       'cos-name'   => $cosName,
+                                       'ifDescr'    => $ifDescr,
+                                       'ifIndex'    => $ifIndex,
+                                       'ifName'     => $ifName,
+                                       'precedence' => 1000 - $cosIndex },
+                                     [ 'JunOS::junos-cos-leaf' ]);
+
+                if( $devdetails->param('JunOS::disable-cos-tail') ne 'yes' )
+                {
+                    $cb->addSubtree( $nodeIFCOS, "Tail_drop_stats",
+                                     { 'comment'  => 'Tail drop statistics' },
+                                     [ 'JunOS::junos-cos-tail' ]);
+                }
+
+                if( $devdetails->param('JunOS::disable-cos-red') ne 'yes' )
+                {
+                    $cb->addSubtree
+                        ( $nodeIFCOS, "RED_stats",
+                          { 'comment'  => 'Random Early Detection' },
+                          [ 'JunOS::junos-cos-red' ]);
+                }
+                
+            } # end foreach (INDEX of queue's [Q-ID])
+        } # end foreach (INDEX of port)
+    } # end if HasCap->{CoS}
+
+
+    # PROG: Firewall Table (filters and counters)
+    if( $devdetails->hasCap('jnxFirewall') )
+    {
+        # Add subtree first
+        my $nodeFW = $cb->addSubtree( $devNode, 'Firewall', undef,
+                                      [ 'JunOS::junos-firewall-subtree' ]);
+
+        # Loop through and find all the filter names
+        foreach my $fwFilter
+            ( sort {$a <=> $b} keys %{$data->{'jnxFirewall'}} )
+        {
+            my $firewall  = $data->{'jnxFirewall'}{$fwFilter};
+
+            # Add subtree for FilterName
+            my $nodeFWFilter =
+                $cb->addSubtree( $nodeFW, $fwFilter,
+                                 { 'comment' => 'Filter: ' . $fwFilter },
+                                 [ 'JunOS::junos-firewall-filter-subtree' ]);
+            
+            # Loop through and find all the counter names within the filter
+            foreach my $fwCounter ( sort {$a <=> $b} keys %{$firewall} )
+            {
+                my $fwOid     = $firewall->{$fwCounter}{'oid'};
+                my $fwType    = $firewall->{$fwCounter}{'type'};
+                my @templates = ( 'JunOS::junos-firewall-filter' );
+
+                # Figure out which templates to apply ...
+                if ($fwType == 2)
+                {
+                    # fwType is a counter ...
+                    push( @templates,
+                          'JunOS::junos-firewall-filter-counter',
+                          'JunOS::junos-firewall-filter-policer' );
+                }
+                elsif ($fwType == 3)
+                {
+                    # fwType is a policer ...
+                    push( @templates,
+                          'JunOS::junos-firewall-filter-policer' );
+                } # END: if $fwType
+
+                # Finally, add the subtree...
+                my $fwTypeName = $fwType == 2 ? 'Counter: ' : 'Policer: ';
+                my $nodeFWCounter =
+                    $cb->addSubtree($nodeFWFilter, $fwCounter,
+                                    { 'comment'    => $fwTypeName . $fwCounter,
+                                      'fw-counter' => $fwCounter,
+                                      'fw-filter'  => $fwFilter,
+                                      'fw-index'   => $fwOid }, \@templates );
+            } # END foreach $fwCounter
+        } # END foreach $fwFilter
+    } # END: if hasCap jnxFirewall
+
+
+    # PROG: Operating Status Table
+    # NOTE: According to the Juniper MIB, the following is a statement:
+    #       jnxOperatingTemp: The temperature in Celsius (degrees C) of this
+    #                         subject.  Zero if unavailable or inapplicable.
+    #       The same applies for all values under Operating status table, if
+    #       Zero is shown it might be considered unavail or N/A.  We will
+    #       also take that into consideration.
+    # NOTE: Also so poorly written, its great.
+    if( $devdetails->hasCap('jnxOperating') )
+    {
+        my $nodeCPU  = $cb->addSubtree( $devNode, 'CPU_Usage', undef,
+                                        [ 'JunOS::junos-cpu-subtree' ]);
+
+        my $nodeMem  = $cb->addSubtree( $devNode, 'Memory_Usage', undef,
+                                        [ 'JunOS::junos-memory-subtree' ]);
+
+        my $nodeTemp =
+            $cb->addSubtree( $devNode, 'Temperature_Sensors', undef,
+                             [ 'JunOS::junos-temperature-subtree' ]);
+
+        
+        foreach my $opIndex
+            ( sort {$a <=> $b} keys %{$data->{'jnxOperating'}} )
+        {
+            my $operating = $data->{'jnxOperating'}{$opIndex};
+            my $jnxCPU    = $operating->{'cpu'};
+            my $jnxDesc   = $operating->{'desc'};
+            my $jnxMem    = $operating->{'mem'};
+            my $jnxTemp   = $operating->{'temp'};
+            my $jnxTag = $jnxDesc;
+            $jnxTag =~ s/\W+/_/go;
+            $jnxTag =~ s/_$//go;
+            # Fix the .'s into _'s for the RRD-DS and name of leaf
+            my $opIndexFix = $opIndex;
+            $opIndexFix =~ s/\./_/g;
+
+            # PROG: Find CPU that does not equal 0
+            if ($jnxCPU > 0)
+            {
+                $cb->addSubtree( $nodeCPU, $jnxTag,
+                                 { 'comment'   => $jnxDesc,
+                                   'cpu-index' => $opIndex },
+                                 [ 'JunOS::junos-cpu' ]);
+            }
+
+            # PROG: Find memory that does not equal 0
+            if ($jnxMem > 0)
+            {
+                $cb->addSubtree( $nodeMem, $jnxTag,
+                                 { 'comment'      => $jnxDesc,
+                                   'mem-index'    => $opIndex,
+                                   'mem-indexFix' => $opIndexFix },
+                                 [ 'JunOS::junos-memory' ]);
+            }
+
+            # PROG: Find Temperature that does not equal 0
+            if ($jnxTemp > 0)
+            {
+                if ($jnxDesc =~ /(temp.* sensor|Engine)/) {
+                    # Small little hack to cleanup the sensor tags
+                    $jnxTag =~ s/_temp(erature|)_sensor//g;
+                    $cb->addLeaf( $nodeTemp, $jnxTag,
+                                  { 'comment'         => $jnxDesc,
+                                    'sensor-desc'     => $jnxDesc, 
+                                    'sensor-index'    => $opIndex,
+                                    'sensor-indexFix' => $opIndexFix },
+                                  [ 'JunOS::junos-temperature-sensor' ]);
+                }
+            }
+        } # END foreach $opIndex
+    } # END if jnxOperating
+
+
+    # PROG: Reverse Forwarding Path (RPF)
+    if( $devdetails->hasCap('jnxRPF') )
+    {
+        # Add subtree first
+        my $nodeRPF = $cb->addSubtree( $devNode, 'RPF', undef,
+                                       [ 'JunOS::junos-rpf-subtree' ]);
+
+        # Loop through and find all interfaces with RPF enabled
+        foreach my $ifIndex ( sort {$a <=> $b} keys %{$data->{'jnxRPF'}} )
+        {
+            # Set some names
+            my $ifAlias = $data->{'interfaces'}{$ifIndex}{'ifAlias'};
+            my $ifName  = $data->{'interfaces'}{$ifIndex}{'ifName'};
+            my $ifNameT = $data->{'interfaces'}{$ifIndex}{'ifNameT'};
+            my $hasIPv4 = $data->{'jnxRPF'}{$ifIndex}{'ipv4'};
+            my $hasIPv6 = $data->{'jnxRPF'}{$ifIndex}{'ipv6'};
+
+            Debug("JunOS:: RPF  int: $ifName  IPv4: $hasIPv4  IPv6: $hasIPv6");
+
+            # PROG: Process IPv4 first ... 
+            if( $hasIPv4 )
+            {
+                $cb->addSubtree( $nodeRPF, 'IPv4_' . $ifNameT,
+                                 { 'comment'    => $ifAlias,
+                                   'ifAddrType' => "ipv4",
+                                   'ifName'     => $ifName,
+                                   'ifNameT'    => $ifNameT,
+                                   'rpfIndex'   => $ifIndex . "." . $hasIPv4 },
+                                 [ 'JunOS::junos-rpf' ]);
+            }
+
+            if( $hasIPv6 )
+            {
+                $cb->addSubtree( $nodeRPF, 'IPv6_' . $ifNameT,
+                                 { 'comment'    => $ifAlias,
+                                   'ifAddrType' => "ipv6",
+                                   'ifName'     => $ifName,
+                                   'ifNameT'    => $ifNameT,
+                                   'rpfIndex'   => $ifIndex . "." . $hasIPv6 },
+                                 [ 'JunOS::junos-rpf' ]);
+            }
+        }
+    } # END: if jnxRPF
+}
+
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/Liebert.pm b/torrus/perllib/Torrus/DevDiscover/Liebert.pm
new file mode 100644 (file)
index 0000000..c8aa3d2
--- /dev/null
@@ -0,0 +1,313 @@
+#
+#  Discovery module for Liebert HVAC systems
+#
+#  Copyright (C) 2008 Jon Nistor
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Liebert.pm,v 1.1 2010-12-27 00:03:50 ivan Exp $
+# Jon Nistor <nistor at snickers.org>
+#
+# NOTE: Options for this module
+#       Liebert::use-fahrenheit
+#      Liebert::disable-temperature
+#      Liebert::disable-humidity
+#      Liebert::disable-state
+#      Liebert::disable-stats
+#
+# NOTE: This module supports both Fahrenheit and Celcius, but for ease of
+#       module and cleanliness we will convert Celcius into Fahrenheit
+#       instead of polling for Fahrenheit directly.
+#
+
+# Liebert discovery module
+package Torrus::DevDiscover::Liebert;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'Liebert'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+our %oiddef =
+    (
+     # LIEBERT-GP-REGISTRATION-MIB
+     'GlobalProducts'    => '1.3.6.1.4.1.476.1.42',
+
+     # LIEBERT-GP-AGENT-MIB
+     'Manufacturer'       => '1.3.6.1.4.1.476.1.42.2.1.1.0',
+     'Model'              => '1.3.6.1.4.1.476.1.42.2.1.2.0',
+     'FirmwareVer'        => '1.3.6.1.4.1.476.1.42.2.1.3.0',
+     'SerialNum'          => '1.3.6.1.4.1.476.1.42.2.1.4.0',
+     'PartNum'            => '1.3.6.1.4.1.476.1.42.2.1.5.0',
+
+     'TemperatureIdDegF'  => '1.3.6.1.4.1.476.1.42.3.4.1.2.3.1.1',
+     'TemperatureIdDegC'  => '1.3.6.1.4.1.476.1.42.3.4.1.3.3.1.1',
+     'HumidityIdRel'      => '1.3.6.1.4.1.476.1.42.3.4.2.2.3.1.1',
+
+     'lgpEnvState'                => '1.3.6.1.4.1.476.1.42.3.4.3',
+     'lgpEnvStateCoolingCapacity' => '1.3.6.1.4.1.476.1.42.3.4.3.9.0',
+     'lgpEnvStatistics'           => '1.3.6.1.4.1.476.1.42.3.4.6',
+
+     );
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch ( 'GlobalProducts',
+            $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+   
+    $devdetails->setCap('interfaceIndexingPersistent');
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    # PROG: Grab versions, serials and type of chassis.
+    my $Info = $dd->retrieveSnmpOIDs ( 'Manufacturer', 'Model',
+                        'FirmwareVer', 'SerialNum', 'PartNum' );
+
+    # SNMP: System comment
+    $data->{'param'}{'comment'} =
+            $Info->{'Manufacturer'} . " " . $Info->{'Model'} . ", Version: " .
+            $Info->{'FirmwareVer'} . ", Serial: " . $Info->{'SerialNum'};
+
+    # The Liebert HVAC snmp implementation requires a lower number
+    # of pdu's to be sent to it.
+    $data->{'param'}{'snmp-oids-per-pdu'} = 10;
+
+    # Temperature
+    if( $devdetails->param('Liebert::disable-temperature') ne 'yes' ) 
+    {
+        $devdetails->setCap('env-temperature');
+
+        if( $devdetails->param('Liebert::use-fahrenheit') ne 'yes' )
+        {
+            # ENV: Temperature in Celcius
+            my $idTable = $session->get_table(
+                 -baseoid => $dd->oiddef('TemperatureIdDegC') );
+            $devdetails->storeSnmpVars( $idTable );
+
+            if( defined( $idTable ) )
+            {
+                $devdetails->setCap('env-temperature-celcius');
+
+                foreach my $index ( $devdetails->getSnmpIndices(
+                                    $dd->oiddef('TemperatureIdDegC') ) )
+                {
+                    Debug("Liebert: Temp (degC) index: $index");
+                    $data->{'liebert'}{'tempidx'}{$index} = "celcius";
+                }
+            }
+        } else {
+            # ENV: Temperature in Fahrenheit
+            my $idTable = $session->get_table(
+                 -baseoid => $dd->oiddef('TemperatureIdDegF') );
+            $devdetails->storeSnmpVars( $idTable );
+
+            if( defined( $idTable ) )
+            {
+                $devdetails->setCap('env-temperature-fahrenheit');
+
+                foreach my $index ( $devdetails->getSnmpIndices(
+                                    $dd->oiddef('TemperatureIdDegF') ) )
+                {
+                    Debug("Liebert: Temp (degF) index: $index");
+                    $data->{'liebert'}{'tempidx'}{$index} = "fahrenheit";
+                }
+            }
+        }
+    }
+
+    # ENV: Humidity
+    if( $devdetails->param('Liebert::disable-humidity') ne 'yes' )
+    {
+        my $idTable = $session->get_table(
+                 -baseoid => $dd->oiddef('HumidityIdRel') );
+        $devdetails->storeSnmpVars( $idTable );
+
+        if( defined( $idTable ) )
+        {
+            $devdetails->setCap('env-humidity');
+            foreach my $index ( $devdetails->getSnmpIndices(
+                                $dd->oiddef('HumidityIdRel') ) )
+            {
+                Debug("Liebert: humidity index: $index");
+                $data->{'liebert'}{'humididx'}{$index} = "humidity";
+            }
+        }
+    }
+
+    # ENV: State
+    if( $devdetails->param('Liebert::disable-state') ne 'yes' )
+    {
+        my $stateTable = $session->get_table(
+                 -baseoid => $dd->oiddef('lgpEnvState') );
+        $devdetails->storeSnmpVars( $stateTable );
+
+        if( defined( $stateTable ) )
+        {
+            $devdetails->setCap('env-state');
+
+            # PROG: Check to see if Firmware is new enough for Capacity
+            if( $dd->checkSnmpOID('lgpEnvStateCoolingCapacity') )
+            {
+                $devdetails->setCap('env-state-capacity');
+            }
+        }
+    }
+
+    # Statistics
+    if( $devdetails->param('Liebert::disable-stats') ne 'yes' )
+    {
+        my $statsTable = $session->get_table(
+                 -baseoid => $dd->oiddef('lgpEnvStatistics') );
+        $devdetails->storeSnmpVars( $statsTable );
+
+        if( defined( $statsTable ) )
+        {
+            $devdetails->setCap('env-stats');
+        }
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+    if( $devdetails->hasCap('env-temperature') )
+    {
+        # All place-setting variables default to Celcius
+        my @template;
+        my $dataFile   = "%system-id%_temperature.rrd";
+        my $fahrenheit = 0;
+        my $snmpVar    = 3;
+        my $tempUnit   = "C";
+        my $tempScale  = "Celcius";
+        my $tempLowLim = 15;
+        my $tempUppLim = 70;
+
+        if( $devdetails->hasCap('env-temperature-fahrenheit') )
+        {
+            $dataFile   = "%system-id%_temperature_f.rrd";
+            $fahrenheit        = 1;
+            $snmpVar    = 2;
+            $tempUnit   = "F";
+            $tempScale  = "Fahrenheit";
+            $tempLowLim = $tempLowLim * 1.8 + 32;
+            $tempUppLim = $tempUppLim * 1.8 + 32;
+            push(@template, "Liebert::temperature-sensor-fahrenheit");
+        } else {
+            push(@template, "Liebert::temperature-sensor");
+        }
+
+        my $paramSubTree = {
+            'data-file'      => $dataFile,
+            'temp-idx'       => $snmpVar,
+            'temp-lower'     => $tempLowLim,
+            'temp-scale'     => $tempUnit,
+            'temp-upper'     => $tempUppLim,
+            'vertical-label' => "degrees $tempScale"
+        };
+        my $nodeTemp = $cb->addSubtree( $devNode, 'Temperature', $paramSubTree,
+                                      [ 'Liebert::temperature-subtree' ] );
+
+       # ----------------------------------------------------------------
+        # PROG: Figure out how many indexes we have
+        foreach my $index ( keys %{$data->{'liebert'}{'tempidx'}} )
+        {
+            my $dataFile = "%system-id%_sensor_$index" . 
+                           ($fahrenheit ? '_fahrenheit':'') . ".rrd";
+            Debug("Liebert: Temperature idx: $index : $tempScale");
+            my $param = {
+                'comment'    => "Sensor: $index",
+                'data-file'  => $dataFile,
+                'sensor-idx' => $index
+            };
+
+            $cb->addSubtree( $nodeTemp, 'sensor_' . $index, $param,
+                        [ @template ] );
+        } # END: foreach my $index
+    } # END: env-temperature
+
+
+    # Humidity
+    if( $devdetails->hasCap('env-humidity') )
+    {
+        my $nodeHumidity = $cb->addSubtree( $devNode, "Humidity", undef,
+                                          [ 'Liebert::humidity-subtree' ] );
+
+        # PROG: Figure out how many sensors we have
+        foreach my $index ( keys %{$data->{'liebert'}{'humididx'}} )
+        {
+            Debug("Liebert: Humidity idx: $index");
+
+            my $param = {
+                'comment'   => "Sensor: " . $index,
+                'humid-idx' => $index
+            };
+
+            $cb->addSubtree( $nodeHumidity, 'sensor_' . $index, $param,
+                           [ 'Liebert::humidity-sensor' ] );
+        }
+
+    } # END of hasCap
+
+
+    # State of the system
+    if( $devdetails->hasCap('env-state') )
+    {
+        my $nodeState = $cb->addSubtree( $devNode, 'State', undef,
+                                       [ 'Liebert::state-subtree' ] );
+
+        if( $devdetails->hasCap('env-state-capacity') )
+        {
+            $cb->addSubtree( $devNode, 'State', undef,
+                           [ 'Liebert::state-capacity' ] );
+        }
+    }
+}
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/MicrosoftWindows.pm b/torrus/perllib/Torrus/DevDiscover/MicrosoftWindows.pm
new file mode 100644 (file)
index 0000000..d924dc4
--- /dev/null
@@ -0,0 +1,181 @@
+#  Copyright (C) 2003-2004  Stanislav Sinyagin, Shawn Ferry
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: MicrosoftWindows.pm,v 1.1 2010-12-27 00:03:55 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+# Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+
+# MS Windows 2000/XP SNMP agent discovery.
+# ifDescr does not give unique interace mapping, so MAC address mapping
+# is used.
+
+package Torrus::DevDiscover::MicrosoftWindows;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'MicrosoftWindows'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # MSFT-MIB
+     'windowsNT'                    => '1.3.6.1.4.1.311.1.1.3.1',
+
+     # FtpServer-MIB
+     'ms_ftpStatistics'             => '1.3.6.1.4.1.311.1.7.2.1',
+
+     # HttpServer-MIB
+     'ms_httpStatistics'            => '1.3.6.1.4.1.311.1.7.3.1',
+     );
+
+# Not all interfaces are normally needed to monitor.
+# You may override the interface filtering in devdiscover-siteconfig.pl:
+# redefine $Torrus::DevDiscover::MicrosoftWindows::interfaceFilter
+# or define $Torrus::DevDiscover::MicrosoftWindows::interfaceFilterOverlay
+
+our $interfaceFilter;
+our $interfaceFilterOverlay;
+my %winNTInterfaceFilter;
+
+if( not defined( $interfaceFilter ) )
+{
+    $interfaceFilter = \%winNTInterfaceFilter;
+}
+
+
+# Key is some unique symbolic name, does not mean anything
+# ifType is the number to match the interface type
+# ifDescr is the regexp to match the interface description
+%winNTInterfaceFilter =
+    (
+     'MS TCP Loopback interface' => {
+         'ifType'  => 24                        # softwareLoopback
+         },
+     );
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'windowsNT',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+
+    my $data = $devdetails->data();
+
+    &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+        ($devdetails, $interfaceFilter);
+
+    if( defined( $interfaceFilterOverlay ) )
+    {
+        &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+            ($devdetails, $interfaceFilterOverlay);
+    }
+
+    $devdetails->setCap('interfaceIndexingManaged');
+    
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    # In Windows SNMP agent, ifDescr is not unique per interface.
+    # We use MAC address as a unique interface identifier.
+
+    $data->{'nameref'}{'ifComment'} = ''; # suggest?
+
+    $data->{'param'}{'ifindex-map'} = '$IFIDX_MAC';
+    Torrus::DevDiscover::RFC2863_IF_MIB::retrieveMacAddresses( $dd,
+                                                               $devdetails );
+
+    $data->{'nameref'}{'ifNick'} = 'MAC';
+    
+    # FTP and HTTP servers, if present
+    if( $dd->checkSnmpTable( 'ms_ftpStatistics' ) )
+    {
+        $devdetails->setCap( 'msIIS' );
+        $devdetails->setCap( 'msFtpStats' );
+    }
+
+    if( $dd->checkSnmpTable( 'ms_httpStatistics' ) )
+    {
+        $devdetails->setCap( 'msIIS' );
+        $devdetails->setCap( 'msHttpStats' );
+    }
+
+    return 1;
+}
+
+
+# Nothing really to do yet
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    if( $devdetails->hasCap( 'msIIS' ) )
+    {
+        my $iisParam = {
+            'precedence'    =>  -100000,
+            'comment'       => 'Microsoft Internet Information Server'
+            };
+
+        my @iisTemplates;
+        if( $devdetails->hasCap( 'msFtpStats' ) )
+        {
+            push( @iisTemplates,
+                  'MicrosoftWindows::microsoft-iis-ftp-stats' );
+        }
+        if( $devdetails->hasCap( 'msHttpStats' ) )
+        {
+            push( @iisTemplates,
+                  'MicrosoftWindows::microsoft-iis-http-stats' );
+        }
+
+
+        my $iisNode = $cb->addSubtree( $devNode, 'MS_IIS', $iisParam,
+                                       \@iisTemplates );
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/MotorolaBSR.pm b/torrus/perllib/Torrus/DevDiscover/MotorolaBSR.pm
new file mode 100644 (file)
index 0000000..dd061d5
--- /dev/null
@@ -0,0 +1,213 @@
+#
+#  Discovery module for Motorola Broadband Services Router (formely Riverdelta)
+#
+#  Copyright (C) 2006 Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: MotorolaBSR.pm,v 1.1 2010-12-27 00:03:53 ivan Exp $
+#
+
+
+# Cisco SCE devices discovery
+package Torrus::DevDiscover::MotorolaBSR;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'MotorolaBSR'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+# pmodule-dependend OIDs are presented for module #1 only.
+# currently devices with more than one module do not exist
+
+our %oiddef =
+    (
+     'rdnProducts' => '1.3.6.1.4.1.4981.4.1',
+     # RDN-CMTS-MIB
+     'rdnCmtsUpstreamChannelTable' => '1.3.6.1.4.1.4981.2.1.2'     
+     );
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'rdnProducts',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) or
+        not $devdetails->isDevType('RFC2670_DOCS_IF') )
+    {
+        return 0;
+    }
+                
+    $devdetails->setCap('interfaceIndexingPersistent');
+
+    return 1;
+}
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    $data->{'param'}{'ifindex-map'} = '$IFIDX_IFINDEX';
+    Torrus::DevDiscover::RFC2863_IF_MIB::storeIfIndexParams( $devdetails );
+    
+    if( $dd->checkSnmpTable( 'rdnCmtsUpstreamChannelTable' ) )
+    {
+        $devdetails->setCap('rdnCmtsUpstreamChannelTable');
+
+        foreach my $ifIndex ( @{$data->{'docsCableUpstream'}} )
+        {
+            my $interface = $data->{'interfaces'}{$ifIndex};
+            
+            push( @{$interface->{'docsTemplates'}},
+                  'MotorolaBSR::motorola-bsr-docsis-upstream-util' );
+        }
+    }
+    
+    return 1;
+}
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+    if( $devdetails->hasCap('rdnCmtsUpstreamChannelTable') and
+        scalar( @{$data->{'docsCableUpstream'}} ) > 0 )
+    {
+        my $upstrNode =
+            $cb->getChildSubtree( $devNode,
+                                  $data->{'docsConfig'}{'docsCableUpstream'}{
+                                      'subtreeName'} );
+        
+        my $shortcuts = 'snr,fec,freq,modems';
+        
+        my $param = {        
+            'overview-shortcuts' =>
+                $shortcuts,
+                
+                'overview-subleave-name-modems' => 'Modems',
+                'overview-direct-link-modems' => 'yes',
+                'overview-direct-link-view-modems' => 'expanded-dir-html',
+                'overview-shortcut-text-modems' => 'All modems',
+                'overview-shortcut-title-modems'=>
+                'Show modem quantities in one page',
+                'overview-page-title-modems' => 'Modem quantities',
+            };
+
+        $cb->addParams( $upstrNode, $param );
+        
+        # Build All_Modems summary graph
+        
+        my $param = {
+            'ds-type'              => 'rrd-multigraph',
+            'ds-names'             => 'registered,unregistered,offline',
+            'graph-lower-limit'    => '0',
+            'precedence'           => '1000',
+                
+            'vertical-label'       => 'Modems',
+            'descriptive-nickname'     => '%system-id%: All modems',
+            
+            'ds-expr-registered' => '{Modems_Registered}',
+            'graph-legend-registered' => 'Registered',
+            'line-style-registered' => 'AREA',
+            'line-color-registered' => '##blue',
+            'line-order-registered' => '1',
+            
+            'ds-expr-unregistered' => '{Modems_Unregistered}',
+            'graph-legend-unregistered' => 'Unregistered',
+            'line-style-unregistered' => 'STACK',
+            'line-color-unregistered' => '##crimson',
+            'line-order-unregistered' => '2',
+            
+            'ds-expr-offline' => '{Modems_Offline}',
+            'graph-legend-offline' => 'Offline',
+            'line-style-offline' => 'STACK',
+            'line-color-offline' => '##silver',
+            'line-order-offline' => '3',                
+        };
+        
+        $param->{'comment'} =
+            'Registered, Unregistered and Offline modems on CMTS';
+        
+        $param->{'nodeid'} =
+            $data->{'docsConfig'}{'docsCableUpstream'}{'nodeidCategory'} .
+            '//%nodeid-device%//modems';
+        
+        my $first = 1;
+        foreach my $ifIndex ( @{$data->{'docsCableUpstream'}} )
+        {
+            my $interface = $data->{'interfaces'}{$ifIndex};
+            
+            my $intf = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
+            
+            if( $first )
+            {
+                $param->{'ds-expr-registered'} =
+                    '{' . $intf . '/Modems_Registered}';
+                $param->{'ds-expr-unregistered'} =
+                    '{' . $intf . '/Modems_Unregistered}';
+                $param->{'ds-expr-offline'} =
+                    '{' . $intf . '/Modems_Offline}';
+                $first = 0;
+            }
+            else
+            {
+                $param->{'ds-expr-registered'} .=
+                    ',{' . $intf . '/Modems_Registered},+';
+                $param->{'ds-expr-unregistered'} .=
+                    ',{' . $intf . '/Modems_Unregistered},+';
+                $param->{'ds-expr-offline'} .=
+                    ',{' . $intf . '/Modems_Offline},+';
+            }
+        }
+
+        my $usNode =
+            $cb->getChildSubtree( $devNode,
+                                  $data->{'docsConfig'}{
+                                      'docsCableUpstream'}{
+                                          'subtreeName'} );
+        if( defined( $usNode ) )
+        {
+            $cb->addLeaf( $usNode, 'All_Modems', $param, [] );
+        }
+        else
+        {
+            Error('Could not find the Upstream subtree');
+            exit 1;
+        }
+    }
+}
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/NetApp.pm b/torrus/perllib/Torrus/DevDiscover/NetApp.pm
new file mode 100644 (file)
index 0000000..3316803
--- /dev/null
@@ -0,0 +1,170 @@
+#  Copyright (C) 2004  Shawn Ferry
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: NetApp.pm,v 1.1 2010-12-27 00:03:55 ivan Exp $
+# Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+
+# NetApp.com storage products
+
+package Torrus::DevDiscover::NetApp;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'NetApp'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+our %oiddef =
+    (
+     'netapp'                               => '1.3.6.1.4.1.789',
+     'netapp1'                              => '1.3.6.1.4.1.789.1',
+     'netappProducts'                       => '1.3.6.1.4.1.789.2',
+
+     # netapp product 
+     'netapp_product'                       => '1.3.6.1.4.1.789.1.1',
+     'netapp_productVersion'                => '1.3.6.1.4.1.789.1.1.2.0',
+     'netapp_productId'                     => '1.3.6.1.4.1.789.1.1.3.0',
+     'netapp_productModel'                  => '1.3.6.1.4.1.789.1.1.5.0',
+     'netapp_productFirmwareVersion'        => '1.3.6.1.4.1.789.1.1.6.0',
+     
+     # netapp sysstat
+     'netapp_sysStat'                       => '1.3.6.1.4.1.789.1.2',
+     'netapp_sysStat_cpuCount'              => '1.3.6.1.4.1.789.1.2.1.6.0',
+     
+     # netapp nfs
+     'netapp_nfs'                           => '1.3.6.1.4.1.789.1.3',
+     'netapp_nfsIsLicensed'                 => '1.3.6.1.4.1.789.1.3.3.1.0',
+     
+     # At a glance Lookup values seem to be the most common as opposed to
+     # collecting NFS stats for v2 and v3 (and eventually v4 ) if No lookups
+     # have been performed at discovery time we assume that vX is not in use.
+     'netapp_tv2cLookups'              => '1.3.6.1.4.1.789.1.3.2.2.3.1.5.0',
+     'netapp_tv3cLookups'              => '1.3.6.1.4.1.789.1.3.2.2.4.1.4.0',
+     
+     # netapp CIFS
+     'netapp_cifs'                     => '1.3.6.1.4.1.789.1.7',
+     'netapp_cifsIsLicensed'           => '1.3.6.1.4.1.789.1.7.21.0',
+     
+     # 4 - 19 should also be interesting
+     # particularly cluster netcache stats
+     );
+
+#       netappFiler     OBJECT IDENTIFIER ::= { netappProducts 1 }
+#       netappNetCache  OBJECT IDENTIFIER ::= { netappProducts 2 }
+#       netappClusteredFiler    OBJECT IDENTIFIER ::= { netappProducts 3 }
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    return $dd->checkSnmpTable( 'netapp' );
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    my $result = $dd->retrieveSnmpOIDs
+        ( 'netapp_productModel',  'netapp_productId',
+          'netapp_productVersion', 'netapp_productFirmwareVersion',
+          'netapp_nfsIsLicensed', 'netapp_cifsIsLicensed',
+          'netapp_tv2cLookups', 'netapp_tv3cLookups' );
+    
+    $data->{'param'}->{'comment'} =
+        sprintf('%s %s: %s %s',
+                $result->{'netapp_productModel'},
+                $result->{'netapp_productId'},
+                $result->{'netapp_productVersion'},
+                $result->{'netapp_productFirmwareVersion'});
+    
+    # At a glance Lookup values seem to be the most common as opposed to
+    # collecting NFS stats for v2 and v3 (and eventually v4 ) if No lookups
+    # have been performed at discovery time we assume that nfsvX is not in use.
+    
+    if( $result->{'netapp_nfsIsLicensed'} == 2 )
+    {
+        if( $result->{'netapp_tv2cLookups'} > 0 )
+        {
+            $devdetails->setCap('NetApp::nfsv2');
+        }
+
+        if( $result->{'netapp_tv3cLookups'} > 0 )
+        {
+            $devdetails->setCap('NetApp::nfsv3');
+        }
+    }
+
+    if( $result->{'netapp_cifsIsLicensed'} == 2 )
+    {
+        $devdetails->setCap('NetApp::cifs');
+    }
+    
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+    $cb->addParams( $devNode, $data->{'params'} );
+
+    # Add CPU Template
+    $cb->addTemplateApplication( $devNode, 'NetApp::CPU');
+    
+    # Add Misc Stats
+    $cb->addTemplateApplication( $devNode, 'NetApp::misc');
+
+    if( $devdetails->hasCap('NetApp::nfsv2') )
+    {
+        $cb->addTemplateApplication( $devNode, 'NetApp::nfsv2');
+    }
+
+    if( $devdetails->hasCap('NetApp::nfsv3') )
+    {
+        $cb->addTemplateApplication( $devNode, 'NetApp::nfsv3');
+    }
+
+    if( $devdetails->hasCap('NetApp::cifs') )
+    {
+        Debug("Would add cifs here\n");
+        #$cb->addTemplateApplication( $devNode, 'NetApp::cifs');
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/NetBotz.pm b/torrus/perllib/Torrus/DevDiscover/NetBotz.pm
new file mode 100644 (file)
index 0000000..f91af5e
--- /dev/null
@@ -0,0 +1,197 @@
+#  Copyright (C) 2009 Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+# $Id: NetBotz.pm,v 1.1 2010-12-27 00:03:47 ivan Exp $
+
+# NetBotz modular sensors
+
+package Torrus::DevDiscover::NetBotz;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'NetBotz'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     'netBotzV2Products'     => '1.3.6.1.4.1.5528.100.20',
+     );
+
+
+our %sensor_types =
+    ('temp'   => {
+        'oid' => '1.3.6.1.4.1.5528.100.4.1.1.1',
+        'template' => 'NetBotz::netbotz-temp-sensor',
+        'max' => 'NetBotz::temp-max',
+        },
+     'humi'   => {
+         'oid' => '1.3.6.1.4.1.5528.100.4.1.2.1',
+         'template' => 'NetBotz::netbotz-humi-sensor',
+         'max' => 'NetBotz::humi-max',
+         },
+     'dew'    => {
+         'oid' => '1.3.6.1.4.1.5528.100.4.1.3.1',
+         'template' => 'NetBotz::netbotz-dew-sensor',
+         'max' => 'NetBotz::dew-max',
+         },
+     'audio'  => {
+         'oid' => '1.3.6.1.4.1.5528.100.4.1.4.1',
+         'template' => 'NetBotz::netbotz-audio-sensor'
+         },
+     'air' => {
+         'oid' => '1.3.6.1.4.1.5528.100.4.1.5.1',
+         'template' => 'NetBotz::netbotz-air-sensor'
+         },
+     'door' => {
+         'oid' => '1.3.6.1.4.1.5528.100.4.2.2.1',
+         'template' => 'NetBotz::netbotz-door-sensor'
+         },
+     );
+     
+     
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'netBotzV2Products',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+    
+    $devdetails->setCap('interfaceIndexingPersistent');
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+
+    foreach my $stype (sort keys %sensor_types)
+    {
+        my $oid = $sensor_types{$stype}{'oid'};
+        
+        my $sensorTable = $session->get_table( -baseoid => $oid );
+        
+        if( defined( $sensorTable ) )
+        {
+            $devdetails->storeSnmpVars( $sensorTable );
+
+            # store the sensor names to guarantee uniqueness
+            my %sensorNames;
+            
+            foreach my $INDEX ($devdetails->getSnmpIndices($oid . '.1'))
+            {
+                my $label = $devdetails->snmpVar( $oid . '.4.' . $INDEX );
+                
+                if( $sensorNames{$label} )
+                {
+                    Warn('Duplicate sensor names: ' . $label);
+                    $sensorNames{$label}++;
+                }
+                else
+                {
+                    $sensorNames{$label} = 1;
+                }
+                
+                if( $sensorNames{$label} > 1 )
+                {
+                    $label .= sprintf(' %d', $sensorNames{$label});
+                }
+                
+                my $leafName = $label;
+                $leafName =~ s/\W/_/g;
+
+                my $param = {
+                    'netbotz-sensor-index' => $INDEX,
+                    'node-display-name' => $label,
+                    'graph-title' => $label,
+                    'precedence' => sprintf('%d', 1000 - $INDEX)
+                };
+
+                if( defined( $sensor_types{$stype}{'max'} ) )
+                {
+                    my $max =
+                        $devdetails->param($sensor_types{$stype}{'max'});
+                    
+                    if( defined($max) and $max > 0 )
+                    {
+                        $param->{'upper-limit'} = $max;
+                    }
+                }
+                
+
+                $data->{'NetBotz'}{$INDEX} = {
+                    'param'    => $param,
+                    'leafName' => $leafName,
+                    'template' => $sensor_types{$stype}{'template'}};
+            }
+        }        
+    }
+    
+    if( not defined($data->{'param'}{'comment'}) or
+        length($data->{'param'}{'comment'}) == 0 )
+    {
+        $data->{'param'}{'comment'} = 'NetBotz environment sensors';
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    my $data = $devdetails->data();
+
+    foreach my $INDEX ( sort {$a<=>$b} keys %{$data->{'NetBotz'}} )
+    {
+        my $ref = $data->{'NetBotz'}{$INDEX};
+        
+        $cb->addLeaf( $devNode, $ref->{'leafName'}, $ref->{'param'},
+                      [$ref->{'template'}] );
+    }
+}
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/NetScreen.pm b/torrus/perllib/Torrus/DevDiscover/NetScreen.pm
new file mode 100644 (file)
index 0000000..9541daa
--- /dev/null
@@ -0,0 +1,152 @@
+#  Copyright (C) 2003  Shawn Ferry
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: NetScreen.pm,v 1.1 2010-12-27 00:03:50 ivan Exp $
+# Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+
+# NetScreen
+
+package Torrus::DevDiscover::NetScreen;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'NetScreen'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+our %oiddef =
+    (
+     'netscreen'         => '1.3.6.1.4.1.3224',
+     'nsResSessMaxium'   => '1.3.6.1.4.1.3224.16.3.3.0',
+     'nsIfFlowTable'     => '1.3.6.1.4.1.3224.9.3',
+
+     'nsIfMonTable'      => '1.3.6.1.4.1.3224.9.4',
+     'nsIfMonIfIdx'      => '1.3.6.1.4.1.3224.9.4.1.1',
+     );
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->checkSnmpTable( 'netscreen' ) )
+    {
+        return 0;
+    }
+
+    my $data = $devdetails->data();
+
+    $devdetails->setCap('interfaceIndexingManaged');
+    
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    $data->{'nameref'}{'ifDescr'} = '';
+    $data->{'param'}{'ifindex-map'} = '$IFIDX_MAC';
+    Torrus::DevDiscover::RFC2863_IF_MIB::retrieveMacAddresses( $dd,
+                                                               $devdetails );
+
+    # TODO: do something about these tables in buildConfig
+
+    if( $dd->checkSnmpTable( 'nsIfFlowTable' ) )
+    {
+        $devdetails->setCap('nsIfFlowTable');
+    }
+
+    if( $dd->checkSnmpTable( 'nsIfMonTable' ) )
+    {
+        $devdetails->setCap('nsIfMonTable');
+    }
+
+    if( not defined( $data->{'param'}{'snmp-oids-per-pdu'} ) )
+    {
+        my $oidsPerPDU = $devdetails->param('NetScreen::snmp-oids-per-pdu');
+        if( $oidsPerPDU == 0 )
+        {
+            $oidsPerPDU = 10;
+        }
+        Debug("Setting snmp-oids-per-pdu to $oidsPerPDU");
+        $data->{'param'}{'snmp-oids-per-pdu'} = $oidsPerPDU;
+    }
+
+    my $result = $dd->retrieveSnmpOIDs('nsResSessMaxium');
+    if( defined($result) and $result->{'nsResSessMaxium'} > 0 )
+    {
+        $devdetails->setCap('NetScreen::SessMax');
+
+        my $param = {};
+        my $max = $result->{'nsResSessMaxium'};
+
+        $param->{'hrule-value-max'} = $max;
+        $param->{'hrule-legend-max'} = 'Maximum Sessions';
+        # upper limit of graph is 5% higher than max sessions
+        $param->{'graph-upper-limit'} =
+            sprintf('%e', 
+                    ( $max * 5 / 100 ) + $max );
+        
+        $data->{'netScreenSessions'} = {
+            'param' => $param,
+        };        
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+
+    { #Allocated Sessions
+
+        my $ref = $data->{'netScreenSessions'};
+
+        $cb->addSubtree( $devNode, "NetScreen_Sessions", $ref->{'param'}, 
+            [ 'NetScreen::netscreen-sessions-stats' ] );
+
+    }
+
+    $cb->addTemplateApplication($devNode, 'NetScreen::netscreen-cpu-stats');
+    $cb->addTemplateApplication($devNode, 'NetScreen::netscreen-memory-stats');
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/OracleDatabase.pm b/torrus/perllib/Torrus/DevDiscover/OracleDatabase.pm
new file mode 100644 (file)
index 0000000..313c73e
--- /dev/null
@@ -0,0 +1,395 @@
+#  Copyright (C) 2003  Shawn Ferry
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: OracleDatabase.pm,v 1.1 2010-12-27 00:03:49 ivan Exp $
+# Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+
+# Oracle Database MIB
+
+package Torrus::DevDiscover::OracleDatabase;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'OracleDatabase'} = {
+    'sequence'     => 600,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+our %oiddef =
+    (
+     # Oracle Database
+     'oraDb'                            => '1.3.6.1.4.1.111.4.1',
+
+     'oraDbConfigDbBlockSize'           => '1.3.6.1.4.1.111.4.1.7.1.3',
+
+     'oraDbSysTable'                    => '1.3.6.1.4.1.111.4.1.1.1',
+
+     'oraDbTablespace'                  => '1.3.6.1.4.1.111.4.1.2.1',
+     'oraDbTablespaceIndex'             => '1.3.6.1.4.1.111.4.1.2.1.1',
+     'oraDbTablespaceName'              => '1.3.6.1.4.1.111.4.1.2.1.2',
+
+     'oraDbDataFile'                    => '1.3.6.1.4.1.111.4.1.3.1',
+     'oraDbDataFileIndex'               => '1.3.6.1.4.1.111.4.1.3.1.1',
+     'oraDbDataFileName'                => '1.3.6.1.4.1.111.4.1.3.1.2',
+
+     'oraDbLibraryCache'                => '1.3.6.1.4.1.111.4.1.4.1',
+     'oraDbLibraryCacheIndex'           => '1.3.6.1.4.1.111.4.1.4.1.1',
+     'oraDbLibraryCacheNameSpace'       => '1.3.6.1.4.1.111.4.1.4.1.2',
+
+     'oraDbLibraryCacheSumTable'        => '1.3.6.1.4.1.111.4.1.5.1',
+
+     'oraDbSGATable'                    => '1.3.6.1.4.1.111.4.1.6.1',
+
+     );
+
+my $DbInfoSizeUnits =
+{
+    1 => '1',                       # bytes
+    2 => '1024',                    # kbytes
+    3 => '1048576',                 # mbytes
+    4 => '1073741824',              # gbytes
+    5 => '1099511627776',           # tbytes
+};
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    return $dd->checkSnmpTable('oraDb');
+}
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    if( not defined( $data->{'param'}{'snmp-oids-per-pdu'} ) )
+    {
+        $data->{'param'}{'snmp-oids-per-pdu'} = '10';
+    }
+    
+    my $dbType = $data->{'ora'};
+
+    # my $oraTableSpaceCols = (
+    #     $dd->oiddef('oraDbTablespaceIndex'),
+    #     $dd->oiddef('oraDbTablespaceName'),
+    #     );
+
+    # my $oraTableSpace = $session->get_entries( -columns => [
+    #         $dd->oiddef('oraDbTablespaceIndex'),
+    #         $dd->oiddef('oraDbTablespaceName'),
+    #         ], );
+
+    my $oraTableSpace = $session->get_table( -baseoid =>
+                                             $dd->oiddef('oraDbTablespace'),
+                                             );
+
+
+    if( defined($oraTableSpace) )
+    {
+        $devdetails->setCap('oraTableSpace');
+        $devdetails->storeSnmpVars($oraTableSpace);
+
+    }
+
+    ##
+
+    # my @oraDbDataFileCols = (
+    #     $dd->oiddef('oraDbDataFileIndex'),
+    #     $dd->oiddef('oraDbDataFileName'),
+    #     );
+
+    # my $oraDbDataFile = $session->get_entries( -columns => [
+    #     @oraDbDataFileCols ], );
+
+    my $oraDbDataFile =
+        $session->get_table( -baseoid => $dd->oiddef('oraDbDataFile') );
+
+    if( defined($oraDbDataFile) )
+    {
+        $devdetails->setCap('oraDbDataFile');
+        $devdetails->storeSnmpVars($oraDbDataFile);
+    }
+
+    ##
+
+    # my @oraDbLibraryCacheCols = (
+    #     $dd->oiddef('oraDbLibraryCacheIndex'),
+    #     $dd->oiddef('oraDbLibraryCacheNameSpace'),
+    #     );
+
+    # my $oraDbLibraryCache = $session->get_entries( -columns => [
+    #     @oraDbLibraryCacheCols ], );
+
+    my $oraDbLibraryCache =
+        $session->get_table( -baseoid => $dd->oiddef('oraDbLibraryCache') );
+
+    if( defined($oraDbLibraryCache) )
+    {
+        $devdetails->setCap('oraDbLibraryCache');
+        $devdetails->storeSnmpVars($oraDbLibraryCache);
+    }
+
+    Debug("Looking For dbNames");
+
+    foreach my $dbName ( keys %{ $dbType } )
+    {
+        Debug("DBName: $dbName");
+
+        my $dbIndex = $dbType->{$dbName}->{'index'};
+        Debug("DBIndex: $dbIndex");
+
+        my $db = {};
+        $dbType->{$dbName} = $db;
+
+        my $oid = $dd->oiddef('oraDbConfigDbBlockSize') . '.' .  $dbIndex;
+        my $result = $session->get_request( -varbindlist => [ $oid ] );
+        
+        
+        if( $session->error_status() == 0 and $result->{$oid} > 0 )
+        {
+            my $blocksize = $result->{$oid};
+            $dbType->{$dbName}->{'dbBlockSize'} = $blocksize;
+            Debug("DB Block Size: $blocksize");
+        }
+        Debug($session->error());
+
+        if( $devdetails->hasCap('oraTableSpace') )
+        {
+            my $ref = {};
+            $db->{'oraTableSpace'} = $ref;
+
+            # Table Space
+            foreach my $tsIndex
+                ( $devdetails->
+                  getSnmpIndices( $dd->oiddef('oraDbTablespaceIndex') .
+                                  '.' . $dbIndex ) )
+            {
+                my $tsName =
+                    $devdetails->snmpVar( $dd->oiddef('oraDbTablespaceName') .
+                                          '.' . $dbIndex . '.' . $tsIndex );
+                
+                $ref->{$tsName} = $tsIndex;
+            }
+        }
+
+        if( $devdetails->hasCap('oraDbDataFile') )
+        {
+            my $ref = {};
+            $db->{'oraDbDataFile'} = $ref;
+
+            # Data File
+            foreach my $dfIndex
+                ( $devdetails->
+                  getSnmpIndices( $dd->oiddef('oraDbDataFileIndex') .
+                                  '.' . $dbIndex ) )
+            {
+                my $dfName =
+                    $devdetails->snmpVar( $dd->oiddef('oraDbDataFileName') .
+                                          '.' . $dbIndex . '.' . $dfIndex );
+
+                $ref->{$dfName} = $dfIndex;
+            }
+        }
+        
+        if( $devdetails->hasCap('oraDbLibraryCache') )
+        {
+            my $ref = {};
+            $db->{'oraDbLibraryCache'} = $ref;
+
+            # Library Cache
+            foreach my $lcIndex
+                ( $devdetails->
+                  getSnmpIndices( $dd->oiddef('oraDbLibraryCacheIndex') .
+                                  '.' . $dbIndex ) )
+            {
+                my $lcName =
+                    $devdetails->
+                    snmpVar( $dd->oiddef('oraDbLibraryCacheNameSpace') .
+                             '.' . $dbIndex . '.' . $lcIndex );
+                
+                $ref->{$lcName} = $lcIndex;
+            }
+        }
+    }
+    
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+    my $dbType = $data->{'ora'};
+
+    my $appNode = $cb->addSubtree($devNode, 'Applications' );
+    my $vendorNode = $cb->addSubtree($appNode, 'Oracle' );
+
+    foreach my $dbName ( keys %{ $dbType } )
+    {
+        my $db = $dbType->{$dbName};
+        my $dbIndex = $dbType->{$dbName}->{'index'};
+        my $dbBlockSize = $dbType->{$dbName}->{'dbBlockSize'};
+
+        my $dbNick = $dbName;
+        $dbNick =~ s/^\///;
+        $dbNick =~ s/\W/_/g;
+        $dbNick =~ s/_+/_/g;
+
+        my $dbParam = {
+            'dbName' => $dbName,
+            'precedence' => sprintf("%d", 10000 - $dbIndex),
+            'vendor' => 'Oracle',
+            'dbNick' => $dbNick,
+        };
+
+        my @dbTemplates = (
+                           'OracleDatabase::Sys',
+                           'OracleDatabase::CacheSum',
+                           'OracleDatabase::SGA',
+                           );
+
+        my $dbNode = $cb->addSubtree($vendorNode, "Vendor_Oracle_DB_$dbNick",
+                                     $dbParam, [ @dbTemplates ] );
+
+        if( $devdetails->hasCap('oraTableSpace') )
+        {
+            my $tsParam = {
+                'comment' => "Table space for $dbName",
+                'precedence' => "600",
+            };
+
+            my $tsNode = $cb->addSubtree($dbNode, 'Table_Space', $tsParam );
+
+            foreach my $tsName ( keys %{ $db->{'oraTableSpace'} } )
+            {
+                my $INDEX = $db->{'oraTableSpace'}->{$tsName};
+
+                my $nick = $tsName;
+                $nick =~ s/^\///;
+                $nick =~ s/\W/_/g;
+                $nick =~ s/_+/_/g;
+
+                my $title = '%system-id%' . " $dbName $tsName";
+
+                my $tsParam = {
+                    'comment'   => "Table Space: $tsName",
+                    'precedence' => sprintf("%d", 10000 - $INDEX),
+                    'table-space-nick' => $nick,
+                    'table-space-name' => $tsName,
+                    'graph-title' => $title,
+                    'descriptive-nickname' => $title,
+                };
+
+                $cb->addSubtree( $tsNode, $nick, $tsParam,
+                                 [ 'OracleDatabase::table-space' ] );
+                Debug("Will add TableSpace: $tsName");
+            }
+        }
+
+        if( $devdetails->hasCap('oraDbDataFile') )
+        {
+            my $dfParam = {
+                'comment' => "Data Files for $dbName",
+                'precedence' => "500",
+            };
+
+            my $dfNode = $cb->addSubtree($dbNode, 'Data_Files', $dfParam );
+
+            foreach my $dfName ( keys %{ $db->{'oraDbDataFile'} } )
+            {
+                my $INDEX = $db->{'oraDbDataFile'}->{$dfName};
+
+                my $nick = $dfName;
+                $nick =~ s/^\///;
+                $nick =~ s/\W/_/g;
+                $nick =~ s/_+/_/g;
+
+                my $title = '%system-id%' . " $dbName $dfName";
+
+
+                my $dfParam = {
+                    'comment'   => "Data File: $dfName",
+                    'precedence' => sprintf("%d", 10000 - $INDEX),
+                    'data-file-nick' => $nick,
+                    'data-file-name' => $dfName,
+                    'graph-title' => $title,
+                    'dbBlockSize' => $dbBlockSize,
+                };
+
+                $cb->addSubtree( $dfNode, $nick, $dfParam,
+                                 ['OracleDatabase::data-file' ] );
+                Debug("Will add DataFile: $dfName");
+            }
+        }
+
+        if( $devdetails->hasCap('oraDbLibraryCache') )
+        {
+            my $lcParam = {
+                'comment' => "Library Cache for $dbName",
+                'precedence' => "400",
+            };
+
+            my $lcNode = $cb->addSubtree($dbNode, 'Library_Cache', $lcParam );
+
+            foreach my $lcName ( keys %{ $db->{'oraDbLibraryCache'} } )
+            {
+                my $INDEX = $db->{'oraDbLibraryCache'}->{$lcName};
+
+                my $nick = $lcName;
+                $nick =~ s/^\///;
+                $nick =~ s/\W/_/g;
+                $nick =~ s/_+/_/g;
+
+                my $title = '%system-id%' . " $dbName $lcName";
+
+                my $lcParam = {
+                    'comment'   => "Library Cache: $lcName",
+                    'precedence' => sprintf("%d", 10000 - $INDEX),
+                    'library-cache-nick' => $nick,
+                    'library-cache-name' => $lcName,
+                    'graph-title' => $title,
+                };
+
+                $cb->addSubtree( $lcNode, $nick, $lcParam,
+                                 ['OracleDatabase::library-cache'] );
+                Debug("Will add LibraryCache: $lcName");
+            }
+        }
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/Paradyne.pm b/torrus/perllib/Torrus/DevDiscover/Paradyne.pm
new file mode 100644 (file)
index 0000000..5e45f17
--- /dev/null
@@ -0,0 +1,200 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Paradyne.pm,v 1.1 2010-12-27 00:03:48 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Paradyne devices discovery
+# A typical Paradyne device has several slots, and all slots are managed
+# through the same IP address, with different community strings.
+# That's why you have to configure "Paradyne::slot-name" parameter
+# in your discovery file, uniquely for each slot. A slot name should
+# not contain special characters.
+
+
+# Tested with:
+#
+#   - Paradyne GranDSLAM 2.0 DSLAM - Hotwire DSL;
+#     Model: 8000-B2-211; S/W Release : M04.02.27
+#
+#   - Paradyne Hotwire ATM ADSL Line Card;
+#     Model: 8365-B1-000; S/W Release: 02.03.54
+#
+#   - Paradyne Hotwire ATM G.SHDSL Line Card;
+#     Model: 8385-B1-000; S/W Release: 02.03.45
+#
+#   - Hotwire IP ReachDSL Line Card;
+#     Model: 8314-B3-000; S/W Release: 04.03.10
+
+
+package Torrus::DevDiscover::Paradyne;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'Paradyne'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # PDN-HEADER-MIB
+     'paradyne-products'                    => '1.3.6.1.4.1.1795.1.14',
+     'xdslDevIfStatsElapsedTimeLinkUp'      =>
+     '1.3.6.1.4.1.1795.2.24.2.6.8.1.1.1.1.4'
+     );
+
+our $statsInterval;
+if( not defined $statsInterval )
+{
+    $statsInterval = 6; # current15Minutes (GORD)
+}
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'paradyne-products',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+
+    if( length( $devdetails->param('Paradyne::slot-name') ) == 0 )
+    {
+        Error('Mandatory discovery parameter "Paradyne::slot-number" ' .
+              'is not defined for a Paradyne device: ' .
+              $devdetails->param('snmp-host') . ':' .
+              $devdetails->param('snmp-port') . ':' .
+              $devdetails->param('snmp-community'));
+        return 0;
+    }
+    
+    $devdetails->setCap('interfaceIndexingManaged');
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+
+    $data->{'nameref'}{'ifReferenceName'} = 'ifName';
+    $data->{'nameref'}{'ifSubtreeName'} = 'ifNameT';
+    $data->{'param'}{'ifindex-table'} = '$ifName';
+    $data->{'nameref'}{'ifNick'} = 'ParadyneIfNick';
+
+    $data->{'nameref'}{'ifComment'} = 'ifDescr';
+
+    if( not defined( $data->{'param'}{'snmp-oids-per-pdu'} ) )
+    {
+        $data->{'param'}{'snmp-oids-per-pdu'} = '10';
+    }
+    
+    my $slot = $devdetails->param('Paradyne::slot-name');    
+    foreach my $ifIndex ( keys %{$data->{'interfaces'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+        $interface->{'ParadyneIfNick'} =
+            $slot . '_' . $interface->{'ifNameT'};
+    }
+    
+    my $xdslOID = $dd->oiddef('xdslDevIfStatsElapsedTimeLinkUp');
+
+    my $xdslTable = $session->get_table( -baseoid => $xdslOID );
+    if( defined $xdslTable )
+    {
+        $devdetails->storeSnmpVars( $xdslTable );
+        $devdetails->setCap('paradyneXDSL');
+
+        foreach my $ifIndex ( keys %{$data->{'interfaces'}} )
+        {
+            if( $devdetails->hasOID( $xdslOID .'.'. $ifIndex .'.'.
+                                     $statsInterval ) )
+            {
+                push( @{$data->{'paradyneXDSLInterfaces'}}, $ifIndex );
+            }
+        }
+    }
+
+    return 1;
+}
+
+
+# Nothing really to do yet
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    if( $devdetails->hasCap('paradyneXDSL') )
+    {
+        my $subtreeName = 'XDSL_Line_Stats';
+
+        my $param = {
+            'precedence'           => '-600',
+            'comment'              => 'Paradyne XDSL line statistics',
+            'xdsl-stats-interval'  => $statsInterval
+            };
+        my $subtreeNode = $cb->addSubtree( $devNode, $subtreeName, $param );
+
+        my $data = $devdetails->data();
+
+        foreach my $ifIndex
+            ( sort {$a<=>$b} @{$data->{'paradyneXDSLInterfaces'}} )
+        {
+            my $interface = $data->{'interfaces'}{$ifIndex};
+
+            my $ifSubtreeName =
+                $interface->{$data->{'nameref'}{'ifSubtreeName'}};
+
+            my $templates = ['Paradyne::paradyne-xdsl-interface'];
+
+            my $param = {
+                'interface-name' => $interface->{'param'}{'interface-name'},
+                'interface-nick' => $interface->{'param'}{'interface-nick'},
+                'comment'        => $interface->{'param'}{'comment'}
+            };
+
+            $cb->addSubtree( $subtreeNode, $ifSubtreeName,
+                             $param, $templates );
+        }
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/RFC1628_UPS_MIB.pm b/torrus/perllib/Torrus/DevDiscover/RFC1628_UPS_MIB.pm
new file mode 100644 (file)
index 0000000..890843f
--- /dev/null
@@ -0,0 +1,180 @@
+#  Copyright (C) 2008  Jon Nistor
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: RFC1628_UPS_MIB.pm,v 1.1 2010-12-27 00:03:56 ivan Exp $
+# Jon Nistor <nistor at snickers dot org>
+
+# Discovery module for UPS-MIB (RFC 1628)
+#
+# Tested with:
+#     ConnectUPS Web/SNMP Card V4.20 [powerware 9390]
+#
+# Issues with:
+#     ConnectUPS Web/SNMP Card V3.16 [powerware 9155]
+#      - InputFrequency and InputTruePower are missing from RFC UPS-MIB
+#
+
+package Torrus::DevDiscover::RFC1628_UPS_MIB;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'RFC1628_UPS_MIB'} = {
+    'sequence'     => 100,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # UPS-MIB
+     'upsIdent'                     => '1.3.6.1.2.1.33.1.1',
+     'upsIdentManufacturer'         => '1.3.6.1.2.1.33.1.1.1.0',
+     'upsIdentModel'                => '1.3.6.1.2.1.33.1.1.2.0',
+     'upsIdentUPSSoftwareVersion'   => '1.3.6.1.2.1.33.1.1.3.0',
+     'upsIdentAgentSoftwareVersion' => '1.3.6.1.2.1.33.1.1.4.0',
+     'upsIdentName'                 => '1.3.6.1.2.1.33.1.1.5.0',
+
+     'upsInputNumLines'             => '1.3.6.1.2.1.33.1.3.2.0',
+     'upsOutputNumLines'            => '1.3.6.1.2.1.33.1.4.3.0',
+     'upsBypassNumLines'            => '1.3.6.1.2.1.33.1.5.2.0'
+     );
+
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    return $dd->checkSnmpTable( 'upsIdent' );
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+
+    my $upsInfo = $dd->retrieveSnmpOIDs('upsIdentManufacturer',
+                  'upsIdentModel', 'upsIdentUPSSoftwareVersion',
+                  'upsIdentAgentSoftwareVersion', 'upsIdentName',
+                  'upsInputNumLines', 'upsOutputNumLines', 'upsBypassNumLines');
+
+    $data->{'param'}{'comment'} = $upsInfo->{'upsIdentManufacturer'} . " " .
+                            $upsInfo->{'upsIdentModel'} . " " . 
+                            $upsInfo->{'upsIdentUPSSoftwareVersion'};
+
+    # PROG: Discover number of lines (in,out,bypass)...
+    $data->{'numInput'}  = $upsInfo->{'upsInputNumLines'};
+    $data->{'numOutput'} = $upsInfo->{'upsOutputNumLines'};
+    $data->{'numBypass'} = $upsInfo->{'upsBypassNumLines'};
+
+    Debug("UPS Lines  Input: " . $data->{'numInput'} .
+                  ", Output: " . $data->{'numOutput'} .
+                  ", Bypass: " . $data->{'numBypass'} );
+
+    if( $devdetails->param('RFC1628_UPS::disable-input') ne 'yes' )
+    {
+        $devdetails->setCap('UPS-input');
+    }
+
+    if( $devdetails->param('RFC1628_UPS::disable-output') ne 'yes' )
+    {
+        $devdetails->setCap('UPS-output');
+    }
+
+    if( $devdetails->param('RFC1628_UPS::disable-bypass') ne 'yes' )
+    {
+        $devdetails->setCap('UPS-bypass');
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+    # PROG: Add static battery information
+    $cb->addSubtree( $devNode, 'Battery',
+                   { 'precedence' => 999 },
+                   [ 'RFC1628_UPS_MIB::battery-subtree' ] );
+    
+    if( $devdetails->hasCap('UPS-input') )
+    {
+        my $nodeInput = $cb->addSubtree( $devNode, 'Input',
+                                  { 'comment' => 'Input feeds' },
+                                  [ 'RFC1628_UPS_MIB::ups-input-subtree' ] );
+
+        foreach my $INDEX ( 1 .. $data->{'numInput'} )
+        {
+            $cb->addSubtree( $nodeInput, sprintf('Phase_%d', $INDEX),
+                             { 'ups-input-idx' => $INDEX },
+                             [ 'RFC1628_UPS::ups-input-leaf' ] );
+        }
+    }
+
+    if( $devdetails->hasCap('UPS-output') )
+    {
+        my $nodeOutput = $cb->addSubtree( $devNode, 'Output',
+                                   { 'comment' => 'Output feeds' },
+                                   [ 'RFC1628_UPS_MIB::ups-output-subtree' ] );
+
+        foreach my $INDEX ( 1 .. $data->{'numOutput'} )
+        {
+            $cb->addSubtree( $nodeOutput, sprintf('Phase_%d', $INDEX),
+                             { 'ups-output-idx' => $INDEX },
+                             [ 'RFC1628_UPS::ups-output-leaf' ] );
+        }
+    }
+
+    if( $devdetails->hasCap('UPS-bypass') )
+    {
+        my $nodeBypass = $cb->addSubtree( $devNode, 'Bypass',
+                                   { 'comment' => 'Bypass feeds' },
+                                   [ 'RFC1628_UPS_MIB::ups-bypass-subtree' ] );
+
+        foreach my $INDEX ( 1 .. $data->{'numBypass'} )
+        {
+            $cb->addSubtree( $nodeBypass, sprintf('Phase_%d', $INDEX),
+                             { 'ups-bypass-idx' => $INDEX },
+                             [ 'RFC1628_UPS::ups-bypass-leaf' ] );
+        }
+    }
+
+}
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/RFC1657_BGP4_MIB.pm b/torrus/perllib/Torrus/DevDiscover/RFC1657_BGP4_MIB.pm
new file mode 100644 (file)
index 0000000..c0a8039
--- /dev/null
@@ -0,0 +1,85 @@
+#  Copyright (C) 2005  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: RFC1657_BGP4_MIB.pm,v 1.1 2010-12-27 00:03:54 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Discovery module for BGP4-MIB (RFC 1657)
+# This module does not generate any XML, but provides information
+# for other discovery modules. For the sake of discovery time and traffic,
+# it is not implicitly executed during the normal discovery process.
+
+package Torrus::DevDiscover::RFC1657_BGP4_MIB;
+
+use strict;
+use Torrus::Log;
+
+
+our %oiddef =
+    (
+     # BGP4-MIB
+     'bgpPeerRemoteAs'       => '1.3.6.1.2.1.15.3.1.9',
+     );
+
+
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+
+    my $table = $session->get_table( -baseoid =>
+                                     $dd->oiddef('bgpPeerRemoteAs'));
+    
+    if( not defined( $table ) or scalar( %{$table} ) == 0 )
+    {
+        return 0;
+    }
+    
+    $devdetails->storeSnmpVars( $table );
+    $devdetails->setCap('bgpPeerTable');
+
+
+    foreach my $INDEX
+        ( $devdetails->
+          getSnmpIndices( $dd->oiddef('bgpPeerRemoteAs') ) )
+    {
+        my $ipAddr = $INDEX;
+
+        my $asNum =
+            $devdetails->snmpVar($dd->oiddef('bgpPeerRemoteAs') .
+                                 '.' . $INDEX);
+
+        $data->{'bgpPeerAS'}{$ipAddr} = $asNum;
+    }
+                            
+    return 1;
+}
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/RFC1697_RDBMS.pm b/torrus/perllib/Torrus/DevDiscover/RFC1697_RDBMS.pm
new file mode 100644 (file)
index 0000000..56d348f
--- /dev/null
@@ -0,0 +1,241 @@
+#  Copyright (C) 2003  Shawn Ferry
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: RFC1697_RDBMS.pm,v 1.1 2010-12-27 00:03:52 ivan Exp $
+# Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+
+# RDBMS MIB
+
+package Torrus::DevDiscover::RFC1697_RDBMS;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'RFC1697_RDBMS'} = {
+    'sequence'     => 100,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+our %oiddef =
+    (
+     # RDBMS-MIB
+     'rdbms'                            => '1.3.6.1.2.1.39',
+
+     'rdbmsDbTable'                     => '1.3.6.1.2.1.39.1.1.1',
+     'rdbmsDbIndex'                     => '1.3.6.1.2.1.39.1.1.1.1',
+     'rdbmsDbVendorName'                => '1.3.6.1.2.1.39.1.1.1.3',
+     'rdbmsDbName'                      => '1.3.6.1.2.1.39.1.1.1.4',
+     'rdbmsDbContact'                   => '1.3.6.1.2.1.39.1.1.1.5',
+     'rdbmsDbPrivateMIBOID'             => '1.3.6.1.2.1.39.1.1.1.2',
+
+     'rdbmsDbInfoTable'                 => '1.3.6.1.2.1.39.1.2.1',
+     'rdbmsDbInfoProductName'           => '1.3.6.1.2.1.39.1.2.1.1',
+     'rdbmsDbInfoVersion'               => '1.3.6.1.2.1.39.1.2.1.2',
+     'rdbmsDbInfoSizeUnits'             => '1.3.6.1.2.1.39.1.2.1.3',
+
+     # currently ignored, generally identical to rdbmsDb for oracle
+     'rdbmsSrvTable'                    => '1.3.6.1.2.1.39.1.5.1',
+     'rdbmsSrvVendorName'               => '1.3.6.1.2.1.39.1.5.1.2',
+     'rdbmsSrvProductName'              => '1.3.6.1.2.1.39.1.5.1.3',
+     'rdbmsSrvContact'                  => '1.3.6.1.2.1.39.1.5.1.4',
+     'rdbmsSrvPrivateMIBOID'            => '1.3.6.1.2.1.39.1.5.1.1',
+
+     # Oracle MIB base
+     'ora'                              => '1.3.6.1.4.1.111',
+
+     );
+
+
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    return $dd->checkSnmpTable('rdbms');
+}
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    my $DbInfoSizeUnits = {
+        1 => '1',                       # bytes
+        2 => '1024',                    # kbytes
+        3 => '1048576',                 # mbytes
+        4 => '1073741824',              # gbytes
+        5 => '1099511627776',           # tbytes
+    };
+
+    my $dbTypes = {
+        ora => $dd->oiddef('ora'),
+    };
+
+
+    my $rdbmsDbTable = $session->get_table( -baseoid =>
+                                            $dd->oiddef('rdbmsDbTable') );
+
+    my $rdbmsDbInfoTable =
+        $session->get_table( -baseoid =>
+                             $dd->oiddef('rdbmsDbInfoTable') );
+
+    if( defined( $rdbmsDbTable ) )
+    {
+        $devdetails->storeSnmpVars($rdbmsDbTable);
+        $devdetails->setCap('RDBMS::DbTable');
+
+        if( defined( $rdbmsDbInfoTable ) )
+        {
+            $devdetails->storeSnmpVars($rdbmsDbInfoTable);
+            $devdetails->setCap('RDBMS::DbInfoTable');
+        }
+        else
+        {
+            Debug("No Actively Opened Instances");
+        }
+
+        my $ref = {};
+        $ref->{'indices'} = [];
+        $data->{'DbTable'} = $ref;
+
+        foreach my $INDEX
+            ( $devdetails->getSnmpIndices( $dd->oiddef('rdbmsDbIndex') ) )
+        {
+            
+            push( @{$ref->{'indices'}}, $INDEX );
+            
+            my $vendor =
+                $devdetails->snmpVar( $dd->oiddef('rdbmsDbVendorName') .
+                                      '.' . $INDEX );
+
+            my $product =
+                $devdetails->snmpVar( $dd->oiddef('rdbmsDbInfoProductName') .
+                                      '.' . $INDEX );
+
+            my $version =
+                $devdetails->snmpVar( $dd->oiddef('rdbmsDbInfoVersion') .
+                                      '.' . $INDEX );
+
+            my $sizeUnits =
+                $devdetails->snmpVar( $dd->oiddef('rdbmsDbInfoSizeUnits') .
+                                      '.' . $INDEX );
+            $sizeUnits = $DbInfoSizeUnits->{$sizeUnits};
+
+            my $dbName =
+                $devdetails->snmpVar( $dd->oiddef('rdbmsDbName') .
+                                      '.' . $INDEX );
+
+            my $dbContact =
+                $devdetails->snmpVar( $dd->oiddef('rdbmsDbContact') .
+                                      '.' . $INDEX );
+
+            my $dbMIBOID =
+                $devdetails->snmpVar( $dd->oiddef('rdbmsDbPrivateMIBOID')
+                                      . '.' . $INDEX );
+
+            my $nick = "Vendor_" . $vendor . "_DB_" . $dbName;
+            $nick =~ s/^\///;
+            $nick =~ s/\W/_/g;
+            $nick =~ s/_+/_/g; 
+
+            my $descr = "Vendor: $vendor DB: $dbName";
+            $descr .= " Contact: $dbContact" if $dbContact;
+            $descr .= " Version: $version" if $version;
+
+            my $param = {};
+            $ref->{$INDEX}->{'param'} = $param;
+            $param->{'vendor'} = $vendor;
+            $param->{'product'} = $product;
+            $param->{'dbVersion'} = $version;
+            $param->{'dbSizeUnits'} = $sizeUnits;
+            $param->{'dbName'} = $dbName;
+            $param->{'dbMIBOID'} = $dbMIBOID;
+            $param->{'nick'} = $nick;
+            $param->{'comment'} = $descr;
+            $param->{'precedence'} = 1000 - $INDEX;
+
+            foreach my $dbType ( keys %{ $dbTypes } )
+            {
+                if( Net::SNMP::oid_base_match
+                    ( $dbTypes->{$dbType}, $dbMIBOID ) )
+                {
+                    if( not exists $data->{$dbType} )
+                    {
+                        $data->{$dbType} = {};
+                    }
+                    $data->{$dbType}->{$dbName}->{'index'} = $INDEX;
+                    Debug(" Added $dbName -> $INDEX to $dbType ");
+                    last;
+                }
+            }
+
+        }
+
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+    return unless $devdetails->isDevType("RDBMS");
+
+    my $appParam = {
+        'precedence'    =>  -100000,
+    };
+
+    my $appNode = $cb->addSubtree( $devNode, 'Applications', $appParam );
+
+    my $param = { };
+    my $oraNode = $cb->addSubtree( $appNode, 'Oracle', $param );
+
+    if( $devdetails->hasCap('RDBMS::DbTable') )
+    {
+        my $ref = $data->{'DbTable'};
+
+        foreach my $INDEX ( @{ $ref->{'indices'} } )
+        {
+            my $param = $ref->{$INDEX}->{'param'};
+            $cb->addSubtree( $oraNode, $param->{'nick'}, $param,
+                             [ 'RFC1697_RDBMS::rdbms-dbtable' ], );
+        }
+
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/RFC2011_IP_MIB.pm b/torrus/perllib/Torrus/DevDiscover/RFC2011_IP_MIB.pm
new file mode 100644 (file)
index 0000000..c7745b5
--- /dev/null
@@ -0,0 +1,94 @@
+#  Copyright (C) 2005  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: RFC2011_IP_MIB.pm,v 1.1 2010-12-27 00:03:56 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Discovery module for IP-MIB (RFC 2011)
+# This module does not generate any XML, but provides information
+# for other discovery modules. For the sake of discovery time and traffic,
+# it is not implicitly executed during the normal discovery process.
+
+package Torrus::DevDiscover::RFC2011_IP_MIB;
+
+use strict;
+use Torrus::Log;
+
+
+our %oiddef =
+    (
+     # IP-MIB
+     'ipNetToMediaTable'       => '1.3.6.1.2.1.4.22',
+     'ipNetToMediaPhysAddress' => '1.3.6.1.2.1.4.22.1.2',
+     );
+
+
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+
+    my $table = $session->get_table( -baseoid =>
+                                     $dd->oiddef('ipNetToMediaPhysAddress'));
+    
+    if( not defined( $table ) or scalar( %{$table} ) == 0 )
+    {
+        return 0;
+    }
+    
+    $devdetails->storeSnmpVars( $table );
+
+    foreach my $INDEX
+        ( $devdetails->
+          getSnmpIndices( $dd->oiddef('ipNetToMediaPhysAddress') ) )
+    {
+        my( $ifIndex, @ipAddrOctets ) = split( '\.', $INDEX );
+        my $ipAddr = join('.', @ipAddrOctets);
+
+        my $interface = $data->{'interfaces'}{$ifIndex};
+        next if not defined( $interface );
+
+        my $phyAddr =
+            $devdetails->snmpVar($dd->oiddef('ipNetToMediaPhysAddress') .
+                                 '.' . $INDEX);
+
+        $interface->{'ipNetToMedia'}{$ipAddr} = $phyAddr;
+        $interface->{'mediaToIpNet'}{$phyAddr} = $ipAddr;
+
+        # Cisco routers assign ARP to subinterfaces, but MAC accounting
+        # to main interfaces. Let them search in a global table
+        $data->{'ipNetToMedia'}{$ipAddr} = $phyAddr;
+        $data->{'mediaToIpNet'}{$phyAddr} = $ipAddr;
+    }
+                            
+    return 1;
+}
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/RFC2662_ADSL_LINE.pm b/torrus/perllib/Torrus/DevDiscover/RFC2662_ADSL_LINE.pm
new file mode 100644 (file)
index 0000000..1c69714
--- /dev/null
@@ -0,0 +1,140 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: RFC2662_ADSL_LINE.pm,v 1.1 2010-12-27 00:03:53 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# ADSL Line statistics.
+
+# We assume that adslAturPhysTable is always present when adslAtucPhysTable
+# is there. Probably that's wrong, and needs to be redesigned.
+
+package Torrus::DevDiscover::RFC2662_ADSL_LINE;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'RFC2662_ADSL_LINE'} = {
+    'sequence'     => 100,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # ADSL-LINE-MIB
+     'adslAtucPhysTable'  => '1.3.6.1.2.1.10.94.1.1.2',
+     'adslAtucCurrSnrMgn' => '1.3.6.1.2.1.10.94.1.1.2.1.4',
+     'adslAturPhysTable' => '1.3.6.1.2.1.10.94.1.1.3'
+     );
+
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    my $atucTable =
+        $session->get_table( -baseoid => $dd->oiddef('adslAtucPhysTable') );
+    if( not defined $atucTable )
+    {
+        return 0;
+    }
+    $devdetails->storeSnmpVars( $atucTable );
+
+    ## Do we need to check adslAtucPhysTable ? ##
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+
+    $data->{'adslAtucPhysTable'} = [];
+
+    foreach my $ifIndex ( keys %{$data->{'interfaces'}} )
+    {
+        if( $devdetails->hasOID( $dd->oiddef('adslAtucCurrSnrMgn') .
+                                 '.' . $ifIndex ) )
+        {
+            push( @{$data->{'adslAtucPhysTable'}}, $ifIndex );
+        }
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    # Build SNR subtree
+    my $subtreeName = 'ADSL_Line_Stats';
+
+    my $param = {
+        'precedence'         => '-600',
+        'comment'            => 'ADSL line statistics'
+        };
+    my $subtreeNode = $cb->addSubtree( $devNode, $subtreeName, $param );
+
+    my $data = $devdetails->data();
+
+    foreach my $ifIndex ( sort {$a<=>$b} @{$data->{'adslAtucPhysTable'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+
+        my $ifSubtreeName = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
+
+        my $templates = ['RFC2662_ADSL_LINE::adsl-line-interface'];
+
+        my $param = {
+            'interface-name' => $interface->{'param'}{'interface-name'},
+            'interface-nick' => $interface->{'param'}{'interface-nick'},
+            'collector-timeoffset-hashstring' =>'%system-id%:%interface-nick%',
+            'comment'        => $interface->{'param'}{'comment'}
+        };
+        
+        $param->{'node-display-name'} =
+            $interface->{$data->{'nameref'}{'ifReferenceName'}};
+        
+        $cb->addSubtree( $subtreeNode, $ifSubtreeName, $param, $templates );
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/RFC2670_DOCS_IF.pm b/torrus/perllib/Torrus/DevDiscover/RFC2670_DOCS_IF.pm
new file mode 100644 (file)
index 0000000..91e30a5
--- /dev/null
@@ -0,0 +1,307 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: RFC2670_DOCS_IF.pm,v 1.1 2010-12-27 00:03:55 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# DOCSIS interface statistics
+
+package Torrus::DevDiscover::RFC2670_DOCS_IF;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'RFC2670_DOCS_IF'} = {
+    'sequence'     => 100,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+$Torrus::DevDiscover::RFC2863_IF_MIB::knownSelectorActions{
+    'DocsisUpSNRMonitor'} = 'RFC2670_DOCS_IF';
+$Torrus::DevDiscover::RFC2863_IF_MIB::knownSelectorActions{
+    'DocsisUpSNRTokenset'} = 'RFC2670_DOCS_IF';
+
+$Torrus::DevDiscover::RFC2863_IF_MIB::knownSelectorActions{
+    'DocsisUpFECCorMonitor'} = 'RFC2670_DOCS_IF';
+$Torrus::DevDiscover::RFC2863_IF_MIB::knownSelectorActions{
+    'DocsisUpFECUncorMonitor'} = 'RFC2670_DOCS_IF';
+
+$Torrus::DevDiscover::RFC2863_IF_MIB::knownSelectorActions{
+    'DocsisDownUtilMonitor'} = 'RFC2670_DOCS_IF';
+
+
+our %oiddef =
+    (
+     # DOCS-IF-MIB
+     'docsIfDownstreamChannelTable' => '1.3.6.1.2.1.10.127.1.1.1',
+     'docsIfCmtsDownChannelCounterTable' => '1.3.6.1.2.1.10.127.1.3.10',
+     'docsIfSigQSignalNoise' => '1.3.6.1.2.1.10.127.1.1.4.1.5',
+     );
+
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    if( $dd->checkSnmpTable( 'docsIfDownstreamChannelTable' ) )
+    {
+        return 1;
+    }
+
+    return 0;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+
+    if( $dd->checkSnmpTable( 'docsIfCmtsDownChannelCounterTable' ) )
+    {
+        $devdetails->setCap('docsDownstreamUtil');
+    }
+
+    my $snrTable =
+        $session->get_table( -baseoid =>
+                             $dd->oiddef('docsIfSigQSignalNoise') );
+    if( defined( $snrTable ) )
+    {
+        $devdetails->storeSnmpVars( $snrTable );
+    }
+    
+    $data->{'docsCableMaclayer'} = [];
+    $data->{'docsCableDownstream'} = [];
+    $data->{'docsCableUpstream'} = [];
+
+    foreach my $ifIndex ( sort {$a<=>$b} keys %{$data->{'interfaces'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+        my $ifType = $interface->{'ifType'};
+
+        $interface->{'docsTemplates'} = [];
+        $interface->{'docsParams'} = {};
+
+        if( $devdetails->hasCap('interfaceIndexingPersistent') )
+        {
+            $interface->{'docsParams'}{'interface-index'} = $ifIndex;
+        }
+        
+        if( $ifType == 127 )
+        {
+            push( @{$data->{'docsCableMaclayer'}}, $ifIndex );
+        }
+        elsif(  $ifType == 128 )
+        {
+            push( @{$data->{'docsCableDownstream'}}, $ifIndex );
+            if( $devdetails->hasCap('docsDownstreamUtil') )
+            {
+                push( @{$interface->{'docsTemplates'}},
+                      'RFC2670_DOCS_IF::docsis-downstream-util' );
+            }
+        }
+        elsif( $ifType == 129 or $ifType == 205 )
+        {
+            if( $devdetails->hasOID( $dd->oiddef('docsIfSigQSignalNoise') .
+                                     '.' . $ifIndex ) )
+            {
+                push( @{$data->{'docsCableUpstream'}}, $ifIndex );
+                push( @{$interface->{'docsTemplates'}},
+                      'RFC2670_DOCS_IF::docsis-upstream-stats' );
+                
+            }
+        }
+    }
+    
+    if( $devdetails->param('RFC2670_DOCS_IF::upstreams-only') eq 'yes' )
+    {
+        $data->{'docsCableMaclayer'} = [];
+        $data->{'docsCableDownstream'} = [];
+    }
+
+    $data->{'docsConfig'} = {
+        'docsCableMaclayer' => {
+            'subtreeName' => 'Docsis_MAC_Layer',
+            'nodeidCategory' => 'docsmac',
+            'templates' => [],
+            'param' => {
+                'node-display-name' => 'DOCSIS MAC Layer',
+            },            
+        },
+        'docsCableDownstream' => {
+            'subtreeName' => 'Docsis_Downstream',
+            'nodeidCategory' => 'docsds',
+            'templates' => [],
+            'param' => {
+                'node-display-name' => 'DOCSIS Downstream',
+            },            
+        },
+        'docsCableUpstream' => {
+            'subtreeName' => 'Docsis_Upstream',
+            'nodeidCategory' => 'docsus',
+            'templates' => ['RFC2670_DOCS_IF::docsis-upstream-subtree'],
+            'param' => {
+                'node-display-name' => 'DOCSIS Upstream',
+            },            
+        },
+    };
+
+    if( $devdetails->hasCap('docsDownstreamUtil') )
+    {
+        push( @{$data->{'docsConfig'}{'docsCableDownstream'}{'templates'}},
+              'RFC2670_DOCS_IF::docsis-downstream-subtree' );        
+    }
+    
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    my $data = $devdetails->data();
+
+    foreach my $category ( sort keys %{$data->{'docsConfig'}} )
+    {
+        if( scalar( @{$data->{$category}} ) > 0 and
+            scalar( @{$data->{'docsConfig'}{$category}{'templates'}} ) > 0 )
+        {
+            # Count non-excluded interfaces
+            my $updatedInterfaceList = [];
+            foreach my $ifIndex ( @{$data->{$category}} )
+            {
+                my $interface = $data->{'interfaces'}{$ifIndex};
+                next if $interface->{'excluded'};
+                push( @{$updatedInterfaceList}, $ifIndex );
+            }
+            $data->{$category} = $updatedInterfaceList;
+            
+            next if scalar( @{$data->{$category}} ) == 0;
+
+            my $subtreeNode =
+                $cb->addSubtree( $devNode,
+                                 $data->{'docsConfig'}{$category}{
+                                     'subtreeName'},
+                                 $data->{'docsConfig'}{$category}{
+                                     'param'},
+                                 $data->{'docsConfig'}{$category}{
+                                     'templates'});
+
+            foreach my $ifIndex ( @{$data->{$category}} )
+            {
+                my $interface = $data->{'interfaces'}{$ifIndex};
+
+                my $param = $interface->{'docsParams'};
+
+                $param->{'searchable'} = 'yes';
+
+                # Copy some parameters from IF-MIB discovery results
+                
+                foreach my $p ('interface-name', 'interface-nick',
+                               'node-display-name', 'comment')
+                {
+                    $param->{$p} = $interface->{'param'}{$p};
+                }
+                
+                $param->{'nodeid-docsif'} =
+                    $data->{'docsConfig'}{$category}{'nodeidCategory'} .
+                    '//%nodeid-device%//' .
+                    $interface->{$data->{'nameref'}{'ifNodeid'}};
+                
+                $param->{'nodeid'} = '%nodeid-docsif%';
+                
+                my $intfNode = $cb->addSubtree
+                    ( $subtreeNode,
+                      $interface->{$data->{'nameref'}{'ifSubtreeName'}},
+                      $param, 
+                      $interface->{'docsTemplates'} );
+
+                # Apply selector actions
+                if( $category eq 'docsCableUpstream' )
+                {
+                    my $monitor =
+                        $interface->{'selectorActions'}{'DocsisUpSNRMonitor'};
+                    my $tset =
+                        $interface->{'selectorActions'}{'DocsisUpSNRTokenset'};
+                    if( defined( $monitor ) or defined( $tset ) )
+                    {
+                        my $param = {};
+                        if( defined( $monitor ) )
+                        {
+                            $param->{'monitor'} = $monitor;
+                        }
+                        if( defined( $tset ) )
+                        {
+                            $param->{'tokenset-member'} = $tset;
+                        }
+                        $cb->addLeaf( $intfNode, 'SNR', $param );
+                    }
+
+                    $monitor = $interface->{'selectorActions'}{
+                        'DocsisUpFECCorMonitor'};
+                    if( defined( $monitor ) )
+                    {
+                        $cb->addLeaf( $intfNode, 'Correctable',
+                                      {'monitor' => $monitor } );
+                    }
+
+                    $monitor = $interface->{'selectorActions'}{
+                        'DocsisUpFECUncorMonitor'};
+                    if( defined( $monitor ) )
+                    {
+                        $cb->addLeaf( $intfNode, 'Uncorrectable',
+                                      {'monitor' => $monitor } );
+                    }                                        
+                }
+                elsif( $category eq 'docsCableDownstream')
+                {
+                    my $monitor = $interface->{'selectorActions'}{
+                        'DocsisDownUtilMonitor'};
+                    if( defined( $monitor ) )
+                    {
+                        $cb->addLeaf( $intfNode, 'UsedBytes',
+                                      {'monitor' => $monitor } );
+                    }
+                }
+            }
+        }
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/RFC2737_ENTITY_MIB.pm b/torrus/perllib/Torrus/DevDiscover/RFC2737_ENTITY_MIB.pm
new file mode 100644 (file)
index 0000000..596152f
--- /dev/null
@@ -0,0 +1,152 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: RFC2737_ENTITY_MIB.pm,v 1.1 2010-12-27 00:03:56 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Discovery module for ENTITY-MIB (RFC 2737)
+# This module does not generate any XML, but provides information
+# for other discovery modules
+
+package Torrus::DevDiscover::RFC2737_ENTITY_MIB;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'RFC2737_ENTITY_MIB'} = {
+    'sequence'     => 100,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # ENTITY-MIB
+     'entPhysicalDescr'        => '1.3.6.1.2.1.47.1.1.1.1.2',
+     'entPhysicalContainedIn'  => '1.3.6.1.2.1.47.1.1.1.1.4',
+     'entPhysicalName'         => '1.3.6.1.2.1.47.1.1.1.1.7'
+     );
+
+
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    my $descrTable =
+        $session->get_table( -baseoid =>
+                             $dd->oiddef('entPhysicalDescr') );
+    if( defined $descrTable )
+    {
+        $devdetails->storeSnmpVars( $descrTable );
+    }
+
+    my $nameTable =
+        $session->get_table( -baseoid =>
+                             $dd->oiddef('entPhysicalName') );
+    if( defined $nameTable )
+    {
+        $devdetails->storeSnmpVars( $nameTable );
+    }
+
+    return( defined($descrTable) or defined($nameTable) );
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+
+    $data->{'entityPhysical'} = {};
+
+    my $chassisIndex = 0;
+    my $oidContainedIn = $dd->oiddef('entPhysicalContainedIn');
+
+    foreach my $phyIndex
+        ( $devdetails->getSnmpIndices($dd->oiddef('entPhysicalDescr')) )
+    {
+        my $ref = {};
+        $data->{'entityPhysical'}{$phyIndex} = $ref;
+
+        # Find the chassis. It is not contained in anything.
+        if( not $chassisIndex )
+        {
+            my $oid = $oidContainedIn . '.' . $phyIndex;
+            my $result = $session->get_request( -varbindlist => [ $oid ] );
+            if( $session->error_status() == 0 and $result->{$oid} == 0 )
+            {
+                $chassisIndex = $phyIndex;
+            }
+        }
+
+        my $descr = $devdetails->snmpVar( $dd->oiddef('entPhysicalDescr') .
+                                          '.' . $phyIndex );
+        if( $descr )
+        {
+            $ref->{'descr'} = $descr;
+        }
+
+        my $name = $devdetails->snmpVar( $dd->oiddef('entPhysicalName') .
+                                         '.' . $phyIndex );
+        if( $name )
+        {
+            $ref->{'name'} = $name;
+        }
+    }
+
+    if( $chassisIndex )
+    {
+        $data->{'entityChassisPhyIndex'} = $chassisIndex;
+        my $chassisDescr = $data->{'entityPhysical'}{$chassisIndex}{'descr'};
+        if( length( $chassisDescr ) > 0 and
+            not defined( $data->{'param'}{'comment'} ) )
+        {
+            Debug('ENTITY-MIB: found chassis description: ' . $chassisDescr);
+            $data->{'param'}{'comment'} = $chassisDescr;
+        }
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/RFC2790_HOST_RESOURCES.pm b/torrus/perllib/Torrus/DevDiscover/RFC2790_HOST_RESOURCES.pm
new file mode 100644 (file)
index 0000000..8e79d9d
--- /dev/null
@@ -0,0 +1,263 @@
+#  Copyright (C) 2003 Shawn Ferry, Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: RFC2790_HOST_RESOURCES.pm,v 1.1 2010-12-27 00:03:47 ivan Exp $
+# Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Standard HOST_RESOURCES_MIB discovery, which should apply to most hosts
+
+package Torrus::DevDiscover::RFC2790_HOST_RESOURCES;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'RFC2790_HOST_RESOURCES'} = {
+    'sequence'     => 100,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+# define the oids that are needed to determine support,
+# capabilities and information about the device
+our %oiddef =
+    (
+     'hrSystemUptime'               => '1.3.6.1.2.1.25.1.1.0',
+     'hrSystemNumUsers'             => '1.3.6.1.2.1.25.1.5.0',
+     'hrSystemProcesses'            => '1.3.6.1.2.1.25.1.6.0',
+     'hrSystemMaxProcesses'         => '1.3.6.1.2.1.25.1.7.0',
+     'hrMemorySize'                 => '1.3.6.1.2.1.25.2.2.0',
+     'hrStorageTable'               => '1.3.6.1.2.1.25.2.3.1',
+     'hrStorageIndex'               => '1.3.6.1.2.1.25.2.3.1.1',
+     'hrStorageType'                => '1.3.6.1.2.1.25.2.3.1.2',
+     'hrStorageDescr'               => '1.3.6.1.2.1.25.2.3.1.3',
+     'hrStorageAllocationUnits'     => '1.3.6.1.2.1.25.2.3.1.4',
+     'hrStorageSize'                => '1.3.6.1.2.1.25.2.3.1.5',
+     'hrStorageUsed'                => '1.3.6.1.2.1.25.2.3.1.6',
+     'hrStorageAllocationFailures'  => '1.3.6.1.2.1.25.2.3.1.7'
+     );
+
+
+our %storageDescTranslate =  ( '/' => {'subtree' => 'root' } );
+
+# storage type names from MIB
+my %storageTypes =
+    (
+     1  => 'Other Storage',
+     2  => 'Physical Memory (RAM)',
+     3  => 'Virtual Memory',
+     4  => 'Fixed Disk',
+     5  => 'Removable Disk',
+     6  => 'Floppy Disk',
+     7  => 'Compact Disk',
+     8  => 'RAM Disk',
+     9  => 'Flash Memory',
+     10 => 'Network File System'
+     );
+
+our $storageGraphTop;
+our $storageHiMark;
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    return $dd->checkSnmpOID('hrSystemUptime');
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+
+    if( $dd->checkSnmpOID('hrSystemNumUsers') )
+    {
+        $devdetails->setCap('hrSystemNumUsers');
+    }
+
+    if( $dd->checkSnmpOID('hrSystemProcesses') )
+    {
+        $devdetails->setCap('hrSystemProcesses');
+    }
+
+    # hrStorage support
+    my $hrStorageTable = $session->get_table( -baseoid =>
+                                              $dd->oiddef('hrStorageTable') );
+    if( defined( $hrStorageTable ) )
+    {
+        $devdetails->storeSnmpVars( $hrStorageTable );
+
+        my $ref = {};
+        $data->{'hrStorage'} = $ref;
+
+        foreach my $INDEX
+            ( $devdetails->getSnmpIndices($dd->oiddef('hrStorageIndex') ) )
+        {
+            my $typeNum = $devdetails->snmpVar( $dd->oiddef('hrStorageType') .
+                                                '.' . $INDEX );
+            $typeNum =~ s/^[0-9.]+\.(\d+)$/$1/;
+
+            my $descr = $devdetails->snmpVar($dd->oiddef('hrStorageDescr')
+                                             . '.' . $INDEX);
+
+            my $used =  $devdetails->snmpVar($dd->oiddef('hrStorageUsed')
+                                             . '.' . $INDEX);
+
+            if( defined( $used ) and $storageTypes{$typeNum} )
+            {
+                my $ref = { 'param' => {}, 'templates' => [] };
+                $data->{'hrStorage'}{$INDEX} = $ref;
+                my $param = $ref->{'param'};
+
+                $param->{'storage-description'} = $descr;
+
+                my $comment = $storageTypes{$typeNum};
+                if( $descr =~ /^\// )
+                {
+                    $comment .= ' (' . $descr . ')';
+                }
+                $param->{'comment'} = $comment;
+
+                if( $storageDescTranslate{$descr}{'subtree'} )
+                {
+                    $descr = $storageDescTranslate{$descr}{'subtree'};
+                }
+                $descr =~ s/^\///;
+                $descr =~ s/\W/_/g;
+                $param->{'storage-nick'} = $descr;
+
+                my $units =
+                    $devdetails->snmpVar
+                    ($dd->oiddef('hrStorageAllocationUnits') . '.' . $INDEX);
+
+                $param->{'collector-scale'} = sprintf('%d,*', $units);
+
+                my $size =
+                    $devdetails->snmpVar
+                    ($dd->oiddef('hrStorageSize') . '.' . $INDEX);
+
+                if( $size )
+                {
+                    if( $storageGraphTop > 0 )
+                    {
+                        $param->{'graph-upper-limit'} =
+                            sprintf('%e',
+                                    $units * $size * $storageGraphTop / 100 );
+                    }
+
+                    if( $storageHiMark > 0 )
+                    {
+                        $param->{'upper-limit'} =
+                            sprintf('%e',
+                                    $units * $size * $storageHiMark / 100 );
+                    }
+                }
+
+                push( @{ $ref->{'templates'} },
+                      'RFC2790_HOST_RESOURCES::hr-storage-usage' );
+            }
+        }
+
+        if( scalar( keys %{$data->{'hrStorage'}} ) > 0 )
+        {
+            $devdetails->setCap('hrStorage');
+        }
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    my $data = $devdetails->data();
+
+    { # Anon sub for System Info
+        my $subtreeName =
+            $devdetails->param('RFC2790_HOST_RESOURCES::sysperf-subtree-name');
+        if( not defined( $subtreeName ) )
+        {
+            $subtreeName = 'System_Performance';
+            $devdetails->setParam
+                ('RFC2790_HOST_RESOURCES::sysperf-subtree-name', $subtreeName);
+        }
+
+        my $param = {};
+
+        my @templates =
+            ('RFC2790_HOST_RESOURCES::hr-system-performance-subtree',
+             'RFC2790_HOST_RESOURCES::hr-system-uptime');
+        if( $devdetails->hasCap('hrSystemNumUsers') )
+        {
+            push( @templates, 'RFC2790_HOST_RESOURCES::hr-system-num-users' );
+        }
+
+        if( $devdetails->hasCap('hrSystemProcesses') )
+        {
+            push( @templates, 'RFC2790_HOST_RESOURCES::hr-system-processes' );
+        }
+
+        my $subtreeNode = $cb->addSubtree( $devNode, $subtreeName,
+                                           $param, \@templates );
+    }
+
+    if( $devdetails->hasCap('hrStorage') )
+    {
+        # Build hrstorage subtree
+        my $subtreeName = 'Storage_Used';
+
+        my $param = {};
+        my @templates = ('RFC2790_HOST_RESOURCES::hr-storage-subtree');
+        my $subtreeNode = $cb->addSubtree( $devNode, $subtreeName,
+                                           $param, \@templates  );
+
+        foreach my $INDEX ( sort {$a<=>$b} keys %{$data->{'hrStorage'}} )
+        {
+            my $ref = $data->{'hrStorage'}{$INDEX};
+
+            #Display in index order, This is generally good(tm)
+            $ref->{'param'}->{'precedence'} = sprintf("%d", 1000 - $INDEX);
+
+            $cb->addLeaf( $subtreeNode, $ref->{'param'}{'storage-nick'},
+                          $ref->{'param'}, $ref->{'templates'} );
+        }
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm b/torrus/perllib/Torrus/DevDiscover/RFC2863_IF_MIB.pm
new file mode 100644 (file)
index 0000000..a3ae801
--- /dev/null
@@ -0,0 +1,1404 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: RFC2863_IF_MIB.pm,v 1.1 2010-12-27 00:03:57 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Standard IF_MIB discovery, which should apply to most devices
+
+package Torrus::DevDiscover::RFC2863_IF_MIB;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'RFC2863_IF_MIB'} = {
+    'sequence'     => 50,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig,
+    'buildGlobalConfig' => \&buildGlobalConfig
+    };
+
+
+our %oiddef =
+    (
+     'ifTable'          => '1.3.6.1.2.1.2.2',
+     'ifDescr'          => '1.3.6.1.2.1.2.2.1.2',
+     'ifType'           => '1.3.6.1.2.1.2.2.1.3',
+     'ifSpeed'          => '1.3.6.1.2.1.2.2.1.5',
+     'ifPhysAddress'    => '1.3.6.1.2.1.2.2.1.6',
+     'ifAdminStatus'    => '1.3.6.1.2.1.2.2.1.7',
+     'ifOperStatus'     => '1.3.6.1.2.1.2.2.1.8',
+     'ifInOctets'       => '1.3.6.1.2.1.2.2.1.10',
+     'ifInUcastPkts'    => '1.3.6.1.2.1.2.2.1.11',
+     'ifInDiscards'     => '1.3.6.1.2.1.2.2.1.13',
+     'ifInErrors'       => '1.3.6.1.2.1.2.2.1.14',
+     'ifOutOctets'      => '1.3.6.1.2.1.2.2.1.16',
+     'ifOutUcastPkts'   => '1.3.6.1.2.1.2.2.1.17',
+     'ifOutDiscards'    => '1.3.6.1.2.1.2.2.1.19',
+     'ifOutErrors'      => '1.3.6.1.2.1.2.2.1.20',
+     'ifXTable'         => '1.3.6.1.2.1.31.1.1',
+     'ifName'           => '1.3.6.1.2.1.31.1.1.1.1',
+     'ifHCInOctets'     => '1.3.6.1.2.1.31.1.1.1.6',
+     'ifHCInUcastPkts'  => '1.3.6.1.2.1.31.1.1.1.7',
+     'ifHCOutOctets'    => '1.3.6.1.2.1.31.1.1.1.10',
+     'ifHCOutUcastPkts' => '1.3.6.1.2.1.31.1.1.1.11',
+     'ifHighSpeed'      => '1.3.6.1.2.1.31.1.1.1.15',     
+     'ifAlias'          => '1.3.6.1.2.1.31.1.1.1.18'
+     );
+
+
+
+# Just curious, are there any devices without ifTable?
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    return $dd->checkSnmpTable('ifTable');
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+    
+    my $session = $dd->session();
+    
+    my $ifTable =
+        $session->get_table( -baseoid => $dd->oiddef('ifTable') );
+    if( not defined $ifTable )
+    {
+        Error('Cannot retrieve ifTable');
+        return 0;
+    }
+    $devdetails->storeSnmpVars( $ifTable );
+
+    my $ifXTable =
+        $session->get_table( -baseoid => $dd->oiddef('ifXTable') );
+    if( defined $ifXTable )
+    {
+        $devdetails->storeSnmpVars( $ifXTable );
+        $devdetails->setCap('ifXTable');
+
+        if( $devdetails->hasOID( $dd->oiddef('ifName') ) )
+        {
+            $devdetails->setCap('ifName');
+        }
+
+        if( $devdetails->hasOID( $dd->oiddef('ifAlias') ) )
+        {
+            $devdetails->setCap('ifAlias');
+        }
+        
+        if( $devdetails->hasOID( $dd->oiddef('ifHighSpeed') ) )
+        {
+            $devdetails->setCap('ifHighSpeed');
+        }
+    }
+
+    ## Fill in per-interface data. This is normally done within discover(),
+    ## but in our case we want to give other modules more control as early
+    ## as possible.
+
+    # Define the tables used for subtree naming, interface indexing,
+    # and RRD file naming
+    my $data = $devdetails->data();
+
+    $data->{'param'}{'has-inout-leaves'} = 'yes';
+
+    ## Set default interface index mapping
+    
+    $data->{'nameref'}{'ifSubtreeName'} = 'ifDescrT';
+    $data->{'nameref'}{'ifReferenceName'}   = 'ifDescr';
+
+    if( $devdetails->hasCap('ifName') )
+    {
+        $data->{'nameref'}{'ifNick'} = 'ifNameT';
+    }
+    else
+    {
+        $data->{'nameref'}{'ifNick'} = 'ifDescrT';
+    }
+
+    if( $devdetails->hasCap('ifAlias') )
+    {
+        $data->{'nameref'}{'ifComment'} = 'ifAlias';
+    }
+    
+    # Pre-populate the interfaces table, so that other modules may
+    # delete unneeded interfaces
+    my $includeAdmDown =
+        $devdetails->param('RFC2863_IF_MIB::list-admindown-interfaces')
+        eq 'yes';
+    my $includeNotpresent =
+        $devdetails->param('RFC2863_IF_MIB::list-notpresent-interfaces')
+        eq 'yes';
+    my $excludeOperDown =
+        $devdetails->param('RFC2863_IF_MIB::exclude-down-interfaces')
+        eq 'yes';
+    foreach my $ifIndex
+        ( $devdetails->getSnmpIndices( $dd->oiddef('ifDescr') ) )
+    {
+        my $admStatus =
+            $devdetails->snmpVar($dd->oiddef('ifAdminStatus') .'.'. $ifIndex);
+        my $operStatus =
+            $devdetails->snmpVar($dd->oiddef('ifOperStatus') .'.'. $ifIndex);
+        
+        if( ( $admStatus == 1 or $includeAdmDown ) and
+            ( $operStatus != 6 or $includeNotpresent ) and
+            ( $operStatus != 2 or not $excludeOperDown ) )
+        {
+            my $interface = {};
+            $data->{'interfaces'}{$ifIndex} = $interface;
+
+            $interface->{'param'} = {};
+            $interface->{'vendor_templates'} = [];
+
+            $interface->{'ifType'} =
+                $devdetails->snmpVar($dd->oiddef('ifType') . '.' . $ifIndex);
+
+            my $descr = $devdetails->snmpVar($dd->oiddef('ifDescr') .
+                                             '.' . $ifIndex);
+            $interface->{'ifDescr'} = $descr;
+            $descr =~ s/\W/_/g;
+            # Some SNMP agents send extra zero byte at the end
+            $descr =~ s/_+$//;
+            $interface->{'ifDescrT'} = $descr;
+
+            if( $devdetails->hasCap('ifName') )
+            {
+                my $iname = $devdetails->snmpVar($dd->oiddef('ifName') .
+                                                 '.' . $ifIndex);
+                if( $iname !~ /\w/ )
+                {
+                    $iname = $interface->{'ifDescr'};
+                    Warn('Empty or invalid ifName for interface ' . $iname);
+                }
+                $interface->{'ifName'} = $iname;
+                $iname =~ s/\W/_/g;
+                $interface->{'ifNameT'} = $iname;
+            }
+
+            if( $devdetails->hasCap('ifAlias') )
+            {
+                $interface->{'ifAlias'} =
+                    $devdetails->snmpVar($dd->oiddef('ifAlias') .
+                                         '.' . $ifIndex);
+            }
+
+            my $bw = 0;
+            if( $devdetails->hasCap('ifHighSpeed') )
+            {
+                my $hiBW = 
+                    $devdetails->snmpVar($dd->oiddef('ifHighSpeed') . '.' .
+                                         $ifIndex);
+                if( $hiBW >= 10 )
+                {
+                    $bw = 1e6 * $hiBW;
+                }
+            }
+
+            if( $bw == 0 )
+            {
+                $bw = 
+                    $devdetails->snmpVar($dd->oiddef('ifSpeed') . '.' .
+                                         $ifIndex);
+            }
+            
+            if( $bw > 0 )
+            {
+                $interface->{'ifSpeed'} = $bw;
+            }
+        }
+    }
+
+    ## Process hints on interface indexing
+    ## The capability 'interfaceIndexingManaged' disables the hints
+    ## and lets the vendor discovery module to operate the indexing
+    
+    if( not $devdetails->hasCap('interfaceIndexingManaged') and
+        not $devdetails->hasCap('interfaceIndexingPersistent') )
+    {
+        my $hint =
+            $devdetails->param('RFC2863_IF_MIB::ifindex-map-hint');
+        if( defined( $hint ) )
+        {
+            if( $hint eq 'ifName' )
+            {
+                if( not $devdetails->hasCap('ifName') )
+                {
+                    Error('Cannot use ifName interface mapping: ifName is '.
+                          'not supported by device');
+                    return 0;
+                }
+                else
+                {
+                    $data->{'nameref'}{'ifReferenceName'} = 'ifName';
+                    $data->{'param'}{'ifindex-table'} = '$ifName';
+                }
+            }
+            elsif( $hint eq 'ifPhysAddress' )
+            {
+                $data->{'param'}{'ifindex-map'} = '$IFIDX_MAC';
+                retrieveMacAddresses( $dd, $devdetails );
+            }
+            elsif( $hint eq 'ifIndex' )
+            {
+                $devdetails->setCap('interfaceIndexingPersistent');
+            }
+            else
+            {
+                Error('Unknown value of RFC2863_IF_MIB::ifindex-map-hint: ' .
+                      $hint);
+            }
+        }
+            
+        $hint =
+            $devdetails->param('RFC2863_IF_MIB::subtree-name-hint');
+        if( defined( $hint ) )
+        {
+            if( $hint eq 'ifName' )
+            {
+                $data->{'nameref'}{'ifSubtreeName'} = 'ifNameT';
+            }
+            else
+            {
+                Error('Unknown value of RFC2863_IF_MIB::subtree-name-hint: ' .
+                      $hint);
+            }
+        }
+        
+        $hint =
+            $devdetails->param('RFC2863_IF_MIB::nodeid-hint');
+        if( defined( $hint ) )
+        {
+            $data->{'nameref'}{'ifNodeid'} = $hint;
+        }
+    }
+    
+    if( $devdetails->hasCap('interfaceIndexingPersistent') )
+    {
+        $data->{'param'}{'ifindex-map'} = '$IFIDX_IFINDEX';
+        storeIfIndexParams( $devdetails );
+    }
+
+    if( not defined( $data->{'nameref'}{'ifNodeid'} ) )
+    {
+        $data->{'nameref'}{'ifNodeid'} = 'ifNodeid';
+    }
+    
+    if( not defined( $data->{'nameref'}{'ifNodeidPrefix'} ) )
+    {
+        $data->{'nameref'}{'ifNodeidPrefix'} = 'ifNodeidPrefix';
+    }
+    
+    # Filter out the interfaces if needed
+
+    if( ref( $data->{'interfaceFilter'} ) )
+    {
+        foreach my $ifIndex ( sort {$a<=>$b} keys %{$data->{'interfaces'}} )
+        {
+            my $interface = $data->{'interfaces'}{$ifIndex};
+            my $match = 0;
+
+            foreach my $filterHash ( @{$data->{'interfaceFilter'}} )
+            {
+                last if $match;
+                foreach my $filter ( values %{$filterHash} )
+                {
+                    last if $match;
+
+                    if( defined( $filter->{'ifType'} ) and
+                        $interface->{'ifType'} == $filter->{'ifType'} )
+                    {
+                        if( not defined( $filter->{'ifDescr'} ) or
+                            $interface->{'ifDescr'} =~ $filter->{'ifDescr'} )
+                        {
+                            $match = 1;
+                        }
+                    }
+                }
+            }
+
+            if( $match )
+            {
+                Debug('Excluding interface: ' .
+                      $interface->{$data->{'nameref'}{'ifReferenceName'}});
+                delete $data->{'interfaces'}{$ifIndex};
+            }
+        }
+    }
+
+    my $suppressHCCounters =
+        $devdetails->param('RFC2863_IF_MIB::suppress-hc-counters') eq 'yes';
+
+    # Explore each interface capability
+
+    foreach my $ifIndex ( keys %{$data->{'interfaces'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+
+        if( $devdetails->hasOID( $dd->oiddef('ifInOctets') .
+                                 '.' . $ifIndex )
+            and
+            $devdetails->hasOID( $dd->oiddef('ifOutOctets') .
+                                 '.' . $ifIndex ) )
+        {
+            $interface->{'hasOctets'} = 1;
+        }
+
+        if( $devdetails->hasOID( $dd->oiddef('ifInUcastPkts') .
+                                 '.' . $ifIndex )
+            and
+            $devdetails->hasOID( $dd->oiddef('ifOutUcastPkts') .
+                                 '.' . $ifIndex ) )
+        {
+            $interface->{'hasUcastPkts'} = 1;
+        }
+
+        if( $devdetails->hasOID( $dd->oiddef('ifInDiscards') .
+                                 '.' . $ifIndex ) )
+        {
+            $interface->{'hasInDiscards'} = 1;
+        }
+
+        if( $devdetails->hasOID( $dd->oiddef('ifOutDiscards') .
+                                 '.' . $ifIndex ) )
+        {
+            $interface->{'hasOutDiscards'} = 1;
+        }
+
+        if( $devdetails->hasOID( $dd->oiddef('ifInErrors') .
+                                 '.' . $ifIndex ) )
+        {
+            $interface->{'hasInErrors'} = 1;
+        }
+
+        if( $devdetails->hasOID( $dd->oiddef('ifOutErrors') .
+                                 '.' . $ifIndex ) )
+        {
+            $interface->{'hasOutErrors'} = 1;
+        }
+
+        if( $devdetails->hasCap('ifXTable') and not $suppressHCCounters )
+        {
+            if( $devdetails->hasOID( $dd->oiddef('ifHCInOctets') .
+                                     '.' . $ifIndex )
+                and
+                $devdetails->hasOID( $dd->oiddef('ifHCOutOctets') .
+                                     '.' . $ifIndex ) )
+            {
+                $interface->{'hasHCOctets'} = 1;
+            }
+
+            if( $devdetails->hasOID( $dd->oiddef('ifHCInUcastPkts') .
+                                     '.' . $ifIndex )
+                and
+                $devdetails->hasOID( $dd->oiddef('ifHCOutUcastPkts') .
+                                     '.' . $ifIndex ) )
+            {
+                $interface->{'hasHCUcastPkts'} = 1;
+            }
+        }
+    }
+
+    push( @{$data->{'templates'}}, 'RFC2863_IF_MIB::rfc2863-ifmib-hostlevel' );
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $globalData = shift;
+
+    my $data = $devdetails->data();
+
+    if( scalar( keys %{$data->{'interfaces'}} ) == 0 )
+    {
+        return;
+    }   
+    
+    # Make sure that ifNick and ifSubtreeName are unique across interfaces
+
+    uniqueEntries( $devdetails, $data->{'nameref'}{'ifNick'} );
+    uniqueEntries( $devdetails, $data->{'nameref'}{'ifSubtreeName'} );
+
+    # If other discovery modules don't set nodeid reference, fall back to
+    # default interface reference
+    
+    
+    # Build interface parameters
+
+    my $nInterfaces = 0;
+   
+    foreach my $ifIndex ( keys %{$data->{'interfaces'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+
+        next if $interface->{'excluded'};
+        $nInterfaces++;
+
+        $interface->{'param'}{'searchable'} = 'yes';
+        
+        $interface->{'param'}{'interface-iana-type'} = $interface->{'ifType'};
+
+        $interface->{'param'}{'interface-name'} =
+            $interface->{$data->{'nameref'}{'ifReferenceName'}};
+
+        $interface->{'param'}{'node-display-name'} =
+            $interface->{$data->{'nameref'}{'ifReferenceName'}};
+
+        $interface->{'param'}{'interface-nick'} =
+            $interface->{$data->{'nameref'}{'ifNick'}};
+
+        if( not defined( $interface->{$data->{'nameref'}{'ifNodeidPrefix'}} ) )
+        {
+            $interface->{$data->{'nameref'}{'ifNodeidPrefix'}} =
+                'if//%nodeid-device%//';
+        }
+        
+        if( not defined( $interface->{$data->{'nameref'}{'ifNodeid'}} ) )
+        {
+            $interface->{$data->{'nameref'}{'ifNodeid'}} =
+                $interface->{$data->{'nameref'}{'ifReferenceName'}};
+        }
+
+        # A per-interface value which is used by leafs in IF-MIB templates
+        $interface->{'param'}{'nodeid-interface'} =
+            $interface->{$data->{'nameref'}{'ifNodeidPrefix'}} .
+            $interface->{$data->{'nameref'}{'ifNodeid'}};
+        
+        $interface->{'param'}{'nodeid'} = '%nodeid-interface%';        
+
+        if( defined $data->{'nameref'}{'ifComment'} and
+            not defined( $interface->{'param'}{'comment'} ) and
+            length( $interface->{$data->{'nameref'}{'ifComment'}} ) > 0 )
+        {
+            my $comment = $interface->{$data->{'nameref'}{'ifComment'}};
+            $interface->{'param'}{'comment'} = $comment;
+            $interface->{'param'}{'interface-comment'} = $comment;
+        }
+
+        # Order the interfaces by ifIndex, not by interface name
+        $interface->{'param'}{'precedence'} = sprintf('%d', 100000-$ifIndex);
+
+        $interface->{'param'}{'devdiscover-nodetype'} =
+            'RFC2863_IF_MIB::interface';
+    }
+
+    if( $nInterfaces == 0 )
+    {
+        return;
+    }
+
+    if( $devdetails->param('RFC2863_IF_MIB::noout') eq 'yes' )
+    {
+        return;
+    }
+
+    # explicitly excluded interfaces    
+    my %excludeName;
+    my $excludeNameList =
+        $devdetails->param('RFC2863_IF_MIB::exclude-interfaces');
+    my $nExplExcluded = 0;
+        
+    if( defined( $excludeNameList ) and length( $excludeNameList ) > 0 )
+    {
+        foreach my $name ( split( /\s*,\s*/, $excludeNameList ) )
+        {
+            $excludeName{$name} = 1;
+        }
+    }
+
+    # explicitly listed interfaces
+    my %onlyName;
+    my $onlyNamesList =
+        $devdetails->param('RFC2863_IF_MIB::only-interfaces');
+    my $onlyNamesDefined = 0;
+    if( defined( $onlyNamesList ) and length( $onlyNamesList ) > 0 )
+    {
+        $onlyNamesDefined = 1;
+        foreach my $name ( split( /\s*,\s*/, $onlyNamesList ) )
+        {
+            $onlyName{$name} = 1;
+        }
+    }
+
+    # Bandwidth usage
+    my %bandwidthLimits;
+    if( $devdetails->param('RFC2863_IF_MIB::bandwidth-usage') eq 'yes' )
+    {
+        my $limits = $devdetails->param('RFC2863_IF_MIB::bandwidth-limits');
+        foreach my $intfLimit ( split( /\s*;\s*/, $limits ) )
+        {
+            my( $intf, $limitIn, $limitOut ) = split( /\s*:\s*/, $intfLimit );
+            $bandwidthLimits{$intf}{'In'} = $limitIn;
+            $bandwidthLimits{$intf}{'Out'} = $limitOut;
+        }
+    }
+
+    # tokenset member interfaces of the form
+    # Format: tset:intf,intf; tokenset:intf,intf;
+    # Format for global parameter:
+    #     tset:host/intf,host/intf; tokenset:host/intf,host/intf;
+    my %tsetMember;
+    my %tsetMemberApplied;
+    my $tsetMembership =
+        $devdetails->param('RFC2863_IF_MIB::tokenset-members');
+    if( defined( $tsetMembership ) and length( $tsetMembership ) > 0 )
+    {
+        foreach my $memList ( split( /\s*;\s*/, $tsetMembership ) )
+        {
+            my ($tset, $list) = split( /\s*:\s*/, $memList );
+            foreach my $intfName ( split( /\s*,\s*/, $list ) )
+            {
+                if( $intfName =~ /\// )
+                {
+                    my( $host, $intf ) = split( '/', $intfName );
+                    if( $host eq $devdetails->param('snmp-host') )
+                    {
+                        $tsetMember{$intf}{$tset} = 1;
+                    }
+                }
+                else
+                {
+                    $tsetMember{$intfName}{$tset} = 1;
+                }
+            }
+        }
+    }
+       
+        
+    # External storage serviceid assignment
+    my $extSrv =
+        $devdetails->param('RFC2863_IF_MIB::external-serviceid');
+    my %extStorage;
+    my %extStorageTrees;
+    
+    if( defined( $extSrv ) and length( $extSrv ) > 0 )
+    {
+        foreach my $srvDef ( split( /\s*,\s*/, $extSrv ) )
+        {
+            my ( $serviceid, $intfName, $direction, $trees ) =
+                split( /\s*:\s*/, $srvDef );
+
+            if( $intfName =~ /\// )
+            {
+                my( $host, $intf ) = split( '/', $intfName );
+                if( $host eq $devdetails->param('snmp-host') )
+                {
+                    $intfName = $intf;
+                }
+                else
+                {
+                    $intfName = undef;
+                }
+            }
+
+            if( defined( $intfName ) and length( $intfName ) > 0 )
+            {
+                if( defined( $trees ) )
+                {
+                    # Trees are listed with '|' as separator,
+                    # whereas compiler expects commas
+                    
+                    $trees =~ s/\s*\|\s*/,/g;
+                }
+                            
+                if( $direction eq 'Both' )
+                {
+                    $extStorage{$intfName}{'In'} = $serviceid . '_IN';
+                    $extStorageTrees{$serviceid . '_IN'} = $trees;
+                    
+                    $extStorage{$intfName}{'Out'} = $serviceid . '_OUT';
+                    $extStorageTrees{$serviceid . '_OUT'} = $trees;
+                }
+                else
+                {
+                    $extStorage{$intfName}{$direction} = $serviceid;
+                    $extStorageTrees{$serviceid} = $trees;
+                }
+            }
+        }
+    }
+
+    # Sums of several interfaces into single graphs (via CDef collector)
+    # RFC2863_IF_MIB::traffic-summaries: the list of sums to create;
+    # RFC2863_IF_MIB::traffic-XXX-path: the full path of the summary leaf
+    # RFC2863_IF_MIB::traffic-XXX-comment: description
+    # RFC2863_IF_MIB::traffic-XXX-interfaces: list of interfaces to add
+    #   format: "intf,intf" or "host/intf, host/intf"
+    my $trafficSums = $devdetails->param('RFC2863_IF_MIB::traffic-summaries');
+    my %trafficSummary;
+    if( defined( $trafficSums ) )
+    {
+        foreach my $summary ( split( /\s*,\s*/, $trafficSums ) )
+        {
+            $globalData->{'RFC2863_IF_MIB::summaryAttr'}{
+                $summary}{'path'} =
+                    $devdetails->param
+                    ('RFC2863_IF_MIB::traffic-' . $summary . '-path');
+            $globalData->{'RFC2863_IF_MIB::summaryAttr'}{
+                $summary}{'comment'} =
+                    $devdetails->param
+                    ('RFC2863_IF_MIB::traffic-' . $summary . '-comment');
+            
+            $globalData->{'RFC2863_IF_MIB::summaryAttr'}{
+                $summary}{'data-dir'} = $devdetails->param('data-dir');
+                    
+            my $intfList = $devdetails->param
+                ('RFC2863_IF_MIB::traffic-' . $summary . '-interfaces');
+
+            # get the intreface names for this host
+            foreach my $intfName ( split( /\s*,\s*/, $intfList ) )
+            {
+                if( $intfName =~ /\// )
+                {
+                    my( $host, $intf ) = split( '/', $intfName );
+                    if( $host eq $devdetails->param('snmp-host') )
+                    {
+                        $trafficSummary{$intf}{$summary} = 1;
+                    }
+                }
+                else
+                {
+                    $trafficSummary{$intfName}{$summary} = 1;
+                }
+            }
+        }
+    }
+    
+    # interface-level parameters to copy
+    my @intfCopyParams = ();
+    my $copyParams = $devdetails->param('RFC2863_IF_MIB::copy-params');
+    if( defined( $copyParams ) and length( $copyParams ) > 0 )
+    {
+        @intfCopyParams = split( /\s*,\s*/m, $copyParams );
+    }
+    
+    # Build configuration tree
+
+    my $subtreeName = $devdetails->param('RFC2863_IF_MIB::subtree-name');
+    if( length( $subtreeName ) == 0 )
+    {
+        $subtreeName = 'Interface_Counters';
+    }
+    my $subtreeParams = {};
+    my $subtreeComment = $devdetails->param('RFC2863_IF_MIB::subtree-comment');
+
+    if( length( $subtreeComment ) > 0 )
+    {
+        $subtreeParams->{'comment'} = $subtreeComment;
+    }
+
+    if( $devdetails->param('RFC2863_IF_MIB::bandwidth-usage') eq 'yes' )
+    {
+        $subtreeParams->{'overview-shortcuts'} = 'traffic,errors,bandwidth';
+    }
+    
+    my $countersNode =
+        $cb->addSubtree( $devNode, $subtreeName, $subtreeParams,
+                         ['RFC2863_IF_MIB::rfc2863-ifmib-subtree'] );
+    
+    foreach my $ifIndex ( sort {$a<=>$b} keys %{$data->{'interfaces'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+
+        if( $interface->{'selectorActions'}{'RemoveInterface'} )
+        {
+            $interface->{'excluded'} = 1;
+            Debug('Removing interface by selector action: ' .
+                  $interface->{$data->{'nameref'}{'ifReferenceName'}});
+        }
+
+        # Some vendor-specific modules may exclude some interfaces
+        next if $interface->{'excluded'};
+
+        # Create a subtree for the interface
+        my $subtreeName = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
+
+        if( $onlyNamesDefined )
+        {
+            if( not $onlyName{$subtreeName} )
+            {
+                $interface->{'excluded'} = 1;
+                $nExplExcluded++;
+                next;
+            }
+        }
+        
+        if( $excludeName{$subtreeName} )
+        {
+            $interface->{'excluded'} = 1;
+            $nExplExcluded++;
+            next;
+        }
+        elsif( length( $subtreeName ) == 0 )
+        {
+            Warn('Excluding an interface with empty name: ifIndex=' .
+                 $ifIndex);
+            next;
+        }
+
+        my @templates = ();
+
+        if( $interface->{'hasHCOctets'} )
+        {
+            push( @templates, 'RFC2863_IF_MIB::ifxtable-hcoctets' );
+        }
+        elsif( $interface->{'hasOctets'} )
+        {
+            push( @templates, 'RFC2863_IF_MIB::iftable-octets' );
+        }
+
+        if( $interface->{'hasOctets'} or $interface->{'hasHCOctets'} )
+        {
+            $interface->{'hasChild'}{'Bytes_In'} = 1;
+            $interface->{'hasChild'}{'Bytes_Out'} = 1;
+            $interface->{'hasChild'}{'InOut_bps'} = 1;            
+
+            foreach my $dir ( 'In', 'Out' )
+            {
+                if( defined( $interface->{'selectorActions'}->
+                             {$dir . 'BytesMonitor'} ) )
+                {
+                    $interface->{'childCustomizations'}->{
+                        'Bytes_' . $dir}->{'monitor'} =
+                            $interface->{'selectorActions'}->{
+                                $dir . 'BytesMonitor'};
+                }
+
+                if( defined( $interface->{'selectorActions'}->
+                             {$dir . 'BytesParameters'} ) )
+                {
+                    my @pairs =
+                        split('\s*;\s*',
+                              $interface->{'selectorActions'}{
+                                  $dir . 'BytesParameters'});
+                    
+                    foreach my $pair( @pairs )
+                    {
+                        my ($param, $val) = split('\s*=\s*', $pair);
+                        $interface->{'childCustomizations'}->{
+                            'Bytes_' . $dir}->{$param} = $val;
+                    }
+                }
+            }
+
+            if( defined( $interface->{'selectorActions'}{'HoltWinters'} ) )
+            {
+                push( @templates, '::holt-winters-defaults' );
+            }
+
+            if( defined( $interface->{'selectorActions'}{'NotifyPolicy'} ) )
+            {
+                $interface->{'param'}{'notify-policy'} =
+                    $interface->{'selectorActions'}{'NotifyPolicy'};
+            }
+        }
+
+        if( not $interface->{'selectorActions'}{'NoPacketCounters'} )
+        {
+            my $has_someting = 0;
+            if( $interface->{'hasHCUcastPkts'} )
+            {
+                push( @templates, 'RFC2863_IF_MIB::ifxtable-hcucast-packets' );
+                $has_someting = 1;
+            }
+            elsif( $interface->{'hasUcastPkts'} )
+            {
+                push( @templates, 'RFC2863_IF_MIB::iftable-ucast-packets' );
+                $has_someting = 1;
+            }
+
+            if( $has_someting )
+            {
+                $interface->{'hasChild'}{'Packets_In'} = 1;            
+                $interface->{'hasChild'}{'Packets_Out'} = 1;            
+            }
+        }
+
+        if( not $interface->{'selectorActions'}{'NoDiscardCounters'} )
+        {
+            if( $interface->{'hasInDiscards'} )
+            {
+                push( @templates, 'RFC2863_IF_MIB::iftable-discards-in' );
+                $interface->{'hasChild'}{'Discards_In'} = 1;            
+
+                if( defined
+                    ($interface->{'selectorActions'}->{'InDiscardsMonitor'}) )
+                {
+                    $interface->{'childCustomizations'}->{
+                        'Discards_In'}->{'monitor'} =
+                            $interface->{'selectorActions'}{
+                                'InDiscardsMonitor'};
+                }
+            }
+            
+            if( $interface->{'hasOutDiscards'} )
+            {
+                push( @templates, 'RFC2863_IF_MIB::iftable-discards-out' );
+                $interface->{'hasChild'}{'Discards_Out'} = 1;
+                
+                if( defined( $interface->{'selectorActions'}->{
+                    'OutDiscardsMonitor'} ) )
+                {
+                    $interface->{'childCustomizations'}->{
+                        'Discards_Out'}->{'monitor'} =
+                            $interface->{'selectorActions'}{
+                                'OutDiscardsMonitor'};
+                }
+            }
+        }
+        
+
+        if( not $interface->{'selectorActions'}{'NoErrorCounters'} )
+        {
+            if( $interface->{'hasInErrors'} )
+            {
+                push( @templates, 'RFC2863_IF_MIB::iftable-errors-in' );
+                $interface->{'hasChild'}{'Errors_In'} = 1;            
+
+                if( defined( $interface->{'selectorActions'}->{
+                    'InErrorsMonitor'} ) )
+                {
+                    $interface->{'childCustomizations'}->{
+                        'Errors_In'}->{'monitor'} =
+                            $interface->{'selectorActions'}{'InErrorsMonitor'};
+                }
+            }
+
+            if( $interface->{'hasOutErrors'} )
+            {
+                push( @templates, 'RFC2863_IF_MIB::iftable-errors-out' );
+                $interface->{'hasChild'}{'Errors_Out'} = 1;            
+
+                if( defined( $interface->{'selectorActions'}->{
+                    'OutErrorsMonitor'} ) )
+                {
+                    $interface->{'childCustomizations'}->{
+                        'Errors_Out'}->{'monitor'} =
+                            $interface->{'selectorActions'}{
+                                'OutErrorsMonitor'};
+                }
+            }
+        }
+        
+        if( defined( $interface->{'selectorActions'}{'TokensetMember'} ) )
+        {
+            foreach my $tset
+                ( split('\s*,\s*',
+                        $interface->{'selectorActions'}{'TokensetMember'}) )
+            {
+                $tsetMember{$subtreeName}{$tset} = 1;
+            }
+        }
+        
+        if( defined( $interface->{'selectorActions'}{'Parameters'} ) )
+        {
+            my @pairs = split('\s*;\s*',
+                              $interface->{'selectorActions'}{'Parameters'});
+            foreach my $pair( @pairs )
+            {
+                my ($param, $val) = split('\s*=\s*', $pair);
+                $interface->{'param'}{$param} = $val;
+            }
+        }
+
+        if( $devdetails->param('RFC2863_IF_MIB::bandwidth-usage') eq 'yes' )
+        {
+            if( defined( $bandwidthLimits{$subtreeName} ) )
+            {
+                $interface->{'param'}{'bandwidth-limit-in'} =
+                    $bandwidthLimits{$subtreeName}{'In'};
+                $interface->{'param'}{'bandwidth-limit-out'} =
+                    $bandwidthLimits{$subtreeName}{'Out'};
+            }
+
+            # We accept that parameters may be added by some other ways
+
+            if( defined( $interface->{'param'}{'bandwidth-limit-in'} ) and
+                defined( $interface->{'param'}{'bandwidth-limit-out'} ) )
+            {
+                push( @templates,
+                      'RFC2863_IF_MIB::interface-bandwidth-usage' );
+            }
+        }
+
+        if( ref( $interface->{'templates'} ) )
+        {
+            push( @templates, @{$interface->{'templates'}} );
+        }
+
+        # Add vendor templates
+        push( @templates, @{$interface->{'vendor_templates'}} );
+        
+        # Add subtree only if there are template references
+
+        if( scalar( @templates ) > 0 )
+        {
+            # process interface-level parameters to copy
+
+            foreach my $param ( @intfCopyParams )
+            {
+                my $val = $devdetails->param('RFC2863_IF_MIB::' .
+                                             $param . '::' . $subtreeName );
+                if( defined( $val ) and length( $val ) > 0 )
+                {
+                    $interface->{'param'}{$param} = $val;
+                }
+            }
+
+            if( defined( $tsetMember{$subtreeName} ) )
+            {
+                my $tsetList =
+                    join( ',', sort keys %{$tsetMember{$subtreeName}} );
+                
+                $interface->{'childCustomizations'}->{'InOut_bps'}->{
+                    'tokenset-member'} = $tsetList;
+                $tsetMemberApplied{$subtreeName} = 1;
+            }
+
+            if( defined( $extStorage{$subtreeName} ) )
+            {
+                foreach my $dir ( 'In', 'Out' )
+                {
+                    if( defined( $extStorage{$subtreeName}{$dir} ) )
+                    {
+                        my $serviceid = $extStorage{$subtreeName}{$dir};
+
+                        my $params = {
+                            'storage-type'      => 'rrd,ext',
+                            'ext-service-id'    => $serviceid,
+                            'ext-service-units' => 'bytes' };
+                        
+                        if( defined( $extStorageTrees{$serviceid} )
+                            and length( $extStorageTrees{$serviceid} ) > 0 )
+                        {
+                            $params->{'ext-service-trees'} =
+                                $extStorageTrees{$serviceid};
+                        }
+
+                        foreach my $param ( keys %{$params} )
+                        {
+                            $interface->{'childCustomizations'}->{
+                                'Bytes_' . $dir}{$param} = $params->{$param};
+                        }
+                    }
+                }
+            }
+            
+            my $intfNode =
+                $cb->addSubtree( $countersNode, $subtreeName,
+                                 $interface->{'param'}, \@templates );
+
+            if( defined( $interface->{'childCustomizations'} ) )
+            {
+                foreach my $childName
+                    ( sort keys %{$interface->{'childCustomizations'}} )
+                {
+                    if( $interface->{'hasChild'}{$childName} )
+                    {
+                        $cb->addLeaf
+                            ( $intfNode, $childName,
+                              $interface->{'childCustomizations'}->{
+                                  $childName} );
+                    }
+                }
+            }
+
+            # If the interafce is a member of traffic summary
+            if( defined( $trafficSummary{$subtreeName} ) )
+            {
+                foreach my $summary ( keys %{$trafficSummary{$subtreeName}} )
+                {
+                    addTrafficSummaryElement( $globalData,
+                                              $summary, $intfNode );
+                }
+            }
+        }
+    }
+    
+    if( $nExplExcluded > 0 )
+    {
+        Debug('Explicitly excluded ' . $nExplExcluded .
+              ' RFC2863_IF_MIB interfaces');
+    }
+
+    if( scalar( %tsetMember ) > 0 )
+    {
+        my @failedIntf;
+        foreach my $intfName ( keys %tsetMember )
+        {
+            if( not $tsetMemberApplied{$intfName} )
+            {
+                push( @failedIntf, $intfName );
+            }
+        }
+
+        if( scalar( @failedIntf ) > 0 )
+        {
+            Warn('The following interfaces were not added to tokensets, ' .
+                 'probably because they do not exist or are explicitly ' .
+                 'excluded: ' .
+                 join(' ', sort @failedIntf));
+        }
+    }                 
+    
+    $cb->{'statistics'}{'interfaces'} += $nInterfaces;
+    if( $cb->{'statistics'}{'max-interfaces-per-host'} < $nInterfaces )
+    {
+        $cb->{'statistics'}{'max-interfaces-per-host'} = $nInterfaces;
+    }
+}
+
+
+sub addTrafficSummaryElement
+{
+    my $globalData = shift;
+    my $summary = shift;
+    my $node = shift;
+
+    if( not defined( $globalData->{
+        'RFC2863_IF_MIB::summaryMembers'}{$summary} ) )
+    {
+        $globalData->{'RFC2863_IF_MIB::summaryMembers'}{$summary} = [];
+    }
+
+    push( @{$globalData->{'RFC2863_IF_MIB::summaryMembers'}{$summary}},
+          $node );
+}
+      
+
+sub buildGlobalConfig
+{
+    my $cb = shift;
+    my $globalData = shift;
+
+    if( not defined( $globalData->{'RFC2863_IF_MIB::summaryMembers'} ) )
+    {
+        return;
+    }
+    
+    foreach my $summary ( keys %{$globalData->{
+        'RFC2863_IF_MIB::summaryMembers'}} )
+    {
+        next if scalar( @{$globalData->{
+            'RFC2863_IF_MIB::summaryMembers'}{$summary}} ) == 0;
+
+        my $attr = $globalData->{'RFC2863_IF_MIB::summaryAttr'}{$summary};
+        my $path = $attr->{'path'};
+
+        if( not defined( $path ) )
+        {
+            Error('Missing the path for traffic summary ' . $summary);
+            next;
+        }
+
+        Debug('Building summary: ' . $summary);
+        
+        # Chop the first and last slashes
+        $path =~ s/^\///;
+        $path =~ s/\/$//;
+        
+        # generate subtree path XML
+        my $subtreeNode = undef;
+        foreach my $subtreeName ( split( '/', $path ) )
+        {
+            $subtreeNode = $cb->addSubtree( $subtreeNode, $subtreeName, {
+                'comment'  => $attr->{'comment'},
+                'data-dir' => $attr->{'data-dir'} } );
+        }
+
+        foreach my $dir ('In', 'Out')
+        {
+            my $rpn = '';
+            foreach my $member ( @{$globalData->{
+                'RFC2863_IF_MIB::summaryMembers'}{$summary}} )
+            {
+                my $memRef = '{' . $cb->getElementPath($member) .
+                    'Bytes_' . $dir . '}';
+                if( length( $rpn ) == 0 )
+                {
+                    $rpn = $memRef;
+                }
+                else
+                {
+                    $rpn .= ',' . $memRef . ',+';
+                }
+            }
+            
+            my $param = {
+                'rpn-expr' => $rpn,
+                'data-file' => 'summary_' . $summary . '.rrd',
+                'rrd-ds' => 'Bytes' . $dir };
+          
+            $cb->addLeaf( $subtreeNode, 'Bytes_' . $dir, $param,
+                          ['::cdef-collector-defaults'] );
+        }
+    }
+}
+
+                       
+
+        
+
+# $filterHash is a hash reference
+# Key is some unique symbolic name, does not mean anything
+# $filterHash->{$key}{'ifType'} is the number to match the interface type
+# $filterHash->{$key}{'ifDescr'} is the regexp to match the interface
+# description
+
+sub addInterfaceFilter
+{
+    my $devdetails = shift;
+    my $filterHash = shift;
+
+    my $data = $devdetails->data();
+
+    if( not ref( $data->{'interfaceFilter'} ) )
+    {
+        $data->{'interfaceFilter'} = [];
+    }
+
+    push( @{$data->{'interfaceFilter'}}, $filterHash );
+}
+
+
+sub uniqueEntries
+{
+    my $devdetails = shift;
+    my $nameref = shift;
+
+    my $data = $devdetails->data();
+    my %count = ();
+
+    foreach my $ifIndex ( sort {$a<=>$b} keys %{$data->{'interfaces'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+
+        my $entry = $interface->{$nameref};
+        if( length($entry) == 0 )
+        {
+            $entry = $interface->{$nameref} = '_';
+        }
+        if( int( $count{$entry} ) > 0 )
+        {
+            my $new_entry = sprintf('%s%d', $entry, int( $count{$entry} ) );
+            $interface->{$nameref} = $new_entry;
+            $count{$new_entry}++;
+        }
+        $count{$entry}++;
+    }
+}
+
+# For devices which require MAC address-to-interface mapping,
+# this function fills in the appropriate interface-macaddr parameters.
+# To get use of MAC mapping, set
+#     $data->{'param'}{'ifindex-map'} = '$IFIDX_MAC';
+
+
+sub retrieveMacAddresses
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+
+    foreach my $ifIndex ( sort {$a<=>$b} keys %{$data->{'interfaces'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+
+        my $macaddr = $devdetails->snmpVar($dd->oiddef('ifPhysAddress') .
+                                           '.' . $ifIndex);
+
+        if( defined( $macaddr ) and length( $macaddr ) > 0 )
+        {
+            $interface->{'MAC'} = $macaddr;
+            $interface->{'param'}{'interface-macaddr'} = $macaddr;
+        }
+        else
+        {
+            Warn('Excluding interface without MAC address: ' .
+                  $interface->{$data->{'nameref'}{'ifReferenceName'}});
+            delete $data->{'interfaces'}{$ifIndex};
+        }
+    }
+}
+
+
+# For devices with fixed ifIndex mapping it populates interface-index parameter
+
+
+sub storeIfIndexParams
+{
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+
+    foreach my $ifIndex ( keys %{$data->{'interfaces'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+        $interface->{'param'}{'interface-index'} = $ifIndex;        
+    }
+}
+
+#######################################
+# Selectors interface
+#
+
+$Torrus::DevDiscover::selectorsRegistry{'RFC2863_IF_MIB'} = {
+    'getObjects'      => \&getSelectorObjects,
+    'getObjectName'   => \&getSelectorObjectName,
+    'checkAttribute'  => \&checkSelectorAttribute,
+    'applyAction'     => \&applySelectorAction,
+};
+
+
+## Objects are interface indexes
+
+sub getSelectorObjects
+{
+    my $devdetails = shift;
+    my $objType = shift;
+    return sort {$a<=>$b} keys ( %{$devdetails->data()->{'interfaces'}} );
+}
+
+
+sub checkSelectorAttribute
+{
+    my $devdetails = shift;
+    my $object = shift;
+    my $objType = shift;
+    my $attr = shift;
+    my $checkval = shift;
+
+    my $data = $devdetails->data();
+    my $interface = $data->{'interfaces'}{$object};
+    
+    if( $attr =~ /^ifSubtreeName\d*$/ )
+    {
+        my $value = $interface->{$data->{'nameref'}{'ifSubtreeName'}};
+        my $match = 0;
+        foreach my $chkexpr ( split( /\s+/, $checkval ) )
+        {
+            if( $value =~ $chkexpr )
+            {
+                $match = 1;
+                last;
+            }
+        }
+        return $match;        
+    }
+    else
+    {
+        my $value;
+        my $operator = '=~';
+        if( $attr eq 'ifComment' )
+        {
+            $value = $interface->{$data->{'nameref'}{'ifComment'}};
+        }
+        elsif( $attr eq 'ifType' )
+        {
+            $value = $interface->{'ifType'};
+            $operator = '==';
+        }
+        else
+        {
+            Error('Unknown RFC2863_IF_MIB selector attribute: ' . $attr);
+            $value = '';
+        }
+
+        return eval( '$value' . ' ' . $operator . '$checkval' ) ? 1:0;
+    }
+}
+
+
+sub getSelectorObjectName
+{
+    my $devdetails = shift;
+    my $object = shift;
+    my $objType = shift;
+    
+    my $data = $devdetails->data();
+    my $interface = $data->{'interfaces'}{$object};
+    return $interface->{$data->{'nameref'}{'ifSubtreeName'}};
+}
+
+
+# Other discovery modules can add their interface actions here
+our %knownSelectorActions =
+    ( 'InBytesMonitor'    => 'RFC2863_IF_MIB',
+      'OutBytesMonitor'   => 'RFC2863_IF_MIB',
+      'InDiscardsMonitor'  => 'RFC2863_IF_MIB',
+      'OutDiscardsMonitor' => 'RFC2863_IF_MIB',
+      'InErrorsMonitor'   => 'RFC2863_IF_MIB',
+      'OutErrorsMonitor'  => 'RFC2863_IF_MIB',
+      'NotifyPolicy'      => 'RFC2863_IF_MIB',
+      'HoltWinters'       => 'RFC2863_IF_MIB',
+      'NoPacketCounters'  => 'RFC2863_IF_MIB',
+      'NoDiscardCounters' => 'RFC2863_IF_MIB',
+      'NoErrorCounters'   => 'RFC2863_IF_MIB',
+      'RemoveInterface'   => 'RFC2863_IF_MIB',
+      'TokensetMember'    => 'RFC2863_IF_MIB',
+      'Parameters'        => 'RFC2863_IF_MIB',
+      'InBytesParameters' => 'RFC2863_IF_MIB',
+      'OutBytesParameters' => 'RFC2863_IF_MIB',);
+
+                            
+sub applySelectorAction
+{
+    my $devdetails = shift;
+    my $object = shift;
+    my $objType = shift;
+    my $action = shift;
+    my $arg = shift;
+
+    my $data = $devdetails->data();
+    my $interface = $data->{'interfaces'}{$object};
+
+    if( defined( $knownSelectorActions{$action} ) )
+    {
+        if( not $devdetails->isDevType( $knownSelectorActions{$action} ) )
+        {
+            Error('Action ' . $action . ' is applied to a device that is ' .
+                  'not of type ' . $knownSelectorActions{$action} .
+                  ': ' . $devdetails->param('system-id'));
+        }
+        $interface->{'selectorActions'}{$action} = $arg;
+    }
+    else
+    {
+        Error('Unknown RFC2863_IF_MIB selector action: ' . $action);
+    }
+}
+   
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/Symmetricom.pm b/torrus/perllib/Torrus/DevDiscover/Symmetricom.pm
new file mode 100644 (file)
index 0000000..cc7ff3a
--- /dev/null
@@ -0,0 +1,104 @@
+#
+#  Discovery module for Symmetricom
+#
+#  Copyright (C) 2007 Jon Nistor
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Symmetricom.pm,v 1.1 2010-12-27 00:03:46 ivan Exp $
+# Jon Nistor <nistor at snickers dot org>
+#
+
+
+# Symmetricom
+package Torrus::DevDiscover::Symmetricom;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'Symmetricom'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+our %oiddef = (
+     # SYMM-SMI
+     'syncServer'           => '1.3.6.1.4.1.9070.1.2.3.1.5',
+     'sysDescr'             => '1.3.6.1.2.1.1.1.0',
+     'ntpSysSystem'         => '1.3.6.1.4.1.9070.1.2.3.1.5.1.1.14.0',
+     'etcSerialNbr'         => '1.3.6.1.4.1.9070.1.2.3.1.5.1.6.2.0',
+     'etcModel'             => '1.3.6.1.4.1.9070.1.2.3.1.5.1.6.3.0',
+     );
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'syncServer',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+    
+    $devdetails->setCap('interfaceIndexingPersistent');
+    $devdetails->setDevType('UcdSnmp'); # Force load Ucd
+
+    return 1;
+}
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    # SNMP: Get the system info and display it in the comment
+    my $ntpComment = $dd->retrieveSnmpOIDs
+        ( 'sysDescr', 'ntpSysSystem', 'etcSerialNbr', 'etcModel' );
+
+    $data->{'ntp'} = $ntpComment;
+
+    $data->{'param'}{'comment'} =
+        $ntpComment->{'ntpSysSystem'} . " " . $ntpComment->{'etcModel'} . 
+        ", Hw Serial#: " . $ntpComment->{'etcSerialNbr'};
+  
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+    my $data = $devdetails->data();
+
+    $cb->addTemplateApplication($devNode, 'Symmetricom::ntp-stats');
+}
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/UcdSnmp.pm b/torrus/perllib/Torrus/DevDiscover/UcdSnmp.pm
new file mode 100644 (file)
index 0000000..9c9ce73
--- /dev/null
@@ -0,0 +1,265 @@
+#  Copyright (C) 2003  Shawn Ferry
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: UcdSnmp.pm,v 1.1 2010-12-27 00:03:47 ivan Exp $
+# Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+
+# Ucd Snmp Discovery
+
+package Torrus::DevDiscover::UcdSnmp;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'UcdSnmp'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+our %oiddef =
+    (
+     # ucd
+     'ucd'                      => '1.3.6.1.4.1.2021',
+     'net_snmp'                 => '1.3.6.1.4.1.8072',
+
+     # We assume that if we have Avail we also have Total
+     'ucd_memAvailSwap'         => '1.3.6.1.4.1.2021.4.4.0',
+     'ucd_memAvailReal'         => '1.3.6.1.4.1.2021.4.6.0',
+
+     # If we have in we assume out
+     'ucd_ssSwapIn'             => '1.3.6.1.4.1.2021.11.3.0',
+
+     # If we have User we assume System and Idle
+     'ucd_ssCpuRawUser'         => '1.3.6.1.4.1.2021.11.50.0',
+     'ucd_ssCpuRawNice'         => '1.3.6.1.4.1.2021.11.51.0',
+     'ucd_ssCpuRawWait'         => '1.3.6.1.4.1.2021.11.54.0',
+     'ucd_ssCpuRawKernel'       => '1.3.6.1.4.1.2021.11.55.0',
+     'ucd_ssCpuRawInterrupts'   => '1.3.6.1.4.1.2021.11.56.0',
+     'ucd_ssCpuRawSoftIRQ'      => '1.3.6.1.4.1.2021.11.61.0',
+
+     # if we have Sent we assume Received
+     'ucd_ssIORawSent'          => '1.3.6.1.4.1.2021.11.57.0',
+
+     'ucd_ssRawInterrupts'      => '1.3.6.1.4.1.2021.11.59.0',
+     'ucd_ssRawContexts'        => '1.3.6.1.4.1.2021.11.60.0',
+
+     'ucd_laTable'              => '1.3.6.1.4.1.2021.10'
+     );
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $sysObjectID = $devdetails->snmpVar( $dd->oiddef('sysObjectID') );
+    
+    if( not $dd->oidBaseMatch( 'ucd', $sysObjectID )
+        and
+        not $dd->oidBaseMatch( 'net_snmp', $sysObjectID ) )
+    {
+        return 0;
+    }
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $session = $dd->session();
+    my $data = $devdetails->data();
+
+    my @checkOids = (
+                     'ucd_memAvailSwap',
+                     'ucd_memAvailReal',
+                     'ucd_ssSwapIn',
+                     'ucd_ssCpuRawUser',
+                     'ucd_ssCpuRawWait',
+                     'ucd_ssCpuRawKernel',
+                     'ucd_ssCpuRawInterrupts',
+                     'ucd_ssCpuRawNice',
+                     'ucd_ssCpuRawSoftIRQ',
+                     'ucd_ssIORawSent',
+                     'ucd_ssRawInterrupts',
+                     );
+
+
+    my $result = $dd->retrieveSnmpOIDs( @checkOids );
+    if( defined( $result ) )
+    {
+        foreach my $oid ( @checkOids )
+        {
+            if( defined($result->{$oid}) and length($result->{$oid}) > 0 )
+            {
+                $devdetails->setCap($oid);
+            }
+        }
+    }
+
+    if( $dd->checkSnmpTable('ucd_laTable') )
+    {
+        $devdetails->setCap('ucd_laTable');
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+    my $data = $devdetails->data();
+
+    # Hostresources MIB is optional in net-snmp. We try and use the same
+    # subtree name for UCD and Hostresources statistics.
+    
+    my $subtreeName =
+        $devdetails->param('RFC2790_HOST_RESOURCES::sysperf-subtree-name');
+    if( not defined( $subtreeName ) )
+    {
+        $subtreeName = 'System_Performance';
+        $devdetails->setParam
+            ('RFC2790_HOST_RESOURCES::sysperf-subtree-name', $subtreeName);
+    }
+
+    my @templates;
+    if( $devdetails->hasCap('ucd_ssIORawSent') )
+    {
+        push( @templates, 'UcdSnmp::ucdsnmp-blockio' );
+    }
+
+    if( $devdetails->hasCap('ucd_ssRawInterrupts') )
+    {
+        push( @templates,  'UcdSnmp::ucdsnmp-raw-interrupts' );
+    }
+
+    if( $devdetails->hasCap('ucd_laTable') )
+    {
+        push( @templates, 'UcdSnmp::ucdsnmp-load-average' );
+    }
+
+    if( $devdetails->hasCap('ucd_memAvailSwap') )
+    {
+        push( @templates, 'UcdSnmp::ucdsnmp-memory-swap' );
+    }
+
+    if( $devdetails->hasCap('ucd_memAvailReal') )
+    {
+        push( @templates, 'UcdSnmp::ucdsnmp-memory-real' );
+    }
+
+    my $cpuMultiParam;
+    my @cpuMultiTemplates;
+
+    if( $devdetails->hasCap('ucd_ssCpuRawUser') )
+    {
+        $cpuMultiParam = {
+            'graph-lower-limit' => '0',
+            'rrd-hwpredict'     => 'disabled',
+            'vertical-label'    => 'Cpu Usage',
+            'comment'           => 'Cpu Idle, Sys, User',
+            'ds-names'          => 'idle,sys,user',
+            'ds-type'           => 'rrd-multigraph'
+            };
+
+        push( @templates,
+              'UcdSnmp::ucdsnmp-cpu-user',
+              'UcdSnmp::ucdsnmp-cpu-system',
+              'UcdSnmp::ucdsnmp-cpu-idle' );
+
+        push( @cpuMultiTemplates,
+              'UcdSnmp::ucdsnmp-cpu-user-multi',
+              'UcdSnmp::ucdsnmp-cpu-system-multi',
+              'UcdSnmp::ucdsnmp-cpu-idle-multi' );
+
+        if( $devdetails->hasCap('ucd_ssCpuRawWait') )
+        {
+            push( @templates, 'UcdSnmp::ucdsnmp-cpu-wait' );
+            push( @cpuMultiTemplates, 'UcdSnmp::ucdsnmp-cpu-wait-multi' );
+
+            $cpuMultiParam->{'comment'}  .= ', Wait';
+            $cpuMultiParam->{'ds-names'} .= ',wait';
+        }
+
+        if( $devdetails->hasCap('ucd_ssCpuRawKernel') )
+        {
+            push( @templates, 'UcdSnmp::ucdsnmp-cpu-kernel' );
+            push( @cpuMultiTemplates, 'UcdSnmp::ucdsnmp-cpu-kernel-multi' );
+
+            $cpuMultiParam->{'comment'}  .= ', Kernel';
+            $cpuMultiParam->{'ds-names'} .= ',kernel';
+        }
+
+        if( $devdetails->hasCap('ucd_ssCpuRawNice') )
+        {
+            push( @templates, 'UcdSnmp::ucdsnmp-cpu-nice' );
+            push( @cpuMultiTemplates, 'UcdSnmp::ucdsnmp-cpu-nice-multi' );
+
+            $cpuMultiParam->{'comment'}  .= ', Nice';
+            $cpuMultiParam->{'ds-names'} .= ',nice';
+        }
+
+        if( $devdetails->hasCap('ucd_ssCpuRawInterrupts') )
+        {
+            push( @templates, 'UcdSnmp::ucdsnmp-cpu-interrupts' );
+            push( @cpuMultiTemplates,
+                  'UcdSnmp::ucdsnmp-cpu-interrupts-multi' );
+
+            $cpuMultiParam->{'comment'}  .= ', Interrupts';
+            $cpuMultiParam->{'ds-names'} .= ',int';
+        }
+
+        if( $devdetails->hasCap('ucd_ssCpuRawSoftIRQ') )
+        {
+            push( @templates, 'UcdSnmp::ucdsnmp-cpu-softirq' );
+            push( @cpuMultiTemplates,
+                  'UcdSnmp::ucdsnmp-cpu-softirq-multi' );
+
+            $cpuMultiParam->{'comment'}  .= ', SoftIRQs';
+            $cpuMultiParam->{'ds-names'} .= ',softirq';
+        }
+
+        $cpuMultiParam->{'comment'} =~ s/\,\s+(\w+)$/ and $1/;
+    }
+
+    my $perfNode = $cb->addSubtree( $devNode, $subtreeName,
+                                    undef, \@templates);
+
+    if( $cpuMultiParam )
+    {
+        $cb->addLeaf( $perfNode, 'Cpu_Stats',
+                      $cpuMultiParam, \@cpuMultiTemplates );
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/DevDiscover/Xylan.pm b/torrus/perllib/Torrus/DevDiscover/Xylan.pm
new file mode 100644 (file)
index 0000000..6d1c894
--- /dev/null
@@ -0,0 +1,199 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Xylan.pm,v 1.1 2010-12-27 00:03:50 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Xylan (Alcatel) switch discovery.
+
+# Tested with:
+#
+# Xylan OmniSwitch 9x
+# Xylan OmniStack 5024
+# Switch software: X/OS 4.3.3
+#
+# Virtual ports are not processed yet
+
+
+package Torrus::DevDiscover::Xylan;
+
+use strict;
+use Torrus::Log;
+
+
+$Torrus::DevDiscover::registry{'Xylan'} = {
+    'sequence'     => 500,
+    'checkdevtype' => \&checkdevtype,
+    'discover'     => \&discover,
+    'buildConfig'  => \&buildConfig
+    };
+
+
+our %oiddef =
+    (
+     # XYLAN-BASE-MIB
+     'xylanSwitchDevice'           => '1.3.6.1.4.1.800.3.1.1',
+     # PORT-MIB::phyPortTable
+     'xylanPhyPortTable'           => '1.3.6.1.4.1.800.2.3.3.1',
+     # PORT-MIB::phyPortDescription
+     'xylanPhyPortDescription'     => '1.3.6.1.4.1.800.2.3.3.1.1.4',
+     # PORT-MIB::phyPortToInterface
+     'xylanPhyPortToInterface'     => '1.3.6.1.4.1.800.2.3.3.1.1.19'
+     );
+
+# Not all interfaces are normally needed to monitor.
+# You may override the interface filtering in devdiscover-siteconfig.pl:
+# redefine $Torrus::DevDiscover::Xylan::interfaceFilter
+# or define $Torrus::DevDiscover::Xylan::interfaceFilterOverlay
+
+our $interfaceFilter;
+our $interfaceFilterOverlay;
+my %xylInterfaceFilter;
+
+if( not defined( $interfaceFilter ) )
+{
+    $interfaceFilter = \%xylInterfaceFilter;
+}
+
+
+# Key is some unique symbolic name, does not mean anything
+# ifType is the number to match the interface type
+# ifDescr is the regexp to match the interface description
+%xylInterfaceFilter =
+    (
+     'vnN' => {
+         'ifType'  => 53                     # propVirtual
+         },
+     'loN' => {
+         'ifType'  => 24                     # softwareLoopback
+         }
+     );
+
+sub checkdevtype
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    if( not $dd->oidBaseMatch
+        ( 'xylanSwitchDevice',
+          $devdetails->snmpVar( $dd->oiddef('sysObjectID') ) ) )
+    {
+        return 0;
+    }
+
+    &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+        ($devdetails, $interfaceFilter);
+
+    if( defined( $interfaceFilterOverlay ) )
+    {
+        &Torrus::DevDiscover::RFC2863_IF_MIB::addInterfaceFilter
+            ($devdetails, $interfaceFilterOverlay);
+    }
+
+    $devdetails->setCap('interfaceIndexingPersistent');
+
+    return 1;
+}
+
+
+sub discover
+{
+    my $dd = shift;
+    my $devdetails = shift;
+
+    my $data = $devdetails->data();
+    my $session = $dd->session();
+
+    $data->{'nameref'}{'ifNick'}        = 'xylanInterfaceNick';
+    $data->{'nameref'}{'ifSubtreeName'} = 'xylanInterfaceNick';
+    $data->{'nameref'}{'ifComment'}     = 'xylanInterfaceComment';
+    $data->{'nameref'}{'ifReferenceName'}   = 'xylanInterfaceHumanName';
+    
+    my $phyPortTable =
+        $session->get_table( -baseoid => $dd->oiddef('xylanPhyPortTable') );
+
+    if( not defined $phyPortTable )
+    {
+        Error('Error retrieving PORT-MIB::phyPortTable from Xylan device');
+        return 0;
+    }
+
+    $devdetails->storeSnmpVars( $phyPortTable );
+
+    foreach my $slotDotPort
+        ( $devdetails->
+          getSnmpIndices( $dd->oiddef('xylanPhyPortDescription') ) )
+    {
+        my ( $slot, $port ) = split( '\.', $slotDotPort );
+
+        my $ifIndex =
+            $devdetails->snmpVar($dd->oiddef('xylanPhyPortToInterface') .
+                                 '.' . $slotDotPort);
+        my $interface = $data->{'interfaces'}{$ifIndex};
+
+        if( defined $interface )
+        {
+            $interface->{'xylanInterfaceNick'} =
+                sprintf( '%d_%d', $slot, $port );
+
+            $interface->{'xylanInterfaceHumanName'} =
+                sprintf( '%d/%d', $slot, $port );
+
+            $interface->{'xylanInterfaceComment'} =
+                $devdetails->snmpVar($dd->oiddef('xylanPhyPortDescription') .
+                                     '.' . $slotDotPort);
+        }
+    }
+
+    # verify if all interfaces are processed
+
+    foreach my $ifIndex ( keys %{$data->{'interfaces'}} )
+    {
+        my $interface = $data->{'interfaces'}{$ifIndex};
+
+        if( not defined( $interface->{'xylanInterfaceNick'} ) )
+        {
+            Warn('Interface ' . $ifIndex . ' is not in phyPortTable');
+
+            my $nick = sprintf( 'PORT%d', $ifIndex );
+            $interface->{'xylanInterfaceNick'} = $nick;
+            $interface->{'xylanInterfaceHumanName'} = $nick;
+
+            $interface->{'xylanInterfaceComment'} = $interface->{'ifDescr'};
+        }
+    }
+
+    return 1;
+}
+
+
+sub buildConfig
+{
+    my $devdetails = shift;
+    my $cb = shift;
+    my $devNode = shift;
+
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Log.pm b/torrus/perllib/Torrus/Log.pm
new file mode 100644 (file)
index 0000000..3c2c824
--- /dev/null
@@ -0,0 +1,136 @@
+#    This file was initially taken from Cricket, and reworked later
+#
+#    Copyright (C) 1998 Jeff R. Allen and WebTV Networks, Inc.
+#    Copyright (C) 2002  Stanislav Sinyagin
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program; if not, write to the Free Software
+#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Log.pm,v 1.1 2010-12-27 00:03:43 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# 2002/06/25 11:35:00  ssinyagin
+# Taken from Cricket lib/Common/Log.pm
+#
+# 2004/06/25 ssinyagin
+# Finally reworked in 2 years!
+#
+
+package Torrus::Log;
+
+use strict;
+
+require Exporter;
+our @ISA = qw(Exporter);
+
+our @EXPORT = qw(Debug Warn Info Error Verbose isDebug);
+
+my @monthNames = ( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul',
+                   'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
+
+my %logLevel = (
+                'debug'    => 9,
+                'verbose'  => 8,
+                'info'     => 7,
+                'warn'     => 5,
+                'error'    => 1 );
+
+my $currentLogLevel = $logLevel{'info'};
+
+sub Log
+{
+    my( $level, @msg ) = @_;    
+
+    $level = $logLevel{$level};
+    
+    if( $level <= $currentLogLevel )
+    {
+        my $severity = ( $level <= $logLevel{'warn'} ) ? '*' : ' ';
+        printf STDERR ( "[%s%s] %s\n",
+                        timeStr( time() ), $severity, join( '', @msg ) );
+    }
+    return undef;
+}
+
+
+sub Error
+{
+    Log( 'error', @_ );
+}
+
+sub Warn
+{
+    Log( 'warn', @_);
+}
+
+sub Info
+{
+    Log( 'info', @_ );
+}
+
+sub Verbose
+{
+    Log( 'verbose', @_ );
+}
+
+our $TID = 0;
+sub setTID
+{
+    $TID = shift;
+}
+
+sub Debug
+{
+    Log( 'debug', $$ . '.' . $TID . ' ', join('|', @_) );
+}
+
+
+sub isDebug
+{
+    return $currentLogLevel >= $logLevel{'debug'};
+}
+
+sub timeStr
+{
+    my $t = shift;
+    
+    my( $sec, $min, $hour, $mday, $mon, $year) = localtime( $t );
+    
+    return sprintf('%02d-%s-%04d %02d:%02d:%02d',
+                   $mday, $monthNames[$mon], $year + 1900, $hour, $min, $sec);
+}
+
+sub setLevel
+{
+    my $level = lc( shift );
+
+    if( defined( $logLevel{$level} ) )
+    {
+        $currentLogLevel = $logLevel{$level};
+    }
+    else
+    {
+        Error("Log level name '$level' unknown. Defaulting to 'info'");
+        $currentLogLevel = $logLevel{'info'};
+    }
+}
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# tab-width: 4
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Monitor.pm b/torrus/perllib/Torrus/Monitor.pm
new file mode 100644 (file)
index 0000000..72e5c24
--- /dev/null
@@ -0,0 +1,700 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Monitor.pm,v 1.1 2010-12-27 00:03:37 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+package Torrus::Monitor;
+@Torrus::Monitor::ISA = qw(Torrus::Scheduler::PeriodicTask);
+
+use strict;
+
+use Torrus::DB;
+use Torrus::ConfigTree;
+use Torrus::Scheduler;
+use Torrus::DataAccess;
+use Torrus::TimeStamp;
+use Torrus::Log;
+
+
+sub new
+{
+    my $proto = shift;
+    my %options = @_;
+
+    if( not $options{'-Name'} )
+    {
+        $options{'-Name'} = "Monitor";
+    }
+
+    my $class = ref($proto) || $proto;
+    my $self  = $class->SUPER::new( %options );
+    bless $self, $class;
+
+
+    $self->{'tree_name'} = $options{'-TreeName'};
+    $self->{'sched_data'} = $options{'-SchedData'};
+    $self->{'delay'} = $options{'-Delay'} * 60;
+    
+    return $self;
+}
+
+
+sub addTarget
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+
+    if( not defined( $self->{'targets'} ) )
+    {
+        $self->{'targets'} = [];
+    }
+    push( @{$self->{'targets'}}, $token );
+}
+
+
+
+
+sub run
+{
+    my $self = shift;
+    
+    my $config_tree =
+        new Torrus::ConfigTree( -TreeName => $self->{'tree_name'},
+                                -Wait => 1 );
+    if( not defined( $config_tree ) )
+    {
+        return;
+    }
+
+    my $da = new Torrus::DataAccess;
+    
+    $self->{'db_alarms'} = new Torrus::DB('monitor_alarms',
+                                          -Subdir => $self->{'tree_name'},
+                                          -WriteAccess => 1);
+
+    foreach my $token ( @{$self->{'targets'}} )
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        my $mlist = $self->{'sched_data'}{'mlist'}{$token};
+        
+        foreach my $mname ( @{$mlist} )
+        {
+            my $obj = { 'token' => $token, 'mname' => $mname };
+
+            $obj->{'da'} = $da;
+            
+            my $mtype = $config_tree->getParam($mname, 'monitor-type');
+            $obj->{'mtype'} = $mtype;
+            
+            my $method = 'check_' . $mtype;
+            my( $alarm, $timestamp ) = $self->$method( $config_tree, $obj );
+            $obj->{'alarm'} = $alarm;
+            $obj->{'timestamp'} = $timestamp;
+            
+            Debug("Monitor $mname returned ($alarm, $timestamp) ".
+                  "for token $token");
+            
+            $self->setAlarm( $config_tree, $obj );
+            undef $obj;
+        }
+    }
+
+    $self->cleanupExpired();
+    
+    undef $self->{'db_alarms'};
+}
+
+
+sub check_failures
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $obj = shift;
+
+    my $token = $obj->{'token'};
+    my $file = $config_tree->getNodeParam( $token, 'data-file' );
+    my $dir = $config_tree->getNodeParam( $token, 'data-dir' );
+    my $ds = $config_tree->getNodeParam( $token, 'rrd-ds' );
+
+    my ($value, $timestamp) = $obj->{'da'}->read_RRD_DS( $dir.'/'.$file,
+                                                         'FAILURES', $ds );
+    return( $value > 0 ? 1:0, $timestamp );
+
+}
+
+
+sub check_expression
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $obj = shift;
+
+    my $token = $obj->{'token'};
+    my $mname = $obj->{'mname'};
+
+    my ($value, $timestamp) = $obj->{'da'}->read( $config_tree, $token );
+    $value = 'UNKN' unless defined($value);
+    
+    my $expr = $value . ',' . $config_tree->getParam($mname,'rpn-expr');
+    $expr = $self->substitute_vars( $config_tree, $obj, $expr );
+
+    my $display_expr = $config_tree->getParam($mname,'display-rpn-expr');
+    if( defined( $display_expr ) )
+    {
+        $display_expr =
+            $self->substitute_vars( $config_tree, $obj,
+                                    $value . ',' . $display_expr );
+        my ($dv, $dt) = $obj->{'da'}->read_RPN( $config_tree, $token,
+                                                $display_expr, $timestamp );
+        $obj->{'display_value'} = $dv;
+    }
+    else
+    {
+        $obj->{'display_value'} = $value;
+    }
+    
+    return $obj->{'da'}->read_RPN( $config_tree, $token, $expr, $timestamp );
+}
+
+
+sub substitute_vars
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $obj = shift;
+    my $expr = shift;
+    
+    my $token = $obj->{'token'};
+    my $mname = $obj->{'mname'};
+
+    if( index( $expr, '#' ) >= 0 )
+    {
+        my $vars;
+        if( exists( $self->{'varscache'}{$token} ) )
+        {
+            $vars = $self->{'varscache'}{$token};
+        }
+        else
+        {
+            my $varstring =
+                $config_tree->getNodeParam( $token, 'monitor-vars' );
+            foreach my $pair ( split( '\s*;\s*', $varstring ) )
+            {
+                my( $var, $value ) = split( '\s*\=\s*', $pair );
+                $vars->{$var} = $value;
+            }
+            $self->{'varscache'}{$token} = $vars;
+        }
+
+        my $ok = 1;
+        while( index( $expr, '#' ) >= 0 and $ok )
+        {
+            if( not $expr =~ /\#(\w+)/ )
+            {
+                Error("Error in monitor expression: $expr for monitor $mname");
+                $ok = 0;
+            }
+            else
+            {
+                my $var = $1;
+                my $val = $vars->{$var};
+                if( not defined $val )
+                {
+                    Error("Unknown variable $var in monitor $mname");
+                    $ok = 0;
+                }
+                else
+                {
+                    $expr =~ s/\#$var/$val$1/g;
+                }
+            }
+        }
+
+    }
+
+    return $expr;
+}
+    
+
+
+sub setAlarm
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $obj = shift;
+
+    my $token = $obj->{'token'};
+    my $mname = $obj->{'mname'};
+    my $alarm = $obj->{'alarm'};
+    my $timestamp = $obj->{'timestamp'};
+
+    my $key = $mname . ':' . $config_tree->path($token);
+    
+    my $prev_values = $self->{'db_alarms'}->get( $key );
+    my ($t_set, $t_expires, $prev_status, $t_last_change);
+    if( defined($prev_values) )
+    {
+        Debug("Previous state found, Alarm: $alarm, ".
+              "Token: $token, Monitor: $mname");
+        ($t_set, $t_expires, $prev_status, $t_last_change) =
+            split(':', $prev_values);
+    }
+
+    my $event;
+
+    $t_last_change = time();
+    
+    if( $alarm )
+    {
+        if( not $prev_status )
+        {
+            $t_set = $timestamp;
+            $event = 'set';
+        }
+        else
+        {
+            $event = 'repeat';
+        }
+    }
+    else
+    {
+        if( $prev_status )
+        {
+            $t_expires = $t_last_change +
+                $config_tree->getParam($mname, 'expires');
+            $event = 'clear';
+        }
+        else
+        {
+            if( defined($t_expires) and time() > $t_expires )
+            {
+                $self->{'db_alarms'}->del( $key );
+                $event = 'forget';
+            }
+        }
+    }
+
+    if( $event )
+    {
+        Debug("Event: $event, Monitor: $mname, Token: $token");
+        $obj->{'event'} = $event;
+        
+        my $action_token = $token;
+        
+        my $action_target =
+            $config_tree->getNodeParam($token, 'monitor-action-target');
+        if( defined( $action_target ) )
+        {
+            Debug('Action target redirected to ' . $action_target);
+            $action_token = $config_tree->getRelative($token, $action_target);
+            Debug('Redirected to token ' . $action_token);
+        }
+        $obj->{'action_token'} = $action_token;
+
+        foreach my $aname (split(',',
+                                 $config_tree->getParam($mname, 'action')))
+        {
+            &Torrus::DB::checkInterrupted();
+            
+            Debug("Running action: $aname");
+            my $method = 'run_event_' .
+                $config_tree->getParam($aname, 'action-type');
+            $self->$method( $config_tree, $aname, $obj );
+        }
+
+        if( $event ne 'forget' )
+        {
+            $self->{'db_alarms'}->put( $key,
+                                       join(':', ($t_set,
+                                                  $t_expires,
+                                                  ($alarm ? 1:0),
+                                                  $t_last_change)) );
+        }
+    }
+}
+
+
+# If an alarm is no longer in ConfigTree, it is not cleaned by setAlarm.
+# We clean them up explicitly after they expire
+
+sub cleanupExpired
+{
+    my $self = shift;
+
+    &Torrus::DB::checkInterrupted();
+    
+    my $cursor = $self->{'db_alarms'}->cursor(-Write => 1);
+    while( my ($key, $timers) = $self->{'db_alarms'}->next($cursor) )
+    {
+        my ($t_set, $t_expires, $prev_status, $t_last_change) =
+            split(':', $timers);
+        
+        if( $t_last_change and
+            time() > ( $t_last_change + $Torrus::Monitor::alarmTimeout ) and
+            ( (not $t_expires) or (time() > $t_expires) ) )
+        {            
+            my ($mname, $path) = split(':', $key);
+            
+            Info('Cleaned up an orphaned alarm: monitor=' . $mname .
+                 ', path=' . $path);
+            $self->{'db_alarms'}->c_del( $cursor );            
+        }
+    }
+    undef $cursor;
+    
+    &Torrus::DB::checkInterrupted();
+}
+    
+
+
+    
+
+sub run_event_tset
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $aname = shift;
+    my $obj = shift;
+
+    my $token = $obj->{'action_token'};
+    my $event = $obj->{'event'};
+    
+    if( $event eq 'set' or $event eq 'forget' )
+    {
+        my $tset = 'S'.$config_tree->getParam($aname, 'tset-name');
+
+        if( $event eq 'set' )
+        {
+            $config_tree->tsetAddMember($tset, $token, 'monitor');
+        }
+        else
+        {
+            $config_tree->tsetDelMember($tset, $token);
+        }
+    }
+}
+
+
+sub run_event_exec
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $aname = shift;
+    my $obj = shift;
+
+    my $token = $obj->{'action_token'};
+    my $event = $obj->{'event'};
+    my $mname = $obj->{'mname'};
+    my $timestamp = $obj->{'timestamp'};
+
+    my $launch_when = $config_tree->getParam($aname, 'launch-when');
+    if( not defined $launch_when )
+    {
+        $launch_when = 'set';
+    }
+
+    if( grep {$event eq $_} split(',', $launch_when) )
+    {
+        my $cmd = $config_tree->getParam($aname, 'command');
+        $cmd =~ s/\&gt\;/\>/;
+        $cmd =~ s/\&lt\;/\</;
+
+        $ENV{'TORRUS_BIN'}       = $Torrus::Global::pkgbindir;
+        $ENV{'TORRUS_UPTIME'}    = time() - $self->whenStarted();
+
+        $ENV{'TORRUS_TREE'}      = $config_tree->treeName();
+        $ENV{'TORRUS_TOKEN'}     = $token;
+        $ENV{'TORRUS_NODEPATH'}  = $config_tree->path( $token );
+
+        my $nick =
+            $config_tree->getNodeParam( $token, 'descriptive-nickname' );
+        if( not defined( $nick ) )
+        {
+            $nick = $ENV{'TORRUS_NODEPATH'};
+        }
+        $ENV{'TORRUS_NICKNAME'} = $nick;
+        
+        $ENV{'TORRUS_NCOMMENT'}  =
+            $config_tree->getNodeParam( $token, 'comment', 1 );
+        $ENV{'TORRUS_NPCOMMENT'} =
+            $config_tree->getNodeParam( $config_tree->getParent( $token ),
+                                        'comment', 1 );
+        $ENV{'TORRUS_EVENT'}     = $event;
+        $ENV{'TORRUS_MONITOR'}   = $mname;
+        $ENV{'TORRUS_MCOMMENT'}  = $config_tree->getParam($mname, 'comment');
+        $ENV{'TORRUS_TSTAMP'}    = $timestamp;
+
+        if( defined( $obj->{'display_value'} ) )
+        {
+            $ENV{'TORRUS_VALUE'} = $obj->{'display_value'};
+
+            my $format = $config_tree->getParam($mname, 'display-format');
+            if( not defined( $format ) )
+            {
+                $format = '%.2f';
+            }
+
+            $ENV{'TORRUS_DISPLAY_VALUE'} =
+                sprintf( $format, $obj->{'display_value'} );
+        }
+
+        my $severity = $config_tree->getParam($mname, 'severity');
+        if( defined( $severity ) )
+        {
+            $ENV{'TORRUS_SEVERITY'} = $severity;
+        }
+        
+        my $setenv_params =
+            $config_tree->getParam($aname, 'setenv-params');
+
+        if( defined( $setenv_params ) )
+        {
+            foreach my $param ( split( ',', $setenv_params ) )
+            {
+                # We retrieve the param from the monitored token, not
+                # from action-token
+                my $value = $config_tree->getNodeParam( $obj->{'token'},
+                                                        $param );
+                if( not defined $value )
+                {
+                    Warn('Parameter ' . $param . ' referenced in action '.
+                         $aname . ', but not defined for ' .
+                         $config_tree->path($obj->{'token'}));
+                    $value = '';
+                }
+                $param =~ s/\W/_/g;
+                my $envName = 'TORRUS_P_'.$param;
+                Debug("Setting environment $envName to $value");
+                $ENV{$envName} = $value;
+            }
+        }
+
+        my $setenv_dataexpr =
+            $config_tree->getParam($aname, 'setenv-dataexpr');
+
+        if( defined( $setenv_dataexpr ) )
+        {
+            # <param name="setenv_dataexpr" value="ENV1=expr1, ENV2=expr2"/>
+            # Integrity checks are done at compilation time.
+            foreach my $pair ( split( ',', $setenv_dataexpr ) )
+            {
+                my ($env, $param) = split( '=', $pair );
+                my $expr = $config_tree->getParam($aname, $param);
+                my ($value, $timestamp) =
+                    $obj->{'da'}->read_RPN( $config_tree, $token, $expr );
+                my $envName = 'TORRUS_'.$env;
+                Debug("Setting environment $envName to $value");
+                $ENV{$envName} = $value;
+            }
+        }
+
+        Debug("Going to run command: $cmd");
+        my $status = system($cmd);
+        if( $status != 0 )
+        {
+            Error("$cmd executed with error: $!");
+        }
+
+        # Clean up the environment
+        foreach my $envName ( keys %ENV )
+        {
+            if( $envName =~ /^TORRUS_/ )
+            {
+                delete $ENV{$envName};
+            }
+        }
+    }
+}
+
+
+
+#######  Monitor scheduler  ########
+
+package Torrus::MonitorScheduler;
+@Torrus::MonitorScheduler::ISA = qw(Torrus::Scheduler);
+
+use Torrus::ConfigTree;
+use Torrus::Log;
+use Torrus::Scheduler;
+use Torrus::TimeStamp;
+
+sub beforeRun
+{
+    my $self = shift;
+
+    my $tree = $self->treeName();
+    my $config_tree = new Torrus::ConfigTree(-TreeName => $tree, -Wait => 1);
+    if( not defined( $config_tree ) )
+    {
+        return undef;
+    }
+
+    my $data = $self->data();
+
+    # Prepare the list of tokens, sorted by period and offset,
+    # from config tree or from cache.
+
+    my $need_new_tasks = 0;
+
+    Torrus::TimeStamp::init();
+    my $known_ts = Torrus::TimeStamp::get($tree . ':monitor_cache');
+    my $actual_ts = $config_tree->getTimestamp();
+    if( $actual_ts >= $known_ts )
+    {
+        if( $self->{'delay'} > 0 )
+        {
+            Info(sprintf('Delaying for %d seconds', $self->{'delay'}));
+            sleep( $self->{'delay'} );
+        }
+
+        Info("Rebuilding monitor cache");
+        Debug("Config TS: $actual_ts, Monitor TS: $known_ts");
+
+        undef $data->{'targets'};
+        $need_new_tasks = 1;
+
+        $data->{'db_tokens'} = new Torrus::DB( 'monitor_tokens',
+                                               -Subdir => $tree,
+                                               -WriteAccess => 1,
+                                               -Truncate    => 1 );
+        $self->cacheMonitors( $config_tree, $config_tree->token('/') );
+        # explicitly close, since we don't need it often, and sometimes
+        # open it in read-only mode
+        $data->{'db_tokens'}->closeNow();
+        undef $data->{'db_tokens'};
+
+        # Set the timestamp
+        &Torrus::TimeStamp::setNow($tree . ':monitor_cache');
+    }
+    Torrus::TimeStamp::release();
+
+    &Torrus::DB::checkInterrupted();
+
+    if( not $need_new_tasks and not defined $data->{'targets'} )
+    {
+        $need_new_tasks = 1;
+
+        $data->{'db_tokens'} = new Torrus::DB('monitor_tokens',
+                                              -Subdir => $tree);
+        my $cursor = $data->{'db_tokens'}->cursor();
+        while( my ($token, $schedule) = $data->{'db_tokens'}->next($cursor) )
+        {
+            my ($period, $offset, $mlist) = split(':', $schedule);
+            if( not exists( $data->{'targets'}{$period}{$offset} ) )
+            {
+                $data->{'targets'}{$period}{$offset} = [];
+            }
+            push( @{$data->{'targets'}{$period}{$offset}}, $token );
+            $data->{'mlist'}{$token} = [];
+            push( @{$data->{'mlist'}{$token}}, split(',', $mlist) );
+        }
+        undef $cursor;
+        $data->{'db_tokens'}->closeNow();
+        undef $data->{'db_tokens'};
+    }
+
+    &Torrus::DB::checkInterrupted();
+
+    # Now fill in Scheduler's task list, if needed
+
+    if( $need_new_tasks )
+    {
+        Verbose("Initializing tasks");
+        my $init_start = time();
+        $self->flushTasks();
+
+        foreach my $period ( keys %{$data->{'targets'}} )
+        {
+            foreach my $offset ( keys %{$data->{'targets'}{$period}} )
+            {
+                my $monitor = new Torrus::Monitor( -Period => $period,
+                                                   -Offset => $offset,
+                                                   -TreeName => $tree,
+                                                   -SchedData => $data );
+
+                foreach my $token ( @{$data->{'targets'}{$period}{$offset}} )
+                {
+                    &Torrus::DB::checkInterrupted();
+                    
+                    $monitor->addTarget( $config_tree, $token );
+                }
+
+                $self->addTask( $monitor );
+            }
+        }
+        Verbose(sprintf("Tasks initialization finished in %d seconds",
+                        time() - $init_start));
+    }
+
+    Verbose("Monitor initialized");
+
+    return 1;
+}
+
+
+sub cacheMonitors
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $ptoken = shift;
+
+    my $data = $self->data();
+
+    foreach my $ctoken ( $config_tree->getChildren( $ptoken ) )
+    {
+        &Torrus::DB::checkInterrupted();
+
+        if( $config_tree->isSubtree( $ctoken ) )
+        {
+            $self->cacheMonitors( $config_tree, $ctoken );
+        }
+        elsif( $config_tree->isLeaf( $ctoken ) and
+               ( $config_tree->getNodeParam($ctoken, 'ds-type') ne
+                 'rrd-multigraph') )
+        {
+            my $mlist = $config_tree->getNodeParam( $ctoken, 'monitor' );
+            if( defined $mlist )
+            {
+                my $period = sprintf('%d',
+                                     $config_tree->getNodeParam
+                                     ( $ctoken, 'monitor-period' ) );
+                my $offset = sprintf('%d',
+                                     $config_tree->getNodeParam
+                                     ( $ctoken, 'monitor-timeoffset' ) );
+                
+                $data->{'db_tokens'}->put( $ctoken,
+                                           $period.':'.$offset.':'.$mlist );
+                
+                push( @{$data->{'targets'}{$period}{$offset}}, $ctoken );
+                $data->{'mlist'}{$ctoken} = [];
+                push( @{$data->{'mlist'}{$ctoken}}, split(',', $mlist) );
+            }
+        }
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/RPN.pm b/torrus/perllib/Torrus/RPN.pm
new file mode 100644 (file)
index 0000000..20fe15a
--- /dev/null
@@ -0,0 +1,213 @@
+#
+#    Copyright (C) 1998 Jeff R. Allen and WebTV Networks, Inc.
+#    Copyright (C) 2002  Stanislav Sinyagin
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program; if not, write to the Free Software
+#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: RPN.pm,v 1.1 2010-12-27 00:03:40 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# a simple little RPN calculator -- implements the same operations
+# that RRDTool does.
+
+# This file is based on Cricket's RPM.pm
+
+package Torrus::RPN;
+
+use strict;
+
+use Torrus::Log;
+use Math::BigFloat;
+
+# Each RPN operator is defined by an array reference with the
+# following  elements: <number of args>, <subroutine>, <accepts undef>
+
+my $operators = {
+    '+' => [ 2, sub{ $_[0] + $_[1]; } ],
+    '-' => [ 2, sub{ $_[0] - $_[1]; } ],
+    '*' => [ 2, sub{ $_[0] * $_[1]; } ],
+    '/' => [ 2, sub{ $_[0] / $_[1]; } ],
+    '%' => [ 2, sub{ $_[0] % $_[1]; } ],
+    'MOD' => [ 2, sub{ $_[0] % $_[1]; } ],
+    'SIN' => [ 1, sub{ sin($_[0]->bsstr()); } ],
+    'COS' => [ 1, sub{ cos($_[0]->bsstr()); } ],
+    'LOG' => [ 1, sub{ log($_[0]); } ],
+    'EXP' => [ 1, sub{ $_[0]->exponent() } ],
+    'FLOOR' => [ 1, sub{ $_[0]->bfloor(); } ],
+    'CEIL' => [ 1, sub{ $_[0]->bceil(); } ],
+    'LT' => [ 2, sub{ ($_[0] <  $_[1]) ? 1:0; } ],
+    'LE' => [ 2, sub{ ($_[0] <= $_[1]) ? 1:0; } ],
+    'GT' => [ 2, sub{ ($_[0] >  $_[1]) ? 1:0; } ],
+    'GE' => [ 2, sub{ ($_[0] >= $_[1]) ? 1:0; } ],
+    'EQ' => [ 2, sub{ ($_[0] == $_[1]) ? 1:0; } ],
+    'IF' => [ 3, sub{ defined($_[0]) ? ($_[0] ? $_[1] : $_[2]) : undef; }, 1],
+    'MIN' => [ 2, sub{ ($_[0] <  $_[1]) ? $_[0] : $_[1]; } ],
+    'MAX' => [ 2, sub{ ($_[0] >  $_[1]) ? $_[0] : $_[1]; } ],
+    'UN'   => [ 1, sub{ defined($_[0]) ? $_[0]->is_nan() : 1; }, 1 ],
+    'UNKN' => [ 0, sub{ undef; } ],
+    # Operators not defined in RRDtool graph
+    'NE'  => [ 2, sub{ ($_[0] != $_[1]) ? 1:0; } ],
+    'AND' => [ 2, sub{ ($_[0] and $_[1]) ? 1:0; } ],
+    'OR'  => [ 2, sub{ ($_[0] or $_[1]) ? 1:0; } ],
+    'NOT' => [ 1, sub{ (not $_[0]) ? 1:0; } ],
+    'ABS' => [ 1, sub{ abs($_[0]); } ],
+    'NOW' => [ 0, sub{ time(); } ],
+    'DUP' => [ 1, sub{ ($_[0], $_[0]);}, 1 ],
+    'EXC' => [ 2, sub{ ($_[1], $_[0]); }, 1 ],
+    'NUM' => [ 1, sub{ defined($_[0]) ? $_[0] : 0; }, 1 ],
+    'INF' => [ 0, sub{ Math::BigFloat->binf(); } ],
+    'NEGINF' => [ 0, sub{ Math::BigFloat->binf('-'); } ]
+    };
+
+
+sub new
+{
+    my $type = shift;
+    my $self = {};
+    bless( $self, $type );
+    $self->{'stack'} = [];
+    return $self;
+}
+
+
+sub operator
+{
+    my $self = shift;
+    my $op = shift;
+
+    my $n_args           = $operators->{$op}->[0];
+    my $action           = $operators->{$op}->[1];
+    my $acceptsUndefined = $operators->{$op}->[2];
+    my @args = ();
+    my $allDefined = 1;
+    for( my $i = 0; $i < $n_args; $i++ )
+    {
+        my $arg = $self->popStack();
+        if( defined( $arg ) or $acceptsUndefined )
+        {
+            push( @args, $arg );
+        }
+        else
+        {
+            $allDefined = 0;
+        }
+    }
+    $self->pushStack( $allDefined ? &{$action}(reverse @args) : undef );
+}
+
+
+sub popStack
+{
+    my $self = shift;
+
+    my $ret;
+    if( scalar( @{$self->{'stack'}} ) == 0 )
+    {
+        Warn("Stack underflow");
+    }
+    else
+    {
+        $ret = pop( @{$self->{'stack'}} );
+    }
+    return $ret;
+}
+
+
+sub pushStack
+{
+    my $self = shift;
+    my @items = @_;
+
+    push( @{$self->{'stack'}}, @items );
+}
+
+
+sub translate
+{
+    my $self = shift;
+    my $string = shift;
+    my $callback = shift;
+
+    # Debug("Translating RPN: $string");
+    my $item;
+    my @new_items;
+    foreach $item ( split( /,/, $string ) )
+    {
+        if( $item =~ /^\{([^\}]*)\}$/ )
+        {
+            my $noderef = $1;
+            my $timeoffset;
+            if( $noderef =~ s/\(([^\)]+)\)// )
+            {
+               $timeoffset = $1;
+            }
+            my $value = &{$callback}( $noderef, $timeoffset );
+            $value = 'UNKN' unless defined( $value );
+            # Debug("$item translated into $value");
+            $item = $value;
+        }
+        elsif( $item eq 'MOD' )
+        {
+            # In Torrus parameter value, percent sign is reserved for
+            # parameter expansion. Rrdtool understands % only.
+            $item = '%';
+        }
+        push( @new_items, $item );
+    }
+
+    $string = join( ',', @new_items );
+    # Debug("RPN translated: $string");
+    return $string;
+}
+
+
+sub run
+{
+    my $self = shift;
+    my $string = shift;
+    my $callback = shift;
+
+    # Debug("Input RPN: $string");
+
+    if( index( $string, '{' ) >= 0 )
+    {
+        $string = $self->translate( $string, $callback );
+    }
+
+    my $item;
+    foreach $item ( split( /,/, $string ) )
+    {
+        if( ref( $operators->{$item} ) )
+        {
+            $self->operator($item);
+        }
+        else
+        {
+            $self->pushStack( Math::BigFloat->new($item) );
+        }
+    }
+    
+    my $retval = $self->popStack();
+    # Debug("RPN result: $retval");
+    return $retval;
+}
+
+1;
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Renderer.pm b/torrus/perllib/Torrus/Renderer.pm
new file mode 100644 (file)
index 0000000..803dd18
--- /dev/null
@@ -0,0 +1,286 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Renderer.pm,v 1.1 2010-12-27 00:03:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+package Torrus::Renderer;
+
+use strict;
+use Digest::MD5 qw(md5_hex);
+
+use Torrus::DB;
+use Torrus::ConfigTree;
+use Torrus::TimeStamp;
+use Torrus::RPN;
+use Torrus::Log;
+use Torrus::SiteConfig;
+
+use Torrus::Renderer::HTML;
+use Torrus::Renderer::RRDtool;
+
+# Inherit methods from these modules
+use base qw(Torrus::Renderer::HTML
+            Torrus::Renderer::RRDtool
+            Torrus::Renderer::Frontpage
+            Torrus::Renderer::AdmInfo);
+
+sub new
+{
+    my $self = {};
+    my $class = shift;
+    bless $self, $class;
+
+    if( not defined $Torrus::Global::cacheDir )
+    {
+        Error('$Torrus::Global::cacheDir must be defined');
+        return undef;
+    }
+    elsif( not -d $Torrus::Global::cacheDir )
+    {
+        Error("No such directory: $Torrus::Global::cacheDir");
+        return undef;
+    }
+
+    $self->{'db'} = new Torrus::DB('render_cache', -WriteAccess => 1);
+    if( not defined( $self->{'db'} ) )
+    {
+        return undef;
+    }
+
+    srand( time() * $$ );
+    
+    return $self;
+}
+
+
+# Returns the absolute filename and MIME type:
+#
+# my($fname, $mimetype) = $renderer->render($config_tree, $token, $view);
+#
+
+sub render
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+    my %new_options = @_;
+
+    # If no options given, preserve the existing ones
+    if( %new_options )
+    {
+        $self->{'options'} = \%new_options;
+    }
+
+    $self->checkAndClearCache( $config_tree );
+
+    my($t_render, $t_expires, $filename, $mime_type);
+
+    my $tree = $config_tree->treeName();
+
+    if( not $config_tree->isTset($token) )
+    {
+        if( my $alias = $config_tree->isAlias($token) )
+        {
+            $token = $alias;
+        }
+        if( not defined( $config_tree->path($token) ) )
+        {
+            Error("No such token: $token");
+            return undef;
+        }
+    }
+
+    $view = $config_tree->getDefaultView($token) unless defined $view;
+
+    my $uid = '';
+    if( $self->{'options'}->{'uid'} )
+    {
+        $uid = $self->{'options'}->{'uid'};
+    }
+
+    my $cachekey = $self->cacheKey( $uid . ':' . $tree . ':' .
+                                    $token . ':' . $view );
+
+    ($t_render, $t_expires, $filename, $mime_type) =
+        $self->getCache( $cachekey );
+
+    my $not_in_cache = 0;
+    
+    if( not defined( $filename ) )
+    {
+        $filename = Torrus::Renderer::newCacheFileName( $cachekey );
+        $not_in_cache = 1;
+    }
+
+    my $cachefile = $Torrus::Global::cacheDir.'/'.$filename;
+
+    if( ( not $not_in_cache ) and
+        -f $cachefile and
+        $t_expires >= time() )
+    {
+        return ($cachefile, $mime_type, $t_expires - time());
+    }
+
+    my $method = 'render_' . $config_tree->getParam($view, 'view-type');
+
+    ($t_expires, $mime_type) =
+        $self->$method( $config_tree, $token, $view, $cachefile );
+
+    if( %new_options )
+    {
+        $self->{'options'} = undef;
+    }
+
+    my @ret;
+    if( defined($t_expires) and defined($mime_type) )
+    {
+        $self->setCache($cachekey, time(), $t_expires, $filename, $mime_type);
+        @ret = ($cachefile, $mime_type, $t_expires - time());
+    }
+
+    return @ret;
+}
+
+
+sub cacheKey
+{
+    my $self = shift;
+    my $keystring = shift;
+
+    if( ref( $self->{'options'}->{'variables'} ) )
+    {
+        foreach my $name ( sort keys %{$self->{'options'}->{'variables'}} )
+        {
+            my $val = $self->{'options'}->{'variables'}->{$name};
+            $keystring .= ':' . $name . '=' . $val;
+        }
+    }
+    return $keystring;
+}
+
+
+sub getCache
+{
+    my $self = shift;
+    my $keystring = shift;
+
+    my $cacheval = $self->{'db'}->get( $keystring );
+
+    if( defined($cacheval) )
+    {
+        return split(':', $cacheval);
+    }
+    else
+    {
+        return undef;
+    }
+}
+
+
+sub setCache
+{
+    my $self = shift;
+    my $keystring = shift;
+    my $t_render = shift;
+    my $t_expires = shift;
+    my $filename = shift;
+    my $mime_type = shift;
+
+    $self->{'db'}->put( $keystring,
+                        join(':',
+                             ($t_render, $t_expires, $filename, $mime_type)));
+}
+
+
+
+sub checkAndClearCache
+{
+    my $self = shift;
+    my $config_tree = shift;
+
+    my $tree = $config_tree->treeName();
+
+    Torrus::TimeStamp::init();
+    my $known_ts = Torrus::TimeStamp::get($tree . ':renderer_cache');
+    my $actual_ts = $config_tree->getTimestamp();
+    if( $actual_ts >= $known_ts or
+        time() >= $known_ts + $Torrus::Renderer::cacheMaxAge )
+    {
+        $self->clearcache();
+        Torrus::TimeStamp::setNow($tree . ':renderer_cache');
+    }
+    Torrus::TimeStamp::release();
+}
+
+
+sub clearcache
+{
+    my $self = shift;
+
+    Debug('Clearing renderer cache');
+    my $cursor = $self->{'db'}->cursor( -Write => 1 );
+    while( my ($key, $val) = $self->{'db'}->next( $cursor ) )
+    {
+        my($t_render, $t_expires, $filename, $mime_type) =  split(':', $val);
+
+        unlink $Torrus::Global::cacheDir.'/'.$filename;
+        $self->{'db'}->c_del( $cursor );
+    }
+    undef $cursor;
+    Debug('Renderer cache cleared');
+}
+
+
+sub newCacheFileName
+{
+    my $cachekey = shift;
+    return sprintf('%s_%.5d', md5_hex($cachekey), rand(1e5));
+}
+
+sub xmlnormalize
+{
+    my( $txt )= @_;
+
+    # Remove spaces in the head and tail.
+    $txt =~ s/^\s+//om;
+    $txt =~ s/\s+$//om;
+
+    # Unscreen special characters
+    $txt =~ s/{COLON}/:/ogm;
+    $txt =~ s/{SEMICOL}/;/ogm;
+    $txt =~ s/{PERCENT}/%/ogm;
+
+    $txt =~ s/\&/\&amp\;/ogm;
+    $txt =~ s/\</\&lt\;/ogm;
+    $txt =~ s/\>/\&gt\;/ogm;
+    $txt =~ s/\'/\&apos\;/ogm;
+    $txt =~ s/\"/\&quot\;/ogm;
+
+    return $txt;
+}
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Renderer/AdmInfo.pm b/torrus/perllib/Torrus/Renderer/AdmInfo.pm
new file mode 100644 (file)
index 0000000..1cbd510
--- /dev/null
@@ -0,0 +1,242 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: AdmInfo.pm,v 1.1 2010-12-27 00:03:44 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+package Torrus::Renderer::AdmInfo;
+
+use strict;
+
+use Torrus::ConfigTree;
+use Torrus::Log;
+use Torrus::ACL;
+
+use Template;
+
+my %rrd_params =
+    (
+     'leaf-type' => {'rrd-def' => {'rrd-ds' => undef,
+                                   'rrd-cf' => undef,
+                                   'data-file' => undef,
+                                   'data-dir'  => undef},
+                     'rrd-cdef' => {'rpn-expr' => undef}},
+     );
+
+my %rrdmulti_params = ( 'ds-names' => undef );
+
+my %collector_params =
+    (
+     'storage-type'   => {'rrd' => {
+         'data-file'              => undef,
+         'data-dir'               => undef,
+         'leaf-type'              => {
+             'rrd-def'  => {'rrd-ds' => undef,
+                            'rrd-cf' => undef,
+                            'rrd-create-dstype' => undef,
+                            'rrd-create-rra'         => undef,
+                            'rrd-create-heartbeat'   => undef,
+                            'rrd-hwpredict'         => {
+                                'enabled' => {'rrd-create-hw-rralen' => undef},
+                                'disabled' => undef
+                                }}}}},
+     'collector-type'        => undef,
+     'collector-period'      => undef,
+     'collector-timeoffset'  => undef,
+     'collector-instance'    => undef,
+     'collector-instance-hashstring' => undef,
+     'collector-scale'      => undef,
+     'collector-dispersed-timeoffset' => {
+         'no' => undef,
+         'yes' => {'collector-timeoffset-min' => undef,
+                   'collector-timeoffset-max' => undef,
+                   'collector-timeoffset-step' => undef,
+                   'collector-timeoffset-hashstring' => undef}}
+     );
+
+
+my %leaf_params =
+    ('ds-type' => {'rrd-file' => \%rrd_params,
+                   'rrd-multigraph' => \%rrdmulti_params,
+                   'collector' => \%collector_params},
+     'rrgraph-views'             => undef,
+     'rrd-scaling-base'         => undef,
+     'graph-logarithmic'        => undef,
+     'graph-rigid-boundaries'   => undef,
+     'graph-ignore-decorations' => undef,
+     'nodeid'                   => undef);
+
+
+my %param_categories =
+    (
+     'collector-dispersed-timeoffset'    => 'Collector',
+     'collector-period'                  => 'Collector',
+     'collector-scale'                   => 'Collector',
+     'collector-timeoffset'              => 'Collector',
+     'collector-timeoffset-hashstring'   => 'Collector',
+     'collector-timeoffset-max'          => 'Collector',
+     'collector-timeoffset-min'          => 'Collector',
+     'collector-timeoffset-step'         => 'Collector',
+     'collector-type'                    => 'Collector',
+     'collector-instance'                => 'Collector',
+     'collector-instance-hashstring'     => 'Collector',
+     'data-dir'                          => 'Storage',
+     'data-file'                         => 'Storage',
+     'ds-names'                          => 'Multigraph',
+     'ds-type'                           => 'Common Parameters',
+     'graph-ignore-decorations'          => 'Display',
+     'graph-logarithmic'                 => 'Display',
+     'graph-rigid-boundaries'            => 'Display',
+     'leaf-type'                         => 'Common Parameters',
+     'nodeid'                            => 'Common Parameters',
+     'rpn-expr'                          => 'RRD CDEF Paramters',
+     'rrd-cf'                            => 'RRD',
+     'rrd-create-dstype'                 => 'RRD',
+     'rrd-create-heartbeat'              => 'RRD',
+     'rrd-create-hw-rralen'              => 'RRD',
+     'rrd-create-rra'                    => 'RRD',
+     'rrd-ds'                            => 'RRD',
+     'rrd-hwpredict'                     => 'RRD',
+     'rrd-scaling-base'                  => 'RRD',
+     'rrgraph-views'                     => 'Display',
+     'storage-type'                      => 'Storage'
+     );
+     
+
+# Load additional validation, configurable from
+# torrus-config.pl and torrus-siteconfig.pl
+
+foreach my $mod ( @Torrus::Renderer::loadAdmInfo )
+{
+    eval( 'require ' . $mod );
+    die( $@ ) if $@;
+    eval( '&' . $mod . '::initAdmInfo( \%leaf_params, \%param_categories )' );
+    die( $@ ) if $@;
+}
+
+
+# All our methods are imported by Torrus::Renderer;
+
+sub render_adminfo
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+    my $outfile = shift;
+
+    if( $self->may_display_adminfo( $config_tree, $token ) )
+    {
+        $self->{'adminfo'} = $self->retrieve_adminfo( $config_tree, $token );
+        my @ret = $self->render_html( $config_tree, $token, $view, $outfile );
+        delete $self->{'adminfo'};
+        return @ret;
+    }
+    else
+    {
+        if( not open(OUT, ">$outfile") )
+        {
+            Error("Cannot open $outfile for writing: $!");
+            return undef;
+        }
+        else
+        {
+            print OUT "Cannot display admin information\n";
+            close OUT;
+        }
+
+        return (300+time(), 'text/plain');
+    }
+}
+
+
+sub may_display_adminfo
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+
+    if( $config_tree->isLeaf( $token ) )
+    {
+        # hasPrivilege is imported from Torrus::Renderer::HTML
+        if( $self->hasPrivilege( $config_tree->treeName(),
+                                 'DisplayAdmInfo' ) )
+        {
+            return 1;
+        }
+    }
+    
+    return 0;
+}
+
+
+sub retrieve_adminfo
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+
+    my $ret = {};
+    my @namemaps = ( \%leaf_params );
+
+    while( scalar( @namemaps ) > 0 )
+    {
+        my @next_namemaps = ();
+
+        foreach my $namemap ( @namemaps )
+        {
+            foreach my $paramkey ( keys %{$namemap} )
+            {
+                my $pname = $paramkey;
+
+                my $pval = $config_tree->getNodeParam( $token, $pname );
+                if( defined( $pval ) )
+                {
+                    if( ref( $namemap->{$paramkey} ) )
+                    {
+                        if( exists $namemap->{$paramkey}->{$pval} )
+                        {
+                            if( defined $namemap->{$paramkey}->{$pval} )
+                            {
+                                push( @next_namemaps,
+                                      $namemap->{$paramkey}->{$pval} );
+                            }
+                        }
+                    }
+
+                    my $category = $param_categories{$pname};
+                    if( not defined( $category ) )
+                    {
+                        $category = 'Other';
+                    }                    
+                    $ret->{$category}{$pname} = $pval;
+                }
+            }
+        }
+        @namemaps = @next_namemaps;
+    }
+
+    return $ret;
+}
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Renderer/Frontpage.pm b/torrus/perllib/Torrus/Renderer/Frontpage.pm
new file mode 100644 (file)
index 0000000..5a9d0a3
--- /dev/null
@@ -0,0 +1,291 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Frontpage.pm,v 1.1 2010-12-27 00:03:44 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+package Torrus::Renderer::Frontpage;
+
+use strict;
+
+use Torrus::ConfigTree;
+use Torrus::Search;
+use Torrus::Log;
+
+use Template;
+use URI::Escape;
+
+# All our methods are imported by Torrus::Renderer;
+
+sub renderUserLogin
+{
+    my $self = shift;
+    my %new_options = @_;
+
+    if( %new_options )
+    {
+        $self->{'options'} = \%new_options;
+    }
+
+    my($t_render, $t_expires, $filename, $mime_type);
+
+    my $cachekey = $self->cacheKey( 'LOGINSCREEN' );
+
+    ($t_render, $t_expires, $filename, $mime_type) =
+        $self->getCache( $cachekey );
+
+    # We don't check the expiration time for login screen
+    if( not defined( $filename ) )
+    {
+        $filename = Torrus::Renderer::newCacheFileName( $cachekey );
+    }
+
+    my $outfile = $Torrus::Global::cacheDir.'/'.$filename;
+
+    $t_expires = time();
+    $mime_type = $Torrus::Renderer::LoginScreen::mimeType;
+    my $tmplfile = $Torrus::Renderer::LoginScreen::template;
+
+    # Create the Template Toolkit processor once, and reuse
+    # it in subsequent render() calls
+
+    if( not defined( $self->{'tt'} ) )
+    {
+        $self->{'tt'} =
+            new Template(INCLUDE_PATH => $Torrus::Global::templateDirs,
+                         TRIM => 1);
+    }
+
+    my $url = $Torrus::Renderer::rendererURL;
+    if( length( $self->{'options'}->{'urlPassTree'} ) > 0 )
+    {
+        $url .= '/' . $self->{'options'}->{'urlPassTree'};
+    }
+    
+    my $ttvars =
+    {
+        'url'        => $url,
+        'plainURL'   => $Torrus::Renderer::plainURL,
+        'style'      => sub { return $self->style($_[0]); },
+        'companyName'=> $Torrus::Renderer::companyName,
+        'companyLogo'=> $Torrus::Renderer::companyLogo,
+        'companyURL' => $Torrus::Renderer::companyURL,
+        'lostPasswordURL' => $Torrus::Renderer::lostPasswordURL,
+        'siteInfo'   => $Torrus::Renderer::siteInfo,
+        'version'    => $Torrus::Global::version,
+        'xmlnorm'    => \&Torrus::Renderer::xmlnormalize
+        };
+
+
+    # Pass the options from Torrus::Renderer::render() to Template
+    while( my( $opt, $val ) = each( %{$self->{'options'}} ) )
+    {
+        $ttvars->{$opt} = $val;
+    }
+
+    my $result = $self->{'tt'}->process( $tmplfile, $ttvars, $outfile );
+
+    undef $ttvars;
+
+    my @ret;
+    if( not $result )
+    {
+        Error("Error while rendering login screen: " .
+              $self->{'tt'}->error());
+    }
+    else
+    {
+        $self->setCache($cachekey, time(), $t_expires, $filename, $mime_type);
+        @ret = ($outfile, $mime_type, $t_expires - time());
+    }
+
+    $self->{'options'} = undef;   
+
+    return @ret;
+}
+
+
+sub renderTreeChooser
+{
+    my $self = shift;
+    my %new_options = @_;
+
+    if( %new_options )
+    {
+        $self->{'options'} = \%new_options;
+    }
+
+    my($t_render, $t_expires, $filename, $mime_type);
+
+    my $uid = '';
+    if( $self->{'options'}->{'uid'} )
+    {
+        $uid = $self->{'options'}->{'uid'};
+    }
+
+    my $cachekey = $self->cacheKey( $uid . ':' . 'TREECHOOSER' );
+
+    ($t_render, $t_expires, $filename, $mime_type) =
+        $self->getCache( $cachekey );
+
+    if( defined( $filename ) )
+    {
+        if( $t_expires >= time() )
+        {
+            return ($Torrus::Global::cacheDir.'/'.$filename,
+                    $mime_type, $t_expires - time());
+        }
+        # Else reuse the old filename
+    }
+    else
+    {
+        $filename = Torrus::Renderer::newCacheFileName( $cachekey );
+    }
+
+    my $outfile = $Torrus::Global::cacheDir.'/'.$filename;
+
+    $t_expires = time() + $Torrus::Renderer::Chooser::expires;
+    $mime_type = $Torrus::Renderer::Chooser::mimeType;
+    
+    my $tmplfile;
+    if( defined( $self->{'options'}{'variables'}{'SEARCH'} ) and
+        $self->mayGlobalSearch() )
+    {
+        $tmplfile = $Torrus::Renderer::Chooser::searchTemplate;
+    }
+    else
+    {
+        $tmplfile = $Torrus::Renderer::Chooser::template;
+    }
+
+    # Create the Template Toolkit processor once, and reuse
+    # it in subsequent render() calls
+
+    if( not defined( $self->{'tt'} ) )
+    {
+        $self->{'tt'} =
+            new Template(INCLUDE_PATH => $Torrus::Global::templateDirs,
+                         TRIM => 1);
+    }
+
+    my $ttvars =
+    {
+        'treeNames' => sub{ return Torrus::SiteConfig::listTreeNames() },
+        'treeDescr' => sub{ return
+                                Torrus::SiteConfig::treeDescription($_[0]) }
+        ,
+        'url'  => sub { return $Torrus::Renderer::rendererURL . '/' . $_[0] },
+        'plainURL'   => $Torrus::Renderer::plainURL,
+        'persistentUrl'  => sub { return $Torrus::Renderer::rendererURL . '/' .
+                                  $_[0] . '?path=' . uri_escape($_[1])}
+        ,
+        'clearVar'   => sub { delete $self->{'options'}{'variables'}{$_[0]};
+                              return undef;},
+        'style'      => sub { return $self->style($_[0]); },
+        'companyName'=> $Torrus::Renderer::companyName,
+        'companyLogo'=> $Torrus::Renderer::companyLogo,
+        'companyURL' => $Torrus::Renderer::companyURL,
+        'siteInfo'   => $Torrus::Renderer::siteInfo,
+        'version'    => $Torrus::Global::version,
+        'xmlnorm'    => \&Torrus::Renderer::xmlnormalize,
+        'userAuth'   => $Torrus::CGI::authorizeUsers,
+        'uid'        => $self->{'options'}->{'uid'},
+        'userAttr'   => sub { return $self->userAttribute( $_[0] ) },
+        'mayDisplayTree' => sub { return $self->
+                                      hasPrivilege( $_[0], 'DisplayTree' ) }
+        ,
+        'mayGlobalSearch' => sub { return $self->mayGlobalSearch(); },        
+        'searchResults'   => sub { return $self->doGlobalSearch($_[0]); }
+    };
+
+
+    # Pass the options from Torrus::Renderer::render() to Template
+    while( my( $opt, $val ) = each( %{$self->{'options'}} ) )
+    {
+        $ttvars->{$opt} = $val;
+    }
+
+    my $result = $self->{'tt'}->process( $tmplfile, $ttvars, $outfile );
+
+    undef $ttvars;
+
+    my @ret;
+    if( not $result )
+    {
+        Error("Error while rendering tree chooser: " .
+              $self->{'tt'}->error());
+    }
+    else
+    {
+        $self->setCache($cachekey, time(), $t_expires, $filename, $mime_type);
+        @ret = ($outfile, $mime_type, $t_expires - time());
+    }
+
+    $self->{'options'} = undef;   
+
+    return @ret;
+}
+
+
+sub mayGlobalSearch
+{
+    my $self = shift;
+    
+    return ( $Torrus::Renderer::globalSearchEnabled and
+             ( not $Torrus::CGI::authorizeUsers or
+               ( $self->hasPrivilege( '*', 'GlobalSearch' ) ) ) );
+}
+
+sub doGlobalSearch
+{
+    my $self = shift;
+    my $string = shift;
+    
+    my $sr = new Torrus::Search;
+    $sr->openGlobal();
+    my $result = $sr->searchPrefix( $string );
+
+    my $sorted = [];
+    push( @{$sorted}, sort {$a->[0] cmp $b->[0]} @{$result} );
+
+    # remove duplicating entries
+    my %seen;
+    my $ret = [];
+    
+    foreach my $element ( @{$sorted} )
+    {
+        my $string = join( ':', $element->[0], $element->[1] );
+        if( not $seen{$string} )
+        {
+            $seen{$string} = 1;
+            push( @{$ret}, $element );
+        }
+    }
+        
+    return $ret;
+}
+
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Renderer/HTML.pm b/torrus/perllib/Torrus/Renderer/HTML.pm
new file mode 100644 (file)
index 0000000..e9f72ac
--- /dev/null
@@ -0,0 +1,530 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: HTML.pm,v 1.1 2010-12-27 00:03:44 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+package Torrus::Renderer::HTML;
+
+use strict;
+
+use Torrus::ConfigTree;
+use Torrus::Search;
+use Torrus::Log;
+
+use URI::Escape;
+use Template;
+use POSIX qw(abs log floor pow);
+use Date::Parse;
+use Date::Format;
+
+Torrus::SiteConfig::loadStyling();
+
+# All our methods are imported by Torrus::Renderer;
+
+sub render_html
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+    my $outfile = shift;
+
+    my $tmplfile = $config_tree->getParam($view, 'html-template');
+
+    my $expires = $config_tree->getParam($view, 'expires');
+    
+    # Create the Template Toolkit processor once, and reuse
+    # it in subsequent render() calls
+
+    if( not defined( $self->{'tt'} ) )
+    {
+        $self->{'tt'} =
+            new Template(INCLUDE_PATH => $Torrus::Global::templateDirs,
+                         TRIM => 1);
+    }
+    my $ttvars =
+    {
+        'treeName'   => $config_tree->treeName(),
+        'token'      => $token,
+        'view'       => $view,
+        'expires'    => $expires,
+        'path'       => sub { return $config_tree->path($_[0]); },
+        'pathToken'  => sub { return $config_tree->token($_[0]); },
+        'nodeExists' => sub { return $config_tree->nodeExists($_[0]); },
+        'children'   => sub { return $config_tree->getChildren($_[0]); },
+        'isLeaf'     => sub { return $config_tree->isLeaf($_[0]); },
+        'isAlias'    => sub { return $config_tree->isAlias($_[0]); },
+        'sortTokens' => sub { return $self->sortTokens($config_tree,
+                                                       $_[0]); },
+        'nodeName'   => sub { return $self->nodeName($config_tree, $_[0]); },
+        'parent'     => sub { return $config_tree->getParent($_[0]); },
+        'nodeParam'  => sub { return $config_tree->getNodeParam(@_); },
+        'param'      => sub { return $config_tree->getParam(@_); },
+        'url'        => sub { return $self->makeURL($config_tree, 0, @_); },
+        'persistentUrl' => sub { return $self->makeURL($config_tree, 1, @_); },
+        'clearVar'   => sub { delete $self->{'options'}{'variables'}{$_[0]};
+                              return undef;},
+        'plainURL'   => $Torrus::Renderer::plainURL,
+        'splitUrls'  => sub { return $self->makeSplitURLs($config_tree,
+                                                          $_[0], $_[1]); },
+        'topURL'     => ($Torrus::Renderer::rendererURL ne '' ?
+                         $Torrus::Renderer::rendererURL : '/'),
+        'rrprint'    => sub { return $self->rrPrint($config_tree,
+                                                    $_[0], $_[1]); },
+        'scale'      => sub { return $self->scale($_[0], $_[1]); },
+        'tsetMembers' => sub { $config_tree->tsetMembers($_[0]); },
+        'tsetList'   => sub { $config_tree->getTsets(); },
+        'style'      => sub { return $self->style($_[0]); },
+        'companyName'=> $Torrus::Renderer::companyName,
+        'companyLogo'=> $Torrus::Renderer::companyLogo,
+        'companyURL' => $Torrus::Renderer::companyURL,
+        'siteInfo'   => $Torrus::Renderer::siteInfo,
+        'treeInfo'   => sub { return $Torrus::Global::treeConfig{
+            $config_tree->treeName()}{'info'}; },
+        'version'    => $Torrus::Global::version,
+        'xmlnorm'    => \&Torrus::Renderer::xmlnormalize,
+        'userAuth'   => $Torrus::CGI::authorizeUsers,
+        'uid'        => $self->{'options'}->{'uid'},
+        'userAttr'   => sub { return $self->userAttribute( $_[0] ) },
+        'mayDisplayAdmInfo' => sub {
+            return $self->may_display_adminfo( $config_tree, $_[0] ) },
+        'adminfo' => $self->{'adminfo'},
+        'mayDisplayReports' => sub {
+            return $self->may_display_reports($config_tree) },
+        'reportsUrl' => sub {
+            return $self->reportsUrl($config_tree); },
+        'timestamp'  => sub { return time2str($Torrus::Renderer::timeFormat,
+                                              time()); },
+        'verifyDate'  => sub { return verifyDate($_[0]); },
+        'markup'     => sub{ return $self->translateMarkup( @_ ); },
+        'searchEnabled' => $Torrus::Renderer::searchEnabled,
+        'searchResults' => sub { return $self->doSearch($config_tree, $_[0]); }
+    };
+    
+    
+    # Pass the options from Torrus::Renderer::render() to Template
+    while( my( $opt, $val ) = each( %{$self->{'options'}} ) )
+    {
+        $ttvars->{$opt} = $val;
+    }
+
+    my $result = $self->{'tt'}->process( $tmplfile, $ttvars, $outfile );
+
+    undef $ttvars;
+
+    if( not $result )
+    {
+        if( $config_tree->isTset( $token ) )
+        {
+            Error("Error while rendering tokenset $token: " .
+                  $self->{'tt'}->error());
+        }
+        else
+        {
+            my $path = $config_tree->path($token);
+            Error("Error while rendering $path: " .
+                  $self->{'tt'}->error());
+        }
+        return undef;
+    }
+
+    return ($expires+time(), 'text/html; charset=UTF-8');
+}
+
+
+sub nodeName
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+
+    my $n = $config_tree->getNodeParam($token, 'node-display-name', 1);
+    if( defined( $n ) and length( $n ) > 0 )
+    {
+        return $n;
+    }
+    
+    return $config_tree->nodeName($config_tree->path($token));
+}
+
+
+sub sortTokens
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $tokenlist = shift;
+
+    my @sorted = ();
+    if( ref($tokenlist) and scalar(@{$tokenlist}) > 0 )
+    {
+        @sorted = sort
+        {
+            my $p_a = $config_tree->getNodeParam($a, 'precedence', 1);
+            $p_a = 0 unless defined $p_a;
+            my $p_b = $config_tree->getNodeParam($b, 'precedence', 1);
+            $p_b = 0 unless defined $p_b;
+            if( $p_a == $p_b )
+            {
+                my $n_a = $config_tree->path($a);
+                my $n_b = $config_tree->path($b);
+                return $n_a cmp $n_b;
+            }
+            else
+            {
+                return $p_b <=> $p_a;
+            }
+        } @{$tokenlist};
+    }
+    else
+    {
+        push(@sorted, $tokenlist);
+    }
+    return @sorted;
+}
+
+
+# compose an URL for a node.
+# $persistent defines if the link should be persistent
+# Persistent link is done with nodeid if available, or with path
+
+sub makeURL
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $persistent = shift;
+    my $token = shift;
+    my $view = shift;
+    my @add_vars = @_;
+
+    my $ret = $Torrus::Renderer::rendererURL . '/' . $config_tree->treeName();
+    
+    if( $persistent )
+    {
+        my $nodeid = $config_tree->getNodeParam($token, 'nodeid', 1);
+        if( defined( $nodeid ) )
+        {
+            $ret .= '?nodeid=' .
+                uri_escape($nodeid, $Torrus::Renderer::uriEscapeExceptions);
+        }
+        else
+        {
+            $ret .= '?path=' .
+                uri_escape($config_tree->path($token),
+                           $Torrus::Renderer::uriEscapeExceptions);
+        }
+    }
+    else
+    {
+        $ret .= '?token=' . uri_escape($token);
+    }
+
+    if( $view )
+    {
+        $ret .= '&amp;view=' . uri_escape($view);
+    }
+
+    my %vars = ();
+    # This could be array or a reference to array
+    my $add_vars_size = scalar( @add_vars );
+    if( $add_vars_size == 1 and ref( $add_vars[0] ) )
+    {
+        %vars = @{$add_vars[0]};
+    }
+    elsif( $add_vars_size > 0 and ($add_vars_size % 2 == 0) )
+    {
+        %vars = @add_vars;
+    }
+
+    if( ref( $self->{'options'}->{'variables'} ) )
+    {
+        foreach my $name ( sort keys %{$self->{'options'}->{'variables'}} )
+        {
+            my $val = $self->{'options'}->{'variables'}->{$name};
+            if( not defined( $vars{$name} ) )
+            {
+                $vars{$name} = $val;
+            }
+        }
+    }
+
+    foreach my $name ( sort keys %vars )
+    {
+        if( $vars{$name} ne '' )
+        {
+            $ret .= '&amp;' . $name . '=' .
+                uri_escape( $vars{$name},
+                            $Torrus::Renderer::uriEscapeExceptions );
+        }
+    }
+
+    return $ret;
+}
+
+sub makeSplitURLs
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+
+    my $ret = '';
+    while( defined( $token ) )
+    {
+        my $path = $config_tree->path($token);
+        
+        my $str = '<SPAN CLASS="PathElement">';
+        $str .=
+            sprintf('<A HREF="%s">%s%s</A>',
+                    $self->makeURL($config_tree, 0, $token, $view),
+                    $config_tree->nodeName($path),
+                    ( $config_tree->isSubtree($token) and
+                      $path ne '/') ? '/':'' );
+        $str .= "</SPAN>\n";
+        
+        $ret = $str . $ret;
+                
+        $token = $config_tree->getParent( $token );
+    }
+    
+    return $ret;
+}
+
+
+sub rrPrint
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+
+    my @ret = ();
+    my($fname, $mimetype) = $self->render( $config_tree, $token, $view );
+
+    if( $mimetype ne 'text/plain' )
+    {
+        Error("View $view does not produce text/plain for token $token");
+    }
+    else
+    {
+        if( not open(IN, $fname) )
+        {
+            Error("Cannot open $fname for reading: $!");
+        }
+        else
+        {
+            chomp(my $values = <IN>);
+            @ret = split(':', $values);
+            close IN;
+        }
+    }
+    return @ret;
+}
+
+# This subroutine is taken from Dave Plonka's Flowscan
+
+sub scale
+{
+    my $self = shift;
+    # This is based somewhat on Tobi Oetiker's code in rrd_graph.c:
+    my $fmt = shift;
+    my $value = shift;
+    my @symbols = ("a", # 10e-18 Ato
+                   "f", # 10e-15 Femto
+                   "p", # 10e-12 Pico
+                   "n", # 10e-9  Nano
+                   "u", # 10e-6  Micro
+                   "m", # 10e-3  Milli
+                   " ", # Base
+                   "k", # 10e3   Kilo
+                   "M", # 10e6   Mega
+                   "G", # 10e9   Giga
+                   "T", # 10e12  Terra
+                   "P", # 10e15  Peta
+                   "E"); # 10e18  Exa
+
+    my $symbcenter = 6;
+    my $digits = (0 == $value)? 0 : floor(log(abs($value))/log(1000));
+    return sprintf( $fmt . " %s", $value/pow(1000, $digits),
+                    $symbols[ $symbcenter+$digits ] );
+}
+
+sub style
+{
+    my $self = shift;
+    my $object = shift;
+
+    my $media;
+    if( not defined( $media = $self->{'options'}->{'variables'}->{'MEDIA'} ) )
+    {
+        $media = 'default';
+    }
+    return  $Torrus::Renderer::styling{$media}{$object};
+}
+
+
+
+sub userAttribute
+{
+    my $self = shift;
+    my $attr = shift;
+
+    if( $self->{'options'}->{'uid'} and $self->{'options'}->{'acl'} )
+    {
+        $self->{'options'}->{'acl'}->
+            userAttribute( $self->{'options'}->{'uid'}, $attr );
+    }
+    else
+    {
+        return '';
+    }
+}
+
+sub hasPrivilege
+{
+    my $self = shift;
+    my $object = shift;
+    my $privilege = shift;
+
+    if( $self->{'options'}->{'uid'} and $self->{'options'}->{'acl'} )
+    {
+        $self->{'options'}->{'acl'}->
+            hasPrivilege( $self->{'options'}->{'uid'}, $object, $privilege );
+    }
+    else
+    {
+        return undef;
+    }
+}
+
+
+sub translateMarkup
+{
+    my $self = shift;
+    my @strings = @_;
+
+    my $tt = new Template( TRIM => 1 );
+
+    my $ttvars =
+    {
+        'em'      =>  sub { return '<em>' . $_[0] . '</em>'; },
+        'strong'  =>  sub { return '<strong>' . $_[0] . '</strong>'; }
+    };
+    
+    my $ret = '';
+    
+    foreach my $str ( @strings )
+    {
+        my $output = '';
+        my $result = $tt->process( \$str, $ttvars, \$output );
+
+        if( not $result )
+        {
+            Error('Error translating markup: ' . $tt->error());
+        }
+        else
+        {
+            $ret .= $output;
+        }
+    }
+
+    undef $tt;
+    
+    return $ret;
+}
+
+
+sub verifyDate
+{
+    my $input = shift;
+
+    my $time = str2time( $input );
+    # rrdtool does not understand dates prior to 1980 (315529200)
+    if( defined( $time ) and $time > 315529200 )
+    {
+        # Present the time in format understood by rrdtool
+        return time2str('%H:%M %Y%m%d', $time);
+    }
+    else
+    {
+        return '';
+    }
+}
+
+
+sub may_display_reports
+{
+    my $self = shift;
+    my $config_tree = shift;
+
+    if( $Torrus::Renderer::displayReports )
+    {
+        if( not $Torrus::CGI::authorizeUsers )
+        {
+            return 1;
+        }
+        
+        my $tree = $config_tree->treeName();
+        if( $self->hasPrivilege( $tree, 'DisplayReports' ) and
+            -r $Torrus::Global::reportsDir . '/' . $tree .
+            '/html/index.html' )
+        {
+            return 1;
+        }
+    }
+    return 0;
+}
+
+
+sub reportsUrl
+{
+    my $self = shift;
+    my $config_tree = shift;
+
+    return $Torrus::Renderer::rendererURL . '/' .
+        $config_tree->treeName() . '?htmlreport=index.html';
+}
+
+
+sub doSearch
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $string = shift;
+    
+
+    my $tree = $config_tree->treeName();
+    
+    my $sr = new Torrus::Search;
+    $sr->openTree( $tree );
+    my $result = $sr->searchPrefix( $string, $tree );
+    $sr->closeTree( $tree );
+
+    my $ret = [];
+    push( @{$ret}, sort {$a->[0] cmp $b->[0]} @{$result} );
+    
+    return $ret;
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Renderer/RRDtool.pm b/torrus/perllib/Torrus/Renderer/RRDtool.pm
new file mode 100644 (file)
index 0000000..db0cc54
--- /dev/null
@@ -0,0 +1,993 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: RRDtool.pm,v 1.1 2010-12-27 00:03:44 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+package Torrus::Renderer::RRDtool;
+
+use strict;
+
+use Torrus::ConfigTree;
+use Torrus::RPN;
+use Torrus::Log;
+
+use RRDs;
+
+# All our methods are imported by Torrus::Renderer;
+
+my %rrd_graph_opts =
+    (
+     'start'  => '--start',
+     'end'    => '--end',
+     'width'  => '--width',
+     'height' => '--height'
+     );
+
+my @arg_arrays = qw(opts defs bg hwtick hrule hwline line fg);
+
+
+sub render_rrgraph
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+    my $outfile = shift;
+
+    if( not $config_tree->isLeaf($token) )
+    {
+        Error("Token $token is not a leaf");
+        return undef;
+    }
+
+    my $obj = {'args' => {}, 'dname' => 'A'};
+
+    foreach my $arrayName ( @arg_arrays )
+    {
+        $obj->{'args'}{$arrayName} = [];
+    }
+
+    push( @{$obj->{'args'}{'opts'}},
+          $self->rrd_make_opts( $config_tree, $token, $view,
+                                \%rrd_graph_opts, ) );
+
+    push( @{$obj->{'args'}{'opts'}},
+          $self->rrd_make_graph_opts( $config_tree, $token, $view ) );
+
+    my $dstype = $config_tree->getNodeParam($token, 'ds-type');
+
+    if( $dstype eq 'rrd-multigraph' )
+    {
+        $self->rrd_make_multigraph( $config_tree, $token, $view, $obj );
+    }
+    else
+    {
+        my $leaftype = $config_tree->getNodeParam($token, 'leaf-type');
+
+        # Handle DEFs and CDEFs
+        # At the moment, we call the DEF as 'A'. Could change in the future
+        if( $leaftype eq 'rrd-def' )
+        {
+            push( @{$obj->{'args'}{'defs'}},
+                  $self->rrd_make_def( $config_tree, $token,
+                                       $obj->{'dname'} ) );
+
+            if( $self->rrd_check_hw( $config_tree, $token, $view ) )
+            {
+                $self->rrd_make_holtwinters( $config_tree, $token,
+                                             $view, $obj );
+            }
+        }
+        elsif( $leaftype eq 'rrd-cdef' )
+        {
+            my $expr = $config_tree->getNodeParam($token, 'rpn-expr');
+            push( @{$obj->{'args'}{'defs'}},
+                  $self->rrd_make_cdef($config_tree, $token,
+                                       $obj->{'dname'}, $expr) );
+        }
+        else
+        {
+            Error("Unsupported leaf-type: $leaftype");
+            return undef;
+        }
+
+        $self->rrd_make_graphline( $config_tree, $token, $view, $obj );
+    }
+
+    $self->rrd_make_hrules( $config_tree, $token, $view, $obj );
+    if( not $Torrus::Renderer::ignoreDecorations )
+    {
+        $self->rrd_make_decorations( $config_tree, $token, $view, $obj );
+    }
+
+    # We're all set
+
+
+    my @args;
+    foreach my $arrayName ( @arg_arrays )
+    {
+        push( @args, @{$obj->{'args'}{$arrayName}} );
+    }
+    Debug("RRDs::graph arguments: " . join(' ', @args));
+
+    $self->tz_set();
+    &RRDs::graph( $outfile, @args );
+    $self->tz_restore();
+    my $ERR=RRDs::error;
+    if( $ERR )
+    {
+        my $path = $config_tree->path($token);
+        Error("$path $view: Error during RRD graph: $ERR");
+        return undef;
+    }
+
+    return( $config_tree->getParam($view, 'expires')+time(), 'image/png' );
+}
+
+
+my %rrd_print_opts =
+    (
+     'start'  => '--start',
+     'end'    => '--end',
+     );
+
+
+
+sub render_rrprint
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+    my $outfile = shift;
+
+    if( not $config_tree->isLeaf($token) )
+    {
+        Error("Token $token is not a leaf");
+        return undef;
+    }
+
+    my @arg_opts;
+    my @arg_defs;
+    my @arg_print;
+
+    push( @arg_opts, $self->rrd_make_opts( $config_tree, $token, $view,
+                                           \%rrd_print_opts, ) );
+
+    my $dstype = $config_tree->getNodeParam($token, 'ds-type');
+
+    if( $dstype eq 'rrd-multigraph' )
+    {
+        Error("View type rrprint is not supported ".
+              "for DS type rrd-multigraph");
+        return undef;
+    }
+
+    my $leaftype = $config_tree->getNodeParam($token, 'leaf-type');
+
+    # Handle DEFs and CDEFs
+    # At the moment, we call the DEF as 'A'. Could change in the future
+    my $dname = 'A';
+    if( $leaftype eq 'rrd-def' )
+    {
+        push( @arg_defs,
+              $self->rrd_make_def( $config_tree, $token, $dname ) );
+    }
+    elsif( $leaftype eq 'rrd-cdef' )
+    {
+        my $expr = $config_tree->getNodeParam($token, 'rpn-expr');
+        push( @arg_defs,
+              $self->rrd_make_cdef($config_tree, $token, $dname, $expr) );
+    }
+    else
+    {
+        Error("Unsupported leaf-type: $leaftype");
+        return undef;
+    }
+
+    foreach my $cf ( split(',', $config_tree->getParam($view, 'print-cf')) )
+    {
+        push( @arg_print, sprintf( 'PRINT:%s:%s:%%le', $dname, $cf ) );
+    }
+
+    # We're all set
+
+    my @args = ( @arg_opts, @arg_defs, @arg_print );
+    Debug("RRDs::graph arguments: " . join(' ', @args));
+
+    my $printout;
+    $self->tz_set();
+    ($printout, undef, undef) = RRDs::graph('/dev/null', @args);
+    $self->tz_restore();
+    my $ERR=RRDs::error;
+    if( $ERR )
+    {
+        my $path = $config_tree->path($token);
+        Error("$path $view: Error during RRD graph: $ERR");
+        return undef;
+    }
+
+    if( not open(OUT, ">$outfile") )
+    {
+        Error("Cannot open $outfile for writing: $!");
+        return undef;
+    }
+    else
+    {
+        printf OUT ("%s\n", join(':', @{$printout}));
+        close OUT;
+    }
+
+    return( $config_tree->getParam($view, 'expires')+time(), 'text/plain' );
+}
+
+
+
+sub rrd_make_multigraph
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+    my $obj = shift;
+
+    my @dsNames =
+        split(',', $config_tree->getNodeParam($token, 'ds-names') );
+
+    # We need this to refer to some existing variable name
+    $obj->{'dname'} = $dsNames[0];
+
+    # Analyze the drawing order
+    my %dsOrder;
+    foreach my $dname ( @dsNames )
+    {
+        my $order = $config_tree->getNodeParam($token, 'line-order-'.$dname);
+        $dsOrder{$dname} = defined( $order ) ? $order : 100;
+    }
+
+    my $disable_legend = $config_tree->getParam($view, 'disable-legend');    
+    $disable_legend =
+        (defined($disable_legend) and $disable_legend eq 'yes') ? 1:0;
+    
+    # make DEFs and Line instructions
+
+    my $do_gprint = 0;
+
+    if( not $disable_legend )
+    {
+        $do_gprint = $self->rrd_if_gprint( $config_tree, $token );
+        if( $do_gprint )
+        {
+            $self->rrd_make_gprint_header( $config_tree, $token, $view, $obj );
+        }
+    }
+
+    foreach my $dname ( sort {$dsOrder{$a} <=> $dsOrder{$b}} @dsNames )
+    {
+        my $dograph = 1;
+        my $ignoreViews =
+            $config_tree->getNodeParam($token, 'ignore-views-'.$dname);
+        if( defined( $ignoreViews ) and
+            grep {$_ eq $view} split(',', $ignoreViews) )
+        {
+            $dograph = 0;
+        }
+
+        my $gprint_this = $do_gprint;
+        if( $do_gprint )
+        {
+            my $ds_nogprint =
+                $config_tree->getNodeParam($token, 'disable-gprint-'.$dname);
+            if( defined( $ds_nogprint ) and $ds_nogprint eq 'yes' )
+            {
+                $gprint_this = 0;
+            }
+        }
+
+        my $legend;
+        
+        if( $dograph or $gprint_this )
+        {
+            my $expr = $config_tree->getNodeParam($token, 'ds-expr-'.$dname);
+            push( @{$obj->{'args'}{'defs'}},
+                  $self->rrd_make_cdef($config_tree, $token, $dname, $expr) );
+
+            $legend =
+                $config_tree->getNodeParam($token, 'graph-legend-'.$dname);
+            if( defined( $legend ) )
+            {
+                $legend =~ s/:/\\:/g;
+            }
+            else
+            {
+                $legend = '';
+            }
+        }
+            
+        if( $gprint_this )
+        {
+            $self->rrd_make_gprint( $dname, $legend,
+                                    $config_tree, $token, $view, $obj );
+            if( not $dograph )
+            {
+                push( @{$obj->{'args'}{'line'}},
+                      'COMMENT:' . $legend . '\l');
+            }
+        }
+        else
+        {
+            # For datasource that disables gprint, there's no reason
+            # to print the label
+            $legend = '';
+        }
+        
+        if( $dograph )
+        {
+            my $linestyle =
+                $self->mkline( $config_tree->getNodeParam
+                               ($token, 'line-style-'.$dname) );
+            
+            my $linecolor =
+                $self->mkcolor( $config_tree->getNodeParam
+                                ($token, 'line-color-'.$dname) );
+            
+            my $alpha =
+                $config_tree->getNodeParam($token, 'line-alpha-'.$dname);
+            if( defined( $alpha ) )
+            {
+                $linecolor .= $alpha;
+            }
+
+            my $stack =
+                $config_tree->getNodeParam($token, 'line-stack-'.$dname);
+            if( defined( $stack ) and $stack eq 'yes' )
+            {
+                $stack = ':STACK';
+            }
+            else
+            {
+                $stack = '';
+            }
+                
+            push( @{$obj->{'args'}{'line'}},
+                  sprintf( '%s:%s%s%s%s', $linestyle, $dname,
+                           $linecolor,
+                           length($legend) > 0 ? ':'.$legend.'\l' : '',
+                           $stack ) );
+            
+        }
+    }
+}
+
+
+# Check if Holt-Winters stuff is needed
+sub rrd_check_hw
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+
+    my $use_hw = 0;
+    my $nodeHW = $config_tree->getNodeParam($token, 'rrd-hwpredict');
+    if( defined($nodeHW) and $nodeHW eq 'enabled' )
+    {
+        my $viewHW = $config_tree->getParam($view, 'rrd-hwpredict');
+        my $varNoHW = $self->{'options'}->{'variables'}->{'NOHW'};
+        
+        if( (not defined($viewHW) or $viewHW ne 'disabled') and
+            (not $varNoHW) )
+        {
+            $use_hw = 1;
+        }
+    }
+    return $use_hw;
+}
+
+
+sub rrd_make_holtwinters
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+    my $obj = shift;
+
+    my $dname = $obj->{'dname'};
+
+    push( @{$obj->{'args'}{'defs'}},
+          $self->rrd_make_def( $config_tree, $token,
+                               $dname . 'pred', 'HWPREDICT' ) );
+    push( @{$obj->{'args'}{'defs'}},
+          $self->rrd_make_def( $config_tree, $token,
+                               $dname . 'dev', 'DEVPREDICT' ) );
+    # Upper boundary definition
+    push( @{$obj->{'args'}{'defs'}},
+          sprintf( 'CDEF:%supper=%spred,%sdev,2,*,+',
+                   $dname, $dname, $dname  ) );
+
+    # Lower boundary definition
+    push( @{$obj->{'args'}{'defs'}},
+          sprintf( 'CDEF:%slower=%spred,%sdev,2,*,-',
+                   $dname, $dname, $dname  ) );
+
+    # Failures definition
+    push( @{$obj->{'args'}{'defs'}},
+          $self->rrd_make_def( $config_tree, $token,
+                               $dname . 'fail', 'FAILURES' ) );
+
+    # Generate H-W Boundary Lines
+
+    # Boundary style
+    my $hw_bndr_style = $config_tree->getParam($view, 'hw-bndr-style');
+    $hw_bndr_style = 'LINE1' unless defined $hw_bndr_style;
+    $hw_bndr_style = $self->mkline( $hw_bndr_style );
+
+    my $hw_bndr_color = $config_tree->getParam($view, 'hw-bndr-color');
+    $hw_bndr_color = '#FF0000' unless defined $hw_bndr_color;
+    $hw_bndr_color = $self->mkcolor( $hw_bndr_color );
+
+    push( @{$obj->{'args'}{'hwline'}},
+          sprintf( '%s:%supper%s:%s',
+                   $hw_bndr_style, $dname, $hw_bndr_color,
+                   $Torrus::Renderer::hwGraphLegend ? 'Boundaries\n':'' ) );
+    push( @{$obj->{'args'}{'hwline'}},
+          sprintf( '%s:%slower%s',
+                   $hw_bndr_style, $dname, $hw_bndr_color ) );
+
+    # Failures Tick
+
+    my $hw_fail_color = $config_tree->getParam($view, 'hw-fail-color');
+    $hw_fail_color = '#FFFFA0' unless defined $hw_fail_color;
+    $hw_fail_color = $self->mkcolor( $hw_fail_color );
+
+    push( @{$obj->{'args'}{'hwtick'}},
+          sprintf( 'TICK:%sfail%s:1.0:%s',
+                   $dname, $hw_fail_color,
+                   $Torrus::Renderer::hwGraphLegend ? 'Failures':'') );
+}
+
+sub rrd_make_graphline
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+    my $obj = shift;
+
+    my $legend;
+    
+    my $disable_legend = $config_tree->getParam($view, 'disable-legend');
+    if( not defined($disable_legend) or $disable_legend ne 'yes' )
+    {
+        $legend = $config_tree->getNodeParam($token, 'graph-legend');
+        if( defined( $legend ) )
+        {
+            $legend =~ s/:/\\:/g;
+        }
+    }
+
+    if( not defined( $legend ) )
+    {
+        $legend = '';
+    }
+    
+    my $styleval = $config_tree->getNodeParam($token, 'line-style');
+    if( not defined( $styleval ) or length( $styleval ) == 0 )
+    {
+        $styleval = $config_tree->getParam($view, 'line-style');
+    }
+    
+    my $linestyle = $self->mkline( $styleval );
+
+    my $colorval = $config_tree->getNodeParam($token, 'line-color');
+    if( not defined( $colorval ) or length( $colorval ) == 0 )
+    {
+        $colorval = $config_tree->getParam($view, 'line-color');
+    }
+    
+    my $linecolor = $self->mkcolor( $colorval );
+
+    if( $self->rrd_if_gprint( $config_tree, $token ) )
+    {
+        $self->rrd_make_gprint_header( $config_tree, $token, $view, $obj );
+
+        $self->rrd_make_gprint( $obj->{'dname'}, $legend,
+                                $config_tree, $token, $view, $obj );
+    }
+
+    push( @{$obj->{'args'}{'line'}},
+          sprintf( '%s:%s%s%s', $linestyle, $obj->{'dname'}, $linecolor,
+                   length($legend) > 0 ? ':'.$legend.'\l' : '' ) );
+}
+
+
+# Generate RRDtool arguments for HRULE's
+
+sub rrd_make_hrules
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+    my $obj = shift;
+
+    my $hrulesList = $config_tree->getParam($view, 'hrules');
+    if( defined( $hrulesList ) )
+    {
+        foreach my $hruleName ( split(',', $hrulesList ) )
+        {
+            # The presence of this parameter is checked by Validator
+            my $valueParam =
+                $config_tree->getParam( $view, 'hrule-value-'.$hruleName );
+            my $value = $config_tree->getNodeParam( $token, $valueParam );
+
+            if( defined( $value ) )
+            {
+                my $color =
+                    $config_tree->getParam($view, 'hrule-color-'.$hruleName);
+                $color = $self->mkcolor( $color );
+
+                my $legend =
+                    $config_tree->getNodeParam($token,
+                                               'hrule-legend-'.$hruleName);
+
+                my $arg = sprintf( 'HRULE:%e%s', $value, $color );
+                if( defined( $legend ) and $legend =~ /\S/ )
+                {
+                    $arg .= ':' . $legend . '\l';
+                }
+                push( @{$obj->{'args'}{'hrule'}}, $arg );
+            }
+        }
+    }
+}
+
+
+sub rrd_make_decorations
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+    my $obj = shift;
+
+    my $decorList = $config_tree->getParam($view, 'decorations');
+    my $ignore_decor =
+        $config_tree->getNodeParam($token, 'graph-ignore-decorations');
+    if( defined( $decorList ) and
+        (not defined($ignore_decor) or $ignore_decor ne 'yes') )
+    {
+        my $decor = {};
+        foreach my $decorName ( split(',', $decorList ) )
+        {
+            my $order =
+                $config_tree->getParam($view, 'dec-order-' . $decorName);
+            $decor->{$order} = {'def' => [], 'line' => ''};
+
+            my $style =
+                $self->mkline( $config_tree->
+                               getParam($view, 'dec-style-' . $decorName) );
+            my $color =
+                $self->mkcolor( $config_tree->
+                                getParam($view, 'dec-color-' . $decorName) );
+            my $expr = $config_tree->
+                getParam($view, 'dec-expr-' . $decorName);
+
+            push( @{$decor->{$order}{'def'}},
+                  $self->rrd_make_cdef( $config_tree, $token, $decorName,
+                                        $obj->{'dname'} . ',POP,' . $expr ) );
+
+            $decor->{$order}{'line'} =
+                sprintf( '%s:%s%s', $style, $decorName, $color );
+        }
+
+        foreach my $order ( sort {$a<=>$b} keys %{$decor} )
+        {
+            my $array = $order < 0 ? 'bg':'fg';
+
+            push( @{$obj->{'args'}{'defs'}}, @{$decor->{$order}{'def'}} );
+            push( @{$obj->{'args'}{$array}}, $decor->{$order}{'line'} );
+        }
+    }
+}
+
+# Takes the parameters from the view, and composes the list of
+# RRDtool arguments
+
+sub rrd_make_opts
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+    my $opthash = shift;
+
+    my @args = ();
+    foreach my $param ( keys %{$opthash} )
+    {
+        my $value =
+            $self->{'options'}->{'variables'}->{'G' . $param};
+        
+        if( not defined( $value ) )
+        {
+            $value = $config_tree->getParam( $view, $param );
+        }
+        
+        if( defined( $value ) )
+        {
+            if( ( $param eq 'start' or $param eq 'end' ) and
+                defined( $self->{'options'}->{'variables'}->{'NOW'} ) )
+            {
+                my $now = $self->{'options'}->{'variables'}->{'NOW'};
+                if( index( $value , 'now' ) >= 0 )
+                {
+                    $value =~ s/now/$now/;
+                }
+                elsif( $value =~ /^(\-|\+)/ )
+                {
+                    $value = $now . $value;
+                }
+            }
+            push( @args, $opthash->{$param}, $value );
+        }
+    }
+
+    my $params = $config_tree->getParam($view, 'rrd-params');
+    if( defined( $params ) )
+    {
+        push( @args, split('\s+', $params) );
+    }
+
+    my $scalingbase = $config_tree->getNodeParam($token, 'rrd-scaling-base');
+    if( defined($scalingbase) and $scalingbase == 1024 )
+    {
+        push( @args, '--base', '1024' );
+    }
+
+    return @args;
+}
+
+
+sub rrd_make_graph_opts
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+
+    my @args = ( '--imgformat', 'PNG' );
+
+    my $graph_log = $config_tree->getNodeParam($token, 'graph-logarithmic');
+    if( defined($graph_log) and $graph_log eq 'yes' )
+    {
+        push( @args, '--logarithmic' );
+    }
+
+    my $disable_title =
+        $config_tree->getParam($view, 'disable-title');
+    if( not defined( $disable_title ) or $disable_title ne 'yes' )
+    {
+        my $title = $config_tree->getNodeParam($token, 'graph-title');
+        if( not defined( $title ) or length( $title ) == 0 )
+        {
+            $title = ' ';
+        }
+        push( @args, '--title', $title );
+    }
+
+    my $disable_vlabel =
+        $config_tree->getParam($view, 'disable-vertical-label');
+    if( not defined( $disable_vlabel ) or $disable_vlabel ne 'yes' )
+    {
+        my $vertical_label =
+            $config_tree->getNodeParam($token, 'vertical-label');
+        if( defined( $vertical_label ) and length( $vertical_label ) > 0 )
+        {
+            push( @args, '--vertical-label', $vertical_label );
+        }
+    }
+
+    my $ignore_limits = $config_tree->getParam($view, 'ignore-limits');
+    if( not defined($ignore_limits) or $ignore_limits ne 'yes' )
+    {
+        my $ignore_lower = $config_tree->getParam($view, 'ignore-lower-limit');
+        if( not defined($ignore_lower) or $ignore_lower ne 'yes' )
+        {
+            my $limit =
+                $config_tree->getNodeParam($token, 'graph-lower-limit');
+            if( defined($limit) and length( $limit ) > 0 )
+            {
+                push( @args, '--lower-limit', $limit );
+            }
+        }
+
+        my $ignore_upper = $config_tree->getParam($view, 'ignore-upper-limit');
+        if( not defined($ignore_upper) or $ignore_upper ne 'yes' )
+        {
+            my $limit =
+                $config_tree->getNodeParam($token, 'graph-upper-limit');
+            if( defined($limit) and length( $limit ) > 0 )
+            {
+                push( @args, '--upper-limit', $limit );
+            }
+        }
+
+        my $rigid_boundaries =
+            $config_tree->getNodeParam($token, 'graph-rigid-boundaries');
+        if( defined($rigid_boundaries) and $rigid_boundaries eq 'yes' )
+        {
+            push( @args, '--rigid' );
+        }
+    }
+
+    if( scalar( @Torrus::Renderer::graphExtraArgs ) > 0 )
+    {
+        push( @args, @Torrus::Renderer::graphExtraArgs );
+    }
+
+    return @args;
+}
+
+
+sub rrd_make_def
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $dname = shift;
+    my $cf = shift;
+
+    my $datafile = $config_tree->getNodeParam($token, 'data-file');
+    my $dataddir = $config_tree->getNodeParam($token, 'data-dir');
+    my $rrdfile = $dataddir.'/'.$datafile;
+    if( not -r $rrdfile )
+    {
+        my $path = $config_tree->path($token);
+        Error("$path: No such file or directory: $rrdfile");
+        return undef;
+    }
+
+    my $ds = $config_tree->getNodeParam($token, 'rrd-ds');
+    if( not defined $cf )
+    {
+        $cf = $config_tree->getNodeParam($token, 'rrd-cf');
+    }
+    return sprintf( 'DEF:%s=%s:%s:%s',
+                    $dname, $rrdfile, $ds, $cf );
+}
+
+
+
+my %cfNames =
+    ( 'AVERAGE' => 1,
+      'MIN'     => 1,
+      'MAX'     => 1,
+      'LAST'    => 1 );
+
+# Moved the validation part to Torrus::ConfigTree::Validator
+sub rrd_make_cdef
+{
+    my $self  = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $dname = shift;
+    my $expr  = shift;
+
+    my @args = ();
+
+    # We will name the DEFs as $dname.sprintf('%.2d', $ds_couter++);
+    my $ds_couter = 1;
+
+    my $rpn = new Torrus::RPN;
+
+    # The callback for RPN translation
+    my $callback = sub
+    {
+        my ($noderef, $timeoffset) = @_;
+
+        my $function;
+        if( $noderef =~ s/^(.+)\@// )
+        {
+            $function = $1;
+        }
+
+        my $cf;
+        if( defined( $function ) and $cfNames{$function} )
+        {
+            $cf = $function;
+        }
+        
+        my $leaf = length($noderef) > 0 ?
+            $config_tree->getRelative($token, $noderef) : $token;
+
+        my $varname = $dname . sprintf('%.2d', $ds_couter++);
+        push( @args,
+              $self->rrd_make_def( $config_tree, $leaf, $varname, $cf ) );
+        return $varname;
+    };
+
+    $expr = $rpn->translate( $expr, $callback );
+    push( @args, sprintf( 'CDEF:%s=%s', $dname, $expr ) );
+    return @args;
+}
+
+
+sub rrd_if_gprint
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+
+    my $disable = $config_tree->getNodeParam($token, 'graph-disable-gprint');
+    if( defined( $disable ) and $disable eq 'yes' )
+    {
+        return 0;
+    }
+    return 1;
+}
+
+sub rrd_make_gprint
+{
+    my $self = shift;
+    my $vname = shift;
+    my $legend = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+    my $obj = shift;
+
+    my @args = ();
+
+    my $gprintValues = $config_tree->getParam($view, 'gprint-values');
+    if( defined( $gprintValues ) and length( $gprintValues ) > 0 )
+    {
+        foreach my $gprintVal ( split(',', $gprintValues ) )
+        {
+            my $format =
+                $config_tree->getParam($view, 'gprint-format-' . $gprintVal);
+            push( @args, 'GPRINT:' . $vname . ':' . $format );
+        }
+    }
+
+    push( @{$obj->{'args'}{'line'}}, @args );
+}
+            
+
+sub rrd_make_gprint_header
+{
+    my $self = shift;
+    my $config_tree = shift;
+    my $token = shift;
+    my $view = shift;
+    my $obj = shift;
+
+    my $gprintValues = $config_tree->getParam($view, 'gprint-values');
+    if( defined( $gprintValues ) and length( $gprintValues ) > 0 )
+    {
+        my $gprintHeader = $config_tree->getParam($view, 'gprint-header');
+        if( defined( $gprintHeader ) and length( $gprintHeader ) > 0 )
+        {
+            push( @{$obj->{'args'}{'line'}},
+                  'COMMENT:' . $gprintHeader . '\l' );
+        }
+    }
+}
+       
+
+sub mkcolor
+{
+    my $self = shift;
+    my $color = shift;
+
+    my $recursionLimit = 100;
+
+    while( $color =~ /^\#\#(\S+)$/ )
+    {
+        if( $recursionLimit-- <= 0 )
+        {
+            Error('Color recursion is too deep');
+            $color = '#000000';
+        }
+        else
+        {
+            my $colorName = $1;
+            $color = $Torrus::Renderer::graphStyles{$colorName}{'color'};
+            if( not defined( $color ) )
+            {
+                Error('No color is defined for ' . $colorName);
+                $color = '#000000';
+            }
+        }
+    }
+    return $color;
+}
+
+sub mkline
+{
+    my $self = shift;
+    my $line = shift;
+
+    if( $line =~ /^\#\#(\S+)$/ )
+    {
+        my $lineName = $1;
+        $line = $Torrus::Renderer::graphStyles{$lineName}{'line'};
+        if( not defined( $line ) )
+        {
+            Error('No line style is defined for ' . $lineName);
+            $line = 'LINE1';
+        }
+    }
+    return $line;
+}
+
+
+sub tz_set
+{
+    my $self = shift;
+
+    if( defined $ENV{'TZ'} )
+    {
+        Debug("Previous TZ value: " . $ENV{'TZ'});
+        $self->{'tz_defined'} = 1;
+    }
+    else
+    {
+        $self->{'tz_defined'} = 0;
+    }
+
+    if( defined( my $newTZ = $self->{'options'}->{'variables'}->{'TZ'} ) )
+    {
+        Debug("Setting TZ to " . $newTZ);
+        $self->{'tz_old'} = $ENV{'TZ'};
+        $ENV{'TZ'} = $newTZ;
+        $self->{'tz_changed'} = 1;
+    }
+    else
+    {
+        $self->{'tz_changed'} = 0;
+    }
+}
+
+sub tz_restore
+{
+    my $self = shift;
+
+    if( $self->{'tz_changed'} )
+    {
+        if( $self->{'tz_defined'} )
+        {
+            Debug("Restoring TZ back to " . $self->{'tz_old'});
+            $ENV{'TZ'} = $self->{'tz_old'};
+        }
+        else
+        {
+            Debug("Restoring TZ back to undefined");
+            delete $ENV{'TZ'};
+        }
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/ReportGenerator.pm b/torrus/perllib/Torrus/ReportGenerator.pm
new file mode 100644 (file)
index 0000000..1a4dec3
--- /dev/null
@@ -0,0 +1,141 @@
+#  Copyright (C) 2005  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: ReportGenerator.pm,v 1.1 2010-12-27 00:03:37 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Package for reports generation
+# Classes should inherit Torrus::ReportGenerator
+
+package Torrus::ReportGenerator;
+
+use strict;
+use Date::Parse;
+
+use Torrus::Log;
+use Torrus::SQL::Reports;
+use Torrus::SQL::SrvExport;
+
+sub new
+{
+    my $class = shift;
+    my $options = shift;
+
+    if( not ref( $options ) or
+        not defined( $options->{'Date'} ) or
+        not defined( $options->{'Time'} ) or
+        not defined( $options->{'Name'} ) )
+    {
+        Error('Missing options in Torrus::Report constructor');
+        return undef;
+    }
+    
+    my $self = {};
+    bless ($self, $class);
+
+    # For monthly reports, adjust date and time for the first day of the month
+    if( $self->isMonthly() )
+    {
+        $options->{'Time'} = '00:00';
+        my ($ss,$mm,$hh,$day,$month,$year,$zone) =
+            strptime( $options->{'Date'} );
+        $year += 1900;
+        $month++;
+        $self->{'StartDate'} = sprintf('%.4d-%.2d-01', $year, $month);
+        $options->{'Date'} = $self->{'StartDate'};
+        $self->{'StartUnixTime'} = str2time( $self->{'StartDate'} );
+        $self->{'Year'} = $year;
+        $self->{'Month'} = $month;
+
+        # Count the number of seconds in the month and define the end date
+        my $endyear = $year;
+        my $endmonth = $month + 1;
+
+        if( $endmonth > 12 )
+        {
+            $endmonth = 1;
+            $endyear++;
+        }
+
+        my $enddate = sprintf('%.4d-%.2d-01', $endyear, $endmonth);
+        $self->{'EndDate'} = $enddate;
+        $self->{'EndUnixTime'} = str2time( $self->{'EndDate'} );
+        
+        $self->{'RangeSeconds'} =
+            $self->{'EndUnixTime'} - $self->{'StartUnixTime'};
+    }
+
+    if( $self->usesSrvExport() )
+    {
+        my $srvExp =
+            Torrus::SQL::SrvExport->new( $options->{'SrvExportSqlSubtype'} );
+        if( not defined( $srvExp ) )
+        {
+            Error('Cannot connect to the database');
+            return undef;
+        }
+        $self->{'srvexport'} = $srvExp;
+    }
+    
+    $self->{'options'} = $options;
+
+    my $sqlRep = Torrus::SQL::Reports->new( $options->{'ReportsSqlSubtype'} );
+    if( not defined( $sqlRep ) )
+    {
+        Error('Cannot connect to the database');
+        return undef;
+    }
+    $self->{'backend'} = $sqlRep;
+    
+    my $reportId = $sqlRep->reportId( $options->{'Date'},
+                                      $options->{'Time'},
+                                      $options->{'Name'} );
+    $self->{'reportId'} = $reportId;
+    
+    if( $sqlRep->isComplete( $reportId ) )
+    {
+        Error('Report already exists');
+        return undef;
+    }
+    
+    return $self;    
+}
+
+
+sub generate
+{
+    die('Virtual method called');    
+}
+
+
+sub isMonthly
+{
+    return 0;
+}
+
+sub usesSrvExport
+{
+    return 0;
+}
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/ReportGenerator/MonthlySrvUsage.pm b/torrus/perllib/Torrus/ReportGenerator/MonthlySrvUsage.pm
new file mode 100644 (file)
index 0000000..481f8ad
--- /dev/null
@@ -0,0 +1,221 @@
+#  Copyright (C) 2005  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: MonthlySrvUsage.pm,v 1.1 2010-12-27 00:03:58 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# For all service IDs available, build monthly usage figures:
+# Average, Maximum, and Percentile (default 95th percentile)
+# 
+
+package Torrus::ReportGenerator::MonthlySrvUsage;
+
+use strict;
+use POSIX qw(floor);
+use Date::Parse;
+use Math::BigFloat;
+
+use Torrus::Log;
+use Torrus::ReportGenerator;
+use Torrus::ServiceID;
+
+use base 'Torrus::ReportGenerator';
+
+sub isMonthly
+{
+    return 1;
+}
+
+sub usesSrvExport
+{
+    return 1;
+}
+
+
+sub generate
+{
+    my $self = shift;
+
+    my $percentile = $self->{'options'}->{'Percentile'};
+    if( not defined( $percentile ) )
+    {
+        $percentile = 95;
+    }
+
+    my $step = $self->{'options'}->{'Step'};
+    if( not defined( $step ) )
+    {
+        $step = 300;
+    }
+
+    my $srvIDParams = new Torrus::ServiceID();
+    
+    my $srvIDs = $self->{'srvexport'}->getServiceIDs();
+    foreach my $serviceid ( @{$srvIDs} )
+    {
+        &Torrus::DB::checkInterrupted();
+        
+        my $data = $self->{'srvexport'}->getIntervalData
+            ( $self->{'StartDate'}, $self->{'EndDate'}, $serviceid );
+
+        &Torrus::DB::checkInterrupted();
+
+        next if scalar( @{$data} ) == 0;
+        Debug('MonthlySrvUsage: Generating report for ' . $serviceid);
+
+        my $params = $srvIDParams->getParams( $serviceid );
+        
+        my @aligned = ();
+        $#aligned = floor( $self->{'RangeSeconds'} / $step );
+        my $nDatapoints = scalar( @aligned );
+            
+        # Fill in the aligned array. For each interval by modulo(step),
+        # we take the maximum value from the available data
+
+        my $maxVal = 0;
+        
+        foreach my $row ( @{$data} )
+        {
+            my $rowtime = str2time( $row->{'srv_date'} . 'T' .
+                                    $row->{'srv_time'} );
+            my $pos = floor( ($rowtime - $self->{'StartUnixTime'}) / $step );
+            my $value = Math::BigFloat->new( $row->{'value'} );
+            if( $value->is_nan() )
+            {
+                $value->bzero();
+                $row->{'value'} = 0;
+            }
+            
+            if( ( not defined( $aligned[$pos] ) ) or
+                $aligned[$pos] < $value )
+            {
+                $aligned[$pos] = $value;
+                if( $value > $maxVal )
+                {
+                    $maxVal = $value;
+                }
+            }
+        }
+
+        &Torrus::DB::checkInterrupted();
+
+        # Set undefined values to zero and calculate the average
+
+        my $sum = Math::BigFloat->new(0);
+        my $unavailCount = 0;
+        foreach my $pos ( 0 .. $#aligned )
+        {
+            if( not defined( $aligned[$pos] ) )
+            {
+                $aligned[$pos] = 0;
+                $unavailCount++;
+            }
+            else
+            {
+                $sum += $aligned[$pos];
+            }
+        }
+
+        &Torrus::DB::checkInterrupted();
+
+        my $avgVal = $sum / $nDatapoints;
+
+        # Calculate the percentile
+
+        my @sorted = sort {$a <=> $b} @aligned;
+        my $pcPos = floor( $nDatapoints * $percentile / 100 );
+        my $pcVal = $sorted[$pcPos];
+
+        # Calculate the total volume if it's a counter
+        my $volume = Math::BigFloat->new(0);
+        my $volumeDefined = 0;
+        if( not defined( $params->{'dstype'} ) or
+            $params->{'dstype'} =~ /^COUNTER/o )
+        {
+            $volumeDefined = 1;
+            foreach my $row ( @{$data} )
+            {
+                $volume += $row->{'value'} * $row->{'intvl'};
+            }
+        }
+
+        # Adjust units and scale
+
+        my $usageUnits = '';
+        my $volumeUnits = '';
+        if( not defined( $params->{'units'} ) or
+            $params->{'units'} eq 'bytes' )
+        {
+            # Adjust bytes into megabit per second
+            $usageUnits = 'Mbps';
+            $maxVal *= 8e-6;
+            $avgVal *= 8e-6;
+            $pcVal  *= 8e-6;
+
+            # Adjust volume bytes into megabytes
+            $volumeUnits = 'GB';
+            $volume /= 1073741824;
+        }
+        
+        $self->{'backend'}->addField( $self->{'reportId'}, {
+            'name'      => 'MAX',
+            'serviceid' => $serviceid,
+            'value'     => $maxVal,
+            'units'     => $usageUnits });
+        
+        $self->{'backend'}->addField( $self->{'reportId'}, {
+            'name'      => 'AVG',
+            'serviceid' => $serviceid,
+            'value'     => $avgVal,
+            'units'     => $usageUnits });
+                                      
+        $self->{'backend'}->addField( $self->{'reportId'}, {
+            'name'      => sprintf('%s%s', $percentile, 'TH_PERCENTILE'),
+            'serviceid' => $serviceid,
+            'value'     => $pcVal,
+            'units'     => $usageUnits });
+        
+        $self->{'backend'}->addField( $self->{'reportId'}, {
+            'name'      => 'UNAVAIL',
+            'serviceid' => $serviceid,
+            'value'     => ($unavailCount*100)/$nDatapoints,
+            'units'     => '%' });
+
+        if( $volumeDefined )
+        {
+            $self->{'backend'}->addField( $self->{'reportId'}, {
+                'name'      => 'VOLUME',
+                'serviceid' => $serviceid,
+                'value'     => $volume,
+                'units'     => $volumeUnits });
+        }
+    }
+
+    &Torrus::DB::checkInterrupted();
+
+    $self->{'backend'}->finalize( $self->{'reportId'} );
+}
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/ReportOutput.pm b/torrus/perllib/Torrus/ReportOutput.pm
new file mode 100644 (file)
index 0000000..b4a4c57
--- /dev/null
@@ -0,0 +1,210 @@
+#  Copyright (C) 2005  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: ReportOutput.pm,v 1.1 2010-12-27 00:03:40 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Package for generating report output to HTML, PDF, whatever
+# Media-specific classes should inherit from this package
+# and 
+
+package Torrus::ReportOutput;
+
+use strict;
+
+use Torrus::Log;
+use Torrus::SQL::Reports;
+use Torrus::ServiceID;
+
+
+sub new
+{
+    my $class = shift;
+    my $options = shift;
+    
+    my $self = {};
+    bless ($self, $class);
+    
+    $self->{'options'} = $options;    
+    defined( $self->{'options'}->{'Tree'} ) or die;
+    
+    my $sqlRep = Torrus::SQL::Reports->new( $options->{'ReportsSqlSubtype'} );
+    if( not defined( $sqlRep ) )
+    {
+        Error('Cannot connect to the database');
+        return undef;
+    }
+    $self->{'backend'} = $sqlRep;
+
+    my $outdir = $Torrus::Global::reportsDir . '/' .
+        $self->{'options'}->{'Tree'};
+    $self->{'outdir'} = $outdir;
+
+    if( not -d $outdir )
+    {
+        if( not mkdir( $outdir ) )
+        {
+            Error('Cannot create directory ' . $outdir . ': ' . $!);
+            return undef;
+        }
+    }
+
+    return $self;    
+}
+
+# initialize the subclasses' internals
+sub init
+{
+    my $self = shift;
+    
+    return 1;
+}
+
+
+sub generate
+{
+    my $self = shift;
+
+    my $ok = 1;
+    
+    my %monthlyReportNames;
+
+    my $srvIdList;
+    if( not $self->{'options'}->{'All_Service_IDs'} )
+    {
+        my $srvId = new Torrus::ServiceID;
+        $srvIdList = $srvId->getAllForTree( $self->{'options'}->{'Tree'} );
+    }
+    
+    my $allReports = $self->{'backend'}->getAllReports( $srvIdList );
+
+    # frontpage, title, list of years, etc.
+    $self->genIntroduction( $allReports );
+
+    while( my( $year, $yearRef ) = each %{$allReports} )
+    {
+        my $monthlyReportFields = {};
+        my $srvidMonthlyFields = {};
+        
+        while( my( $month, $monthRef ) = each %{$yearRef} )
+        {
+            my $dailyReportFields = {};
+            
+            while( my( $day, $dayRef ) = each %{$monthRef} )
+            {
+                while( my( $reportName, $fieldsRef ) = each %{$dayRef} )
+                {
+                    # Check if the report is monthly
+                    if( not defined( $monthlyReportNames{$reportName} ) )
+                    {
+                        my $class =
+                            $Torrus::ReportGenerator::modules{$reportName};
+                        eval( 'require ' . $class );
+                        die( $@ ) if $@;
+
+                        $monthlyReportNames{$reportName} =
+                            $class->isMonthly() ? 1:0;
+                    }
+
+                    # This report is monthly -- do not include it in daily
+                    # list.
+                    if( $monthlyReportNames{$reportName} )
+                    {
+                        $monthlyReportFields->{$month}{$reportName} =
+                            $fieldsRef;
+                        while( my( $serviceid, $fref ) = each %{$fieldsRef} )
+                        {
+                            $srvidMonthlyFields->{$serviceid}{$reportName}->{
+                                $month} = $fref;
+                        }
+                    }
+                    else
+                    {
+                        $dailyReportFields->{$day} = $dayRef;
+                    }
+                }
+            }
+
+            $ok = $self->genDailyOutput( $year, $month, $dailyReportFields )?
+                $ok:0;
+        }
+
+        $ok = $self->genSrvIdOutput( $year, $srvidMonthlyFields ) ? $ok:0;
+        $ok = $self->genMonthlyOutput( $year, $monthlyReportFields ) ? $ok:0;;
+    }
+
+    return $ok;
+}
+
+
+# Print the head page and years reference
+sub genIntroduction
+{
+    my $self = shift;
+    my $allReports = shift;
+
+    return 1;
+}
+
+
+# Print monthly report for a given service ID
+# The fields argument is a hash of hashes:
+# serviceid => reportname => month => fieldname => {value, units}
+sub genSrvIdOutput
+{
+    my $self = shift;
+    my $year = shift;    
+    my $fields = shift;
+
+    return 1;
+}
+    
+# Print daily report
+# Fields structure:
+# day => reportname => serviceid => fieldname => {value, units}
+sub genDailyOutput
+{
+    my $self = shift;
+    my $year = shift;    
+    my $month = shift;    
+    my $fields = shift;
+
+    return 1;
+}
+
+# Print monthly report
+# fields:
+# month => reportname => serviceid => fieldname => {value, units}
+sub genMonthlyOutput
+{
+    my $self = shift;
+    my $year = shift;    
+    my $fields = shift;
+
+    return 1;
+}    
+    
+        
+    
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/ReportOutput/HTML.pm b/torrus/perllib/Torrus/ReportOutput/HTML.pm
new file mode 100644 (file)
index 0000000..40348a6
--- /dev/null
@@ -0,0 +1,296 @@
+#  Copyright (C) 2005  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: HTML.pm,v 1.1 2010-12-27 00:03:46 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+package Torrus::ReportOutput::HTML;
+
+use strict;
+use Template;
+use Date::Format;
+
+use Torrus::Log;
+use Torrus::ReportOutput;
+use Torrus::SiteConfig;
+
+use base 'Torrus::ReportOutput';
+
+our @monthNames = qw
+    (January February March April May June
+     July August September October November December);
+
+sub init
+{
+    my $self = shift;
+
+    Torrus::SiteConfig::loadStyling();
+    
+    my $htmldir = $self->{'outdir'} . '/html';
+    if( not -d $htmldir )
+    {
+        Verbose('Creating directory: ' . $htmldir);
+        if( not mkdir( $htmldir ) )
+        {
+            Error('Cannot create directory ' . $htmldir . ': ' . $!);
+            return 0;
+        }
+    }
+    $self->{'htmldir'} = $htmldir;
+    
+    $self->{'tt'} =
+        new Template(INCLUDE_PATH => $Torrus::Global::templateDirs,
+                     TRIM => 1);
+    return 1;
+}
+
+
+# Print the head page and years reference
+sub genIntroduction
+{
+    my $self = shift;
+    my $allReports = shift;
+
+    return $self->render({
+        'filename' => $self->indexFilename(),
+        'template' => 'index',
+        'data' => $allReports });    
+}
+
+
+# Print monthly report for a given service ID
+# The fields argument is a hash of hashes:
+# serviceid => reportname => month => fieldname => {value, units}
+sub genSrvIdOutput
+{
+    my $self = shift;
+    my $year = shift;    
+    my $fields = shift;
+
+    my $ok = 1;
+    while( my( $serviceid, $ref ) = each %{$fields} )
+    {
+        $ok = $self->render({
+            'filename' => $self->srvIdFilename($year, $serviceid),
+            'template' => 'serviceid',
+            'data' => $ref,
+            'serviceid' => $serviceid,
+            'year' => $year }) ? $ok:0; 
+    }
+    return $ok;
+}
+
+
+# Print daily report -- NOT IMPLEMENTED YET
+# Fields structure:
+# day => reportname => serviceid => fieldname => {value, units}
+sub genDailyOutput
+{
+    my $self = shift;
+    my $year = shift;    
+    my $month = shift;    
+    my $fields = shift;
+
+    return 1;
+}
+
+
+# Print monthly report
+# fields:
+# month => reportname => serviceid => fieldname => {value, units}
+sub genMonthlyOutput
+{
+    my $self = shift;
+    my $year = shift;    
+    my $fields = shift;
+
+    my $ok = 1;
+    my @months;
+    while( my( $month, $ref ) = each %{$fields} )
+    {
+        if( $self->render({
+            'filename' => $self->monthlyFilename($year, $month),
+            'template' => 'monthly',
+            'data'     => $ref,
+            'year'     => $year,
+            'month'    => $month }) )
+        {
+            push( @months, $month );
+        }
+        else
+        {
+            $ok = 0;
+        }
+    }
+
+    my @sorted = sort {$a <=>$b} @months;
+    $ok = $self->render({
+        'filename' => $self->yearlyFilename($year),
+        'template' => 'yearly',
+        'data'     => {'months' => \@sorted},
+        'year'     => $year }) ? $ok:0;
+    return $ok;
+}
+    
+
+sub indexFilename
+{
+    return 'index.html';
+}
+
+
+sub srvIdFilename
+{
+    my $self = shift;
+    my $year = shift;
+    my $serviceid = shift;
+
+    return sprintf('%.4d_serviceid_%s.html', $year, $serviceid);
+}
+
+sub monthlyFilename
+{
+    my $self = shift;
+    my $year = shift;
+    my $month = shift;
+
+    return sprintf('%.4d_monthly_%.2d.html', $year, $month);
+}
+
+sub yearlyFilename
+{
+    my $self = shift;
+    my $year = shift;
+
+    return sprintf('%.4d_yearly.html', $year);
+}
+    
+    
+
+sub render
+{
+    my $self = shift;
+    my $opt = shift;
+
+    my $outfile = $self->{'htmldir'} . '/' . $opt->{'filename'};
+    my $tmplfile = $Torrus::ReportOutput::HTML::templates{$opt->{'template'}};
+    Debug('Rendering ' . $outfile . ' from ' . $tmplfile);
+    
+    my $ttvars =
+    {
+        'plainURL'   => $Torrus::Renderer::plainURL,
+        'style'      => sub { return $self->style($_[0]); },
+        'treeName'   => $self->{'options'}->{'Tree'},
+        'companyName'=> $Torrus::Renderer::companyName,
+        'companyURL' => $Torrus::Renderer::companyURL,
+        'siteInfo'   => $Torrus::Renderer::siteInfo,
+        'version'    => $Torrus::Global::version,
+        'xmlnorm'    => \&xmlnormalize,
+        'data'       => $opt->{'data'},
+        'year'       => $opt->{'year'},
+        'month'      => $opt->{'month'},
+        'serviceid'  => $opt->{'serviceid'},
+        'indexUrl'   => sub {
+            return $self->reportUrl($self->indexFilename());},
+        'srvIdUrl'   => sub {
+            return $self->reportUrl($self->srvIdFilename($opt->{'year'},
+                                                         $_[0]));},
+        'monthlyUrl' => sub {
+            return $self->reportUrl($self->monthlyFilename($opt->{'year'},
+                                                           $_[0]));},
+        'yearlyUrl' => sub {
+            return $self->reportUrl($self->yearlyFilename($_[0]));},
+        'monthName' => sub {$self->monthName($_[0]);},
+        'formatValue' => sub {
+            if( ref($_[0]))
+            {
+                return sprintf('%.2f %s', $_[0]->{'value'}, $_[0]->{'units'});
+            }
+            else
+            {
+                return 'N/A';
+            }},
+        'timestamp'  => sub { return time2str($Torrus::Renderer::timeFormat,
+                                              time()); },
+    };
+    
+    my $result = $self->{'tt'}->process( $tmplfile, $ttvars, $outfile );
+
+    if( not $result )
+    {
+        Error("Error while rendering " . $outfile . ": " .
+              $self->{'tt'}->error());
+        return 0;
+    }
+    return 1;
+}
+
+
+sub style
+{
+    my $self = shift;
+    my $object = shift;
+
+    my $ret = $Torrus::Renderer::styling{'report'}{$object};
+    if( not defined( $ret ) )
+    {
+        $ret = $Torrus::Renderer::styling{'default'}{$object};
+    }
+
+    return $ret;
+}
+
+sub monthName
+{
+    my $self = shift;
+    my $month = shift;
+
+    return $monthNames[ $month - 1 ];
+}
+
+
+sub reportUrl
+{
+    my $self = shift;
+    my $filename = shift;
+
+    return $Torrus::Renderer::rendererURL . '/' .
+        $self->{'options'}->{'Tree'} . '?htmlreport=' . $filename;
+}
+
+sub xmlnormalize
+{
+    my( $txt )= @_;
+
+    $txt =~ s/\&/\&amp\;/gm;
+    $txt =~ s/\</\&lt\;/gm;
+    $txt =~ s/\>/\&gt\;/gm;
+    $txt =~ s/\'/\&apos\;/gm;
+    $txt =~ s/\"/\&quot\;/gm;
+
+    return $txt;
+}
+
+    
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/SNMP_Failures.pm b/torrus/perllib/Torrus/SNMP_Failures.pm
new file mode 100644 (file)
index 0000000..4203dc1
--- /dev/null
@@ -0,0 +1,205 @@
+#  Copyright (C) 2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: SNMP_Failures.pm,v 1.1 2010-12-27 00:03:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+# SNMP failures statistics interface
+
+package Torrus::SNMP_Failures;
+
+use Torrus::DB;
+use Torrus::Log;
+use strict;
+
+
+sub new
+{
+    my $self = {};
+    my $class = shift;
+    my %options = @_;
+    bless $self, $class;
+
+    %{$self->{'options'}} = %options;
+
+    die() if ( not defined($options{'-Tree'}) or
+               not defined($options{'-Instance'}) );
+
+    $self->{'db_failures'} =
+        new Torrus::DB( 'snmp_failures_' . $options{'-Instance'},
+                        -Subdir => $self->{'options'}{'-Tree'},
+                        -Btree => 1,
+                        -WriteAccess => $options{'-WriteAccess'} );
+
+    $self->{'counters'} = ['unreachable', 'deleted', 'mib_errors'];
+    
+    return( defined( $self->{'db_failures'} ) ? $self:undef );
+}
+
+
+sub DESTROY
+{
+    my $self = shift;    
+    $self->{'db_failures'}->closeNow();
+}
+
+
+
+sub init
+{
+    my $self = shift;
+
+    $self->{'db_failures'}->trunc();
+    
+    foreach my $c ( @{$self->{'counters'}} )
+    {
+        $self->{'db_failures'}->put('c:' . $c, 0);
+    }
+}
+
+
+
+sub host_failure
+{
+    my $self = shift;    
+    my $type = shift;
+    my $hosthash = shift;
+
+    $self->{'db_failures'}->put('h:' . $hosthash,
+                                $type . ':' . time());
+}
+
+
+sub set_counter
+{
+    my $self = shift;    
+    my $type = shift;
+    my $count = shift;
+
+    $self->{'db_failures'}->put('c:' . $type, $count);
+}
+    
+
+sub remove_host
+{
+    my $self = shift;    
+    my $hosthash = shift;
+
+    $self->{'db_failures'}->del('h:' . $hosthash);
+}
+
+    
+sub mib_error
+{
+    my $self = shift;    
+    my $hosthash = shift;
+    my $path = shift;
+
+    my $count = $self->{'db_failures'}->get('M:' . $hosthash);
+    $count = 0 unless defined($count);
+
+    $self->{'db_failures'}->put('m:' . $hosthash, $path . ':' . time());    
+    $self->{'db_failures'}->put('M:' . $hosthash, $count + 1);
+
+    my $global_count = $self->{'db_failures'}->get('c:mib_errors');
+    $self->{'db_failures'}->put('c:mib_errors', $global_count + 1);
+}
+
+
+
+sub read
+{
+    my $self = shift;
+    my $out = shift;
+    my %options = @_;
+
+    foreach my $c ( @{$self->{'counters'}} )
+    {
+        if( not defined( $out->{'total_' . $c} ) )
+        {
+            $out->{'total_' . $c} = 0;
+        }
+        
+        $out->{'total_' . $c} += 
+            $self->{'db_failures'}->get('c:' . $c);
+
+        if( $options{'-details'} and
+            not defined( $out->{'detail_' . $c} ) )
+        {
+            $out->{'detail_' . $c} = {};
+        }
+    }
+
+    &Torrus::DB::checkInterrupted();
+        
+    if( $options{'-details'} )
+    {
+        my $cursor = $self->{'db_failures'}->cursor();
+        while( my ($key, $val) = $self->{'db_failures'}->next($cursor) )
+        {
+            if( $key =~ /^h:(.+)$/o )
+            {
+                my $hosthash = $1;
+                my ($counter, $timestamp) = split(/:/o, $val);
+
+                $out->{'detail_' . $counter}{$hosthash} = {
+                    'timestamp' => 0 + $timestamp,
+                    'time' => scalar(localtime( $timestamp )),
+                };
+            }
+            elsif( $key =~ /^m:(.+)$/o )
+            {
+                my $hosthash = $1;
+                my ($path, $timestamp) = split(/:/o, $val);
+
+                $out->{'detail_mib_errors'}{$hosthash}{'nodes'}{$path} = {
+                    'timestamp' => 0 + $timestamp,
+                    'time' => scalar(localtime( $timestamp )),
+                }
+            }
+            elsif( $key =~ /^M:(.+)$/o )
+            {
+                my $hosthash = $1;
+                my $count = 0 + $val;
+                
+                if( not defined
+                    ( $out->{'detail_mib_errors'}{$hosthash}{'count'}) )
+                {
+                    $out->{'detail_mib_errors'}{$hosthash}{'count'} = 0;
+                }
+                
+                $out->{'detail_mib_errors'}{$hosthash}{'count'} += $count;
+            }
+            
+            &Torrus::DB::checkInterrupted();
+        }
+        
+        undef $cursor;
+    }
+}
+
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/SQL.pm b/torrus/perllib/Torrus/SQL.pm
new file mode 100644 (file)
index 0000000..de54cac
--- /dev/null
@@ -0,0 +1,234 @@
+#  Copyright (C) 2005  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: SQL.pm,v 1.1 2010-12-27 00:03:38 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Package for RDBMS communication management in Torrus
+# Classes should inherit Torrus::SQL and execute Torrus::SQL->new(),
+# and then use methods of DBIx::Abstract.
+
+package Torrus::SQL;
+
+use strict;
+use DBI;
+use DBIx::Abstract;
+use DBIx::Sequence;
+
+use Torrus::Log;
+
+my %connectionArgsCache;
+
+# Obtain connection attributes for particular class and object subtype.
+# The attributes are defined in torrus-siteconfig.pl, in a hash
+# %Torrus::SQL::connections.
+# For a given Perl class and an optional subtype,
+# the connection attributes are derived in the following order:
+# 'Default', 'Default/[subtype]', '[Class]', '[Class]/[subtype]',
+# 'All/[subtype]'.
+# For a simple setup, the default attributes are usually defined for
+# 'Default' key.
+# The key attributes are: 'dsn', 'username', and 'password'.
+# Returns a hash reference with the same keys.
+
+sub getConnectionArgs
+{
+    my $class = shift;
+    my $objClass = shift;
+    my $subtype = shift;
+
+    my $cachekey = $objClass . ( defined( $subtype )? '/'.$subtype : '');
+    if( defined( $connectionArgsCache{$cachekey} ) )
+    {
+        return $connectionArgsCache{$cachekey};
+    }
+    
+    my @lookup = ('Default');
+    if( defined( $subtype ) )
+    {
+        push( @lookup, 'Default/' . $subtype );
+    }
+    push( @lookup, $objClass );
+    if( defined( $subtype ) )
+    {
+        push( @lookup, $objClass . '/' . $subtype, 'All/' . $subtype );
+    }    
+
+    my $ret = {};
+    foreach my $attr ( 'dsn', 'username', 'password' )
+    {
+        my $val;
+        foreach my $key ( @lookup )
+        {
+            if( defined( $Torrus::SQL::connections{$key} ) )
+            {
+                if( defined( $Torrus::SQL::connections{$key}{$attr} ) )
+                {
+                    $val = $Torrus::SQL::connections{$key}{$attr};
+                }
+            }
+        }
+        if( not defined( $val ) )
+        {
+            die('Undefined attribute in %Torrus::SQL::connections: ' . $attr);
+        }
+        $ret->{$attr} = $val;
+    }
+
+    $connectionArgsCache{$cachekey} = $ret;
+    
+    return $ret;
+}
+
+
+my %dbhPool;
+
+# For those who want direct DBI manipulation, simply call
+# Class->dbh($subtype) with optional subtype. Then you don't use
+# any other methods of Torrus::SQL.
+
+sub dbh
+{
+    my $class = shift;
+    my $subtype = shift;
+
+    my $attrs = Torrus::SQL->getConnectionArgs( $class, $subtype );
+
+    my $poolkey = $attrs->{'dsn'} . '//' . $attrs->{'username'} . '//' .
+        $attrs->{'password'};
+
+    my $dbh;
+    
+    if( exists( $dbhPool{$poolkey} ) )
+    {
+        $dbh = $dbhPool{$poolkey};
+        if( not $dbh->ping() )
+        {
+            $dbh = undef;
+            delete $dbhPool{$poolkey};
+        }
+    }
+
+    if( not defined( $dbh ) )
+    {
+        $dbh = DBI->connect( $attrs->{'dsn'},
+                             $attrs->{'username'},
+                             $attrs->{'password'},
+                             { 'PrintError' => 0,
+                               'AutoCommit' => 0 } );
+
+        if( not defined( $dbh ) )
+        {
+            Error('Error connecting to DBI source ' . $attrs->{'dsn'} . ': ' .
+                  $DBI::errstr);
+        }
+        else
+        {
+            $dbhPool{$poolkey} = $dbh;
+        }
+    }
+    
+    return $dbh;
+}
+
+
+END
+{
+    foreach my $dbh ( values %dbhPool )
+    {
+        $dbh->disconnect();
+    }
+}
+
+
+sub new
+{
+    my $class = shift;
+    my $subtype = shift;
+
+    my $self = {};
+
+    $self->{'dbh'} = $class->dbh( $subtype );
+    if( not defined( $self->{'dbh'} ) )
+    {
+        return undef;
+    }
+    
+    $self->{'sql'} = DBIx::Abstract->connect( $self->{'dbh'} );
+
+    $self->{'subtype'} = $subtype;
+    $self->{'classname'} = $class;
+    
+    bless ($self, $class);
+    return $self;    
+}
+
+
+
+sub sequence
+{
+    my $self = shift;
+
+    if( not defined( $self->{'sequence'} ) )
+    {
+        my $attrs = Torrus::SQL->getConnectionArgs( $self->{'classname'},
+                                                    $self->{'subtype'} );
+
+        $self->{'sequence'} = DBIx::Sequence->new({
+            dbh => $self->{'dbh'},
+            allow_id_reuse => 1 });
+    }
+    return $self->{'sequence'};
+}
+       
+
+sub sequenceNext
+{
+    my $self = shift;
+
+    return $self->sequence()->Next($self->{'classname'});
+}
+
+
+sub fetchall
+{
+    my $self = shift;
+    my $columns = shift;
+    
+    my $ret = [];
+    while( defined( my $row = $self->{'sql'}->fetchrow_arrayref() ) )
+    {
+        my $retrecord = {};
+        my $i = 0;
+        foreach my $col ( @{$columns} )
+        {
+            $retrecord->{$col} = $row->[$i++];
+        }
+        push( @{$ret}, $retrecord );
+    }
+    
+    return $ret;
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/SQL/Reports.pm b/torrus/perllib/Torrus/SQL/Reports.pm
new file mode 100644 (file)
index 0000000..5a90b7e
--- /dev/null
@@ -0,0 +1,291 @@
+#  Copyright (C) 2005  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Reports.pm,v 1.1 2010-12-27 00:03:59 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Class for Reporter data manipulation
+package Torrus::SQL::ReportFields;
+
+package Torrus::SQL::Reports;
+
+use strict;
+
+use Torrus::SQL;
+use base 'Torrus::SQL';
+
+use Torrus::Log;
+# use Torrus::SQL::ReportFields;
+
+# The name of the table and columns 
+# defaults configured in torrus-config.pl
+our $tableName;
+our %columns;
+
+
+sub new
+{
+    my $class = shift;
+    my $subtype = shift;
+
+    my $self  = $class->SUPER::new( $subtype );
+
+    $self->{'fields'} = Torrus::SQL::ReportFields->new( $subtype );
+    
+    bless ($self, $class);
+    return $self;
+}
+    
+
+# Find or create a new row in reports table
+# 
+sub reportId
+{
+    my $self = shift;
+    my $repdate = shift;
+    my $reptime = shift;
+    my $repname = shift;
+
+    my $result = $self->{'sql'}->select_one_to_arrayref({
+        'fields' => [ $columns{'id'}, $columns{'iscomplete'} ],
+        'table' => $tableName,
+        'where' => { $columns{'rep_date'}   => $repdate,
+                     $columns{'rep_time'}   => $reptime,
+                     $columns{'reportname'} => $repname } });
+    
+    if( defined( $result ) )
+    {
+        if( not $result->[1] ) 
+        {
+            # iscomplete is zero - the report is unfinished
+            Warn('Found unfinished report ' . $repname . ' for ' .
+                 $repdate . ' ' . $reptime .
+                 '. Deleting the previous report data');
+            $self->{'fields'}->removeAll( $result->[0] );
+        }
+            
+        return $result->[0];
+    }
+    else
+    {
+        my $id = $self->sequenceNext();
+
+        $self->{'sql'}->insert({
+            'table' => $tableName,
+            'fields' => { $columns{'id'} => $id,
+                          $columns{'rep_date'}   => $repdate,
+                          $columns{'rep_time'}   => $reptime,
+                          $columns{'reportname'} => $repname,
+                          $columns{'iscomplete'} => 0 } });
+        
+        return $id;
+    }
+}
+
+
+
+# Add a new field to a report. The field is a hash array reference
+# with keys: 'name', 'serviceid', 'value', 'units'
+
+sub addField
+{
+    my $self = shift;
+    my $reportId = shift;
+    my $field = shift;
+
+    if( isDebug() )
+    {
+        Debug('Adding report field: ' . $field->{'name'} .
+              ':' . $field->{'serviceid'} . ' = ' . $field->{'value'} .
+              ' ' . $field->{'units'});
+    }
+    $self->{'fields'}->add( $reportId, $field );
+}
+
+
+sub getFields
+{
+    my $self = shift;
+    my $reportId = shift;
+
+    return $self->{'fields'}->getAll( $reportId );
+}
+
+
+sub isComplete
+{
+    my $self = shift;
+    my $reportId = shift;
+    
+    my $result = $self->{'sql'}->select_one_to_arrayref({
+        'fields' => [ $columns{'iscomplete'} ],
+        'table' => $tableName,
+        'where' => { $columns{'id'}   => $reportId } });
+    
+    if( defined( $result ) )
+    {
+        return $result->[0];
+    }
+    else
+    {
+        Error('Cannot find the report record for ID=' . $reportId);
+    }
+
+    return 0;
+}
+
+
+sub finalize
+{
+    my $self = shift;
+    my $reportId = shift;
+
+    $self->{'sql'}->update({
+        'table' => $tableName,
+        'where' => { $columns{'id'}   => $reportId },
+        'fields' => { $columns{'iscomplete'} => 1 } });
+
+    $self->{'sql'}->commit();
+}
+
+
+sub getAllReports
+{
+    my $self = shift;
+    my $srvIdList = shift;
+    my $limitDate = shift;
+
+    my $where = { $columns{'iscomplete'} => 1 };
+    
+    if( defined( $limitDate ) )
+    {
+        $where->{$columns{'rep_date'}} = ['>=', $limitDate];
+    }
+    
+    $self->{'sql'}->select({
+        'table' => $tableName,
+        'where' => $where,
+        'fields' => [ $columns{'id'},
+                      $columns{'rep_date'},
+                      $columns{'rep_time'},
+                      $columns{'reportname'} ] });
+    
+    my $reports =
+        $self->fetchall([ 'id', 'rep_date', 'rep_time', 'reportname' ]);
+
+    my $ret = {};
+    foreach my $report ( @{$reports} )
+    {
+        my($year, $month, $day) = split('-', $report->{'rep_date'});
+
+        my $fields = $self->getFields( $report->{'id'} );
+        my $fieldsref = {};
+        
+        foreach my $field ( @{$fields} )
+        {
+            if( not ref( $srvIdList ) or
+                grep {$field->{'serviceid'} eq $_} @{$srvIdList} )
+            {
+                $fieldsref->{$field->{'serviceid'}}->{$field->{'name'}} = {
+                    'value' => $field->{'value'},
+                    'units' => $field->{'units'} };
+            }
+        }
+        
+        $ret->{$year}{$month}{$day}{$report->{'reportname'}} = $fieldsref;
+    }
+    return $ret;    
+}
+
+        
+        
+    
+    
+
+        
+################################################
+## Class for report fields table
+
+package Torrus::SQL::ReportFields;
+use strict;
+
+use Torrus::SQL;
+use base 'Torrus::SQL';
+
+use Torrus::Log;
+
+# The name of the table and columns 
+# defaults configured in torrus-config.pl
+our $tableName;
+our %columns;
+
+sub add
+{
+    my $self = shift;
+    my $reportId = shift;
+    my $attrs = shift;
+    
+    my $id = $self->sequenceNext();
+    
+    $self->{'sql'}->insert({
+        'table' => $tableName,
+        'fields' => { $columns{'id'}         => $id,
+                      $columns{'rep_id'}     => $reportId,
+                      $columns{'name'}       => $attrs->{'name'},
+                      $columns{'serviceid'}  => $attrs->{'serviceid'},
+                      $columns{'value'}      => $attrs->{'value'},
+                      $columns{'units'}      => $attrs->{'units'} } });
+}
+
+
+sub getAll
+{
+    my $self = shift;
+    my $reportId = shift;
+       
+    $self->{'sql'}->select({
+        'table' => $tableName,
+        'where' => { $columns{'rep_id'} => $reportId },
+        'fields' => [ $columns{'name'},
+                      $columns{'serviceid'},
+                      $columns{'value'},
+                      $columns{'units'}] });
+
+    return $self->fetchall([ 'name', 'serviceid', 'value', 'units' ]);
+}
+
+
+sub removeAll
+{
+    my $self = shift;
+    my $reportId = shift;
+       
+    $self->{'sql'}->delete({
+        'table' => $tableName,
+        'where' => { $columns{'rep_id'} => $reportId }});
+}    
+    
+    
+    
+    
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/SQL/SrvExport.pm b/torrus/perllib/Torrus/SQL/SrvExport.pm
new file mode 100644 (file)
index 0000000..ef94547
--- /dev/null
@@ -0,0 +1,109 @@
+#  Copyright (C) 2005  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: SrvExport.pm,v 1.1 2010-12-27 00:03:59 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Class for Collector's external storage export data manipulation.
+
+package Torrus::SQL::SrvExport;
+
+use strict;
+
+use Torrus::SQL;
+use base 'Torrus::SQL';
+
+use Torrus::Log;
+
+# The name of the table and columns where the collector export is stored
+# defaults configured in torrus-config.pl
+our $tableName;
+our %columns;
+
+sub sqlInsertStatement
+{
+    return sprintf('INSERT INTO %s (%s,%s,%s,%s,%s) VALUES (?,?,?,?,?)',
+                   $tableName,
+                   $columns{'srv_date'},
+                   $columns{'srv_time'},
+                   $columns{'serviceid'},
+                   $columns{'value'},
+                   $columns{'intvl'});
+}
+                   
+
+sub getServiceIDs
+{
+    my $self = shift;
+    
+    $self->{'sql'}->select({
+        'fields' => [ $columns{'serviceid'} ],
+        'table' => $tableName,
+        'group' => [ $columns{'serviceid'} ],
+        'order' => [ $columns{'serviceid'} ] });
+
+    my $ret = [];
+    while( defined( my $row = $self->{'sql'}->fetchrow_arrayref() ) )
+    {
+        push( @{$ret}, $row->[0] );
+    }
+
+    return $ret;    
+}    
+
+
+# YYYY-MM-DD for start and end date
+# returns the reference to the array of hashes for selected entries.
+
+sub getIntervalData
+{
+    my $self = shift;
+    my $startdate = shift;
+    my $enddate = shift;
+    my $serviceid = shift;
+
+    $self->{'sql'}->select({
+        'fields' =>
+            [ $columns{'srv_date'},
+              $columns{'srv_time'},
+              $columns{'value'},
+              $columns{'intvl'} ],
+            'table' => $tableName,
+            'where' => [ {$columns{'serviceid'} => $serviceid},
+                         'AND',
+                         {$columns{'srv_date'} => ['>=', $startdate]},
+                         'AND',
+                         {$columns{'srv_date'} => ['<', $enddate]}
+                         ]});
+
+    return $self->fetchall([ 'srv_date', 'srv_time', 'value', 'intvl' ]);
+}
+
+
+    
+    
+    
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Scheduler.pm b/torrus/perllib/Torrus/Scheduler.pm
new file mode 100644 (file)
index 0000000..9777d75
--- /dev/null
@@ -0,0 +1,498 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Scheduler.pm,v 1.1 2010-12-27 00:03:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+# Task scheduler.
+# Task object MUST implement two methods:
+# run() -- the running cycle
+# whenNext() -- returns the next time it must be run.
+# See below the Torrus::Scheduler::PeriodicTask class definition
+#
+# Options:
+#   -Tree        => tree name
+#   -ProcessName => process name and commandline options
+#   -RunOnce     => 1       -- this prevents from infinite loop.   
+
+
+package Torrus::Scheduler;
+
+use strict;
+use Torrus::SchedulerInfo;
+use Torrus::Log;
+
+sub new
+{
+    my $self = {};
+    my $class = shift;
+    my %options = @_;
+    bless $self, $class;
+
+    %{$self->{'options'}} = %options;
+    %{$self->{'data'}} = ();
+
+    if( not defined( $options{'-Tree'} ) or
+        not defined( $options{'-ProcessName'} ) )
+    {
+        die();
+    }
+
+    $self->{'stats'} = new Torrus::SchedulerInfo( -Tree => $options{'-Tree'},
+                                                  -WriteAccess => 1 );    
+    return $self;
+}
+
+
+sub DESTROY
+{
+    my $self = shift;
+    delete $self->{'stats'};
+}
+
+sub treeName
+{
+    my $self = shift;
+    return $self->{'options'}{'-Tree'};
+}
+
+sub setProcessStatus
+{
+    my $self = shift;
+    my $text = shift;
+    $0 = $self->{'options'}{'-ProcessName'} . ' [' . $text . ']';
+}
+
+sub addTask
+{
+    my $self = shift;
+    my $task = shift;
+    my $when = shift;
+
+    if( not defined $when )
+    {
+        # If not specified, run immediately
+        $when = time() - 1;
+    }
+    $self->storeTask( $task, $when );
+    $self->{'stats'}->clearStats( $task->id() );
+}
+
+
+sub storeTask
+{
+    my $self = shift;
+    my $task = shift;
+    my $when = shift;
+
+    if( not defined( $self->{'tasks'}{$when} ) )
+    {
+        $self->{'tasks'}{$when} = [];
+    }
+    push( @{$self->{'tasks'}{$when}}, $task );
+}
+    
+
+sub flushTasks
+{
+    my $self = shift;
+
+    if( defined( $self->{'tasks'} ) )
+    {
+        foreach my $when ( keys %{$self->{'tasks'}} )
+        {
+            foreach my $task ( @{$self->{'tasks'}{$when}} )
+            {
+                $self->{'stats'}->clearStats( $task->id() );
+            }
+        }
+        undef $self->{'tasks'};
+    }
+}
+
+
+sub run
+{
+    my $self = shift;
+
+    my $stop = 0;
+
+    while( not $stop )
+    {
+        $self->setProcessStatus('initializing scheduler');
+        while( not $self->beforeRun() )
+        {
+            &Torrus::DB::checkInterrupted();
+            
+            Error('Scheduler initialization error. Sleeping ' .
+                  $Torrus::Scheduler::failedInitSleep . ' seconds');
+
+            &Torrus::DB::setUnsafeSignalHandlers();
+            sleep($Torrus::Scheduler::failedInitSleep);
+            &Torrus::DB::setSafeSignalHandlers();
+        }
+        $self->setProcessStatus('');
+        my $nextRun = time() + 3600;
+        foreach my $when ( keys %{$self->{'tasks'}} )
+        {
+            # We have 1-second rounding error
+            if( $when <= time() + 1 )
+            {
+                foreach my $task ( @{$self->{'tasks'}{$when}} )
+                {
+                    &Torrus::DB::checkInterrupted();
+                    
+                    my $startTime = time();
+
+                    $self->beforeTaskRun( $task, $startTime, $when );
+                    $task->beforeRun( $self->{'stats'} );
+
+                    $self->setProcessStatus('running');
+                    $task->run();
+                    my $whenNext = $task->whenNext();
+                    
+                    $task->afterRun( $self->{'stats'}, $startTime );
+                    $self->afterTaskRun( $task, $startTime );
+                    
+                    if( $whenNext > 0 )
+                    {
+                        if( $whenNext == $when )
+                        {
+                            Error("Incorrect time returned by task");
+                        }
+                        $self->storeTask( $task, $whenNext );
+                        if( $nextRun > $whenNext )
+                        {
+                            $nextRun = $whenNext;
+                        }
+                    }
+                }
+                delete $self->{'tasks'}{$when};
+            }
+            elsif( $nextRun > $when )
+            {
+                $nextRun = $when;
+            }
+        }
+
+        if( $self->{'options'}{'-RunOnce'} or
+            ( scalar( keys %{$self->{'tasks'}} ) == 0 and
+              not $self->{'options'}{'-RunAlways'} ) )
+        {
+            $self->setProcessStatus('');
+            $stop = 1;
+        }
+        else
+        {
+            if( scalar( keys %{$self->{'tasks'}} ) == 0 )
+            {
+                Info('Tasks list is empty. Will sleep until ' .
+                     scalar(localtime($nextRun)));
+            }
+
+            $self->setProcessStatus('sleeping');
+            &Torrus::DB::setUnsafeSignalHandlers();            
+            Debug('We will sleep until ' . scalar(localtime($nextRun)));
+            
+            if( $Torrus::Scheduler::maxSleepTime > 0 )
+            {
+                Debug('This is a VmWare-like clock. We devide the sleep ' .
+                      'interval into small pieces');
+                while( time() < $nextRun )
+                {
+                    my $sleep = $nextRun - time();
+                    if( $sleep > $Torrus::Scheduler::maxSleepTime )
+                    {
+                        $sleep = $Torrus::Scheduler::maxSleepTime;
+                    }
+                    Debug('Sleeping ' . $sleep . ' seconds');
+                    sleep( $sleep );
+                }
+            }
+            else
+            {
+                my $sleep = $nextRun - time();
+                if( $sleep > 0 )
+                {
+                    sleep( $sleep );
+                }
+            }
+
+            &Torrus::DB::setSafeSignalHandlers();
+        }
+    }
+}
+
+
+# A method to override by ancestors. Executed every time before the
+# running cycle. Must return true value when finishes.
+sub beforeRun
+{
+    my $self = shift;
+    Debug('Torrus::Scheduler::beforeRun() - doing nothing');
+    return 1;
+}
+
+
+sub beforeTaskRun
+{
+    my $self = shift;
+    my $task = shift;
+    my $startTime = shift;
+    my $plannedStartTime = shift;
+
+    if( not $task->didNotRun() and  $startTime > $plannedStartTime + 1 )
+    {
+        my $late = $startTime - $plannedStartTime;
+        Verbose(sprintf('Task delayed %d seconds', $late));
+        $self->{'stats'}->setStatsValues( $task->id(), 'LateStart', $late );
+    }
+}
+
+
+sub afterTaskRun
+{
+    my $self = shift;
+    my $task = shift;
+    my $startTime = shift;
+
+    my $len = time() - $startTime;
+    Verbose(sprintf('%s task finished in %d seconds', $task->name(), $len));
+    
+    $self->{'stats'}->setStatsValues( $task->id(), 'RunningTime', $len );
+}
+
+
+# User data can be stored here
+sub data
+{
+    my $self = shift;
+    return $self->{'data'};
+}
+
+
+# Periodic task base class
+# Options:
+#   -Period   => seconds    -- cycle period
+#   -Offset   => seconds    -- time offset from even period moments
+#   -Name     => "string"   -- Symbolic name for log messages
+#   -Instance => N          -- instance number
+
+package Torrus::Scheduler::PeriodicTask;
+
+use Torrus::Log;
+use strict;
+
+sub new
+{
+    my $self = {};
+    my $class = shift;
+    my %options = @_;
+    bless $self, $class;
+
+    if( not defined( $options{'-Instance'} ) )
+    {
+        $options{'-Instance'} = 0;
+    }
+
+    %{$self->{'options'}} = %options;
+
+    $self->{'options'}{'-Period'} = 0 unless
+        defined( $self->{'options'}{'-Period'} );
+
+    $self->{'options'}{'-Offset'} = 0 unless
+        defined( $self->{'options'}{'-Offset'} );
+        
+    $self->{'options'}{'-Name'} = "PeriodicTask" unless
+        defined( $self->{'options'}{'-Name'} );
+
+    $self->{'missedPeriods'} = 0;
+
+    $self->{'options'}{'-Started'} = time();
+
+    # Array of (Name, Value) pairs for any kind of stats    
+    $self->{'statValues'} = [];
+    
+    Debug("New Periodic Task created: period=" .
+          $self->{'options'}{'-Period'} .
+          " offset=" . $self->{'options'}{'-Offset'});
+
+    return $self;
+}
+
+
+sub whenNext
+{
+    my $self = shift;
+
+    if( $self->period() > 0 )
+    {
+        my $now = time();
+        my $period = $self->period();
+        my $offset = $self->offset();
+        my $previous;
+
+        if( defined $self->{'previousSchedule'} )
+        {
+            if( $now - $self->{'previousSchedule'} <= $period )
+            {
+                $previous = $self->{'previousSchedule'};
+            }
+            elsif( not $Torrus::Scheduler::ignoreClockSkew )
+            {
+                Error('Last run of ' . $self->{'options'}{'-Name'} .
+                      ' was more than ' . $period . ' seconds ago');
+                $self->{'missedPeriods'} =
+                    int( ($now - $self->{'previousSchedule'}) / $period );
+            }
+        }
+        if( not defined( $previous ) )
+        {
+            $previous = $now - ($now % $period) + $offset;
+        }
+
+        my $whenNext = $previous + $period;
+        $self->{'previousSchedule'} = $whenNext;
+
+        Debug("Task ". $self->{'options'}{'-Name'}.
+              " wants to run next time at " . scalar(localtime($whenNext)));
+        return $whenNext;
+    }
+    else
+    {
+        return undef;
+    }
+}
+
+
+sub beforeRun
+{
+    my $self = shift;
+    my $stats = shift;
+
+    Verbose(sprintf('%s periodic task started. Period: %d:%.2d; ' .
+                    'Offset: %d:%.2d',
+                    $self->name(),
+                    int( $self->period() / 60 ), $self->period() % 60,
+                    int( $self->offset() / 60 ), $self->offset() % 60));    
+}
+
+
+sub afterRun
+{
+    my $self = shift;
+    my $stats = shift;
+    my $startTime = shift;
+    
+    my $len = time() - $startTime;
+    if( $len > $self->period() )
+    {
+        Warn(sprintf('%s task execution (%d) longer than period (%d)',
+                     $self->name(), $len, $self->period()));
+        
+        $stats->setStatsValues( $self->id(), 'TooLong', $len );
+        $stats->incStatsCounter( $self->id(), 'OverrunPeriods',
+                                 int( $len > $self->period() ) );
+    }
+
+    if( $self->{'missedPeriods'} > 0 )
+    {
+        $stats->incStatsCounter( $self->id(), 'MissedPeriods',
+                                 $self->{'missedPeriods'} );
+        $self->{'missedPeriods'} = 0;
+    }
+
+    foreach my $pair( @{$self->{'statValues'}} )
+    {
+        $stats->setStatsValues( $self->id(), @{$pair} );
+    }
+    @{$self->{'statValues'}} = [];
+}
+
+
+sub run
+{
+    my $self = shift;
+    Error("Dummy class Torrus::Scheduler::PeriodicTask was run");
+}
+
+
+sub period
+{
+    my $self = shift;
+    return $self->{'options'}->{'-Period'};
+}
+
+
+sub offset
+{
+    my $self = shift;
+    return $self->{'options'}->{'-Offset'};
+}
+
+
+sub didNotRun
+{
+    my $self = shift;
+    return( not defined( $self->{'previousSchedule'} ) );
+}
+
+
+sub name
+{
+    my $self = shift;
+    return $self->{'options'}->{'-Name'};
+}
+
+sub instance
+{
+    my $self = shift;
+    return $self->{'options'}->{'-Instance'};
+}
+
+
+sub whenStarted
+{
+    my $self = shift;
+    return $self->{'options'}->{'-Started'};
+}
+
+
+sub id
+{
+    my $self = shift;
+    return join(':', 'P', $self->name(), $self->instance(),
+                $self->period(), $self->offset());
+}
+
+sub setStatValue
+{
+    my $self = shift;
+    my $name = shift;
+    my $value = shift;
+
+    push( @{$self->{'statValues'}}, [$name, $value] );
+}
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/SchedulerInfo.pm b/torrus/perllib/Torrus/SchedulerInfo.pm
new file mode 100644 (file)
index 0000000..452b161
--- /dev/null
@@ -0,0 +1,216 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: SchedulerInfo.pm,v 1.1 2010-12-27 00:03:43 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+# Task scheduler runtime information. Quite basic statistics access.
+
+package Torrus::SchedulerInfo;
+
+use Torrus::DB;
+use Torrus::Log;
+use strict;
+
+
+sub new
+{
+    my $self = {};
+    my $class = shift;
+    my %options = @_;
+    bless $self, $class;
+
+    %{$self->{'options'}} = %options;
+
+    die() if not defined( $options{'-Tree'} );
+
+    $self->{'db_stats'} =
+        new Torrus::DB( 'scheduler_stats',
+                      -Subdir => $self->{'options'}{'-Tree'},
+                      -Btree => 1,
+                      -WriteAccess => $options{'-WriteAccess'} );
+
+    return( defined( $self->{'db_stats'} ) ? $self:undef );
+}
+
+
+sub DESTROY
+{
+    my $self = shift;
+    delete $self->{'db_stats'};
+}
+
+
+sub readStats
+{
+    my $self = shift;
+
+    my $stats = {};
+
+    my $cursor = $self->{'db_stats'}->cursor();
+    while( my ($key, $value) = $self->{'db_stats'}->next($cursor) )
+    {
+        my( $id, $variable ) = split( '#', $key );
+        if( defined( $id ) and defined( $variable ) )
+        {
+            $stats->{$id}{$variable} = $value;
+        }
+    }
+    undef $cursor;
+
+    return $stats;
+}
+
+
+sub setValue
+{
+    my $self = shift;
+    my $id = shift;
+    my $variable = shift;
+    my $value = shift;
+
+    $self->{'db_stats'}->put( join('#', $id, $variable), $value );
+}
+
+sub getValue
+{
+    my $self = shift;
+    my $id = shift;
+    my $variable = shift;
+    
+    return $self->{'db_stats'}->get( join('#', $id, $variable) );
+}
+
+
+sub clearStats
+{
+    my $self = shift;
+    my $id = shift;
+
+    my $cursor = $self->{'db_stats'}->cursor( -Write => 1 );
+    while( my ($key, $value) = $self->{'db_stats'}->next($cursor) )
+    {
+        my( $db_id, $variable ) = split( '#', $key );
+        if( defined( $db_id ) and defined( $variable ) and
+            $id eq $db_id )
+        {
+            $self->{'db_stats'}->c_del( $cursor );
+        }
+    }
+    undef $cursor;
+}
+
+
+sub clearAll
+{
+    my $self = shift;
+    $self->{'db_stats'}->trunc();
+}
+
+
+sub setStatsValues
+{
+    my $self = shift;
+    my $id = shift;
+    my $variable = shift;
+    my $value = shift;
+
+    $self->setValue( $id, 'Last' . $variable, $value );
+
+    my $maxName = 'Max' . $variable;
+    my $maxVal = $self->getValue( $id, $maxName );
+    if( not defined( $maxVal ) or $value > $maxVal )
+    {
+        $maxVal = $value;
+    }
+    $self->setValue( $id, $maxName, $maxVal );
+
+    my $minName = 'Min' . $variable;
+    my $minVal = $self->getValue( $id, $minName );
+    if( not defined( $minVal ) or $value < $minVal )
+    {
+        $minVal = $value;
+    }
+    $self->setValue( $id, $minName, $minVal );
+
+    my $timesName = 'NTimes' . $variable;
+    my $nTimes = $self->getValue( $id, $timesName );
+
+    my $avgName = 'Avg' . $variable;
+    my $average = $self->getValue( $id, $avgName );
+
+    if( not defined( $nTimes ) )
+    {
+        $nTimes = 1;
+        $average = $value;
+    }
+    else
+    {
+        $average = ( $average * $nTimes + $value ) / ( $nTimes + 1 );
+        $nTimes++;
+    }
+    $self->setValue( $id, $timesName, $nTimes );
+    $self->setValue( $id, $avgName, $average );
+
+    my $expAvgName = 'ExpAvg' . $variable;
+    my $expAverage = $self->getValue( $id, $expAvgName );
+    if( not defined( $expAverage ) )
+    {
+        $expAverage = $value;
+    }
+    else
+    {
+        my $alpha = $Torrus::Scheduler::statsExpDecayAlpha;
+        $expAverage = $alpha * $value + ( 1 - $alpha ) * $expAverage;
+    }
+    $self->setValue( $id, $expAvgName, $expAverage );
+}
+
+
+sub incStatsCounter
+{
+    my $self = shift;
+    my $id = shift;
+    my $variable = shift;
+    my $increment = shift;
+
+    if( not defined( $increment ) )
+    {
+        $increment = 1;
+    }
+
+    my $name = 'Count' . $variable;
+    my $previous = $self->getValue( $id, $name );
+
+    if( not defined( $previous ) )
+    {
+        $previous = 0;
+    }
+    
+    $self->setValue( $id, $name, $previous + $increment );
+}
+
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/Search.pm b/torrus/perllib/Torrus/Search.pm
new file mode 100644 (file)
index 0000000..9923757
--- /dev/null
@@ -0,0 +1,148 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Search.pm,v 1.1 2010-12-27 00:03:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+
+# Task scheduler runtime information. Quite basic statistics access.
+
+package Torrus::Search;
+
+use Torrus::DB;
+use Torrus::Log;
+use strict;
+
+
+sub new
+{
+    my $self = {};
+    my $class = shift;
+    my %options = @_;
+    bless $self, $class;
+
+    %{$self->{'options'}} = %options;
+
+    return $self;
+}
+
+
+sub openTree
+{
+    my $self = shift;
+    my $tree = shift;
+
+    my $db = new Torrus::DB
+        ( 'searchwords',
+          -Subdir => $tree,
+          -Btree => 1,
+          -Duplicates => 1,
+          -WriteAccess => $self->{'options'}{'-WriteAccess'},
+          -Truncate => $self->{'options'}{'-WriteAccess'} );
+
+    $self->{'db_treewords'}{$tree} = $db;
+}
+
+
+sub closeTree
+{
+    my $self = shift;
+    my $tree = shift;
+
+    $self->{'db_treewords'}{$tree}->closeNow();
+}
+
+
+sub openGlobal
+{
+    my $self = shift;
+
+    my $db = new Torrus::DB
+        ( 'globsearchwords',
+          -Btree => 1,
+          -Duplicates => 1,
+          -WriteAccess => $self->{'options'}{'-WriteAccess'},
+          -Truncate => $self->{'options'}{'-WriteAccess'} );
+
+    $self->{'db_globwords'} = $db;    
+}
+
+
+sub storeKeyword
+{
+    my $self = shift;
+    my $tree = shift;
+    my $keyword = lc( shift );
+    my $path = shift;
+    my $param = shift;
+
+    my $val = $path;
+    if( defined( $param ) )
+    {
+        $val .= ':' . $param;
+    }
+
+    my $lookupkey = join( ':', $tree, $keyword, $val );    
+    if( not $self->{'stored'}{$lookupkey} )
+    {
+        $self->{'db_treewords'}{$tree}->put( $keyword, $val );
+        if( defined( $self->{'db_globwords'} ) )
+        {
+            $self->{'db_globwords'}->put( $keyword, join(':', $tree, $val) );
+        }
+
+        $self->{'stored'}{$lookupkey} = 1;
+    }
+}
+
+sub searchPrefix
+{
+    my $self = shift;
+    my $prefix = lc( shift );
+    my $tree = shift;
+
+    my $db = defined( $tree ) ?
+        $self->{'db_treewords'}{$tree} : $self->{'db_globwords'};
+
+    my $result = $db->searchPrefix( $prefix );
+
+    my $ret = [];
+    
+    if( defined( $result ) )
+    {
+        foreach my $pair ( @{$result} )
+        {
+            my $retstrings = [];
+            push( @{$retstrings}, split(':', $pair->[1]) );
+            push( @{$ret}, $retstrings );
+        }
+    }
+
+    return $ret;
+}
+    
+    
+
+
+    
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/ServiceID.pm b/torrus/perllib/Torrus/ServiceID.pm
new file mode 100644 (file)
index 0000000..90cbb98
--- /dev/null
@@ -0,0 +1,188 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: ServiceID.pm,v 1.1 2010-12-27 00:03:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+# Manage the properties assigned to Service IDs
+
+package Torrus::ServiceID;
+
+use Torrus::DB;
+use Torrus::Log;
+
+use strict;
+
+
+sub new
+{
+    my $self = {};
+    my $class = shift;
+    my %options = @_;
+    bless $self, $class;
+
+    my $writing = $options{'-WriteAccess'};
+
+    $self->{'db_params'} =
+        new Torrus::DB( 'serviceid_params',
+                        -Btree => 1,
+                        -WriteAccess => $writing );
+    defined( $self->{'db_params'} ) or return( undef );
+
+    $self->{'is_writing'} = $writing;
+
+    return $self;
+}
+
+
+sub DESTROY
+{
+    my $self = shift;
+    Debug('Destroyed ServiceID object');
+    undef $self->{'db_params'};
+}
+
+
+
+sub idExists
+{
+    my $self = shift;
+    my $serviceid = shift;
+    my $tree = shift;
+
+    if( defined($tree) )
+    {
+        return $self->{'db_params'}->searchList( 't:'.$tree, $serviceid );
+    }
+
+    return $self->{'db_params'}->searchList( 'a:', $serviceid );
+}    
+    
+
+sub add
+{
+    my $self = shift;
+    my $serviceid = shift;
+    my $parameters = shift;
+
+    $self->{'db_params'}->addToList( 'a:', $serviceid );
+    
+    my $trees = $parameters->{'trees'};
+
+    foreach my $tree ( split(/\s*,\s*/o, $trees) )
+    {
+        $self->{'db_params'}->addToList( 't:'.$tree, $serviceid );
+    }
+
+    foreach my $param ( keys %{$parameters} )
+    {
+        my $val = $parameters->{$param};
+        
+        if( defined( $val ) and length( $val ) > 0 )
+        {
+            $self->{'db_params'}->put( 'p:'.$serviceid.':'.$param, $val );
+            $self->{'db_params'}->addToList( 'P:'.$serviceid, $param );
+        }
+    }
+}
+
+
+sub getParams
+{
+    my $self = shift;
+    my $serviceid = shift;
+
+    my $ret = {};
+    my $plist = $self->{'db_params'}->get( 'P:'.$serviceid );
+    foreach my $param ( split(',', $plist ) )
+    {
+        $ret->{$param} =
+            $self->{'db_params'}->get( 'p:'.$serviceid.':'.$param );
+    }
+
+    return $ret;
+}    
+
+
+sub getAllForTree
+{
+    my $self = shift;
+    my $tree = shift;
+
+    my $ret = [];
+    my $idlist = $self->{'db_params'}->get('t:'.$tree);
+    if( defined( $idlist ) )
+    {
+        push( @{$ret}, split( ',', $idlist ) );
+    }
+    return $ret;
+}
+
+
+sub cleanAllForTree
+{
+    my $self = shift;
+    my $tree = shift;
+
+    my $idlist = $self->{'db_params'}->get('t:'.$tree);
+    if( defined( $idlist ) )
+    {
+        foreach my $serviceid ( split( ',', $idlist ) )
+        {
+            # A ServiceID may belong to several trees.
+            # delete it from all other trees.
+
+            my $srvTrees =
+                $self->{'db_params'}->get( 'p:'.$serviceid.':trees' );
+            
+            foreach my $srvTree ( split(/\s*,\s*/o, $srvTrees) )
+            {
+                if( $srvTree ne $tree )
+                {
+                    $self->{'db_params'}->delFromList( 't:'.$srvTree,
+                                                       $serviceid );
+                }
+            }            
+            
+            $self->{'db_params'}->delFromList( 'a:', $serviceid );
+            
+            my $plist = $self->{'db_params'}->get( 'P:'.$serviceid );
+
+            foreach my $param ( split(',', $plist ) )
+            {
+                $self->{'db_params'}->del( 'p:'.$serviceid.':'.$param );
+            }
+
+            $self->{'db_params'}->del( 'P:'.$serviceid );
+            
+        }
+        $self->{'db_params'}->deleteList('t:'.$tree);
+    }
+}
+
+            
+            
+            
+            
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/SiteConfig.pm b/torrus/perllib/Torrus/SiteConfig.pm
new file mode 100644 (file)
index 0000000..947d085
--- /dev/null
@@ -0,0 +1,335 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: SiteConfig.pm,v 1.1 2010-12-27 00:03:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+## %Torrus::Global::treeConfig manipulation
+
+package Torrus::SiteConfig;
+
+use Torrus::Log;
+use strict;
+
+our %validDaemonNames = ('collector' => 1,
+                         'monitor'   => 1);
+
+our %mandatoryGraphStyles =
+    (
+     'SingleGraph'     => {'color' => 1, 'line'  => 1},
+     'HWBoundary'     => {'color' => 1, 'line'  => 1},
+     'HWFailure'      => {'color' => 1},
+     'HruleMin'       => {'color' => 1},
+     'HruleNormal'    => {'color' => 1},
+     'HruleMax'       => {'color' => 1},
+     'BpsIn'          => {'color' => 1, 'line'  => 1},
+     'BpsOut'         => {'color' => 1, 'line'  => 1}
+     );
+
+%Torrus::SiteConfig::validLineStyles =
+    (
+     'LINE1' => 1,
+     'LINE2' => 1,
+     'LINE3' => 1,
+     'AREA'  => 1,
+     'STACK' => 1
+     );
+
+## Verify the correctness of %Torrus::Global::treeConfig contents
+
+sub verify
+{
+    my $ok = 1;
+    if( not (scalar( keys %Torrus::Global::treeConfig )) )
+    {
+        Error('%Torrus::Global::treeConfig is not defined or empty');
+        $ok = 0;
+    }
+
+    foreach my $tree ( keys %Torrus::Global::treeConfig )
+    {
+        if( $tree !~ /^[a-zA-Z][a-zA-Z0-9_\-]*$/o )
+        {
+            Error("Invalid tree name: " . $tree);
+            $ok = 0;
+            next;
+        }
+
+        if( not $Torrus::Global::treeConfig{$tree}{'description'} )
+        {
+            Error("Missing description for the tree named \"" . $tree . "\"");
+            $ok = 0;
+        }
+
+        my $xmlfiles = $Torrus::Global::treeConfig{$tree}{'xmlfiles'};
+        if( not ref( $xmlfiles ) or not scalar( @{$xmlfiles} ) )
+        {
+            Error("'xmlfiles' array is not defined for the tree named \"" .
+                  $tree . "\"");
+            $ok = 0;
+        }
+        else
+        {
+            foreach my $file ( @{$xmlfiles} )
+            {
+                $ok = findXMLFile( $file,
+                                   "in the tree named \"" . $tree . "\"" ) ?
+                                       $ok:0;
+            }
+
+            if( ref( $Torrus::Global::treeConfig{$tree}{'run'} ) )
+            {
+                foreach my $daemon
+                    ( keys %{$Torrus::Global::treeConfig{$tree}{'run'}} )
+                {
+                    if( not $validDaemonNames{$daemon} )
+                    {
+                        Error("\"" . $daemon . "\" is not a correct daemon " .
+                              "name in the tree named \"" . $tree . "\"");
+                        $ok = 0;
+                    }
+                }
+            }
+        }
+    }
+
+    foreach my $file ( @Torrus::Global::xmlAlwaysIncludeFirst )
+    {
+        $ok = findXMLFile( $file,
+                           'in @Torrus::Global::xmlAlwaysIncludeFirst' ) ?
+                               $ok:0;
+    }
+    foreach my $file ( @Torrus::Global::xmlAlwaysIncludeLast )
+    {
+        $ok = findXMLFile( $file,
+                           'in @Torrus::Global::xmlAlwaysIncludeLast' ) ?
+                               $ok:0;
+    }
+
+    # Validate the styling profile
+
+    my $file = $Torrus::Global::stylingDir . '/' .
+        $Torrus::Renderer::stylingProfile . '.pl';
+    if( -r $file )
+    {
+        require $file;
+
+        #Color names are always there
+        require $Torrus::Global::stylingDir . '/colornames.pl';
+
+        if( defined($Torrus::Renderer::stylingProfileOverlay) )
+        {
+            my $overlay = $Torrus::Renderer::stylingProfileOverlay;
+            if( -r $overlay )
+            {
+                require $overlay;
+            }
+            else
+            {
+                Error('Error reading styling profile overlay from ' .
+                      $overlay . ': File is not readable');
+                $ok = 0;
+            }
+        }
+
+        my $profile = \%Torrus::Renderer::graphStyles;
+        # Check if mandatory parameters present
+        foreach my $element ( keys %mandatoryGraphStyles )
+        {
+            if( ref( $profile->{$element} ) )
+            {
+                if( $mandatoryGraphStyles{$element}{'color'}
+                    and not defined( $profile->{$element}{'color'} ) )
+                {
+                    Error('Mandatory color for ' . $element .
+                          ' is not defined in ' . $file);
+                    $ok = 0;
+                }
+                if( $mandatoryGraphStyles{$element}{'line'}
+                    and not defined( $profile->{$element}{'line'} ) )
+                {
+                    Error('Mandatory line style for ' . $element .
+                          ' is not defined in ' . $file);
+                    $ok = 0;
+                }
+            }
+            else
+            {
+                Error('Mandatory styling for ' . $element .
+                      ' is not defined in ' . $file);
+                $ok = 0;
+            }
+        }
+        # Check validity of all parameters
+        foreach my $element ( keys %{$profile} )
+        {
+            if( defined( $profile->{$element}{'color'} ) )
+            {
+                my $color = $profile->{$element}{'color'};
+                my $recursionLimit = 100;
+
+                while( $color =~ /^\#\#(\S+)$/ )
+                {
+                    if( $recursionLimit-- <= 0 )
+                    {
+                        Error('Color recursion is too deep');
+                        $ok = 0;
+                    }
+                    else
+                    {
+                        my $colorName = $1;
+                        $color = $profile->{$colorName}{'color'};
+                        if( not defined( $color ) )
+                        {
+                            Error('No color is defined for ' . $colorName);
+                            $ok = 0;
+                        }
+                    }
+                }
+
+                if( $color !~ /^\#[0-9a-fA-F]{6}$/ )
+                {
+                    Error('Invalid color specification for ' . $element .
+                          ' in ' . $file);
+                    $ok = 0;
+                }
+            }
+            if( defined( $profile->{$element}{'line'} ) )
+            {
+                if( not $Torrus::SiteConfig::validLineStyles{
+                    $profile->{$element}{'line'}} )
+                {
+                    Error('Invalid line specification for ' . $element .
+                          ' in ' . $file);
+                    $ok = 0;
+                }
+            }
+        }
+    }
+    else
+    {
+        Error('Error reading styling profile from ' . $file .
+              ': File is not readable');
+        $ok = 0;
+    }
+
+    return $ok;
+}
+
+
+sub findXMLFile
+{
+    my $file = shift;
+    my $msg = shift;
+
+    my $filename;
+    if( defined( $file ) )
+    {
+        my $found = 0;
+        foreach my $dir ( @Torrus::Global::xmlDirs )
+        {
+            $filename = $dir . '/' . $file;
+            if( -r $filename )
+            {
+                $found = 1;
+                last;
+            }
+        }
+        
+        if( not $found )
+        {
+            Error("Cannot find file: " . $file);
+            $filename = undef;
+        }
+    }
+    else
+    {
+        Error("File name undefined " . $msg);
+    }
+    return $filename;
+}
+
+
+sub treeExists
+{
+    my $tree = shift;
+    return defined( $Torrus::Global::treeConfig{$tree} );
+}
+
+
+sub listTreeNames
+{
+    return( sort keys %Torrus::Global::treeConfig );
+}
+
+
+sub mayRunCollector
+{
+    my $tree = shift;
+    my $run = $Torrus::Global::treeConfig{$tree}{'run'}{'collector'};
+    return( defined($run) and $run > 0 );   
+}
+
+sub collectorInstances
+{
+    my $tree = shift;
+    my $run = $Torrus::Global::treeConfig{$tree}{'run'}{'collector'};
+    return( (defined($run) and $run > 1) ? int($run) : 1 ); 
+}
+
+sub mayRunMonitor
+{
+    my $tree = shift;
+    return $Torrus::Global::treeConfig{$tree}{'run'}{'monitor'};
+}
+
+
+sub listXmlFiles
+{
+    my $tree = shift;
+    return @{$Torrus::Global::treeConfig{$tree}{'xmlfiles'}};
+}
+
+
+sub treeDescription
+{
+    my $tree = shift;
+    return $Torrus::Global::treeConfig{$tree}{'description'};
+}
+
+
+sub loadStyling
+{
+    require $Torrus::Global::stylingDir . '/' .
+        $Torrus::Renderer::stylingProfile . '.pl';
+
+    require $Torrus::Global::stylingDir . '/colornames.pl';
+
+    if( defined($Torrus::Renderer::stylingProfileOverlay) )
+    {
+        require $Torrus::Renderer::stylingProfileOverlay;
+    }
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/perllib/Torrus/TimeStamp.pm b/torrus/perllib/Torrus/TimeStamp.pm
new file mode 100644 (file)
index 0000000..0795914
--- /dev/null
@@ -0,0 +1,71 @@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: TimeStamp.pm,v 1.1 2010-12-27 00:03:43 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+package Torrus::TimeStamp;
+
+use Torrus::DB;
+use Torrus::Log;
+
+use strict;
+
+$Torrus::TimeStamp::db = undef;
+
+END
+{
+    Torrus::TimeStamp::release();
+}
+
+sub init
+{
+    not defined( $Torrus::TimeStamp::db ) or
+        die('$Torrus::TimeStamp::db is defined at init');
+    $Torrus::TimeStamp::db = new Torrus::DB('timestamps', -WriteAccess => 1);
+}
+
+sub release
+{
+    undef $Torrus::TimeStamp::db;
+}
+
+sub setNow
+{
+    my $tname = shift;
+    ref( $Torrus::TimeStamp::db ) or
+        die('$Torrus::TimeStamp::db is not defined at setNow');
+    $Torrus::TimeStamp::db->put( $tname, time() );
+}
+
+sub get
+{
+    my $tname = shift;
+    ref( $Torrus::TimeStamp::db ) or
+        die('$Torrus::TimeStamp::db is not defined at get');
+    my $stamp = $Torrus::TimeStamp::db->get( $tname );
+    return defined($stamp) ? $stamp : 0;
+}
+
+
+1;
+
+
+# Local Variables:
+# mode: perl
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/scripts/rrdup_notify.sh b/torrus/scripts/rrdup_notify.sh
new file mode 100644 (file)
index 0000000..baa8f45
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/sh
+# 
+# Periodically check if there are RRD files not updated by collector,
+# and email the warning message.
+# *.old.rrd files are ignored
+
+# $Id: rrdup_notify.sh,v 1.1 2010-12-27 00:04:04 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+# Where the RRD files are located. Separate multiple paths with space
+RRDSTORAGE=/srv/torrus/collector_rrd
+
+# Maximum allowed age of an RRD file, in minutes.
+MAXAGE=60
+
+# Where to send complaints
+NOTIFY=root
+
+TMPFILE=/tmp/rrdup_notify.$$
+
+cp /dev/null ${TMPFILE}
+
+for d in ${RRDSTORAGE}; do
+  find ${d} -name '*.rrd' ! -name '*.old.rrd' \
+    -mmin +${MAXAGE} -print >>${TMPFILE}
+done
+
+nLines=`wc -l ${TMPFILE} | awk '{print $1}'`
+
+if test ${nLines} -gt 0; then
+  cat ${TMPFILE} | \
+    mail -s "`printf \"Warning: %d aged RRD files\" ${nLines}`" ${NOTIFY}
+fi
+
+rm ${TMPFILE}
+
+# Local Variables:
+# mode: shell-script
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/scripts/xml/extract-skeleton.xsl b/torrus/scripts/xml/extract-skeleton.xsl
new file mode 100644 (file)
index 0000000..863cbbd
--- /dev/null
@@ -0,0 +1,87 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: extract-skeleton.xsl,v 1.1 2010-12-27 00:04:04 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+  XSLT Template to transform Torrus configuration into a skeleton of
+  subtrees and leaves only.
+
+-->
+
+<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="xml" encoding="UTF-8" indent="yes" />
+<xsl:strip-space elements="*" />
+
+<xsl:template match="/configuration">
+  <configuration>
+    <creator-info>
+      This file is a result of extract-skeleton.xsl template
+    </creator-info>
+    <xsl:text>
+    </xsl:text>
+    <xsl:apply-templates />
+  </configuration>
+</xsl:template>
+
+
+<xsl:template match="creator-info">
+  <creator-info>
+    <xsl:value-of select="." />
+  </creator-info>
+  <xsl:text>
+  </xsl:text>
+</xsl:template>
+
+
+<xsl:template match="datasources">
+  <datasources>
+    <xsl:apply-templates />
+  </datasources>
+    <xsl:text>
+    </xsl:text>
+</xsl:template>
+
+
+<xsl:template match="subtree">
+  <xsl:text>
+  </xsl:text>
+  <subtree name="{@name}">
+    <xsl:text> </xsl:text>
+    <xsl:apply-templates />
+  </subtree>
+  <xsl:text>
+  </xsl:text>
+</xsl:template>
+
+
+<xsl:template match="leaf">
+  <xsl:text>
+  </xsl:text>
+  <leaf name="{@name}">
+    <xsl:text> </xsl:text>
+    <xsl:apply-templates />
+  </leaf>
+  <xsl:text>
+  </xsl:text>
+</xsl:template>
+
+
+</xsl:transform>
+
diff --git a/torrus/setup_tools/Bundle/Torrus.pm b/torrus/setup_tools/Bundle/Torrus.pm
new file mode 100644 (file)
index 0000000..7fc37ef
--- /dev/null
@@ -0,0 +1,85 @@
+#  Torrus Perl bundle
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Torrus.pm,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+#
+
+
+package Bundle::Torrus;
+
+$VERSION = '1.00';
+
+__END__
+
+=head1 NAME
+
+Bundle::Torrus - A bundle to install Torrus prerequisite modules
+
+=head1 SYNOPSIS
+
+C<perl -I `pwd`/lib -MCPAN -e 'install Bundle::Torrus'>
+
+=head1 CONTENTS
+
+File::Temp                       - required by XML::SAX
+
+XML::NamespaceSupport   1.07     - required by XML::LibXML
+
+XML::SAX                0.11     - required by XML::LibXML
+
+XML::LibXML::Common              - required by XML::LibXML
+
+AppConfig               - required by Template
+
+File::Spec              - required by Template
+
+Crypt::DES     2.03     - required by Net::SNMP
+
+Digest::MD5    2.11     - required by Net::SNMP
+
+Digest::SHA1   1.02     - required by Net::SNMP
+
+Digest::HMAC   1.00     - required by Net::SNMP
+
+MIME::Base64            - required by URI::Escape
+
+
+XML::LibXML     1.54  - older versions do not handle charsets properly
+
+BerkeleyDB      0.19    - older versions do not have trunc()
+
+Template                - this is template-toolkit
+
+Proc::Daemon
+
+Net::SNMP       5.2.0   - older versions may not work
+
+URI::Escape
+
+Apache::Session
+
+Date::Parse
+
+JSON
+
+=head1 AUTHOR
+
+Stanislav Sinyagin E<lt>F<ssinyagin@yahoo.com>E<gt>
+
+=cut
diff --git a/torrus/setup_tools/check_perlthreading.pl b/torrus/setup_tools/check_perlthreading.pl
new file mode 100644 (file)
index 0000000..22666e3
--- /dev/null
@@ -0,0 +1,37 @@
+
+use threads;
+
+$| = 1;
+
+print "The child thread must keep ticking while the main thread sleeps\n";
+print "If it's not so, then we have a compatibility problem\n";
+
+
+
+my $thrChild = threads->create( \&child );
+$thrChild->detach();
+
+print "P> Launched the child thread. Now I sleep 20 seconds\n";
+sleep(20);
+print "P> Parent woke up. Was there ticking inbetween?\n";
+
+exit 0;
+
+
+
+sub child
+{
+    print "C> Child thread started. I will print 10 lines, one per second\n";
+
+    foreach my $i (1..10)
+    {
+        print("C> Child tick " . $i . "\n");
+        sleep(1);
+    }
+}
+
+        
+            
+        
+    
+
diff --git a/torrus/setup_tools/configure_fhs b/torrus/setup_tools/configure_fhs
new file mode 100755 (executable)
index 0000000..69a07b1
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Configure script for FHC compliant setup (http://www.pathname.com/fhs/)
+# $Id: configure_fhs,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+if test ! -x ./configure; then
+  echo "$0: cannot find ./configure" 2>&1
+  echo "Usage: ./setup_tools/configure_fhs [configure options]..." 2>&1
+  exit 1
+fi
+
+./configure \
+ --prefix=/opt \
+ --mandir=/opt/share/man \
+ pkghome=/opt/torrus \
+ sitedir=/etc/opt/torrus \
+ "$@"
+  
\ No newline at end of file
diff --git a/torrus/setup_tools/mkvardir.sh.in b/torrus/setup_tools/mkvardir.sh.in
new file mode 100644 (file)
index 0000000..568ba13
--- /dev/null
@@ -0,0 +1,57 @@
+#!@SHELL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: mkvardir.sh.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+dir=$1
+user=@var_user@
+group=@var_group@
+mode=@var_mode@
+SHELL=@SHELL@
+
+if test ! -d $dir; then
+
+    @install_sh@ -d $dir || exit 1
+
+    if test "@enable_varperm@" = "yes"; then
+
+        if test "x@host_os@" != "xcygwin"; then
+            test -z "$user"  && user=torrus
+            test -z "$group" && group=torrus
+            test -z "$mode"  && mode=775
+        fi
+
+        test -z "$mode" || chmod $mode  $dir || (rmdir $dir; exit 1)
+        test -z "$user"  || chown $user  $dir || (rmdir $dir; exit 1)
+        test -z "$group" || (chgrp $group $dir && chmod g+s $dir) || \
+          (rmdir $dir; exit 1)
+
+    fi
+    
+fi
+
+exit 0
+
+
+
+# Local Variables:
+# mode: shell-script
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/setup_tools/replace_rrfw.sh b/torrus/setup_tools/replace_rrfw.sh
new file mode 100755 (executable)
index 0000000..87b7059
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# replace all ocurrences of RRFW and rrfw to Torrus and torrus
+
+IN=$1
+sed -e 's/RRFW/Torrus/g' -e 's/rrfw/torrus/g' $IN >/tmp/$$
+mv /tmp/$$ $IN
+
diff --git a/torrus/setup_tools/substvars.sh.in b/torrus/setup_tools/substvars.sh.in
new file mode 100644 (file)
index 0000000..15273cb
--- /dev/null
@@ -0,0 +1,98 @@
+#!@SHELL@
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: substvars.sh.in,v 1.1 2010-12-27 00:04:39 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+PACKAGE=@PACKAGE@
+prefix=@prefix@
+datarootdir=@datarootdir@
+pkghome=@pkghome@
+exec_prefix=@exec_prefix@
+perllibdir=@perllibdir@
+pluginsdir=@pluginsdir@
+sysconfdir=@sysconfdir@
+varprefix=@varprefix@
+sitedir=@sitedir@
+supdir=@supdir@
+styldir=@supdir@/styling
+
+devdiscover_config_pl=@cfgdefdir@/devdiscover-config.pl
+torrus_config_pl=@cfgdefdir@/torrus-config.pl
+
+torrus_siteconfig_pl=@siteconfdir@/torrus-siteconfig.pl
+snmptrap_siteconfig_pl=@siteconfdir@/snmptrap-siteconfig.pl
+email_siteconfig_pl=@siteconfdir@/email-siteconfig.pl
+devdiscover_siteconfig_pl=@siteconfdir@/devdiscover-siteconfig.pl
+notify_siteconfig_pl=@siteconfdir@/notify-siteconfig.pl
+
+@SED@ \
+    -e "s,\@FIND\@,@FIND@,g" \
+    -e "s,\@PERL\@,@PERL@,g" \
+    -e "s,\@RM\@,@RM@,g" \
+    -e "s,\@SHELL\@,@SHELL@,g" \
+    -e "s,\@VERSION\@,@VERSION@,g" \
+    -e "s,\@bindir\@,@bindir@,g" \
+    -e "s,\@cachedir\@,@cachedir@,g" \
+    -e "s,\@cfgdefdir\@,@cfgdefdir@,g" \
+    -e "s,\@dbhome\@,@dbhome@,g" \
+    -e "s,\@defrrddir\@,@defrrddir@,g" \
+    -e "s,\@devdiscover_config_pl\@,$devdiscover_config_pl,g" \
+    -e "s,\@devdiscover_siteconfig_pl\@,$devdiscover_siteconfig_pl,g" \
+    -e "s,\@distxmldir\@,@distxmldir@,g" \
+    -e "s,\@pkgdocdir\@,@pkgdocdir@,g" \
+    -e "s,\@email_siteconfig_pl\@,$email_siteconfig_pl,g" \
+    -e "s,\@exmpdir\@,@exmpdir@,g" \
+    -e "s,\@logdir\@,@logdir@,g" \
+    -e "s,\@mandir\@,@mandir@,g" \
+    -e "s,\@mansec_misc\@,@mansec_misc@,g" \
+    -e "s,\@mansec_usercmd\@,@mansec_usercmd@,g" \
+    -e "s,\@notify_siteconfig_pl\@,$notify_siteconfig_pl,g" \
+    -e "s,\@perlithreads\@,@perlithreads@,g" \
+    -e "s,\@perllibdir\@,@perllibdir@,g" \
+    -e "s,\@perllibdirs\@,@perllibdirs@,g" \
+    -e "s,\@piddir\@,@piddir@,g" \
+    -e "s,\@pkgbindir\@,@pkgbindir@,g" \
+    -e "s,\@pkghome\@,@pkghome@,g" \
+    -e "s,\@plugdevdisccfgdir\@,@plugdevdisccfgdir@,g" \
+    -e "s,\@pluginsdir\@,@pluginsdir@,g" \
+    -e "s,\@plugtorruscfgdir\@,@plugtorruscfgdir@,g" \
+    -e "s,\@plugwrapperdir\@,@plugwrapperdir@,g" \
+    -e "s,\@reportsdir\@,@reportsdir@,g" \
+    -e "s,\@scriptsdir\@,@scriptsdir@,g" \
+    -e "s,\@seslockdir\@,@seslockdir@,g" \
+    -e "s,\@sesstordir\@,@sesstordir@,g" \
+    -e "s,\@siteconfdir\@,@siteconfdir@,g" \
+    -e "s,\@sitedir\@,@sitedir@,g" \
+    -e "s,\@sitexmldir\@,@sitexmldir@,g" \
+    -e "s,\@snmptrap_siteconfig_pl\@,$snmptrap_siteconfig_pl,g" \
+    -e "s,\@styldir\@,$styldir,g" \
+    -e "s,\@supdir\@,@supdir@,g" \
+    -e "s,\@tmpldir\@,@tmpldir@,g" \
+    -e "s,\@tmpluserdir\@,@tmpluserdir@,g" \
+    -e "s,\@torrus_config_pl\@,$torrus_config_pl,g" \
+    -e "s,\@torrus_siteconfig_pl\@,$torrus_siteconfig_pl,g" \
+    -e "s,\@torrus_user\@,@torrus_user@,g" \
+    -e "s,\@webplaindir\@,@webplaindir@,g" \
+    $1
+
+# Local Variables:
+# mode: shell-script
+# indent-tabs-mode: nil
+# perl-indent-level: 4
+# End:
diff --git a/torrus/sup/Makefile.am b/torrus/sup/Makefile.am
new file mode 100644 (file)
index 0000000..4579fd0
--- /dev/null
@@ -0,0 +1,45 @@
+
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.am,v 1.1 2010-12-27 00:04:04 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+dtddir = $(supdir)/dtd
+dist_dtd_DATA =  dtd/snmp-discovery.dtd   dtd/torrus-config.dtd
+
+mibsdir = $(supdir)/mibs
+dist_mibs_DATA =  mibs/RRDTOOL-SMI.txt \
+                 mibs/TORRUS-MIB.txt
+
+styldir = $(supdir)/styling
+dist_styl_DATA = \
+       styling/colornames.pl  \
+       styling/rainbow-schema.pl \
+       styling/torrus-schema.pl
+
+
+webplaindir = @webplaindir@
+dist_webplain_DATA = \
+       webplain/explain-rrdgraph.html \
+       webplain/torrus.css \
+       webplain/torrus-printer.css \
+       webplain/torrus-report.css
+
+
+install-data-local:
+       $(mkinstalldirs) $(DESTDIR)$(webscriptsdir)
diff --git a/torrus/sup/Makefile.in b/torrus/sup/Makefile.in
new file mode 100644 (file)
index 0000000..eaccd49
--- /dev/null
@@ -0,0 +1,455 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#  Copyright (C) 2002  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.in,v 1.1 2010-12-27 00:04:04 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = sup
+DIST_COMMON = $(dist_dtd_DATA) $(dist_mibs_DATA) $(dist_styl_DATA) \
+       $(dist_webplain_DATA) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(dtddir)" "$(DESTDIR)$(mibsdir)" \
+       "$(DESTDIR)$(styldir)" "$(DESTDIR)$(webplaindir)"
+dist_dtdDATA_INSTALL = $(INSTALL_DATA)
+dist_mibsDATA_INSTALL = $(INSTALL_DATA)
+dist_stylDATA_INSTALL = $(INSTALL_DATA)
+dist_webplainDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_dtd_DATA) $(dist_mibs_DATA) $(dist_styl_DATA) \
+       $(dist_webplain_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+FIND = @FIND@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KILL = @KILL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERLINC = @PERLINC@
+POD2MAN = @POD2MAN@
+POD2MAN_PRESENT_FALSE = @POD2MAN_PRESENT_FALSE@
+POD2MAN_PRESENT_TRUE = @POD2MAN_PRESENT_TRUE@
+POD2TEXT = @POD2TEXT@
+POD2TEXT_PRESENT_FALSE = @POD2TEXT_PRESENT_FALSE@
+POD2TEXT_PRESENT_TRUE = @POD2TEXT_PRESENT_TRUE@
+RM = @RM@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SLEEP = @SLEEP@
+STRIP = @STRIP@
+SU = @SU@
+VERSION = @VERSION@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+cachedir = @cachedir@
+cfgdefdir = @cfgdefdir@
+datadir = @datadir@
+dbhome = @dbhome@
+defrrddir = @defrrddir@
+distxmldir = @distxmldir@
+enable_pkgonly = @enable_pkgonly@
+enable_varperm = @enable_varperm@
+exec_prefix = @exec_prefix@
+exmpdir = @exmpdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mansec_misc = @mansec_misc@
+mansec_usercmd = @mansec_usercmd@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+perlithreads = @perlithreads@
+perllibdir = @perllibdir@
+perllibdirs = @perllibdirs@
+piddir = @piddir@
+pkgbindir = @pkgbindir@
+pkgdocdir = @pkgdocdir@
+pkghome = @pkghome@
+plugdevdisccfgdir = @plugdevdisccfgdir@
+pluginsdir = @pluginsdir@
+plugtorruscfgdir = @plugtorruscfgdir@
+plugwrapperdir = @plugwrapperdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+reportsdir = @reportsdir@
+sbindir = @sbindir@
+scriptsdir = @scriptsdir@
+seslockdir = @seslockdir@
+sesstordir = @sesstordir@
+sharedstatedir = @sharedstatedir@
+siteconfdir = @siteconfdir@
+sitedir = @sitedir@
+sitexmldir = @sitexmldir@
+supdir = @supdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+tmpldir = @tmpldir@
+tmpluserdir = @tmpluserdir@
+torrus_user = @torrus_user@
+var_group = @var_group@
+var_mode = @var_mode@
+var_user = @var_user@
+varprefix = @varprefix@
+webplaindir = @webplaindir@
+webscriptsdir = @webscriptsdir@
+wrapperdir = @wrapperdir@
+dtddir = $(supdir)/dtd
+dist_dtd_DATA = dtd/snmp-discovery.dtd   dtd/torrus-config.dtd
+mibsdir = $(supdir)/mibs
+dist_mibs_DATA = mibs/RRDTOOL-SMI.txt \
+                 mibs/TORRUS-MIB.txt
+
+styldir = $(supdir)/styling
+dist_styl_DATA = \
+       styling/colornames.pl  \
+       styling/rainbow-schema.pl \
+       styling/torrus-schema.pl
+
+dist_webplain_DATA = \
+       webplain/explain-rrdgraph.html \
+       webplain/torrus.css \
+       webplain/torrus-printer.css \
+       webplain/torrus-report.css
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  sup/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  sup/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+install-dist_dtdDATA: $(dist_dtd_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(dtddir)" || $(mkdir_p) "$(DESTDIR)$(dtddir)"
+       @list='$(dist_dtd_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_dtdDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(dtddir)/$$f'"; \
+         $(dist_dtdDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(dtddir)/$$f"; \
+       done
+
+uninstall-dist_dtdDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_dtd_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(dtddir)/$$f'"; \
+         rm -f "$(DESTDIR)$(dtddir)/$$f"; \
+       done
+install-dist_mibsDATA: $(dist_mibs_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(mibsdir)" || $(mkdir_p) "$(DESTDIR)$(mibsdir)"
+       @list='$(dist_mibs_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_mibsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(mibsdir)/$$f'"; \
+         $(dist_mibsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(mibsdir)/$$f"; \
+       done
+
+uninstall-dist_mibsDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_mibs_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(mibsdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(mibsdir)/$$f"; \
+       done
+install-dist_stylDATA: $(dist_styl_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(styldir)" || $(mkdir_p) "$(DESTDIR)$(styldir)"
+       @list='$(dist_styl_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_stylDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(styldir)/$$f'"; \
+         $(dist_stylDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(styldir)/$$f"; \
+       done
+
+uninstall-dist_stylDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_styl_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(styldir)/$$f'"; \
+         rm -f "$(DESTDIR)$(styldir)/$$f"; \
+       done
+install-dist_webplainDATA: $(dist_webplain_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(webplaindir)" || $(mkdir_p) "$(DESTDIR)$(webplaindir)"
+       @list='$(dist_webplain_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_webplainDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(webplaindir)/$$f'"; \
+         $(dist_webplainDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(webplaindir)/$$f"; \
+       done
+
+uninstall-dist_webplainDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_webplain_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(webplaindir)/$$f'"; \
+         rm -f "$(DESTDIR)$(webplaindir)/$$f"; \
+       done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+       $(mkdir_p) $(distdir)/dtd $(distdir)/mibs $(distdir)/styling $(distdir)/webplain
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+       for dir in "$(DESTDIR)$(dtddir)" "$(DESTDIR)$(mibsdir)" "$(DESTDIR)$(styldir)" "$(DESTDIR)$(webplaindir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local install-dist_dtdDATA \
+       install-dist_mibsDATA install-dist_stylDATA \
+       install-dist_webplainDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_dtdDATA uninstall-dist_mibsDATA \
+       uninstall-dist_stylDATA uninstall-dist_webplainDATA \
+       uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+       distclean-generic distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am \
+       install-data-local install-dist_dtdDATA install-dist_mibsDATA \
+       install-dist_stylDATA install-dist_webplainDATA install-exec \
+       install-exec-am install-info install-info-am install-man \
+       install-strip installcheck installcheck-am installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
+       uninstall-dist_dtdDATA uninstall-dist_mibsDATA \
+       uninstall-dist_stylDATA uninstall-dist_webplainDATA \
+       uninstall-info-am
+
+
+install-data-local:
+       $(mkinstalldirs) $(DESTDIR)$(webscriptsdir)
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/torrus/sup/dtd/snmp-discovery.dtd b/torrus/sup/dtd/snmp-discovery.dtd
new file mode 100644 (file)
index 0000000..e8953ab
--- /dev/null
@@ -0,0 +1,39 @@
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: snmp-discovery.dtd,v 1.1 2010-12-27 00:04:04 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+  Torrus Discovery Instructions XML DTD
+  
+-->
+
+<!ELEMENT creator-info ( #PCDATA ) >
+
+<!ELEMENT file-info ( format-version ) >
+
+<!ELEMENT format-version ( #PCDATA ) >
+
+<!ELEMENT host ( param+ ) >
+
+<!ELEMENT param ( #PCDATA ) >
+<!ATTLIST param name CDATA #REQUIRED >
+<!ATTLIST param value CDATA #IMPLIED >
+
+<!ELEMENT snmp-discovery ( file-info, creator-info*, param+, host+ ) >
+
+
diff --git a/torrus/sup/dtd/torrus-config.dtd b/torrus/sup/dtd/torrus-config.dtd
new file mode 100644 (file)
index 0000000..5227f81
--- /dev/null
@@ -0,0 +1,96 @@
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: torrus-config.dtd,v 1.1 2010-12-27 00:04:04 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+  Torrus Configuration XML DTD
+  
+-->
+
+<!ELEMENT action ( param+ ) >
+<!ATTLIST action name NMTOKEN #REQUIRED >
+
+<!ELEMENT alias ( #PCDATA ) >
+
+<!ELEMENT apply-template EMPTY >
+<!ATTLIST apply-template name NMTOKEN #REQUIRED >
+
+<!ELEMENT configuration ( creator-info | definitions | datasources |
+                          include | monitors | param-properties |
+                          token-sets | views )* >
+
+<!ELEMENT creator-info ( #PCDATA ) >
+
+<!ELEMENT datasources ( template | alias | apply-template |
+                        leaf | param | subtree |
+                        setvar | iftrue | iffalse )* >
+                        
+<!ELEMENT def EMPTY >
+<!ATTLIST def name ID #REQUIRED >
+<!ATTLIST def value CDATA #REQUIRED >
+
+<!ELEMENT definitions ( def )* >
+
+<!ELEMENT detailed ( alias | apply-template |
+                    leaf | param | subtree |
+                    setvar | iftrue | iffalse )* >
+<!ATTLIST detailed match NMTOKEN #REQUIRED >
+
+<!ELEMENT include EMPTY >
+<!ATTLIST include filename ID #REQUIRED >
+
+<!ELEMENT leaf ( alias | apply-template | param |
+                 setvar | iftrue | iffalse )* >
+<!ATTLIST leaf name NMTOKEN #REQUIRED >
+
+<!ELEMENT monitor ( param+ ) >
+<!ATTLIST monitor name NMTOKEN #REQUIRED >
+
+<!ELEMENT monitors ( action | monitor )* >
+
+<!ELEMENT param ( #PCDATA ) >
+<!ATTLIST param name NMTOKEN #REQUIRED >
+<!ATTLIST param value CDATA #IMPLIED >
+
+<!ELEMENT param-properties ( prop )* >
+
+<!ELEMENT prop >
+<!ATTLIST prop param NMTOKEN #REQUIRED >
+<!ATTLIST prop prop NMTOKEN #REQUIRED >
+<!ATTLIST prop value CDATA #REQUIRED >
+
+<!ELEMENT subtree ( alias | apply-template |
+                    leaf | param | subtree | setvar | iftrue | iffalse )* >
+<!ATTLIST subtree name NMTOKEN #REQUIRED >
+
+<!ELEMENT template ( alias | apply-template |
+                     leaf | param | subtree | setvar | iftrue | iffalse )* >
+<!ATTLIST template name NMTOKEN #REQUIRED >
+
+<!ELEMENT token-set ( param* ) >
+<!ATTLIST token-set name NMTOKEN #REQUIRED >
+
+<!ELEMENT token-sets ( param | token-set )* >
+
+<!ELEMENT view ( param | view )* >
+<!ATTLIST view name ID #REQUIRED >
+
+<!ELEMENT views ( view* ) >
+
+
+
diff --git a/torrus/sup/mibs/RRDTOOL-SMI.txt b/torrus/sup/mibs/RRDTOOL-SMI.txt
new file mode 100644 (file)
index 0000000..dd306ed
--- /dev/null
@@ -0,0 +1,39 @@
+RRDTOOL-SMI DEFINITIONS ::= BEGIN
+
+IMPORTS
+       MODULE-IDENTITY,
+       OBJECT-IDENTITY,
+       enterprises
+               FROM SNMPv2-SMI;
+
+rrdtool MODULE-IDENTITY
+       LAST-UPDATED "200209150000Z"
+       ORGANIZATION "RRD Tool"
+       CONTACT-INFO
+               "    Tobi Oetiker
+
+                Postal: ETZ J97, ETH
+                        8092 Zurich
+                        Switzerland
+
+                Telephone: +41 1 632-5286
+                E-mail: oetiker@ee.ethz.ch
+
+                RRD Tool Information:
+                  http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/
+               "
+       DESCRIPTION
+               "The Structure of RRDTool fellow projects"
+       ::= { enterprises 14697 }       -- assigned by IANA
+
+torrus    OBJECT-IDENTITY
+       STATUS  current
+       DESCRIPTION
+               "Round Robin Database Framework. 
+                http://torrus.sourceforge.net/
+                "
+       ::= { rrdtool 1 }
+
+-- more to come if necessary.
+
+END
diff --git a/torrus/sup/mibs/TORRUS-MIB.txt b/torrus/sup/mibs/TORRUS-MIB.txt
new file mode 100644 (file)
index 0000000..8ada99b
--- /dev/null
@@ -0,0 +1,183 @@
+TORRUS-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+    MODULE-IDENTITY, OBJECT-IDENTITY, NOTIFICATION-TYPE,
+    Integer32
+        FROM SNMPv2-SMI
+    DateAndTime
+        FROM SNMPv2-TC
+    rrdtool
+        FROM RRDTOOL-SMI;
+
+torrus MODULE-IDENTITY
+    LAST-UPDATED "200506210000Z"
+    ORGANIZATION "Round Robin Database Framework project"
+    CONTACT-INFO
+        "Round Robin Database Framework project
+                
+         Project description and documentation:
+         http://torrus.org
+         
+         Administrative contact for MIB module:
+
+         Stanislav Sinyagin
+         Tel. +41 79 407 02 24
+         E-mail: ssinyagin@yahoo.com"
+    DESCRIPTION
+        "The MIB module for SNMP variables specific to Torrus project"
+        ::= { rrdtool 1 }
+
+EventType ::= TEXTUAL-CONVENTION
+    STATUS current
+    DESCRIPTION
+        "Defines the event type:
+        set      -- The monitor condition is first time met
+        repeat   -- The monitor condition is met again on the consequtive
+                    monitorin cycle
+        clear    -- The monitor condition is not met the first time after
+                    event type set or repeat
+        forget   -- The monitor condition was not met during the expiration
+                    period since the last event type clear"
+    SYNTAX INTEGER {
+             set(1),
+             repeat(2),
+             clear(3),
+             forget(4)
+             }
+                   
+TreeName ::= TEXTUAL-CONVENTION
+    STATUS current
+    DESCRIPTION
+        "Torrus system operates with several datasource trees
+        identified by names"
+    SYNTAX OCTET STRING (SIZE (1..512))
+    
+Token ::= TEXTUAL-CONVENTION
+    STATUS current
+    DESCRIPTION
+        "Token is a short ID for the leaf or subtree of the Torrus
+        datasources hierarchy"
+    SYNTAX OCTET STRING (SIZE (5..10))
+
+Path ::= TEXTUAL-CONVENTION
+    STATUS current
+    DESCRIPTION
+        "Path is the full name of the Torrus datasource, containing its
+        parent nodes separated by slashes"
+    SYNTAX OCTET STRING (SIZE (1..512))
+
+MonitorEventsEntry ::= SEQUENCE {
+    torrusEventIndex     Integer32,
+    torrusToken          Token,
+    torrusMonitorName    OCTET STRING,
+    torrusEventType      EventType,
+    torrusPath           Path,
+    torrusTimestamp      DateAndTime,
+    torrusSeverity       Integer32,
+    torrusMonitorDesc    OCTET STRING
+}
+    
+torrusMonitorEventsTable OBJECT-TYPE
+    SYNTAX      SEQUENCE OF MonitorEventsEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Table of current monitor events"    
+    ::= { torrus 1 }
+
+torrusMonitorEventsEntry OBJECT-TYPE
+    SYNTAX      MonitorEventsEntry
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Each monitor event is characterized by the datasource token and
+         monitor name"
+    INDEX { torrusEventIndex }
+    ::= { torrusMonitorEventsTable 1 }
+
+torrusEventIndex OBJECT-TYPE
+    SYNTAX      Integer32 (1..65535)
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The value of this object uniquely identifies this
+        event entry."
+    ::= { torrusMonitorEventsEntry 1 }
+                        
+torrusToken OBJECT-TYPE
+    SYNTAX      Token
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Token is a short ID for the leaf or subtree of the Torrus
+         datasources hierarchy"
+    ::= { torrusMonitorEventsEntry 2 }
+
+torrusMonitorName OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Each monitor instance is identified by unique name"
+    ::= { torrusMonitorEventsEntry 3 }
+
+torrusEventType OBJECT-TYPE
+    SYNTAX      EventType
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The type of the event: set(1), repeat(2), clear(3), forget(4)"
+    ::= { torrusMonitorEventsEntry 4 }
+    
+torrusPath OBJECT-TYPE
+    SYNTAX      Path
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "The full name of the Torrus datasource, containing its
+        parent nodes separated by slashes"
+    ::= { torrusMonitorEventsEntry 5 }
+
+torrusTimestamp OBJECT-TYPE
+    SYNTAX      DateAndTime
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Timestamp of the event, in SNMPv2 format, e.g.
+         1992-5-26,13:30:15.0,-4:0"
+    ::= { torrusMonitorEventsEntry 6 }
+        
+torrusTreeName OBJECT-TYPE
+    SYNTAX      TreeName
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Name of the datasource tree"
+    ::= { torrusMonitorEventsEntry 7 }
+
+torrusSeverity OBJECT-TYPE
+    SYNTAX      Integer32 (1..65535)
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Optional severity level"
+    ::= { torrusMonitorEventsEntry 8 }
+
+torrusMonitorDesc OBJECT-TYPE
+    SYNTAX      OCTET STRING
+    MAX-ACCESS  not-accessible
+    STATUS      current
+    DESCRIPTION
+        "Human readable monitor comment"
+    ::= { torrusMonitorEventsEntry 9 }
+    
+torrusAlarm NOTIFICATION-TYPE
+    OBJECTS  { torrusToken, torrusMonitorName, torrusEventType,
+               torrusPath, torrusTimestamp }
+    STATUS   current
+    DESCRIPTION
+        "The SNMP trap that is generated when an Torrus monitor
+        condition is changed for the leaf being monitored"
+    ::= { torrus 2 }
+        
+END
diff --git a/torrus/sup/styling/colornames.pl b/torrus/sup/styling/colornames.pl
new file mode 100644 (file)
index 0000000..848b4e2
--- /dev/null
@@ -0,0 +1,183 @@
+# Symbolic Color names
+
+# $Id: colornames.pl,v 1.1 2010-12-27 00:04:04 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+# Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+
+my %colorNames =
+    (
+     # Taken from the tt2 example file
+     'black'    => {'color'   => '#000000'},
+     'grey25'   => {'color'   => '#404040'},
+     'grey50'   => {'color'   => '#808080'},
+     'grey75'   => {'color'   => '#c0c0c0'},
+     'white'    => {'color'   => '#ffffff'},
+     'red'      => {'color'   => '#ff0000'},
+     'red25'    => {'color'   => '#400000'},
+     'red50'    => {'color'   => '#800000'},
+     'red75'    => {'color'   => '#c00000'},
+     'green'    => {'color'   => '#00ff00'},
+     'green25'  => {'color'   => '#004000'},
+     'green50'  => {'color'   => '#008000'},
+     'green75'  => {'color'   => '#00c000'},
+     'blue'     => {'color'   => '#0000ff'},
+     'blue25'   => {'color'   => '#000040'},
+     'blue50'   => {'color'   => '#000080'},
+     'blue75'   => {'color'   => '#0000c0'},
+     'blood'    => {'color'   => '#800000'},
+     'scarlet'  => {'color'   => '#c04040'},
+     'rose'     => {'color'   => '#f08080'},
+     'orange'   => {'color'   => '#fe7202'},
+     'leaf'     => {'color'   => '#006400'},
+     'bud'      => {'color'   => '#66aa66'},
+     'mint'     => {'color'   => '#aaffaa'},
+     'marine'   => {'color'   => '#0066cc'},
+     'sky'      => {'color'   => '#66ccff'},
+     'mauve'    => {'color'   => '#6666cc'},
+     'lilac'    => {'color'   => '#9797ff'},
+
+     # http://www.mandarindesign.com/color.html#namedcolors
+     # http://www.w3schools.com/html/html_colornames.asp
+     # http://www.oreilly.com/catalog/wdnut/excerpt/color_names.html
+     'aliceblue'            => {'color'   => '#F0F8FF'},
+     'antiquewhite'         => {'color'   => '#FAEBD7'},
+     'aqua'                 => {'color'   => '#00FFFF'},
+     'aquamarine'           => {'color'   => '#7FFFD4'},
+     'azure'                => {'color'   => '#F0FFFF'},
+     'beige'                => {'color'   => '#F5F5DC'},
+     'bisque'               => {'color'   => '#FFE4C4'},
+     'blanchedalmond'       => {'color'   => '#FFEBCD'},
+     'blueviolet'           => {'color'   => '#8A2BE2'},
+     'brown'                => {'color'   => '#A52A2A'},
+     'burlywood'            => {'color'   => '#DEB887'},
+     'cadetblue'            => {'color'   => '#5F9EA0'},
+     'chartreuse'           => {'color'   => '#7FFF00'},
+     'chocolate'            => {'color'   => '#D2691E'},
+     'coral'                => {'color'   => '#FF7F50'},
+     'cornflowerblue'       => {'color'   => '#6495ED'},
+     'cornsilk'             => {'color'   => '#FFF8DC'},
+     'crimson'              => {'color'   => '#DC143C'},
+     'cyan'                 => {'color'   => '#00FFFF'},
+     'darkblue'             => {'color'   => '#00008B'},
+     'darkcyan'             => {'color'   => '#008B8B'},
+     'darkgoldenrod'        => {'color'   => '#B8860B'},
+     'darkgray'             => {'color'   => '#A9A9A9'},
+     'darkgreen'            => {'color'   => '#006400'},
+     'darkkhaki'            => {'color'   => '#BDB76B'},
+     'darkmagenta'          => {'color'   => '#8B008B'},
+     'darkolivegreen'       => {'color'   => '#556B2F'},
+     'darkorange'           => {'color'   => '#FF8C00'},
+     'darkorchid'           => {'color'   => '#9932CC'},
+     'darkred'              => {'color'   => '#8B0000'},
+     'darksalmon'           => {'color'   => '#E9967A'},
+     'darkseagreen'         => {'color'   => '#8FBC8B'},
+     'darkslateblue'        => {'color'   => '#483D8B'},
+     'darkslategray'        => {'color'   => '#2F4F4F'},
+     'darkturquoise'        => {'color'   => '#00CED1'},
+     'darkviolet'           => {'color'   => '#9400D3'},
+     'deeppink'             => {'color'   => '#FF1493'},
+     'deepskyblue'          => {'color'   => '#00BFFF'},
+     'dimgray'              => {'color'   => '#696969'},
+     'dodgerblue'           => {'color'   => '#1E90FF'},
+     'firebrick'            => {'color'   => '#B22222'},
+     'floralwhite'          => {'color'   => '#FFFAF0'},
+     'forestgreen'          => {'color'   => '#228B22'},
+     'fuchsia'              => {'color'   => '#FF00FF'},
+     'gainsboro'            => {'color'   => '#DCDCDC'},
+     'ghostwhite'           => {'color'   => '#F8F8FF'},
+     'gold'                 => {'color'   => '#FFD700'},
+     'goldenrod'            => {'color'   => '#DAA520'},
+     'gray'                 => {'color'   => '#808080'},
+     'greenyellow'          => {'color'   => '#ADFF2F'},
+     'honeydew'             => {'color'   => '#F0FFF0'},
+     'hotpink'              => {'color'   => '#FF69B4'},
+     'indianred'            => {'color'   => '#CD5C5C'},
+     'indigo'               => {'color'   => '#4B0082'},
+     'ivory'                => {'color'   => '#FFFFF0'},
+     'khaki'                => {'color'   => '#F0E68C'},
+     'lavender'             => {'color'   => '#E6E6FA'},
+     'lavenderblush'        => {'color'   => '#FFF0F5'},
+     'lawngreen'            => {'color'   => '#7CFC00'},
+     'lemonchiffon'         => {'color'   => '#FFFACD'},
+     'lightblue'            => {'color'   => '#ADD8E6'},
+     'lightcoral'           => {'color'   => '#F08080'},
+     'lightcyan'            => {'color'   => '#E0FFFF'},
+     'lightgoldenrodyellow' => {'color'   => '#FAFAD2'},
+     'lightgreen'           => {'color'   => '#90EE90'},
+     'lightgrey'            => {'color'   => '#D3D3D3'},
+     'lightpink'            => {'color'   => '#FFB6C1'},
+     'lightsalmon'          => {'color'   => '#FFA07A'},
+     'lightseagreen'        => {'color'   => '#20B2AA'},
+     'lightskyblue'         => {'color'   => '#87CEFA'},
+     'lightslategray'       => {'color'   => '#778899'},
+     'lightsteelblue'       => {'color'   => '#B0C4DE'},
+     'lightyellow'          => {'color'   => '#FFFFE0'},
+     'lime'                 => {'color'   => '#00FF00'},
+     'limegreen'            => {'color'   => '#32CD32'},
+     'linen'                => {'color'   => '#FAF0E6'},
+     'magenta'              => {'color'   => '#FF00FF'},
+     'maroon'               => {'color'   => '#800000'},
+     'mediumaquamarine'     => {'color'   => '#66CDAA'},
+     'mediumblue'           => {'color'   => '#0000CD'},
+     'mediumorchid'         => {'color'   => '#BA55D3'},
+     'mediumpurple'         => {'color'   => '#9370DB'},
+     'mediumseagreen'       => {'color'   => '#3CB371'},
+     'mediumslateblue'      => {'color'   => '#7B68EE'},
+     'mediumspringgreen'    => {'color'   => '#00FA9A'},
+     'mediumturquoise'      => {'color'   => '#48D1CC'},
+     'mediumvioletred'      => {'color'   => '#C71585'},
+     'midnightblue'         => {'color'   => '#191970'},
+     'mintcream'            => {'color'   => '#F5FFFA'},
+     'mistyrose'            => {'color'   => '#FFE4E1'},
+     'moccasin'             => {'color'   => '#FFE4B5'},
+     'navajowhite'          => {'color'   => '#FFDEAD'},
+     'navy'                 => {'color'   => '#000080'},
+     'oldlace'              => {'color'   => '#FDF5E6'},
+     'olive'                => {'color'   => '#808000'},
+     'olivedrab'            => {'color'   => '#6B8E23'},
+     'orangered'            => {'color'   => '#FF4500'},
+     'orchid'               => {'color'   => '#DA70D6'},
+     'palegoldenrod'        => {'color'   => '#EEE8AA'},
+     'palegreen'            => {'color'   => '#98FB98'},
+     'paleturquoise'        => {'color'   => '#AFEEEE'},
+     'palevioletred'        => {'color'   => '#DB7093'},
+     'papayawhip'           => {'color'   => '#FFEFD5'},
+     'peachpuff'            => {'color'   => '#FFDAB9'},
+     'peru'                 => {'color'   => '#CD853F'},
+     'pink'                 => {'color'   => '#FFC0CB'},
+     'plum'                 => {'color'   => '#DDA0DD'},
+     'powderblue'           => {'color'   => '#B0E0E6'},
+     'purple'               => {'color'   => '#800080'},
+     'rosybrown'            => {'color'   => '#BC8F8F'},
+     'royalblue'            => {'color'   => '#4169E1'},
+     'saddlebrown'          => {'color'   => '#8B4513'},
+     'salmon'               => {'color'   => '#FA8072'},
+     'sandybrown'           => {'color'   => '#F4A460'},
+     'seagreen'             => {'color'   => '#2E8B57'},
+     'seashell'             => {'color'   => '#FFF5EE'},
+     'sienna'               => {'color'   => '#A0522D'},
+     'silver'               => {'color'   => '#C0C0C0'},
+     'skyblue'              => {'color'   => '#87CEEB'},
+     'slateblue'            => {'color'   => '#6A5ACD'},
+     'slategray'            => {'color'   => '#708090'},
+     'snow'                 => {'color'   => '#FFFAFA'},
+     'springgreen'          => {'color'   => '#00FF7F'},
+     'steelblue'            => {'color'   => '#4682B4'},
+     'tan'                  => {'color'   => '#D2B48C'},
+     'teal'                 => {'color'   => '#008080'},
+     'thistle'              => {'color'   => '#D8BFD8'},
+     'tomato'               => {'color'   => '#FF6347'},
+     'turquoise'            => {'color'   => '#40E0D0'},
+     'violet'               => {'color'   => '#EE82EE'},
+     'wheat'                => {'color'   => '#F5DEB3'},
+     'whitesmoke'           => {'color'   => '#F5F5F5'},
+     'yellow'               => {'color'   => '#FFFF00'},
+     'yellowgreen'          => {'color'   => '#9ACD32'},
+     );
+
+while( my($style, $def) = each( %colorNames ) )
+{
+    $Torrus::Renderer::graphStyles{$style} = $def;
+}
+
+1;
diff --git a/torrus/sup/styling/rainbow-schema.pl b/torrus/sup/styling/rainbow-schema.pl
new file mode 100644 (file)
index 0000000..cdab693
--- /dev/null
@@ -0,0 +1,26 @@
+# Example of alternate style
+# rougly the traditional colors in a rainbow.
+#  Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+#
+# This file should be referenced using the
+# $Torrus::Renderer::stylingProfileOverlay option:
+#   $Torrus::Renderer::stylingProfileOverlay = "rainbow-schema";
+
+$Torrus::Renderer::graphStyles{'one'}{'color'} = '##darkred';
+$Torrus::Renderer::graphStyles{'two'}{'color'} = '##red';
+$Torrus::Renderer::graphStyles{'three'}{'color'} = '##yellow';
+$Torrus::Renderer::graphStyles{'four'}{'color'} = '##deeppink';
+$Torrus::Renderer::graphStyles{'five'}{'color'} = '##forestgreen';
+$Torrus::Renderer::graphStyles{'six'}{'color'} = '##orange';
+$Torrus::Renderer::graphStyles{'seven'}{'color'} = '##indigo';
+$Torrus::Renderer::graphStyles{'eight'}{'color'} = '##blueviolet';
+$Torrus::Renderer::graphStyles{'nine'}{'color'} = '##blue';
+$Torrus::Renderer::graphStyles{'ten'}{'color'} = '##deepskyblue';
+
+# slightly off white background with gold grid lines
+push( @Torrus::Renderer::graphExtraArgs,
+      '--color=CANVAS#DCDCDC',  #light grey
+      '--color=BACK#808080',    # darker grey
+      '--color=GRID#FFD700' );  # gold
+
+1;
diff --git a/torrus/sup/styling/torrus-schema.pl b/torrus/sup/styling/torrus-schema.pl
new file mode 100644 (file)
index 0000000..9ece864
--- /dev/null
@@ -0,0 +1,171 @@
+# RRDtool graph Colors and Lines Profile.
+# You are encouraged to create your own copy and reference it
+# with $Torrus::Renderer::stylingProfile in your torrus-siteconfig.pl
+# or better define your amendments in Torrus::Renderer::stylingProfileOverlay
+
+# $Id: torrus-schema.pl,v 1.1 2010-12-27 00:04:04 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+# Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+
+%Torrus::Renderer::graphStyles =
+    (
+     'SingleGraph'     => {
+         'color' => '##blue',
+         'line'  => 'LINE2'
+         },
+     'HWBoundary'     => {
+         'color' => '##red',
+         'line'  => 'LINE1'
+         },
+     'HWFailure'      => {
+         'color' => '##moccasin'
+         },
+     'HruleMin'       => {
+         'color' => '##darkmagenta'
+         },
+     'HruleNormal'    => {
+         'color' => '##seagreen'
+         },
+     'HruleMax'       => {
+         'color' => '##darkmagenta'
+         },
+     'BpsIn'          => {
+         'color' => '##green',
+         'line'  => 'AREA'
+         },
+     'BpsOut'         => {
+         'color' => '##blue',
+         'line'  => 'LINE2'
+         },
+
+     'BusinessDay'    => {
+         'color' => '##white',
+         'line'  => 'AREA'
+         },
+     'Evening'        => {
+         'color' => '##mintcream',
+         'line'  => 'AREA'
+         },
+     'Night'          => {
+         'color' => '##lavender',
+         'line'  => 'AREA'
+         },
+
+     # Common Definitions
+     # Using generic names allows the "generic" value to be
+     # changed without editing every instance
+     'in'       => {
+         'color'   => '##green',
+         'line'    => 'AREA'
+         },
+     'out'      => {
+         'color'   => '##blue',
+         'line'    => 'LINE2'
+         },
+
+     'nearend'       => {
+         'color'   => '##green',
+         'line'    => 'LINE2'
+         },
+     'farend'      => {
+         'color'   => '##blue',
+         'line'    => 'LINE2'
+         },
+
+     'maxvalue'       => {
+         'color'   => '##darkseagreen',
+         'line'    => 'AREA'
+         },
+     'currvalue'      => {
+         'color'   => '##blue',
+         'line'    => 'LINE2'
+         },
+
+     'totalresource'  => {
+         'color'   => '##palegreen',
+         'line'    => 'AREA'
+         },
+     'resourceusage'  => {
+         'color'   => '##blue',
+         'line'    => 'AREA'
+         },
+     'resourcepartusage'  => {
+         'color'   => '##crimson',
+         'line'    => 'AREA'
+         },
+
+     # convenient definitions one - ten, colors that
+     # "work" in a single graph
+     'one'      => {'color'   => '##green'},
+     'two'      => {'color'   => '##blue'},
+     'three'    => {'color'   => '##red'},
+     'four'     => {'color'   => '##gold'},
+     'five'     => {'color'   => '##seagreen'},
+     'six'      => {'color'   => '##cornflowerblue'},
+     'seven'    => {'color'   => '##crimson'},
+     'eight'    => {'color'   => '##darkorange'},
+     'nine'     => {'color'   => '##darkmagenta'},
+     'ten'      => {'color'   => '##orangered'},
+
+     # definitions for combinatorial graphing
+
+     #RED
+     'red1'     => {
+         'color'  => '##red',
+         'line'   => 'AREA',
+     },
+     'red2'     => {
+         'color'  => '##red25',
+         'line'   => 'STACK',
+     },
+     'red3'     => {
+         'color'  => '##red50',
+         'line'   => 'STACK',
+     },
+     'red4'     => {
+         'color'  => '##red75',
+         'line'   => 'STACK',
+     },
+
+     #GREEN
+     'green1'     => {
+         'color'   => '##green',
+         'line'    => 'AREA',
+     },
+     'green2'     => {
+         'color'   => '##green25',
+         'line'    => 'STACK',
+     },
+     'green3'     => {
+         'color'   => '##green50',
+         'line'    => 'STACK',
+     },
+     'green4'     => {
+         'color'   => '##green75',
+         'line'    => 'STACK',
+     },
+
+     #BLUE
+     'blue1'     => {
+         'color'   => '##blue',
+         'line'    => 'AREA',
+     },
+     'blue2'     => {
+         'color'   => '##blue25',
+         'line'    => 'STACK',
+     },
+     'blue3'     => {
+         'color'   => '##blue50',
+         'line'    => 'STACK',
+     },
+     'blue4'     => {
+         'color'   => '##blue75',
+         'line'    => 'STACK',
+     },
+     );
+
+# Place for extra RRDtool graph arguments
+# Example: ( '--color', 'BACK#D0D0FF', '--color', 'GRID#A0A0FF' );
+@Torrus::Renderer::graphExtraArgs = ();
+
+1;
diff --git a/torrus/sup/webplain/explain-rrdgraph.html b/torrus/sup/webplain/explain-rrdgraph.html
new file mode 100644 (file)
index 0000000..7dc8051
--- /dev/null
@@ -0,0 +1,85 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<HTML>
+<!-- Torrus Copyright (c) 2003-2004 Stanislav Sinyagin -->
+<HEAD>
+<TITLE>RRD Graph Description</TITLE>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
+<STYLE type="text/css" media="all">
+  @import url( torrus.css );  
+</STYLE>
+</HEAD>
+<BODY>
+
+
+<DIV CLASS="HelpContent">
+
+<H1>RRD Graph Description</H1>
+
+<P>
+The graphs in Torrus are drawn by
+<a href="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/">RRDtool</a>,
+a powerful instrument for data aggregation and graphing. 
+</P>
+
+<P>
+The horizontal axis displays the time at which the data has been collected.
+The rightmost point corresponds to the most recent moment. 
+</P>
+
+<P>
+The date and time of the graph can be easily changed by using the
+<em>Set date</em> checkbox at the bottom of the page. When the checkbox is
+checked, the date/time string in the text field is interpreted after clicking
+the submit button. It is then reflected in the <em>Report date</em>
+informational line at the page displaying the graphs. The date format is
+quite flexible. It understands such input as "<TT>July 13 5:00</TT>",
+or "<TT>01/13/2003 5:00</TT>", etc.
+</P>
+
+
+<P>
+The vertical axis scales automatically to fit the data values. The meaning of
+the values depends on the nature of the datasource, and is usually described
+in the graph legend, comments, and the help text.
+</P>
+
+
+<P>
+Usually the legend of the vertical axis specifies the meaning of the values:
+<ul>
+<li>Bps: bytes per second counter</li>
+<li>bps: bits per second counter</li>
+<li>pps: pakets per second counter</li>
+</ul>
+Other legends correspond mostly to gauges, such as temperature, load
+percentage, or disk space.
+</P>
+
+<P>
+The graphing engine automatically chooses the best units for scaling
+the values. The scaling magnitude is displayed alongside the numerical value,
+with the following meaning:
+<ul>
+<li>a: 10e-18 Atto</li>
+<li>f: 10e-15 Femto</li>
+<li>p: 10e-12 Pico</li>
+<li>n: 10e-9  Nano</li>
+<li>u: 10e-6  Micro</li>
+<li>m: 10e-3  Milli</li>
+<li>k: 10e+3   Kilo</li>
+<li>M: 10e+6   Mega</li>
+<li>G: 10e+9   Giga</li>
+<li>T: 10e+12  Tera</li>
+<li>P: 10e+15  Peta</li>
+<li>E: 10e+18  Exa</li>
+</ul>
+Memory usage is scaled with the base of 1024.
+</P>
+
+</DIV>
+<DIV CLASS="Footer">
+Powered by <A HREF="http://torrus.sourceforge.net">Torrus</A>
+</DIV>
+</BODY>
+</HTML>
\ No newline at end of file
diff --git a/torrus/sup/webplain/torrus-printer.css b/torrus/sup/webplain/torrus-printer.css
new file mode 100644 (file)
index 0000000..966abff
--- /dev/null
@@ -0,0 +1,264 @@
+/*
+   Torrus Renderer stylesheet.
+   Designed by Stanislav Sinyagin
+
+   $Id: torrus-printer.css,v 1.1 2010-12-27 00:04:04 ivan Exp $
+   */
+BODY {
+  background-color : white;
+  color : black;
+  font-family : verdana, arial, helvetica, sans-serif;
+  font-size : 10pt;
+  margin : 0;
+  padding-bottom : 0;
+  padding-left : 0;
+  padding-right : 0;
+  padding-top : 0;
+  voice-family : inherit, male;
+}
+
+H1, H2, H3 {
+  background-color : transparent;
+  color : black;
+}
+
+
+H1 {
+  font-size : 18pt;
+  font-weight : 900;
+  line-height : 20pt;
+}
+
+H2 {
+  font-size : 16pt;
+  font-weight : 700;
+  line-height : 18pt;
+}
+
+H3 {
+  font-size : 14pt;
+  line-height : 16pt;
+}
+
+P {
+  background-color : transparent;
+  color : black;
+  line-height : 18pt;
+  text-decoration : none;
+  padding-bottom : 0;
+  padding-left : 0;
+  padding-right : 0;
+  padding-top : 0;
+}
+
+A, A:link, A:visited {
+  background-color : transparent;
+  color : black;
+  text-decoration : none;
+}
+
+*.Header {
+  background-color : transparent;
+  border-bottom : 0.5pt solid black;
+  border-left : 0 solid black;
+  border-right : 0 solid black;
+  border-top : 0.5pt solid black;
+  color : black;
+  font-size : 9pt;
+  font-weight : 700;
+  margin : 5pt 0 10pt;
+  padding-bottom : 0;
+  padding-left : 10pt;
+  padding-right : 0;
+  padding-top : 10pt;
+}
+
+DIV.LoginInfo {
+  position : absolute;
+  right : 0;
+  top : 8px;
+  font-size : 9px;
+  text-align : right;
+}
+
+DIV.LoginInfo SPAN.UserName {
+  display : block;
+}
+
+DIV.LoginInfo SPAN.Logout {
+  display : none;
+}
+
+DIV.CurrentTime {
+  float: right;
+  font-size : 9px;
+  text-align: right;
+}
+
+*.Content, *.SingleColumnContent  {
+  margin-bottom : 0;
+  margin-left : 5pt;
+  margin-right : 5pt;
+  margin-top : 0;
+  padding-bottom : 10pt;
+  padding-left : 10pt;
+  padding-right : 10pt;
+  padding-top : 10pt;
+}
+
+DIV.CurrentPath {
+  background-color : transparent;
+}
+
+*.PathURLs {
+  font-size : 9px;
+}
+
+DIV.CurrentTree {
+  background-color : transparent;
+}
+
+DIV.Legend {
+  background-color : transparent;
+  color : black;
+  font-size : 8pt;
+  margin-bottom : 10pt;
+  margin-top : 10pt;
+}
+
+DIV.LegendRow {
+  clear : both;
+  height : 9pt;
+  width : 100%;
+  margin-bottom : 3pt;
+}
+
+*.LegendRow *.LegendName {
+  font-weight : bold;
+  padding-right : 5pt;
+  text-align : left;
+}
+
+*.LegendRow *.LegendValue {
+  text-align : left;
+}
+
+P.Variables SPAN.VariableName {
+  font-weight : bold;
+}
+
+DIV.Monitors {
+  clear : both;
+  float : none;
+  font-size : 8pt;
+  margin-bottom : 10pt;
+  position : relative;
+  width : 90%;
+}
+
+SPAN.MonitorName {
+  padding-left: 20pt;
+  padding-right: 20pt;
+}
+
+
+DIV.Listing {
+  margin-bottom : 10pt;
+  margin-left : 20pt;
+  margin-right : 20pt;
+}
+
+*.ListRow, *.ListRowEven  {
+  border-bottom : 0.5pt solid gray;
+  clear : both;
+  font-size : 8pt;
+  line-height : 12pt;
+  padding-top : 3pt;
+  width : 100%;
+}
+
+*.Listing *.NodeName {
+  display : block;
+  font-weight : bold;
+  padding-right : 5pt;
+  padding-left : 5pt;
+  text-align : left;
+}
+
+*.Listing *.NodeDescr {
+  display : block;
+  padding-left : 30pt;
+  padding-right : 5pt;
+  text-align : left;
+}
+
+DIV.Graph, DIV.ShortGraph  {
+  border-bottom : 0.5pt solid gray;
+  margin-bottom : 10pt;
+  margin-left : 20pt;
+  margin-right : 20pt;
+  margin-top : 15pt;
+  page-break-inside : avoid;
+}
+
+
+DIV.ShortGraph *.NodeName {
+  font-weight : bold;
+  width : 100%;
+}
+
+DIV.ShortGraph *.NodeDescr {
+  margin-bottom : 5pt;
+  width : 100%;
+}
+
+*.GraphImage {
+  text-align: center;
+}
+
+*.GraphImage IMG {
+  border-width : 0;
+  border-color : transparent;
+  float : none;
+}
+
+
+/* In tokenset display, short graphs are placed in two
+   columns on the screen, but one column on printer */
+
+DIV.ShortLeft, DIV.ShortRight {
+  width : 100%;
+}
+
+
+
+*.BottomShortcuts {
+  display : none;
+}
+
+
+*.TopMenu, *.BottomMenu {
+  display : none;
+}
+
+
+*.Footer {
+  background-color : transparent;
+  border-bottom : 0 solid black;
+  border-left : 0 solid black;
+  border-right : 0 solid black;
+  border-top : 0.75pt solid black;
+  color : black;
+  font-size : 6pt;
+  margin : 0 0 10pt;
+  padding-bottom : 0;
+  padding-left : 0;
+  padding-right : 0;
+  padding-top : 0;
+  text-align : right;
+  width : 100%;
+}
+
+*.SiteInfo, *.TreeInfo {
+  padding-left : 5em;
+}
diff --git a/torrus/sup/webplain/torrus-report.css b/torrus/sup/webplain/torrus-report.css
new file mode 100644 (file)
index 0000000..e18dda8
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+   Torrus Renderer stylesheet.
+   Designed by Stanislav Sinyagin
+
+   $Id: torrus-report.css,v 1.1 2010-12-27 00:04:04 ivan Exp $
+   */
+BODY {
+  background-color : white;
+  color : black;
+  font-family : verdana, arial, helvetica, sans-serif;
+  font-size : 10pt;
+  margin : 0;
+  padding-bottom : 0;
+  padding-left : 0;
+  padding-right : 0;
+  padding-top : 0;
+  voice-family : inherit, male;
+}
+
+H1, H2, H3 {
+  background-color : transparent;
+  color : black;
+}
+
+
+H1 {
+  font-size : 18pt;
+  font-weight : 900;
+  line-height : 20pt;
+}
+
+H2 {
+  font-size : 16pt;
+  font-weight : 700;
+  line-height : 18pt;
+}
+
+H3 {
+  font-size : 14pt;
+  line-height : 16pt;
+}
+
+A, A:link, A:visited {
+  background-color : transparent;
+  color : black;
+  text-decoration : none;
+}
+
+A:hover {
+  background-color : #eee;
+  color : inherit;
+}
+
+*.Header {
+  background-color : transparent;
+  border-bottom : 0.5pt solid black;
+  border-left : 0 solid black;
+  border-right : 0 solid black;
+  border-top : 0.5pt solid black;
+  color : black;
+  font-size : 9pt;
+  font-weight : 700;
+  margin : 5pt 0 10pt;
+  padding-bottom : 0;
+  padding-left : 10pt;
+  padding-right : 0;
+  padding-top : 10pt;
+}
+
+
+DIV.CurrentTime {
+  float: right;
+  font-size : 9px;
+  text-align: right;
+}
+
+*.Content, *.SingleColumnContent  {
+  margin-bottom : 0;
+  margin-left : 5pt;
+  margin-right : 5pt;
+  margin-top : 0;
+  padding-bottom : 10pt;
+  padding-left : 10pt;
+  padding-right : 10pt;
+  padding-top : 10pt;
+}
+
+
+DIV.CurrentTree {
+  background-color : transparent;
+  margin-bottom : 4pt;
+}
+
+
+TABLE.ReportTable {
+  font-size : 9pt;
+  border-collapse : collapse;
+}
+
+CAPTION.ReportTable {
+  font-size : 14pt;
+  font-weight : 700;
+  caption-side: top;
+  padding-bottom : 7pt;
+  padding-top : 10pt;
+}
+
+TR.ReportHeadRow {
+  background-color : #999;
+}
+
+
+TR.ReportEvenRow {
+  background-color : #ccc;
+}
+
+TD {
+  border : solid 1px #aaa;
+  padding-bottom : 1pt;
+  padding-top : 3pt;
+  padding-left : 2pt;
+  padding-right : 2pt;
+  width : 10%;
+}
+
+TD.ReportHeadCell {
+  font-weight : 700;
+  text-align : center;
+}
+
+TD.ReportCell {
+  text-align : right;
+  padding-left : 7pt;
+}
+
+TD.ReportFirstCell {
+  text-align : left;
+  font-weight : 600;
+}
+
+
+DIV.ReportLegend {
+  margin-top: 60pt;
+  margin-left: 10pt;
+  font-size : 7pt;  
+}
+
+SPAN.ReportLegendTerm {
+  font-weight : 700;
+  padding-right : 2pt;
+}
+
+*.Footer {
+  background-color : transparent;
+  border-bottom : 0 solid black;
+  border-left : 0 solid black;
+  border-right : 0 solid black;
+  border-top : 0.75pt solid black;
+  color : black;
+  font-size : 6pt;
+  margin : 0 0 10pt;
+  padding-bottom : 0;
+  padding-left : 0;
+  padding-right : 0;
+  padding-top : 0;
+  text-align : right;
+  width : 100%;
+}
+
+*.SiteInfo, *.TreeInfo {
+  padding-left : 5em;
+}
diff --git a/torrus/sup/webplain/torrus.css b/torrus/sup/webplain/torrus.css
new file mode 100644 (file)
index 0000000..a20e008
--- /dev/null
@@ -0,0 +1,503 @@
+/*
+   Torrus Renderer stylesheet.
+   Designed by BlueRobot.com
+   Modified by Ian Holsman <ian@holsman.net>
+   Optimised by Stanislav Sinyagin
+
+   $Id: torrus.css,v 1.1 2010-12-27 00:04:04 ivan Exp $
+   */
+BODY {
+  background-color : white;
+  color : #333;
+  font-family : verdana, arial, helvetica, sans-serif;
+  font-size : 11px;
+  margin : 0;
+  padding-bottom : 0;
+  padding-left : 0;
+  padding-right : 0;
+  padding-top : 0;
+  voice-family : inherit, male;
+}
+
+H1, H2, H3, P {
+  background-color : inherit;
+  margin : 0 0 15px;
+  padding-bottom : 0;
+  padding-left : 0;
+  padding-right : 0;
+  padding-top : 0;
+}
+
+H1, H2 {
+  color : #ccc;
+}
+
+H1 {
+  font-size : 28px;
+  font-weight : 900;
+  line-height : 28px;
+}
+
+H2 {
+  font-size : 20px;
+  font-weight : 700;
+  line-height : 20px;
+}
+
+H3 {
+  color : #333;
+  font-size : 18px;
+  line-height : 18px;
+}
+
+P {
+  clear : both; /* needed for Opera 6.12 */
+  color : #333;
+  float : none;
+  font-size : 11px;
+  line-height : 20px;
+}
+
+A {
+  background-color : inherit;
+  color : #09c;
+  font-weight : 600;
+  text-decoration : none;
+}
+
+A:link, A:visited {
+  background-color : inherit;
+  color : #09c;
+}
+
+A:hover {
+  background-color : #eee;
+  color : inherit;
+}
+
+DIV.CurrentPath A:hover {
+  background-color : #ccc;
+  color : inherit;
+}
+
+
+*.Header {
+  background-color : #eee;
+  border-bottom : 1px solid black;
+  border-left : 0 solid black;
+  border-right : 0 solid black;
+  border-top : 1px solid black;
+  color : inherit;
+  margin : 1em 0 1em;
+  padding-bottom : 0;
+  padding-left : 20px;
+  padding-right : 0;
+  padding-top : 17px;
+}
+
+
+*.Header A:hover {
+  background-color : #ccc;
+  color : inherit;
+}
+
+DIV.LoginInfo {
+  position : absolute;
+  right : 1em;
+  top : 1.5em;
+  font-size : 9px;
+  text-align : right;
+}
+
+DIV.LoginInfo SPAN.UserName {
+  display : block;
+}
+
+DIV.LoginInfo SPAN.Logout {
+  display : block;
+}
+
+SPAN.Logout A {
+  font-size : 9px;
+}
+
+DIV.CurrentTime {
+  float: right;
+  font-size : 9px;
+  padding-right: 1em;
+  text-align: right;
+}
+
+*.Content, *.SingleColumnContent  {
+  display : block;
+  float : left;
+  margin-bottom : 20px;
+  margin-left : 0px;
+  margin-right : 0px;
+  margin-top : 0;
+  padding-bottom : 10px;
+  padding-left : 10px;
+  padding-right : 10px;
+  padding-top : 10px;
+}
+
+*.SingleColumnContent {
+  padding-right : 0px;
+  width : 100%;
+}
+
+*.Content {
+  padding-right : 0px;
+  width : 70%;
+}
+
+DIV.PathMenu {
+  background-color : #eee;
+  border-bottom : 1px dashed #999;
+  border-left : 1px dashed #999;
+  border-right : 1px dashed #999;
+  border-top : 1px dashed #999;
+  color : inherit;
+  float : left;
+  line-height : 17px;
+  margin-left : 5px;
+  padding-bottom : 10px;
+  padding-left : 10px;
+  padding-right : 10px;
+  padding-top : 10px;
+  position : relative;
+  min-width : 15%; /* does not work in IE6 */
+}
+
+SPAN.PathElement {
+  display : block;
+}
+
+SPAN.TreeName {
+  font-weight : bold;
+}
+
+*.PathMenu DIV.CurrentTree {
+  font-size : 10px;
+  overflow : hidden;
+  width : 150px; /* compensate unsupported min-width in IE6 */
+}
+
+*.PathMenuHeader {
+  font-size : 10px;
+}
+
+*.SingleColumnContent DIV.CurrentTree {
+  padding-bottom : 5px;
+}
+
+*.SingleColumnContent DIV.CurrentTree {
+  color : inherit;
+  font-size : 10px;
+}
+
+DIV.Legend {
+  background-color : #eee;
+  color : inherit;
+  clear : both;
+  float : none;
+  font-size : 10px;
+  margin-bottom : 10px;
+  position : relative;
+  width : 90%;
+}
+
+DIV.LegendRow {
+  clear : both;
+  float : none;
+  margin-bottom: 2px;
+}
+
+DIV.LegendRow SPAN.LegendName {
+  font-weight : bold;
+  text-align : left;
+  padding-right : 5px;
+}
+
+DIV.LegendRow SPAN.LegendValue {
+  text-align : left;
+}
+
+P.Variables SPAN.VariableName {
+  font-weight : bold;
+}
+
+DIV.Monitors {
+  clear : both;
+  float : none;
+  font-size : 10px;
+  margin-bottom : 10px;
+  position : relative;
+  width : 90%;
+}
+
+SPAN.MonitorName {
+  padding-left: 20px;
+  padding-right: 20px;
+}
+
+
+DIV.Listing {
+  clear : both;
+  float : none;
+  font-size : 11px;
+  margin-bottom : 10px;
+  width : 90%;
+}
+
+*.ListRow, *.ListRowEven  {
+  clear : both;
+  margin-top : 3px;
+}
+
+*.ListRowEven {
+  background-color : #eee;
+}
+
+*.ListRowEven A:hover {
+  background-color : #ccc;
+  color : inherit;
+}
+
+DIV.Listing *.NodeName  {
+  display : block;
+  font-weight : bold;
+  padding-left : 10px;
+  text-align : left;
+}
+
+DIV.Listing *.NodeDescr, DIV.Listing *.TokensetDescr  {
+  display : block;
+  padding-left : 30px;
+}
+
+*.RecursiveListRow {
+  clear : both;
+  margin-top : 3px;
+  margin-left : 20px;
+  margin-right : 2px;
+  padding-bottom: 2px;
+  border: 1px solid #eee;
+}
+
+
+DIV.ShortGraph *.NodeDescr {
+  font-weight : 600;
+  padding-left : 10px;
+}
+
+DIV.Graph, DIV.ShortGraph  {
+  clear : left;
+  float : left;
+  margin-bottom : 10px;
+  margin-top : 15px; 
+  position : relative;
+  width : 100%;
+}
+
+
+DIV.ShortGraph *.NodeName, DIV.ShortGraph *.NodeDescr {
+  clear : both;
+  float : none;
+  font-size : 11px;
+  width : 100%;
+}
+
+DIV.ShortGraph IMG {
+  border-width : 0;
+  border-color : transparent;
+  clear : both;
+  float : left;
+}
+
+/* In tokenset display, short graphs are placed in two
+   columns: left and right */
+
+DIV.ShortLeft, DIV.ShortRight {
+  margin-bottom : 5px;
+  page-break-inside : avoid;
+  position : relative;
+  width : 50%;
+}
+
+DIV.ShortLeft {
+  clear : left;
+  float : left;
+}
+
+DIV.ShortRight {
+  clear : right;
+  float : right;
+}
+
+
+FORM.LoginForm {
+  color : #333;
+  font-size : 11px;
+  line-height : 20px;
+  width : 50%;
+}
+
+SPAN.LoginTitle {
+  float : left;
+  width : 20%;
+}
+
+SPAN.LoginInput INPUT {
+  width : 30%;
+}
+
+SPAN.LoginInput INPUT.Remember {
+  width : auto;
+}
+
+
+*.BottomShortcuts {
+  clear : both;
+  float : none;
+  font-size : 11px;
+  height : 15px;
+  margin : 25px 0 20px;
+  padding-bottom : 0;
+  padding-left : 0;
+  padding-right : 0;
+  padding-top : 0;
+  position : relative;
+}
+
+
+*.TopMenu {
+  font-size : 9px;
+  padding-left : 1em;
+}
+
+*.BottomMenu {
+  clear : both;
+  float : none;
+  font-size : 9px;
+  /* height : 15px; */
+  margin : 50px 0 0 0;
+  padding-bottom : 0;
+  padding-left : 1em;
+  padding-right : 0;
+  padding-top : 0;
+  width : 100%;  
+}
+
+
+
+*.TopMenu A, *.TopMenu A:link, *.TopMenu A:visited,
+*.BottomMenu A, *.BottomMenu A:link, *.BottomMenu A:visited {
+  color: #A1C3CB;
+  font-size : 9px;  
+}
+
+
+*.Footer {
+  background-color : #eee;
+  border-bottom : 1px solid black;
+  border-left : 0 solid black;
+  border-right : 0 solid black;
+  border-top : 1px solid black;
+  clear : both;
+  color : inherit;
+  float : none;
+  font-size : 10px;
+  height : 15px;
+  line-height : 12px;
+  margin : 0 0 10px;
+  padding-bottom : 0;
+  padding-left : 0;
+  padding-right : 1em;
+  padding-top : 0;
+  text-align : right;
+}
+
+*.Footer A {
+  font-size : 10px;
+}
+
+*.SiteInfo, *.TreeInfo {
+  padding-left : 5em;
+}
+
+*.HelpContent {
+  font-size: 12px;
+  line-height: 15px;
+  padding-bottom: 5px;
+  padding-left: 2em;
+  padding-right: 2em;
+  padding-top: 5px;
+}
+
+*.HelpContent P {
+  font-size: 12px;
+}
+
+*.HelpHeader {
+  color : #ccc;
+  font-size : 13px;
+  font-weight: 800;
+  margin : 10px 0 10px;
+}
+
+*.HelpFooter {
+  position: absolute;
+  bottom: 0;
+  margin : 0 0 10px;
+}
+
+*.HelpPathHeader {
+  font-weight: 700;
+  margin : 10px 0 10px;
+}
+
+*.HelpMessage {
+  padding-left: 2em;
+  padding-right: 2em;
+}
+
+*.SetDateDialog {
+  font-size : 9px;
+  padding-bottom : 0;
+  padding-left : 2em;
+  padding-right : 2em;
+  padding-top : 0;
+}
+
+*.SetDateDialog FORM {
+  display : inline;
+}
+
+*.SetDateDialog INPUT {
+  font-size : 9px;
+}
+
+
+*.SearchDialog {
+  font-size : 9px;
+  padding-bottom : 0;
+  padding-left : 2em;
+  padding-right : 2em;
+  padding-top : 0;
+}
+
+*.SearchDialog FORM {
+  display : inline;
+}
+
+*.SearchDialog INPUT {
+  font-size : 9px;
+}
+
+
+
+*.ErrorMessage {
+  color : red;
+  height : 15px;
+}
diff --git a/torrus/templates/aclexport.xml b/torrus/templates/aclexport.xml
new file mode 100644 (file)
index 0000000..b27b4d3
--- /dev/null
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+
+<!-- Torrus Access Control Lists export -->
+
+<aclexport>
+  <file-info>
+    <format-version>1.1</format-version>
+  </file-info>
+
+  <groups>
+    [% FOREACH group = groups() %]
+    <group name="[% group %]">
+      [% privhash = privileges(group);
+         FOREACH object = privhash.keys.sort;
+           FOREACH priv = privhash.$object.keys.sort %]
+      <privilege object="[% object %]" name="[% priv %]"/>
+      [%   END;
+         END;
+         FOREACH attr = gattrlist(group); %]
+      <attribute name="[% attr %]" value="[% xmlnorm(gattr(group, attr)) %]"/>
+      [%   END; %]
+    </group>
+    [% END %]
+  </groups>
+
+  <users>
+    [% FOREACH uid = users() %]
+    <user uid="[% uid %]">
+      [% FOREACH group = memberof(uid) %]
+      <member-of group="[% group %]"/>
+      [% END;
+         FOREACH attr = uattrlist(uid);
+           IF attr != 'uid' %]
+      <attribute name="[% attr %]" value="[% xmlnorm(uattr(uid, attr)) %]"/>
+      [%   END;
+         END %]
+    </user>
+    [% END %]
+  </users>
+</aclexport>
diff --git a/torrus/templates/adminfo.html b/torrus/templates/adminfo.html
new file mode 100644 (file)
index 0000000..a041e00
--- /dev/null
@@ -0,0 +1,38 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% INCLUDE htmlstart
+     title='Administrative information: ' _ path(token)
+     contentClass="SingleColumnContent"
+     noTopMenu=1 %]
+
+<H1>Administrative information</H1>
+[% INCLUDE treename %]
+<P>Path: [% path(token) %]</P>
+
+[%
+FOREACH category = adminfo.keys.sort;
+%]
+<H2>[% category %]</H2>
+<DIV CLASS="Listing">
+[%
+  counter = 0;
+  evenRow = 0;
+
+  FOREACH pname = adminfo.$category.keys.sort;
+    counter = counter + 1;
+    IF counter % 2 == 0;
+      evenRow = 1;
+    ELSE;
+      evenRow = 0;
+    END;
+%]
+  <DIV CLASS="[% evenRow ? 'ListRowEven' : 'ListRow' %]">
+    <SPAN CLASS="NodeName">[% pname %]</SPAN>
+    <SPAN CLASS="NodeDescr">[% adminfo.$category.$pname %]</SPAN>
+    </SPAN>
+  </DIV>
+[% END %]
+</DIV>
+[%
+END %]
+
+[% INCLUDE htmlend %]
diff --git a/torrus/templates/default-chooser.html b/torrus/templates/default-chooser.html
new file mode 100644 (file)
index 0000000..f49b789
--- /dev/null
@@ -0,0 +1,37 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% INCLUDE htmlstart
+     title="Torrus Top: " _ companyName
+     contentClass="SingleColumnContent"
+     noTopMenu=1 %]
+
+<P>Choose the datasource tree</P>
+
+<DIV CLASS="Listing">
+[%   counter = 0;
+     evenRow = 0;
+
+     FOREACH tree = treeNames();
+
+     IF not userAuth or mayDisplayTree(tree);
+         counter = counter + 1;
+
+         IF counter % 2 == 0;
+           evenRow = 1;
+         ELSE;
+           evenRow = 0;
+         END;
+%]
+
+  <DIV CLASS="[% evenRow ? 'ListRowEven' : 'ListRow' %]">
+    <SPAN CLASS="NodeName"><A HREF="[%url(tree)%]">[% tree %]</A></SPAN>
+    <SPAN CLASS="NodeDescr">[% xmlnorm(treeDescr(tree)) %]</SPAN>
+  </DIV>
+  [% END %]
+[% END %]
+</DIV>
+
+</DIV><!-- Content -->[% global.contentFinished = 1 %]
+<DIV CLASS="BottomMenu">
+[% INCLUDE globalsearchdialog %]
+</DIV>
+[% INCLUDE htmlend %]
diff --git a/torrus/templates/default-dir.html b/torrus/templates/default-dir.html
new file mode 100644 (file)
index 0000000..ef6358d
--- /dev/null
@@ -0,0 +1,74 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% thepath=path(token) %]
+[% INCLUDE htmlstart title=thepath printpath=1 %]
+
+<H1>[% xmlnorm(nodeParam(token,'comment')) %]</H1>
+
+[% INCLUDE legend %]
+
+<P>Directories you can jump to:</P>
+<DIV CLASS="Listing">
+[%   hasLeaves = 0; hasSubtrees = 0;
+     childCounter = 0;
+     evenRow = 0;
+     FOREACH child = sortTokens(children(token));
+       hidden = 0;
+       IF nodeParam(child,'hidden') == 'yes';
+         hidden = 1;
+       END;
+       comment = nodeParam(child,'comment',1);
+       IF not hidden or variables.SHOWHIDDEN;
+         childCounter = childCounter + 1;
+         evenRow = childCounter % 2 == 0;
+         IF isLeaf(child);
+           hasLeaves = hasLeaves + 1;
+         ELSE;
+           IF isAlias(child);
+             thisIsAlias = 1;
+             urlTitle=' TITLE="Symbolic link to ' _ path(isAlias(child)) _'"';
+             IF isLeaf(isAlias(child));
+               hasLeaves = hasLeaves + 1;
+             END;
+           ELSE;
+             hasSubtrees = 1;
+             urlTitle = '';
+           END;
+         END;
+%]
+  <DIV CLASS="[% evenRow ? 'ListRowEven' : 'ListRow' %]">
+    <SPAN CLASS="NodeName">
+      [% thisIsAlias ? '<EM CLASS="Alias">':'';
+         hidden ? '<EM CLASS="ShowHidden">':'' %]
+      <A HREF="[%url(child)%]"[%urlTitle%]>[% nodeName(child) %]</A>
+      [% hidden ? '</EM>':'';
+         thisIsAlias ? '</EM>':''; %]
+    </SPAN>
+       [% IF comment %]
+    <SPAN CLASS="NodeDescr">
+      [% hidden ? '<EM CLASS="ShowHidden">':'' %]
+      [% xmlnorm(comment) %]
+      [% hidden ? '</EM>':'' %]
+    </SPAN>
+       [% END %]
+  </DIV>
+    [% END %]
+  [% END %]
+</DIV>
+
+<DIV CLASS="BottomShortcuts">
+[% IF hasLeaves > 1;
+    INCLUDE shortcut url=url(token, 'expanded-dir-html')
+                     text="Expand leaves"
+                     title="Show all leaf graphs in one page";
+   END;
+   IF hasSubtrees and nodeParam(token,'show-recursive',1) == 'yes';
+    INCLUDE shortcut url=url(token, 'recursive-dir-html')
+                     text="Recursive view"
+                     title="Show all subtrees and leaves in one page";
+   
+   END;
+   INCLUDE overviewShortcuts %]
+</DIV>
+
+[% INCLUDE bottomline %]
+[% INCLUDE htmlend %]
diff --git a/torrus/templates/default-helptext.html b/torrus/templates/default-helptext.html
new file mode 100644 (file)
index 0000000..3f9cb15
--- /dev/null
@@ -0,0 +1,39 @@
+[%#  #### We don't need the standard header and footer ####### %]
+[% PROCESS 'html-incblocks.txt' %]
+[% thepath=path(token) %]
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<HTML>
+<!-- Torrus Copyright (c) 2004 Stanislav Sinyagin -->
+<HEAD>
+<TITLE>Help: [%thepath%]</TITLE>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
+<STYLE type="text/css" media="all">
+  @import url( [% plainURL _ style('stylesheet') %] );
+  [% cssoverlay = style('cssoverlay'); IF cssoverlay; %]
+  @import url( [% cssoverlay %] );
+  [% END %]
+</STYLE>
+</HEAD>
+<BODY>
+<DIV CLASS="HelpContent">
+
+<DIV CLASS="HelpHeader">
+Torrus Help
+</DIV>
+
+<DIV CLASS="HelpPathHeader">
+[% thepath %]
+</DIV>
+
+[% helptext=nodeParam(token, 'help-text', 1); %]
+<DIV CLASS="HelpMessage">
+[% markup( helptext ) %]
+</DIV>
+
+<DIV CLASS="HelpFooter">
+<A HREF="javascript:window.close()">Close window</A>
+</DIV>
+</DIV>
+</BODY>
+</HTML>
diff --git a/torrus/templates/default-login.html b/torrus/templates/default-login.html
new file mode 100644 (file)
index 0000000..47dc610
--- /dev/null
@@ -0,0 +1,59 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% INCLUDE htmlstart
+     title="Torrus Login: " _ companyName
+     contentClass="SingleColumnContent"
+     noTopMenu=1 %]
+
+[% IF authFailed %]
+<P>Incorrect username or password.</P>
+[% END %]
+
+<P>Please authenticate yourself</P>
+
+<FORM CLASS="LoginForm" METHOD="POST" ACTION="[%url%]">
+  [% IF urlPassParams.token.defined AND urlPassParams.token.length > 0 %]
+    <INPUT TYPE="HIDDEN" NAME="token" VALUE="[%urlPassParams.token%]"/>
+  [% ELSE;
+      IF urlPassParams.path.defined AND urlPassParams.path.length > 0 %]
+       <INPUT TYPE="HIDDEN" NAME="path" VALUE="[%urlPassParams.path%]"/>
+  [% ELSE;
+        IF urlPassParams.nodeid.defined AND urlPassParams.nodeid.length > 0 %]
+       <INPUT TYPE="HIDDEN" NAME="nodeid" VALUE="[%urlPassParams.nodeid%]"/>
+  [%    END;
+     END;
+     END %]
+  [% IF urlPassParams.view.defined AND urlPassParams.view.length > 0 %]
+    <INPUT TYPE="HIDDEN" NAME="view" VALUE="[% urlPassParams.view %]"/>
+  [% END %]
+  <DIV CLASS="LoginRow">
+    <SPAN CLASS="LoginTitle">Username:</SPAN>
+    <SPAN CLASS="LoginInput">
+      <INPUT CLASS="Username" TYPE="TEXT" NAME="uid"/>
+    </SPAN>
+  </DIV>
+  <DIV CLASS="LoginRow">
+    <SPAN CLASS="LoginTitle">Password:</SPAN>
+    <SPAN CLASS="LoginInput">
+      <INPUT CLASS="Password" TYPE="PASSWORD" NAME="password"/>
+    </SPAN>
+  </DIV>
+  <DIV CLASS="LoginRow">
+    <SPAN CLASS="LoginTitle">
+    &nbsp;
+    </SPAN>
+    <SPAN CLASS="LoginInput">
+    <INPUT CLASS="Remember" TYPE="CHECKBOX" NAME="remember"/>
+    remember me
+    </SPAN>
+  </DIV>
+  <DIV CLASS="LoginRow">
+      <INPUT CLASS="Submit" TYPE="SUBMIT" VALUE="Login"/>
+  </DIV>
+</FORM>
+[% IF lostPasswordURL %]
+  <DIV CLASS="LoginRow">
+    <A HREF="[% lostPasswordURL %]">Lost password?</A>
+  </DIV>
+[% END %]
+
+[% INCLUDE htmlend %]
diff --git a/torrus/templates/default-recursivedir.html b/torrus/templates/default-recursivedir.html
new file mode 100644 (file)
index 0000000..eed6493
--- /dev/null
@@ -0,0 +1,52 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% thepath=path(token) %]
+[% INCLUDE htmlstart title=thepath printpath=1 %]
+
+<H1>[% xmlnorm(nodeParam(token,'comment')) %]</H1>
+
+[% INCLUDE legend %]
+
+[%#  ###########    Recursively print the children   ################ %]
+
+[% BLOCK recursiveChildren;
+     FOREACH child = sortTokens(children(token));
+       hidden = 0;
+       IF nodeParam(child,'hidden') == 'yes';
+         hidden = 1;
+       END;
+       IF isAlias(child);
+         thisIsAlias = 1;
+         urlTitle = 'Symbolic link to ' _ path(isAlias(child));
+       ELSE;
+         urlTitle = nodeParam(child,'comment',1);
+       END;
+       IF not hidden or variables.SHOWHIDDEN; %]
+<DIV CLASS="RecursiveListRow">
+  <SPAN CLASS="NodeName">
+    [% thisIsAlias ? '<EM CLASS="Alias">':'';
+       hidden ? '<EM CLASS="ShowHidden">':'' %]
+    <A HREF="[%url(child)%]"
+       TITLE="[%urlTitle%]">[% nodeName(child) %]</A>
+    [% hidden ? '</EM>':'';  thisIsAlias ? '</EM>':''; %]
+  </SPAN>
+  [% INCLUDE recursiveChildren token=child %]
+</DIV>
+    [% END;
+     END;
+  END %]
+
+
+<P>Directories you can jump to:</P>
+<DIV CLASS="Listing">
+[% INCLUDE recursiveChildren token=token %]
+</DIV>
+
+<DIV CLASS="BottomShortcuts">
+[% INCLUDE shortcut url=url(token) text="Default view"
+                     title="Restore default subtree view";
+   INCLUDE overviewShortcuts
+%]
+</DIV>
+
+[% INCLUDE bottomline %]
+[% INCLUDE htmlend %]
diff --git a/torrus/templates/default-rrd.html b/torrus/templates/default-rrd.html
new file mode 100644 (file)
index 0000000..cfbdbce
--- /dev/null
@@ -0,0 +1,134 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% INCLUDE setdate %]
+[% INCLUDE htmlstart title='Graphs for ' _ path(token) printpath=1 %]
+
+[% parentComment = nodeParam(parent(token),'comment') %]
+[% IF parentComment %]<H1>Graphs for [% xmlnorm(parentComment) %]</H1>[% END %]
+
+[% INCLUDE variables %]
+
+<P>[% xmlnorm(nodeParam(token,'comment')) %]</P>
+
+[% INCLUDE legend %]
+
+[% monitors = nodeParam(token,'monitor');
+   IF monitors != '';
+   moncount = monitors.split(',').size %]
+<DIV CLASS="Monitors">
+<DIV CLASS="MonitorsTitle">
+<STRONG>Monitor[% (moncount > 1) ? 's' : '' %]:</STRONG>
+[% (moncount > 1) ? moncount : '' %]
+[% FOREACH monitor = monitors.split(',');
+     mondesc = param(monitor, 'comment') %]
+     <DIV CLASS="MonitorLine">
+     <SPAN CLASS="MonitorName">[% monitor %]</SPAN>
+     [% IF mondesc; %]<SPAN CLASS="MonitorDesc">([% mondesc %])</SPAN>[% END %]
+     </DIV>
+[% END %]
+</DIV>
+</DIV>
+[% END %]
+
+[% IF nodeParam(token, 'ds-type') != 'rrd-multigraph' %]
+  [% dayValues = rrprint(token, 'rrd-print-daily') %]
+  [% lastValue = rrprint(token, 'rrd-print-last') %]
+
+  <P>Min: [% scale('%.1f', dayValues.0) %], &nbsp;
+  Avg: [% scale('%.1f', dayValues.1) %], &nbsp;
+  Max: <STRONG>[% scale('%.1f', dayValues.2) %]</STRONG>, &nbsp;
+  Last: [% scale('%.1f', lastValue) %]
+  </P>
+[% END %]
+
+[%
+  graphvars = [];
+  graphviews = nodeParam(token,'rrgraph-views').split(',');
+  dayView = graphviews.1;
+  weekView = graphviews.2;
+  monthView = graphviews.3;
+  yearView = graphviews.4;
+  IF   nodeParam(token, 'rrd-hwpredict') == 'enabled' and
+       ( param(view, 'rrd-hwpredict') == 'disabled' or variables.NOHW );
+    graphvars = ['NOHW', 1];
+  END;
+%]
+
+<DIV CLASS="Graph">
+<H2>Last day graph</H2>
+[% INCLUDE rrgraph view=dayView vars=graphvars %]
+</DIV>
+
+<DIV CLASS="Graph">
+<H2>Last week graph</H2>
+[% INCLUDE rrgraph view=weekView vars=graphvars %]
+</DIV>
+
+[% longterm = param(view, 'longterm') %]
+[% IF longterm %]
+
+<DIV CLASS="Graph">
+<H2>Last month graph</H2>
+[% INCLUDE rrgraph view=monthView %]
+</DIV>
+
+<DIV CLASS="Graph">
+<H2>Last year graph</H2>
+[% INCLUDE rrgraph view=yearView %]
+</DIV>
+
+[% END %]
+
+<DIV CLASS="BottomShortcuts">
+[%
+  IF longterm;
+    hwview='longterm-rrd-html';
+    termview='default-rrd-html';
+  ELSE;
+    hwview='default-rrd-html';
+    termview='longterm-rrd-html';
+  END;
+  hwvars = [];
+  termvars = [];
+  IF nodeParam(token, 'rrd-hwpredict') == 'enabled' and
+     param(view, 'rrd-hwpredict') != 'disabled';
+    IF not variables.NOHW;
+      hwaction = 'Disable';
+      hwvars = ['NOHW', 1];
+      termvars = ['NOHW', ''];
+    ELSE;
+      hwaction = 'Enable';
+      hwvars = ['NOHW', ''];
+      termvars = ['NOHW', 1];
+    END;
+    INCLUDE shortcut url=url(token, hwview, hwvars)
+                     text=hwaction _ " Holt-Winters"
+                     title="Switch Holt-Winters prediction boundaries";
+  ELSE;
+    IF longterm;
+      termview='default-rrd-html';
+    ELSE;
+      termview='longterm-rrd-html';
+    END;
+  END;
+
+  IF longterm;
+    termstr='Short';
+    sctitle="View last day and last week graphs";
+  ELSE;
+    termstr='Long';
+    sctitle="View last day, week, month, and year graphs";
+  END;
+
+  INCLUDE shortcut url=url(token, termview, termvars)
+                  text=termstr _ "term view"
+                  title=sctitle;
+                  
+  INCLUDE shortcut url=plainURL _ 'explain-rrdgraph.html'
+                  text='Explain graph'
+                  title='Describe graph elements and values'
+                  newwindow=1;
+%]
+</DIV>
+
+[% INCLUDE bottomline %]
+[% INCLUDE htmlend %]
diff --git a/torrus/templates/default-tset.html b/torrus/templates/default-tset.html
new file mode 100644 (file)
index 0000000..6cf7911
--- /dev/null
@@ -0,0 +1,56 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% INCLUDE setdate %]
+[% comment = xmlnorm(param(token, 'comment')) %]
+[% INCLUDE htmlstart title=comment contentClass="SingleColumnContent" %]
+
+<H1>[% comment %]</H1>
+
+[% INCLUDE treename %]
+
+[% INCLUDE variables %]
+
+[% SET pos = 1; SET global.hwpredict = 0 %]
+[% FOREACH node = sortTokens(tsetMembers(token)) %]
+  [% IF pos == 1 %]
+<DIV CLASS="ShortLeft">
+  [% ELSE %]
+<DIV CLASS="ShortRight">
+  [% END %]
+  [% nodename=nodeParam(node,'descriptive-nickname');
+     IF nodename=='';
+       nodename=path(node);
+     END;
+     INCLUDE shortgraph
+        token=node
+        nodename=nodename
+        comment=nodeParam(parent(node),'comment',1)
+   %]
+</DIV>
+  [% IF pos == 1 %]
+    [% SET pos = 2 %]
+  [% ELSE %]
+    [% SET pos = 1 %]
+  [% END %]
+[% END %]
+
+<DIV CLASS="BottomShortcuts">
+[%
+  IF global.hwpredict;
+    IF variables.NOHW;
+      INCLUDE shortcut url=url(token, view, 'NOHW', '')
+                       text="Enable Holt-Winters"
+                       title="Switch Holt-Winters prediction boundaries";
+    ELSE;
+      INCLUDE shortcut url=url(token, view, 'NOHW', 1)
+                       text="Disable Holt-Winters"
+                       title="Switch Holt-Winters prediction boundaries";
+    END;
+  END
+%]
+
+[% INCLUDE shortcut url=url('SS') text="Back to tokensets list"
+                    title="List of non-empty tokensets"%]
+</DIV>
+
+[% INCLUDE tsetbottomline %]
+[% INCLUDE htmlend %]
diff --git a/torrus/templates/email-alarm.txt b/torrus/templates/email-alarm.txt
new file mode 100644 (file)
index 0000000..59c6036
--- /dev/null
@@ -0,0 +1,27 @@
+Subject: Monitor event: [%event%], [% nickname %]
+
+This is automatic Torrus event notification.
+
+Event timestamp:     [% timestamp %]
+
+Tree name:           [% tree %]
+Node path:           [% path %]
+Node description:    [% npcomment %]
+Monitor name:        [% monitor %]
+Monitor description: [% mcomment %]
+
+Event type:          [% event %]
+
+You can browse the node up-to-date graphs at this URL:
+  [% url %]
+
+
+
+Event types description:
+  set       Alarm condition is met first time
+  repeat    Alarm condition repeats
+  clear     Alarm condition is no longer met
+  forget    Information about this alarm has expired
+
+Torrus home page and documentation:
+  http://torrus.sourceforge.net
\ No newline at end of file
diff --git a/torrus/templates/expanded-dir.html b/torrus/templates/expanded-dir.html
new file mode 100644 (file)
index 0000000..844a2c3
--- /dev/null
@@ -0,0 +1,52 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% INCLUDE setdate %]
+[% thepath=path(token) %]
+[% INCLUDE htmlstart title=thepath printpath=1 %]
+
+<H1>[% xmlnorm(nodeParam(token,'comment')) %]</H1>
+
+[% INCLUDE variables %]
+
+[% INCLUDE legend %]
+
+<H2>Leaf nodes:</H2>
+[%
+  FOREACH child = sortTokens(children(token));
+    IF isLeaf(child);
+      INCLUDE shortgraph
+        token=child
+        nodename=nodeName(child)
+        comment=nodeParam(child,'comment',1);
+    ELSIF isAlias(child);
+      atoken=isAlias(child);
+      IF isLeaf(atoken);
+        INCLUDE shortgraph
+          token=atoken
+          nodename=nodeName(atoken)
+          comment=path(atoken);
+      END;
+    END;
+  END;
+%]
+
+<DIV CLASS="BottomShortcuts">
+[%
+  IF global.hwpredict;
+    IF variables.NOHW;
+      INCLUDE shortcut url=url(token, view, 'NOHW', '')
+                       text="Enable Holt-Winters"
+                       title="Switch Holt-Winters prediction boundaries";
+    ELSE;
+      INCLUDE shortcut url=url(token, view, 'NOHW', 1)
+                       text="Disable Holt-Winters"
+                       title="Switch Holt-Winters prediction boundaries";
+    END;
+  END
+%]
+
+[% INCLUDE shortcut url=url(token) text="Default view"
+                    title="Restore default subtree view" %]
+</DIV>
+
+[% INCLUDE bottomline %]
+[% INCLUDE htmlend %]
diff --git a/torrus/templates/globalsearch.html b/torrus/templates/globalsearch.html
new file mode 100644 (file)
index 0000000..c01c3d4
--- /dev/null
@@ -0,0 +1,43 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% global.SearchString = variables.SEARCH; clearVar('SEARCH') %]
+[% INCLUDE htmlstart
+     title='Global Search results: ' _ global.SearchString
+     contentClass="SingleColumnContent"
+     noTopMenu=1 %]
+
+<DIV CLASS="TopMenu">
+[% INCLUDE shortcut url=url() text="Top"
+                    title="Choose from the list of trees"%]
+</DIV>
+                    
+<H1>Global Search results: [% global.SearchString %]</H1>
+<DIV CLASS="Listing">
+[% results = searchResults( global.SearchString );
+   counter = 0;
+
+   FOREACH entry = results;
+
+    counter = counter + 1;
+    IF counter % 2 == 0;
+      evenRow = 1;
+    ELSE;
+      evenRow = 0;
+    END;
+
+%]
+  <DIV CLASS="[% evenRow ? 'ListRowEven' : 'ListRow' %]">
+    <SPAN CLASS="NodeName">[%entry.0%]:
+    <A HREF="[%persistentUrl(entry.0, entry.1)%]">
+    [% entry.1 %]</A>
+    </SPAN>
+  </DIV>
+[% END %]
+</DIV>
+
+
+</DIV><!-- Content -->[% global.contentFinished = 1 %]
+<DIV CLASS="BottomMenu">
+[% INCLUDE globalsearchdialog %]
+</DIV>
+
+[% INCLUDE htmlend %]
diff --git a/torrus/templates/html-incblocks.txt b/torrus/templates/html-incblocks.txt
new file mode 100644 (file)
index 0000000..ca5540e
--- /dev/null
@@ -0,0 +1,356 @@
+[%#
+  $Id: html-incblocks.txt,v 1.1 2010-12-27 00:04:03 ivan Exp $
+  All BLOCK statements are defined here
+%]
+
+[%#  ###########    Initialize globals   ################ %]
+[% global.setDateDialog = 0; %]
+
+
+[%#  ###########    Print the starting HTML blahblah   ################ %]
+
+[% BLOCK htmlstart;
+   IF ! contentClass; contentClass="Content"; END %]
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<HTML>
+<!-- Torrus Copyright (c) 2003-2004 Stanislav Sinyagin -->
+<HEAD>
+<SCRIPT language="JavaScript"> 
+<!--
+function helpwindow() 
+{ 
+window.open('[%url(token) _ '&view=helptext-html'%]','helpwindow',
+'width=600,height=400,resizable=yes,left=200,top=100'); 
+} 
+//--> 
+</SCRIPT>
+<TITLE>[% title %]</TITLE>
+<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
+[% IF expires %]<META HTTP-EQUIV="Refresh" CONTENT="[% expires %]"/>[% END %]
+<STYLE type="text/css" media="all">
+  @import url( [% plainURL _ style('stylesheet') %] );
+  [% cssoverlay = style('cssoverlay'); IF cssoverlay; %]
+  @import url( [% cssoverlay %] );
+  [% END %]
+</STYLE>
+</HEAD>
+<BODY>
+
+<DIV CLASS="Header">
+
+<SPAN CLASS="CompanyInfo">
+<A TITLE="company info"
+HREF="[%companyURL%]">[% IF companyLogo %]<IMG SRC="[%companyLogo%]"
+ALT=[%companyName%] STYLE="border:0">[% ELSE; companyName; END %]</A>
+</SPAN>
+
+[% IF siteInfo %]
+<SPAN CLASS="SiteInfo">
+[% siteInfo %]
+</SPAN>
+[% END %]
+
+[% IF treeName and treeInfo %]
+<SPAN CLASS="TreeInfo">
+[% treeInfo %]
+</SPAN>
+[% END %]
+
+[% IF userAuth and uid;
+     commonname = userAttr('cn');
+     IF commonname == ''; commonname = uid; END; %]
+<DIV CLASS="LoginInfo">
+<SPAN CLASS="UserName">[% commonname %]</SPAN>
+<SPAN CLASS="Logout"><A HREF="[% topURL _ '?LOGOUT=1' %]">Logout</A></SPAN>
+</DIV>
+[% END %]
+</DIV>
+<DIV CLASS="CurrentTime">[% timestamp %]</DIV>
+[% IF printpath %]
+  <DIV CLASS="PathMenu">
+    [% INCLUDE treename %]
+    <DIV CLASS="CurrentPath">
+      <SPAN CLASS="PathMenuHeader">Current path:</SPAN>
+      <SPAN CLASS="PathURLs">[% splitUrls(token) %]</SPAN>
+    </DIV>
+  </DIV>
+[% END %]
+[% IF not noTopMenu %]
+<DIV CLASS="TopMenu">
+[% INCLUDE shortcut url=topURL text="Top"
+                    title="Choose from the list of trees"%]
+[% theParent=parent(token);
+   IF theParent and theParent != token;
+     INCLUDE shortcut url=url(theParent) text="Up"
+                    title="Climb up the tree";
+   END %]
+[% INCLUDE helpshortcut %]
+[% IF mayDisplayAdmInfo(token);
+     INCLUDE shortcut url=url(token,'adminfo')
+                      text="AdmInfo"
+                      title="Administrative details"
+                      newwindow=1;
+   END
+%]
+
+</DIV>
+[% END %]
+<DIV CLASS="[%contentClass%]">
+[% global.contentFinished = 0 %]
+[% IF global.printError %]
+<DIV CLASS="ErrorMessage">[% global.printError %]</DIV>
+[% global.printError = '' %]
+[% END %]
+[% END %]
+
+[%#  ###########    Print the legend   ################ %]
+
+[% BLOCK legend %]
+[%   legend = nodeParam(token, 'legend') %]
+[%   IF legend.length > 0 %]
+<DIV CLASS="Legend">
+[%     FOREACH legpairstring = legend.split(';') %]
+[%       SET legpair = legpairstring.split(':') %]
+         <DIV CLASS="LegendRow">
+           <SPAN CLASS="LegendName">[% xmlnorm(legpair.0) %]:</SPAN>
+           <SPAN CLASS="LegendValue">[% xmlnorm(legpair.1) %]</SPAN>
+         </DIV>
+[%     END %]
+</DIV>
+[%   END %]
+[% END %]
+
+[%# ###########    Print the TZ and NOW variables   ################ %]
+
+[% BLOCK variables %]
+[%   IF variables.TZ or variables.NOW %]
+<P CLASS="Variables">
+[%     IF variables.TZ %]
+          <SPAN CLASS="VariableName">Timezone:</SPAN>
+          <SPAN CLASS="VariableValue">[% variables.TZ %].</SPAN>
+[%     END %]
+[%     IF variables.NOW %]
+          <SPAN CLASS="VariableName">Report date:</SPAN>
+          <SPAN CLASS="VariableValue">[% variables.NOW %].</SPAN>
+[%     END %]
+</P>
+[%   END %]
+[% END %]
+
+
+[%# ###########    Print the current tree name   ################ %]
+
+[% BLOCK treename %]
+    <DIV CLASS="CurrentTree">
+      <SPAN CLASS="PathMenuHeader">Tree:</SPAN>
+      <SPAN CLASS="TreeName">[% treeName %]</SPAN>
+    </DIV>
+[% END %]
+
+[%# ###########    Print the shortcut   ################ %]
+
+[% BLOCK shortcut %]
+  <SPAN CLASS="Shortcut">
+  [&nbsp;<A TITLE="[%title%]" HREF="[%url%]"
+            [%IF newwindow; 'TARGET="_blank"'; END%]>[%text%]</A>&nbsp;]
+  </SPAN>
+[% END %]
+
+[%# ###########    Print the Help shortcut   ################ %]
+[% BLOCK helpshortcut;
+     IF nodeParam(token, 'help-text', 1);
+       INCLUDE shortcut
+         url="javascript:helpwindow()"
+         text="Help"
+         title="Open a help window for this page";
+     END;
+   END %]
+
+[%# ###########    Print the common bottomline   ################ %]
+
+[% BLOCK bottomline %]
+</DIV><!-- Content -->[% global.contentFinished = 1 %]
+<DIV CLASS="BottomMenu">
+[% INCLUDE shortcut url=persistentUrl(token,view,global.bookmarkVars)
+                    text="Bookmark"
+                    title="Permanent link to this page"%]
+[% INCLUDE shortcut url=url('SS')           text="Tokensets"
+                    title="List of non-empty tokensets"%]
+[% INCLUDE shortcut url=url(token,view,'MEDIA','printer','OVS',ovs)
+                    text="Printable view"
+                    title="Prepare this page for printing"
+                    newwindow=1%]
+[% IF mayDisplayReports();
+     INCLUDE shortcut url=reportsUrl
+                      text="Reports"
+                      title="Show reports page"
+                      newwindow=1;
+   END %]
+[% IF global.setDateDialog; INCLUDE enterdate; END %]
+[% INCLUDE searchdialog %]
+</DIV>
+[% END %]
+
+[%# ###########    Print the Tokensets bottomline   ################ %]
+
+[% BLOCK tsetbottomline %]
+</DIV><!-- Content -->[% global.contentFinished = 1 %]
+<DIV CLASS="BottomMenu">
+[% INCLUDE shortcut url=url(pathToken('/')) text="Datasources tree"
+                    title="Back to the datasources tree" %]
+[% INCLUDE shortcut url=url(token,view,'MEDIA','printer')
+                    text="Printable view"
+                    title="Prepare this page for printing"
+                    newwindow=1%]
+[% INCLUDE helpshortcut %]
+[% INCLUDE searchdialog %]
+</DIV>
+[% END %]
+
+
+[%# ###########    Print the ending HTML blahblah   ################ %]
+
+[% BLOCK htmlend %]
+[% IF ! global.contentFinished %]</DIV><!-- Content -->[% END %]
+<DIV CLASS="Footer">
+  Powered by <A HREF="http://torrus.org">Torrus</A> [% version %]
+</DIV>
+</BODY>
+</HTML>
+[% END %]
+
+[%# ########   Print the RRD graph image   ####### %]
+
+[% BLOCK rrgraph %]
+<DIV CLASS="GraphImage">
+<IMG SRC="[%url(token, view, vars)%]"
+     ALT="[% param(view, 'description') %]">
+</DIV>
+[% END %]
+
+
+[%# ########   Print the short-term RRD graph image   ####### %]
+
+[% BLOCK shortgraph %]
+[%
+  hidden = 0;
+  IF nodeParam(token,'hidden') == 'yes';
+    hidden = 1;
+  END;
+  IF not hidden or variables.SHOWHIDDEN
+%]
+<DIV CLASS="ShortGraph">
+      [% IF not urltoken; urltoken = token; END %]
+      [% hidden ? '<SPAN CLASS="ShowHidden">':'' %]
+      <DIV CLASS="NodeName">
+        <A HREF="[%url(urltoken,urlview)%]">[% nodename %]</A>
+      </DIV>
+      [%IF comment%]<DIV CLASS="NodeDescr">[%xmlnorm(comment)%]</DIV>[%END%]
+      [% hidden ? '</SPAN>':'' %]
+      
+      [%
+        shortView = nodeParam(token,'rrgraph-views').split(',').0;
+        shortvars = [];
+        IF nodeParam(token, 'rrd-hwpredict') == 'enabled' and
+           param(view, 'rrd-hwpredict') != 'disabled';
+          global.hwpredict = 1;
+          IF variables.NOHW;
+            shortvars = ['NOHW', 1];
+          ELSE;
+            shortvars = ['NOHW', ''];          
+          END;
+        END
+      %]
+      <DIV CLASS="GraphImage">
+      <A HREF="[%url(urltoken,urlview)%]">
+      <IMG SRC="[%url(token, shortView, shortvars)%]"
+           ALT="[% param(shortView, 'description') %]">
+      </A>
+      </DIV>
+</DIV>
+  [% END %]
+[% END %]
+
+
+[%# ########   Print the overview shortcuts   ####### %]
+[% BLOCK overviewShortcuts %]
+[%
+  IF nodeParam(token, 'has-overview-shortcuts', 1) == 'yes';
+    FOREACH ovs = nodeParam(token,'overview-shortcuts').split('\s*,\s*');
+     p1 = 'overview-shortcut-text-' _ ovs;
+     p2 = 'overview-shortcut-title-' _ ovs;
+     INCLUDE shortcut
+        url=url(token, 'overview-subleaves-html', 'OVS', ovs)
+        text=nodeParam(token, p1, 1)
+        title=nodeParam(token, p2, 1);
+    END;
+  END %]
+[% END %]
+
+
+[%# ########   Set the date variable   ####### %]
+[% BLOCK setdate %]
+[% IF variables.SETDATE == 1;
+     thedate = verifyDate( variables.SETDATEV );
+     IF thedate.length == 0;
+         global.printError = 'Incorrect date format';
+         clearVar('SETDATE');
+     ELSE;
+         variables.NOW = thedate;
+     END;
+   ELSE;
+     clearVar('NOW');
+     clearVar('SETDATE');
+     clearVar('SETDATEV');
+   END;
+   global.setDateDialog = 1;
+%]
+[% END %]
+
+
+[%# ########   Print the date selection elements   ####### %]
+[% BLOCK enterdate %]
+<SPAN CLASS="SetDateDialog">
+<FORM METHOD=GET ACTION="[%topUrl()%]">
+<INPUT TYPE="hidden" NAME="token" VALUE="[%token%]"/>
+<INPUT TYPE="hidden" NAME="view" VALUE="[%view%]"/>
+[% IF ovs %]<INPUT TYPE="hidden" NAME="OVS" VALUE="[%ovs%]"/>[% END %]
+<LABEL>
+<INPUT TYPE="checkbox" NAME="SETDATE" VALUE="1"
+[%variables.SETDATE ? 'CHECKED':''%]/>
+Set date</LABEL>
+<INPUT TYPE="text" NAME="SETDATEV" SIZE="22" VALUE="[%variables.SETDATEV%]"/>
+<INPUT TYPE="submit" VALUE="&gt;"/>
+</FORM>
+</SPAN>
+[% END %]
+
+
+[%# ########   Print the searchform HTML   ####### %]
+[% BLOCK searchdialog %]
+[% IF searchEnabled %]
+<SPAN CLASS="SearchDialog">
+<FORM METHOD=GET ACTION="[%topUrl()%]">
+<INPUT TYPE="hidden" NAME="token" VALUE="[%pathToken('/')%]"/>
+<INPUT TYPE="hidden" NAME="view" VALUE="search"/>
+<LABEL>Search</LABEL>
+<INPUT TYPE="text" NAME="SEARCH" SIZE="22" VALUE=""/>
+<INPUT TYPE="submit" VALUE="&gt;"/>
+</FORM>
+</SPAN>
+[% END %]
+[% END %]
+
+[%# ########   Print the Global searchform HTML   ####### %]
+[% BLOCK globalsearchdialog %]
+[% IF mayGlobalSearch() %]
+<SPAN CLASS="SearchDialog">
+<FORM METHOD=GET ACTION="[%topUrl()%]">
+<LABEL>Search</LABEL>
+<INPUT TYPE="text" NAME="SEARCH" SIZE="22" VALUE=""/>
+<INPUT TYPE="submit" VALUE="&gt;"/>
+</FORM>
+</SPAN>
+[% END %]
+[% END %]
diff --git a/torrus/templates/overview-subleaves.html b/torrus/templates/overview-subleaves.html
new file mode 100644 (file)
index 0000000..345e06f
--- /dev/null
@@ -0,0 +1,47 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% INCLUDE setdate %]
+[% ovs=variables.OVS; clearVar('OVS'); global.bookmarkVars=['OVS',ovs];
+   thepath=path(token) %]
+[% INCLUDE htmlstart title=thepath printpath=1 %]
+
+<H1>[% p = 'overview-page-title-' _ ovs; nodeParam(token, p, 1) %]</H1>
+
+[% INCLUDE variables %]
+
+[% INCLUDE legend %]
+
+[%
+  FOREACH child = sortTokens(children(token));
+    childpath = path(child);
+    p = 'overview-subleave-name-' _ ovs;
+    FOREACH childname = nodeParam(token, p,1).split('\s*,\s*');
+      ovwpath = childpath _ childname;
+      IF nodeExists(ovwpath);
+        ovwtoken = pathToken(ovwpath);
+
+        urltoken = ovwtoken;
+        p = 'overview-direct-link-' _ ovs;
+        IF nodeParam(token, p, 1) == 'yes';
+          urltoken = child;
+          p = 'overview-direct-link-view-' _ ovs;
+          urlview = nodeParam(token, p, 1);
+        END;
+
+        INCLUDE shortgraph
+          token=ovwtoken
+          urltoken=urltoken
+          urlview=urlview
+          nodename=nodeName(child)
+          comment=nodeParam(child,'comment',1);
+      END;
+    END;
+  END
+%]
+
+<DIV CLASS="BottomShortcuts">
+[% INCLUDE shortcut url=url(token) text="Default view"
+                    title="Restore default subtree view" %]
+</DIV>
+
+[% INCLUDE bottomline %]
+[% INCLUDE htmlend %]
diff --git a/torrus/templates/report-index.html b/torrus/templates/report-index.html
new file mode 100644 (file)
index 0000000..7bc41a6
--- /dev/null
@@ -0,0 +1,29 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% INCLUDE htmlstart
+     title="Torrus Reports"
+     contentClass="SingleColumnContent"
+     noTopMenu=1 %]
+
+<H1>Torrus reports</H1>
+
+[% INCLUDE treename %]
+
+<TABLE CLASS="ReportTable">
+<CAPTION CLASS="ReportTable"></CAPTION>
+<TR CLASS="ReportHeadrow">
+<TD CLASS="ReportHeadCell">Year</TD>
+</TR>
+[% rowCount = 0;
+   FOREACH yr = data.keys.sort;
+     rowCount = rowCount + 1;
+     IF rowCount % 2  %]
+<TR CLASS="ReportEvenRow">
+[%   ELSE %]
+<TR CLASS="ReportRow">
+[%   END %]          
+<TD CLASS="ReportFirstCell"><A HREF="[% yearlyUrl(yr) %]">[% yr %]</A></TD>
+</TR>
+[% END %]
+</TABLE>
+
+[% INCLUDE htmlend %]
diff --git a/torrus/templates/report-monthly.html b/torrus/templates/report-monthly.html
new file mode 100644 (file)
index 0000000..c302f93
--- /dev/null
@@ -0,0 +1,132 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% INCLUDE htmlstart
+     title="Torrus Reports: " _ year
+     contentClass="SingleColumnContent"
+     noTopMenu=1 %]
+
+<H1>Torrus report: [% monthName(month) %]
+<A HREF="[% yearlyUrl(year) %]">[% year %]</A></H1>
+
+[% INCLUDE treename %]
+
+[% FOREACH reportname = data.keys.sort;
+     fieldshash = data.$reportname;
+     IF reportname == 'MonthlyUsage' %]
+
+<TABLE CLASS="ReportTable">
+<CAPTION CLASS="ReportTable">Monthly usage</CAPTION>
+<TR CLASS="ReportHeadRow">
+<TD CLASS="ReportHeadCell">Service ID</TD>
+<TD CLASS="ReportHeadCell">Average</TD>
+<TD CLASS="ReportHeadCell">95th<BR/>Percentile</TD>
+<TD CLASS="ReportHeadCell">Maximum</TD>
+<TD CLASS="ReportHeadCell">Unavailable<BR/>samples</TD>
+<TD CLASS="ReportHeadCell">Volume</TD>
+</TR>
+[%     rowCount = 0;
+       FOREACH serviceid = fieldshash.keys.sort;
+         rowCount = rowCount + 1;
+         IF rowCount % 2 %]
+<TR CLASS="ReportEvenRow">
+[%       ELSE %]
+<TR CLASS="ReportRow">
+[%       END %]       
+<TD CLASS="ReportFirstCell">
+<A HREF="[% srvIdUrl(serviceid) %]">[% serviceid %]</A>
+</TD>
+[%       FOREACH varname = ['AVG', '95TH_PERCENTILE', 'MAX',
+                            'UNAVAIL', 'VOLUME'] %]
+<TD CLASS="ReportCell">
+[% formatValue( fieldshash.$serviceid.$varname ) %]
+</TD>
+[%       END %]
+</TR>
+[%     END %]
+</TABLE>
+
+[% ELSE %]
+
+<TABLE CLASS="ReportTable">
+<CAPTION CLASS="ReportTable">[% reportname %]</CAPTION>
+<TR CLASS="ReportHeadRow">
+<TD CLASS="ReportHeadCell">Service ID</TD>
+<TD CLASS="ReportHeadCell">Field</TD>
+<TD CLASS="ReportHeadCell">Value</TD>
+</TR>
+[%     rowCount = 0;
+       FOREACH serviceid = fieldshash.keys.sort;
+         FOREACH varname = fieldshash.$serviceid.keys.sort;
+           rowCount = rowCount + 1;
+           IF rowCount % 2 %]
+<TR CLASS="ReportEvenRow">
+[%         ELSE %]
+<TR CLASS="ReportRow">
+[%         END %]       
+<TD CLASS="ReportFirstCell">
+<A HREF="[% srvIdUrl(serviceid) %]">[% serviceid %]</A>
+</TD>
+<TD CLASS="ReportCell">
+[% varname %]
+</TD>
+<TD CLASS="ReportCell">
+[% formatValue( fieldshash.$serviceid.$varname ) %]
+</TD>
+</TR>
+[%       END;
+       END %]
+</TABLE>
+
+[%   END;
+   END %]
+
+<DIV CLASS="ReportLegend">
+
+<DIV CLASS="ReportLegendLine">
+<SPAN CLASS="ReportLegendTerm">
+Average:
+</SPAN>
+<SPAN CLASS="ReportLegendDef">
+the monthly average of 5-minute samples.
+</SPAN>
+</DIV>
+
+<DIV CLASS="ReportLegendLine">
+<SPAN CLASS="ReportLegendTerm">
+95th percentile:
+</SPAN>
+<SPAN CLASS="ReportLegendDef">
+95% of the time, the usage is at or below this amount.
+</SPAN>
+</DIV>
+
+<DIV CLASS="ReportLegendLine">
+<SPAN CLASS="ReportLegendTerm">
+Maximum:
+</SPAN>
+<SPAN CLASS="ReportLegendDef">
+the maximum value among 5-minute samples.
+</SPAN>
+</DIV>
+
+<DIV CLASS="ReportLegendLine">
+<SPAN CLASS="ReportLegendTerm">
+Unavailable samples:
+</SPAN>
+<SPAN CLASS="ReportLegendDef">
+how many 5-minute samples were missed from the measurements.
+</SPAN>
+</DIV>
+
+<DIV CLASS="ReportLegendLine">
+<SPAN CLASS="ReportLegendTerm">
+Volume:
+</SPAN>
+<SPAN CLASS="ReportLegendDef">
+for traffic usage, this is the absolut volume of data in avaiable 5-minute
+samples.
+</SPAN>
+</DIV>
+
+</DIV>
+
+[% INCLUDE htmlend %]
diff --git a/torrus/templates/report-serviceid.html b/torrus/templates/report-serviceid.html
new file mode 100644 (file)
index 0000000..bd392ca
--- /dev/null
@@ -0,0 +1,147 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% INCLUDE htmlstart
+     title="Torrus Reports: " _ year
+     contentClass="SingleColumnContent"
+     noTopMenu=1 %]
+
+<H1>Torrus report: <A HREF="[% yearlyUrl(year) %]">[% year %]</A>,
+[% serviceid %]</H1>
+
+[% INCLUDE treename %]
+
+[% FOREACH reportname = data.keys.sort;
+     fieldshash = data.$reportname;
+     IF reportname == 'MonthlyUsage' %]
+
+<TABLE CLASS="ReportTable">
+<CAPTION CLASS="ReportTable">Monthly usage</CAPTION>
+<TR CLASS="ReportHeadRow">
+<TD CLASS="ReportHeadCell">Month</TD>
+<TD CLASS="ReportHeadCell">Average</TD>
+<TD CLASS="ReportHeadCell">95th<BR/>Percentile</TD>
+<TD CLASS="ReportHeadCell">Maximum</TD>
+<TD CLASS="ReportHeadCell">Unavailable<BR/>samples</TD>
+<TD CLASS="ReportHeadCell">Volume</TD>
+<TD CLASS="ReportHeadCell">Extrapolated<BR/>volume</TD>
+</TR>
+[%     rowCount = 0;
+       FOREACH mth = fieldshash.keys.sort;
+         rowCount = rowCount + 1;
+         IF rowCount % 2 %]
+<TR CLASS="ReportEvenRow">
+[%       ELSE %]
+<TR CLASS="ReportRow">
+[%       END %]       
+<TD CLASS="ReportFirstCell">
+<A HREF="[% monthlyUrl(mth) %]">[% monthName(mth) %]</A>
+</TD>
+[%       FOREACH varname = ['AVG', '95TH_PERCENTILE', 'MAX',
+                            'UNAVAIL', 'VOLUME'] %]
+<TD CLASS="ReportCell">
+[% formatValue( fieldshash.$mth.$varname ) %]
+</TD>
+[%       END %]
+<TD CLASS="ReportCell">
+[% extr.value = fieldshash.$mth.VOLUME.value * 100 /
+                 ( 100 - fieldshash.$mth.UNAVAIL.value );
+   extr.units = fieldshash.$mth.VOLUME.units;
+   formatValue( extr ) %]
+</TD>
+</TR>
+[%     END %]
+</TABLE>
+
+[% ELSE %]
+
+<TABLE CLASS="ReportTable">
+<CAPTION CLASS="ReportTable">[% reportname %]</CAPTION>
+<TR CLASS="ReportHeadRow">
+<TD CLASS="ReportHeadCell">Month</TD>
+<TD CLASS="ReportHeadCell">Field</TD>
+<TD CLASS="ReportHeadCell">Value</TD>
+</TR>
+[%     rowCount = 0;
+       FOREACH mth = fieldshash.keys.sort;
+         FOREACH varname = fieldshash.$mth.keys.sort;
+           rowCount = rowCount + 1;
+           IF rowCount % 2 %]
+<TR CLASS="ReportEvenRow">
+[%         ELSE %]
+<TR CLASS="ReportRow">
+[%         END %]       
+<TD CLASS="ReportFirstCell">
+<A HREF="[% monthlyUrl(mth) %]">[% monthName(mth) %]</A>
+</TD>
+<TD CLASS="ReportCell">
+[% varname %]
+</TD>
+<TD CLASS="ReportCell">
+[% formatValue( fieldshash.$mth.$varname ) %]
+</TD>
+</TR>
+[%       END;
+       END %]
+</TABLE>
+[%   END;
+   END %]
+
+<DIV CLASS="ReportLegend">
+
+<DIV CLASS="ReportLegendLine">
+<SPAN CLASS="ReportLegendTerm">
+Average:
+</SPAN>
+<SPAN CLASS="ReportLegendDef">
+the monthly average of 5-minute samples.
+</SPAN>
+</DIV>
+
+<DIV CLASS="ReportLegendLine">
+<SPAN CLASS="ReportLegendTerm">
+95th percentile:
+</SPAN>
+<SPAN CLASS="ReportLegendDef">
+95% of the time, the usage is at or below this amount.
+</SPAN>
+</DIV>
+
+<DIV CLASS="ReportLegendLine">
+<SPAN CLASS="ReportLegendTerm">
+Maximum:
+</SPAN>
+<SPAN CLASS="ReportLegendDef">
+the maximum value among 5-minute samples.
+</SPAN>
+</DIV>
+
+<DIV CLASS="ReportLegendLine">
+<SPAN CLASS="ReportLegendTerm">
+Unavailable samples:
+</SPAN>
+<SPAN CLASS="ReportLegendDef">
+how many 5-minute samples were missed from the measurements.
+</SPAN>
+</DIV>
+
+<DIV CLASS="ReportLegendLine">
+<SPAN CLASS="ReportLegendTerm">
+Volume:
+</SPAN>
+<SPAN CLASS="ReportLegendDef">
+for traffic usage, this is the absolut volume of data in avaiable 5-minute
+samples.
+</SPAN>
+</DIV>
+
+<DIV CLASS="ReportLegendLine">
+<SPAN CLASS="ReportLegendTerm">
+Extrapolated volume:
+</SPAN>
+<SPAN CLASS="ReportLegendDef">
+for traffic usage, this is the volume of data extrapolated to the whole
+time range.
+</SPAN>
+</DIV>
+</DIV>
+
+[% INCLUDE htmlend %]
diff --git a/torrus/templates/report-yearly.html b/torrus/templates/report-yearly.html
new file mode 100644 (file)
index 0000000..6f9078d
--- /dev/null
@@ -0,0 +1,31 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% INCLUDE htmlstart
+     title="Torrus Reports: " _ year
+     contentClass="SingleColumnContent"
+     noTopMenu=1 %]
+
+<H1><A HREF="[% indexUrl() %]">Torrus reports</A>: [% year %]</H1>
+
+[% INCLUDE treename %]
+
+<TABLE CLASS="ReportTable">
+<CAPTION CLASS="ReportTable">Monthly reports</CAPTION>
+<TR CLASS="ReportHeadRow">
+<TD CLASS="ReportHeadCell">Month</TD>
+</TR>
+[% rowCount = 0;
+   FOREACH mth = data.months;
+     rowCount = rowCount + 1;
+     IF rowCount % 2  %]
+<TR CLASS="ReportEvenRow">
+[%   ELSE %]
+<TR CLASS="ReportRow">
+[%   END %]       
+<TD CLASS="ReportFirstCell">
+<A HREF="[% monthlyUrl(mth) %]">[% monthName(mth) _ ' ' _ year %]</A>
+</TD>
+</TR>
+[% END %]
+</TABLE>
+
+[% INCLUDE htmlend %]
diff --git a/torrus/templates/search.html b/torrus/templates/search.html
new file mode 100644 (file)
index 0000000..b5ce585
--- /dev/null
@@ -0,0 +1,43 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% global.SearchString = variables.SEARCH; clearVar('SEARCH') %]
+[% INCLUDE htmlstart
+     title='Search results: ' _ global.SearchString
+     contentClass="SingleColumnContent" %]
+
+<H1>Search results: [% global.SearchString %]</H1>
+[% INCLUDE treename %]
+<DIV CLASS="Listing">
+[% results = searchResults(global.SearchString);
+   counter = 0;
+
+   FOREACH entry = results;
+
+    counter = counter + 1;
+    IF counter % 2 == 0;
+      evenRow = 1;
+    ELSE;
+      evenRow = 0;
+    END;
+
+    etoken = pathToken(entry.0);
+%]
+  <DIV CLASS="[% evenRow ? 'ListRowEven' : 'ListRow' %]">
+    <SPAN CLASS="NodeName"><A HREF="[%persistentUrl(etoken)%]">
+    [% entry.0 %]</A></SPAN>
+    <SPAN CLASS="NodeDescr">
+    [% IF entry.1; entry.1 _ ': ' _ xmlnorm(nodeParam(etoken, entry.1));
+    END %]
+    </SPAN>
+  </DIV>
+[% END %]
+</DIV>
+
+
+</DIV><!-- Content -->[% global.contentFinished = 1 %]
+<DIV CLASS="BottomMenu">
+[% INCLUDE shortcut url=url(pathToken('/')) text="Datasources tree"
+                    title="Back to the datasources tree" %]
+[% INCLUDE searchdialog %]
+</DIV>
+
+[% INCLUDE htmlend %]
diff --git a/torrus/templates/tset-list.html b/torrus/templates/tset-list.html
new file mode 100644 (file)
index 0000000..a378578
--- /dev/null
@@ -0,0 +1,38 @@
+[% PROCESS 'html-incblocks.txt' %]
+[% INCLUDE htmlstart
+     title="Non-empty tokensets"
+     contentClass="SingleColumnContent" %]
+
+<H1>Non-empty tokensets</H1>
+
+[% INCLUDE treename %]
+
+<DIV CLASS="Listing">
+[%   counter = 0;
+     evenRow = 0;
+
+     FOREACH tset = tsetList();
+       sz = tsetMembers(tset).size;
+
+       IF sz.length > 0 AND sz > 0;
+       
+         counter = counter + 1;
+
+         IF counter % 2 == 0;
+           evenRow = 1;
+         ELSE;
+           evenRow = 0;
+         END;
+%]
+  <DIV CLASS="[% evenRow ? 'ListRowEven' : 'ListRow' %]">
+    <SPAN CLASS="TokensetDescr">
+      <A HREF="[%url(tset)%]">[% xmlnorm(param(tset, 'comment')) %]</A>
+      ([% sz %])
+    </SPAN>
+  </DIV>
+       [% END %]
+     [% END %]
+</DIV>
+
+[% INCLUDE tsetbottomline %]
+[% INCLUDE htmlend %]
diff --git a/torrus/xmlconfig/Makefile.am b/torrus/xmlconfig/Makefile.am
new file mode 100644 (file)
index 0000000..4db5359
--- /dev/null
@@ -0,0 +1,109 @@
+
+#  Copyright (C) 2002-2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.am,v 1.1 2010-12-27 00:04:05 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+EXTRA_DIST = \
+       site-global.xml
+
+xmldir         = $(distxmldir)
+dist_xml_DATA  = defaults.xml snmp-defs.xml cdef-collector-defs.xml
+
+vendordir      = $(distxmldir)/vendor
+dist_vendor_DATA = \
+       vendor/alteon.xml \
+       vendor/alu-timetra.xml \
+       vendor/apc.ups.xml  \
+       vendor/apple.ae.xml \
+       vendor/arbor_e.xml \
+       vendor/ascend.max.xml \
+       vendor/atmel.xml \
+       vendor/betternetworks.xml \
+       vendor/casa-cmts.xml \
+       vendor/cisco.firewall.xml \
+       vendor/cisco.generic.xml \
+       vendor/cisco.ios.xml \
+       vendor/cisco.ios.docsis.xml \
+       vendor/cisco.ios.mac-accounting.xml \
+       vendor/cisco.sce.xml \
+       vendor/cisco.vdsl-line.xml \
+       vendor/compaq.cim.xml \
+       vendor/empire.systemedge.xml \
+       vendor/empire.systemedge.ntregperf.xml \
+       vendor/f5.bigip.xml \
+       vendor/foundry.xml \
+       vendor/ftos.xml \
+       vendor/jacarta.xml \
+       vendor/junos.xml \
+       vendor/hp.hpux.xml \
+       vendor/liebert.xml \
+       vendor/microsoft.windows.xml \
+       vendor/motorola.bsr.xml \
+       vendor/netapp.filer.xml \
+       vendor/netbotz.xml \
+       vendor/netscreen.xml \
+       vendor/paradyne.xdsl.xml \
+       vendor/symmetricom.xml \
+       vendor/ucd.ucd-snmp.xml
+
+genericdir    =  $(distxmldir)/generic
+dist_generic_DATA = \
+       generic/collector-periods.xml \
+       generic/monitors.xml \
+       generic/rfc1628.ups.xml \
+       generic/rfc1697.rdbms.xml \
+       generic/rfc2662.adsl-line.xml \
+       generic/rfc2670.docsis-if.xml \
+       generic/rfc2790.host-resources.xml \
+       generic/rfc2863.if-mib.xml
+
+examplesdir   =  $(distxmldir)/examples
+dist_examples_DATA = \
+       examples/apc-ups.xml \
+       examples/ascend.max.xml \
+       examples/docsis-monitors.xml \
+       examples/generic-netsnmp.xml \
+       examples/hpux.xml \
+       examples/monitors.xml \
+       examples/multigraph.xml \
+       examples/rainbow-schema.xml \
+       examples/servers.data \
+       examples/servers.tmpl
+
+olddir        =  $(distxmldir)/old
+dist_old_DATA = \
+       old/cisco.generic.old-0.1.4.xml \
+       old/cisco.ios.mac-accounting-0.1.8.xml \
+       old/cisco-mac-accounting-example.xml \
+       old/rfc1213.xml \
+       old/rfc2670.docsis-if.old.0.1.5d-20040224.xml \
+       old/rfc2670.docsis-if.old.1.0.4.xml \
+       old/rfc2863.if-mib.old-0.1.4.xml \
+       old/rfc2863.if-mib.old-0.1.7.xml \
+       old/snmp-defs.old-0.1.2.xml
+
+
+install-data-local:
+       $(mkinstalldirs) $(DESTDIR)$(sitexmldir)
+       if test ! -r $(DESTDIR)$(sitexmldir)/site-global.xml; then \
+         $(INSTALL_DATA) site-global.xml \
+               $(DESTDIR)$(sitexmldir)/site-global.xml; \
+       fi
+
+
diff --git a/torrus/xmlconfig/Makefile.in b/torrus/xmlconfig/Makefile.in
new file mode 100644 (file)
index 0000000..56463bc
--- /dev/null
@@ -0,0 +1,539 @@
+# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005  Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+#  Copyright (C) 2002-2010  Stanislav Sinyagin
+#
+#  This program is free software; you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+# $Id: Makefile.in,v 1.1 2010-12-27 00:04:05 ivan Exp $
+# Stanislav Sinyagin <ssinyagin@yahoo.com>
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = xmlconfig
+DIST_COMMON = $(dist_examples_DATA) $(dist_generic_DATA) \
+       $(dist_old_DATA) $(dist_vendor_DATA) $(dist_xml_DATA) \
+       $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(examplesdir)" "$(DESTDIR)$(genericdir)" \
+       "$(DESTDIR)$(olddir)" "$(DESTDIR)$(vendordir)" \
+       "$(DESTDIR)$(xmldir)"
+dist_examplesDATA_INSTALL = $(INSTALL_DATA)
+dist_genericDATA_INSTALL = $(INSTALL_DATA)
+dist_oldDATA_INSTALL = $(INSTALL_DATA)
+dist_vendorDATA_INSTALL = $(INSTALL_DATA)
+dist_xmlDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_examples_DATA) $(dist_generic_DATA) $(dist_old_DATA) \
+       $(dist_vendor_DATA) $(dist_xml_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+FIND = @FIND@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KILL = @KILL@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PERLINC = @PERLINC@
+POD2MAN = @POD2MAN@
+POD2MAN_PRESENT_FALSE = @POD2MAN_PRESENT_FALSE@
+POD2MAN_PRESENT_TRUE = @POD2MAN_PRESENT_TRUE@
+POD2TEXT = @POD2TEXT@
+POD2TEXT_PRESENT_FALSE = @POD2TEXT_PRESENT_FALSE@
+POD2TEXT_PRESENT_TRUE = @POD2TEXT_PRESENT_TRUE@
+RM = @RM@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SLEEP = @SLEEP@
+STRIP = @STRIP@
+SU = @SU@
+VERSION = @VERSION@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+cachedir = @cachedir@
+cfgdefdir = @cfgdefdir@
+datadir = @datadir@
+dbhome = @dbhome@
+defrrddir = @defrrddir@
+distxmldir = @distxmldir@
+enable_pkgonly = @enable_pkgonly@
+enable_varperm = @enable_varperm@
+exec_prefix = @exec_prefix@
+exmpdir = @exmpdir@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+logdir = @logdir@
+mandir = @mandir@
+mansec_misc = @mansec_misc@
+mansec_usercmd = @mansec_usercmd@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+perlithreads = @perlithreads@
+perllibdir = @perllibdir@
+perllibdirs = @perllibdirs@
+piddir = @piddir@
+pkgbindir = @pkgbindir@
+pkgdocdir = @pkgdocdir@
+pkghome = @pkghome@
+plugdevdisccfgdir = @plugdevdisccfgdir@
+pluginsdir = @pluginsdir@
+plugtorruscfgdir = @plugtorruscfgdir@
+plugwrapperdir = @plugwrapperdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+reportsdir = @reportsdir@
+sbindir = @sbindir@
+scriptsdir = @scriptsdir@
+seslockdir = @seslockdir@
+sesstordir = @sesstordir@
+sharedstatedir = @sharedstatedir@
+siteconfdir = @siteconfdir@
+sitedir = @sitedir@
+sitexmldir = @sitexmldir@
+supdir = @supdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+tmpldir = @tmpldir@
+tmpluserdir = @tmpluserdir@
+torrus_user = @torrus_user@
+var_group = @var_group@
+var_mode = @var_mode@
+var_user = @var_user@
+varprefix = @varprefix@
+webplaindir = @webplaindir@
+webscriptsdir = @webscriptsdir@
+wrapperdir = @wrapperdir@
+EXTRA_DIST = \
+       site-global.xml
+
+xmldir = $(distxmldir)
+dist_xml_DATA = defaults.xml snmp-defs.xml cdef-collector-defs.xml
+vendordir = $(distxmldir)/vendor
+dist_vendor_DATA = \
+       vendor/alteon.xml \
+       vendor/alu-timetra.xml \
+       vendor/apc.ups.xml  \
+       vendor/apple.ae.xml \
+       vendor/arbor_e.xml \
+       vendor/ascend.max.xml \
+       vendor/atmel.xml \
+       vendor/betternetworks.xml \
+       vendor/casa-cmts.xml \
+       vendor/cisco.firewall.xml \
+       vendor/cisco.generic.xml \
+       vendor/cisco.ios.xml \
+       vendor/cisco.ios.docsis.xml \
+       vendor/cisco.ios.mac-accounting.xml \
+       vendor/cisco.sce.xml \
+       vendor/cisco.vdsl-line.xml \
+       vendor/compaq.cim.xml \
+       vendor/empire.systemedge.xml \
+       vendor/empire.systemedge.ntregperf.xml \
+       vendor/f5.bigip.xml \
+       vendor/foundry.xml \
+       vendor/ftos.xml \
+       vendor/jacarta.xml \
+       vendor/junos.xml \
+       vendor/hp.hpux.xml \
+       vendor/liebert.xml \
+       vendor/microsoft.windows.xml \
+       vendor/motorola.bsr.xml \
+       vendor/netapp.filer.xml \
+       vendor/netbotz.xml \
+       vendor/netscreen.xml \
+       vendor/paradyne.xdsl.xml \
+       vendor/symmetricom.xml \
+       vendor/ucd.ucd-snmp.xml
+
+genericdir = $(distxmldir)/generic
+dist_generic_DATA = \
+       generic/collector-periods.xml \
+       generic/monitors.xml \
+       generic/rfc1628.ups.xml \
+       generic/rfc1697.rdbms.xml \
+       generic/rfc2662.adsl-line.xml \
+       generic/rfc2670.docsis-if.xml \
+       generic/rfc2790.host-resources.xml \
+       generic/rfc2863.if-mib.xml
+
+examplesdir = $(distxmldir)/examples
+dist_examples_DATA = \
+       examples/apc-ups.xml \
+       examples/ascend.max.xml \
+       examples/docsis-monitors.xml \
+       examples/generic-netsnmp.xml \
+       examples/hpux.xml \
+       examples/monitors.xml \
+       examples/multigraph.xml \
+       examples/rainbow-schema.xml \
+       examples/servers.data \
+       examples/servers.tmpl
+
+olddir = $(distxmldir)/old
+dist_old_DATA = \
+       old/cisco.generic.old-0.1.4.xml \
+       old/cisco.ios.mac-accounting-0.1.8.xml \
+       old/cisco-mac-accounting-example.xml \
+       old/rfc1213.xml \
+       old/rfc2670.docsis-if.old.0.1.5d-20040224.xml \
+       old/rfc2670.docsis-if.old.1.0.4.xml \
+       old/rfc2863.if-mib.old-0.1.4.xml \
+       old/rfc2863.if-mib.old-0.1.7.xml \
+       old/snmp-defs.old-0.1.2.xml
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+               && exit 0; \
+             exit 1;; \
+         esac; \
+       done; \
+       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  xmlconfig/Makefile'; \
+       cd $(top_srcdir) && \
+         $(AUTOMAKE) --gnu  xmlconfig/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+       @case '$?' in \
+         *config.status*) \
+           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+         *) \
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+       esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+uninstall-info-am:
+install-dist_examplesDATA: $(dist_examples_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(examplesdir)" || $(mkdir_p) "$(DESTDIR)$(examplesdir)"
+       @list='$(dist_examples_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_examplesDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(examplesdir)/$$f'"; \
+         $(dist_examplesDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(examplesdir)/$$f"; \
+       done
+
+uninstall-dist_examplesDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_examples_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(examplesdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(examplesdir)/$$f"; \
+       done
+install-dist_genericDATA: $(dist_generic_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(genericdir)" || $(mkdir_p) "$(DESTDIR)$(genericdir)"
+       @list='$(dist_generic_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_genericDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(genericdir)/$$f'"; \
+         $(dist_genericDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(genericdir)/$$f"; \
+       done
+
+uninstall-dist_genericDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_generic_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(genericdir)/$$f'"; \
+         rm -f "$(DESTDIR)$(genericdir)/$$f"; \
+       done
+install-dist_oldDATA: $(dist_old_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(olddir)" || $(mkdir_p) "$(DESTDIR)$(olddir)"
+       @list='$(dist_old_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_oldDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(olddir)/$$f'"; \
+         $(dist_oldDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(olddir)/$$f"; \
+       done
+
+uninstall-dist_oldDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_old_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(olddir)/$$f'"; \
+         rm -f "$(DESTDIR)$(olddir)/$$f"; \
+       done
+install-dist_vendorDATA: $(dist_vendor_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(vendordir)" || $(mkdir_p) "$(DESTDIR)$(vendordir)"
+       @list='$(dist_vendor_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_vendorDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(vendordir)/$$f'"; \
+         $(dist_vendorDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(vendordir)/$$f"; \
+       done
+
+uninstall-dist_vendorDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_vendor_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(vendordir)/$$f'"; \
+         rm -f "$(DESTDIR)$(vendordir)/$$f"; \
+       done
+install-dist_xmlDATA: $(dist_xml_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(xmldir)" || $(mkdir_p) "$(DESTDIR)$(xmldir)"
+       @list='$(dist_xml_DATA)'; for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         f=$(am__strip_dir) \
+         echo " $(dist_xmlDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(xmldir)/$$f'"; \
+         $(dist_xmlDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(xmldir)/$$f"; \
+       done
+
+uninstall-dist_xmlDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_xml_DATA)'; for p in $$list; do \
+         f=$(am__strip_dir) \
+         echo " rm -f '$(DESTDIR)$(xmldir)/$$f'"; \
+         rm -f "$(DESTDIR)$(xmldir)/$$f"; \
+       done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+       $(mkdir_p) $(distdir)/examples $(distdir)/generic $(distdir)/old $(distdir)/vendor
+       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+       list='$(DISTFILES)'; for file in $$list; do \
+         case $$file in \
+           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+         esac; \
+         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+           dir="/$$dir"; \
+           $(mkdir_p) "$(distdir)$$dir"; \
+         else \
+           dir=''; \
+         fi; \
+         if test -d $$d/$$file; then \
+           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+           fi; \
+           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+         else \
+           test -f $(distdir)/$$file \
+           || cp -p $$d/$$file $(distdir)/$$file \
+           || exit 1; \
+         fi; \
+       done
+check-am: all-am
+check: check-am
+all-am: Makefile $(DATA)
+installdirs:
+       for dir in "$(DESTDIR)$(examplesdir)" "$(DESTDIR)$(genericdir)" "$(DESTDIR)$(olddir)" "$(DESTDIR)$(vendordir)" "$(DESTDIR)$(xmldir)"; do \
+         test -z "$$dir" || $(mkdir_p) "$$dir"; \
+       done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+         `test -z '$(STRIP)' || \
+           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+       @echo "This command is intended for maintainers to use"
+       @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+       -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local install-dist_examplesDATA \
+       install-dist_genericDATA install-dist_oldDATA \
+       install-dist_vendorDATA install-dist_xmlDATA
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+       -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_examplesDATA uninstall-dist_genericDATA \
+       uninstall-dist_oldDATA uninstall-dist_vendorDATA \
+       uninstall-dist_xmlDATA uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+       distclean-generic distdir dvi dvi-am html html-am info info-am \
+       install install-am install-data install-data-am \
+       install-data-local install-dist_examplesDATA \
+       install-dist_genericDATA install-dist_oldDATA \
+       install-dist_vendorDATA install-dist_xmlDATA install-exec \
+       install-exec-am install-info install-info-am install-man \
+       install-strip installcheck installcheck-am installdirs \
+       maintainer-clean maintainer-clean-generic mostlyclean \
+       mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
+       uninstall-dist_examplesDATA uninstall-dist_genericDATA \
+       uninstall-dist_oldDATA uninstall-dist_vendorDATA \
+       uninstall-dist_xmlDATA uninstall-info-am
+
+
+install-data-local:
+       $(mkinstalldirs) $(DESTDIR)$(sitexmldir)
+       if test ! -r $(DESTDIR)$(sitexmldir)/site-global.xml; then \
+         $(INSTALL_DATA) site-global.xml \
+               $(DESTDIR)$(sitexmldir)/site-global.xml; \
+       fi
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/torrus/xmlconfig/cdef-collector-defs.xml b/torrus/xmlconfig/cdef-collector-defs.xml
new file mode 100644 (file)
index 0000000..fe202b6
--- /dev/null
@@ -0,0 +1,86 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2007 Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: cdef-collector-defs.xml,v 1.1 2010-12-27 00:04:06 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!-- These are the default parameters for CDef collector
+
+  WARNING: This file is overwritten by "make install"
+-->
+
+<configuration>
+
+
+<datasources>
+
+  <template name="cdef-collector-defaults">
+  
+    <param name="ds-type" value="collector" />
+    <param name="collector-type" value="cdef" />
+
+    <param name="cdef-collector-delay" value="0"/>
+    <param name="cdef-collector-tolerance" value="2"/>
+    
+    <!-- Two mandatory parameters define the collector schedule.
+         The collector runs at moments defined by formula:
+           time + period - (time mod period) + timeoffset -->
+    <param name="collector-period" value="300" />
+    <param name="collector-timeoffset" value="10" />
+
+    <param name="storage-type" value="rrd" />
+
+    <param name="system-id" value="cdef-collector" />
+    
+    <!-- RRD Parameters -->
+
+    <!-- Round-robin arrays to be created, separated by space.
+     We keep 5-minute details for 1 month,
+     30-minute average and maximum details for 6 months,
+     and 1-day aggregated stats for 2 years.
+     In 30-minute average one missing sample is allowed.
+     In daily average one hour of missing samples are allowed.
+      -->
+    <param name="rrd-create-rra">
+      RRA:AVERAGE:0:1:10080
+      RRA:AVERAGE:0.17:6:9120      RRA:MAX:0.17:6:9120
+      RRA:AVERAGE:0.042:288:732    RRA:MAX:0.042:288:732
+    </param>
+
+    <!-- if no updates are received for 8 minutes, consider the datasource
+         unknown, i.e. dead -->
+    <param name="rrd-create-heartbeat" value="500"/>
+
+    <param name="rrd-create-min" value="0"/>
+    <param name="rrd-create-max" value="U"/>
+
+    <param name="leaf-type" value="rrd-def" />
+    <param name="rrd-cf"    value="AVERAGE" />
+    <param name="rrd-create-dstype" value="GAUGE" />
+    
+    <!-- Default schedule for the monitor -->
+    <param name="monitor-period"     value="300" />
+    <param name="monitor-timeoffset" value="75" />
+    
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/defaults.xml b/torrus/xmlconfig/defaults.xml
new file mode 100644 (file)
index 0000000..1ffb27b
--- /dev/null
@@ -0,0 +1,309 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002-2007  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: defaults.xml,v 1.1 2010-12-27 00:04:05 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!--
+  These are the default settings for the datasources and  tokensets,
+  and default view definitions.
+
+  WARNING: This file is overwritten by "make install"
+  
+  It is recommended to place all site customizations in site-global.xml,
+  as it would not be overwritten by the installer.
+-->
+
+<configuration>
+
+<param-properties>
+  <!-- Parameters where space is removed from values -->
+  <prop param="action"             prop="remspace" value="1"/>
+  <prop param="display-rpn-expr"   prop="remspace" value="1"/>
+  <prop param="ds-names"           prop="remspace" value="1"/>
+  <prop param="hrules"             prop="remspace" value="1"/>
+  <prop param="launch-when"        prop="remspace" value="1"/>
+  <prop param="monitor"            prop="remspace" value="1"/>
+  <prop param="nodeid"             prop="remspace" value="1"/>
+  <prop param="print-cf"           prop="remspace" value="1"/>
+  <prop param="rpn-expr"           prop="remspace" value="1"/>
+  <prop param="rrgraph-views"      prop="remspace" value="1"/>
+  <prop param="setenv-dataexpr"    prop="remspace" value="1"/>
+  <prop param="setenv-params"      prop="remspace" value="1"/>
+  <prop param="storage-type"       prop="remspace" value="1"/>
+  <prop param="tokenset-member"    prop="remspace" value="1"/>
+  <prop param="value-map"          prop="remspace" value="1"/>
+
+  <!-- Parameters which need to be expanded accorrding
+       to $defs and %paramrefs% -->
+
+  <prop param="collector-scale"       prop="expand" value="1"/>
+  <prop param="collector-timeoffset-hashstring"
+                                      prop="expand" value="1"/>
+  <prop param="collector-instance-hashstring"
+                                      prop="expand" value="1"/>
+  <prop param="comment"               prop="expand" value="1"/>
+  <prop param="data-dir"              prop="expand" value="1"/>
+  <prop param="data-file"             prop="expand" value="1"/>
+  <prop param="descriptive-nickname"  prop="expand" value="1"/>
+  <prop param="graph-legend"          prop="expand" value="1"/>
+  <prop param="graph-title"           prop="expand" value="1"/>
+  <prop param="lower-limit"           prop="expand" value="1"/>
+  <prop param="monitor-vars"          prop="expand" value="1"/>
+  <prop param="nodeid"                prop="expand" value="1"/>
+  <prop param="normal-level"          prop="expand" value="1"/>
+  <prop param="rpn-expr"              prop="expand" value="1"/>
+  <prop param="rrd-create-max"        prop="expand" value="1"/>
+  <prop param="rrd-create-min"        prop="expand" value="1"/>
+  <prop param="rrd-ds"                prop="expand" value="1"/>
+  <prop param="transform-value"       prop="expand" value="1"/>
+  <prop param="upper-limit"           prop="expand" value="1"/>
+
+  <!-- Parameters which are included in search DB -->
+  <prop param="comment"               prop="search" value="1"/>
+  <prop param="legend"                prop="search" value="1"/>
+
+  
+</param-properties>
+
+<datasources>
+
+  <!-- Default views must be defined -->
+  <param name="default-subtree-view" value="default-dir-html" />
+  <param name="default-leaf-view" value="default-rrd-html" />
+  <param name="rrgraph-views">
+    short,last24h,lastweek,lastmonth,lastyear
+  </param>
+
+  <!-- Minimum set of parameters if we use
+       collector-dispersed-timeoffset=yes -->
+  <param name="collector-timeoffset-hashstring" value="%system-id%" />
+  <param name="collector-timeoffset-min" value="0" />
+  <param name="collector-timeoffset-max" value="300" />
+  <param name="collector-timeoffset-step" value="60" />
+
+  <param name="collector-instance-hashstring" value="%system-id%" />
+
+</datasources>
+
+<token-sets>
+
+  <param name="default-tset-view" value="default-tset-html" />
+  <param name="default-tsetlist-view" value="tset-list-html" />
+
+</token-sets>
+
+<views>
+
+  <!-- Defaults being used by other graphs -->
+  <view name="default-rrgraph">
+    <param name="view-type"     value="rrgraph" />
+    <param name="expires"       value="300" />
+    <param name="start"         value="-24h" />
+    <param name="end"           value="now" />
+    <param name="width"         value="500" />
+    <param name="height"        value="250" />
+    <param name="line-style"    value="##SingleGraph" />
+    <param name="line-color"    value="##SingleGraph" />
+    <param name="hw-bndr-style" value="##HWBoundary" />
+    <param name="hw-bndr-color" value="##HWBoundary" />
+    <param name="hw-fail-color" value="##HWFailure" />
+
+    <param name="hrules"            value="min,norm,max"/>
+    <param name="hrule-color-min"   value="##HruleMin"/>
+    <param name="hrule-value-min"   value="lower-limit"/>
+    <param name="hrule-color-norm"  value="##HruleNormal"/>
+    <param name="hrule-value-norm"  value="normal-level"/>
+    <param name="hrule-color-max"   value="##HruleMax"/>
+    <param name="hrule-value-max"   value="upper-limit"/>
+
+    <param name="decorations"       value="busday,evening,night"/>
+
+    # Business day: 8:00 to 17:00
+    <param name="dec-order-busday"     value="-10"/>
+    <param name="dec-expr-busday">
+      LTIME,86400,%,DUP,28800,GE,EXC,61200,LE,*,INF,UNKN,IF
+    </param>
+    <param name="dec-style-busday"     value="##BusinessDay"/>
+    <param name="dec-color-busday"     value="##BusinessDay"/>
+
+    # Evening: 17:00 to 22:00
+    <param name="dec-order-evening"    value="-20"/>
+    <param name="dec-expr-evening">
+      LTIME,86400,%,DUP,61200,GE,EXC,79200,LE,*,INF,UNKN,IF
+    </param>
+    <param name="dec-style-evening"    value="##Evening"/>
+    <param name="dec-color-evening"    value="##Evening"/>
+
+    # Night: 22:00 to 6:00
+    <param name="dec-order-night"    value="-30"/>
+    <param name="dec-expr-night">
+      LTIME,86400,%,DUP,79200,GE,EXC,21600,LE,+,INF,UNKN,IF
+    </param>
+    <param name="dec-style-night"    value="##Night"/>
+    <param name="dec-color-night"    value="##Night"/>
+
+    # GPRINT stuff
+    <param name="gprint-values"         value="current,average,max,min"/>
+    <param name="gprint-header"
+           value="Current    Average    Maximum    Minimum"/>
+
+    <param name="gprint-format-current" value="LAST:%8.2lf%s"/>
+    <param name="gprint-format-average" value="AVERAGE:%8.2lf%s"/>
+    <param name="gprint-format-max"     value="MAX:%8.2lf%s"/>
+    <param name="gprint-format-min"     value="MIN:%8.2lf%s"/>
+    
+    <!-- Last day graph, inherits parameters from the above -->
+    <view name="last24h">
+      <param name="start"         value="-24hours" />
+      <param name="description"   value="Last 24 hours graph" />
+    </view>
+
+    <!-- Last week graph -->
+    <view name="lastweek">
+      <param name="start"         value="-7days" />
+      <param name="description"   value="Last week graph" />
+    </view>
+
+    <!-- Last month graph -->
+    <view name="lastmonth">
+      <param name="start"         value="-1month" />
+      <param name="rrd-hwpredict" value="disabled" />
+      <param name="decorations"   value=""/>
+      <param name="description"   value="Last month graph" />
+    </view>
+
+    <!-- Last year graph -->
+    <view name="lastyear">
+      <param name="start"         value="-1year" />
+      <param name="rrd-hwpredict" value="disabled" />
+      <param name="decorations"   value=""/>
+      <param name="description"   value="Last year graph" />
+    </view>
+
+    <!-- Short overview for multigraph listings -->
+    <view name="short">
+      <param name="width"         value="350" />
+      <param name="height"        value="100" />
+      <param name="start"         value="-6h" />
+      <param name="gprint-values" value="current"/>
+      <param name="gprint-header" value=""/>
+      <param name="gprint-format-current" value="LAST:Current\: %7.2lf%s"/>
+      <param name="description"   value="Last 6 hours graph" />
+      
+      <view name="last24h-small">
+        <param name="start"         value="-24hours" />
+        <param name="description"   value="Last 24 hours graph" />
+      </view>
+    </view>
+  </view>
+
+  <!-- This is the HTML page with RRD graphs on it.
+       Use the specified HTML file as a template with special tags in it -->
+  <view name="default-rrd-html">
+    <param name="view-type"     value="html" />
+    <param name="expires"       value="300" />
+    <param name="html-template" value="default-rrd.html" />
+    <view name="longterm-rrd-html">
+      <param name="longterm" value="1" />
+    </view>
+  </view>
+
+
+  <!-- This is the HTML page for tree browsing -->
+  <view name="default-dir-html">
+    <param name="view-type"     value="html" />
+    <param name="expires"       value="3600" />
+    <param name="html-template" value="default-dir.html" />
+  </view>
+
+  <!-- This shows the leaves of the subtree -->
+  <view name="expanded-dir-html">
+    <param name="view-type"     value="html" />
+    <param name="expires"       value="300" />
+    <param name="html-template" value="expanded-dir.html" />
+  </view>
+
+  <!-- This shows overview subleaves (previousely InOutBps) -->
+  <view name="overview-subleaves-html">
+    <param name="view-type"     value="html" />
+    <param name="expires"       value="300" />
+    <param name="html-template" value="overview-subleaves.html" />
+  </view>
+
+  <!-- This all subtrees and leaves recureively -->
+  <view name="recursive-dir-html">
+    <param name="view-type"     value="html" />
+    <param name="expires"       value="3600" />
+    <param name="html-template" value="default-recursivedir.html" />
+  </view>
+  
+  <view name="rrd-print-daily">
+    <param name="view-type"     value="rrprint" />
+    <param name="expires"       value="300" />
+    <param name="start"         value="-24h" />
+    <param name="end"           value="now" />
+    <param name="print-cf"      value="MIN,AVERAGE,MAX" />
+  </view>
+
+  <view name="rrd-print-last">
+    <param name="view-type"     value="rrprint" />
+    <param name="expires"       value="300" />
+    <param name="start"         value="-1h" />
+    <param name="end"           value="now" />
+    <param name="print-cf"      value="LAST" />
+  </view>
+
+  <!-- This is the HTML page for tokenset browsing -->
+  <view name="default-tset-html">
+    <param name="view-type"     value="html" />
+    <param name="expires"       value="60" />
+    <param name="html-template" value="default-tset.html" />
+  </view>
+
+  <view name="tset-list-html">
+    <param name="view-type"     value="html" />
+    <param name="expires"       value="60" />
+    <param name="html-template" value="tset-list.html" />
+  </view>
+
+  <!-- This is the HTML page for displaying the help message -->
+  <view name="helptext-html">
+    <param name="view-type"     value="html" />
+    <param name="expires"       value="3600" />
+    <param name="html-template" value="default-helptext.html" />
+  </view>
+  
+  <view name="adminfo">
+    <param name="view-type"     value="adminfo" />
+    <param name="expires"       value="3600" />
+    <param name="html-template" value="adminfo.html" />
+  </view>
+
+  <view name="search">
+    <param name="view-type"     value="html" />
+    <param name="expires"       value="3600" />
+    <param name="html-template" value="search.html" />
+  </view>
+
+    
+</views>
+
+</configuration>
diff --git a/torrus/xmlconfig/examples/apc-ups.xml b/torrus/xmlconfig/examples/apc-ups.xml
new file mode 100644 (file)
index 0000000..b85b264
--- /dev/null
@@ -0,0 +1,64 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+   Copyright (C) 2003  Aaron S. Bush <abush at microelectronics dot com>
+
+   File: apc-ups.xml
+   Description: APC UPS battery monitor example for Torrus.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+-->
+
+<!--
+   This is the example of using the definitions from
+   "vendor/apc.ups.xml" configuration file.
+   Currently the tree structure has to be built by hand, the same way as
+   the example below. In the future, there will be device discovery
+   support for this vendor.
+-->
+
+<configuration>
+
+<datasources>
+
+  <subtree name="SNMP">
+
+    <subtree name="UPS">
+
+      <param name="snmp-community" value="public" />
+      <param name="domain-name" value="example.com" />
+      <param name="data-dir" value="/var/snmpcollector" />
+
+
+      <subtree name="ups1">
+        <param name="legend">
+          Location: Chen's take-away, Duebendorf;
+          Contact:  Chen;
+          Power consumer: Microwave oven
+        </param>
+        <param name="snmp-host" value="ups1" />
+
+        <param name="snmp-version" value="1" />
+
+        <apply-template name="apcups-health" />
+
+      </subtree>
+      <!-- ups1 -->
+
+    </subtree>
+  </subtree>
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/examples/ascend.max.xml b/torrus/xmlconfig/examples/ascend.max.xml
new file mode 100644 (file)
index 0000000..ac70f56
--- /dev/null
@@ -0,0 +1,58 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003 Roman Hochuli, Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: ascend.max.xml,v 1.1 2010-12-27 00:04:28 ivan Exp $
+  Roman Hochuli <roman@hochu.li>
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+  Ascend MAC Call statistics.
+  Tested with Ascent MAX 4000 with Software-Release feik.m40 7.0.26
+-->
+
+<configuration>
+<datasources>
+  <subtree name="SNMP">
+    <subtree name="Dialup">
+
+      <param name="snmp-version" value="1" />
+      <param name="snmp-community" value="xxxx" />
+      <param name="domain-name" value="" />
+      <param name="data-dir" value="/var/snmpcollector" />
+
+      <subtree name="myhost.mydomain.com">
+        <param name="legend">
+          Location: Hardstrasse 235;
+          Contact: GPS Technik AG, Zuercherstrasse 139, CH-8952 Schlieren
+        </param>
+        <param name="snmp-host" value="myhost.mydomain.com" />
+
+        <subtree name="Call_Statistics">
+           <apply-template name="ascend-totalcalls" />
+
+           <leaf name="E1_2_CurrentCalls">
+             <param name="ascend-ifidx" value="2" />
+             <apply-template name="ascend-e1stats" />
+           </leaf>
+        </subtree>
+
+      </subtree>
+
+    </subtree>
+  </subtree>
+</datasources>
+</configuration>
diff --git a/torrus/xmlconfig/examples/docsis-monitors.xml b/torrus/xmlconfig/examples/docsis-monitors.xml
new file mode 100644 (file)
index 0000000..0a5ffd6
--- /dev/null
@@ -0,0 +1,433 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2005  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: docsis-monitors.xml,v 1.1 2010-12-27 00:04:28 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+   Example monitors that may be applied to DOCSIS CMTS monitoring  
+  
+-->
+
+
+<configuration>
+
+<token-sets>
+
+  <token-set name="docs-warnings">
+    <param name="comment" value="DOCSIS Warnings" />
+  </token-set>
+
+  <token-set name="docs-minor">
+    <param name="comment" value="DOCSIS Minor failures" />
+  </token-set>
+
+  <token-set name="docs-major">
+    <param name="comment" value="DOCSIS Major failures" />
+  </token-set>
+
+</token-sets>
+
+<monitors>
+
+  <!-- **********************************************************
+        Three levels of actions for different severity levels
+       ********************************************************** -->
+  <action name="docs-tset-warnings">
+    <param name="action-type" value="tset" />
+    <param name="tset-name" value="docs-warnings" />
+  </action>
+
+  <action name="docs-tset-minor">
+    <param name="action-type" value="tset" />
+    <param name="tset-name" value="docs-minor" />
+  </action>
+
+  <action name="docs-tset-major">
+    <param name="action-type" value="tset" />
+    <param name="tset-name" value="docs-major" />
+  </action>
+
+  
+  <!-- ==========================================================
+       ==                  RFC2670 monitors                    ==
+       ========================================================== -->
+
+  
+  <!-- **********************************************************
+        SNR monitors
+       ********************************************************** -->
+  <monitor name="docsis-snr-1">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr"
+             value="DUP,0,GT,EXC,DUP,24.5,LT,EXC,22,GE,AND,AND" />
+    <param name="action"        value="docs-tset-warnings" />
+    <param name="expires"       value="1800" />
+    <param name="comment">
+      Signal/Noise-Ratio lower than 30dB
+    </param>
+  </monitor>
+
+  <monitor name="docsis-snr-2">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr"
+             value="DUP,0,GT,EXC,DUP,22,LT,EXC,18,GE,AND,AND" />
+    <param name="action"        value="docs-tset-minor" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      Signal/Noise-Ratio lower than 25dB
+    </param>
+  </monitor>
+
+  <monitor name="docsis-snr-3">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr"      value="DUP,0,GT,EXC,18,LT,AND" />
+    <param name="action"        value="docs-tset-major" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      Signal/Noise-Ratio lower than 18dB
+    </param>
+  </monitor>
+
+
+  <!-- **********************************************************
+        Correctable FEC error rate monitors
+       ********************************************************** -->
+  <monitor name="docsis-feccor-1">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    DUP,
+    {Error-Free},{Uncorrectable},+,+,
+    /,100,*,DUP,
+    10,GT,EXC,20,LE,AND
+    </param>
+    <param name="action"        value="docs-tset-warnings" />
+    <param name="expires"       value="1800" />
+    <param name="comment">
+      FEC correctable error rate more than 10%
+    </param>
+  </monitor>
+
+  <monitor name="docsis-feccor-2">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    DUP,
+    {Error-Free},{Uncorrectable},+,+,
+    /,100,*,
+    20,GT
+    </param>
+    <param name="action"        value="docs-tset-minor" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      FEC correctable error rate more than 20%
+    </param>
+  </monitor>
+
+
+  <!-- **********************************************************
+        Uncorrectable FEC error rate monitors
+       ********************************************************** -->
+  <monitor name="docsis-fecuncor-1">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    DUP,
+    {Error-Free},{Correctable},+,+,
+    /,100,*,DUP,
+    0.5,GT,EXC,1,LE,AND
+    </param>
+    <param name="action"        value="docs-tset-warnings" />
+    <param name="expires"       value="1800" />
+    <param name="comment">
+      FEC uncorrectable error rate more than 0.5%
+    </param>
+  </monitor>
+
+  <monitor name="docsis-fecuncor-2">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    DUP,
+    {Error-Free},{Correctable},+,+,
+    /,100,*,DUP,
+    1,GT,2,EXC,LE,AND
+    </param>
+    <param name="action"        value="docs-tset-minor" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      FEC uncorrectable error rate more than 1%
+    </param>
+  </monitor>
+
+  <monitor name="docsis-fecuncor-3">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    DUP,
+    {Error-Free},{Correctable},+,+,
+    /,100,*,
+    2,GT
+    </param>
+    <param name="action"        value="docs-tset-major" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      FEC uncorrectable error rate more than 2%
+    </param>
+  </monitor>
+
+
+  <!-- **********************************************************
+        Downstream utilization monitors
+       ********************************************************** -->
+  <monitor name="docsis-downutl-1">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    {TotalBytes},/,100,*,
+    DUP,
+    75,GT,EXC,80,LE,AND
+    </param>
+    <param name="action"        value="docs-tset-warnings" />
+    <param name="expires"       value="1800" />
+    <param name="comment">
+      DOCSIS downstream utilization more than 75%
+    </param>
+  </monitor>
+
+  <monitor name="docsis-downutl-2">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    {TotalBytes},/,100,*,
+    DUP,
+    80,GT,EXC,85,LE,AND
+    </param>
+    <param name="action"        value="docs-tset-minor" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      DOCSIS downstream utilization more than 80%
+    </param>
+  </monitor>
+  
+  <monitor name="docsis-downutl-3">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    {TotalBytes},/,100,*,
+    85,GT
+    </param>
+    <param name="action"        value="docs-tset-minor" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      DOCSIS downstream utilization more than 85%
+    </param>
+  </monitor>
+
+       
+
+  <!-- ==========================================================
+       ==                  Cisco-specific monitors             ==
+       ========================================================== -->
+   <!-- **********************************************************
+          Upstream utilization monitors
+        ********************************************************** -->
+        
+  <monitor name="docsis-uputil-1">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    DUP,
+    75,GT,EXC,80,LE,AND
+    </param>
+    <param name="action"        value="docs-tset-warnings" />
+    <param name="expires"       value="1800" />
+    <param name="comment">
+      DOCSIS upstream utilization more than 75%
+    </param>
+  </monitor>
+
+  <monitor name="docsis-uputil-2">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    DUP,
+    80,GT,EXC,85,LE,AND
+    </param>
+    <param name="action"        value="docs-tset-minor" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      DOCSIS upstream utilization more than 80%
+    </param>
+  </monitor>
+
+  <monitor name="docsis-uputil-3">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    85,GT
+    </param>
+    <param name="action"        value="docs-tset-major" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      DOCSIS upstream utilization more than 85%
+    </param>
+  </monitor>
+
+
+   <!-- **********************************************************
+          Upstream free contention slots monitors
+        ********************************************************** -->
+        
+  <monitor name="docsis-upslots-1">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    DUP,
+    17,LT,EXC,12,GE,AND
+    </param>
+    <param name="action"        value="docs-tset-warnings" />
+    <param name="expires"       value="1800" />
+    <param name="comment">
+      free DOCSIS upstream minislots less than 17%
+    </param>
+  </monitor>
+
+  <monitor name="docsis-upslots-2">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    DUP,
+    12,LT,EXC,7,GE,AND
+    </param>
+    <param name="action"        value="docs-tset-minor" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      free DOCSIS upstream minislots less than 12%
+    </param>
+  </monitor>
+
+  <monitor name="docsis-upslots-3">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    7,LT
+    </param>
+    <param name="action"        value="docs-tset-major" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      free DOCSIS upstream minislots less than 7%
+    </param>
+  </monitor>
+
+   <!-- **********************************************************
+          Modems online monitors
+        ********************************************************** -->
+
+  <!-- If Modems_Total < 100, then
+         Active < 10% ===> warning
+       If Modems_Total >= 100, then
+         Active < 50% ===> minor
+         Active < 10% ===> major  -->
+        
+  <monitor name="docsis-modems-1">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    {Modems_Total},/,100,*,10,LT,    
+    {Modems_Total},100,LT,AND
+    </param>
+    <param name="action"        value="docs-tset-warnings" />
+    <param name="expires"       value="1800" />
+    <param name="comment">
+      Less than 10% of DOCSIS modems online on a low-loaded interface
+    </param>
+  </monitor>
+
+  <monitor name="docsis-modems-2">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    {Modems_Total},/,100,*,
+    DUP,
+    50,LT,EXC,10,GE,AND,
+    {Modems_Total},100,GE,AND
+    </param>
+    <param name="action"        value="docs-tset-minor" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      Less than 50% of DOCSIS modems online
+    </param>
+  </monitor>
+
+  <monitor name="docsis-modems-3">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    {Modems_Total},/,100,*,10,LT,
+    {Modems_Total},100,GE,AND
+    </param>
+    <param name="action"        value="docs-tset-major" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      Less than 10% of DOCSIS modems online
+    </param>
+  </monitor>
+
+  <!-- ==========================================================
+       ==           IF-MIB monitors for cable interfaces       ==
+       ========================================================== -->
+
+  <monitor name="docs-inerrors-1">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    {Packets_In},/,100,*,DUP,
+    10,GT,EXC,50,LE,AND
+    </param>
+    <param name="action"        value="docs-tset-warnings" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      Input packet errors more than 10%
+    </param>
+  </monitor>
+
+  <monitor name="docs-inerrors-2">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    {Packets_In},/,100,*,DUP,
+    50,GT
+    </param>
+    <param name="action"        value="docs-tset-minor" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      Input packet errors more than 50%
+    </param>
+  </monitor>
+
+  <monitor name="docs-outerrors-1">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    {Packets_Out},/,100,*,DUP,
+    10,GT,EXC,50,LE,AND
+    </param>
+    <param name="action"        value="docs-tset-warnings" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      Output packet errors more than 10%
+    </param>
+  </monitor>
+
+  <monitor name="docs-outerrors-2">
+    <param name="monitor-type"  value="expression" />
+    <param name="rpn-expr">
+    {Packets_Out},/,100,*,DUP,
+    50,GT
+    </param>
+    <param name="action"        value="docs-tset-minor" />
+    <param name="expires"       value="21600" />
+    <param name="comment">
+      Output packet errors more than 50%
+    </param>
+  </monitor>
+       
+</monitors>
+
+</configuration>
diff --git a/torrus/xmlconfig/examples/generic-netsnmp.xml b/torrus/xmlconfig/examples/generic-netsnmp.xml
new file mode 100644 (file)
index 0000000..79f5140
--- /dev/null
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright (C) 2003  Shawn Ferry
+
+   File: generic-netsnmp.xml
+   Description: System monitor example for Torrus.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+
+  $Id: generic-netsnmp.xml,v 1.1 2010-12-27 00:04:28 ivan Exp $
+  @(#) 10/18/03 generic-netsnmp.xml 1.2 (10/18/03 18:33:14) sferry
+-->
+<!--
+   This is the example of using templates from vendor and generic definition
+   files:
+   generic/rfc1213.xml, generic/rfc2790.host-resources.xml,
+   vendor/ucd-snmp.xml
+
+   This file can be used as an example for any host using ucd-snmp
+
+   You are encouraged to look at one of the tree-<name> configurations.
+
+-->
+<configuration>
+  <datasources>
+    <!--
+      Apply the one-minute-period template, which sets the collector period
+      to one minute and uses the appropriate RRA values for the period
+    -->
+    <!-- The top subtree for for the Generic Tree-->
+    <subtree name="Generic">
+      <apply-template name="snmp-defaults"/>
+      <!--
+          Set the snmp community port and version
+          All of these settings override any previously
+          set values and are in effect for everything
+          inside this subtree
+        -->
+      <param name="snmp-community" value="public"/>
+      <param name="snmp-port" value="191"/>
+      <param name="snmp-version" value="1"/>
+      <param name="domain-name" value=""/>
+
+      <!-- Set the data-dir for rrd files created because of this subtree
+          I use a directory per tree and a directory per host. The directories
+          must be manually created -->
+      <param name="data-dir">
+          /usr/local/torrus-data/generic/snmp/%system-id%
+      </param>
+
+      <!-- This subtree wraps up the applied configuration for "SolarisHost"
+           It is also appropriate for most net/ucd snmp hosts -->
+      <subtree name="SolarisHost">
+        <apply-template name="one-minute-period"/>
+
+        <!-- Text to display while showing this tree -->
+        <param name="legend">
+            Location: System Localtion ; Contact: System Contact
+        </param>
+
+        <!-- The IP address of the host that is being queried -->
+        <param name="snmp-host" value="127.0.0.1"/>
+        <!--
+            Apply the template named ucd-snmp
+            ucd-snmp attempts to capture and graph system memory
+                blockio and system/processor information(similar to vmstat)
+                it is actually a wrap up of  the following templates
+                ucd-memory, ucd-blockio, ucd-context_interrupts
+          -->
+        <apply-template name="ucd-snmp"/>
+
+        <!-- Apply the template named rfc2790.host-resources
+                rfc2790.host-resources, wraps up the template
+                hrsystem, which attempts to graph the number of users
+                and processes on a system.
+          -->
+        <apply-template name="rfc2790.host-resources"/>
+
+        <!-- The Storage Subtree, it is not required that a tree exist
+             at this level -->
+        <subtree name="Storage">
+
+          <!-- the root filesystem -->
+          <subtree name="root">
+
+            <!-- the string that is returned for hrStorageDescr -->
+            <param name="storage-description" value="/"/>
+
+            <!-- The Name of the file system without any special characters
+                 Used to create the datafile -->
+            <param name="filesystem" value="root"/>
+
+            <!-- Apply the template hrstorage -->
+            <apply-template name="hrstorage"/>
+          </subtree>
+
+          <subtree name="tmp">
+            <param name="storage-description" value="/tmp"/>
+            <param name="filesystem" value="tmp"/>
+            <apply-template name="hrstorage"/>
+          </subtree>
+
+          <subtree name="var">
+            <param name="storage-description" value="/var"/>
+            <param name="filesystem" value="var"/>
+            <apply-template name="hrstorage"/>
+          </subtree>
+
+          <subtree name="opt">
+            <param name="storage-description" value="/opt"/>
+            <param name="filesystem" value="opt"/>
+            <apply-template name="hrstorage"/>
+          </subtree>
+
+        </subtree>
+
+        <!-- Interfaces -->
+        <!-- The NetworkInterfaces Subtree, it is not required that a
+             tree exist at this level -->
+        <subtree name="NetworkInterfaces">
+
+          <!-- The network interface hme0 -->
+          <subtree name="hme0">
+            <!-- The name of the interface as returned by rfc1213_ifDescr -->
+            <param name="interface-name" value="hme0"/>
+
+            <!-- Apply the template rfc1213-interface -->
+            <apply-template name="rfc1213-interface"/>
+          </subtree>
+
+          <subtree name="qfe0">
+            <param name="interface-name" value="qfe0"/>
+            <apply-template name="rfc1213-interface"/>
+          </subtree>
+
+          <subtree name="qfe1">
+            <param name="interface-name" value="qfe1"/>
+            <apply-template name="rfc1213-interface"/>
+          </subtree>
+        </subtree>
+      </subtree>
+    </subtree>
+  </datasources>
+</configuration>
diff --git a/torrus/xmlconfig/examples/hpux.xml b/torrus/xmlconfig/examples/hpux.xml
new file mode 100644 (file)
index 0000000..2d91f2d
--- /dev/null
@@ -0,0 +1,103 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+   Copyright (C) 2003  Aaron S. Bush <abush at microelectronics dot com>
+
+   File: hpux.xml
+   Description: HP-UX system monitor example for Torrus.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+-->
+
+<!--
+   This is the example of using the definitions from
+   "vendor/hp.hpux.xml" configuration file.
+   Currently the tree structure has to be built by hand, the same way as
+   the example below. In the future, there will be device discovery
+   support for this vendor.
+-->
+
+<configuration>
+
+<datasources>
+
+  <subtree name="SNMP">
+
+    <subtree name="HP">
+
+      <param name="snmp-community" value="public" />
+      <param name="domain-name" value="example.com" />
+      <param name="data-dir" value="/var/snmpcollector" />
+
+      <subtree name="hp01">
+        <param name="legend">
+          Location: Rack 01;
+          Contact: John Doe
+        </param>
+        <param name="snmp-host" value="hp01" />
+
+        <subtree name="stand">
+          <param name="filesystem-name"   value="/stand" />
+          <param name="filesystem"        value="stand" />
+          <apply-template name="hpux-filesystem" />
+        </subtree>
+
+        <subtree name="root">
+          <param name="filesystem-name"   value="/" />
+          <param name="filesystem"        value="root" />
+          <apply-template name="hpux-filesystem" />
+        </subtree>
+
+        <subtree name="var">
+          <param name="filesystem-name"   value="/var" />
+          <param name="filesystem"        value="var" />
+          <apply-template name="hpux-filesystem" />
+        </subtree>
+
+        <subtree name="usr">
+          <param name="filesystem-name"   value="/usr" />
+          <param name="filesystem"        value="usr" />
+          <apply-template name="hpux-filesystem" />
+        </subtree>
+
+        <subtree name="tmp">
+          <param name="filesystem-name"   value="/tmp" />
+          <param name="filesystem"        value="tmp" />
+          <apply-template name="hpux-filesystem" />
+        </subtree>
+
+        <subtree name="home">
+          <param name="filesystem-name"   value="/home" />
+          <param name="filesystem"        value="home" />
+          <apply-template name="hpux-filesystem" />
+        </subtree>
+
+        <subtree name="opt">
+          <param name="filesystem-name"   value="/opt" />
+          <param name="filesystem"        value="opt" />
+          <apply-template name="hpux-filesystem" />
+        </subtree>
+
+        <apply-template name="hpux-cpu" />
+
+      </subtree>
+      <!-- hp01 -->
+
+    </subtree>
+  </subtree>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/examples/monitors.xml b/torrus/xmlconfig/examples/monitors.xml
new file mode 100644 (file)
index 0000000..a7a42d0
--- /dev/null
@@ -0,0 +1,156 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: monitors.xml,v 1.1 2010-12-27 00:04:29 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!--
+  These examples show how monitors can be built in Torrus and used together
+  with your data.
+ -->
+
+<configuration>
+
+<token-sets>
+
+  <token-set name="jumps">
+    <param name="comment" value="Traffic rate jumps" />
+  </token-set>
+
+  <token-set name="hw-failures">
+    <param name="comment" value="Holt-Winters prediction failures" />
+  </token-set>
+
+  <token-set name="devel">
+    <param name="comment"
+           value="Torrus development and testing" />
+  </token-set>
+
+</token-sets>
+
+<monitors>
+
+  <!-- First define the actions -->
+
+  <!-- This action will put the graphs of alarmed datasources in
+       a single alarm report page -->
+  <action name="graph-hw-failures">
+    <param name="action-type" value="tset" />
+    <param name="tset-name" value="hw-failures" />
+  </action>
+
+  <action name="graph-jumps">
+    <param name="action-type" value="tset" />
+    <param name="tset-name" value="jumps" />
+  </action>
+
+  <action name="graph-devel">
+    <param name="action-type" value="tset" />
+    <param name="tset-name" value="devel" />
+  </action>
+
+  <action name="report-file">
+    <param name="action-type" value="exec" />
+    <param name="command">
+      echo `date '+%d-%b-%Y %H:%M:%S'` \
+      $TORRUS_MONITOR $TORRUS_EVENT $TORRUS_NODEPATH \
+      &gt;&gt; /tmp/torrus-events
+    </param>
+    <param name="launch-when" value="set, repeat, clear, forget" />
+  </action>
+
+  <action name="snmptrap">
+    <param name="action-type" value="exec" />
+    <param name="command" value="$TORRUS_HOME/bin/action_snmptrap" />
+    <param name="launch-when" value="set, clear" />
+  </action>
+
+  <action name="report-email">
+    <param name="action-type" value="exec" />
+    <param name="command">
+      $TORRUS_HOME/bin/action_printemail | mail ssinyagin@yahoo.com
+    </param>
+    <param name="launch-when" value="set, clear" />
+  </action>
+
+  <monitor name="hw-failures">
+    <param name="monitor-type" value="failures" />
+    <param name="action"
+           value="graph-hw-failures, report-file" />
+    <param name="expires" value="21600" />
+    <param name="comment"
+           value="Holt-Winters prediction failures" />
+  </monitor>
+
+  <monitor name="strict-maximum">
+    <param name="monitor-type" value="expression" />
+    <param name="rpn-expr">
+      #max,GT
+    </param>
+    <param name="action" value="report-email" />
+    <param name="expires" value="3600" />
+    <param name="comment"
+           value="Value is more than specified maximum" />
+  </monitor>
+
+  <monitor name="strict-minimum">
+    <param name="monitor-type" value="expression" />
+    <param name="rpn-expr">
+      #min,LT
+    </param>
+    <param name="action" value="report-email" />
+    <param name="expires" value="3600" />
+    <param name="comment"
+           value="Value is less than specified minimum" />
+  </monitor>
+
+  <monitor name="high-jumps">
+    <param name="monitor-type" value="expression" />
+    <param name="rpn-expr">
+      {(LAST-300)},10,*,GT,
+      {(LAST)},{(LAST-300)},10,/,LT,
+      OR,
+      {T@(LAST)},3600,+,NOW,GE,
+      AND
+    </param>
+    <param name="action" value="graph-jumps, report-file" />
+    <param name="expires" value="3600" />
+    <param name="comment"
+           value="Value jumped more than 10-fold in 5 minutes" />
+  </monitor>
+
+  <monitor name="mon-devel">
+    <param name="monitor-type" value="expression" />
+    <param name="rpn-expr">
+      {(LAST-600)},-,ABS,10485760,GT,
+      {T@(LAST)},3600,+,NOW,GE,
+      AND
+    </param>
+    <param name="action">
+      graph-devel, report-file, snmptrap
+    </param>
+    <param name="expires" value="900" />
+    <param name="comment"
+           value="Traffic jumps more than 10mbps in 10 minutes" />
+  </monitor>
+
+</monitors>
+
+</configuration>
diff --git a/torrus/xmlconfig/examples/multigraph.xml b/torrus/xmlconfig/examples/multigraph.xml
new file mode 100644 (file)
index 0000000..d9356b4
--- /dev/null
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: multigraph.xml,v 1.1 2010-12-27 00:04:29 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!--
+  This example shows how multiple datasources may be displayed in
+  one graph. See also the template definitions for "BpsInOut"
+  in "snmp-defs.xml", "vendor/cisco.ios.xml".
+ -->
+
+<configuration>
+
+<datasources>
+
+  <subtree name="SampleMulti">
+    <leaf name="sample1">
+      <param name="ds-type" value="rrd-multigraph" />
+      <param name="ds-names" value="in,out" />
+      <param name="foobarpath"
+             value="/SNMP/Routers/213.230.38.4/FastEthernet0_0" />
+
+      <!-- parameter name tail is formed by the DS name -->
+
+      <param name="ds-expr-in"       value="{%foobarpath%/locIfInBitsSec}" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="AREA" />
+      <param name="line-color-in"    value="#00FF00" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{%foobarpath%/locIfOutBitsSec}" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="LINE2" />
+      <param name="line-color-out"   value="#0000FF" />
+      <param name="line-order-out"   value="2" />
+
+    </leaf>
+  </subtree>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/examples/rainbow-schema.xml b/torrus/xmlconfig/examples/rainbow-schema.xml
new file mode 100644 (file)
index 0000000..0685b32
--- /dev/null
@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (C) 2003 Shawn Ferry
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+Shawn Ferry <sferry at sevenspace dot com > <lalartu at obscure dot org>
+
+$Id: rainbow-schema.xml,v 1.1 2010-12-27 00:04:28 ivan Exp $
+@(#) 10/18/03 schema.xml 1.3 (10/18/03 18:44:31) sferry
+
+-->
+<!--
+  (Not very much practical) example of using styling/rainbow-schema.pl
+-->
+
+<include filename="generic/rfc1213.xml"/>
+
+<configuration>
+  <datasources>
+    <!-- rfc1313-interface must be applied at the per-interface level  -->
+    <!--
+    rfc1213-interface-rainbow Template
+    -->
+    <template name="rfc1213-interface-rainbow">
+      <param name="data-file"
+             value="%system-id%_rfc1213-%interface-name%.rrd"/>
+      <leaf name="InOutBytes">
+        <param name="ignore-upper-limit" value="no"/>
+        <param name="graph-upper-limit" value="1000"/>
+        <param name="comment" value="Input and Output bits per second graphs"/>
+        <param name="ds-type" value="rrd-multigraph"/>
+        <param name="ds-names"
+            value="in,out,one,two,three,four,five,six,seven,eight,nine,ten"/>
+        <!-- IN -->
+        <param name="ds-expr-in" value="{ifInOctets}"/>
+        <param name="graph-legend-in" value="Bytes per second in"/>
+        <param name="line-style-in" value="AREA"/>
+        <param name="line-color-in" value="##BpsOut"/>
+        <param name="line-order-in" value="1"/>
+        <!-- OUT -->
+        <param name="ds-expr-out" value="{ifOutOctets}"/>
+        <param name="graph-legend-out" value="Bytes per second out"/>
+        <param name="line-style-out" value="LINE2"/>
+        <param name="line-color-out" value="##in"/>
+        <param name="line-order-out" value="2"/>
+
+
+        <!-- IN -->
+        <param name="ds-expr-one" value="{ifInOctets},1.5,*"/>
+        <param name="graph-legend-one" value="one"/>
+        <param name="line-style-one" value="AREA"/>
+        <param name="line-color-one" value="##one"/>
+        <param name="line-order-one" value="3"/>
+        <!-- OUT -->
+        <param name="ds-expr-two" value="{ifOutOctets},2,*"/>
+        <param name="graph-legend-two" value="two"/>
+        <param name="line-style-two" value="LINE2"/>
+        <param name="line-color-two" value="##two"/>
+        <param name="line-order-two" value="4"/>
+
+        <!-- IN -->
+        <param name="ds-expr-three" value="{ifInOctets},2.5,*"/>
+        <param name="graph-legend-three" value="three"/>
+        <param name="line-style-three" value="STACK"/>
+        <param name="line-color-three" value="##three"/>
+        <param name="line-order-three" value="5"/>
+        <!-- OUT -->
+        <param name="ds-expr-four" value="{ifOutOctets},2.5,*"/>
+        <param name="graph-legend-four" value="four"/>
+        <param name="line-style-four" value="LINE2"/>
+        <param name="line-color-four" value="##four"/>
+        <param name="line-order-four" value="6"/>
+
+        <!-- IN -->
+        <param name="ds-expr-five" value="{ifInOctets},3,*"/>
+        <param name="graph-legend-five" value="five"/>
+        <param name="line-style-five" value="STACK"/>
+        <param name="line-color-five" value="##five"/>
+        <param name="line-order-five" value="7"/>
+        <!-- OUT -->
+        <param name="ds-expr-six" value="{ifOutOctets},3,*"/>
+        <param name="graph-legend-six" value="six"/>
+        <param name="line-style-six" value="LINE2"/>
+        <param name="line-color-six" value="##six"/>
+        <param name="line-order-six" value="8"/>
+
+        <!-- IN -->
+        <param name="ds-expr-seven" value="{ifInOctets},3.5,*"/>
+        <param name="graph-legend-seven" value="seven"/>
+        <param name="line-style-seven" value="STACK"/>
+        <param name="line-color-seven" value="##seven"/>
+        <param name="line-order-seven" value="9"/>
+        <!-- OUT -->
+        <param name="ds-expr-eight" value="{ifOutOctets},3.5,*"/>
+        <param name="graph-legend-eight" value="eight"/>
+        <param name="line-style-eight" value="LINE2"/>
+        <param name="line-color-eight" value="##eight"/>
+        <param name="line-order-eight" value="10"/>
+
+
+        <!-- IN -->
+        <param name="ds-expr-nine" value="{ifInOctets},4,*"/>
+        <param name="graph-legend-nine" value="nine"/>
+        <param name="line-style-nine" value="STACK"/>
+        <param name="line-color-nine" value="##nine"/>
+        <param name="line-order-nine" value="11"/>
+        <!-- OUT -->
+        <param name="ds-expr-ten" value="{ifOutOctets},4,*"/>
+        <param name="graph-legend-ten" value="ten"/>
+        <param name="line-style-ten" value="LINE2"/>
+        <param name="line-color-ten" value="##ten"/>
+        <param name="line-order-ten" value="12"/>
+
+      </leaf>
+      <leaf name="ifOutErrors">
+        <param name="snmp-object" value="$rfc1213_ifOutErrors.$rfc1213_IFIDX"/>
+        <param name="rrd-ds" value="rfc1213_ifOutErrors"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment" value="Output error counter for the interface"/>
+        <param name="graph-legend" value="Errors out"/>
+      </leaf>
+      <leaf name="ifInErrors">
+        <param name="snmp-object" value="$rfc1213_ifInErrors.$rfc1213_IFIDX"/>
+        <param name="rrd-ds" value="rfc1213_ifInErrors"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment" value="Input error counter for the interface"/>
+        <param name="graph-legend" value="Errors in"/>
+      </leaf>
+      <leaf name="ifInOctets">
+        <param name="hidden" value="yes"/>
+        <param name="snmp-object" value="$rfc1213_ifInOctets.$rfc1213_IFIDX"/>
+        <param name="rrd-ds" value="rfc1213_ifInOctets"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment">
+          1-minute average of input Bytes per second
+        </param>
+        <param name="graph-legend" value="Bytes in"/>
+      </leaf>
+      <leaf name="ifOutOctets">
+        <param name="hidden" value="yes"/>
+        <param name="snmp-object" value="$rfc1213_ifOutOctets.$rfc1213_IFIDX"/>
+        <param name="rrd-ds" value="rfc1213_ifOutOctets"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment">
+          1-minute average of output Bytes per second
+        </param>
+        <param name="graph-legend" value="Bytes out"/>
+      </leaf>
+    </template>
+  </datasources>
+</configuration>
diff --git a/torrus/xmlconfig/examples/servers.data b/torrus/xmlconfig/examples/servers.data
new file mode 100644 (file)
index 0000000..28775dc
--- /dev/null
@@ -0,0 +1,69 @@
+[%#
+  Example of using tpage for Torrus config generation.
+  This is an example only. See User Guide for more details.
+  Author: Christian Schnidrig
+  Generate the XML configuration with
+  tpage --define data=servers.data servers.tmpl >servers.xml
+%]
+[%
+  servers = [
+    {
+      name => 'torrus'
+      type => 'Linux',
+      location => 'Binz'
+      description => 'Torrus (Front-end)'
+      community => 'blabla',
+      ram => 3000000000
+      numCpu => 2,
+      disks => [
+          {name => '/', nickName => 'Root'}
+          {name => '/var/snmpcollector/0', nickName => 'Collector_0'}
+          {name => '/var/snmpcollector/1', nickName => 'Collector_1'}
+          {name => '/var/snmpcollector/2', nickName => 'Collector_2'}
+          {name => '/var/snmpcollector/3', nickName => 'Collector_3'}
+          {name => '/var/snmpcollector/4', nickName => 'Collector_4'}
+        ],
+      nics => [
+          {name => 'eth0', nickName => 'nic', speed => 100000000}
+          {name => 'eth1', nickName => 'local', speed => 1000000000}
+        ]
+    }
+    {
+      name => 'torrus2'
+      type => 'Linux',
+      location => 'Binz'
+      description => 'Torrus (Collector)'
+      community => 'blabla',
+      ram => 3000000000
+      numCpu => 2,
+      disks => [
+          {name => '/', nickName => 'Root'}
+          {name => '/var/snmpcollector/5', nickName => 'Collector_5'}
+          {name => '/var/snmpcollector/6', nickName => 'Collector_6'}
+          {name => '/var/snmpcollector/7', nickName => 'Collector_7'}
+          {name => '/var/snmpcollector/8', nickName => 'Collector_8'}
+          {name => '/var/snmpcollector/9', nickName => 'Collector_9'}
+        ],
+      nics => [
+          {name => 'eth0', nickName => 'nic', speed => 100000000}
+          {name => 'eth1', nickName => 'local', speed => 1000000000}
+        ]
+    }
+    {
+      name => 'someSolarisMachine',
+      type => 'Solaris',
+      location => 'Binz',
+      description => 'Tacacs Server',
+      community => 'blabla',
+      ram => 224000000,
+      numCpu => 1,
+      disks => [
+          {name => '/', nickName => 'Root'}
+          {name => '/log', nickName => 'Log'}
+        ],
+      nics => [
+          {name => 'le0', nickName => 'nic', speed => 100000000}
+        ]
+    }
+  ]
+%]
diff --git a/torrus/xmlconfig/examples/servers.tmpl b/torrus/xmlconfig/examples/servers.tmpl
new file mode 100644 (file)
index 0000000..47b26e5
--- /dev/null
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<!--
+  Example of using tpage for Torrus config generation.
+  This is an example only. See User Guide for more details.
+  Author: Christian Schnidrig
+-->
+
+[% PROCESS $data %]
+
+<configuration>
+<datasources>
+
+  <subtree name="SNMP">
+    <subtree name="Servers">
+      [% FOREACH server = servers %]
+      <!-- ************************************************************* -->
+      <!-- [% server.name %] -->
+      <subtree name="[% server.type %]">
+        <subtree name="[% server.name %]">
+
+          <alias>/ByName/[% server.name %]/</alias>
+
+          <param name="snmp-community"  value="[% server.community %]" />
+          <param name="comment"         value="[% server.description %]" />
+          <param name="snmp-host"       value="[% server.name %]" />
+          <param name="legend">
+            Description: [% server.description %]
+            Location:    [% server.location %]
+          </param>
+
+          <apply-template name="physicalRam" />
+          <leaf name="PhysicalRAM">
+            <param name="lower-limit"     value="0" />
+            <param name="upper-limit"     value="[% server.ram %]" />
+          </leaf>
+
+          <param name="numCpu"            value="[% server.numCpu %]" />
+          [% IF server.type == 'Linux'%]
+          <apply-template name="cpu-Linux" />
+          [% ELSE %]
+          <apply-template name="cpu-Solaris" />
+          [% END %]
+          <apply-template name="load" />
+          <apply-template name="virtualMemory" />
+
+          <apply-template name="swap" />
+
+          <apply-template name="sysIO" />
+          [% SET precedence = 200 %]
+          [% FOREACH disk = server.disks %]
+              <leaf name="Disk_[% disk.nickName %]">
+                <param name="comment"       value="Disk [% disk.name %]" />
+                <param name="data-file">
+                  %system-id%_[%disk.nickName%].rrd
+                </param>
+                <param name="storage-name"    value="[% disk.name %]" />
+                [% SET precedence = precedence + 10 %]
+                <param name="precedence"    value="[% precedence %]" />
+                <apply-template name="disk" />
+              </leaf>
+          [% END %]
+          [% FOREACH nic = server.nics %]
+              <subtree name="[% nic.nickName %]">
+                <param name="interface-name"  value="[% nic.name %]" />
+                <param name="interface-nick"  value="[% nic.nickName %]" />
+                <param name="speed"   value="[% nic.speed %]" />
+                <param name="comment" value="Network Traffic [% nic.name %]"/>
+                <apply-template name="interface-counters" />
+                [% SET precedence = precedence + 10 %]
+                <param name="precedence"    value="[% precedence %]" />
+              </subtree>
+            [% END %]
+            <apply-template name="hrSystemUptime" />
+          </subtree>
+        </subtree>
+      [% END %]
+    </subtree>
+  </subtree>
+
+</datasources>
+</configuration>
+
diff --git a/torrus/xmlconfig/generic/collector-periods.xml b/torrus/xmlconfig/generic/collector-periods.xml
new file mode 100644 (file)
index 0000000..550575a
--- /dev/null
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright (C) 2003 Shawn Ferry
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+   Shawn Ferry <sferry at sevenspace dot com > <lalartu at obscure dot org>
+
+$Id: collector-periods.xml,v 1.1 2010-12-27 00:04:30 ivan Exp $
+@(#) 10/18/03 collector-periods.xml 1.8 (10/16/03 23:44:25) sferry
+
+-->
+
+<!--
+  Template(s) to override the default periods and RRA definitions.
+-->
+
+<configuration>
+  <datasources>
+    <!--
+      Two mandatory parameters define the collector schedule.
+      The collector runs at moments defined by formula:
+        time + period - (time mod period) + timeoffset
+
+      Each period requires RRAs to be defined for that period
+      RRAs use the following syntax   RRA:CF:xff:steps:rows
+      as the calculation of setps and rows is period dependent
+    -->
+
+    <!-- ONE MINUTE PERIOD -->
+    <template name="one-minute-period">
+      <param name="collector-period"      value="60"/>
+      <param name="collector-timeoffset"  value="10"/>
+      <!--
+        Round-robin arrays to be created, separated by space.
+        RRA:CF:xff:steps:rows
+        We keep: (step = 60 )
+          1-minute avg details for 1 week,
+          30-minute ave/min/max details for 6 weeks,
+          1-day ave/min/max for 2 years
+      -->
+      <param name="rrd-create-rra">
+        RRA:AVERAGE:0:1:10080
+        RRA:LAST:0:1:1
+        RRA:AVERAGE:0.17:30:2688 RRA:MIN:0.17:30:2688 RRA:MAX:0.17:30:2688
+        RRA:AVERAGE:0.042:1440:732
+        RRA:MIN:0.042:1440:732   RRA:MAX:0.042:1440:732
+      </param>
+      <param name="rrd-create-heartbeat" value="300"/>
+
+      <!-- Optional Holt-Winters season length.
+           Default is one-day (1440 1-minute intervals) -->
+      <param name="rrd-create-hw-season" value="1440" />
+
+      <!-- Mandatory length of the Holt-Winters archives.
+           Same length as main 1-minutes RRA -->
+      <param name="rrd-create-hw-rralen" value="10080" />
+    </template>
+
+
+    
+    <!-- FIVE MINUTE PERIOD -->
+    <template name="five-minute-period">
+      <param name="collector-period"      value="300"/>
+      <param name="collector-timeoffset"  value="20"/>
+      <!-- Round-robin arrays to be created, separated by space.
+           RRA:CF:xff:steps:rows
+           We keep: (step = 300 )
+             5-minute avg for 2 weeks,
+             30-minute ave/min/max details for 6 weeks,
+             1-day ave/min/max for 2 years
+      -->
+      <param name="rrd-create-rra">
+        RRA:AVERAGE:0:1:4032
+        RRA:AVERAGE:0.17:6:2016   RRA:MAX:0.17:6:2016   RRA:MIN:0.17:6:2016
+        RRA:AVERAGE:0.042:288:732 RRA:MAX:0.042:288:732 RRA:MIN:0.042:288:732
+      </param>
+      <param name="rrd-create-heartbeat" value="900"/>
+    </template>
+
+  </datasources>
+</configuration>
diff --git a/torrus/xmlconfig/generic/monitors.xml b/torrus/xmlconfig/generic/monitors.xml
new file mode 100644 (file)
index 0000000..57a40c3
--- /dev/null
@@ -0,0 +1,97 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003 Shawn Ferry
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+   Shawn Ferry <sferry at sevenspace dot com > <lalartu at obscure dot org>
+
+$Id $
+
+-->
+<configuration>
+  <monitors>
+
+    <!-- Actions -->
+    <action name="graph-hw-failures">
+      <param name="action-type" value="tset" />
+      <param name="tset-name" value="hw-failures" />
+    </action>
+
+    <action name="graph-Violations">
+      <param name="action-type" value="tset" />
+      <param name="tset-name" value="Violations" />
+    </action>
+
+    <!-- Monitors -->
+    <monitor name="hw-failures">
+      <param name="monitor-type" value="failures" />
+      <param name="action" value="graph-hw-failures" />
+      <param name="expires" value="3600" />
+    </monitor>
+
+    <monitor name="fail_eq">
+      <param name="monitor-type" value="expression"/>
+      <param name="rpn-expr" value="#fail,EQ"/>
+      <param name="action" value="graph-Violations"/>
+      <param name="expires" value="86400"/>
+    </monitor>
+
+    <monitor name="fail_lt">
+      <param name="monitor-type" value="expression"/>
+      <param name="rpn-expr" value="#fail,LT"/>
+      <param name="action" value="graph-Violations"/>
+      <param name="expires" value="86400"/>
+    </monitor>
+
+    <monitor name="fail_le">
+      <param name="monitor-type" value="expression"/>
+      <param name="rpn-expr" value="#fail,LE"/>
+      <param name="action" value="graph-Violations"/>
+      <param name="expires" value="86400"/>
+    </monitor>
+
+    <monitor name="fail_gt">
+      <param name="monitor-type" value="expression"/>
+      <param name="rpn-expr" value="#fail,GT"/>
+      <param name="action" value="graph-Violations"/>
+      <param name="expires" value="86400"/>
+    </monitor>
+
+    <monitor name="fail_ge">
+      <param name="monitor-type" value="expression"/>
+      <param name="rpn-expr" value="#fail,GE"/>
+      <param name="action" value="graph-Violations"/>
+      <param name="expires" value="86400"/>
+    </monitor>
+
+  </monitors>
+
+  <!-- Tokensets -->
+  <token-sets>
+    <param name="default-tset-view" value="default-tset-html" />
+    <param name="default-tsetlist-view" value="tset-list-html" />
+
+    <token-set name="hw-failures">
+      <param name="comment" value="HW Prediction Violations"/>
+    </token-set>
+
+    <token-set name="Violations">
+      <param name="comment" value="Monitor Violations"/>
+    </token-set>
+
+  </token-sets>
+
+</configuration>
diff --git a/torrus/xmlconfig/generic/rfc1628.ups.xml b/torrus/xmlconfig/generic/rfc1628.ups.xml
new file mode 100644 (file)
index 0000000..1888967
--- /dev/null
@@ -0,0 +1,370 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright (C) 2008 Jon Nistor
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: rfc1628.ups.xml,v 1.1 2010-12-27 00:04:30 ivan Exp $
+  Jon Nistor <nistor at snickers dot org>
+
+-->
+
+<configuration>
+
+<definitions>
+  <!-- UPS-MIB -->
+
+  <!-- Battery group -->
+  <def name="upsBatteryStatus"             value="1.3.6.1.2.1.33.1.2.1.0"/>
+  <def name="upsSecondsOnBattery"          value="1.3.6.1.2.1.33.1.2.2.0"/>
+  <def name="upsEstimatedMinutesRemaining" value="1.3.6.1.2.1.33.1.2.3.0"/>
+  <def name="upsEstimatedChargeRemaining"  value="1.3.6.1.2.1.33.1.2.4.0"/>
+  <def name="upsBatteryVoltage"            value="1.3.6.1.2.1.33.1.2.5.0"/>
+  <def name="upsBatteryCurrent"            value="1.3.6.1.2.1.33.1.2.6.0"/>
+
+  <!-- Input group -->
+  <def name="upsInputLineBads"             value="1.3.6.1.2.1.33.1.3.1.0"/>
+  <def name="upsInputFrequency"            value="1.3.6.1.2.1.33.1.3.3.1.2"/>
+  <def name="upsInputVoltage"              value="1.3.6.1.2.1.33.1.3.3.1.3"/>
+  <def name="upsInputCurrent"              value="1.3.6.1.2.1.33.1.3.3.1.4"/>
+  <def name="upsInputTruePower"            value="1.3.6.1.2.1.33.1.3.3.1.5"/>
+
+  <!-- Output group -->
+  <def name="upsOutputFrequency"           value="1.3.6.1.2.1.33.1.4.2.0"/>
+  <def name="upsOutputVoltage"             value="1.3.6.1.2.1.33.1.4.4.1.2"/>
+  <def name="upsOutputCurrent"             value="1.3.6.1.2.1.33.1.4.4.1.3"/>
+  <def name="upsOutputPower"               value="1.3.6.1.2.1.33.1.4.4.1.4"/>
+  <def name="upsOutputPercentLoad"         value="1.3.6.1.2.1.33.1.4.4.1.5"/>
+
+  <!-- Bypass group -->
+  <def name="upsBypassFrequency"           value="1.3.6.1.2.1.33.1.5.1.0"/>
+  <def name="upsBypassVoltage"             value="1.3.6.1.2.1.33.1.5.3.1.2"/>
+
+</definitions>
+
+<datasources>
+
+  <template name="battery-subtree">
+    <param name="data-file"         value="%system-id%_ups_battery.rrd"/>
+    <param name="comment"           value="Battery Information"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+    <leaf name="Status">
+      <!-- values: 1 unknown, 2 normal, 3 low, 4 depleted -->
+      <param name="comment"      value="Capacity remaining in batteries"/>
+      <param name="graph-legend" value="status"/>
+      <param name="graph-title"
+              value="Status: 1 unknown, 2 normal, 3 low, 4 depleted"/>
+      <param name="precedence"   value="990"/>
+      <param name="rrd-ds"       value="BatteryStatus"/>
+      <param name="snmp-object"  value="$upsBatteryStatus"/>
+    </leaf>
+    <leaf name="Seconds_On_Batttery">
+      <param name="comment"        value="Seconds unit is on battery"/>
+      <param name="graph-legend"   value="Seconds on battery"/>
+      <param name="precedence"     value="980"/>
+      <param name="rrd-ds"         value="SecondsOnBattery"/>
+      <param name="snmp-object"    value="$upsSecondsOnBattery"/>
+      <param name="vertical-label" value="seconds"/>
+    </leaf>
+
+    <leaf name="Minutes_Remaining">
+      <param name="comment"        value="Minutes remaining before depletion"/>
+      <param name="graph-legend"   value="Minutes left before depletion"/>
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"     value="970"/>
+      <param name="rrd-ds"         value="EstMinRemaining"/>
+      <param name="snmp-object"    value="$upsEstimatedMinutesRemaining"/>
+      <param name="vertical-label" value="minutes"/>
+    </leaf>
+
+    <leaf name="Charge_Remaining">
+      <param name="comment"        value="Battery charge remaining"/>
+      <param name="graph-legend"   value="Battery charge remaining"/>
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"     value="960"/>
+      <param name="rrd-ds"         value="EstChgRemaining"/>
+      <param name="snmp-object"    value="$upsEstimatedChargeRemaining"/>
+      <param name="upper-limit"    value="100" />
+      <param name="vertical-label" value="percent"/>
+    </leaf>
+
+    <leaf name="Battery_Voltage">
+      <param name="hidden"         value="yes"/>
+      <param name="comment"        value="Magnitude of battery voltage"/>
+      <param name="graph-legend"   value="Battery Voltage"/>
+      <param name="precedence"     value="951"/>
+      <param name="rrd-ds"         value="BatteryVoltage"/>
+      <param name="snmp-object"    value="$upsBatteryVoltage"/>
+      <param name="vertical-label" value="0.1 Volt DC"/>
+    </leaf>
+
+    <leaf name="Voltage">
+      <param name="comment"        value="Magnitude of battery voltage"/>
+      <param name="graph-legend"   value="Battery Voltage"/>
+      <param name="precedence"     value="950"/>
+      <param name="ds-type"        value="rrd-file"/>
+      <param name="leaf-type"      value="rrd-cdef"/>
+      <param name="rpn-expr"       value="{Battery_Voltage},0.1,*"/>
+      <param name="vertical-label" value="Volt DC"/>
+    </leaf>
+      
+    <leaf name="Battery_Current">
+      <param name="hidden"         value="yes"/>
+      <param name="comment"        value="Present battery current"/>
+      <param name="graph-legend"   value="Battery current"/>
+      <param name="precedence"     value="940"/>
+      <param name="rrd-ds"         value="BatteryCurrent"/>
+      <param name="snmp-object"    value="$upsBatteryCurrent"/>
+      <param name="vertical-label" value="0.1 Amp DC"/>
+    </leaf>
+
+    <leaf name="Current">
+      <param name="comment"        value="Present battery current"/>
+      <param name="graph-legend"   value="Battery current"/>
+      <param name="precedence"     value="930"/>
+      <param name="ds-type"        value="rrd-file"/>
+      <param name="leaf-type"      value="rrd-cdef"/>
+      <param name="rpn-expr"       value="{Battery_Current},0.1,*"/>
+      <param name="vertical-label" value="Amp DC"/>
+    </leaf>
+  </template>
+
+  <template name="ups-input-subtree">
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="freq,volt,curr,true"/>
+    <!-- Frequency -->
+    <param name="overview-subleave-name-freq" value="Frequency"/>
+    <param name="overview-shortcut-text-freq"
+           value="All Frequency"/>
+    <param name="overview-shortcut-title-freq"
+           value="Show input frequency for all phases on one page"/>
+    <param name="overview-page-title-freq"
+           value="Input Frequency"/>
+    <!-- Voltage -->
+    <param name="overview-subleave-name-volt" value="Voltage"/>
+    <param name="overview-shortcut-text-volt"
+           value="All Voltage"/>
+    <param name="overview-shortcut-title-volt"
+           value="Show input voltage for all phases on one page"/>
+    <param name="overview-page-title-volt"
+           value="Input Voltage"/>
+    <!-- Current -->
+    <param name="overview-subleave-name-curr" value="Current"/>
+    <param name="overview-shortcut-text-curr"
+           value="All Current"/>
+    <param name="overview-shortcut-title-curr"
+           value="Show input current for all phases on one page"/>
+    <param name="overview-page-title-curr"
+           value="Input Current"/>
+    <!-- TruePower -->
+    <param name="overview-subleave-name-true" value="True_Power"/>
+    <param name="overview-shortcut-text-true"
+           value="All True Power"/>
+    <param name="overview-shortcut-title-true"
+           value="Show input true power for all phases on one page"/>
+    <param name="overview-page-title-true"
+           value="Input True Power"/>
+  </template>
+
+  <template name="ups-input-leaf">
+    <param name="data-file"      value="%system-id%_input_%ups-input-idx%.rrd"/>
+    <param name="comment"           value="Phase %ups-input-idx% input"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+    <leaf name="Input_Frequency">
+      <param name="hidden"         value="yes"/>
+      <param name="comment"        value="Present input frequency"/>
+      <param name="graph-legend"   value="Input frequency"/>
+      <param name="precedence"     value="991"/>
+      <param name="rrd-ds"         value="inputFrequency"/>
+      <param name="snmp-object"    value="$upsInputFrequency.%ups-input-idx%"/>
+      <param name="vertical-label" value="0.1 Hertz"/>
+    </leaf>
+
+    <leaf name="Frequency">
+      <param name="comment"        value="Present input frequency"/>
+      <param name="graph-legend"   value="Input frequency"/>
+      <param name="precedence"     value="990"/>
+      <param name="ds-type"        value="rrd-file"/>
+      <param name="leaf-type"      value="rrd-cdef"/>
+      <param name="rpn-expr"       value="{Input_Frequency},0.1,*"/>
+      <param name="vertical-label" value="Hertz"/>
+    </leaf>
+
+    <leaf name="Voltage">
+      <param name="comment"        value="Magnitude of present input voltage"/>
+      <param name="graph-legend"   value="Input voltage"/>
+      <param name="precedence"     value="980"/>
+      <param name="rrd-ds"         value="inputVoltage"/>
+      <param name="snmp-object"    value="$upsInputVoltage.%ups-input-idx%"/>
+      <param name="vertical-label" value="RMS Volts"/>
+    </leaf>
+
+    <leaf name="Input_Current">
+      <param name="hidden"         value="yes"/>
+      <param name="comment"        value="Magnitude of present input current"/>
+      <param name="graph-legend"   value="Input current"/>
+      <param name="precedence"     value="971"/>
+      <param name="rrd-ds"         value="inputCurrent"/>
+      <param name="snmp-object"    value="$upsInputCurrent.%ups-input-idx%"/>
+      <param name="vertical-label" value="0.1 RMS Amp"/>
+    </leaf>
+
+    <leaf name="Current">
+      <param name="comment"        value="Magnitude of present input current"/>
+      <param name="graph-legend"   value="Input current"/>
+      <param name="precedence"     value="970"/>
+      <param name="ds-type"        value="rrd-file"/>
+      <param name="leaf-type"      value="rrd-cdef"/>
+      <param name="rpn-expr"       value="{Input_Current},0.1,*"/>
+      <param name="vertical-label" value="RMS Amp"/>
+    </leaf>
+
+    <leaf name="True_Power">
+      <param name="comment"      value="Magnitude of present input true power"/>
+      <param name="graph-legend"   value="Input true power"/>
+      <param name="precedence"     value="960"/>
+      <param name="rrd-ds"         value="inputTruePower"/>
+      <param name="snmp-object"    value="$upsInputTruePower.%ups-input-idx%"/>
+      <param name="vertical-label" value="Watts"/>
+    </leaf>
+  </template>
+
+
+  <template name="ups-output-subtree">
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="volt,curr,pwr,load"/>
+    <!-- Voltage -->
+    <param name="overview-subleave-name-volt" value="Voltage"/>
+    <param name="overview-shortcut-text-volt"
+           value="All Voltage"/>
+    <param name="overview-shortcut-title-volt"
+           value="Show output voltage for all phases on one page"/>
+    <param name="overview-page-title-volt"
+           value="Output Voltage"/>
+    <!-- Current -->
+    <param name="overview-subleave-name-curr" value="Current"/>
+    <param name="overview-shortcut-text-curr"
+           value="All Current"/>
+    <param name="overview-shortcut-title-curr"
+           value="Show output current for all phases on one page"/>
+    <param name="overview-page-title-curr"
+           value="Output Current"/>
+    <!-- Power -->
+    <param name="overview-subleave-name-pwr" value="Power"/>
+    <param name="overview-shortcut-text-pwr"
+           value="All True Power"/>
+    <param name="overview-shortcut-title-pwr"
+           value="Show output true power for all phases on one page"/>
+    <param name="overview-page-title-pwr"
+           value="Output True Power"/>
+    <!-- Load -->
+    <param name="overview-subleave-name-load" value="Load"/>
+    <param name="overview-shortcut-text-load"
+           value="All Percentage Load"/>
+    <param name="overview-shortcut-title-load"
+           value="Show output load for all phases on one page"/>
+    <param name="overview-page-title-load"
+           value="Output Load"/>
+  </template>
+
+  <template name="ups-output-leaf">
+    <param name="data-file"    value="%system-id%_output_%ups-output-idx%.rrd"/>
+    <param name="comment"           value="Phase %ups-output-idx% output"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+    <leaf name="Voltage">
+      <param name="comment"       value="Present output voltage"/>
+      <param name="graph-legend"  value="Output Voltage"/>
+      <param name="precedence"    value="990"/>
+      <param name="rrd-ds"        value="outputVoltage"/>
+      <param name="snmp-object"   value="$upsOutputVoltage.%ups-output-idx%"/>
+      <param name="vertical-label" value="RMS Volts"/>
+    </leaf>
+
+    <leaf name="Output_Current">
+      <param name="hidden"        value="yes"/>
+      <param name="comment"       value="Present output current"/>
+      <param name="graph-legend"  value="Output Current"/>
+      <param name="precedence"    value="981"/>
+      <param name="rrd-ds"        value="outputCurrent"/>
+      <param name="snmp-object"   value="$upsOutputCurrent.%ups-output-idx%"/>
+      <param name="vertical-label" value="0.1 RMS Amp"/>
+    </leaf>
+
+    <leaf name="Current">
+      <param name="comment"        value="Present output voltage"/>
+      <param name="graph-legend"   value="Output Current"/>
+      <param name="precedence"     value="980"/>
+      <param name="ds-type"        value="rrd-file"/>
+      <param name="leaf-type"      value="rrd-cdef"/>
+      <param name="rpn-expr"       value="{Output_Current},0.1,*"/>
+      <param name="vertical-label" value="RMS Amp"/>
+    </leaf>
+
+    <leaf name="Power">
+      <param name="comment"        value="Present output true power"/>
+      <param name="graph-legend"   value="Output True Power"/>
+      <param name="precedence"     value="970"/>
+      <param name="rrd-ds"         value="outputTruePower"/>
+      <param name="snmp-object"    value="$upsOutputPower.%ups-output-idx%"/>
+      <param name="vertical-label" value="Watts"/>
+    </leaf>
+
+    <leaf name="Load">
+      <param name="comment"        value="Present capacity used"/>
+      <param name="graph-legend"   value="Capacity load"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="graph-upper-limit" value="100"/>
+      <param name="precedence"     value="960"/>
+      <param name="rrd-ds"         value="outputLoad"/>
+      <param name="snmp-object" value="$upsOutputPercentLoad.%ups-output-idx%"/>
+      <param name="upper-limit"    value="100"/>
+      <param name="vertical-label" value="Percent"/>
+    </leaf>
+  </template>
+
+  <template name="ups-bypass-subtree">
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="volt"/>
+    <!-- Voltage -->
+    <param name="overview-subleave-name-volt" value="Voltage"/>
+    <param name="overview-shortcut-text-volt"
+           value="All Voltage"/>
+    <param name="overview-shortcut-title-volt"
+           value="Show bypass voltage for all phases on one page"/>
+    <param name="overview-page-title-volt"
+           value="Bypass Voltage"/>
+  </template>
+
+  <template name="ups-bypass-leaf">
+    <param name="data-file"    value="%system-id%_bypass%ups-bypass-idx%.rrd"/>
+    <param name="comment"           value="Phase %ups-bypass-idx% bypass"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+    <leaf name="Voltage">
+      <param name="comment"       value="Present bypass voltage"/>
+      <param name="graph-legend"  value="Output Voltage"/>
+      <param name="precedence"    value="990"/>
+      <param name="rrd-ds"        value="bypassVoltage"/>
+      <param name="snmp-object"   value="$upsBypassVoltage.%ups-bypass-idx%"/>
+      <param name="vertical-label" value="RMS Volts"/>
+    </leaf>
+  </template>
+
+</datasources>
+</configuration>
diff --git a/torrus/xmlconfig/generic/rfc1697.rdbms.xml b/torrus/xmlconfig/generic/rfc1697.rdbms.xml
new file mode 100644 (file)
index 0000000..b5708a7
--- /dev/null
@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright (C) 2003 Shawn Ferry
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+   Shawn Ferry <sferry at sevenspace dot com > <lalartu at obscure dot org>
+
+  Authors: Shawn Ferry
+
+  $Id: rfc1697.rdbms.xml,v 1.1 2010-12-27 00:04:29 ivan Exp $
+-->
+<configuration>
+  <definitions>
+    <!-- rdbmsDbTable -->
+    <def name="rdbmsDbName" value="1.3.6.1.2.1.39.1.1.1.4"/>
+
+    <!-- rdbmsDbInfoTable -->
+    <def name="rdbmsDbInfoSizeAllocated" value="1.3.6.1.2.1.39.1.2.1.4"/>
+    <def name="rdbmsDbInfoSizeUsed" value="1.3.6.1.2.1.39.1.2.1.5"/>
+
+    <!-- rdbmsDbSrvInfoTable -->
+    <def name="rdbmsSrvInfoFinishedTransactions"
+                                     value="1.3.6.1.2.1.39.1.6.1.2"/>
+    <def name="rdbmsSrvInfoDiskReads" value="1.3.6.1.2.1.39.1.6.1.3"/>
+    <def name="rdbmsSrvInfoLogicalReads" value="1.3.6.1.2.1.39.1.6.1.4"/>
+    <def name="rdbmsSrvInfoDiskWrites" value="1.3.6.1.2.1.39.1.6.1.5"/>
+    <def name="rdbmsSrvInfoLogicalWrites" value="1.3.6.1.2.1.39.1.6.1.6"/>
+    <def name="rdbmsSrvInfoPageReads" value="1.3.6.1.2.1.39.1.6.1.7"/>
+    <def name="rdbmsSrvInfoPageWrites" value="1.3.6.1.2.1.39.1.6.1.8"/>
+    <def name="rdbmsSrvInfoRequestsHandled" value="1.3.6.1.2.1.39.1.6.1.10"/>
+
+    <!-- Network Services applTable -->
+    <def name="applInboundAssociations" value="1.3.6.1.2.1.27.1.1.8"/>
+
+    <def name="DB_IDX"
+         value="M($rdbmsDbName,%dbName%)"/>
+  </definitions>
+
+  <datasources>
+
+    <template name="rdbms-dbtable">
+      <subtree name="DB_Stats">
+        <param name="precedence" value="1000"/>
+        <param name="data-file"
+                 value="%system-id%_%vendor%_%dbName%_RDBMS.rrd"/>
+        <param name="rrd-hwpredict" value="disabled" />
+        <leaf name="DB_Allocated">
+          <param name="leaf-type"   value="rrd-def"/>
+          <param name="hidden"      value="no"/>
+          <param name="rrd-cf"      value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="collector-scale" value="%dbSizeUnits%,*"/>
+          <param name="snmp-object" value="$rdbmsDbInfoSizeAllocated.$DB_IDX"/>
+          <param name="rrd-ds"      value="dbAllocated"/>
+          <param name="comment" value="Space Allocated to this Database"/>
+          <param name="graph-legend"   value="Allocated Space"/>
+          <param name="vertical-label" value="Bytes"/>
+          <param name="descriptive-nickname"
+            value="%system-id%:%snmp-host% %dbName% Allocated Space"/>
+        </leaf>
+        <leaf name="DB_Used">
+          <param name="leaf-type"   value="rrd-def"/>
+          <param name="hidden"      value="no"/>
+          <param name="rrd-cf"      value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="collector-scale" value="%dbSizeUnits%,*"/>
+          <param name="snmp-object" value="$rdbmsDbInfoSizeAllocated.$DB_IDX"/>
+          <param name="rrd-ds"      value="dbUsed"/>
+          <param name="comment" value="Space Allocated to this Database"/>
+          <param name="graph-legend"   value="Used Space"/>
+          <param name="vertical-label" value="Bytes"/>
+          <param name="descriptive-nickname"
+            value="%system-id%:%snmp-host% %dbName% Used Space"/>
+        </leaf>
+        <leaf name="DB_Finished_Transactions">
+          <param name="leaf-type"   value="rrd-def"/>
+          <param name="hidden"      value="no"/>
+          <param name="rrd-cf"      value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="snmp-object"
+              value="$rdbmsSrvInfoFinishedTransactions.$DB_IDX"/>
+          <param name="rrd-ds"      value="FinishedTrans"/>
+          <param name="comment" value="Finished Transactions (COMMIT/ABORT)"/>
+          <param name="graph-legend"   value="Transactions/s"/>
+          <param name="vertical-label" value="Transactions"/>
+          <param name="descriptive-nickname"
+              value="%system-id%:%snmp-host% %dbName% Finished Transactions"/>
+        </leaf>
+        <leaf name="DB_Disk_Reads">
+          <param name="leaf-type"   value="rrd-def"/>
+          <param name="hidden"      value="no"/>
+            <param name="rrd-cf"      value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="snmp-object" value="$rdbmsSrvInfoDiskReads.$DB_IDX"/>
+          <param name="rrd-ds"      value="DiskReads"/>
+          <param name="comment" value="Disk Reads/s"/>
+          <param name="graph-legend"   value="Disk Reads"/>
+          <param name="vertical-label" value="Disk Reads/s"/>
+          <param name="descriptive-nickname"
+              value="%system-id%:%snmp-host% %dbName% Disk Reads/s"/>
+        </leaf>
+        <leaf name="DB_Logical_Reads">
+          <param name="leaf-type"   value="rrd-def"/>
+          <param name="hidden"      value="no"/>
+          <param name="rrd-cf"      value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="snmp-object" value="$rdbmsSrvInfoLogicalReads.$DB_IDX"/>
+          <param name="rrd-ds"      value="LogicalReads"/>
+          <param name="comment" value="Logical Reads/s"/>
+          <param name="graph-legend"   value="Logical Reads"/>
+          <param name="vertical-label" value="Logical Reads/s"/>
+          <param name="descriptive-nickname"
+              value="%system-id%:%snmp-host% %dbName% Logical Reads/s"/>
+        </leaf>
+        <leaf name="DB_Disk_Writes">
+          <param name="leaf-type"   value="rrd-def"/>
+          <param name="hidden"      value="no"/>
+          <param name="rrd-cf"      value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="snmp-object" value="$rdbmsSrvInfoDiskWrites.$DB_IDX"/>
+          <param name="rrd-ds"      value="DiskWrites"/>
+          <param name="comment" value="Disk Writes/s"/>
+          <param name="graph-legend"   value="Writes"/>
+          <param name="vertical-label" value="Writes/s"/>
+          <param name="descriptive-nickname"
+              value="%system-id%:%snmp-host% %dbName% Disk Writes/s"/>
+        </leaf>
+        <leaf name="DB_Logical_Writes">
+          <param name="leaf-type"   value="rrd-def"/>
+          <param name="hidden"      value="no"/>
+          <param name="rrd-cf"      value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="snmp-object"
+                   value="$rdbmsSrvInfoLogicalWrites.$DB_IDX"/>
+          <param name="rrd-ds"      value="LogicalWrites"/>
+          <param name="comment" value="Logical Writes/s"/>
+          <param name="graph-legend"   value="Logical Writes"/>
+          <param name="vertical-label" value="Logical Writes/s"/>
+          <param name="descriptive-nickname"
+              value="%system-id%:%snmp-host% %dbName% Logical Writes/s"/>
+        </leaf>
+        <leaf name="DB_Page_Writes">
+          <param name="leaf-type"   value="rrd-def"/>
+          <param name="hidden"      value="no"/>
+          <param name="rrd-cf"      value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="snmp-object" value="$rdbmsSrvInfoPageWrites.$DB_IDX"/>
+          <param name="rrd-ds"      value="PageWrites"/>
+          <param name="comment" value="Page Writes/s"/>
+          <param name="graph-legend"   value="Page Writes"/>
+          <param name="vertical-label" value="Page Writes/s"/>
+          <param name="descriptive-nickname"
+              value="%system-id%:%snmp-host% %dbName% Page Writes/s"/>
+        </leaf>
+        <leaf name="DB_Page_Reads">
+          <param name="leaf-type"   value="rrd-def"/>
+          <param name="hidden"      value="no"/>
+          <param name="rrd-cf"      value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="snmp-object" value="$rdbmsSrvInfoPageReads.$DB_IDX"/>
+          <param name="rrd-ds"      value="PageReads"/>
+          <param name="comment" value="Page Reads/s"/>
+          <param name="graph-legend"   value="Page Reads"/>
+          <param name="vertical-label" value="Page Reads/s"/>
+          <param name="descriptive-nickname"
+              value="%system-id%:%snmp-host% %dbName% Page Reads/s"/>
+        </leaf>
+        <leaf name="DB_Request_Rate">
+          <param name="leaf-type"   value="rrd-def"/>
+          <param name="hidden"      value="no"/>
+          <param name="rrd-cf"      value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="snmp-object"
+              value="$rdbmsSrvInfoRequestsHandled.$DB_IDX"/>
+          <param name="rrd-ds"      value="RequestsHandled"/>
+          <param name="comment" value="Requests Handled/s"/>
+          <param name="graph-legend"   value="Requests Handled"/>
+          <param name="vertical-label" value="Requests Handled/s"/>
+          <param name="descriptive-nickname"
+              value="%system-id%:%snmp-host% %dbName% Requests Handled/s"/>
+        </leaf>
+        <leaf name="DB_Inbound_Associations">
+          <param name="leaf-type"   value="rrd-def"/>
+          <param name="hidden"      value="no"/>
+          <param name="rrd-cf"      value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="snmp-object" value="$applInboundAssociations.$DB_IDX"/>
+          <param name="rrd-ds"      value="InboundAssociations"/>
+          <param name="comment" value="Inbound Associations"/>
+          <param name="graph-legend"   value="Inbound Associations"/>
+          <param name="vertical-label" value="Inbound Associations"/>
+          <param name="descriptive-nickname"
+            value="%system-id%:%snmp-host% %dbName% Inbound Associations"/>
+        </leaf>
+      </subtree>
+    </template>
+  </datasources>
+</configuration>
diff --git a/torrus/xmlconfig/generic/rfc2662.adsl-line.xml b/torrus/xmlconfig/generic/rfc2662.adsl-line.xml
new file mode 100644 (file)
index 0000000..1c1ac13
--- /dev/null
@@ -0,0 +1,247 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003  Gord Philpott <gphilpot@mnsi.net>
+   Copyright (C) 2003  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+   $Id: rfc2662.adsl-line.xml,v 1.1 2010-12-27 00:04:29 ivan Exp $
+-->
+
+
+<!--
+   RFC 2662 (ADSL-LINE-MIB)
+   Definitions of Managed Objects for the ADSL Lines
+
+   Tested with:
+      Paradyne Hotwire ATM ADSL Line Card;
+      Model: 8365-B1-000; S/W Release: 02.03.54
+-->
+
+
+<configuration>
+
+<definitions>
+  <!-- ADSL-LINE-MIB -->
+  <def name="adslAtucCurrSnrMgn"         value="1.3.6.1.2.1.10.94.1.1.2.1.4" />
+  <def name="adslAtucCurrAtn"            value="1.3.6.1.2.1.10.94.1.1.2.1.5" />
+  <def name="adslAtucCurrAttainableRate" value="1.3.6.1.2.1.10.94.1.1.2.1.8" />
+  <def name="adslAtucChanCurrTxRate"     value="1.3.6.1.2.1.10.94.1.1.4.1.2" />
+
+  <def name="adslAturCurrSnrMgn"         value="1.3.6.1.2.1.10.94.1.1.3.1.4" />
+  <def name="adslAturCurrAtn"            value="1.3.6.1.2.1.10.94.1.1.3.1.5" />
+  <def name="adslAturCurrAttainableRate" value="1.3.6.1.2.1.10.94.1.1.3.1.8" />
+  <def name="adslAturChanCurrTxRate"     value="1.3.6.1.2.1.10.94.1.1.5.1.2" />
+</definitions>
+
+<datasources>
+
+  <template name="adsl-line-interface">
+  
+    <param name="rrd-hwpredict" value="disabled" />
+
+    <!-- ******* Start: ATUC and ATUR SNR Margin ******* -->
+    <leaf name="Atuc_SnrMgn">
+      <param name="comment"            value="ATUC SNR Margin" />
+      <param name="snmp-object"  value="$adslAtucCurrSnrMgn.%ifindex-map%" />
+      <param name="collector-scale"    value="10,/" />
+      <param name="rrd-ds"             value="AtucSnrMgn" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_adsl-stats.rrd" />
+      <param name="hidden"             value="yes" />
+    </leaf>
+
+    <leaf name="Atur_SnrMgn">
+      <param name="comment"            value="ATUR SNR Margin" />
+      <param name="snmp-object"  value="$adslAturCurrSnrMgn.%ifindex-map%" />
+      <param name="collector-scale"    value="10,/" />
+      <param name="rrd-ds"             value="AturSnrMgn" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_adsl-stats.rrd" />
+      <param name="hidden"             value="yes" />
+    </leaf>
+
+    <leaf name="SNR_Margin">               <!-- Multiple line graph -->
+      <param name="comment"            value="ATUC and ATUR SNR Margin" />
+      <param name="precedence"         value="100" />
+      <param name="ds-type"            value="rrd-multigraph" />
+      <param name="ds-names"           value="atuc,atur" />
+
+      <param name="ds-expr-atuc"       value="{Atuc_SnrMgn}" />
+      <param name="graph-legend-atuc"  value="ATUC SNR Margin" />
+      <param name="line-style-atuc"    value="##nearend" />
+      <param name="line-color-atuc"    value="##nearend" />
+      <param name="line-order-atuc"    value="1" />
+
+      <param name="ds-expr-atur"       value="{Atur_SnrMgn}" />
+      <param name="graph-legend-atur"  value="ATUR SNR Margin" />
+      <param name="line-style-atur"    value="##farend" />
+      <param name="line-color-atur"    value="##farend" />
+      <param name="line-order-atur"    value="2" />
+
+      <param name="vertical-label"      value="dB" />
+      <param name="graph-lower-limit"   value="0" />
+    </leaf>
+    <!-- ******* End: ATUC and ATUR SNR Margin ******* -->
+
+    <!-- ******* Start: ATUC and ATUR Attenuation ******* -->
+    <leaf name="Atuc_Atn">
+      <param name="comment"            value="ATUC Attenuation" />
+      <param name="snmp-object"   value="$adslAtucCurrAtn.%ifindex-map%" />
+      <param name="collector-scale"    value="10,/" />
+      <param name="rrd-ds"             value="AtucAtn" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_adsl-stats.rrd" />
+      <param name="hidden"             value="yes" />
+    </leaf>
+
+    <leaf name="Atur_Atn">
+      <param name="comment"            value="ATUR Attenuation" />
+      <param name="snmp-object"   value="$adslAturCurrAtn.%ifindex-map%" />
+      <param name="collector-scale"    value="10,/" />
+      <param name="rrd-ds"             value="AturAtn" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_adsl-stats.rrd" />
+      <param name="hidden"             value="yes" />
+    </leaf>
+
+    <leaf name="Attenuation">          <!-- Multiple line graph -->
+      <param name="comment"            value="ATUC and ATUR Attenuation" />
+      <param name="ds-type"            value="rrd-multigraph" />
+      <param name="ds-names"           value="atuc,atur" />
+
+      <param name="ds-expr-atuc"       value="{Atuc_Atn}" />
+      <param name="graph-legend-atuc"  value="ATUC SNR Margin" />
+      <param name="line-style-atuc"    value="##nearend" />
+      <param name="line-color-atuc"    value="##nearend" />
+      <param name="line-order-atuc"    value="1" />
+
+      <param name="ds-expr-atur"       value="{Atur_Atn}" />
+      <param name="graph-legend-atur"  value="ATUR SNR Margin" />
+      <param name="line-style-atur"    value="##farend" />
+      <param name="line-color-atur"    value="##farend" />
+      <param name="line-order-atur"    value="2" />
+
+      <param name="vertical-label"      value="dB" />
+      <param name="graph-lower-limit"   value="0" />
+    </leaf>
+    <!-- ******* End: ATUC and ATUR SNR Margin ******* -->
+
+
+    <!-- ******* Start: ATUC Attainable Rates ******* -->
+    <leaf name="Atuc_AttainableRate">
+      <param name="comment"            value="ATUC Attainable Rate" />
+      <param name="snmp-object"
+             value="$adslAtucCurrAttainableRate.%ifindex-map%" />
+      <param name="rrd-ds"             value="AtucAttainableRate" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_adsl-stats.rrd" />
+      <param name="graph-legend"       value="ATUC Attainable Rate" />
+      <param name="hidden"             value="yes" />
+    </leaf>
+
+    <leaf name="Atuc_CurrTxRate">
+      <param name="comment"            value="ATUC Current TX Rate" />
+      <param name="snmp-object"
+             value="$adslAtucChanCurrTxRate.%ifindex-map%" />
+      <param name="rrd-ds"             value="AtucCurrTxRate" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_adsl-stats.rrd" />
+      <param name="graph-legend"       value="ATUC Curr TX Rate" />
+      <param name="hidden"             value="yes" />
+    </leaf>
+
+    <leaf name="ATUC_TX_Rates">          <!-- Multiple line graph -->
+      <param name="comment"            value="ATUC TX Rates" />
+      <param name="precedence"         value="90" />
+      <param name="ds-type"            value="rrd-multigraph" />
+      <param name="ds-names"           value="attain,curr" />
+
+      <param name="ds-expr-attain"       value="{Atuc_AttainableRate}" />
+      <param name="graph-legend-attain"  value="ATUC Attainable Rate" />
+      <param name="line-style-attain"    value="##maxvalue" />
+      <param name="line-color-attain"    value="##maxvalue" />
+      <param name="line-order-attain"    value="1" />
+
+      <param name="ds-expr-curr"       value="{Atuc_CurrTxRate}" />
+      <param name="graph-legend-curr"  value="ATUC Curr TX Rate" />
+      <param name="line-style-curr"    value="##currvalue" />
+      <param name="line-color-curr"    value="##currvalue" />
+      <param name="line-order-curr"    value="2" />
+
+      <param name="vertical-label"      value="bps" />
+      <param name="graph-lower-limit"   value="0" />
+    </leaf>
+    <!-- ******* End: ATUC TX Rates ******* -->
+
+    <!-- ******* Start: ATUR TX Rates ******* -->
+    <leaf name="Atur_AttainableRate">
+      <param name="comment"            value="ATUR Attainable Rate" />
+      <param name="snmp-object"
+             value="$adslAturCurrAttainableRate.%ifindex-map%" />
+      <param name="rrd-ds"             value="AturAttainableRate" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_adsl-stats.rrd" />
+      <param name="graph-legend"       value="ATUR Attainable Rate" />
+      <param name="hidden"             value="yes" />
+    </leaf>
+
+    <leaf name="Atur_CurrTxRate">
+      <param name="comment"            value="ATUR Current TX Rate" />
+      <param name="snmp-object"
+             value="$adslAturChanCurrTxRate.%ifindex-map%" />
+      <param name="rrd-ds"             value="AturCurrTxRate" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_adsl-stats.rrd" />
+      <param name="graph-legend"       value="ATUR Current TX Rate" />
+      <param name="hidden"             value="yes" />
+    </leaf>
+
+    <leaf name="ATUR_TX_Rates">          <!-- Multiple line graph -->
+      <param name="comment"            value="ATUR TX Rates" />
+      <param name="precedence"         value="70" />
+      <param name="ds-type"            value="rrd-multigraph" />
+      <param name="ds-names"           value="attain,curr" />
+
+      <param name="ds-expr-attain"       value="{Atur_AttainableRate}" />
+      <param name="graph-legend-attain"  value="ATUR Attainable Rate" />
+      <param name="line-style-attain"    value="##maxvalue" />
+      <param name="line-color-attain"    value="##maxvalue" />
+      <param name="line-order-attain"    value="1" />
+
+      <param name="ds-expr-curr"       value="{Atur_CurrTxRate}" />
+      <param name="graph-legend-curr"  value="ATUR Curr TX Rate" />
+      <param name="line-style-curr"    value="##currvalue" />
+      <param name="line-color-curr"    value="##currvalue" />
+      <param name="line-order-curr"    value="2" />
+
+      <param name="vertical-label"      value="bps" />
+      <param name="graph-lower-limit"   value="0" />
+    </leaf>
+    <!-- ******* End: ATUR TX Rates ******* -->
+
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/generic/rfc2670.docsis-if.xml b/torrus/xmlconfig/generic/rfc2670.docsis-if.xml
new file mode 100644 (file)
index 0000000..7756ca6
--- /dev/null
@@ -0,0 +1,347 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003  Roman Hochuli, Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: rfc2670.docsis-if.xml,v 1.1 2010-12-27 00:04:30 ivan Exp $
+  Roman Hochuli <roman@hochu.li>
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+  SEE ALSO: xmlconfig/examples/docsis-monitors.xml
+  
+-->
+
+<configuration>
+
+<definitions>
+  <!-- DOCS-IF-MIB::docsIfSignalQualityTable -->
+  <def name="docsIfSigQUnerroreds"      value="1.3.6.1.2.1.10.127.1.1.4.1.2"/>
+  <def name="docsIfSigQCorrecteds"      value="1.3.6.1.2.1.10.127.1.1.4.1.3"/>
+  <def name="docsIfSigQUncorrectables"  value="1.3.6.1.2.1.10.127.1.1.4.1.4"/>
+  <def name="docsIfSigQSignalNoise"     value="1.3.6.1.2.1.10.127.1.1.4.1.5"/>
+
+  <!-- DOCS-IF-MIB::docsIfUpstreamChannelTable -->
+  <def name="docsIfUpChannelFrequency"  value="1.3.6.1.2.1.10.127.1.1.2.1.2"/>
+    
+  <!-- DOCS-IF-MIB::docsIfCmtsDownChannelCounterTable -->
+  <def name="docsIfCmtsDownChnlCtrExtTotalBytes"
+                                value="1.3.6.1.2.1.10.127.1.3.10.1.4"/>
+  <def name="docsIfCmtsDownChnlCtrExtUsedBytes"
+                                value="1.3.6.1.2.1.10.127.1.3.10.1.5"/>
+</definitions>
+
+<datasources>
+
+  <template name="docsis-subtree-common">
+    <!-- nodeid-docsif is overwritten by devdiscover at the
+         interface level. This definition is here for backward compatibility
+         with older discovery results or for systems which do not use
+         devdiscover -->
+    <param name="nodeid-docsif"
+      value="docs//%nodeid-device%//%interface-nick%//"/>
+  </template>
+
+  
+  <template name="docsis-upstream-subtree">
+    <apply-template name="docsis-subtree-common"/>
+    <param name="precedence"           value="-500" />
+    <param name="comment"        value="DOCSIS upstream channel statistics" />
+    <param name="data-file">
+       %system-id%_%interface-nick%_docsis_upstream.rrd
+    </param>
+    <param name="collector-timeoffset-hashstring"
+                                       value="%system-id%:%interface-nick%" />
+    <param name="descriptive-nickname" value="%system-id%:%interface-name%"/>
+    <param name="graph-title"          value="%descriptive-nickname%" />
+
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="snr,fec,freq"/>
+    
+    <param name="overview-subleave-name-snr" value="SNR"/>
+    <param name="overview-direct-link-snr"      value="yes"/>
+    <param name="overview-direct-link-view-snr" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-snr"
+           value="All SNR"/>
+    <param name="overview-shortcut-title-snr"
+           value="Show signal quality graphs for all upstreams in one page"/>
+    <param name="overview-page-title-snr"
+           value="SNR Graphs"/>
+
+    <param name="overview-subleave-name-fec" value="FEC_Summary"/>
+    <param name="overview-direct-link-fec"      value="yes"/>
+    <param name="overview-direct-link-view-fec" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-fec"
+           value="All FEC"/>
+    <param name="overview-shortcut-title-fec"
+           value="Show FEC statistics for all upstreams in one page"/>
+    <param name="overview-page-title-fec"
+           value="FEC Graphs"/>
+                      
+    <param name="overview-subleave-name-freq" value="Frequency"/>
+    <param name="overview-direct-link-freq"      value="yes"/>
+    <param name="overview-direct-link-view-freq" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-freq"
+           value="All Frequency"/>
+    <param name="overview-shortcut-title-freq"
+           value="Show all upstream frequenciesin one page"/>
+    <param name="overview-page-title-freq"
+           value="Upstream frequency Graphs"/>
+
+    <param name="rrd-hwpredict"     value="disabled" />
+  </template>
+  
+  <template name="docsis-signal-quality-codewords">
+    <param name="rrd-create-dstype"   value="COUNTER" />
+    <param name="vertical-label"      value="Codewords/s" />
+    <param name="graph-lower-limit"   value="0" />
+  </template>
+
+  <template name="docsis-upstream-stats">
+    <leaf name="SNR">
+      <param name="snmp-object"  value="$docsIfSigQSignalNoise.%ifindex-map%"/>
+
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="rrd-ds"              value="SNR" />
+      <param name="collector-scale"     value="10,/" />
+
+      <param name="comment"             value="Signal/Noise Ratio" />
+      <param name="graph-legend"        value="Signal/Noise Ratio" />
+      <param name="vertical-label"      value="dB" />
+
+      <param name="normal-level"        value="25" />
+      <param name="lower-limit"         value="18" />
+      <param name="graph-lower-limit"   value="10" />
+      <param name="graph-upper-limit"   value="30" />
+
+      <param name="precedence"          value="1000" />
+
+      <!-- This monitor may be redefined by
+           DocsisUpSNRMonitor selector action -->
+      <param name="monitor"             value="docsis-snr-lower-20db" />
+      
+      <param name="nodeid"            value="%nodeid-docsif%//snr"/>
+    </leaf>
+
+    
+    <leaf name="FEC_Summary">
+      <param name="ds-type"           value="rrd-multigraph" />
+      <param name="ds-names"          value="corr,uncorr" />
+      <param name="nodeid"            value="%nodeid-docsif%//fec"/>
+
+      <param name="graph-lower-limit"       value="0.01" />
+      <param name="graph-upper-limit"       value="100" />
+      <param name="graph-logarithmic"       value="yes" />
+      <param name="graph-rigid-boundaries"  value="yes" />
+      
+      <param name="precedence"        value="950" />
+      <param name="comment"
+              value="Reed-Solomon forward error correction (FEC) summary" />
+      <param name="vertical-label"    value="Percent" />
+
+      <param name="ds-expr-corr">
+      {Correctable},{Error-Free},{Correctable},{Uncorrectable},+,+,/,100,*
+      </param>
+      <param name="graph-legend-corr"  value="Correctable Codewords" />
+      <param name="line-style-corr"      value="##SingleGraph" />
+      <param name="line-color-corr"      value="##green" />
+      <param name="line-order-corr"      value="1" />
+
+      <param name="ds-expr-uncorr">
+      {Uncorrectable},{Error-Free},{Correctable},{Uncorrectable},+,+,/,100,*
+      </param>
+      <param name="graph-legend-uncorr"  value="Uncorrectable Codewords" />
+      <param name="line-style-uncorr"    value="##SingleGraph" />
+      <param name="line-color-uncorr"    value="##red" />
+      <param name="line-order-uncorr"    value="2" />
+    </leaf>
+
+    <leaf name="Error-Free">
+      <apply-template name="docsis-signal-quality-codewords"/>
+      <param name="snmp-object"  value="$docsIfSigQUnerroreds.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Unerroreds" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="FEC codewords received on this channel without error"/>
+      <param name="graph-legend" value="Error-free Codewords" />
+      <param name="precedence"   value="900" />
+      <param name="graph-lower-limit"       value="0.01" />
+      <param name="graph-upper-limit"       value="100" />
+      <param name="graph-logarithmic"       value="yes" />
+      <param name="graph-rigid-boundaries"  value="yes" />
+    </leaf>
+
+    <leaf name="Correctable">
+      <apply-template name="docsis-signal-quality-codewords"/>
+      <param name="snmp-object"  value="$docsIfSigQCorrecteds.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Correcteds" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="FEC codewords received on this channel correctable errors"/>
+      <param name="graph-legend" value="Correctable Codewords" />
+      <param name="precedence"   value="800" />
+      <param name="monitor-action-target"  value="FEC_Summary"/>
+      <param name="graph-lower-limit"       value="0.01" />
+      <param name="graph-upper-limit"       value="100" />
+      <param name="graph-logarithmic"       value="yes" />
+      <param name="graph-rigid-boundaries"  value="yes" />
+    </leaf>
+
+    <leaf name="Uncorrectable">
+      <apply-template name="docsis-signal-quality-codewords"/>
+      <param name="snmp-object"
+                        value="$docsIfSigQUncorrectables.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Uncorrectables" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="FEC codewords received on this channel uncorrectable errors"/>
+      <param name="graph-legend" value="Uncorrectable Codewords" />
+      <param name="precedence"   value="700" />
+      <param name="monitor-action-target"  value="FEC_Summary"/>
+      <param name="graph-lower-limit"       value="0.01" />
+      <param name="graph-upper-limit"       value="100" />
+      <param name="graph-logarithmic"       value="yes" />
+      <param name="graph-rigid-boundaries"  value="yes" />
+    </leaf>
+    
+    <leaf name="Frequency">
+      <param name="snmp-object"
+                        value="$docsIfUpChannelFrequency.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Frequency" />
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="vertical-label"      value="Hz" />
+      <param name="comment"
+          value="Upstream frequency"/>
+      <param name="graph-legend" value="Frequency" />
+      <param name="precedence"   value="600" />
+      <param name="nodeid"            value="%nodeid-docsif%//frequency"/>
+    </leaf>
+  </template>
+
+
+
+  <template name="docsis-downstream-subtree">
+    <apply-template name="docsis-subtree-common"/>
+    <param name="precedence"           value="-500" />
+    <param name="comment"        value="DOCSIS downstream statistics" />
+    <param name="data-file">
+       %system-id%_%interface-nick%_docsis_downstream.rrd
+    </param>
+    <param name="collector-timeoffset-hashstring"
+                                       value="%system-id%:%interface-nick%" />
+    <param name="descriptive-nickname" value="%system-id%:%interface-name%"/>
+    <param name="graph-title"          value="%descriptive-nickname%" />
+
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="util"/>
+    <param name="overview-subleave-name-util" value="Utilization"/>
+    <param name="overview-direct-link-util"      value="yes"/>
+    <param name="overview-direct-link-view-util" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-util"
+           value="All Utilization"/>
+    <param name="overview-shortcut-title-util"
+           value="Show utilization graphs for all downstreams in one page"/>
+    <param name="overview-page-title-util"
+           value="Downstream Utilization Graphs"/>
+    <param name="rrd-hwpredict"     value="disabled" />
+  </template>
+
+  
+  <template name="docsis-downstream-util">  
+    <leaf name="Utilization">
+      <param name="ds-type"           value="rrd-multigraph" />
+      <param name="ds-names"          value="util" />
+      <param name="nodeid"            value="%nodeid-docsif%//util"/>
+
+      <param name="graph-lower-limit"  value="0" />
+      <param name="graph-upper-limit"  value="100" />
+
+      <param name="precedence"        value="950" />
+      <param name="comment"
+              value="Downstream channel utilization" />
+      <param name="vertical-label"    value="Percent" />
+
+      <param name="ds-expr-util">
+        {UsedBytes},{TotalBytes},/,100,*
+      </param>
+      <param name="graph-legend-util"  value="Utilization" />
+      <param name="line-style-util"      value="##resourceusage" />
+      <param name="line-color-util"      value="##resourceusage" />
+      <param name="line-order-util"      value="1" />
+    </leaf>
+    
+    <leaf name="TotalBytes">
+      <param name="rrd-create-dstype"   value="COUNTER" />
+      <param name="snmp-object-type"    value="COUNTER64" />
+      <param name="vertical-label"      value="Bytes/s" />
+      <param name="graph-lower-limit"   value="0" />
+      <param name="snmp-object"
+               value="$docsIfCmtsDownChnlCtrExtTotalBytes.%ifindex-map%"/>
+      <param name="rrd-ds"       value="TotalBytes" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment">
+        The total number of bytes in the Payload portion
+      </param>
+      <param name="graph-legend" value="Total Bytes" />
+      <param name="precedence"   value="800" />
+    </leaf>
+    
+    <leaf name="UsedBytes">
+      <param name="rrd-create-dstype"   value="COUNTER" />
+      <param name="snmp-object-type"    value="COUNTER64" />
+      <param name="vertical-label"      value="Bytes/s" />
+      <param name="graph-lower-limit"   value="0" />
+      <param name="snmp-object"
+               value="$docsIfCmtsDownChnlCtrExtUsedBytes.%ifindex-map%"/>
+      <param name="rrd-ds"       value="UsedBytes" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment">
+       The total number of DOCSIS data bytes transported by this downstream
+       channel
+      </param>
+      <param name="graph-legend" value="Used Bytes" />
+      <param name="precedence"   value="800" />
+      <param name="monitor-action-target"  value="Utilization"/>
+    </leaf>  
+  </template>  
+  
+</datasources>
+
+<monitors>
+
+    <monitor name="docsis-snr-lower-20db">
+      <param name="monitor-type"  value="expression" />
+      <param name="rpn-expr"      value="DUP,0,GT,EXC,20,LT,AND" />
+      <param name="action"        value="docsis-snr-lower-20" />
+      <param name="expires"       value="3600" />
+      <param name="comment">
+        Signal/Noise-Ratio was lower than 20dB
+      </param>
+    </monitor>
+
+    <action name="docsis-snr-lower-20">
+      <param name="action-type"     value="tset" />
+      <param name="tset-name"       value="docsis-snr-lower-20" />
+    </action>
+
+</monitors>
+
+<token-sets>
+    <token-set name="docsis-snr-lower-20">
+      <param name="comment" value="S/N Ratio less than 20dB" />
+    </token-set>
+</token-sets>
+
+</configuration>
diff --git a/torrus/xmlconfig/generic/rfc2790.host-resources.xml b/torrus/xmlconfig/generic/rfc2790.host-resources.xml
new file mode 100644 (file)
index 0000000..ed54013
--- /dev/null
@@ -0,0 +1,155 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright (C) 2003 Shawn Ferry, Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+   Shawn Ferry <sferry at sevenspace dot com > <lalartu at obscure dot org>
+
+  Authors: Shawn Ferry, Stanislav Sinyagin
+  Vendor: HOST-RESOURCES-MIB
+
+  $Id: rfc2790.host-resources.xml,v 1.1 2010-12-27 00:04:31 ivan Exp $
+  @(#) 10/18/03 rfc2790.host-resources.xml 1.10 (10/18/03 19:24:09) sferry
+-->
+<!--
+
+    NOTE:    Graphing of storage data is not working as expected.
+
+-->
+<!--
+    Generic MIB definitions and templates for:
+
+        The templates defined in this file should work with any
+        snmp implementation supporting:
+
+        HOST-RESOURCES-MIB (RFC 2790)
+    -->
+<configuration>
+  <definitions>
+    <!-- HOST-RESOURCES-MIB -->
+    <def name="hrSystemUptime"           value="1.3.6.1.2.1.25.1.1.0"/>
+    <def name="hrSystemNumUsers"         value="1.3.6.1.2.1.25.1.5.0"/>
+    <def name="hrSystemProcesses"        value="1.3.6.1.2.1.25.1.6.0"/>
+    <def name="hrSystemMaxProcesses"     value="1.3.6.1.2.1.25.1.7.0"/>
+    <def name="hrMemorySize"             value="1.3.6.1.2.1.25.2.2.0"/>
+    <!--  HOST-RESOURCES-MIB hrStorageTable -->
+    <def name="hrStorageDescr"           value="1.3.6.1.2.1.25.2.3.1.3"/>
+    <!-- The size in bytes of each allocated unit -->
+    <def name="hrStorageAllocationUnits" value="1.3.6.1.2.1.25.2.3.1.4"/>
+    <!-- Size in Allocation units -->
+    <def name="hrStorageSize"            value="1.3.6.1.2.1.25.2.3.1.5"/>
+    <!-- Size in Allocation units -->
+    <def name="hrStorageUsed"            value="1.3.6.1.2.1.25.2.3.1.6"/>
+    <def name="hrStorageAllocationFailures" value="1.3.6.1.2.1.25.2.3.1.7"/>
+    <def name="hrStorage_IDX"
+         value="M($hrStorageDescr,%storage-description%)"/>
+  </definitions>
+
+  <datasources>
+
+    <template name="hr-system-performance-subtree">
+      <param name="comment"    value="System, CPU and memory statistics" />
+      <param name="devdiscover-nodetype"
+                               value="RFC2790_HOST_RESOURCES::sysPerf" />
+      <param name="rrd-hwpredict" value="disabled" />
+    </template>
+    
+    <template name="hr-system-uptime">
+      <leaf name="hrSystemUptime">
+        <param name="data-file"       value="%system-id%_hrSysUptime.rrd"/>
+        <param name="leaf-type"         value="rrd-def"/>
+        <param name="hidden"            value="yes"/>
+        <param name="snmp-object"       value="$hrSystemUptime"/>
+        <param name="rrd-ds"            value="hrSystemUptime"/>
+        <param name="rrd-cf"            value="LAST"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment"
+            value="System Uptime in Ticks (1/100th Second)"/>
+        <param name="graph-legend"      value="Uptime in Ticks"/>
+        <param name="vertical-label"    value="Ticks"/>
+        <param name="rrd-create-rra"    value="RRA:LAST:0:1:10080"/>
+      </leaf>
+      <leaf name="Uptime">
+        <param name="vertical-label" value="Days"/>
+        <param name="comment" value="Uptime"/>
+        <param name="ds-type" value="rrd-multigraph"/>
+        <param name="ds-names" value="Days"/>
+        <!-- Days -->
+        <param name="ds-expr-Days"> 
+          {hrSystemUptime},8640000,/
+        </param>
+        <param name="graph-legend-Days" value="Days"/>
+        <param name="line-style-Days" value="AREA"/>
+        <param name="line-color-Days" value="##green"/>
+        <param name="line-order-Days" value="3"/>
+      </leaf>
+    </template>
+
+    <template name="hr-system-num-users">
+        <leaf name="Users">
+        <param name="data-file"   value="%system-id%_hrSystem.rrd"/>
+        <param name="leaf-type"         value="rrd-def"/>
+        <param name="snmp-object"       value="$hrSystemNumUsers"/>
+        <param name="rrd-ds"            value="hrSystemNumUsers"/>
+        <param name="rrd-cf"            value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment"      value="Number of Users on the System"/>
+        <param name="vertical-label"    value="Count"/>
+        <param name="graph-legend"      value="Users"/>
+        <param name="graph-lower-limit" value="0" />
+      </leaf>
+    </template>
+
+    <template name="hr-system-processes">
+      <leaf name="Processes">
+        <param name="data-file"   value="%system-id%_hrSystem.rrd"/>
+        <param name="leaf-type"         value="rrd-def"/>
+        <param name="snmp-object"       value="$hrSystemProcesses"/>
+        <param name="rrd-ds"            value="hrSystemProcesses"/>
+        <param name="rrd-cf"            value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment"           value="Number of Processes"/>
+        <param name="graph-legend"      value="Processes"/>
+        <param name="vertical-label"    value="Count"/>
+        <param name="graph-lower-limit" value="0" />
+      </leaf>
+    </template>
+
+    <template name="hr-storage-subtree">
+      <param name="comment"    value="Storage Devices Usage" />
+      <param name="devdiscover-nodetype"
+                               value="RFC2790_HOST_RESOURCES::storageUsed" />
+      <param name="collector-timeoffset-hashstring"
+                               value="%system-id%:%storage-nick%" />
+      <param name="rrd-hwpredict" value="disabled" />
+    </template>
+        
+    <template name="hr-storage-usage">
+      <param name="data-file" value="%system-id%_%storage-nick%_usage.rrd"/>
+      <param name="comment"           value="Storage space used"/>
+      <param name="leaf-type"         value="rrd-def"/>
+      <param name="snmp-object"       value="$hrStorageUsed.$hrStorage_IDX"/>
+      <param name="rrd-scaling-base"  value="1024"/>
+      <param name="rrd-ds"            value="hrStorageUsed"/>
+      <param name="rrd-cf"            value="AVERAGE"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="graph-legend"      value="Space Used"/>
+      <param name="vertical-label"    value="Bytes"/>
+      <param name="graph-lower-limit" value="0" />
+    </template>
+
+  </datasources>
+</configuration>
diff --git a/torrus/xmlconfig/generic/rfc2863.if-mib.xml b/torrus/xmlconfig/generic/rfc2863.if-mib.xml
new file mode 100644 (file)
index 0000000..faa8dfe
--- /dev/null
@@ -0,0 +1,538 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: rfc2863.if-mib.xml,v 1.1 2010-12-27 00:04:30 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!--
+  RFC2863 IF-MIB definitions
+-->
+
+<configuration>
+
+<param-properties>
+  <!-- Parameters which are included in search DB -->
+  <prop param="interface-name"               prop="search" value="1"/>
+  <prop param="interface-macaddr"            prop="search" value="1"/>
+  <prop param="interface-macaddr"            prop="search" value="1"/>
+  <prop param="interface-nick"               prop="search" value="1"/>
+  
+</param-properties>
+
+
+<definitions>
+  <!-- IF-MIB:ifTable  -->
+  <def name="ifDescr"           value="1.3.6.1.2.1.2.2.1.2" />
+  <def name="ifSpeed"           value="1.3.6.1.2.1.2.2.1.5" />
+  <def name="ifPhysAddress"     value="1.3.6.1.2.1.2.2.1.6" />
+  <def name="ifInOctets"        value="1.3.6.1.2.1.2.2.1.10" />
+  <def name="ifInUcastPkts"     value="1.3.6.1.2.1.2.2.1.11" />
+  <def name="ifInDiscards"      value="1.3.6.1.2.1.2.2.1.13" />
+  <def name="ifInErrors"        value="1.3.6.1.2.1.2.2.1.14" />
+  <def name="ifOutOctets"       value="1.3.6.1.2.1.2.2.1.16" />
+  <def name="ifOutUcastPkts"    value="1.3.6.1.2.1.2.2.1.17" />
+  <def name="ifOutDiscards"     value="1.3.6.1.2.1.2.2.1.19" />
+  <def name="ifOutErrors"       value="1.3.6.1.2.1.2.2.1.20" />
+
+  <!-- IF-MIB:ifXTable -->
+  <def name="ifName"            value="1.3.6.1.2.1.31.1.1.1.1" />
+  <def name="ifHCInOctets"      value="1.3.6.1.2.1.31.1.1.1.6" />
+  <def name="ifHCInUcastPkts"   value="1.3.6.1.2.1.31.1.1.1.7" />
+  <def name="ifHCOutOctets"     value="1.3.6.1.2.1.31.1.1.1.10" />
+  <def name="ifHCOutUcastPkts"  value="1.3.6.1.2.1.31.1.1.1.11" />
+
+  <!-- RFC1213-MIB:ipAddrTable -->
+  <def name="ipAdEntIfIndex"   value="1.3.6.1.2.1.4.20.1.2" />
+
+  <!-- Interface indices -->
+  <def name="IFIDX_DESCR"   value="M($ifDescr, %interface-name%)" />
+  <def name="IFIDX_MAC"     value="M($ifPhysAddress, %interface-macaddr%)" />
+  <def name="IFIDX_IP"      value="V(ipAdEntIfIndex.%interface-ipaddr%)" />
+  <def name="IFIDX_IFINDEX" value="%interface-index%" />
+
+</definitions>
+
+<datasources>
+
+  <!-- Some parameters need to be at host level -->
+  <template name="rfc2863-ifmib-hostlevel">
+    <param name="ifindex-map" value="M(%ifindex-table%, %interface-name%)"/>
+    <param name="ifindex-table" value="$ifDescr" />
+    
+    <!-- nodeid-interface is overwritten by devdiscover at the
+         interface level. This definition is here for backward compatibility
+         with older discovery results or for systems which do not use
+         devdiscover -->
+    <param name="nodeid-interface"
+      value="if//%nodeid-device%//%interface-nick%//"/>
+      
+  </template>
+
+  <!-- Parameters for interfaces parent subtree -->
+  <template name="rfc2863-ifmib-subtree">
+    <param name="node-display-name"  value="Interfaces"/>
+    <param name="comment" value="Interface traffic and error counters"/>
+    
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="traffic,errors"/>
+    
+    <param name="overview-subleave-name-traffic" value="InOut_bps"/>
+    <param name="overview-shortcut-text-traffic"
+           value="All traffic"/>
+    <param name="overview-shortcut-title-traffic"
+           value="Show traffic for all interfaces on one page"/>
+    <param name="overview-page-title-traffic"
+           value="Input/Output Graphs"/>
+
+    <param name="overview-subleave-name-errors"
+           value="Discards_In,Discards_Out,Errors_In,Errors_Out"/>
+    <param name="overview-shortcut-text-errors"
+           value="All errors"/>
+    <param name="overview-shortcut-title-errors"
+           value="Show all interface errors on one page"/>
+    <param name="overview-page-title-errors"
+           value="Interface errors"/>
+
+    <param name="overview-subleave-name-bandwidth"
+           value="Bandwidth_Usage"/>
+    <param name="overview-shortcut-text-bandwidth"
+           value="All bandwidth"/>
+    <param name="overview-shortcut-title-bandwidth"
+           value="Show all bandwidth usage on one page"/>
+    <param name="overview-page-title-bandwidth"
+           value="Bandwidth usage"/>
+           
+    <param name="descriptive-nickname" value="%system-id%:%interface-name%"/>
+    <param name="data-file" value="%system-id%_%interface-nick%_if-mib.rrd" />
+    <param name="graph-title" value="%descriptive-nickname%" />
+    <param name="collector-timeoffset-hashstring"
+           value="%system-id%:%interface-nick%" />
+    <param name="help-text">
+    The default view shows the device's network interfaces for which
+    the traffic statistics are available. Expanded view can be seen by
+    clicking the [%em('Show InOut_bps for all interfaces')%] shortcut.
+    It would show input/output graphs for all interfaces on a single page.
+    </param>
+  </template>
+
+  <template name="iftable-octets">
+    <leaf name="Bytes_In">
+      <param name="snmp-object"       value="$ifInOctets.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifInOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="ext-dstype"        value="COUNTER32" />
+      <param name="comment"  value="Input byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes in" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="990" />
+      <param name="monitor-action-target"  value="InOut_bps"/>
+      <param name="nodeid"            value="%nodeid-interface%//inbytes"/>
+     </leaf>
+
+    <leaf name="Bytes_Out">
+      <param name="snmp-object"       value="$ifOutOctets.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifOutOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="ext-dstype"        value="COUNTER32" />
+      <param name="comment" value="Output byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes out" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="980" />
+      <param name="monitor-action-target"  value="InOut_bps"/>
+      <param name="nodeid"            value="%nodeid-interface%//outbytes"/>
+    </leaf>
+
+    <leaf name="InOut_bps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="1000" />
+      <param name="nodeid"           value="%nodeid-interface%//inoutbit"/>
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{Bytes_In},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{Bytes_Out},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+  </template>
+
+  <!-- Some interface instances (e.g. serial subinterfaces in Coisco routers)
+       don't have UcastPkts and Errors counters -->
+
+  <template name="iftable-ucast-packets">
+    <leaf name="Packets_In">
+      <param name="snmp-object"       value="$ifInUcastPkts.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifInUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Input packet counter for the interface" />
+      <param name="graph-legend"      value="Packets in" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="890" />
+      <param name="nodeid"            value="%nodeid-interface%//inpackets"/>
+    </leaf>
+
+    <leaf name="Packets_Out">
+      <param name="snmp-object"       value="$ifOutUcastPkts.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifOutUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Output packet counter for the interface" />
+      <param name="graph-legend"      value="Packets out" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="880" />
+      <param name="nodeid"            value="%nodeid-interface%//outpackets"/>
+    </leaf>
+  </template>
+
+  <template name="iftable-discards-in">
+    <leaf name="Discards_In">
+      <param name="snmp-object"       value="$ifInDiscards.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifInDiscards" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-hwpredict"     value="disabled" />
+      <param name="comment" value="Input discards for the interface" />
+      <param name="graph-legend"      value="Discards in" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="790" />
+      <param name="nodeid"            value="%nodeid-interface%//indrops"/>
+      <param name="help-text">
+      Input discards may occur when the packets arrive from the interface
+      media, and the router is not able to process them. This can possibly
+      occur because of performance problems.
+      </param>
+    </leaf>
+  </template>
+
+  <template name="iftable-discards-out">
+    <leaf name="Discards_Out">
+      <param name="snmp-object"       value="$ifOutDiscards.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifOutDiscards" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-hwpredict"     value="disabled" />
+      <param name="comment" value="Output discards for the interface" />
+      <param name="graph-legend"      value="Discards out" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="780" />
+      <param name="nodeid"            value="%nodeid-interface%//outdrops"/>
+      <param name="help-text">
+      Output discards may occur when the router has prepared packets for
+      transmission, but the interface is not able to send them. This
+      may happen because of not enough available bandwidth on
+      the output interface.
+      </param>
+    </leaf>
+  </template>
+
+  <template name="iftable-errors-in">
+    <leaf name="Errors_In">
+      <param name="snmp-object"       value="$ifInErrors.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifInErrors" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-hwpredict"     value="disabled" />
+      <param name="comment" value="Input errors for the interface" />
+      <param name="graph-legend"      value="Errors in" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="690" />
+      <param name="nodeid"            value="%nodeid-interface%//inerr"/>
+      <param name="help-text">
+      Input errors usually mean that the interface receives broken packets
+      from the media. This migh be caused by problems with the physical
+      condition of the transmission media, or elecrical interference.
+      </param>
+    </leaf>
+  </template>
+
+  <template name="iftable-errors-out">
+    <leaf name="Errors_Out">
+      <param name="snmp-object"       value="$ifOutErrors.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifOutErrors" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-hwpredict"     value="disabled" />
+      <param name="comment" value="Output errors for the interface" />
+      <param name="graph-legend"      value="Errors out" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="680" />
+      <param name="nodeid"            value="%nodeid-interface%//outerr"/>
+      <param name="help-text">
+      Output errors occur when the interface is not able to send packets
+      to the media for some reasons.
+      </param>
+    </leaf>
+  </template>
+
+
+  <template name="ifxtable-hcoctets">
+    <leaf name="Bytes_In">
+      <param name="snmp-object"       value="$ifHCInOctets.%ifindex-map%" />
+      <param name="snmp-object-type"  value="COUNTER64" />
+      <param name="rrd-ds"            value="ifHCInOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="ext-dstype"        value="COUNTER64" />
+      <param name="rrd-create-max"    value="1e15"/>
+      <param name="ext-counter-max"   value="1e15"/>
+      <param name="comment"  value="Input byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes in" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="990" />
+      <param name="monitor-action-target"  value="InOut_bps"/>
+      <param name="nodeid"            value="%nodeid-interface%//inbytes"/>
+    </leaf>
+
+    <leaf name="Bytes_Out">
+      <param name="snmp-object"       value="$ifHCOutOctets.%ifindex-map%" />
+      <param name="snmp-object-type"  value="COUNTER64" />
+      <param name="rrd-ds"            value="ifHCOutOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="ext-dstype"        value="COUNTER64" />
+      <param name="rrd-create-max"    value="1e15"/>
+      <param name="ext-counter-max"   value="1e15"/>
+      <param name="comment" value="Output byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes out" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="980" />
+      <param name="monitor-action-target"  value="InOut_bps"/>
+      <param name="nodeid"            value="%nodeid-interface%//outbytes"/>
+    </leaf>
+
+    <leaf name="InOut_bps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="1000" />
+      <param name="nodeid"           value="%nodeid-interface%//inoutbit"/>
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{Bytes_In},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{Bytes_Out},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+  </template>
+
+  <template name="ifxtable-hcucast-packets">
+    <leaf name="Packets_In">
+      <param name="snmp-object"       value="$ifHCInUcastPkts.%ifindex-map%" />
+      <param name="snmp-object-type"  value="COUNTER64" />
+      <param name="rrd-ds"            value="ifHCInUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-create-max"    value="1e15"/>
+      <param name="comment" value="Input packet counter for the interface" />
+      <param name="graph-legend"      value="Packets in" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="890" />
+      <param name="nodeid"            value="%nodeid-interface%//inpackets"/>
+    </leaf>
+
+    <leaf name="Packets_Out">
+      <param name="snmp-object"   value="$ifHCOutUcastPkts.%ifindex-map%" />
+      <param name="snmp-object-type"  value="COUNTER64" />
+      <param name="rrd-ds"            value="ifHCOutUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-create-max"    value="1e15"/>
+      <param name="comment" value="Output packet counter for the interface" />
+      <param name="graph-legend"      value="Packets out" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="880" />
+      <param name="nodeid"            value="%nodeid-interface%//outpackets"/>
+    </leaf>
+  </template>
+
+
+  <!-- Bandwidth usage in percentage of megabits
+       100 * (bytes * 8 / 1e6) / limit = bytes / (limit * 1250)  -->
+  <template name="interface-bandwidth-usage">
+    <leaf name="Bandwidth_Usage">
+      <param name="comment" value="Bandwidth usage graphs" />
+      <param name="vertical-label"   value="percent" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="graph-upper-limit" value="100" />
+      <param name="upper-limit"      value="100" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="998" />
+      <param name="nodeid"            value="%nodeid-interface%//bw"/>
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"
+         value="{Bytes_In},%bandwidth-limit-in%,1250.0,*,/" />
+      <param name="graph-legend-in"
+        value="Input use of %bandwidth-limit-in% Mbps" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"
+         value="{Bytes_Out},%bandwidth-limit-out%,1250.0,*,/" />
+      <param name="graph-legend-out"
+        value="Output use of %bandwidth-limit-out% Mbps" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+  </template>
+
+
+  
+  <!-- ********************************************************************
+
+  Templates for read-only access to RRD files
+
+  ************************************************************************-->
+
+  <template name="read-iftable-octets">
+    <leaf name="Bytes_In">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_if-mib.rrd" />
+      <param name="rrd-ds"            value="ifInOctets" />
+      <param name="comment"  value="Input byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes in" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="990" />
+      <param name="monitor-action-target"  value="InOut_bps"/>
+    </leaf>
+
+    <leaf name="Bytes_Out">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_if-mib.rrd" />
+      <param name="rrd-ds"            value="ifOutOctets" />
+      <param name="comment" value="Output byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes out" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="980" />
+      <param name="monitor-action-target"  value="InOut_bps"/>
+    </leaf>
+
+    <leaf name="InOut_bps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{Bytes_In},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{Bytes_Out},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+  </template>
+
+
+  <template name="read-ifxtable-hcoctets">
+    <leaf name="Bytes_In">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_if-mib.rrd" />
+      <param name="rrd-ds"            value="ifHCInOctets" />
+      <param name="comment"  value="Input byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes in" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="monitor-action-target"  value="InOut_bps"/>
+    </leaf>
+
+    <leaf name="Bytes_Out">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_if-mib.rrd" />
+      <param name="rrd-ds"            value="ifHCOutOctets" />
+      <param name="comment" value="Output byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes out" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="monitor-action-target"  value="InOut_bps"/>
+    </leaf>
+
+    <leaf name="InOut_bps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{Bytes_In},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{Bytes_Out},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/old/cisco-mac-accounting-example.xml b/torrus/xmlconfig/old/cisco-mac-accounting-example.xml
new file mode 100644 (file)
index 0000000..d62cc99
--- /dev/null
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: cisco-mac-accounting-example.xml,v 1.1 2010-12-27 00:04:28 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!--
+  This file gives an example how to monitor the MAC accounting
+  on Cisco routers. It may be useful for per-BGP peer statistics
+  on an Ethernet media.
+
+  This file relies on the definitions and templates from
+  "vendor/cisco.ios.mac-accounting.xml".
+ -->
+
+<configuration>
+<datasources>
+
+
+  <subtree name="SNMP">
+
+    <param name="snmp-community" value="blahblah" />
+    <param name="domain-name" value="xyz.net" />
+    <param name="data-dir" value="/var/snmpcollector" />
+
+    <subtree name="MAC_Accounting">
+      <param name="comment" value="MAC accounting test router" />
+      <param name="collector-period" value="180" />
+      <param name="collector-timeoffset" value="13" />
+
+
+      <subtree name="test1">
+        <param name="snmp-host" value="rtrZHT001" />
+        <param name="interface-name" value="FastEthernet6/1" />
+        <param name="interface-nick" value="Fe6_1" />
+        <param name="mac" value="0.3.49.144.200.28" />
+        <param name="mac-nick" value="testOne" />
+        <param name="comment" value="MAC accounting Test: 0.3.49.144.200.28" />
+        <apply-template name="cisco-mac-accounting" />
+      </subtree>
+
+      <subtree name="test2">
+        <param name="snmp-host" value="rtrZHT001" />
+        <param name="interface-name" value="FastEthernet6/1" />
+        <param name="interface-nick" value="Fe6_1" />
+        <param name="mac" value="0.2.74.137.72.112" />
+        <param name="mac-nick" value="testTwo" />
+        <param name="comment" value="MAC accounting Test: 0.2.74.137.72.112" />
+        <apply-template name="cisco-mac-accounting" />
+      </subtree>
+
+      <subtree name="test3">
+        <param name="snmp-host" value="rtrZHT001" />
+        <param name="interface-name" value="FastEthernet6/6" />
+        <param name="interface-nick" value="Fe6_1" />
+        <param name="mac" value="0.9.182.41.169.3" />
+        <param name="mac-nick" value="testThree" />
+        <param name="comment" value="MAC accounting Test: 0.9.182.41.169.3" />
+        <apply-template name="cisco-mac-accounting" />
+      </subtree>
+
+    </subtree>
+
+  </subtree>
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/old/cisco.generic.old-0.1.4.xml b/torrus/xmlconfig/old/cisco.generic.old-0.1.4.xml
new file mode 100644 (file)
index 0000000..4b0c824
--- /dev/null
@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: cisco.generic.old-0.1.4.xml,v 1.1 2010-12-27 00:04:27 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!-- Common Cisco definitions -->
+
+<configuration>
+
+<definitions>
+
+  <!-- CISCO-PROCESS-MIB:cpmCPUTotalTable -->
+  <def name="cpmCPUTotal5minRev" value="1.3.6.1.4.1.9.9.109.1.1.1.1.8" />
+
+  <!-- CISCO-MEMORY-POOL-MIB:ciscoMemoryPoolTable -->
+  <def name="ciscoMemoryPoolUsed"        value="1.3.6.1.4.1.9.9.48.1.1.1.5" />
+  <def name="ciscoMemoryPoolFree"        value="1.3.6.1.4.1.9.9.48.1.1.1.6" />
+
+  <!-- CISCO-ENVMON-MIB:ciscoEnvMonTemperatureStatusTable -->
+  <def name="ciscoEnvMonTemperatureStatusIndex"
+                          value="1.3.6.1.4.1.9.9.13.1.3.1.1" />
+  <def name="ciscoEnvMonTemperatureStatusDescr"
+                          value="1.3.6.1.4.1.9.9.13.1.3.1.2" />
+  <def name="ciscoEnvMonTemperatureStatusValue"
+                          value="1.3.6.1.4.1.9.9.13.1.3.1.3" />
+  <def name="ciscoEnvMonTemperatureStatusState"
+                          value="1.3.6.1.4.1.9.9.13.1.3.1.6" />
+
+</definitions>
+
+<datasources>
+
+  <template name="cisco-mempool">
+    <subtree name="Memory_Usage">
+      <param name="rrd-create-dstype" value="GAUGE" />
+      <param name="data-file"         value="%system-id%_mempool.rrd" />
+      <param name="comment"           value="Memory usage statistics" />
+      <param name="precedence"        value="-100" />
+
+      <leaf name="Processor_Memory_Used">
+        <param name="snmp-object"     value="$ciscoMemoryPoolUsed.1"/>
+        <param name="rrd-ds"          value="ciscoMemoryPoolUsed" />
+        <param name="comment">
+          Number of bytes from the Processor memory pool
+          that are currently in use
+        </param>
+        <param name="graph-legend"    value="Memory used" />
+      </leaf>
+
+      <leaf name="Processor_Memory_Free">
+        <param name="snmp-object"     value="$ciscoMemoryPoolFree.1"/>
+        <param name="rrd-ds"          value="ciscoMemoryPoolFree" />
+        <param name="comment">
+          Number of bytes from the Processor memory pool
+          that are currently free
+        </param>
+        <param name="graph-legend"    value="Memory free" />
+      </leaf>
+    </subtree>
+  </template>
+
+  <template name="cisco-cpu">
+    <leaf name="CPU_Total_5min">
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"          value="%system-id%_cpu.rrd" />
+      <param name="precedence"         value="-200" />
+      <param name="snmp-object"        value="$cpmCPUTotal5minRev.1"/>
+      <param name="rrd-ds"             value="cpmCPUTotal5minRev" />
+      <param name="comment">
+          The overall CPU busy percentage in the last 5 minute period
+      </param>
+      <param name="graph-legend"       value="CPU usage" />
+    </leaf>
+  </template>
+
+  <!-- template to be applied inside the sensor leaf.
+       Two parameters must be defined: sensor-index and sensor-description -->
+  <template name="cisco-temperature-sensor">
+    <param name="comment"      value="%sensor-description%"/>
+    <param name="rrd-ds"       value="sensor_%sensor-index%"/>
+    <param name="snmp-object"
+           value="$ciscoEnvMonTemperatureStatusValue.%sensor-index%"/>
+    <param name="graph-legend"      value="%sensor-description%"/>
+    <param name="graph-lower-limit" value="10"/>
+    <param name="graph-upper-limit" value="80"/>
+    <param name="vertical-label"  value="degrees Celsius"/>
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/old/cisco.ios.mac-accounting-0.1.8.xml b/torrus/xmlconfig/old/cisco.ios.mac-accounting-0.1.8.xml
new file mode 100644 (file)
index 0000000..a58aa1a
--- /dev/null
@@ -0,0 +1,113 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: cisco.ios.mac-accounting-0.1.8.xml,v 1.1 2010-12-27 00:04:27 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!--
+  This file defines the template for MAC accounting
+  on Cisco routers. It may be useful for per-BGP peer statistics
+  on an Ethernet media.
+
+  See also "examples/cisco-mac-accounting.xml" for a working example.
+ -->
+
+<configuration>
+
+<definitions>
+
+  <!-- CISCO-IP-STAT-MIB:cipMacTable -->
+  <def name="cipMacSwitchedBytes"   value="1.3.6.1.4.1.9.9.84.1.2.1.1.4" />
+
+</definitions>
+
+
+<datasources>
+
+  <!-- Template for MAC accounting -->
+  <template name="cisco-mac-accounting">
+
+    <param name="snmp-object">
+      $cipMacSwitchedBytes.%ifindex-map%.%direction%.%mac%
+    </param>
+
+    <param name="data-file">
+      %system-id%_%interface-nick%_%mac-nick%.rrd"
+    </param>
+
+    <param name="rrd-ds" value="%mac-nick%_%direction%" />
+
+    <param name="rrd-create-dstype" value="COUNTER" />
+
+    <leaf name="InOctets">
+      <param name="comment"          value="Input bytes per second" />
+      <param name="direction"        value="1" />
+      <param name="hidden"           value="yes" />
+      <param name="graph-legend"     value="Bytes in" />
+    </leaf>
+
+    <leaf name="OutOctets">
+      <param name="comment"          value="Output bytes per second" />
+      <param name="direction"        value="2" />
+      <param name="hidden"           value="yes" />
+      <param name="graph-legend"     value="Bytes out" />
+    </leaf>
+
+    <leaf name="InBps">
+      <param name="comment"          value="Input bits per second" />
+      <param name="ds-type"          value="rrd-file" />
+      <param name="leaf-type"        value="rrd-cdef" />
+      <param name="rpn-expr"         value="{InOctets},8,*" />
+      <param name="graph-legend"     value="Bits in" />
+    </leaf>
+
+    <leaf name="OutBps">
+      <param name="comment"          value="Output bits per second" />
+      <param name="ds-type"          value="rrd-file" />
+      <param name="leaf-type"        value="rrd-cdef" />
+      <param name="rpn-expr"         value="{OutOctets},8,*" />
+      <param name="graph-legend"     value="Bits out" />
+    </leaf>
+
+    <leaf name="InOut_bps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{InOctets},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="AREA" />
+      <param name="line-color-in"    value="#00FF00" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{OutOctets},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="LINE2" />
+      <param name="line-color-out"   value="#0000FF" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/old/rfc1213.xml b/torrus/xmlconfig/old/rfc1213.xml
new file mode 100644 (file)
index 0000000..a04d8a0
--- /dev/null
@@ -0,0 +1,224 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (C) 2003 Shawn Ferry
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+Shawn Ferry <sferry at sevenspace dot com > <lalartu at obscure dot org>
+
+Author: Shawn Ferry
+Vendor: RFC1213-MIB
+
+$Id: rfc1213.xml,v 1.1 2010-12-27 00:04:27 ivan Exp $
+@(#) 10/18/03 rfc1213.xml 1.8 (10/18/03 19:24:09) sferry
+
+-->
+<!--
+Generic definitions and templates for:
+
+        The templates defined in this file should work with any
+        snmp implementation supporting:
+
+                RFC1213-MIB
+
+(ssinyagin) Please note that RFC1213 is obsoleted or superceded by:
+RFC3418 (SNMPv2-MIB)
+RFC2863 (IF-MIB)
+RFC2011 (IP-MIB)
+
+-->
+<configuration>
+  <definitions>
+    <!-- RFC1213-MIB -->
+    <def name="rfc1213_sysUpTime" value="1.3.6.1.2.1.1.3.0"/>
+    <!-- RFC1213-MIB interfaces Table -->
+    <def name="rfc1213_ifDescr" value="1.3.6.1.2.1.2.2.1.2"/>
+    <def name="rfc1213_ifPhysAddress" value="1.3.6.1.2.1.2.2.1.6"/>
+    <def name="rfc1213_ifInOctets" value="1.3.6.1.2.1.2.2.1.10"/>
+    <def name="rfc1213_ifInUcastPkts" value="1.3.6.1.2.1.2.2.1.11"/>
+    <def name="rfc1213_ifInErrors" value="1.3.6.1.2.1.2.2.1.14"/>
+    <def name="rfc1213_ifOutOctets" value="1.3.6.1.2.1.2.2.1.16"/>
+    <def name="rfc1213_ifOutUcastPkts" value="1.3.6.1.2.1.2.2.1.17"/>
+    <def name="rfc1213_ifOutErrors" value="1.3.6.1.2.1.2.2.1.20"/>
+    <def name="rfc1213_IFIDX" value="M($rfc1213_ifDescr, %interface-name%)"/>
+    <!-- ICMP -->
+    <def name="rfc1213_icmpInMsgs" value="1.3.6.1.2.1.5.1.0"/>
+    <def name="rfc1213_icmpOutMsgs" value="1.3.6.1.2.1.5.14.0"/>
+    <!-- SNMP -->
+    <def name="rfc1213_snmpInPkts" value="1.3.6.1.2.1.11.1.0"/>
+    <def name="rfc1213_snmpOutPkts" value="1.3.6.1.2.1.11.2.0"/>
+    <def name="rfc1213_snmpOutTraps" value="1.3.6.1.2.1.11.29.0"/>
+  </definitions>
+  <datasources>
+    <!--
+    rfc1213 wrap up template
+    -->
+    <template name="rfc1213">
+      <apply-template name="rfc1213-icmp"/>
+      <apply-template name="rfc1213-snmp"/>
+    </template>
+    <!-- rfc1313-interface must be applied at the per-interface level  -->
+    <!--
+    rfc1213_interface Template
+    -->
+    <template name="rfc1213-interface">
+      <param name="data-file" value="%system-id%_rfc1213-%interface-name%.rrd"/>
+      <leaf name="InOutBytes">
+        <param name="comment" value="Input and Output bits per second graphs"/>
+        <param name="ds-type" value="rrd-multigraph"/>
+        <param name="ds-names" value="in,out"/>
+        <!-- IN -->
+        <param name="ds-expr-in" value="{ifInOctets}"/>
+        <param name="graph-legend-in" value="Bytes per second in"/>
+        <param name="line-style-in" value="AREA"/>
+        <param name="line-color-in" value="##in"/>
+        <param name="line-order-in" value="1"/>
+        <!-- OUT -->
+        <param name="ds-expr-out" value="{ifOutOctets}"/>
+        <param name="graph-legend-out" value="Bytes per second out"/>
+        <param name="line-style-out" value="LINE2"/>
+        <param name="line-color-out" value="##out"/>
+        <param name="line-order-out" value="2"/>
+      </leaf>
+      <leaf name="ifOutErrors">
+        <param name="snmp-object" value="$rfc1213_ifOutErrors.$rfc1213_IFIDX"/>
+        <param name="rrd-ds" value="rfc1213_ifOutErrors"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment" value="Output error counter for the interface"/>
+        <param name="graph-legend" value="Errors out"/>
+      </leaf>
+      <leaf name="ifInErrors">
+        <param name="snmp-object" value="$rfc1213_ifInErrors.$rfc1213_IFIDX"/>
+        <param name="rrd-ds" value="rfc1213_ifInErrors"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment" value="Input error counter for the interface"/>
+        <param name="graph-legend" value="Errors in"/>
+      </leaf>
+      <leaf name="ifInOctets">
+        <param name="hidden" value="yes"/>
+        <param name="snmp-object" value="$rfc1213_ifInOctets.$rfc1213_IFIDX"/>
+        <param name="rrd-ds" value="rfc1213_ifInOctets"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment">
+          1-minute average of input Bytes per second
+        </param>
+        <param name="graph-legend" value="Bytes in"/>
+      </leaf>
+      <leaf name="ifOutOctets">
+        <param name="hidden" value="yes"/>
+        <param name="snmp-object" value="$rfc1213_ifOutOctets.$rfc1213_IFIDX"/>
+        <param name="rrd-ds" value="rfc1213_ifOutOctets"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment">
+          1-minute average of output Bytes per second
+        </param>
+        <param name="graph-legend" value="Bytes out"/>
+      </leaf>
+    </template>
+    <!-- ICMP Template -->
+    <template name="rfc1213-icmp">
+      <subtree name="ICMP">
+        <param name="data-file" value="%system-id%_rfc1213-ICMP.rrd"/>
+        <leaf name="InOutICMP">
+          <param name="comment" value="Input and Output ICMP Messages"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="in,out"/>
+          <!-- IN -->
+          <param name="ds-expr-in" value="{icmpInMsgs}"/>
+          <param name="graph-legend-in" value="Bytes per second in"/>
+          <param name="line-style-in" value="AREA"/>
+          <param name="line-color-in" value="##in"/>
+          <param name="line-order-in" value="1"/>
+          <!-- OUT -->
+          <param name="ds-expr-out" value="{icmpOutMsgs}"/>
+          <param name="graph-legend-out" value="Bytes per second out"/>
+          <param name="line-style-out" value="LINE2"/>
+          <param name="line-color-out" value="##out"/>
+          <param name="line-order-out" value="2"/>
+        </leaf>
+        <leaf name="icmpInMsgs">
+          <param name="hidden" value="yes"/>
+          <param name="snmp-object" value="$rfc1213_icmpInMsgs"/>
+          <param name="rrd-ds" value="rfc1213_icmpIMsgs"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="comment">
+            1-minute average of Incomming ICMP messages
+          </param>
+          <param name="graph-legend" value="ICMP In"/>
+        </leaf>
+        <leaf name="icmpOutMsgs">
+          <param name="hidden" value="yes"/>
+          <param name="snmp-object" value="$rfc1213_icmpOutMsgs"/>
+          <param name="rrd-ds" value="rfc1213_icmpOMsgs"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="comment">
+            "1-minute average of Outgoing ICMP messages"
+          </param>
+          <param name="graph-legend" value="ICMP Out"/>
+        </leaf>
+      </subtree>
+    </template>
+    <!-- SNMP Template -->
+    <template name="rfc1213-snmp">
+      <subtree name="SNMP">
+        <param name="data-file" value="%system-id%_rfc1213-SNMP.rrd"/>
+        <leaf name="InOutSNMP">
+          <param name="comment" value="Input and Output SNMP Packets"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="in,out"/>
+          <!-- IN -->
+          <param name="ds-expr-in" value="{snmpInPkts}"/>
+          <param name="graph-legend-in" value="Packets per second in"/>
+          <param name="line-style-in" value="AREA"/>
+          <param name="line-color-in" value="##in"/>
+          <param name="line-order-in" value="1"/>
+          <!-- OUT -->
+          <param name="ds-expr-out" value="{snmpOutPkts}"/>
+          <param name="graph-legend-out" value="Packets per second out"/>
+          <param name="line-style-out" value="LINE2"/>
+          <param name="line-color-out" value="##out"/>
+          <param name="line-order-out" value="2"/>
+        </leaf>
+        <leaf name="snmpOutTraps">
+          <param name="snmp-object" value="$rfc1213_snmpOutTraps"/>
+          <param name="rrd-ds" value="rfc1213_snmpOTraps"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="comment" value="SNMP Traps Sent"/>
+          <param name="graph-legend" value="SNMP Traps "/>
+        </leaf>
+        <leaf name="snmpInPkts">
+          <param name="hidden" value="yes"/>
+          <param name="snmp-object" value="$rfc1213_snmpInPkts"/>
+          <param name="rrd-ds" value="rfc1213_snmpIPkts"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="comment">
+            1-minute average of Incomming SNMP Packets
+           </param>
+          <param name="graph-legend" value="SNMP In"/>
+        </leaf>
+        <leaf name="snmpOutPkts">
+          <param name="hidden" value="yes"/>
+          <param name="snmp-object" value="$rfc1213_snmpOutPkts"/>
+          <param name="rrd-ds" value="rfc1213_snmpOPkts"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="comment">
+            1-minute average of Outgoing SNMP Packets
+          </param>
+          <param name="graph-legend" value="SNMP Out"/>
+        </leaf>
+      </subtree>
+    </template>
+  </datasources>
+</configuration>
diff --git a/torrus/xmlconfig/old/rfc2670.docsis-if.old.0.1.5d-20040224.xml b/torrus/xmlconfig/old/rfc2670.docsis-if.old.0.1.5d-20040224.xml
new file mode 100644 (file)
index 0000000..ea62bee
--- /dev/null
@@ -0,0 +1,90 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003  Roman Hochuli, Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: rfc2670.docsis-if.old.0.1.5d-20040224.xml,v 1.1 2010-12-27 00:04:27 ivan Exp $
+  Roman Hochuli <roman@hochu.li>
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<configuration>
+
+  <definitions>
+    <!-- DOCS-IF-MIB:docsIfSigQSignalNoise -->
+    <def name="docsIfSigQSignalNoise" value="1.3.6.1.2.1.10.127.1.1.4.1.5" />
+  </definitions>
+
+  <datasources>
+
+    <template name="docsis-upstream-snr">
+      <param name="snmp-object"  value="$docsIfSigQSignalNoise.%ifindex-map%"/>
+
+      <param name="data-file">
+        %system-id%_%interface-nick%_docsIfSigQSignalNoise.rrd
+      </param>
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="rrd-ds"              value="SNR" />
+      <param name="collector-scale"     value="10,/" />
+
+      <param name="graph-legend"        value="Signal/Noise-Ratio" />
+      <param name="vertical-label"      value="dB" />
+
+      <param name="normal-level"        value="25" />
+      <param name="lower-limit"         value="18" />
+      <param name="graph-lower-limit"   value="0" />
+      <param name="graph-upper-limit"   value="35" />
+
+      <param name="collector-timeoffset-hashstring"
+             value="%system-id%:%interface-nick%" />
+
+      <param name="monitor"             value="docsis-snr-lower-20db" />
+      <param name="tokenset-member"     value="docsis-snr" />
+    </template>
+
+  </datasources>
+
+  <monitors>
+
+    <monitor name="docsis-snr-lower-20db">
+      <param name="monitor-type"  value="expression" />
+      <param name="rpn-expr"      value="20,LT" />
+      <param name="action"        value="docsis-snr-lower-20" />
+      <param name="expires"       value="3600" />
+      <param name="comment">
+        Signal/Noise-Ratio was lower than 20dB
+      </param>
+    </monitor>
+
+    <action name="docsis-snr-lower-20">
+      <param name="action-type"     value="tset" />
+      <param name="tset-name"       value="docsis-snr-lower-20" />
+    </action>
+
+  </monitors>
+
+  <token-sets>
+    <token-set name="docsis-snr">
+      <param name="comment" value="S/N Ratio for all interfaces" />
+    </token-set>
+
+    <token-set name="docsis-snr-lower-20">
+      <param name="comment" value="S/N Ratio less than 20dB" />
+    </token-set>
+  </token-sets>
+
+</configuration>
diff --git a/torrus/xmlconfig/old/rfc2670.docsis-if.old.1.0.4.xml b/torrus/xmlconfig/old/rfc2670.docsis-if.old.1.0.4.xml
new file mode 100644 (file)
index 0000000..f2a47d8
--- /dev/null
@@ -0,0 +1,303 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003  Roman Hochuli, Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: rfc2670.docsis-if.old.1.0.4.xml,v 1.1 2010-12-27 00:04:27 ivan Exp $
+  Roman Hochuli <roman@hochu.li>
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+  SEE ALSO: xmlconfig/examples/docsis-monitors.xml
+  
+-->
+
+<configuration>
+
+<definitions>
+  <!-- DOCS-IF-MIB::docsIfSignalQualityTable -->
+  <def name="docsIfSigQUnerroreds"      value="1.3.6.1.2.1.10.127.1.1.4.1.2"/>
+  <def name="docsIfSigQCorrecteds"      value="1.3.6.1.2.1.10.127.1.1.4.1.3"/>
+  <def name="docsIfSigQUncorrectables"  value="1.3.6.1.2.1.10.127.1.1.4.1.4"/>
+  <def name="docsIfSigQSignalNoise"     value="1.3.6.1.2.1.10.127.1.1.4.1.5"/>
+  
+  <!-- DOCS-IF-MIB::docsIfCmtsDownChannelCounterTable -->
+  <def name="docsIfCmtsDownChnlCtrExtTotalBytes"
+                                value="1.3.6.1.2.1.10.127.1.3.10.1.4"/>
+  <def name="docsIfCmtsDownChnlCtrExtUsedBytes"
+                                value="1.3.6.1.2.1.10.127.1.3.10.1.5"/>
+</definitions>
+
+<datasources>
+
+  <template name="docsis-upstream-subtree">
+    <param name="precedence"           value="-500" />
+    <param name="comment"        value="DOCSIS upstream channel statistics" />
+    <param name="data-file">
+       %system-id%_%interface-nick%_docsis_upstream.rrd
+    </param>
+    <param name="collector-timeoffset-hashstring"
+                                       value="%system-id%:%interface-nick%" />
+    <param name="descriptive-nickname" value="%system-id%:%interface-name%"/>
+    <param name="graph-title"          value="%descriptive-nickname%" />
+
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="snr,fec"/>
+    
+    <param name="overview-subleave-name-snr" value="SNR"/>
+    <param name="overview-direct-link-snr"      value="yes"/>
+    <param name="overview-direct-link-view-snr" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-snr"
+           value="All SNR"/>
+    <param name="overview-shortcut-title-snr"
+           value="Show signal quality graphs for all upstreams in one page"/>
+    <param name="overview-page-title-snr"
+           value="SNR Graphs"/>
+
+    <param name="overview-subleave-name-fec" value="FEC_Summary"/>
+    <param name="overview-direct-link-fec"      value="yes"/>
+    <param name="overview-direct-link-view-fec" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-fec"
+           value="All FEC"/>
+    <param name="overview-shortcut-title-fec"
+           value="Show FEC statistics for all upstreams in one page"/>
+    <param name="overview-page-title-fec"
+           value="FEC Graphs"/>
+                      
+    <param name="rrd-hwpredict"     value="disabled" />
+  </template>
+  
+  <template name="docsis-signal-quality-codewords">
+    <param name="rrd-create-dstype"   value="COUNTER" />
+    <param name="vertical-label"      value="Codewords/s" />
+    <param name="graph-lower-limit"   value="0" />
+  </template>
+
+  <template name="docsis-upstream-signal-quality">
+    <leaf name="SNR">
+      <param name="snmp-object"  value="$docsIfSigQSignalNoise.%ifindex-map%"/>
+
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="rrd-ds"              value="SNR" />
+      <param name="collector-scale"     value="10,/" />
+
+      <param name="comment"             value="Signal/Noise Ratio" />
+      <param name="graph-legend"        value="Signal/Noise Ratio" />
+      <param name="vertical-label"      value="dB" />
+
+      <param name="normal-level"        value="25" />
+      <param name="lower-limit"         value="18" />
+      <param name="graph-lower-limit"   value="10" />
+      <param name="graph-upper-limit"   value="30" />
+
+      <param name="precedence"          value="1000" />
+
+      <!-- This monitor may be redefined by
+           DocsisUpSNRMonitor selector action -->
+      <param name="monitor"             value="docsis-snr-lower-20db" />
+    </leaf>
+
+    <leaf name="FEC_Summary">
+      <param name="ds-type"           value="rrd-multigraph" />
+      <param name="ds-names"          value="corr,uncorr" />
+
+      <param name="graph-lower-limit"       value="0.01" />
+      <param name="graph-upper-limit"       value="100" />
+      <param name="graph-logarithmic"       value="yes" />
+      <param name="graph-rigid-boundaries"  value="yes" />
+      
+      <param name="precedence"        value="950" />
+      <param name="comment"
+              value="Reed-Solomon forward error correction (FEC) summary" />
+      <param name="vertical-label"    value="Percent" />
+
+      <param name="ds-expr-corr">
+      {Correctable},{Error-Free},{Correctable},{Uncorrectable},+,+,/,100,*
+      </param>
+      <param name="graph-legend-corr"  value="Correctable Codewords" />
+      <param name="line-style-corr"      value="##SingleGraph" />
+      <param name="line-color-corr"      value="##green" />
+      <param name="line-order-corr"      value="1" />
+
+      <param name="ds-expr-uncorr">
+      {Uncorrectable},{Error-Free},{Correctable},{Uncorrectable},+,+,/,100,*
+      </param>
+      <param name="graph-legend-uncorr"  value="Uncorrectable Codewords" />
+      <param name="line-style-uncorr"    value="##SingleGraph" />
+      <param name="line-color-uncorr"    value="##red" />
+      <param name="line-order-uncorr"    value="2" />
+    </leaf>
+
+    <leaf name="Error-Free">
+      <apply-template name="docsis-signal-quality-codewords"/>
+      <param name="snmp-object"  value="$docsIfSigQUnerroreds.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Unerroreds" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="FEC codewords received on this channel without error"/>
+      <param name="graph-legend" value="Error-free Codewords" />
+      <param name="precedence"   value="900" />
+      <param name="graph-lower-limit"       value="0.01" />
+      <param name="graph-upper-limit"       value="100" />
+      <param name="graph-logarithmic"       value="yes" />
+      <param name="graph-rigid-boundaries"  value="yes" />
+    </leaf>
+
+    <leaf name="Correctable">
+      <apply-template name="docsis-signal-quality-codewords"/>
+      <param name="snmp-object"  value="$docsIfSigQCorrecteds.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Correcteds" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="FEC codewords received on this channel correctable errors"/>
+      <param name="graph-legend" value="Correctable Codewords" />
+      <param name="precedence"   value="800" />
+      <param name="monitor-action-target"  value="FEC_Summary"/>
+      <param name="graph-lower-limit"       value="0.01" />
+      <param name="graph-upper-limit"       value="100" />
+      <param name="graph-logarithmic"       value="yes" />
+      <param name="graph-rigid-boundaries"  value="yes" />
+    </leaf>
+
+    <leaf name="Uncorrectable">
+      <apply-template name="docsis-signal-quality-codewords"/>
+      <param name="snmp-object"
+                        value="$docsIfSigQUncorrectables.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Uncorrectables" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="FEC codewords received on this channel uncorrectable errors"/>
+      <param name="graph-legend" value="Uncorrectable Codewords" />
+      <param name="precedence"   value="700" />
+      <param name="monitor-action-target"  value="FEC_Summary"/>
+      <param name="graph-lower-limit"       value="0.01" />
+      <param name="graph-upper-limit"       value="100" />
+      <param name="graph-logarithmic"       value="yes" />
+      <param name="graph-rigid-boundaries"  value="yes" />
+    </leaf>
+  </template>
+
+
+
+  <template name="docsis-downstream-subtree">
+    <param name="precedence"           value="-500" />
+    <param name="comment"        value="DOCSIS downstream statistics" />
+    <param name="data-file">
+       %system-id%_%interface-nick%_docsis_downstream.rrd
+    </param>
+    <param name="collector-timeoffset-hashstring"
+                                       value="%system-id%:%interface-nick%" />
+    <param name="descriptive-nickname" value="%system-id%:%interface-name%"/>
+    <param name="graph-title"          value="%descriptive-nickname%" />
+
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="util"/>
+    <param name="overview-subleave-name-util" value="Utilization"/>
+    <param name="overview-direct-link-util"      value="yes"/>
+    <param name="overview-direct-link-view-util" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-util"
+           value="All Utilization"/>
+    <param name="overview-shortcut-title-util"
+           value="Show utilization graphs for all downstreams in one page"/>
+    <param name="overview-page-title-util"
+           value="Downstream Utilization Graphs"/>
+    <param name="rrd-hwpredict"     value="disabled" />
+  </template>
+
+  
+  <template name="docsis-downstream-util">  
+    <leaf name="Utilization">
+      <param name="ds-type"           value="rrd-multigraph" />
+      <param name="ds-names"          value="util" />
+      <param name="graph-lower-limit"  value="0" />
+      <param name="graph-upper-limit"  value="100" />
+
+      <param name="precedence"        value="950" />
+      <param name="comment"
+              value="Downstream channel utilization" />
+      <param name="vertical-label"    value="Percent" />
+
+      <param name="ds-expr-util">
+        {UsedBytes},{TotalBytes},/,100,*
+      </param>
+      <param name="graph-legend-util"  value="Utilization" />
+      <param name="line-style-util"      value="##resourceusage" />
+      <param name="line-color-util"      value="##resourceusage" />
+      <param name="line-order-util"      value="1" />
+    </leaf>
+    
+    <leaf name="TotalBytes">
+      <param name="rrd-create-dstype"   value="COUNTER" />
+      <param name="snmp-object-type"    value="COUNTER64" />
+      <param name="vertical-label"      value="Bytes/s" />
+      <param name="graph-lower-limit"   value="0" />
+      <param name="snmp-object"
+               value="$docsIfCmtsDownChnlCtrExtTotalBytes.%ifindex-map%"/>
+      <param name="rrd-ds"       value="TotalBytes" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment">
+        The total number of bytes in the Payload portion
+      </param>
+      <param name="graph-legend" value="Total Bytes" />
+      <param name="precedence"   value="800" />
+    </leaf>
+    
+    <leaf name="UsedBytes">
+      <param name="rrd-create-dstype"   value="COUNTER" />
+      <param name="snmp-object-type"    value="COUNTER64" />
+      <param name="vertical-label"      value="Bytes/s" />
+      <param name="graph-lower-limit"   value="0" />
+      <param name="snmp-object"
+               value="$docsIfCmtsDownChnlCtrExtUsedBytes.%ifindex-map%"/>
+      <param name="rrd-ds"       value="UsedBytes" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment">
+       The total number of DOCSIS data bytes transported by this downstream
+       channel
+      </param>
+      <param name="graph-legend" value="Used Bytes" />
+      <param name="precedence"   value="800" />
+      <param name="monitor-action-target"  value="Utilization"/>
+    </leaf>  
+  </template>  
+  
+</datasources>
+
+<monitors>
+
+    <monitor name="docsis-snr-lower-20db">
+      <param name="monitor-type"  value="expression" />
+      <param name="rpn-expr"      value="DUP,0,GT,EXC,20,LT,AND" />
+      <param name="action"        value="docsis-snr-lower-20" />
+      <param name="expires"       value="3600" />
+      <param name="comment">
+        Signal/Noise-Ratio was lower than 20dB
+      </param>
+    </monitor>
+
+    <action name="docsis-snr-lower-20">
+      <param name="action-type"     value="tset" />
+      <param name="tset-name"       value="docsis-snr-lower-20" />
+    </action>
+
+</monitors>
+
+<token-sets>
+    <token-set name="docsis-snr-lower-20">
+      <param name="comment" value="S/N Ratio less than 20dB" />
+    </token-set>
+</token-sets>
+
+</configuration>
diff --git a/torrus/xmlconfig/old/rfc2863.if-mib.old-0.1.4.xml b/torrus/xmlconfig/old/rfc2863.if-mib.old-0.1.4.xml
new file mode 100644 (file)
index 0000000..831fd6a
--- /dev/null
@@ -0,0 +1,394 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: rfc2863.if-mib.old-0.1.4.xml,v 1.1 2010-12-27 00:04:27 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!--
+  RFC2863 IF-MIB definitions
+-->
+
+<configuration>
+
+<definitions>
+  <!-- IF-MIB:ifTable  -->
+  <def name="ifDescr"           value="1.3.6.1.2.1.2.2.1.2" />
+  <def name="ifSpeed"           value="1.3.6.1.2.1.2.2.1.5" />
+  <def name="ifPhysAddress"     value="1.3.6.1.2.1.2.2.1.6" />
+  <def name="ifInOctets"        value="1.3.6.1.2.1.2.2.1.10" />
+  <def name="ifInUcastPkts"     value="1.3.6.1.2.1.2.2.1.11" />
+  <def name="ifInDiscards"      value="1.3.6.1.2.1.2.2.1.13" />
+  <def name="ifInErrors"        value="1.3.6.1.2.1.2.2.1.14" />
+  <def name="ifOutOctets"       value="1.3.6.1.2.1.2.2.1.16" />
+  <def name="ifOutUcastPkts"    value="1.3.6.1.2.1.2.2.1.17" />
+  <def name="ifOutDiscards"     value="1.3.6.1.2.1.2.2.1.19" />
+  <def name="ifOutErrors"       value="1.3.6.1.2.1.2.2.1.20" />
+
+  <!-- IF-MIB:ifXTable -->
+  <def name="ifName"            value="1.3.6.1.2.1.31.1.1.1.1" />
+  <def name="ifHCInOctets"      value="1.3.6.1.2.1.31.1.1.1.6" />
+  <def name="ifHCInUcastPkts"   value="1.3.6.1.2.1.31.1.1.1.7" />
+  <def name="ifHCOutOctets"     value="1.3.6.1.2.1.31.1.1.1.10" />
+  <def name="ifHCOutUcastPkts"  value="1.3.6.1.2.1.31.1.1.1.11" />
+
+  <!-- RFC1213-MIB:ipAddrTable -->
+  <def name="ipAdEntIfIndex"   value="1.3.6.1.2.1.4.20.1.2" />
+
+  <!-- Interface indices -->
+  <def name="IFIDX_DESCR"   value="M($ifDescr, %interface-name%)" />
+  <def name="IFIDX_MAC"     value="M($ifPhysAddress, %interface-mac%)" />
+  <def name="IFIDX_IP"      value="V(ipAdEntIfIndex.%interface-ipaddr%)" />
+
+  <!-- Default Interface index lookup -->
+  <def name="IFIDX"         value="M(%ifindex-table%, %interface-name%)" />
+</definitions>
+
+<datasources>
+
+  <!-- Parameters for interfaces parent subtree -->
+  <template name="rfc2863-ifmib-subtree">
+    <param name="has-overview-subleaves" value="yes"/>
+    <param name="overview-subleave-name" value="InOutBps"/>
+    <param name="overview-shortcut-text"
+           value="Show InOutBps for all interfaces"/>
+    <param name="overview-shortcut-title"
+           value="Show all interfaces traffic in one page"/>
+    <param name="overview-page-title"
+           value="Input/Output Graphs"/>
+  </template>
+
+  <template name="iftable-octets">
+    <leaf name="ifInOctets">
+      <param name="snmp-object"       value="$ifInOctets.$IFIDX" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_octets.rrd" />
+      <param name="rrd-ds"            value="ifInOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment"  value="Input byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes in" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifOutOctets">
+      <param name="snmp-object"       value="$ifOutOctets.$IFIDX" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_octets.rrd" />
+      <param name="rrd-ds"            value="ifOutOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Output byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes out" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="InOutBps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{ifInOctets},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{ifOutOctets},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+  </template>
+
+  <!-- Some interface instances (e.g. serial subinterfaces in Coisco routers)
+       don't have UcastPkts and Errors counters -->
+
+  <template name="iftable-ucast-packets">
+    <leaf name="ifInUcastPkts">
+      <param name="snmp-object"       value="$ifInUcastPkts.$IFIDX" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_packets.rrd" />
+      <param name="rrd-ds"            value="ifInUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Input packet counter for the interface" />
+      <param name="graph-legend"      value="Packets in" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifOutUcastPkts">
+      <param name="snmp-object"       value="$ifOutUcastPkts.$IFIDX" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_packets.rrd" />
+      <param name="rrd-ds"            value="ifOutUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Output packet counter for the interface" />
+      <param name="graph-legend"      value="Packets out" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+  </template>
+
+  <template name="iftable-discards">
+    <leaf name="ifInDiscards">
+      <param name="snmp-object"       value="$ifInDiscards.$IFIDX" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_discards.rrd" />
+      <param name="rrd-ds"            value="ifInDiscards" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Input discards for the interface" />
+      <param name="graph-legend"      value="Discards in" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifOutDiscards">
+      <param name="snmp-object"       value="$ifOutDiscards.$IFIDX" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_discards.rrd" />
+      <param name="rrd-ds"            value="ifOutDiscards" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Output discards for the interface" />
+      <param name="graph-legend"      value="Discards out" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+  </template>
+
+  <template name="iftable-errors">
+    <leaf name="ifInErrors">
+      <param name="snmp-object"       value="$ifInErrors.$IFIDX" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_errors.rrd" />
+      <param name="rrd-ds"            value="ifInErrors" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Input errors for the interface" />
+      <param name="graph-legend"      value="Errors in" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifOutErrors">
+      <param name="snmp-object"       value="$ifOutErrors.$IFIDX" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_errors.rrd" />
+      <param name="rrd-ds"            value="ifOutErrors" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Output errors for the interface" />
+      <param name="graph-legend"      value="Errors out" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+  </template>
+
+
+  <template name="ifxtable-hcoctets">
+    <leaf name="ifHCInOctets">
+      <param name="snmp-object"       value="$ifHCInOctets.$IFIDX" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_hcoctets.rrd" />
+      <param name="rrd-ds"            value="ifHCInOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-create-max"    value="1e15"/>
+      <param name="comment"  value="Input byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes in" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifHCOutOctets">
+      <param name="snmp-object"       value="$ifHCOutOctets.$IFIDX" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_hcoctets.rrd" />
+      <param name="rrd-ds"            value="ifHCOutOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-create-max"    value="1e15"/>
+      <param name="comment" value="Output byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes out" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="InOutBps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{ifHCInOctets},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{ifHCOutOctets},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+  </template>
+
+  <template name="ifxtable-hcucast-packets">
+    <leaf name="ifHCInUcastPkts">
+      <param name="snmp-object"       value="$ifHCInUcastPkts.$IFIDX" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_hcpackets.rrd" />
+      <param name="rrd-ds"            value="ifHCInUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-create-max"    value="1e15"/>
+      <param name="comment" value="Input packet counter for the interface" />
+      <param name="graph-legend"      value="Packets in" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifHCOutUcastPkts">
+      <param name="snmp-object"       value="$ifHCOutUcastPkts.$IFIDX" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_hcpackets.rrd" />
+      <param name="rrd-ds"            value="ifHCOutUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-create-max"    value="1e15"/>
+      <param name="comment" value="Output packet counter for the interface" />
+      <param name="graph-legend"      value="Packets out" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+  </template>
+
+  <!-- ********************************************************************
+
+  Templates for read-only access to RRD files
+
+  ************************************************************************-->
+
+  <template name="read-iftable-octets">
+    <leaf name="ifInOctets">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_octets.rrd" />
+      <param name="rrd-ds"            value="ifInOctets" />
+      <param name="comment"  value="Input byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes in" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifOutOctets">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_octets.rrd" />
+      <param name="rrd-ds"            value="ifOutOctets" />
+      <param name="comment" value="Output byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes out" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="InOutBps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{ifInOctets},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{ifOutOctets},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+  </template>
+
+
+  <template name="read-ifxtable-hcoctets">
+    <leaf name="ifHCInOctets">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_hcoctets.rrd" />
+      <param name="rrd-ds"            value="ifHCInOctets" />
+      <param name="comment"  value="Input byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes in" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifHCOutOctets">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_hcoctets.rrd" />
+      <param name="rrd-ds"            value="ifHCOutOctets" />
+      <param name="comment" value="Output byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes out" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="InOutBps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{ifHCInOctets},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{ifHCOutOctets},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/old/rfc2863.if-mib.old-0.1.7.xml b/torrus/xmlconfig/old/rfc2863.if-mib.old-0.1.7.xml
new file mode 100644 (file)
index 0000000..66e8080
--- /dev/null
@@ -0,0 +1,400 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: rfc2863.if-mib.old-0.1.7.xml,v 1.1 2010-12-27 00:04:28 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!--
+  RFC2863 IF-MIB definitions
+-->
+
+<configuration>
+
+<definitions>
+  <!-- IF-MIB:ifTable  -->
+  <def name="ifDescr"           value="1.3.6.1.2.1.2.2.1.2" />
+  <def name="ifSpeed"           value="1.3.6.1.2.1.2.2.1.5" />
+  <def name="ifPhysAddress"     value="1.3.6.1.2.1.2.2.1.6" />
+  <def name="ifInOctets"        value="1.3.6.1.2.1.2.2.1.10" />
+  <def name="ifInUcastPkts"     value="1.3.6.1.2.1.2.2.1.11" />
+  <def name="ifInDiscards"      value="1.3.6.1.2.1.2.2.1.13" />
+  <def name="ifInErrors"        value="1.3.6.1.2.1.2.2.1.14" />
+  <def name="ifOutOctets"       value="1.3.6.1.2.1.2.2.1.16" />
+  <def name="ifOutUcastPkts"    value="1.3.6.1.2.1.2.2.1.17" />
+  <def name="ifOutDiscards"     value="1.3.6.1.2.1.2.2.1.19" />
+  <def name="ifOutErrors"       value="1.3.6.1.2.1.2.2.1.20" />
+
+  <!-- IF-MIB:ifXTable -->
+  <def name="ifName"            value="1.3.6.1.2.1.31.1.1.1.1" />
+  <def name="ifHCInOctets"      value="1.3.6.1.2.1.31.1.1.1.6" />
+  <def name="ifHCInUcastPkts"   value="1.3.6.1.2.1.31.1.1.1.7" />
+  <def name="ifHCOutOctets"     value="1.3.6.1.2.1.31.1.1.1.10" />
+  <def name="ifHCOutUcastPkts"  value="1.3.6.1.2.1.31.1.1.1.11" />
+
+  <!-- RFC1213-MIB:ipAddrTable -->
+  <def name="ipAdEntIfIndex"   value="1.3.6.1.2.1.4.20.1.2" />
+
+  <!-- Interface indices -->
+  <def name="IFIDX_DESCR"   value="M($ifDescr, %interface-name%)" />
+  <def name="IFIDX_MAC"     value="M($ifPhysAddress, %interface-macaddr%)" />
+  <def name="IFIDX_IP"      value="V(ipAdEntIfIndex.%interface-ipaddr%)" />
+  <def name="IFIDX_IFINDEX" value="%interface-index%" />
+
+</definitions>
+
+<datasources>
+
+  <!-- Some parameters need to be at host level -->
+  <template name="rfc2863-ifmib-hostlevel">
+    <param name="ifindex-map" value="M(%ifindex-table%, %interface-name%)"/>
+  </template>
+
+  <!-- Parameters for interfaces parent subtree -->
+  <template name="rfc2863-ifmib-subtree">
+    <param name="comment" value="Interface traffic and error counters"/>
+    <param name="has-overview-subleaves" value="yes"/>
+    <param name="overview-subleave-name" value="InOutBps"/>
+    <param name="overview-shortcut-text"
+           value="Show InOutBps for all interfaces"/>
+    <param name="overview-shortcut-title"
+           value="Show all interfaces traffic in one page"/>
+    <param name="overview-page-title"
+           value="Input/Output Graphs"/>
+    <param name="descriptive-nickname" value="%system-id%:%interface-name%"/>
+    <param name="data-file" value="%system-id%_%interface-nick%_if-mib.rrd" />
+    <param name="graph-title" value="%descriptive-nickname%" />
+    <param name="collector-timeoffset-hashstring"
+           value="%system-id%:%interface-nick%" />
+  </template>
+
+  <template name="iftable-octets">
+    <leaf name="ifInOctets">
+      <param name="snmp-object"       value="$ifInOctets.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifInOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment"  value="Input byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes in" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifOutOctets">
+      <param name="snmp-object"       value="$ifOutOctets.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifOutOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Output byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes out" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="InOutBps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{ifInOctets},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{ifOutOctets},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+  </template>
+
+  <!-- Some interface instances (e.g. serial subinterfaces in Coisco routers)
+       don't have UcastPkts and Errors counters -->
+
+  <template name="iftable-ucast-packets">
+    <leaf name="ifInUcastPkts">
+      <param name="snmp-object"       value="$ifInUcastPkts.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifInUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Input packet counter for the interface" />
+      <param name="graph-legend"      value="Packets in" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifOutUcastPkts">
+      <param name="snmp-object"       value="$ifOutUcastPkts.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifOutUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Output packet counter for the interface" />
+      <param name="graph-legend"      value="Packets out" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+  </template>
+
+  <template name="iftable-discards-in">
+    <leaf name="ifInDiscards">
+      <param name="snmp-object"       value="$ifInDiscards.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifInDiscards" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-hwpredict"     value="disabled" />
+      <param name="comment" value="Input discards for the interface" />
+      <param name="graph-legend"      value="Discards in" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+      <iftrue var="RFC2863_IF_MIB::errors-monitor">
+        <param name="monitor" value="RFC2863_IF_MIB-errors" />
+      </iftrue>
+    </leaf>
+  </template>
+
+  <template name="iftable-discards-out">
+    <leaf name="ifOutDiscards">
+      <param name="snmp-object"       value="$ifOutDiscards.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifOutDiscards" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-hwpredict"     value="disabled" />
+      <param name="comment" value="Output discards for the interface" />
+      <param name="graph-legend"      value="Discards out" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+      <iftrue var="RFC2863_IF_MIB::errors-monitor">
+        <param name="monitor" value="RFC2863_IF_MIB-errors" />
+      </iftrue>
+    </leaf>
+  </template>
+
+  <template name="iftable-errors-in">
+    <leaf name="ifInErrors">
+      <param name="snmp-object"       value="$ifInErrors.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifInErrors" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-hwpredict"     value="disabled" />
+      <param name="comment" value="Input errors for the interface" />
+      <param name="graph-legend"      value="Errors in" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+      <iftrue var="RFC2863_IF_MIB::errors-monitor">
+        <param name="monitor" value="RFC2863_IF_MIB-errors" />
+      </iftrue>
+    </leaf>
+  </template>
+
+  <template name="iftable-errors-out">
+    <leaf name="ifOutErrors">
+      <param name="snmp-object"       value="$ifOutErrors.%ifindex-map%" />
+      <param name="rrd-ds"            value="ifOutErrors" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-hwpredict"     value="disabled" />
+      <param name="comment" value="Output errors for the interface" />
+      <param name="graph-legend"      value="Errors out" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+      <iftrue var="RFC2863_IF_MIB::errors-monitor">
+        <param name="monitor" value="RFC2863_IF_MIB-errors" />
+      </iftrue>
+    </leaf>
+  </template>
+
+
+  <template name="ifxtable-hcoctets">
+    <leaf name="ifHCInOctets">
+      <param name="snmp-object"       value="$ifHCInOctets.%ifindex-map%" />
+      <param name="snmp-object-type"  value="COUNTER64" />
+      <param name="rrd-ds"            value="ifHCInOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-create-max"    value="1e15"/>
+      <param name="comment"  value="Input byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes in" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifHCOutOctets">
+      <param name="snmp-object"       value="$ifHCOutOctets.%ifindex-map%" />
+      <param name="snmp-object-type"  value="COUNTER64" />
+      <param name="rrd-ds"            value="ifHCOutOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-create-max"    value="1e15"/>
+      <param name="comment" value="Output byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes out" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="InOutBps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{ifHCInOctets},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{ifHCOutOctets},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+  </template>
+
+  <template name="ifxtable-hcucast-packets">
+    <leaf name="ifHCInUcastPkts">
+      <param name="snmp-object"       value="$ifHCInUcastPkts.%ifindex-map%" />
+      <param name="snmp-object-type"  value="COUNTER64" />
+      <param name="rrd-ds"            value="ifHCInUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-create-max"    value="1e15"/>
+      <param name="comment" value="Input packet counter for the interface" />
+      <param name="graph-legend"      value="Packets in" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifHCOutUcastPkts">
+      <param name="snmp-object"   value="$ifHCOutUcastPkts.%ifindex-map%" />
+      <param name="snmp-object-type"  value="COUNTER64" />
+      <param name="rrd-ds"            value="ifHCOutUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-create-max"    value="1e15"/>
+      <param name="comment" value="Output packet counter for the interface" />
+      <param name="graph-legend"      value="Packets out" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+  </template>
+
+  <!-- ********************************************************************
+
+  Templates for read-only access to RRD files
+
+  ************************************************************************-->
+
+  <template name="read-iftable-octets">
+    <leaf name="ifInOctets">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_if-mib.rrd" />
+      <param name="rrd-ds"            value="ifInOctets" />
+      <param name="comment"  value="Input byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes in" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifOutOctets">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_if-mib.rrd" />
+      <param name="rrd-ds"            value="ifOutOctets" />
+      <param name="comment" value="Output byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes out" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="InOutBps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{ifInOctets},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{ifOutOctets},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+  </template>
+
+
+  <template name="read-ifxtable-hcoctets">
+    <leaf name="ifHCInOctets">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_if-mib.rrd" />
+      <param name="rrd-ds"            value="ifHCInOctets" />
+      <param name="comment"  value="Input byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes in" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifHCOutOctets">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_if-mib.rrd" />
+      <param name="rrd-ds"            value="ifHCOutOctets" />
+      <param name="comment" value="Output byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes out" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="InOutBps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{ifHCInOctets},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{ifHCOutOctets},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/old/snmp-defs.old-0.1.2.xml b/torrus/xmlconfig/old/snmp-defs.old-0.1.2.xml
new file mode 100644 (file)
index 0000000..a77b311
--- /dev/null
@@ -0,0 +1,285 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: snmp-defs.old-0.1.2.xml,v 1.1 2010-12-27 00:04:28 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!-- These are the basic definitions for the SNMP collector
+
+  WARNING: This file is overwritten by "make install"
+-->
+
+<configuration>
+
+<definitions>
+  <!-- IF-MIB:ifTable  -->
+  <def name="ifDescr"           value="1.3.6.1.2.1.2.2.1.2" />
+  <def name="ifPhysAddress"     value="1.3.6.1.2.1.2.2.1.6" />
+  <def name="ifInOctets"        value="1.3.6.1.2.1.2.2.1.10" />
+  <def name="ifInUcastPkts"     value="1.3.6.1.2.1.2.2.1.11" />
+  <def name="ifInErrors"        value="1.3.6.1.2.1.2.2.1.14" />
+  <def name="ifOutOctets"       value="1.3.6.1.2.1.2.2.1.16" />
+  <def name="ifOutUcastPkts"    value="1.3.6.1.2.1.2.2.1.17" />
+  <def name="ifOutErrors"       value="1.3.6.1.2.1.2.2.1.20" />
+
+  <!-- IF-MIB:ifXTable -->
+  <def name="ifName"            value="1.3.6.1.2.1.31.1.1.1.1" />
+  <def name="ifHCInOctets"      value="1.3.6.1.2.1.31.1.1.1.6" />
+  <def name="ifHCInUcastPkts"   value="1.3.6.1.2.1.31.1.1.1.7" />
+  <def name="ifHCOutOctets"     value="1.3.6.1.2.1.31.1.1.1.10" />
+  <def name="ifHCOutUcastPkts"  value="1.3.6.1.2.1.31.1.1.1.11" />
+
+  <!-- RFC1213-MIB:ipAddrTable -->
+  <def name="ipAdEntIfIndex"   value="1.3.6.1.2.1.4.20.1.2" />
+
+  <!-- Interface indices -->
+  <def name="IFIDX_DESCR"   value="M($ifDescr, %interface-name%)" />
+  <def name="IFIDX_MAC"     value="M($ifPhysAddress, %interface-mac%)" />
+  <def name="IFIDX_IP"      value="V(ipAdEntIfIndex.%interface-ipaddr%)" />
+
+  <!-- Default Interface index lookup -->
+  <def name="IFIDX"         value="M(%ifindex-table%, %interface-name%)" />
+
+</definitions>
+
+<datasources>
+
+  <template name="interface-counters">
+
+    <leaf name="InOutBps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{ifInOctets},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{ifOutOctets},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+
+    <leaf name="ifInOctets">
+      <param name="snmp-object"       value="$ifInOctets.$IFIDX" />
+      <param name="rrd-ds"            value="ifInOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment"  value="Input byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes in" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifInUcastPkts">
+      <param name="snmp-object"       value="$ifInUcastPkts.$IFIDX" />
+      <param name="rrd-ds"            value="ifInUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Input packet counter for the interface" />
+      <param name="graph-legend"      value="Packets in" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifOutOctets">
+      <param name="snmp-object"       value="$ifOutOctets.$IFIDX" />
+      <param name="rrd-ds"            value="ifOutOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Output byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes out" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifOutUcastPkts">
+      <param name="snmp-object"       value="$ifOutUcastPkts.$IFIDX" />
+      <param name="rrd-ds"            value="ifOutUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Output packet counter for the interface" />
+      <param name="graph-legend"      value="Packets out" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+  </template>
+
+  <template name="hc-interface-counters">
+
+    <leaf name="InOutBps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{ifHCInOctets},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{ifHCOutOctets},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+
+    <leaf name="ifHCInOctets">
+      <param name="snmp-object"       value="$ifHCInOctets.$IFIDX" />
+      <param name="rrd-ds"            value="ifHCInOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment"  value="Input byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes in" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifHCInUcastPkts">
+      <param name="snmp-object"       value="$ifHCInUcastPkts.$IFIDX" />
+      <param name="rrd-ds"            value="ifHCInUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Input packet counter for the interface" />
+      <param name="graph-legend"      value="Packets in" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifHCOutOctets">
+      <param name="snmp-object"       value="$ifHCOutOctets.$IFIDX" />
+      <param name="rrd-ds"            value="ifHCOutOctets" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Output byte counter for the interface" />
+      <param name="graph-legend"      value="Bytes out" />
+      <param name="vertical-label"    value="Bps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+    <leaf name="ifHCOutUcastPkts">
+      <param name="snmp-object"       value="$ifHCOutUcastPkts.$IFIDX" />
+      <param name="rrd-ds"            value="ifHCOutUcastPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="comment" value="Output packet counter for the interface" />
+      <param name="graph-legend"      value="Packets out" />
+      <param name="vertical-label"    value="pps" />
+      <param name="graph-lower-limit" value="0" />
+    </leaf>
+
+  </template>
+
+  <subtree name="SNMP">
+    <param name="ds-type" value="collector" />
+    <param name="collector-type" value="snmp" />
+
+    <!-- Two mandatory parameters define the collector schedule.
+         The collector runs at moments defined by formula:
+           time + period - (time mod period) + timeoffset -->
+    <param name="collector-period" value="300" />
+    <param name="collector-timeoffset" value="10" />
+
+    <param name="storage-type" value="rrd" />
+
+    <param name="comment" value="Data collected via SNMP" />
+
+    <!-- SNMP Parameters -->
+
+    <!-- Optional SNMP version. Default is 2c.
+         Valid values are: 1, 2c.
+         Version 3 will be supported in the future.  -->
+    <param name="snmp-version" value="2c" />
+
+    <!-- Optional port. Deefault is 161 -->
+    <param name="snmp-port" value="161" />
+
+    <!-- Mandatory community name -->
+    <param name="snmp-community" value="public" />
+
+    <!-- Mandatory session timeout and no. of retries -->
+    <param name="snmp-timeout" value="10" />
+    <param name="snmp-retries" value="2" />
+
+    <!-- Optional domain name. Appended to a hostname which
+         has no dots in it -->
+    <param name="domain-name" value="must.redefine.domain.net" />
+
+    <!-- Where the interface index is looked up -->
+    <param name="ifindex-table" value="$ifDescr" />
+
+    <!-- RRD Parameters -->
+
+    <!-- Directory path where RRD files will be stored -->
+    <param name="data-dir" value="/var/snmpcollector" />
+
+    <!-- Round-robin arrays to be created, separated by space.
+     In this example, we keep 5-minute details for 2 weeks,
+     30-minute average and maximum details for 6 weeks,
+     and 1-day aggregated stats for 2 years -->
+    <param name="rrd-create-rra">
+      RRA:AVERAGE:0.5:1:4032
+      RRA:AVERAGE:0.5:6:2016     RRA:MAX:0.5:6:2016
+      RRA:AVERAGE:0.5:288:732    RRA:MAX:0.5:288:732
+    </param>
+
+    <!-- if no updates are received for 30 minutes, consider the datasource
+         unknown, i.e. dead -->
+    <param name="rrd-create-heartbeat" value="500"/>
+
+    <param name="rrd-create-min" value="0"/>
+    <param name="rrd-create-max" value="U"/>
+
+    <param name="rrd-hwpredict" value="disabled" />
+
+    <!-- Optional Holt-Winters algorithm parameters
+      Default values are:
+        alpha=0.1, beta=0.0035, gamma=0.1,
+        window_length=9, failure_threshold=6 -->
+    <param name="rrd-create-hw-alpha" value="0.1" />
+    <param name="rrd-create-hw-beta" value="0.0035" />
+    <param name="rrd-create-hw-gamma" value="0.1" />
+    <param name="rrd-create-hw-winlen" value="9" />
+    <param name="rrd-create-hw-failth" value="6" />
+
+    <!-- Optional Holt-Winters season length.
+         Default is one-day (288 5-minute intervals) -->
+    <param name="rrd-create-hw-season" value="288" />
+
+    <!-- Mandatory length of the Holt-Winters archives.
+         Recommended same length as main 5-minutes RRA -->
+    <param name="rrd-create-hw-rralen" value="4032" />
+
+    <param name="data-file" value="%system-id%_%interface-nick%.rrd" />
+    <param name="leaf-type" value="rrd-def" />
+    <param name="rrd-cf"    value="AVERAGE" />
+
+    <!-- In other files, define the subtree of /SNMP for your routers -->
+
+  </subtree>
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/site-global.xml b/torrus/xmlconfig/site-global.xml
new file mode 100644 (file)
index 0000000..ad15ce2
--- /dev/null
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+
+<!-- 
+  Global configuration parameters, applied to every tree.
+  This file is not overwritten by "make install"
+  Uncomment what is needed and add new parameters here
+-->
+
+<configuration>
+
+<datasources>
+
+  <!-- Disperse the collector timeoffsets. Useful in large installations
+       and/or network devices with plenty interaces -->  
+  <!-- param name="collector-dispersed-timeoffset" value="yes" -->
+
+  <!-- This would replace the 6-hour small graphs with 24-hour ones -->
+  <!-- param name="rrgraph-views">
+    last24h-small,last24h,lastweek,lastmonth,lastyear
+  </param -->
+
+  
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/snmp-defs.xml b/torrus/xmlconfig/snmp-defs.xml
new file mode 100644 (file)
index 0000000..d55b45f
--- /dev/null
@@ -0,0 +1,167 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: snmp-defs.xml,v 1.1 2010-12-27 00:04:06 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!-- These are the basic definitions for the SNMP collector
+
+  WARNING: This file is overwritten by "make install"
+-->
+
+<configuration>
+
+<param-properties>
+  <!-- Parameters which need to be expanded accorrding
+       to $defs and %paramrefs% -->
+
+  <prop param="ifindex-table"       prop="expand" value="1"/>
+  <prop param="snmp-host"           prop="expand" value="1"/>
+  <prop param="snmp-object"         prop="expand" value="1"/>
+
+  <!-- Parameters which are included in search DB -->
+  <prop param="snmp-host"               prop="search" value="1"/>
+  
+</param-properties>
+
+
+<datasources>
+
+  <template name="snmp-defaults">
+    <param name="ds-type" value="collector" />
+    <param name="collector-type" value="snmp" />
+
+    <!-- Two mandatory parameters define the collector schedule.
+         The collector runs at moments defined by formula:
+           time + period - (time mod period) + timeoffset -->
+    <param name="collector-period" value="300" />
+    <param name="collector-timeoffset" value="10" />
+
+    <param name="storage-type" value="rrd" />
+
+    <!-- Unique host identifier, normally same as hostname -->
+    <param name="system-id" value="%snmp-host%" />
+
+    <!-- Host-specific part of nodeid -->
+    <param name="nodeid-device" value="%system-id%" />
+
+    <!-- Host-level nodeid -->
+    <param name="nodeid" value="device//%nodeid-device%" />
+    
+    <!-- SNMP Parameters -->
+
+    <!--
+      The following parameters must be defined elsewhere:
+
+      snmp-host
+
+      snmp-version
+         Valid values are: 1, 2c.
+         Version 3 will be supported in the future.
+
+      snmp-port: UDP port to use (usually 161)
+
+      snmp-community
+
+      domain-name: will be appended to hostname if it contains no dots
+
+      data-dir
+      data-file
+    -->
+    
+    <!-- Mandatory transport protocol -->
+    <param name="snmp-ipversion" value="4" />
+    <param name="snmp-transport" value="udp" />
+    
+    <!-- Mandatory session timeout and no. of retries -->
+    <param name="snmp-timeout" value="10" />
+    <param name="snmp-retries" value="2" />
+
+    <!-- Number of SNMP OIDs per one UDP packet -->
+    <param name="snmp-oids-per-pdu" value="40" />
+
+    <!-- RRD Parameters -->
+
+    <!-- Round-robin arrays to be created, separated by space.
+     By default we keep 5-minute details for 2 weeks,
+     30-minute average and maximum details for 6 weeks,
+     and 1-day aggregated stats for 2 years.
+     In 30-minute average one missing sample is allowed.
+     In daily average one hour of missing samples are allowed.
+      -->
+    <param name="rrd-create-rra">
+      RRA:AVERAGE:0:1:4032
+      RRA:AVERAGE:0.17:6:2016      RRA:MAX:0.17:6:2016
+      RRA:AVERAGE:0.042:288:732    RRA:MAX:0.042:288:732
+    </param>
+
+    <!-- if no updates are received for 8 minutes, consider the datasource
+         unknown, i.e. dead -->
+    <param name="rrd-create-heartbeat" value="500"/>
+
+    <param name="rrd-create-min" value="0"/>
+    <param name="rrd-create-max" value="U"/>
+
+    <param name="leaf-type" value="rrd-def" />
+    <param name="rrd-cf"    value="AVERAGE" />
+
+    <!-- Default schedule for the monitor -->
+    <param name="monitor-period"     value="300" />
+    <param name="monitor-timeoffset" value="75" />
+    
+    <param name="searchable" value="yes" />
+  </template>
+
+  <!-- Optional Holt-Winters algorithm parameters
+       Default values are:
+        alpha=0.1, beta=0.0035, gamma=0.1,
+        window_length=9, failure_threshold=6 -->
+
+  <template name="holt-winters-defaults">
+    <param name="rrd-hwpredict" value="enabled" />
+
+    <param name="rrd-create-hw-alpha" value="0.1" />
+    <param name="rrd-create-hw-beta" value="0.0035" />
+    <param name="rrd-create-hw-gamma" value="0.1" />
+    <param name="rrd-create-hw-winlen" value="9" />
+    <param name="rrd-create-hw-failth" value="6" />
+
+    <!-- Optional Holt-Winters season length.
+         Default is one-day (288 5-minute intervals) -->
+    <param name="rrd-create-hw-season" value="288" />
+
+    <!-- Mandatory length of the Holt-Winters archives.
+         Recommended same length as main 5-minutes RRA -->
+    <param name="rrd-create-hw-rralen" value="4032" />
+  </template>
+
+  <!-- Template for read-only access to RRD files -->
+  
+  <template name="viewonly-defaults">
+    <param name="ds-type" value="rrd-file" />
+    <param name="leaf-type" value="rrd-def" />
+    <param name="rrd-cf"    value="AVERAGE" />
+    <param name="system-id" value="%snmp-host%" />
+  </template>
+
+  
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/alteon.xml b/torrus/xmlconfig/vendor/alteon.xml
new file mode 100644 (file)
index 0000000..cf490ed
--- /dev/null
@@ -0,0 +1,695 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2006 Jon Nistor
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: alteon.xml,v 1.1 2010-12-27 00:04:11 ivan Exp $
+  Jon Nistor <nistor at snickers dot org>
+
+  ALTEON leafs:
+        alteon-cpu
+        alteon-maint
+        alteon-maint-subtree
+        alteon-mem
+        alteon-packets
+        alteon-sensor
+        alteon-vserver
+        alteon-vserver-subtree
+  NOTE: Module tested against: ACEdirector(3) (snmpV1)
+-->
+
+<!-- Alteon specific definitions -->
+<configuration>
+
+<definitions>
+  <!-- ALTEON-PRIVATE-MIBS -->
+  <def name="hwSensor1Temp"            value="1.3.6.1.4.1.1872.2.1.1.6.0"/>
+  <def name="hwSensor2Temp"            value="1.3.6.1.4.1.1872.2.1.1.7.0"/>
+  <def name="hwSensor3Temp"            value="1.3.6.1.4.1.1872.2.1.1.8.0"/>
+  <def name="hwSensor4Temp"            value="1.3.6.1.4.1.1872.2.1.1.9.0"/>
+  <!-- Maintenance Statistics Table -->
+  <def name="slbStatPortMaintCurBindings"
+                                       value="1.3.6.1.4.1.1872.2.1.8.2.1.1.2"/>
+  <def name="slbStatPortMaintBindingFails"
+                                       value="1.3.6.1.4.1.1872.2.1.8.2.1.1.3"/>
+  <def name="slbStatPortMaintNonTcpFrames"
+                                       value="1.3.6.1.4.1.1872.2.1.8.2.1.1.4"/>
+  <def name="slbStatPortMaintTcpFragments"
+                                       value="1.3.6.1.4.1.1872.2.1.8.2.1.1.5"/>
+  <def name="slbStatPortMaintUdpDatagrams"
+                                       value="1.3.6.1.4.1.1872.2.1.8.2.1.1.6"/>
+  <def name="slbStatPortMaintIncorrectVIPs"
+                                       value="1.3.6.1.4.1.1872.2.1.8.2.1.1.7"/>
+  <def name="slbStatPortMaintIncorrectVports"
+                                       value="1.3.6.1.4.1.1872.2.1.8.2.1.1.8"/>
+  <def name="slbStatPortMaintRealServerNoAvails"
+                                       value="1.3.6.1.4.1.1872.2.1.8.2.1.1.9"/>
+  <def name="slbStatPortMaintFilteredDeniedFrames"
+                                      value="1.3.6.1.4.1.1872.2.1.8.2.1.1.10"/>
+
+  <!-- Virtual Server Table -->
+  <def name="slbStatVServerCurrSessions"
+                                       value="1.3.6.1.4.1.1872.2.1.8.2.7.1.2"/>
+  <def name="slbStatVServerTotalSessions"
+                                       value="1.3.6.1.4.1.1872.2.1.8.2.7.1.2"/>
+  <def name="slbStatVServerHighestSessions"
+                                       value="1.3.6.1.4.1.1872.2.1.8.2.7.1.4"/>
+  <def name="slbStatVServerHCOctetsLow32"
+                                       value="1.3.6.1.4.1.1872.2.1.8.2.7.1.6"/>
+  <def name="slbStatVServerHCOctetsHigh32"
+                                       value="1.3.6.1.4.1.1872.2.1.8.2.7.1.7"/>
+  <!-- not used yet -->
+  <def name="slbStatVServerHeaderHits" value="1.3.6.1.4.1.1872.2.1.8.2.7.1.8"/>
+  <def name="slbStatVServerHeaderMisses"
+                                       value="1.3.6.1.4.1.1872.2.1.8.2.7.1.9"/>
+  <def name="slbStatVServerHeaderTotalSessions"
+                                      value="1.3.6.1.4.1.1872.2.1.8.2.7.1.10"/>
+  <!-- // -->
+  <def name="memStatsAllocs"           value="1.3.6.1.4.1.1872.2.1.8.12.1.0"/>
+  <def name="memStatsFrees"            value="1.3.6.1.4.1.1872.2.1.8.12.2.0"/>
+  <def name="memStatsAllocFails"       value="1.3.6.1.4.1.1872.2.1.8.12.3.0"/>
+  <def name="memStatsBytesCurr"        value="1.3.6.1.4.1.1872.2.1.8.12.4.0"/>
+  <def name="memStatsBytesHiwat"       value="1.3.6.1.4.1.1872.2.1.8.12.5.0"/>
+  <def name="memStatsPoolBytes"        value="1.3.6.1.4.1.1872.2.1.8.12.6.0"/>
+  <def name="memStatsLargest"          value="1.3.6.1.4.1.1872.2.1.8.12.7.0"/>
+  <def name="pktStatsAllocs"           value="1.3.6.1.4.1.1872.2.1.8.13.1.0"/>
+  <def name="pktStatsFrees"            value="1.3.6.1.4.1.1872.2.1.8.13.2.0"/>
+  <def name="pktStatsAllocFails"       value="1.3.6.1.4.1.1872.2.1.8.13.3.0"/>
+  <def name="pktStatsMediums"          value="1.3.6.1.4.1.1872.2.1.8.13.4.0"/>
+  <def name="pktStatsJumbos"           value="1.3.6.1.4.1.1872.2.1.8.13.5.0"/>
+  <def name="pktStatsSmalls"           value="1.3.6.1.4.1.1872.2.1.8.13.6.0"/>
+  <def name="mpCpuAStatsUtil1Second"   value="1.3.6.1.4.1.1872.2.1.8.16.1.0"/>
+  <def name="mpCpuBStatsUtil1Second"   value="1.3.6.1.4.1.1872.2.1.8.16.2.0"/>
+  <def name="mpCpuAStatsUtil4Seconds"  value="1.3.6.1.4.1.1872.2.1.8.16.3.0"/>
+  <def name="mpCpuBStatsUtil4Seconds"  value="1.3.6.1.4.1.1872.2.1.8.16.4.0"/>
+  <def name="mpCpuAStatsUtil64Seconds" value="1.3.6.1.4.1.1872.2.1.8.16.5.0"/>
+  <def name="mpCpuBStatsUtil64Seconds" value="1.3.6.1.4.1.1872.2.1.8.16.6.0"/>
+
+</definitions>
+
+
+<datasources>
+  <!-- CPU Statistics -->
+  <template name="alteon-cpu">
+    <subtree name="CPU_Usage">
+      <param name="comment">
+        Alteon MP CPU statistics
+      </param>
+      <param name="data-file"         value="%system-id%_SLB_cpu.rrd"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="vertical-label"    value="Percentage"/>
+
+      <leaf name="CPU_A_1Sec">
+        <param name="precedence"      value="301"/>
+        <param name="comment"         value="Util of MP CPU A over 1 second"/>
+        <param name="graph-legend"    value="Utilization"/>
+        <param name="rrd-ds"          value="CpuAUtil1Sec"/>
+        <param name="snmp-object"     value="$mpCpuAStatsUtil1Second"/>
+      </leaf>
+
+      <leaf name="CPU_B_1Sec">
+        <param name="precedence"      value="300"/>
+        <param name="comment"         value="Util of MP CPU B over 1 second"/>
+        <param name="graph-legend"    value="Utilization"/>
+        <param name="rrd-ds"          value="CpuBUtil1Sec"/>
+        <param name="snmp-object"     value="$mpCpuBStatsUtil1Second"/>
+      </leaf>
+
+      <leaf name="CPU_A_4Secs">
+        <param name="precedence"      value="201"/>
+        <param name="comment"         value="Util of MP CPU A over 4 seconds"/>
+        <param name="graph-legend"    value="Utilization"/>
+        <param name="rrd-ds"          value="CpuAUtil4Sec"/>
+        <param name="snmp-object"     value="$mpCpuAStatsUtil4Seconds"/>
+      </leaf>
+
+      <leaf name="CPU_B_4Secs">
+        <param name="precedence"      value="200"/>
+        <param name="comment"         value="Util of MP CPU B over 4 seconds"/>
+        <param name="graph-legend"    value="Utilization"/>
+        <param name="rrd-ds"          value="CpuBUtil4Sec"/>
+        <param name="snmp-object"     value="$mpCpuBStatsUtil4Seconds"/>
+      </leaf>
+
+      <leaf name="CPU_A_64Secs">
+        <param name="precedence"      value="101"/>
+        <param name="comment"       value="Util of MP CPU A over 64 seconds"/>
+        <param name="graph-legend"    value="Utilization"/>
+        <param name="rrd-ds"          value="CpuAUtil64Sec"/>
+        <param name="snmp-object"     value="$mpCpuAStatsUtil64Seconds"/>
+      </leaf>
+
+      <leaf name="CPU_B_64Secs">
+        <param name="precedence"      value="100"/>
+        <param name="comment"       value="Util of MP CPU B over 64 seconds"/>
+        <param name="graph-legend"    value="Utilization"/>
+        <param name="rrd-ds"          value="CpuBUtil64Sec"/>
+        <param name="snmp-object"     value="$mpCpuBStatsUtil64Seconds"/>
+      </leaf>
+
+     <leaf name="Summary_1_Sec">
+        <param name="precedence"         value="999"/>
+        <param name="comment"            value="Util for 1 second"/>
+        <param name="title"              value="Percentage : 1 Second"/>
+        <param name="ds-type"            value="rrd-multigraph"/>
+        <param name="ds-names"           value="CPU_A,CPU_B"/>
+        <param name="graph-lower-limit"  value="0"/>
+        <!-- CPU A: 1 Second -->
+        <param name="ds-expr-CPU_A"      value="{CPU_A_1Sec}"/>
+        <param name="graph-legend-CPU_A" value="CPU A"/>
+        <param name="line-style-CPU_A"   value="LINE2"/>
+        <param name="line-color-CPU_A"   value="##one"/>
+        <param name="line-order-CPU_A"   value="1"/>
+        <!-- CPU B: 1 Second -->
+        <param name="ds-expr-CPU_B"      value="{CPU_B_1Sec}"/>
+        <param name="graph-legend-CPU_B" value="CPU B"/>
+        <param name="line-style-CPU_B"   value="LINE2"/>
+        <param name="line-color-CPU_B"   value="##two"/>
+        <param name="line-order-CPU_B"   value="2"/>
+     </leaf>
+
+     <leaf name="Summary_4_Secs">
+        <param name="precedence"         value="998"/>
+        <param name="comment"            value="Util for 4 seconds"/>
+        <param name="title"              value="Percentage : 4 Seconds"/>
+        <param name="ds-type"            value="rrd-multigraph"/>
+        <param name="ds-names"           value="CPU_A,CPU_B"/>
+        <param name="graph-lower-limit"  value="0"/>
+        <!-- CPU A: 4 Seconds -->
+        <param name="ds-expr-CPU_A"      value="{CPU_A_4Secs}"/>
+        <param name="graph-legend-CPU_A" value="CPU A"/>
+        <param name="line-style-CPU_A"   value="LINE2"/>
+        <param name="line-color-CPU_A"   value="##one"/>
+        <param name="line-order-CPU_A"   value="1"/>
+        <!-- CPU B: 4 Seconds -->
+        <param name="ds-expr-CPU_B"      value="{CPU_B_4Secs}"/>
+        <param name="graph-legend-CPU_B" value="CPU B"/>
+        <param name="line-style-CPU_B"   value="LINE2"/>
+        <param name="line-color-CPU_B"   value="##two"/>
+        <param name="line-order-CPU_B"   value="2"/>
+     </leaf>
+
+     <leaf name="Summary_64_Secs">
+        <param name="precedence"         value="997"/>
+        <param name="comment"            value="Util for 64 seconds"/>
+        <param name="title"              value="Percentage : 64 Seconds"/>
+        <param name="ds-type"            value="rrd-multigraph"/>
+        <param name="ds-names"           value="CPU_A,CPU_B"/>
+        <param name="graph-lower-limit"  value="0"/>
+        <!-- CPU A: 64 Seconds -->
+        <param name="ds-expr-CPU_A"      value="{CPU_A_64Secs}"/>
+        <param name="graph-legend-CPU_A" value="CPU A"/>
+        <param name="line-style-CPU_A"   value="LINE2"/>
+        <param name="line-color-CPU_A"   value="##one"/>
+        <param name="line-order-CPU_A"   value="1"/>
+        <!-- CPU B: 64 Seconds -->
+        <param name="ds-expr-CPU_B"      value="{CPU_B_64Secs}"/>
+        <param name="graph-legend-CPU_B" value="CPU B"/>
+        <param name="line-style-CPU_B"   value="LINE2"/>
+        <param name="line-color-CPU_B"   value="##two"/>
+        <param name="line-order-CPU_B"   value="2"/>
+     </leaf>
+    </subtree>
+  </template>
+
+  <!-- Memory Statistics -->
+  <template name="alteon-mem">
+    <subtree name="Memory_Usage">
+      <param name="comment">
+        Memory Statistics Group
+      </param>
+      <param name="data-file"         value="%system-id%_SLB_mem.rrd"/>
+
+      <leaf name="Memory_Alloc">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="precedence"        value="999"/>
+        <param name="comment"
+              value="Total number of memory allocations"/>
+        <param name="vertical-label"    value="Total"/>
+        <param name="graph-legend"      value="Number"/>
+        <param name="rrd-ds"            value="memStatsAllocs"/>
+        <param name="snmp-object"       value="$memStatsAllocs"/>
+      </leaf>
+
+      <leaf name="Memory_Free">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="precedence"        value="998"/>
+        <param name="comment"
+              value="Total number of memory frees"/>
+        <param name="vertical-label"    value="Total"/>
+        <param name="graph-legend"      value="Number"/>
+        <param name="rrd-ds"            value="memStatsFrees"/>
+        <param name="snmp-object"       value="$memStatsFrees"/>
+      </leaf>
+
+      <leaf name="Memory_Alloc_Fails">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="precedence"        value="997"/>
+        <param name="comment"
+              value="Total number of memory allocations failed"/>
+        <param name="vertical-label"    value="Total"/>
+        <param name="graph-legend"      value="Number"/>
+        <param name="rrd-ds"            value="memStatsAllocFails"/>
+        <param name="snmp-object"       value="$memStatsAllocFails"/>
+      </leaf>
+
+      <leaf name="Memory_Bytes_Curr">
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="precedence"        value="899"/>
+        <param name="comment"
+              value="Outstanding memory in bytes have been allocated"/>
+        <param name="vertical-label"    value="Bytes"/>
+        <param name="graph-legend"      value="Number"/>
+        <param name="rrd-ds"            value="memStatsBytesCurr"/>
+        <param name="snmp-object"       value="$memStatsBytesCurr"/>
+      </leaf>
+
+      <leaf name="Memory_Bytes_High_Water_Mark">
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="precedence"        value="898"/>
+        <param name="comment"
+              value="Bytes allocated witch high water mark"/>
+        <param name="vertical-label"    value="Bytes"/>
+        <param name="graph-legend"      value="Bytes"/>
+        <param name="rrd-ds"            value="memStatsBytesHiwat"/>
+        <param name="snmp-object"       value="$memStatsBytesHiwat"/>
+      </leaf>
+
+      <leaf name="Memory_Bytes_Total">
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="precedence"        value="897"/>
+        <param name="comment"
+              value="Total bytes in the memory pool"/>
+        <param name="vertical-label"    value="Bytes"/>
+        <param name="graph-legend"      value="Bytes"/>
+        <param name="rrd-ds"            value="memStatsPoolBytes"/>
+        <param name="snmp-object"       value="$memStatsPoolBytes"/>
+      </leaf>
+
+      <leaf name="Memory_Bytes_Largest_Alloc">
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="precedence"        value="896"/>
+        <param name="comment"
+              value="Largest block has been allocated"/>
+        <param name="vertical-label"    value="Bytes"/>
+        <param name="graph-legend"      value="Bytes"/>
+        <param name="rrd-ds"            value="memStatsLargest"/>
+        <param name="snmp-object"       value="$memStatsLargest"/>
+      </leaf>
+    </subtree>
+  </template>
+
+  <!-- Packet Statistics -->
+  <template name="alteon-packets">
+    <subtree name="Packet_Stats">
+      <param name="comment">
+        Packet Statistics Group
+      </param>
+      <param name="data-file"         value="%system-id%_SLB_pkts.rrd"/>
+
+      <leaf name="Packets_Alloc">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="precedence"        value="999"/>
+        <param name="comment"
+              value="Total packets which have been allocated"/>
+        <param name="vertical-label"    value="Total"/>
+        <param name="graph-legend"      value="Number"/>
+        <param name="rrd-ds"            value="pktStatsAllocs"/>
+        <param name="snmp-object"       value="$pktStatsAllocs"/>
+      </leaf>
+
+      <leaf name="Packets_Freed">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="precedence"        value="998"/>
+        <param name="comment"
+              value="Total packets which have been freed"/>
+        <param name="vertical-label"    value="Total"/>
+        <param name="graph-legend"      value="Number"/>
+        <param name="rrd-ds"            value="pktStatsFrees"/>
+        <param name="snmp-object"       value="$pktStatsFrees"/>
+      </leaf>
+
+      <leaf name="Packets_Alloc_Fails">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="precedence"        value="997"/>
+        <param name="comment"
+              value="Total packet allocations failed"/>
+        <param name="vertical-label"    value="Total"/>
+        <param name="graph-legend"      value="Number"/>
+        <param name="rrd-ds"            value="pktStatsAllocFails"/>
+        <param name="snmp-object"       value="$pktStatsAllocFails"/>
+      </leaf>
+      <!-- Packet Size information -->
+      <leaf name="Packets_Size_Small">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="precedence"        value="803"/>
+        <param name="comment"
+              value="Number of small size packets have been allocated"/>
+        <param name="vertical-label"    value="Total"/>
+        <param name="graph-legend"      value="Number"/>
+        <param name="rrd-ds"            value="pktStatsSmalls"/>
+        <param name="snmp-object"       value="$pktStatsSmalls"/>
+      </leaf>
+
+      <leaf name="Packets_Size_Medium">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="precedence"        value="802"/>
+        <param name="comment"
+              value="Number of medium size packets have been allocated"/>
+        <param name="vertical-label"    value="Total"/>
+        <param name="graph-legend"      value="Number"/>
+        <param name="rrd-ds"            value="pktStatsMediums"/>
+        <param name="snmp-object"       value="$pktStatsMediums"/>
+      </leaf>
+
+      <leaf name="Packets_Size_Jumbo">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="precedence"        value="801"/>
+        <param name="comment"
+              value="Number of jumbo size packets have been allocated"/>
+        <param name="vertical-label"    value="Total"/>
+        <param name="graph-legend"      value="Number"/>
+        <param name="rrd-ds"            value="pktStatsJumbos"/>
+        <param name="snmp-object"       value="$pktStatsJumbos"/>
+      </leaf>
+    </subtree>
+  </template>
+
+  <!-- Temperature Sensors -->
+  <template name="alteon-sensor">
+    <subtree name="Temperature">
+      <param name="comment">
+        Alteon Temperature Sensors
+      </param>
+      <param name="data-file"         value="%system-id%_SLB_sensor.rrd"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="vertical-label"    value="degrees Celsius"/>
+
+      <leaf name="All_Temperatures">
+        <param name="precedence"         value="1000"/>
+        <param name="comment"            value="Display all 4 temperatures"/>
+        <param name="title"              value="Temperature"/>
+        <param name="ds-type"            value="rrd-multigraph"/>
+        <param name="ds-names"           value="CPU_A,CPU_B,Temp3,Temp4"/>
+        <param name="graph-lower-limit"  value="0"/>
+        <!-- Temperature Sensor 1 -->
+        <param name="ds-expr-CPU_A"      value="{CPU_A}"/>
+        <param name="graph-legend-CPU_A" value="Hw Sensor 1: rear left"/>
+        <param name="line-style-CPU_A"   value="LINE2"/>
+        <param name="line-color-CPU_A"   value="##one"/>
+        <param name="line-order-CPU_A"   value="1"/>
+        <!-- Temperature Sensor 2 -->
+        <param name="ds-expr-CPU_B"      value="{CPU_B}"/>
+        <param name="graph-legend-CPU_B" value="Hw Sensor 2: rear middle"/>
+        <param name="line-style-CPU_B"   value="LINE2"/>
+        <param name="line-color-CPU_B"   value="##two"/>
+        <param name="line-order-CPU_B"   value="2"/>
+        <!-- Temperature Sensor 3 -->
+        <param name="ds-expr-Temp3"      value="{Temp3}"/>
+        <param name="graph-legend-Temp3" value="Hw Sensor 3: front middle"/>
+        <param name="line-style-Temp3"   value="LINE2"/>
+        <param name="line-color-Temp3"   value="##three"/>
+        <param name="line-order-Temp3"   value="3"/>
+        <!-- Temperature Sensor 4 -->
+        <param name="ds-expr-Temp4"      value="{Temp4}"/>
+        <param name="graph-legend-Temp4" value="Hw Sensor 4: front right"/>
+        <param name="line-style-Temp4"   value="LINE2"/>
+        <param name="line-color-Temp4"   value="##four"/>
+        <param name="line-order-Temp4"   value="4"/>
+      </leaf>
+      
+      <leaf name="CPU_A">
+        <param name="comment"         value="Temp of Sensor 1: rear left"/>
+        <param name="graph-legend"    value="degrees Celcius"/>
+        <param name="rrd-ds"          value="hwSensor1Temp"/>
+        <param name="snmp-object"     value="$hwSensor1Temp"/>
+      </leaf>
+
+      <leaf name="CPU_B">
+        <param name="comment"         value="Temp of Sensor 2: rear middle"/>
+        <param name="graph-legend"    value="degrees Celcius"/>
+        <param name="rrd-ds"          value="hwSensor2Temp"/>
+        <param name="snmp-object"     value="$hwSensor2Temp"/>
+      </leaf>
+
+      <leaf name="Temp3">
+        <param name="comment"         value="Temp of Sensor 3: front middle"/>
+        <param name="graph-legend"    value="degrees Celcius"/>
+        <param name="rrd-ds"          value="hwSensor3Temp"/>
+        <param name="snmp-object"     value="$hwSensor3Temp"/>
+      </leaf>
+
+      <leaf name="Temp4">
+        <param name="comment"         value="Temp of Sensor 4: front right"/>
+        <param name="graph-legend"    value="degrees Celcius"/>
+        <param name="rrd-ds"          value="hwSensor4Temp"/>
+        <param name="snmp-object"     value="$hwSensor4Temp"/>
+      </leaf>
+    </subtree>
+  </template>
+
+  <!-- SLB Virtual Servers Statistics Table -->
+  <template name="alteon-vserver-subtree">
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="currSess,totalSess"/>
+    <!-- Concurrent Sessions -->
+    <param name="overview-subleave-name-currSess" value="Current_Sessions"/>
+    <param name="overview-shortcut-text-currSess"
+           value="Concurrent Sessions"/>
+    <param name="overview-shortcut-title-currSess"
+           value="Show concurrent session summary for all VServers"/>
+    <param name="overview-page-title-currSess"
+           value="Concurrent VServer connection overview"/>
+    <!-- Total Sessions -->
+    <param name="overview-subleave-name-totalSess" value="Total_Sessions"/>
+    <param name="overview-shortcut-text-totalSess"
+           value="Total Sessions"/>
+    <param name="overview-shortcut-title-totalSess"
+           value="Show total session summary for all VServers"/>
+    <param name="overview-page-title-totalSess"
+           value="Total VServer connection overview"/>
+  </template>
+
+  <template name="alteon-vserver">
+    <param name="data-file"         value="%system-id%_SLB_vserver.rrd"/>
+    <param name="rrd-create-dstype" value="COUNTER"/>
+
+    <leaf name="Current_Sessions">
+      <param name="precedence"        value="999"/>
+      <param name="comment"           value="Number of concurrent sessions"/>
+      <param name="graph-legend"      value="Concurrent number"/>
+      <param name="vertical-label"    value="concurrent"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="rrd-ds"
+            value="CurrSessions_%alteon-vserver-index%"/>
+      <param name="snmp-object"
+            value="$slbStatVServerCurrSessions.%alteon-vserver-index%"/>
+    </leaf>
+
+    <leaf name="Total_Sessions">
+      <param name="precedence"     value="998"/>
+      <param name="comment"        value="Number of total sessions"/>
+      <param name="graph-legend"   value="total number"/>
+      <param name="vertical-label" value="total"/>
+      <param name="rrd-ds"
+            value="TotalSessions_%alteon-vserver-index%"/>
+      <param name="snmp-object"
+            value="$slbStatVServerTotalSessions.%alteon-vserver-index%"/>
+    </leaf>
+
+    <leaf name="Highest_Sessions">
+      <param name="precedence"     value="997"/>
+      <param name="comment"        value="Highest sessions handled"/>
+      <param name="graph-legend"   value="highest session count"/>
+      <param name="vertical-label" value="total"/>
+      <param name="rrd-ds"
+            value="HighestSessions_%alteon-vserver-index%"/>
+      <param name="snmp-object"
+            value="$slbStatVServerHighestSessions.%alteon-vserver-index%"/>
+    </leaf>
+
+    <leaf name="Octets_rcvd_xmit_Low32">
+      <param name="precedence"     value="996"/>
+      <param name="comment"        value="Lower 32bit value of rcvd/xmit"/>
+      <param name="graph-legend"   value="rcvd/xmit"/>
+      <param name="vertical-label" value="total"/>
+      <param name="rrd-ds"
+            value="HCOctetsLow32_%alteon-vserver-index%"/>
+      <param name="snmp-object"
+            value="$slbStatVServerHCOctetsLow32.%alteon-vserver-index%"/>
+    </leaf>
+
+    <leaf name="Octets_rcvd_xmit_High32">
+      <param name="precedence"     value="995"/>
+      <param name="comment"        value="Higher 32bit value of rcvd/xmit"/>
+      <param name="graph-legend"   value="rcvd/xmit"/>
+      <param name="vertical-label" value="total"/>
+      <param name="rrd-ds"
+            value="HCOctetsHigh32_%alteon-vserver-index%"/>
+      <param name="snmp-object"
+           value="$slbStatVServerHCOctetsHigh32.%alteon-vserver-index%"/>
+    </leaf>
+  </template>
+
+  <!-- SLB Port Maintenance Statistics Table -->
+  <template name="alteon-maint-subtree">
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="currBind,failSess,filterDeny"/>
+    <!-- Current Bindings -->
+    <param name="overview-subleave-name-currBind" value="Current_Bindings"/>
+    <param name="overview-shortcut-text-currBind"
+           value="Current Bindings"/>
+    <param name="overview-shortcut-title-currBind"
+           value="Show current number of bindings per port"/>
+    <param name="overview-page-title-currBind"
+           value="Current number of bindings overview"/>
+    <!-- Failed Bindings -->
+    <param name="overview-subleave-name-failSess" value="Failed_Bindings"/>
+    <param name="overview-shortcut-text-failSess"
+           value="Failed Bindings"/>
+    <param name="overview-shortcut-title-failSess"
+           value="Show total number of binding failures"/>
+    <param name="overview-page-title-failSess"
+           value="Total number of binding failures"/>
+    <!-- Filtered Denied Frames -->
+    <param name="overview-subleave-name-filterDeny"
+           value="Filtered_Denied_Frames"/>
+    <param name="overview-shortcut-text-filterDeny"
+           value="Frames denied"/>
+    <param name="overview-shortcut-title-filterDeny"
+           value="Show total number of frames denied by filters"/>
+    <param name="overview-page-title-filterDeny"
+           value="Total number of frames that are denied due to port filter"/>
+  </template>
+
+  <template name="alteon-maint">
+    <param name="data-file"         value="%system-id%_SLB_maint.rrd"/>
+    <param name="rrd-create-dstype" value="COUNTER"/>
+
+    <leaf name="Current_Bindings">
+      <param name="precedence"        value="999"/>
+      <param name="comment"           value="Current number of bindings"/>
+      <param name="graph-legend"      value="Current number"/>
+      <param name="vertical-label"    value="current"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="rrd-ds"
+            value="CurBindings_%alteon-maint-index%"/>
+      <param name="snmp-object"
+            value="$slbStatPortMaintCurBindings.%alteon-maint-index%"/>
+    </leaf>
+
+    <leaf name="Failed_Bindings">
+      <param name="precedence"        value="998"/>
+      <param name="comment"         value="Total number of binding failures"/>
+      <param name="graph-legend"      value="Total number"/>
+      <param name="vertical-label"    value="total"/>
+      <param name="rrd-ds"
+            value="BindingFails_%alteon-maint-index%"/>
+      <param name="snmp-object"
+            value="$slbStatPortMaintBindingFails.%alteon-maint-index%"/>
+    </leaf>
+
+    <leaf name="Non_TCP_Frames">
+      <param name="precedence"        value="997"/>
+      <param name="comment"
+            value="Total number of non-TCP/IP frames dropped on the port"/>
+      <param name="graph-legend"      value="Drops"/>
+      <param name="vertical-label"    value="total"/>
+      <param name="rrd-ds"
+            value="NonTcpFrames_%alteon-maint-index%"/>
+      <param name="snmp-object"
+            value="$slbStatPortMaintNonTcpFrames.%alteon-maint-index%"/>
+    </leaf>
+
+    <leaf name="TCP_Fragments">
+      <param name="precedence"        value="996"/>
+      <param name="comment"
+            value="Total number of TCP fragments dropped on the port"/>
+      <param name="graph-legend"      value="Drops"/>
+      <param name="vertical-label"    value="total"/>
+      <param name="rrd-ds"
+            value="TcpFragments_%alteon-maint-index%"/>
+      <param name="snmp-object"
+            value="$slbStatPortMaintTcpFragments.%alteon-maint-index%"/>
+    </leaf>
+
+    <leaf name="UDP_Datagrams">
+      <param name="precedence"        value="995"/>
+      <param name="comment"
+            value="Total number of UDP datagrams dropped on the port"/>
+      <param name="graph-legend"      value="Drops"/>
+      <param name="vertical-label"    value="total"/>
+      <param name="rrd-ds"
+            value="UdpDatagrams_%alteon-maint-index%"/>
+      <param name="snmp-object"
+            value="$slbStatPortMaintUdpDatagrams.%alteon-maint-index%"/>
+    </leaf>
+
+    <leaf name="Incorrect_VIPs">
+      <param name="precedence"        value="994"/>
+      <param name="comment"
+            value="Total number of frames with incorrect VIPs dropped"/>
+      <param name="graph-legend"      value="Drops"/>
+      <param name="vertical-label"    value="total"/>
+      <param name="rrd-ds"
+            value="IncorrectVIPs_%alteon-maint-index%"/>
+      <param name="snmp-object"
+            value="$slbStatPortMaintIncorrectVIPs.%alteon-maint-index%"/>
+    </leaf>
+
+    <leaf name="Incorrect_Vports">
+      <param name="precedence"        value="993"/>
+      <param name="comment"
+           value="Total number of frames with incorrect Virtual Port dropped"/>
+      <param name="graph-legend"      value="Drops"/>
+      <param name="vertical-label"    value="total"/>
+      <param name="rrd-ds"
+            value="IncorrectVports_%alteon-maint-index%"/>
+      <param name="snmp-object"
+            value="$slbStatPortMaintIncorrectVports.%alteon-maint-index%"/>
+    </leaf>
+
+    <leaf name="Real_Servers_Not_Avail">
+      <param name="precedence"        value="992"/>
+      <param name="comment"
+            value="Total number of frames that are dropped on the port because
+                   no real server is avail"/>
+      <param name="graph-legend"      value="Drops"/>
+      <param name="vertical-label"    value="total"/>
+      <param name="rrd-ds"
+            value="ServerNoAvails_%alteon-maint-index%"/>
+      <param name="snmp-object"
+            value="$slbStatPortMaintRealServerNoAvails.%alteon-maint-index%"/>
+    </leaf>
+
+    <leaf name="Filtered_Denied_Frames">
+      <param name="precedence"        value="991"/>
+      <param name="comment"
+            value="Total number of frames that are denied on the port
+                   by the filter"/>
+      <param name="graph-legend"      value="Drops"/>
+      <param name="vertical-label"    value="total"/>
+      <param name="rrd-ds"
+            value="FilDeniedFrames_%alteon-maint-index%"/>
+      <param name="snmp-object"
+          value="$slbStatPortMaintFilteredDeniedFrames.%alteon-maint-index%"/>
+    </leaf>
+  </template>
+
+</datasources>
+
+</configuration>
+
diff --git a/torrus/xmlconfig/vendor/alu-timetra.xml b/torrus/xmlconfig/vendor/alu-timetra.xml
new file mode 100644 (file)
index 0000000..f830224
--- /dev/null
@@ -0,0 +1,425 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright (C) 2010 Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+   Alcatel-Lucent ESS and SR routers
+
+  $Id: alu-timetra.xml,v 1.1 2010-12-27 00:04:21 ivan Exp $
+-->
+
+
+<configuration>
+  <definitions>
+   <!-- TIMETRA-SERV-MIB -->
+   <def name="sapBaseStatsIngressPchipDroppedPackets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.1"/>
+   <def name="sapBaseStatsIngressPchipDroppedOctets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.2"/>
+   <def name="sapBaseStatsIngressPchipOfferedHiPrioPackets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.3"/>
+   <def name="sapBaseStatsIngressPchipOfferedHiPrioOctets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.4"/>
+   <def name="sapBaseStatsIngressPchipOfferedLoPrioPackets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.5"/>
+   <def name="sapBaseStatsIngressPchipOfferedLoPrioOctets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.6"/>
+   <def name="sapBaseStatsIngressQchipDroppedHiPrioPackets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.7"/>
+   <def name="sapBaseStatsIngressQchipDroppedHiPrioOctets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.8"/>
+   <def name="sapBaseStatsIngressQchipDroppedLoPrioPackets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.9"/>
+   <def name="sapBaseStatsIngressQchipDroppedLoPrioOctets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.10"/>
+   <def name="sapBaseStatsIngressQchipForwardedInProfPackets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.11"/>
+   <def name="sapBaseStatsIngressQchipForwardedInProfOctets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.12"/>
+   <def name="sapBaseStatsIngressQchipForwardedOutProfPackets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.13"/>
+   <def name="sapBaseStatsIngressQchipForwardedOutProfOctets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.14"/>
+   <def name="sapBaseStatsEgressQchipDroppedInProfPackets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.15"/>
+   <def name="sapBaseStatsEgressQchipDroppedInProfOctets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.16"/>
+   <def name="sapBaseStatsEgressQchipDroppedOutProfPackets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.17"/>
+   <def name="sapBaseStatsEgressQchipDroppedOutProfOctets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.18"/>
+   <def name="sapBaseStatsEgressQchipForwardedInProfPackets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.19"/>
+   <def name="sapBaseStatsEgressQchipForwardedInProfOctets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.20"/>
+   <def name="sapBaseStatsEgressQchipForwardedOutProfPackets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.21"/>
+   <def name="sapBaseStatsEgressQchipForwardedOutProfOctets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.22"/>
+   <def name="sapBaseStatsIngressPchipOfferedUncoloredPackets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.24"/>
+   <def name="sapBaseStatsIngressPchipOfferedUncoloredOctets"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.25"/>
+   <def name="sapBaseStatsAuthenticationPktsDiscarded"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.26"/>
+   <def name="sapBaseStatsAuthenticationPktsSuccess"
+        value="1.3.6.1.4.1.6527.3.1.2.4.3.6.1.27"/>
+  </definitions>
+
+<datasources>
+
+  <template name="alu-timetra-customer">
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="traffic,discards"/>
+    
+    <param name="overview-subleave-name-traffic" value="InOut_bps"/>
+    <param name="overview-shortcut-text-traffic"
+           value="Traffic"/>
+    <param name="overview-shortcut-title-traffic"
+           value="Show egress and ingress traffic for all SAPs on one page"/>
+    <param name="overview-page-title-traffic"
+           value="Egress/ingress traffic graphs"/>
+    <param name="overview-direct-link-traffic"      value="yes"/>
+    <param name="overview-direct-link-view-traffic"
+           value="expanded-dir-html"/>
+    
+    <param name="overview-subleave-name-discards">
+      IngressQchipDroppedHiPrioPackets,
+      IngressQchipDroppedLoPrioPackets,
+      EgressQchipDroppedInProfPackets,
+      EgressQchipDroppedOutProfPackets
+    </param>
+    <param name="overview-shortcut-text-discards"
+           value="Discards"/>
+    <param name="overview-shortcut-title-discards"
+           value="Show all packet discards for all SAPs on one page"/>
+    <param name="overview-page-title-discards"
+           value="Packet Discards"/>
+    <param name="overview-direct-link-discards"      value="yes"/>
+    <param name="overview-direct-link-view-discards"
+           value="expanded-dir-html"/>
+  </template>
+
+  
+    <template name="alu-timetra-sap">
+      <param name="collector-timeoffset-hashstring"
+        value="%system-id%:%timetra-sap-id%" />
+      <param name="data-file"
+        value="%system-id%_sap_%timetra-sap-id%_%timetra-stat-category%.rrd"/>
+
+      <param name="descriptive-nickname"
+             value="%system-id% %timetra-sap-name%"/>
+      <param name="graph-title" value="%descriptive-nickname%" />
+      
+      <param name="snmp-object-type"  value="COUNTER64" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="ext-dstype"        value="COUNTER64" />
+      <param name="rrd-create-max"    value="1e15"/>
+      <param name="ext-counter-max"   value="1e15"/>
+      <param name="graph-lower-limit" value="0" />
+
+      <param name="nodeid-sap">
+        sap//%nodeid-device%//%timetra-customer-id%//%timetra-sap-name%
+      </param>
+
+      <leaf name="InOut_bps">
+        <param name="comment"
+          value="Egress and Ingress bits per second graph"/>
+        <param name="vertical-label"   value="bps" />
+        <param name="graph-lower-limit" value="0" />
+        <param name="rrd-hwpredict"    value="disabled" />
+        <param name="precedence"       value="5000" />
+        <param name="nodeid"           value="%nodeid-sap%//inoutbit"/>
+
+        <param name="ds-type"          value="rrd-multigraph" />
+        <param name="ds-names"         value="ingrinp,ingrop,egrinp,egrop" />
+
+        <param name="ds-expr-ingrinp"
+          value="{IngressQchipForwardedInProfOctets},8,*" />
+        <param name="graph-legend-ingrinp"
+          value="Ingress bps in-profile" />
+        <param name="line-style-ingrinp"    value="AREA" />
+        <param name="line-color-ingrinp"    value="##green" />
+        <param name="line-order-ingrinp"    value="1" />
+
+        <param name="ds-expr-ingrop"
+          value="{IngressQchipForwardedOutProfOctets},8,*" />
+        <param name="graph-legend-ingrop"
+          value="Ingress bps out-of-profile" />
+        <param name="line-style-ingrop"   value="AREA" />
+        <param name="line-stack-ingrop"   value="yes" />
+        <param name="line-color-ingrop"   value="##green75" />
+        <param name="line-order-ingrop"   value="2" />
+
+        <param name="ds-expr-egrinp"
+          value="{EgressQchipForwardedInProfOctets},8,*" />
+        <param name="graph-legend-egrinp"
+          value="Egress bps in-profile" />
+        <param name="line-style-egrinp"    value="LINE2" />        
+        <param name="line-color-egrinp"    value="##blue" />
+        <param name="line-order-egrinp"    value="11" />
+
+        <param name="ds-expr-egrop"
+          value="{EgressQchipForwardedOutProfOctets},8,*" />
+        <param name="graph-legend-egrop"
+           value="Egress bps out-of-profile" />
+        <param name="line-style-egrop"   value="LINE1.5" />
+        <param name="line-color-egrop"   value="##blue75" />
+        <param name="line-stack-egrop"   value="yes" />
+        <param name="line-order-egrop"   value="12" />
+      </leaf>
+
+            
+
+      <leaf name="IngressQchipDroppedHiPrioPackets">
+        <param name="timetra-stat-category"  value="IngressQchip" />        
+        <param name="snmp-object">
+         $sapBaseStatsIngressQchipDroppedHiPrioPackets.%timetra-sap-id%
+        </param>
+        <param name="rrd-ds"            value="DropHPrPkt" />
+        <param name="comment"
+           value="The number of high priority packets dropped by the Qchip" />
+        <param name="graph-legend"      value="Ingress HPr packets dropped" />
+        <param name="vertical-label"    value="pps" />
+        <param name="precedence"        value="1000" />
+      </leaf>
+      
+      <leaf name="IngressQchipDroppedHiPrioOctets">
+        <param name="timetra-stat-category"  value="IngressQchip" />        
+        <param name="snmp-object">
+         $sapBaseStatsIngressQchipDroppedHiPrioOctets.%timetra-sap-id%
+        </param>
+        <param name="rrd-ds"            value="DropHPrOct" />
+        <param name="comment">
+         The number of high priority octets dropped by the Qchip
+        </param>
+        <param name="graph-legend"      value="Ingress HPr bytes dropped" />
+        <param name="vertical-label"    value="Bps" />
+        <param name="precedence"        value="990" />
+      </leaf>
+
+
+      
+      <leaf name="IngressQchipDroppedLoPrioPackets">
+        <param name="timetra-stat-category"  value="IngressQchip" />        
+        <param name="snmp-object">
+         $sapBaseStatsIngressQchipDroppedLoPrioPackets.%timetra-sap-id%"
+        </param>
+        <param name="rrd-ds"            value="DropLPrPkt" />
+        <param name="comment">
+         The number of low priority packets dropped by the Qchip
+        </param>
+        <param name="graph-legend"      value="Ingress LPr packets dropped" />
+        <param name="vertical-label"    value="pps" />
+        <param name="precedence"        value="980" />
+      </leaf>
+      
+      <leaf name="IngressQchipDroppedLoPrioOctets">
+        <param name="timetra-stat-category"  value="IngressQchip" />        
+        <param name="snmp-object">
+          $sapBaseStatsIngressQchipDroppedLoPrioOctets.%timetra-sap-id%
+        </param>
+        <param name="rrd-ds"            value="DropLPrOct" />
+        <param name="comment">
+         The number of low priority octets dropped by the Qchip
+        </param>
+        <param name="graph-legend"      value="Ingress LPr bytes dropped" />
+        <param name="vertical-label"    value="Bps" />
+        <param name="precedence"        value="970" />
+      </leaf>
+
+
+
+      <leaf name="IngressQchipForwardedInProfPackets">
+        <param name="timetra-stat-category"  value="IngressQchip" />        
+        <param name="snmp-object">
+         $sapBaseStatsIngressQchipForwardedInProfPackets.%timetra-sap-id%
+        </param>
+        <param name="rrd-ds"            value="FwInProfPkt" />
+        <param name="comment">
+         The number of in-profile packets forwarded by the ingress Qchip
+        </param>
+        <param name="graph-legend"    value="Ingress INP packets forwarded" />
+        <param name="vertical-label"    value="pps" />
+        <param name="precedence"        value="960" />
+      </leaf>
+      
+      <leaf name="IngressQchipForwardedInProfOctets">
+        <param name="timetra-stat-category"  value="IngressQchip" />        
+        <param name="snmp-object">
+         $sapBaseStatsIngressQchipForwardedInProfOctets.%timetra-sap-id%
+        </param>
+        <param name="rrd-ds"            value="FwInProfOct" />
+        <param name="comment">
+         The number of in-profile octets forwarded by the ingress Qchip
+        </param>
+        <param name="graph-legend"      value="Ingress INP bytes forwarded" />
+        <param name="vertical-label"    value="Bps" />
+        <param name="precedence"        value="950" />
+      </leaf>
+
+
+      <leaf name="IngressQchipForwardedOutProfPackets">
+        <param name="timetra-stat-category"  value="IngressQchip" />        
+        <param name="snmp-object">
+         $sapBaseStatsIngressQchipForwardedInProfPackets.%timetra-sap-id%
+        </param>
+        <param name="rrd-ds"            value="FwOutProfPkt" />
+        <param name="comment">
+         The number of in-profile packets forwarded by the ingress Qchip
+        </param>
+        <param name="graph-legend"      value="Ingress OP packets forwarded" />
+        <param name="vertical-label"    value="pps" />
+        <param name="precedence"        value="940" />
+      </leaf>
+      
+      <leaf name="IngressQchipForwardedOutProfOctets">
+        <param name="timetra-stat-category"  value="IngressQchip" />        
+        <param name="snmp-object">
+         $sapBaseStatsIngressQchipForwardedOutProfOctets.%timetra-sap-id%
+        </param>
+        <param name="rrd-ds"            value="FwOutProfOct" />
+        <param name="comment">
+         The number of in-profile octets forwarded by the ingress Qchip
+        </param>
+        <param name="graph-legend"      value="Ingress OP bytes forwarded" />
+        <param name="vertical-label"    value="Bps" />
+        <param name="precedence"        value="930" />
+      </leaf>
+
+
+
+
+      <leaf name="EgressQchipDroppedInProfPackets">
+        <param name="timetra-stat-category"  value="EgressQchip" />        
+        <param name="snmp-object">
+         $sapBaseStatsEgressQchipDroppedInProfPackets.%timetra-sap-id%
+        </param>
+        <param name="rrd-ds"            value="DropInProfPkt" />
+        <param name="comment">
+         The number of in-profile packets discarded by the egress Qchip
+        </param>
+        <param name="graph-legend"      value="Egress INP packets dropped" />
+        <param name="vertical-label"    value="pps" />
+        <param name="precedence"        value="700" />
+      </leaf>
+      
+      <leaf name="EgressQchipDroppedInProfOctets">
+        <param name="timetra-stat-category"  value="EgressQchip" />        
+        <param name="snmp-object">
+         $sapBaseStatsEgressQchipDroppedInProfOctets.%timetra-sap-id%
+        </param>
+        <param name="rrd-ds"            value="DropInProfOct" />
+        <param name="comment">
+         The number of in-profile octets discarded by the egress Qchip
+        </param>
+        <param name="graph-legend"      value="Egress INP bytes dropped" />
+        <param name="vertical-label"    value="Bps" />
+        <param name="precedence"        value="690" />
+      </leaf>
+
+
+      <leaf name="EgressQchipDroppedOutProfPackets">
+        <param name="timetra-stat-category"  value="EgressQchip" />        
+        <param name="snmp-object">
+         $sapBaseStatsEgressQchipDroppedOutProfPackets.%timetra-sap-id%
+        </param>
+        <param name="rrd-ds"            value="DropOutProfPkt" />
+        <param name="comment">
+         The number of out-of-profile packets discarded by the egress Qchip
+        </param>
+        <param name="graph-legend"      value="Egress OP packets dropped" />
+        <param name="vertical-label"    value="pps" />
+        <param name="precedence"        value="680" />
+      </leaf>
+      
+      <leaf name="EgressQchipDroppedOutProfOctets">
+        <param name="timetra-stat-category"  value="EgressQchip" />        
+        <param name="snmp-object">
+         $sapBaseStatsEgressQchipDroppedOutProfOctets.%timetra-sap-id%
+        </param>
+        <param name="rrd-ds"            value="DropOutProfOct" />
+        <param name="comment">
+         The number of out-of-profile octets discarded by the egress Qchip
+        </param>
+        <param name="graph-legend"      value="Egress OP bytes dropped" />
+        <param name="vertical-label"    value="Bps" />
+        <param name="precedence"        value="670" />
+      </leaf>
+
+
+      <leaf name="EgressQchipForwardedInProfPackets">
+        <param name="timetra-stat-category"  value="EgressQchip" />        
+        <param name="snmp-object">
+         $sapBaseStatsEgressQchipForwardedInProfPackets.%timetra-sap-id%
+        </param>
+        <param name="rrd-ds"            value="FwInProfPkt" />
+        <param name="comment">
+         The number of in-profile packets forwarded by the egress Qchip
+        </param>
+        <param name="graph-legend"      value="Egress INP packets forwarded" />
+        <param name="vertical-label"    value="pps" />
+        <param name="precedence"        value="660" />
+      </leaf>
+      
+      <leaf name="EgressQchipForwardedInProfOctets">
+        <param name="timetra-stat-category"  value="EgressQchip" />        
+        <param name="snmp-object">
+         $sapBaseStatsEgressQchipForwardedInProfOctets.%timetra-sap-id%
+        </param>
+        <param name="rrd-ds"            value="FwInProfOct" />
+        <param name="comment">
+         The number of in-profile octets forwarded by the egress Qchip
+        </param>
+        <param name="graph-legend"      value="Egress INP bytes forwarded" />
+        <param name="vertical-label"    value="Bps" />
+        <param name="precedence"        value="650" />
+      </leaf>
+
+
+      <leaf name="EgressQchipForwardedOutProfPackets">
+        <param name="timetra-stat-category"  value="EgressQchip" />        
+        <param name="snmp-object">
+         $sapBaseStatsEgressQchipForwardedInProfPackets.%timetra-sap-id%
+        </param>
+        <param name="rrd-ds"            value="FwOutProfPkt" />
+        <param name="comment">
+         The number of in-profile packets forwarded by the egress Qchip
+        </param>
+        <param name="graph-legend"      value="Egress OP packets forwarded" />
+        <param name="vertical-label"    value="pps" />
+        <param name="precedence"        value="640" />
+      </leaf>
+      
+      <leaf name="EgressQchipForwardedOutProfOctets">
+        <param name="timetra-stat-category"  value="EgressQchip" />        
+        <param name="snmp-object">
+         $sapBaseStatsEgressQchipForwardedOutProfOctets.%timetra-sap-id%
+        </param>
+        <param name="rrd-ds"            value="FwOutProfOct" />
+        <param name="comment">
+         The number of in-profile octets forwarded by the egress Qchip
+        </param>
+        <param name="graph-legend"      value="Egress OP bytes forwarded" />
+        <param name="vertical-label"    value="Bps" />
+        <param name="precedence"        value="630" />
+      </leaf>
+      
+
+    </template>
+        
+  </datasources>
+</configuration>
diff --git a/torrus/xmlconfig/vendor/apc.ups.xml b/torrus/xmlconfig/vendor/apc.ups.xml
new file mode 100644 (file)
index 0000000..5ee2a65
--- /dev/null
@@ -0,0 +1,135 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+   Copyright (C) 2003  Aaron S. Bush  <abush at microelectronics dot com>
+
+   File: vendor/apc.ups.xml
+   Description: APC UPS battery monitor definitions and templates for Torrus.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+-->
+
+<!--
+    Tested with APC Matrix 5000 and 3000 units using internal or
+    external Web/SNMP mgmt. cards via SNMP v1.
+-->
+
+
+<configuration>
+
+<definitions>
+  <!-- APC UPS MIB -->
+  <def name="apcUpsAdvBatteryRunTimeRemaining"
+                          value="1.3.6.1.4.1.318.1.1.1.2.2.3" />
+  <def name="apcUpsAdvBatteryCapacity"
+                          value="1.3.6.1.4.1.318.1.1.1.2.2.1" />
+  <def name="apcUpsAdvBatteryTemperature"
+                          value="1.3.6.1.4.1.318.1.1.1.2.2.2" />
+  <def name="apcUpsAdvOutputLoad"
+                          value="1.3.6.1.4.1.318.1.1.1.4.2.3" />
+  <def name="apcUpsAdvOutputCurrent"
+                          value="1.3.6.1.4.1.318.1.1.1.4.2.4" />
+</definitions>
+
+<datasources>
+
+  <template name="apcups-health">
+    <param name="data-file"     value="%system-id%_health.rrd" />
+
+    <leaf name="Battery_Runtime_Ticks">
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="precedence"         value="90" />
+      <param name="snmp-object"
+             value="$apcUpsAdvBatteryRunTimeRemaining.0"/>
+      <param name="rrd-ds"             value="BatRunTimeRemain" />
+      <param name="comment">
+          The UPS Battery Runtime (Ticks)
+      </param>
+      <param name="graph-legend"       value="Runtime (Ticks)" />
+    </leaf>
+
+    <leaf name="Battery_Runtime_Minutes">
+      <param name="ds-type"             value="rrd-file" />
+      <param name="leaf-type"           value="rrd-cdef" />
+      <param name="precedence"          value="100" />
+      <param name="rpn-expr"
+             value="{Battery_Runtime_Ticks},6000,/" />
+      <param name="comment">
+          The UPS Battery Runtime (Minutes)
+      </param>
+      <param name="graph-legend"       value="Runtime (Minutes)" />
+    </leaf>
+
+    <leaf name="Battery_Capacity">
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="precedence"         value="85" />
+      <param name="snmp-object"        value="$apcUpsAdvBatteryCapacity.0"/>
+      <param name="rrd-ds"             value="BatteryCapacity" />
+      <param name="comment">
+          The remaining battery capacity expressed in percent of full capacity.
+      </param>
+      <param name="graph-legend"       value="Percent Capacity" />
+    </leaf>
+
+    <leaf name="Battery_Temperature_Celsius">
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="precedence"         value="70" />
+      <param name="snmp-object"        value="$apcUpsAdvBatteryTemperature.0"/>
+      <param name="rrd-ds"             value="IntTemperature" />
+      <param name="comment">
+          The UPS Internal Temperature (Celsius)
+      </param>
+      <param name="graph-legend"       value="Temperature (Celsius)" />
+    </leaf>
+
+    <leaf name="Battery_Temperature_Fahrenheit">
+      <param name="ds-type"             value="rrd-file" />
+      <param name="leaf-type"           value="rrd-cdef" />
+      <param name="precedence"          value="80" />
+      <param name="rpn-expr"
+             value="32,{Battery_Temperature_Celsius},1.8,*,+" />
+      <param name="comment">
+          The UPS Internal Temperature (Fahrenheit)
+      </param>
+      <param name="graph-legend"       value="Temperature (Fahrenheit)" />
+    </leaf>
+
+    <leaf name="Battery_Output_Load">
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="precedence"         value="60" />
+      <param name="snmp-object"        value="$apcUpsAdvOutputLoad.0"/>
+      <param name="rrd-ds"             value="OutputLoad" />
+      <param name="comment">
+          The current UPS load expressed in percent of rated capacity.
+      </param>
+      <param name="graph-legend"       value="Percent Load" />
+    </leaf>
+
+    <leaf name="Battery_Output_Current">
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="precedence"         value="50" />
+      <param name="snmp-object"        value="$apcUpsAdvOutputCurrent.0"/>
+      <param name="rrd-ds"             value="OutputCurrent" />
+      <param name="comment">
+          The current in ampres drawn by the load on the UPS.
+      </param>
+      <param name="graph-legend"       value="Current Ampres" />
+    </leaf>
+  </template>
+  <!-- apcups-health -->
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/apple.ae.xml b/torrus/xmlconfig/vendor/apple.ae.xml
new file mode 100644 (file)
index 0000000..6f9990d
--- /dev/null
@@ -0,0 +1,181 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2007 Jon Nistor
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: apple.ae.xml,v 1.1 2010-12-27 00:04:17 ivan Exp $
+  Jon Nistor <nistor at snickers dot org>
+
+-->
+<!-- Apple Airport Extreme -->
+
+<configuration>
+
+<definitions>
+  <!-- AIRPORT-BASESTATION-3-MIB::baseStation3 -->
+  <def name="wirelessNumber"      value="1.3.6.1.4.1.63.501.3.2.1.0"/>
+
+  <def name="wirelessStrength"    value="1.3.6.1.4.1.63.501.3.2.2.1.6"/>
+  <def name="wirelessNoise"       value="1.3.6.1.4.1.63.501.3.2.2.1.7"/>
+  <def name="wirelessRate"        value="1.3.6.1.4.1.63.501.3.2.2.1.8"/>
+  <def name="wirelessNumRX"       value="1.3.6.1.4.1.63.501.3.2.2.1.9"/>
+  <def name="wirelessNumTX"       value="1.3.6.1.4.1.63.501.3.2.2.1.10"/>
+  <def name="wirelessNumRXErrors" value="1.3.6.1.4.1.63.501.3.2.2.1.11"/>
+  <def name="wirelessNumTXErrors" value="1.3.6.1.4.1.63.501.3.2.2.1.12"/>
+
+  <def name="dhcpNumber"          value="1.3.6.1.4.1.63.501.3.3.1.0"/>
+</definitions>
+
+
+<datasources>
+  <template name="ae-global-stats">
+    <subtree name="Global_Stats">
+        <param name="comment"           value="Global statistics"/>
+        <param name="data-file"         value="%system-id%_global.rrd"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+
+        <leaf name="DHCP_Clients">
+            <param name="comment"     value="Total number of DHCP clients"/>
+            <param name="graph-title" value="%system-id%:DHCP Clients"/>
+            <param name="rrd-ds"      value="dhcpNumber"/>
+            <param name="snmp-object" value="$dhcpNumber"/>
+        </leaf>
+        <leaf name="Wireless_Clients">
+            <param name="comment"     value="Total number of wireless clients"/>
+            <param name="graph-title" value="%system-id%:Wireless Clients"/>
+            <param name="rrd-ds"      value="wirelessNumber"/>
+            <param name="snmp-object" value="$wirelessNumber"/>
+        </leaf>
+    </subtree>
+  </template>
+
+
+  <template name="ae-wireless-clients-subtree">
+    <param name="comment" value="Wireless client information"/>
+    <param name="has-overview-shortcuts"     value="yes"/>
+    <param name="overview-shortcuts"         value="strength,rate,noise"/>
+    <!-- Wireless Strength -->
+    <param name="overview-subleave-name-strength"
+           value="Wireless_Strength"/>
+    <param name="overview-shortcut-text-strength"
+           value="All wireless strength"/>
+    <param name="overview-shortcut-title-strength"
+           value="Show all wireless client strengths"/>
+    <param name="overview-page-title-strength"
+           value="Wireless strength overview per client"/>
+    <!-- Wireless Rate -->
+    <param name="overview-subleave-name-rate"
+           value="Wireless_Rate"/>
+    <param name="overview-shortcut-text-rate"
+           value="All wireless rates"/>
+    <param name="overview-shortcut-title-rate"
+           value="Show all wireless client rates"/>
+    <param name="overview-page-title-rate"
+           value="Wireless rate overview per client"/>
+    <!-- Wireless Noise -->
+    <param name="overview-subleave-name-noise"
+           value="Wireless_Noise"/>
+    <param name="overview-shortcut-text-noise"
+           value="All wireless noise"/>
+    <param name="overview-shortcut-title-noise"
+           value="Show all wireless client noise"/>
+    <param name="overview-page-title-noise"
+           value="Wireless noise overview per client"/>
+  </template>
+
+
+  <template name="ae-wireless-clients-leaf">
+    <param name="comment"            value="%wireless-mac%"/>
+    <param name="data-file"
+           value="%system-id%_wireless_%wireless-macFix%.rrd"/>
+    <param name="graph-title"        value="%system-id%:%wireless-mac%"/>
+    <param name="graph-lower-limit"  value="0"/>
+    <param name="snmp-object-type"   value="COUNTER64" />
+
+    <leaf name="Wireless_Strength">
+        <param name="comment"
+               value="The signal strength reported by the wireless client"/>
+        <param name="graph-legend"       value="Signal"/>
+        <param name="precedence"         value="910"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-create-min"     value="U"/>
+        <param name="rrd-ds"             value="wirelessStrength"/>
+        <param name="snmp-object"
+               value="$wirelessStrength.%wireless-macOid%"/>
+    </leaf>
+    <leaf name="Wireless_Noise">
+        <param name="comment"
+               value="The noise reported by the wireless client"/>
+        <param name="graph-legend"       value="Noise"/>
+        <param name="precedence"         value="909"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-create-min"     value="U"/>
+        <param name="rrd-ds"             value="wirelessNoise"/>
+        <param name="snmp-object"
+               value="$wirelessNoise.%wireless-macOid%"/>
+    </leaf>
+    <leaf name="Wireless_Rate">
+        <param name="comment"
+               value="The rate reported by the wireless client"/>
+        <param name="graph-legend"       value="Rate"/>
+        <param name="precedence"         value="908"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-ds"             value="wirelessRate"/>
+        <param name="snmp-object"
+               value="$wirelessRate.%wireless-macOid%"/>
+    </leaf>
+    <leaf name="Received_Packets">
+        <param name="comment"           value="The number of packets received"/>
+        <param name="graph-legend"      value="Packets"/>
+        <param name="precedence"        value="907"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="rrd-ds"            value="wirelessNumRX"/>
+        <param name="snmp-object"
+               value="$wirelessNumRX.%wireless-macOid%"/>
+    </leaf>
+    <leaf name="Transmitted_Packets">
+        <param name="comment"     value="The number of packets transmitted"/>
+        <param name="graph-legend"       value="Packets"/>
+        <param name="precedence"         value="906"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="rrd-ds"            value="wirelessNumTX"/>
+        <param name="snmp-object"
+               value="$wirelessNumTX.%wireless-macOid%"/>
+    </leaf>
+    <leaf name="Received_Packets_Errors">
+        <param name="comment"    value="The number of error packets received"/>
+        <param name="graph-legend"      value="Packets"/>
+        <param name="precedence"        value="905"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="rrd-ds"            value="wirelessNumRXErrors"/>
+        <param name="snmp-object"
+               value="$wirelessNumRXErrors.%wireless-macOid%"/>
+    </leaf>
+    <leaf name="Transmitted_Packets_Errors">
+        <param name="comment"    value="The number of error packets transmit"/>
+        <param name="graph-legend"      value="Packets"/>
+        <param name="precedence"        value="904"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="rrd-ds"            value="wirelessNumTXErrors"/>
+        <param name="snmp-object"
+               value="$wirelessNumTXErrors.%wireless-macOid%"/>
+    </leaf>
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/arbor_e.xml b/torrus/xmlconfig/vendor/arbor_e.xml
new file mode 100644 (file)
index 0000000..cc4a364
--- /dev/null
@@ -0,0 +1,2820 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2008-2010 Jon Nistor
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: arbor_e.xml,v 1.1 2010-12-27 00:04:16 ivan Exp $
+  Jon Nistor <nistor at snickers dot org>
+
+-->
+<!--
+     Arbor e-Series specific definitions (former Ellacoya)
+     Devices include: e30, e100
+ -->
+
+<configuration>
+
+<definitions>
+  <!-- ELLACOYA-MIB::hostMemory -->
+  <def name="sdramSize"           value="1.3.6.1.4.1.3813.1.4.2.1.0" />
+  <def name="sdramUsage"          value="1.3.6.1.4.1.3813.1.4.2.2.0" />
+  <def name="mBufPoolSize"        value="1.3.6.1.4.1.3813.1.4.2.3.0" />
+  <def name="mBufUsage"           value="1.3.6.1.4.1.3813.1.4.2.4.0" />
+  <def name="blkSize"             value="1.3.6.1.4.1.3813.1.4.2.5.1.2" />
+  <def name="sysMal"              value="1.3.6.1.4.1.3813.1.4.2.5.1.4" />
+  <def name="sysBlks"             value="1.3.6.1.4.1.3813.1.4.2.5.1.6" />
+  <def name="usedBlks"            value="1.3.6.1.4.1.3813.1.4.2.5.1.7" />
+  <def name="freeBlks"            value="1.3.6.1.4.1.3813.1.4.2.5.1.8" />
+
+  <def name="hDriveHd0Size"       value="1.3.6.1.4.1.3813.1.4.2.6.0" />
+  <def name="hDriveHd0Usage"      value="1.3.6.1.4.1.3813.1.4.2.7.0" />
+  <def name="hDriveHd1Size"       value="1.3.6.1.4.1.3813.1.4.2.8.0" />
+  <def name="hDriveHd1Usage"      value="1.3.6.1.4.1.3813.1.4.2.9.0" />
+
+  <def name="hDriveErrBlockRW"    value="1.3.6.1.4.1.3813.1.4.2.10.1.0" />
+  <def name="hDriveErrCommand"    value="1.3.6.1.4.1.3813.1.4.2.10.2.0" />
+  <def name="hDriveErrReadWrite"  value="1.3.6.1.4.1.3813.1.4.2.10.3.0" />
+  <def name="hDriveErrWriteOnly"  value="1.3.6.1.4.1.3813.1.4.2.10.4.0" />
+  <def name="hDriveErrReady"      value="1.3.6.1.4.1.3813.1.4.2.10.5.0" />
+  <def name="hDriveErrBusy"       value="1.3.6.1.4.1.3813.1.4.2.10.6.0" />
+  <def name="hDriveErrDataReq"    value="1.3.6.1.4.1.3813.1.4.2.10.7.0" />
+  <def name="hDriveErrSeek"       value="1.3.6.1.4.1.3813.1.4.2.10.8.0" />
+  <def name="hDriveErrDataReqNS"  value="1.3.6.1.4.1.3813.1.4.2.10.9.0" />
+  <def name="hDriveErrInterfCRC"  value="1.3.6.1.4.1.3813.1.4.2.10.10.0" />
+  <def name="hDriveErrUncorrData" value="1.3.6.1.4.1.3813.1.4.2.10.11.0" />
+  <def name="hDriveErrIdNotFound" value="1.3.6.1.4.1.3813.1.4.2.10.12.0" />
+  <def name="hDriveErrAbortedCmd" value="1.3.6.1.4.1.3813.1.4.2.10.13.0" />
+  <def name="hDriveErrTrack0NF"   value="1.3.6.1.4.1.3813.1.4.2.10.14.0" />
+  <def name="hDriveErrAddrMarkNF" value="1.3.6.1.4.1.3813.1.4.2.10.15.0" />
+
+  <def name="partitionSize"       value="1.3.6.1.4.1.3813.1.4.2.11.1.3" />
+  <def name="partitionUsage"      value="1.3.6.1.4.1.3813.1.4.2.11.1.4" />
+
+  <!-- e100 / memPerCpu-->
+  <def name="cpuSdramSize"        value="1.3.6.1.4.1.3813.1.4.2.12.1.2" />
+  <def name="cpuSdramUsage"       value="1.3.6.1.4.1.3813.1.4.2.12.1.3" />
+
+  <def name="hDriveDailyLogSize"  value="1.3.6.1.4.1.3813.1.4.2.13.0" />
+  <def name="hDriveDailyLogUsage" value="1.3.6.1.4.1.3813.1.4.2.14.0" />
+
+  <!-- ELLACOYA-MIB::fwdTables -->
+  <def name="l3UserTblCapacity"          value="1.3.6.1.4.1.3813.1.4.3.1.0" />
+  <def name="l3UserTblUsage"             value="1.3.6.1.4.1.3813.1.4.3.2.0" />
+  <def name="macTblCapacity"             value="1.3.6.1.4.1.3813.1.4.3.3.0" />
+  <def name="macTblUsage"                value="1.3.6.1.4.1.3813.1.4.3.4.0" />
+  <def name="polGroupSysCapacity"        value="1.3.6.1.4.1.3813.1.4.3.5.0" />
+  <def name="polGroupSysUsage"           value="1.3.6.1.4.1.3813.1.4.3.6.0" />
+  <def name="subscriberSysCapacity"      value="1.3.6.1.4.1.3813.1.4.3.9.0" />
+  <def name="subscriberSysUsage"         value="1.3.6.1.4.1.3813.1.4.3.10.0" />
+  <def name="activeL3UserTblUsage"       value="1.3.6.1.4.1.3813.1.4.3.11.0" />
+  <def name="authenticatedL3UserCount"   value="1.3.6.1.4.1.3813.1.4.3.12.0" />
+  <def name="unauthenticatedL3UserCount" value="1.3.6.1.4.1.3813.1.4.3.13.0" />
+
+  <def name="loginRespOkStatsCount"      value="1.3.6.1.4.1.3813.1.4.3.15.1.2"/>
+
+  <!-- ELLACOYA-MIB::cpu -->
+  <def name="cpuUtilization"      value="1.3.6.1.4.1.3813.1.4.4.1.0"/>
+  <def name="cpuUtil"             value="1.3.6.1.4.1.3813.1.4.4.2.1.3"/>
+
+  <!-- ELLACOYA-MIB::flow -->
+  <def name="flowPoolName"        value="1.3.6.1.4.1.3813.1.4.5"/>
+
+  <!-- ELLACOYA-MIB::slowpathCounters -->
+  <def name="allPackets"          value="1.3.6.1.4.1.3813.1.4.4.10.1.1.0" />
+  <def name="ipPackets"           value="1.3.6.1.4.1.3813.1.4.4.10.1.2.0" />
+  <def name="tcpPackets"          value="1.3.6.1.4.1.3813.1.4.4.10.1.3.0" />
+  <def name="udpPackets"          value="1.3.6.1.4.1.3813.1.4.4.10.1.4.0" />
+  <def name="icmpPackets"         value="1.3.6.1.4.1.3813.1.4.4.10.1.5.0" />
+  <def name="igmpPackets"         value="1.3.6.1.4.1.3813.1.4.4.10.1.6.0" />
+  <def name="ipFragmentPackets"   value="1.3.6.1.4.1.3813.1.4.4.10.1.7.0" />
+  <def name="dhcpPacketsToServer" value="1.3.6.1.4.1.3813.1.4.4.10.1.8.0" />
+  <def name="dhcpPacketsToClient" value="1.3.6.1.4.1.3813.1.4.4.10.1.9.0" />
+  <def name="ipInIpPackets"       value="1.3.6.1.4.1.3813.1.4.4.10.1.10.0" />
+  <def name="l2tpControlPackets"  value="1.3.6.1.4.1.3813.1.4.4.10.1.11.0" />
+  <def name="l2tpDataPackets"     value="1.3.6.1.4.1.3813.1.4.4.10.1.12.0" />
+
+  <!-- ELLACOYA-MIB::sigCounters -->
+  <def name="allSigPackets"       value="1.3.6.1.4.1.3813.1.4.4.10.2.1" />
+  <def name="fakeForwardPackets"  value="1.3.6.1.4.1.3813.1.4.4.10.2.2" />
+  <def name="fakeReversePackets"  value="1.3.6.1.4.1.3813.1.4.4.10.2.3" />
+
+  <!-- ELLACOYA-MIB::ldap -->
+  <def name="ldapDeltaCount"      value="1.3.6.1.4.1.3813.1.4.7.16.0" />
+
+  <!-- ELLACOYA-MIB::bundleStatsTable -->
+  <def name="bundleBytesSent"     value="1.3.6.1.4.1.3813.1.4.12.1.1.3" />
+  <def name="bundleBytesReceived" value="1.3.6.1.4.1.3813.1.4.12.1.1.4" />
+  <def name="bundleSubCount"      value="1.3.6.1.4.1.3813.1.4.12.1.1.5" />
+  <def name="bundleBytesSentDenyPolicyDrop" 
+                                  value="1.3.6.1.4.1.3813.1.4.12.1.1.6" />
+  <def name="bundleBytesReceivedDenyPolicyDrop"
+                                  value="1.3.6.1.4.1.3813.1.4.12.1.1.7" />
+  <def name="bundleBytesSentRateLimitDrop"
+                                  value="1.3.6.1.4.1.3813.1.4.12.1.1.8" />
+  <def name="bundleBytesReceivedRateLimitDrop"
+                                        value="1.3.6.1.4.1.3813.1.4.12.1.1.9"/>
+  <!-- ELLACOYA-MIB::bundleOfferStatsEntry -->
+  <def name="boBundleBytesSent"         value="1.3.6.1.4.1.3813.1.4.12.2.1.5"/>
+  <def name="boBundleBytesReceived"     value="1.3.6.1.4.1.3813.1.4.12.2.1.6"/>
+  <def name="boBundleSubCount"          value="1.3.6.1.4.1.3813.1.4.12.2.1.7"/>
+  <def name="boPacketsSent64"           value="1.3.6.1.4.1.3813.1.4.12.2.1.8"/>
+  <def name="boPacketsReceived64"       value="1.3.6.1.4.1.3813.1.4.12.2.1.9"/>
+  <def name="boPacketsSent65to127"      value="1.3.6.1.4.1.3813.1.4.12.2.1.10"/>
+  <def name="boPacketsReceived65to127"  value="1.3.6.1.4.1.3813.1.4.12.2.1.11"/>
+  <def name="boPacketsSent128to255"     value="1.3.6.1.4.1.3813.1.4.12.2.1.12"/>
+  <def name="boPacketsReceived128to255" value="1.3.6.1.4.1.3813.1.4.12.2.1.13"/>
+  <def name="boPacketsSent256to511"     value="1.3.6.1.4.1.3813.1.4.12.2.1.14"/>
+  <def name="boPacketsReceived256to511" value="1.3.6.1.4.1.3813.1.4.12.2.1.15"/>
+  <def name="boPacketsSent512to1023"    value="1.3.6.1.4.1.3813.1.4.12.2.1.16"/>
+  <def name="boPacketsReceived512to1023"
+                                        value="1.3.6.1.4.1.3813.1.4.12.2.1.17"/>
+  <def name="boPacketsSent1024to1518"   value="1.3.6.1.4.1.3813.1.4.12.2.1.18"/>
+  <def name="boPacketsReceived1024to1518"
+                                        value="1.3.6.1.4.1.3813.1.4.12.2.1.19"/>
+  <def name="boPacketsSent1519up"       value="1.3.6.1.4.1.3813.1.4.12.2.1.20"/>
+  <def name="boPacketsReceived1519up"   value="1.3.6.1.4.1.3813.1.4.12.2.1.21"/>
+  <def name="boBundleBytesSentDenyPolicyDrop"
+                                        value="1.3.6.1.4.1.3813.1.4.12.2.1.22"/>
+  <def name="boBundleBytesReceivedDenyPolicyDrop"
+                                        value="1.3.6.1.4.1.3813.1.4.12.2.1.23"/>
+  <def name="boBundleBytesSentRateLimitDrop"
+                                        value="1.3.6.1.4.1.3813.1.4.12.2.1.24"/>
+  <def name="boBundleBytesReceivedRateLimitDrop" 
+                                        value="1.3.6.1.4.1.3813.1.4.12.2.1.25"/>
+
+  <!-- ELLACOYA-MIB::policyMgmt -->
+  <def name="deltaOperationsReceived"   value="1.3.6.1.4.1.3813.1.4.16.2.0"/>
+  <def name="deltaOperationsProcessed"  value="1.3.6.1.4.1.3813.1.4.16.3.0"/>
+  <def name="serviceProfileTblCapacity" value="1.3.6.1.4.1.3813.1.4.16.4.0"/>
+  <def name="serviceProfileTblUsage"    value="1.3.6.1.4.1.3813.1.4.16.5.0"/>
+  <def name="serviceBundleTblCapacity"  value="1.3.6.1.4.1.3813.1.4.16.6.0"/>
+  <def name="serviceBundleTblUsage"     value="1.3.6.1.4.1.3813.1.4.16.7.0"/>
+  <def name="policyTblCapacity"         value="1.3.6.1.4.1.3813.1.4.16.8.0"/>
+  <def name="policyTblUsage"            value="1.3.6.1.4.1.3813.1.4.16.9.0"/>
+  <def name="subnetGrpTblCapacity"      value="1.3.6.1.4.1.3813.1.4.16.10.0"/>
+  <def name="subnetGrpTblUsage"         value="1.3.6.1.4.1.3813.1.4.16.11.0"/>
+
+  <!-- ELLACOYA-MIB::subscriberMgmt -->
+  <def name="subscriberMgmtTblCapacity"   value="1.3.6.1.4.1.3813.1.4.17.1.0"/>
+  <def name="subscriberMgmtTblUsage"      value="1.3.6.1.4.1.3813.1.4.17.2.0"/>
+  <def name="subscriberNameTblCapacity"   value="1.3.6.1.4.1.3813.1.4.17.3.0"/>
+  <def name="subscriberNameTblUsage"      value="1.3.6.1.4.1.3813.1.4.17.4.0"/>
+  <def name="identifiedSubscriberCount"   value="1.3.6.1.4.1.3813.1.4.17.5.0"/>
+  <def name="unidentifiedSubscriberCount" value="1.3.6.1.4.1.3813.1.4.17.6.0"/>
+
+  <def name="subscriberStateCount"      value="1.3.6.1.4.1.3813.1.4.17.7.1.3"/>
+  <def name="subscriberIdAttemptsCount" value="1.3.6.1.4.1.3813.1.4.17.9.1.2"/>
+
+  <!-- ELLACOYA-MIB::l2tp -->
+  <def name="l2tpAllocTags"       value="1.3.6.1.4.1.3813.1.4.18.3.1.1.0" />
+  <def name="l2tpIPDefaultTags"   value="1.3.6.1.4.1.3813.1.4.18.3.1.2.0" />
+  <def name="l2tpSecureEPSess"    value="1.3.6.1.4.1.3813.1.4.18.3.2.1.1.2" />
+  <def name="l2tpSecureEPOver"    value="1.3.6.1.4.1.3813.1.4.18.3.2.1.1.3" />
+
+</definitions>
+<datasources>
+
+  <!--
+   **************************************************************************
+
+    e30 Series templates
+
+   **************************************************************************
+  -->
+
+  <template name="e30-buffers">
+    <subtree name="Buffer_Usage">
+        <param name="comment"           value="Buffer Usage"/>
+        <param name="data-file"         value="%system-id%_membuf.rrd"/>
+        <param name="graph-title"       value="%system-id%: Buffers"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+
+        <leaf name="Usage">
+          <param name="precedence"         value="1000"/>
+          <param name="comment"            value="Total vs Used"/>
+          <param name="graph-title"        value="Total vs Used"/>
+          <param name="vertical-label"     value="blocks"/>
+          <param name="ds-type"            value="rrd-multigraph"/>
+          <param name="ds-names"           value="total,used"/>
+          <param name="graph-lower-limit"  value="0"/>
+          <!-- Total Buffers -->
+          <param name="ds-expr-total"      value="{Total}"/>
+          <param name="graph-legend-total" value="Total"/>
+          <param name="line-style-total"   value="##totalresource"/>
+          <param name="line-color-total"   value="##totalresource"/>
+          <param name="line-order-total"   value="1"/>
+          <!-- Used Memory -->
+          <param name="ds-expr-used"       value="{Used}"/>
+          <param name="graph-legend-used"  value="Used"/>
+          <param name="line-style-used"    value="##resourceusage"/>
+          <param name="line-color-used"    value="##resourceusage"/>
+          <param name="line-order-used"    value="2"/>
+        </leaf>
+
+        <leaf name="Total">
+          <param name="precedence"        value="902"/>
+          <param name="comment"           value="Total Buffer Pool Size"/>
+          <param name="graph-legend"      value="Total Buffer Pool Size"/>
+          <param name="vertical-label"    value="memory blocks"/>
+          <param name="rrd-ds"            value="mBufPoolSize"/>
+          <param name="snmp-object"       value="$mBufPoolSize"/>
+        </leaf>
+
+        <leaf name="Used">
+          <param name="precedence"        value="901"/>
+          <param name="comment"           value="Used Buffer Pool Size"/>
+          <param name="graph-legend"      value="Used Buffer Pool Size"/>
+          <param name="vertical-label"    value="KBytes"/>
+          <param name="rrd-ds"            value="mBufUsage"/>
+          <param name="snmp-object"       value="$mBufUsage"/>
+        </leaf>
+    </subtree>
+  </template>
+
+
+  <template name="e30-cpu">
+    <param name="comment"           value="Overall CPU busy percentage"/>
+    <param name="data-file"         value="%system-id%_cpu.rrd"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+    <leaf name="CPU_Utilization">
+      <param name="comment"           value="CPU Utilization"/>
+      <param name="rrd-ds"            value="cpu_0"/>
+      <param name="snmp-object"       value="$cpuUtilization"/>
+      <param name="graph-legend"      value="CPU usage"/>
+      <param name="graph-lower-limit" value="0" />
+      <param name="graph-upper-limit" value="100" />
+      <param name="upper-limit"       value="80" />
+      <param name="vertical-label"    value="Percent"/>
+    </leaf>
+  </template>
+
+
+  <template name="e30-fwdTable">
+    <subtree name="Forwarding_Table">
+        <param name="comment"           value="Forwarding Table Stats"/>
+        <param name="data-file"         value="%system-id%_fwdTable.rrd"/>
+        <param name="graph-title"       value="%system-id%: Forwarding Table"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+
+        <subtree name="L3_user_table">
+          <param name="comment"     value="L3 User Table (Layer 3)"/>
+
+          <leaf name="Usage">
+            <param name="precedence"         value="1000"/>
+            <param name="comment"            value="Total vs Used"/>
+            <param name="graph-title"        value="Total vs Used: L3 Entries"/>
+            <param name="vertical-label"     value="entries"/>
+            <param name="ds-type"            value="rrd-multigraph"/>
+            <param name="ds-names"           value="total,used"/>
+            <param name="graph-lower-limit"  value="0"/>
+
+            <!-- Total L3 User Table Entries -->
+            <param name="ds-expr-total"      value="{Total}"/>
+            <param name="graph-legend-total" value="Total"/>
+            <param name="line-style-total"   value="##totalresource"/>
+            <param name="line-color-total"   value="##totalresource"/>
+            <param name="line-order-total"   value="1"/>
+            <!-- Used L3 User Table Entries -->
+            <param name="ds-expr-used"       value="{Used}"/>
+            <param name="graph-legend-used"  value="Used"/>
+            <param name="line-style-used"    value="##resourceusage"/>
+            <param name="line-color-used"    value="##resourceusage"/>
+            <param name="line-order-used"    value="2"/>
+          </leaf>
+
+          <leaf name="Total">
+            <param name="precedence"     value="902"/>
+            <param name="comment"        value="Total L3 User Table"/>
+            <param name="graph-legend"   value="Total L3 User Table"/>
+            <param name="graph-title"    value="Total L3 User Table"/>
+            <param name="vertical-label" value="entries"/>
+            <param name="rrd-ds"         value="l3UserTblCapacity"/>
+            <param name="snmp-object"    value="$l3UserTblCapacity"/>
+          </leaf>
+
+          <leaf name="Used">
+            <param name="precedence"     value="901"/>
+            <param name="comment"        value="Used L3 User Table"/>
+            <param name="graph-legend"   value="Used L3 User Table"/>
+            <param name="graph-legend"   value="Used L3 User Table"/>
+            <param name="vertical-label" value="entries"/>
+            <param name="rrd-ds"         value="l3UserTblUsage"/>
+            <param name="snmp-object"    value="$l3UserTblUsage"/>
+          </leaf>
+        </subtree>
+
+        <subtree name="MAC_table">
+          <param name="comment" value="MAC Table (Layer 2)"/>
+
+          <leaf name="Usage">
+            <param name="precedence"         value="1000"/>
+            <param name="comment"            value="Total vs Used"/>
+            <param name="graph-title"        value="Total vs Used: MAC Table"/>
+            <param name="vertical-label"     value="entries"/>
+            <param name="ds-type"            value="rrd-multigraph"/>
+            <param name="ds-names"           value="total,used"/>
+            <param name="graph-lower-limit"  value="0"/>
+
+            <!-- Total Mac Table Entries -->
+            <param name="ds-expr-total"      value="{Total}"/>
+            <param name="graph-legend-total" value="Total"/>
+            <param name="line-style-total"   value="##totalresource"/>
+            <param name="line-color-total"   value="##totalresource"/>
+            <param name="line-order-total"   value="1"/>
+            <!-- Used MAC Table Entries -->
+            <param name="ds-expr-used"       value="{Used}"/>
+            <param name="graph-legend-used"  value="Used"/>
+            <param name="line-style-used"    value="##resourceusage"/>
+            <param name="line-color-used"    value="##resourceusage"/>
+            <param name="line-order-used"    value="2"/>
+          </leaf>
+
+          <leaf name="Total">
+            <param name="precedence"        value="902"/>
+            <param name="comment"           value="Total MAC table"/>
+            <param name="graph-legend"      value="Total MAC table"/>
+            <param name="graph-title"       value="Total MAC table"/>
+            <param name="vertical-label"    value="entries"/>
+            <param name="rrd-ds"            value="macTblCapacity"/>
+            <param name="snmp-object"       value="$macTblCapacity"/>
+          </leaf>
+
+          <leaf name="Used">
+            <param name="precedence"        value="901"/>
+            <param name="comment"           value="Used MAC table"/>
+            <param name="graph-legend"      value="Used MAC table"/>
+            <param name="graph-title"       value="Used MAC table"/>
+            <param name="vertical-label"    value="entries"/>
+            <param name="rrd-ds"            value="macTblUsage"/>
+            <param name="snmp-object"       value="$macTblUsage"/>
+          </leaf>
+        </subtree>
+
+        <subtree name="PolicyGroup">
+          <param name="comment" value="Policy Groups (service bundles)"/>
+
+          <leaf name="Usage">
+            <param name="precedence"    value="1000"/>
+            <param name="comment"       value="Total vs Used"/>
+            <param name="graph-title"   value="Total vs Used: service bundles"/>
+            <param name="vertical-label"     value="entries"/>
+            <param name="ds-type"            value="rrd-multigraph"/>
+            <param name="ds-names"           value="total,used"/>
+            <param name="graph-lower-limit"  value="0"/>
+
+            <!-- Total Policy Group Entries -->
+            <param name="ds-expr-total"      value="{Total}"/>
+            <param name="graph-legend-total" value="Total"/>
+            <param name="line-style-total"   value="##totalresource"/>
+            <param name="line-color-total"   value="##totalresource"/>
+            <param name="line-order-total"   value="1"/>
+            <!-- Used Policy Group Entries -->
+            <param name="ds-expr-used"       value="{Used}"/>
+            <param name="graph-legend-used"  value="Used"/>
+            <param name="line-style-used"    value="##resourceusage"/>
+            <param name="line-color-used"    value="##resourceusage"/>
+            <param name="line-order-used"    value="2"/>
+          </leaf>
+
+          <leaf name="Total">
+            <param name="precedence"        value="902"/>
+            <param name="comment"           value="Total policy group entries"/>
+            <param name="graph-legend"      value="Total policy group entries"/>
+            <param name="vertical-label"    value="entries"/>
+            <param name="rrd-ds"            value="polGroupSysCapacity"/>
+            <param name="snmp-object"       value="$polGroupSysCapacity"/>
+          </leaf>
+
+          <leaf name="Used">
+            <param name="precedence"        value="901"/>
+            <param name="comment"           value="Used policy group entries"/>
+            <param name="graph-legend"      value="Used policy group entries"/>
+            <param name="vertical-label"    value="entries"/>
+            <param name="rrd-ds"            value="polGroupSysUsage"/>
+            <param name="snmp-object"       value="$polGroupSysUsage"/>
+          </leaf>
+        </subtree>
+        <subtree name="Subscriber_Capacity">
+          <param name="comment" value="Subscriber System"/>
+
+          <leaf name="Usage">
+            <param name="precedence"         value="1000"/>
+            <param name="comment"            value="Total vs Used"/>
+            <param name="graph-title"        value="Total vs Used: Subscriber"/>
+            <param name="vertical-label"     value="entries"/>
+            <param name="ds-type"            value="rrd-multigraph"/>
+            <param name="ds-names"           value="total,used"/>
+            <param name="graph-lower-limit"  value="0"/>
+
+            <!-- Total Subscriber Capacity -->
+            <param name="ds-expr-total"      value="{Total}"/>
+            <param name="graph-legend-total" value="Total"/>
+            <param name="line-style-total"   value="##totalresource"/>
+            <param name="line-color-total"   value="##totalresource"/>
+            <param name="line-order-total"   value="1"/>
+            <!-- Used Subscriber Capacity -->
+            <param name="ds-expr-used"       value="{Used}"/>
+            <param name="graph-legend-used"  value="Used"/>
+            <param name="line-style-used"    value="##resourceusage"/>
+            <param name="line-color-used"    value="##resourceusage"/>
+            <param name="line-order-used"    value="2"/>
+          </leaf>
+
+          <leaf name="Total">
+            <param name="precedence"        value="902"/>
+            <param name="comment"           value="Total subscriber capacity"/>
+            <param name="graph-legend"      value="Total subscriber capacity"/>
+            <param name="graph-title"       value="Total subscriber capacity"/>
+            <param name="vertical-label"    value="entries"/>
+            <param name="rrd-ds"            value="subscriberSysCap"/>
+            <param name="snmp-object"       value="$subscriberSysCapacity"/>
+          </leaf>
+
+          <leaf name="Used">
+            <param name="precedence"        value="901"/>
+            <param name="comment"           value="Used subscriber capacity"/>
+            <param name="graph-legend"      value="Used subscriber capacity"/>
+            <param name="graph-title"       value="Used subscriber capacity"/>
+            <param name="vertical-label"    value="entries"/>
+            <param name="rrd-ds"            value="subscriberSysUsage"/>
+            <param name="snmp-object"       value="$subscriberSysUsage"/>
+          </leaf>
+        </subtree>
+
+        <subtree name="Authenticated_Subscribers">
+          <param name="comment" value="Authentication statistics"/>
+
+          <leaf name="Summary">
+            <param name="precedence"         value="1000"/>
+            <param name="comment"            value="Auth vs Unauth"/>
+            <param name="graph-title"        value="Auth vs Unauth: Subs"/>
+            <param name="vertical-label"     value="subscribers"/>
+            <param name="ds-type"            value="rrd-multigraph"/>
+            <param name="ds-names"           value="auth,unauth"/>
+            <param name="graph-lower-limit"  value="0"/>
+
+            <!-- Authenticated -->
+            <param name="ds-expr-auth"         value="{Auth}"/>
+            <param name="graph-legend-auth"    value="Authenticated"/>
+            <param name="line-style-auth"      value="##totalresource"/>
+            <param name="line-color-auth"      value="##totalresource"/>
+            <param name="line-order-auth"      value="1"/>
+            <!-- Unauthenticated -->
+            <param name="ds-expr-unauth"       value="{Unauth}"/>
+            <param name="graph-legend-unauth"  value="Unauthenticated"/>
+            <param name="line-style-unauth"    value="##resourceusage"/>
+            <param name="line-color-unauth"    value="##resourceusage"/>
+            <param name="line-order-unauth"    value="2"/>
+          </leaf>
+
+          <leaf name="Auth">
+            <param name="precedence"      value="902"/>
+            <param name="comment"         value="Authenticated subscribers"/>
+            <param name="graph-legend"    value="Authenticated"/>
+            <param name="graph-title"     value="Authenticated subscribers"/>
+            <param name="vertical-label"  value="subscribers"/>
+            <param name="rrd-ds"          value="authL3Cnt"/>
+            <param name="snmp-object"     value="$authenticatedL3UserCount"/>
+          </leaf>
+
+          <leaf name="Unauth">
+            <param name="precedence"      value="901"/>
+            <param name="comment"         value="Unauthenticated subscribers"/>
+            <param name="graph-legend"    value="Unauthenticated"/>
+            <param name="graph-title"     value="Unauthenticated subscribers"/>
+            <param name="vertical-label"  value="subscribers"/>
+            <param name="rrd-ds"          value="unauthL3Cnt"/>
+            <param name="snmp-object"     value="$unauthenticatedL3UserCount"/>
+          </leaf>
+        </subtree>
+    </subtree>
+  </template>
+
+
+  <template name="e30-fwdTable-login">
+    <param name="comment"       value="Login OK attempt counter: %login-idx%"/>
+    <param name="data-file"     value="%system-id%_fwdTable_login.rrd"/>
+    <param name="graph-title"   value="%system-id%: Login attempt %login-idx%"/>
+    <param name="graph-legend"  value="Num of attempts"/>
+    <param name="rrd-create-dstype" value="COUNTER"/>
+    <param name="rrd-ds"        value="login_%login-idx%"/>
+    <param name="snmp-object"   value="$loginRespOkStatsCount.%login-idx%"/>
+  </template>
+
+
+  <template name="e30-bundle-subtree">
+    <param name="data-file" 
+                     value="%system-id%_bundle_%e30-bundle-rrd%.rrd"/>
+    <param name="graph-lower-limit"  value="0" />
+    <param name="graph-title"        value="%e30-bundle-name%"/>
+
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts"     value="up,down,volume,subcount"/>
+    <!-- Up Volume -->
+    <param name="overview-subleave-name-up"      value="Up_bps"/>
+    <param name="overview-direct-link-up"        value="yes"/>
+    <param name="overview-direct-link-view-up"   value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-up"
+           value="Upstream Usage"/>
+    <param name="overview-shortcut-title-up"
+           value="Show upstream bandwidth usage for all bundles"/>
+    <param name="overview-page-title-up"
+           value="Upstream Usage"/>
+    <!-- Down Volume -->
+    <param name="overview-subleave-name-down"    value="Down_bps"/>
+    <param name="overview-direct-link-down"      value="yes"/>
+    <param name="overview-direct-link-view-down" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-down"
+           value="Downstream Usage"/>
+    <param name="overview-shortcut-title-down"
+           value="Show downstream bandwidth usage for all bundles"/>
+    <param name="overview-page-title-down"
+           value="Downstream Usage"/>
+    <!-- InOut Volume -->
+    <param name="overview-subleave-name-volume"    value="Volume"/>
+    <param name="overview-direct-link-volume"      value="yes"/>
+    <param name="overview-direct-link-view-volume" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-volume"
+           value="InOut Usage"/>
+    <param name="overview-shortcut-title-volume"
+           value="Show InOut bandwidth usage for all bundles"/>
+    <param name="overview-page-title-volume"
+           value="Volume Usage"/>
+    <!-- Subscriber Count -->
+    <param name="overview-subleave-name-subcount"    value="Subscriber_Count"/>
+    <param name="overview-direct-link-subcount"      value="yes"/>
+    <param name="overview-direct-link-view-subcount" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-subcount"
+           value="Subscriber Count"/>
+    <param name="overview-shortcut-title-subcount"
+           value="Show subscriber count for all bundles"/>
+    <param name="overview-page-title-subcount"
+           value="Subscriber Count"/>
+  </template>
+
+
+  <template name="e30-bundle">
+    <leaf name="Volume">
+      <param name="comment"
+                     value="InOut volume in kilobytes/s"/>
+      <param name="precedence"          value="1000"/>
+      <param name="ds-type"             value="rrd-multigraph"/>
+      <param name="ds-names"            value="down,up"/>
+      <!-- Volume Download -->
+      <param name="ds-expr-down"        value="{DownVolume},8,*"/>
+      <param name="graph-legend-down"   value="Bits per second in"/>
+      <param name="line-style-down"     value="##BpsIn"/>
+      <param name="line-color-down"     value="##BpsIn"/>
+      <param name="line-order-down"     value="1"/>
+      <!-- Volume Upload -->
+      <param name="ds-expr-up"          value="{UpVolume},8,*"/>
+      <param name="graph-legend-up"     value="Bits per second out"/>
+      <param name="line-style-up"       value="##BpsOut"/>
+      <param name="line-color-up"       value="##BpsOut"/>
+      <param name="line-order-up"       value="2"/>
+    </leaf>
+
+    <leaf name="UpVolume">
+      <param name="comment"         value="Upstream volume in kilobytes/s"/>
+      <param name="hidden"          value="yes"/>
+      <param name="rrd-ds"          value="UpVolume"/>
+      <param name="snmp-object"
+            value="$bundleBytesSent.%e30-bundle-index%"/>
+      <param name="precedence"        value="902"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+
+    <leaf name="DownVolume">
+      <param name="comment"         value="Downstream volume in kilobytes/s"/>
+      <param name="hidden"          value="yes"/>
+      <param name="rrd-ds"          value="DownVolume"/>
+      <param name="snmp-object"
+            value="$bundleBytesReceived.%e30-bundle-index%"/>
+      <param name="precedence"        value="901"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+
+    <leaf name="Up_bps">
+      <param name="comment" value="Upstream bandwidth usage per service"/>
+      <param name="graph-legend"   value="Upstream BW"/>
+      <param name="vertical-label" value="bps"/>
+      <param name="ds-type"        value="rrd-file" />
+      <param name="leaf-type"      value="rrd-cdef" />
+      <param name="rpn-expr"       value="{UpVolume},8,*" />
+      <param name="precedence"     value="802"/>
+    </leaf>
+
+    <leaf name="Down_bps">
+      <param name="comment" value="Downstream bandwidth usage per service"/>
+      <param name="graph-legend"   value="Downstream BW"/>
+      <param name="vertical-label" value="bps"/>
+      <param name="ds-type"        value="rrd-file" />
+      <param name="leaf-type"      value="rrd-cdef" />
+      <param name="rpn-expr"       value="{DownVolume},8,*" />
+      <param name="precedence"     value="801"/>
+    </leaf>
+
+    <leaf name="Subscriber_Count">
+      <param name="comment"        value="Number of subs using bundle"/>
+      <param name="graph-legend"   value="subscriber count"/>
+      <param name="vertical-label" value="subs"/>
+      <param name="rrd-ds"         value="subCount"/>
+      <param name="snmp-object"    value="$bundleSubCount.%e30-bundle-index%"/>
+      <param name="precedence"     value="700"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+    </leaf>
+  </template>
+
+
+  <template name="e30-bundle-deny">
+    <leaf name="Volume_Denied">
+      <param name="comment"
+                     value="InOut of denied volume in kilobytes/s"/>
+      <param name="precedence"          value="1000"/>
+      <param name="ds-type"             value="rrd-multigraph"/>
+      <param name="ds-names"            value="down,up"/>
+      <!-- Volume Download -->
+      <param name="ds-expr-down"        value="{DownDenyVolume},8,*"/>
+      <param name="graph-legend-down"   value="Denied Bits per second in"/>
+      <param name="line-style-down"     value="##BpsIn"/>
+      <param name="line-color-down"     value="##BpsIn"/>
+      <param name="line-order-down"     value="1"/>
+      <!-- Volume Upload -->
+      <param name="ds-expr-up"          value="{UpDenyVolume},8,*"/>
+      <param name="graph-legend-up"     value="Denied Bits per second out"/>
+      <param name="line-style-up"       value="##BpsOut"/>
+      <param name="line-color-up"       value="##BpsOut"/>
+      <param name="line-order-up"       value="2"/>
+    </leaf>
+
+    <leaf name="UpDenyVolume">
+      <param name="data-file" 
+                     value="%system-id%_bundle_%e30-bundle-rrd%_deny.rrd"/>
+      <param name="comment"    value="Upstream denied volume in kilobytes/s"/>
+      <param name="hidden"     value="yes"/>
+      <param name="rrd-ds"     value="UpDenyVolume"/>
+      <param name="snmp-object"
+            value="$bundleBytesSentDenyPolicyDrop.%e30-bundle-index%"/>
+      <param name="precedence"        value="602"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="snmp-object-type" value="COUNTER64"/>
+    </leaf>
+
+    <leaf name="DownDenyVolume">
+      <param name="data-file" 
+                     value="%system-id%_bundle_%e30-bundle-rrd%_deny.rrd"/>
+      <param name="comment"    value="Downstream denied volume in kilobytes/s"/>
+      <param name="hidden"     value="yes"/>
+      <param name="rrd-ds"     value="DownVolume"/>
+      <param name="snmp-object"
+            value="$bundleBytesReceivedDenyPolicyDrop.%e30-bundle-index%"/>
+      <param name="precedence"        value="601"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="snmp-object-type" value="COUNTER64"/>
+    </leaf>
+
+    <leaf name="Up_Deny_bps">
+      <param name="comment"
+            value="Upstream denied bandwidth usage per service"/>
+      <param name="graph-legend"   value="Upstream Denied BW"/>
+      <param name="line-style"     value="##BpsOut"/>
+      <param name="line-color"     value="##BpsOut"/>
+      <param name="vertical-label" value="bps"/>
+      <param name="ds-type"        value="rrd-file" />
+      <param name="leaf-type"      value="rrd-cdef" />
+      <param name="rpn-expr"       value="{UpDenyVolume},8,*" />
+      <param name="precedence"        value="502"/>
+    </leaf>
+
+    <leaf name="Down_Deny_bps">
+      <param name="comment"
+            value="Downstream denied bandwidth usage per service"/>
+      <param name="graph-legend"   value="Downstream denied BW"/>
+      <param name="line-style"     value="##BpsIn"/>
+      <param name="line-color"     value="##BpsIn"/>
+      <param name="vertical-label" value="bps"/>
+      <param name="ds-type"        value="rrd-file" />
+      <param name="leaf-type"      value="rrd-cdef" />
+      <param name="rpn-expr"       value="{DownDenyVolume},8,*" />
+      <param name="precedence"        value="501"/>
+    </leaf>
+  </template>
+
+
+  <template name="e30-bundle-ratelimit">
+    <leaf name="Volume_RateLimit">
+      <param name="comment"
+                     value="InOut of ratelimit volume in kilobytes/s"/>
+      <param name="precedence"          value="1000"/>
+      <param name="ds-type"             value="rrd-multigraph"/>
+      <param name="ds-names"            value="down,up"/>
+      <!-- Volume Download -->
+      <param name="ds-expr-down"        value="{DownRateVolume},8,*"/>
+      <param name="graph-legend-down"   value="Rate limit Bits per second in"/>
+      <param name="line-style-down"     value="##BpsIn"/>
+      <param name="line-color-down"     value="##BpsIn"/>
+      <param name="line-order-down"     value="1"/>
+      <!-- Volume Upload -->
+      <param name="ds-expr-up"          value="{UpRateVolume},8,*"/>
+      <param name="graph-legend-up"     value="Rate limit Bits per second out"/>
+      <param name="line-style-up"       value="##BpsOut"/>
+      <param name="line-color-up"       value="##BpsOut"/>
+      <param name="line-order-up"       value="2"/>
+    </leaf>
+
+    <leaf name="UpRateVolume">
+      <param name="data-file" 
+                     value="%system-id%_bundle_%e30-bundle-rrd%_ratelimit.rrd"/>
+      <param name="comment"   value="Upstream ratelimit volume in kilobytes/s"/>
+      <param name="hidden"    value="yes"/>
+      <param name="rrd-ds"    value="UpDenyVolume"/>
+      <param name="snmp-object"
+            value="$bundleBytesSentRateLimitDrop.%e30-bundle-index%"/>
+      <param name="precedence"        value="402"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="snmp-object-type" value="COUNTER64"/>
+    </leaf>
+
+    <leaf name="DownRateVolume">
+      <param name="data-file" 
+                     value="%system-id%_bundle_%e30-bundle-rrd%_ratelimit.rrd"/>
+      <param name="comment" value="Downstream ratelimit volume in kilobytes/s"/>
+      <param name="hidden"  value="yes"/>
+      <param name="rrd-ds"  value="DownVolume"/>
+      <param name="snmp-object"
+            value="$bundleBytesReceivedRateLimitDrop.%e30-bundle-index%"/>
+      <param name="precedence"        value="401"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="snmp-object-type" value="COUNTER64"/>
+    </leaf>
+
+    <leaf name="Up_Rate_bps">
+      <param name="comment"
+            value="Upstream rate limit bandwidth usage per service"/>
+      <param name="graph-legend"   value="Upstream rate limited in Bps"/>
+      <param name="vertical-label" value="bps"/>
+      <param name="ds-type"        value="rrd-file" />
+      <param name="leaf-type"      value="rrd-cdef" />
+      <param name="rpn-expr"       value="{UpRateVolume},8,*" />
+      <param name="precedence"        value="302"/>
+    </leaf>
+
+    <leaf name="Down_Rate_bps">
+      <param name="comment"
+            value="Downstream rate limit bandwidth usage per service"/>
+      <param name="graph-legend"   value="Downstream rate limited in Bps"/>
+      <param name="vertical-label" value="bps"/>
+      <param name="ds-type"        value="rrd-file" />
+      <param name="leaf-type"      value="rrd-cdef" />
+      <param name="rpn-expr"       value="{DownRateVolume},8,*" />
+      <param name="precedence"        value="301"/>
+    </leaf>
+  </template>
+
+
+  <template name="e30-hdd-subtree">
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="usage,total,used"/>
+    <!-- Usage -->
+    <param name="overview-subleave-name-usage" value="Usage"/>
+    <param name="overview-shortcut-text-usage"
+          value="All HDD Parition usage summary"/>
+    <param name="overview-shortcut-title-usage"
+          value="Show hdd usage summary for all partitions on one page"/>
+    <param name="overview-page-title-usage"
+          value="Parition usage"/>
+    <!-- Total -->
+    <param name="overview-subleave-name-total" value="Total"/>
+    <param name="overview-shortcut-text-total"
+          value="All HDD Parition total size summary"/>
+    <param name="overview-shortcut-title-total"
+          value="Show hdd total size summary for all partitions on one page"/>
+    <param name="overview-page-title-total"
+          value="Parition Size Total"/>
+    <!-- Used -->
+    <param name="overview-subleave-name-used" value="Used"/>
+    <param name="overview-shortcut-text-used"
+          value="All HDD Parition used size summary"/>
+    <param name="overview-shortcut-title-used"
+          value="Show hdd used size summary for all partitions on one page"/>
+    <param name="overview-page-title-used"
+          value="Parition Size Used"/>
+  </template>
+
+
+  <template name="e30-hdd">
+        <param name="comment"           value="Hard Drive information"/>
+        <param name="data-file"         value="%system-id%_hdd.rrd"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+
+        <subtree name="Partition_0">
+          <param name="comment"         value="Firmware images"/>
+          <leaf name="Usage">
+            <param name="precedence"         value="1000"/>
+            <param name="comment"            value="Hd0: Total vs Used"/>
+            <param name="graph-title"        value="Hd0: Total vs Used"/>
+            <param name="vertical-label"     value="Bytes"/>
+            <param name="ds-type"            value="rrd-multigraph"/>
+            <param name="ds-names"           value="total,used"/>
+            <param name="graph-lower-limit"  value="0"/>
+            <!-- Total Parition Size -->
+            <param name="ds-expr-total"      value="{Total_Raw},1024,*"/>
+            <param name="graph-legend-total" value="Total"/>
+            <param name="line-style-total"   value="##totalresource"/>
+            <param name="line-color-total"   value="##totalresource"/>
+            <param name="line-order-total"   value="1"/>
+            <!-- Used Partition Size -->
+            <param name="ds-expr-used"       value="{Used_Raw},1024,*"/>
+            <param name="graph-legend-used"  value="Used"/>
+            <param name="line-style-used"    value="##resourceusage"/>
+            <param name="line-color-used"    value="##resourceusage"/>
+            <param name="line-order-used"    value="2"/>
+          </leaf>
+
+          <leaf name="Total">
+            <param name="precedence"        value="902"/>
+            <param name="comment"           value="Size of hd0 partition"/>
+            <param name="ds-type"           value="rrd-file"/>
+            <param name="leaf-type"         value="rrd-cdef"/>
+            <param name="rpn-expr"          value="{Total_Raw},1024,*"/>
+            <param name="graph-legend"      value="Size of hd0 partition"/>
+            <param name="graph-title"       value="Size of hd0 partition"/>
+            <param name="vertical-label"    value="Bytes"/>
+          </leaf>
+
+          <leaf name="Used">
+            <param name="precedence"        value="902"/>
+            <param name="comment"           value="Usage of hd0 partition"/>
+            <param name="ds-type"           value="rrd-file"/>
+            <param name="leaf-type"         value="rrd-cdef"/>
+            <param name="rpn-expr"          value="{Used_Raw},1024,*"/>
+            <param name="graph-legend"      value="Usage of hd0 partition"/>
+            <param name="graph-title"       value="Usage of hd0 partition"/>
+            <param name="vertical-label"    value="Bytes"/>
+          </leaf>
+
+          <leaf name="Total_Raw">
+            <param name="hidden"            value="yes"/>
+            <param name="precedence"        value="102"/>
+            <param name="comment"           value="Size of hd0 partition"/>
+            <param name="graph-legend"      value="Size of hd0 partition"/>
+            <param name="graph-title"       value="Size of hd0 partition"/>
+            <param name="vertical-label"    value="Bytes"/>
+            <param name="rrd-ds"            value="hDriveHd0Size"/>
+            <param name="snmp-object"       value="$hDriveHd0Size"/>
+          </leaf>
+
+          <leaf name="Used_Raw">
+            <param name="hidden"            value="yes"/>
+            <param name="precedence"        value="101"/>
+            <param name="comment"           value="Usage of hd0 partition"/>
+            <param name="graph-legend"      value="Usage of hd0 partition"/>
+            <param name="graph-title"       value="Usage of hd0 partition"/>
+            <param name="vertical-label"    value="Bytes"/>
+            <param name="rrd-ds"            value="hDriveHd0Usage"/>
+            <param name="snmp-object"       value="$hDriveHd0Usage"/>
+          </leaf>
+        </subtree>
+
+        <subtree name="Partition_1">
+          <param name="comment"             value="Logs, Usage files, etc"/>
+          <leaf name="Usage">
+            <param name="precedence"         value="1000"/>
+            <param name="comment"            value="Hd1: Total vs Used"/>
+            <param name="graph-legend"       value="Hd1: Total vs Used"/>
+            <param name="graph-title"        value="Hd1: Total vs Used"/>
+            <param name="vertical-label"     value="Bytes"/>
+            <param name="ds-type"            value="rrd-multigraph"/>
+            <param name="ds-names"           value="total,used"/>
+            <param name="graph-lower-limit"  value="0"/>
+
+            <!-- Total Parition Size -->
+            <param name="ds-expr-total"      value="{Total_Raw},1024,*"/>
+            <param name="graph-legend-total" value="Total"/>
+            <param name="line-style-total"   value="##totalresource"/>
+            <param name="line-color-total"   value="##totalresource"/>
+            <param name="line-order-total"   value="1"/>
+            <!-- Used Partition Size -->
+            <param name="ds-expr-used"       value="{Used_Raw},1024,*"/>
+            <param name="graph-legend-used"  value="Used"/>
+            <param name="line-style-used"    value="##resourceusage"/>
+            <param name="line-color-used"    value="##resourceusage"/>
+            <param name="line-order-used"    value="2"/>
+          </leaf>
+
+          <leaf name="Total">
+            <param name="precedence"        value="902"/>
+            <param name="comment"           value="Size of hd1 partition"/>
+            <param name="ds-type"           value="rrd-file"/>
+            <param name="leaf-type"         value="rrd-cdef"/>
+            <param name="rpn-expr"          value="{Total_Raw},1024,*"/>
+            <param name="graph-legend"      value="Size of hd1 partition"/>
+            <param name="graph-title"       value="Size of hd1 partition"/>
+            <param name="vertical-label"    value="Bytes"/>
+          </leaf>
+
+          <leaf name="Used">
+            <param name="precedence"        value="902"/>
+            <param name="comment"           value="Usage of hd1 partition"/>
+            <param name="ds-type"           value="rrd-file"/>
+            <param name="leaf-type"         value="rrd-cdef"/>
+            <param name="rpn-expr"          value="{Used_Raw},1024,*"/>
+            <param name="graph-legend"      value="Usage of hd1 partition"/>
+            <param name="graph-title"       value="Usage of hd1 partition"/>
+            <param name="vertical-label"    value="Bytes"/>
+          </leaf>
+
+          <leaf name="Total_Raw">
+            <param name="hidden"            value="yes"/>
+            <param name="precedence"        value="102"/>
+            <param name="comment"           value="Size of hd1 partition"/>
+            <param name="graph-legend"      value="Size of hd1 partition"/>
+            <param name="graph-title"       value="Size of hd1 partition"/>
+            <param name="vertical-label"    value="KBytes"/>
+            <param name="rrd-ds"            value="hDriveHd1Size"/>
+            <param name="snmp-object"       value="$hDriveHd1Size"/>
+          </leaf>
+
+          <leaf name="Used_Raw">
+            <param name="hidden"            value="yes"/>
+            <param name="precedence"        value="101"/>
+            <param name="comment"           value="Usage of hd1 partition"/>
+            <param name="graph-legend"      value="Usage of hd1 partition"/>
+            <param name="graph-title"       value="Usage of hd1 partition"/>
+            <param name="vertical-label"    value="KBytes"/>
+            <param name="rrd-ds"            value="hDriveHd1Usage"/>
+            <param name="snmp-object"       value="$hDriveHd1Usage"/>
+          </leaf>
+        </subtree>
+  </template>
+
+
+  <template name="e30-hdd-errors">
+    <subtree name="HDD_Errors">
+        <param name="comment"           value="Hard Drive errors"/>
+        <param name="data-file"         value="%system-id%_hdd_err.rrd"/>
+        <param name="graph-title"       value="%system-id%: Hdd errors"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+
+        <leaf name="hDriveErrBlockRW">
+          <param name="precedence"        value="917"/>
+          <param name="comment"           value="Number of Block R/W errors"/>
+          <param name="graph-legend"      value="Block R/W errors"/>
+          <param name="vertical-label"    value="errors"/>
+          <param name="rrd-ds"            value="ErrBlockRW"/>
+          <param name="snmp-object"       value="$hDriveErrBlockRW"/>
+        </leaf>
+        <leaf name="hDriveErrCommand">
+          <param name="precedence"        value="916"/>
+          <param name="comment"           value="Number of Command errors"/>
+          <param name="graph-legend"      value="Command errors"/>
+          <param name="vertical-label"    value="errors"/>
+          <param name="rrd-ds"            value="ErrCommand"/>
+          <param name="snmp-object"       value="$hDriveErrCommand"/>
+        </leaf>
+        <leaf name="hDriveErrReadWrite">
+          <param name="precedence"        value="915"/>
+          <param name="comment"           value="Number of Read/Write errors"/>
+          <param name="graph-legend"      value="R/W errors"/>
+          <param name="vertical-label"    value="errors"/>
+          <param name="rrd-ds"            value="ErrReadWrite"/>
+          <param name="snmp-object"       value="$hDriveErrReadWrite"/>
+        </leaf>
+        <leaf name="hDriveErrWriteOnly">
+          <param name="precedence"        value="914"/>
+          <param name="comment"           value="Number of WriteOnly errors"/>
+          <param name="graph-legend"      value="Write errors"/>
+          <param name="vertical-label"    value="errors"/>
+          <param name="rrd-ds"            value="ErrWriteOnly"/>
+          <param name="snmp-object"       value="$hDriveErrWriteOnly"/>
+        </leaf>
+        <leaf name="hDriveErrReady">
+          <param name="precedence"        value="913"/>
+          <param name="comment"           value="Number of Ready errors"/>
+          <param name="graph-legend"      value="Ready errors"/>
+          <param name="vertical-label"    value="errors"/>
+          <param name="rrd-ds"            value="ErrReady"/>
+          <param name="snmp-object"       value="$hDriveErrReady"/>
+        </leaf>
+        <leaf name="hDriveErrBusy">
+          <param name="precedence"        value="912"/>
+          <param name="comment"           value="Number of Busy errors"/>
+          <param name="graph-legend"      value="Busy errors"/>
+          <param name="vertical-label"    value="errors"/>
+          <param name="rrd-ds"            value="ErrBusy"/>
+          <param name="snmp-object"       value="$hDriveErrBusy"/>
+        </leaf>
+        <leaf name="hDriveErrDataReq">
+          <param name="precedence"        value="911"/>
+          <param name="comment"           value="Number of DataReq errors"/>
+          <param name="graph-legend"      value="DataReq errors"/>
+          <param name="vertical-label"    value="errors"/>
+          <param name="rrd-ds"            value="ErrDataReq"/>
+          <param name="snmp-object"       value="$hDriveErrDataReq"/>
+        </leaf>
+        <leaf name="hDriveErrSeek">
+          <param name="precedence"        value="910"/>
+          <param name="comment"           value="Number of Seek errors"/>
+          <param name="graph-legend"      value="Seek errors"/>
+          <param name="vertical-label"    value="errors"/>
+          <param name="rrd-ds"            value="ErrSeek"/>
+          <param name="snmp-object"       value="$hDriveErrSeek"/>
+        </leaf>
+        <leaf name="hDriveErrDataReqNS">
+          <param name="precedence"        value="909"/>
+          <param name="comment"           value="Number of DataReqNS errors"/>
+          <param name="graph-legend"      value="DataReqNS errors"/>
+          <param name="vertical-label"    value="errors"/>
+          <param name="rrd-ds"            value="ErrDataReqNS"/>
+          <param name="snmp-object"       value="$hDriveErrDataReqNS"/>
+        </leaf>
+        <leaf name="hDriveErrInterfCRC">
+          <param name="precedence"        value="908"/>
+          <param name="comment"           value="Number of InterfCRC errors"/>
+          <param name="graph-legend"      value="InterfCRC errors"/>
+          <param name="vertical-label"    value="errors"/>
+          <param name="rrd-ds"            value="ErrInterfCRC"/>
+          <param name="snmp-object"       value="$hDriveErrInterfCRC"/>
+        </leaf>
+        <leaf name="hDriveErrUncorrData">
+          <param name="precedence"        value="907"/>
+          <param name="comment"           value="Number of UncorrData errors"/>
+          <param name="graph-legend"      value="UncorrData errors"/>
+          <param name="vertical-label"    value="errors"/>
+          <param name="rrd-ds"            value="ErrUncorrData"/>
+          <param name="snmp-object"       value="$hDriveErrUncorrData"/>
+        </leaf>
+        <leaf name="hDriveErrIdNotFound">
+          <param name="precedence"        value="906"/>
+          <param name="comment"           value="Number of IdNotFound errors"/>
+          <param name="graph-legend"      value="IdNotFound errors"/>
+          <param name="vertical-label"    value="errors"/>
+          <param name="rrd-ds"            value="ErrIdNotFound"/>
+          <param name="snmp-object"       value="$hDriveErrIdNotFound"/>
+        </leaf>
+        <leaf name="hDriveErrAbortedCmd">
+          <param name="precedence"        value="905"/>
+          <param name="comment"           value="Number of AbortedCmd errors"/>
+          <param name="graph-legend"      value="AbortedCmd errors"/>
+          <param name="vertical-label"    value="errors"/>
+          <param name="rrd-ds"            value="ErrAbortedCmd"/>
+          <param name="snmp-object"       value="$hDriveErrAbortedCmd"/>
+        </leaf>
+        <leaf name="hDriveErrTrack0NF">
+          <param name="precedence"        value="904"/>
+          <param name="comment"           value="Number of TrackONF errors"/>
+          <param name="graph-legend"      value="TrackONF errors"/>
+          <param name="vertical-label"    value="errors"/>
+          <param name="rrd-ds"            value="ErrTrack0NF"/>
+          <param name="snmp-object"       value="$hDriveErrTrack0NF"/>
+        </leaf>
+        <leaf name="hDriveErrAddrMarkNF">
+          <param name="precedence"        value="903"/>
+          <param name="comment"           value="Number of AddrMarkNF errors"/>
+          <param name="graph-legend"      value="AddrMarkNF errors"/>
+          <param name="vertical-label"    value="errors"/>
+          <param name="rrd-ds"            value="ErrAddrMarkNF"/>
+          <param name="snmp-object"       value="$hDriveErrAddrMarkNF"/>
+        </leaf>
+    </subtree>
+  </template>
+
+
+  <template name="e30-hdd-logs">
+    <subtree name="Daily_Logs">
+        <param name="comment"           value="Daily log directory"/>
+        <param name="data-file"         value="%system-id%_hdd_logs.rrd"/>
+        <param name="graph-title"       value="%system-id%: Hdd logs"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+
+        <leaf name="Daily_Log_Size">
+          <param name="comment"           value="Size of daily log directory"/>
+          <param name="graph-legend"      value="Size of daily log directory"/>
+          <param name="rrd-ds"            value="DailyLogSize"/>
+          <param name="ds-type"           value="rrd-file"/>
+          <param name="leaf-type"         value="rrd-cdef"/>
+          <param name="rpn-expr"          value="{Daily_Log_Size_Raw},1024,*"/>
+          <param name="vertical-label"    value="Bytes"/>
+        </leaf>
+
+        <leaf name="Daily_Log_Usage">
+          <param name="comment"
+                      value="Current usage of daily log directory"/>
+          <param name="graph-legend"      value="Usage of daily log dir"/>
+          <param name="line-style"        value="##resourceusage" />
+          <param name="line-color"        value="##resourceusage" />
+          <param name="rrd-ds"            value="DailyLogUsage"/>
+          <param name="ds-type"           value="rrd-file"/>
+          <param name="leaf-type"         value="rrd-cdef"/>
+          <param name="rpn-expr"          value="{Daily_Log_Usage_Raw},1024,*"/>
+          <param name="vertical-label"    value="Bytes"/>
+        </leaf>
+
+        <leaf name="Daily_Log_Size_Raw">
+          <param name="hidden"            value="yes"/>
+          <param name="comment"           value="Size of daily log directory"/>
+          <param name="graph-legend"      value="Size of daily log directory"/>
+          <param name="rrd-ds"            value="DailyLogSize"/>
+          <param name="snmp-object"       value="$hDriveDailyLogSize"/>
+          <param name="vertical-label"    value="Bytes"/>
+        </leaf>
+
+        <leaf name="Daily_Log_Usage_Raw">
+          <param name="hidden"            value="yes"/>
+          <param name="comment"
+                      value="Current usage of daily log directory"/>
+          <param name="graph-legend"      value="Usage of daily log dir"/>
+          <param name="line-style"        value="##resourceusage" />
+          <param name="line-color"        value="##resourceusage" />
+          <param name="rrd-ds"            value="DailyLogUsage"/>
+          <param name="snmp-object"       value="$hDriveDailyLogUsage"/>
+          <param name="vertical-label"    value="Bytes"/>
+        </leaf>
+    </subtree>
+  </template>
+
+
+  <template name="e30-l2tp-subtree">
+    <param name="comment"           value="L2TP statistics"/>
+    <param name="data-file"         value="%system-id%_l2tp.rrd"/>
+    <param name="graph-lower-limit" value="0"/>
+    <param name="graph-title"       value="%system-id%: L2TP"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+    <leaf name="Allocated_Tags">
+      <param name="precedence"     value="1000"/>
+      <param name="comment"        value="Number of L2TP sessions"/>
+      <param name="graph-legend"   value="L2TP sessions"/>
+      <param name="vertical-label" value="sessions"/>
+      <param name="rrd-ds"         value="l2tpAllocTags"/>
+      <param name="snmp-object"    value="$l2tpAllocTags"/>
+    </leaf>
+
+    <leaf name="Default_tags">
+      <param name="precedence"     value="999"/>
+      <param name="comment"        value="IP addresses using default tags"/>
+      <param name="graph-legend"   value="IP addresses using default tags"/>
+      <param name="vertical-label" value="IP Addresses"/>
+      <param name="rrd-ds"         value="l2tpIPDefaultTags"/>
+      <param name="snmp-object"    value="$l2tpIPDefaultTags"/>
+    </leaf>
+  </template>
+
+
+  <template name="e30-l2tp-secure-endpoints-subtree">
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts"     value="sessions,overlap"/>
+    <!-- Sessions -->
+    <param name="overview-subleave-name-sessions" value="Sessions"/>
+    <param name="overview-shortcut-text-sessions"
+           value="All L2TP sessions summary"/>
+    <param name="overview-shortcut-title-sessions"
+           value="Show L2TP session summary for all endpoints"/>
+    <param name="overview-page-title-sessions"
+           value="L2TP session usage"/>
+    <!-- Overlap -->
+    <param name="overview-subleave-name-overlap" value="Overlap"/>
+    <param name="overview-shortcut-text-overlap"
+           value="All L2TP overlapping session summary"/>
+    <param name="overview-shortcut-title-overlap"
+           value="Show L2TP overlapping session summary for all endpoints"/>
+    <param name="overview-page-title-overlap"
+           value="L2TP session usage"/>
+  </template>
+
+
+  <template name="e30-l2tp-secure-endpoints-leaf">
+    <param name="comment"           value="Secure endpoint: %e30-l2tp-ep%"/>
+    <param name="data-file"    
+                value="%system-id%_l2tp_endpoint_%e30-l2tp-file%.rrd"/>
+    <param name="graph-lower-limit" value="0"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+    <leaf name="Sessions">
+      <param name="comment"      value="L2TP sessions on endpoint"/>
+      <param name="graph-legend" value="sessions"/>
+      <param name="graph-title"  value="Sessions on %e30-l2tp-ep%"/>
+      <param name="line-style"   value="##resourceusage"/>
+      <param name="precedence"   value="999"/>
+      <param name="rrd-ds"       value="l2tpSecureEPSess"/>
+      <param name="snmp-object"  value="$l2tpSecureEPSess.%e30-l2tp-ep%"/>
+    </leaf>
+      
+    <leaf name="Overlap">
+      <param name="comment"      value="L2TP sessions on endpoint overlapping"/>
+      <param name="graph-legend" value="sessions overlapping"/>
+      <param name="graph-title"  value="Sessions overlap on %e30-l2tp-ep%"/>
+      <param name="line-style"   value="##resourceusage"/>
+      <param name="precedence"   value="998"/>
+      <param name="rrd-ds"       value="l2tpSecureEPOver"/>
+      <param name="snmp-object"  value="$l2tpSecureEPOver.%e30-l2tp-ep%"/>
+    </leaf>
+  </template>
+
+
+  <template name="e30-mem">
+    <subtree name="Memory">
+        <param name="comment"           value="Memory usage statistics"/>
+        <param name="data-file"         value="%system-id%_mem.rrd"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+
+        <leaf name="Usage">
+          <param name="precedence"         value="1000"/>
+          <param name="comment"            value="Total vs Used"/>
+          <param name="graph-title"        value="Total vs Used"/>
+          <param name="vertical-label"     value="KBytes"/>
+          <param name="ds-type"            value="rrd-multigraph"/>
+          <param name="ds-names"           value="total,used"/>
+          <param name="graph-lower-limit"  value="0"/>
+          <!-- Total Memory -->
+          <param name="ds-expr-total"      value="{Total}"/>
+          <param name="graph-legend-total" value="Total"/>
+          <param name="line-style-total"   value="##totalresource"/>
+          <param name="line-color-total"   value="##totalresource"/>
+          <param name="line-order-total"   value="1"/>
+          <!-- Used Memory -->
+          <param name="ds-expr-used"       value="{Used}"/>
+          <param name="graph-legend-used"  value="Used"/>
+          <param name="line-style-used"    value="##resourceusage"/>
+          <param name="line-color-used"    value="##resourceusage"/>
+          <param name="line-order-used"    value="2"/>
+        </leaf>
+
+        <leaf name="Total">
+          <param name="precedence"        value="902"/>
+          <param name="comment"           value="Total memory"/>
+          <param name="graph-legend"      value="Total memory"/>
+          <param name="vertical-label"    value="KBytes"/>
+          <param name="rrd-ds"            value="sdramSize"/>
+          <param name="snmp-object"       value="$sdramSize"/>
+        </leaf>
+
+        <leaf name="Used">
+          <param name="precedence"        value="901"/>
+          <param name="comment"           value="Used memory"/>
+          <param name="graph-legend"      value="Used memory"/>
+          <param name="vertical-label"    value="KBytes"/>
+          <param name="rrd-ds"            value="sdramUsage"/>
+          <param name="snmp-object"       value="$sdramUsage"/>
+        </leaf>
+    </subtree>
+  </template>
+
+
+  <template name="e30-mempool-subtree">
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts"
+                 value="used,sysMal,sysBlks,usedBlks,freeBlks"/>
+
+    <!-- Percent Used -->
+    <param name="overview-subleave-name-used" value="Percentage_used"/>
+    <param name="overview-shortcut-text-used"
+           value="Percent Used"/>
+    <param name="overview-shortcut-title-used"
+           value="Show percentage used of all pools on one page"/>
+    <param name="overview-page-title-used"
+           value="Percentage used"/>
+    <!-- Memory Allocation -->
+    <param name="overview-subleave-name-sysMal" value="Memory_Alloc"/>
+    <param name="overview-shortcut-text-sysMal"
+           value="Memory Alloc"/>
+    <param name="overview-shortcut-title-sysMal"
+           value="Show memory allocation size usage of all pools on one page"/>
+    <param name="overview-page-title-sysMal"
+           value="Memory Allocation"/>
+    <!-- System Blocks -->
+    <param name="overview-subleave-name-sysBlks" value="System_Blocks"/>
+    <param name="overview-shortcut-text-sysBlks"
+           value="System Blocks"/>
+    <param name="overview-shortcut-title-sysBlks"
+           value="Show system block usage of all pools on one page"/>
+    <param name="overview-page-title-sysBlks"
+           value="System Blocks"/>
+    <!-- System Blocks Used -->
+    <param name="overview-subleave-name-usedBlks" value="System_Blocks_Used"/>
+    <param name="overview-shortcut-text-usedBlks"
+           value="System Blocks Used"/>
+    <param name="overview-shortcut-title-usedBlks"
+           value="Show system block usage of all pools on one page"/>
+    <param name="overview-page-title-usedBlks"
+           value="System Blocks used"/>
+    <!-- System Blocks Free -->
+    <param name="overview-subleave-name-freeBlks" value="System_Blocks_Free"/>
+    <param name="overview-shortcut-text-freeBlks"
+           value="System Blocks Free"/>
+    <param name="overview-shortcut-title-freeBlks"
+           value="Show system block free of all pools on one page"/>
+    <param name="overview-page-title-freeBlks"
+           value="System Blocks free"/>
+  </template>
+
+
+  <template name="e30-mempool">
+    <param name="graph-title"       value="%e30-mempool-name%"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+        <leaf name="Percentage_used">
+          <param name="comment"         value="Percent of blocks used"/>
+          <param name="graph-legend"    value="Percentage Used"/>
+          <param name="vertical-label"  value="percent"/>
+          <param name="ds-type"         value="rrd-file" />
+          <param name="leaf-type"       value="rrd-cdef" />
+          <param name="rpn-expr"
+                          value="{System_Blocks_Used},{System_Blocks},/"/>
+          <param name="precedence"      value="1000"/>
+        </leaf>
+
+        <leaf name="Block_Size">
+          <param name="precedence"      value="100"/>
+          <param name="hidden"          value="yes"/>
+          <param name="comment"         value="Size of a single memory block"/>
+          <param name="graph-legend"    value="Size of a single memory block"/>
+          <param name="graph-title"     value="%e30-mempool-name%"/>
+          <param name="vertical-label"  value="KBytes"/>
+          <param name="rrd-ds"          value="blkSize"/>
+          <param name="snmp-object"     value="$blkSize.%e30-mempool-index%"/>
+        </leaf>
+
+        <leaf name="Memory_Alloc">
+          <param name="precedence"      value="90"/>
+          <param name="comment"         value="memory chunk allocations"/>
+          <param name="graph-legend"    value="memory chunk allocations"/>
+          <param name="graph-title"     value="%e30-mempool-name%"/>
+          <param name="vertical-label"  value="number of malloc"/>
+          <param name="rrd-ds"          value="sysMal"/>
+          <param name="snmp-object"     value="$sysMal.%e30-mempool-index%"/>
+        </leaf>
+
+        <leaf name="System_Blocks">
+          <param name="precedence"      value="70"/>
+          <param name="comment"         value="memory blocks in the system"/>
+          <param name="graph-legend"    value="memory blocks in the system"/>
+          <param name="graph-title"     value="%e30-mempool-name%"/>
+          <param name="vertical-label"  value="memory blocks"/>
+          <param name="rrd-ds"          value="sysBlks"/>
+          <param name="snmp-object"     value="$sysBlks.%e30-mempool-index%"/>
+        </leaf>
+
+        <leaf name="System_Blocks_Used">
+          <param name="precedence"      value="60"/>
+          <param name="comment"         value="memory blocks in use"/>
+          <param name="graph-legend"    value="memory blocks in use"/>
+          <param name="graph-title"     value="%e30-mempool-name%"/>
+          <param name="vertical-label"  value="memory blocks in use"/>
+          <param name="rrd-ds"          value="usedBlks"/>
+          <param name="snmp-object"     value="$usedBlks.%e30-mempool-index%"/>
+        </leaf>
+
+        <leaf name="System_Blocks_Free">
+          <param name="precedence"      value="50"/>
+          <param name="comment"         value="memory blocks unused"/>
+          <param name="graph-legend"    value="memory blocks unused"/>
+          <param name="graph-title"     value="%e30-mempool-name%"/>
+          <param name="vertical-label"  value="memory blocks"/>
+          <param name="rrd-ds"          value="freeBlks"/>
+          <param name="snmp-object"     value="$freeBlks.%e30-mempool-index%"/>
+        </leaf>
+  </template>
+
+
+  <template name="e30-slowpath">
+    <param name="comment"                value="SlowPath Counters"/>
+    <param name="data-file"              value="%system-id%_slowpath.rrd"/>
+    <param name="graph-lower-limit"      value="0"/>
+    <param name="rrd-create-dstype"      value="GAUGE"/>
+
+    <leaf name="Summary">
+      <param name="precedence"         value="1000"/>
+      <param name="comment"            value="Summary of slowPath packets"/>
+      <param name="graph-title"        value="Summary of slowPath packets"/>
+      <param name="vertical-label"     value="packets"/>
+      <param name="ds-type"            value="rrd-multigraph"/>
+      <param name="ds-names"           value="a,b,c,d,e,f,g,h,i,j"/>
+      <param name="graph-lower-limit"  value="0"/>
+      <!-- All packets -->
+      <param name="ds-expr-a"          value="{allPackets}"/>
+      <param name="graph-legend-a"     value="All packets"/>
+      <param name="line-style-a"       value="LINE1"/>
+      <param name="line-color-a"       value="##one"/>
+      <param name="line-order-a"       value="1"/>
+      <!-- IP packets -->
+      <param name="ds-expr-b"          value="{ipPackets}"/>
+      <param name="graph-legend-b"     value="IP packets"/>
+      <param name="line-style-b"       value="LINE1"/>
+      <param name="line-color-b"       value="##two"/>
+      <param name="line-order-b"       value="2"/>
+      <!-- TCP packets -->
+      <param name="ds-expr-c"          value="{tcpPackets}"/>
+      <param name="graph-legend-c"     value="TCP packets"/>
+      <param name="line-style-c"       value="LINE1"/>
+      <param name="line-color-c"       value="##three"/>
+      <param name="line-order-c"       value="3"/>
+      <!-- UDP packets -->
+      <param name="ds-expr-d"          value="{udpPackets}"/>
+      <param name="graph-legend-d"     value="UDP packets"/>
+      <param name="line-style-d"       value="LINE1"/>
+      <param name="line-color-d"       value="##four"/>
+      <param name="line-order-d"       value="4"/>
+      <!-- ICMP packets -->
+      <param name="ds-expr-e"          value="{icmpPackets}"/>
+      <param name="graph-legend-e"     value="ICMP packets"/>
+      <param name="line-style-e"       value="LINE1"/>
+      <param name="line-color-e"       value="##five"/>
+      <param name="line-order-e"       value="5"/>
+      <!-- IGMP packets -->
+      <param name="ds-expr-f"          value="{igmpPackets}"/>
+      <param name="graph-legend-f"     value="IGMP packets"/>
+      <param name="line-style-f"       value="LINE1"/>
+      <param name="line-color-f"       value="##six"/>
+      <param name="line-order-f"       value="6"/>
+      <!-- IP Fragment packets -->
+      <param name="ds-expr-g"          value="{ipFragmentPackets}"/>
+      <param name="graph-legend-g"     value="IP fragment packets"/>
+      <param name="line-style-g"       value="LINE1"/>
+      <param name="line-color-g"       value="##seven"/>
+      <param name="line-order-g"       value="7"/>
+
+      <!-- SKIPPING DHCP packets to Client and server -->
+
+      <!-- IP in IP packets -->
+      <param name="ds-expr-h"          value="{ipInIpPackets}"/>
+      <param name="graph-legend-h"     value="IP in IP packets"/>
+      <param name="line-style-h"       value="LINE1"/>
+      <param name="line-color-h"       value="##eight"/>
+      <param name="line-order-h"       value="8"/>
+      <!-- L2TP control packets -->
+      <param name="ds-expr-i"          value="{l2tpControlPackets}"/>
+      <param name="graph-legend-i"     value="L2TP control packets"/>
+      <param name="line-style-i"       value="LINE1"/>
+      <param name="line-color-i"       value="##nine"/>
+      <param name="line-order-i"       value="9"/>
+      <!-- L2TP data packets -->
+      <param name="ds-expr-j"          value="{l2tpDataPackets}"/>
+      <param name="graph-legend-j"     value="L2TP data packets"/>
+      <param name="line-style-j"       value="LINE1"/>
+      <param name="line-color-j"       value="##ten"/>
+      <param name="line-order-j"       value="10"/>
+    </leaf>
+
+    <leaf name="allPackets">
+      <param name="precedence"         value="912"/>
+      <param name="comment"            value="Total packets"/>
+      <param name="graph-legend"       value="All packets received by CPU"/>
+      <param name="rrd-ds"             value="allPackets"/>
+      <param name="snmp-object"        value="$allPackets"/>
+    </leaf>
+    <leaf name="ipPackets">
+      <param name="precedence"         value="911"/>
+      <param name="comment"            value="Total IP packets"/>
+      <param name="graph-legend"       value="IP packets received by CPU"/>
+      <param name="rrd-ds"             value="ipPackets"/>
+      <param name="snmp-object"        value="$ipPackets"/>
+    </leaf>
+    <leaf name="tcpPackets">
+      <param name="precedence"         value="910"/>
+      <param name="comment"            value="Total TCP packets"/>
+      <param name="graph-legend"       value="TCP packets received by CPU"/>
+      <param name="rrd-ds"             value="tcpPackets"/>
+      <param name="snmp-object"        value="$tcpPackets"/>
+    </leaf>
+    <leaf name="udpPackets">
+      <param name="precedence"         value="909"/>
+      <param name="comment"            value="Total UDP packets"/>
+      <param name="graph-legend"       value="UDP packets received by CPU"/>
+      <param name="rrd-ds"             value="udpPackets"/>
+      <param name="snmp-object"        value="$udpPackets"/>
+    </leaf>
+    <leaf name="icmpPackets">
+      <param name="precedence"         value="908"/>
+      <param name="comment"            value="Total ICMP packets"/>
+      <param name="graph-legend"       value="ICMP packets received by CPU"/>
+      <param name="rrd-ds"             value="icmpPackets"/>
+      <param name="snmp-object"        value="$icmpPackets"/>
+    </leaf>
+    <leaf name="igmpPackets">
+      <param name="precedence"         value="907"/>
+      <param name="comment"            value="Total IGMP packets"/>
+      <param name="graph-legend"       value="IGMP packets received by CPU"/>
+      <param name="rrd-ds"             value="igmpPackets"/>
+      <param name="snmp-object"        value="$igmpPackets"/>
+    </leaf>
+    <leaf name="ipFragmentPackets">
+      <param name="precedence"         value="906"/>
+      <param name="comment"            value="Total IP Fragment packets"/>
+      <param name="graph-legend"       value="IP Fragment packets received"/>
+      <param name="rrd-ds"             value="ipFragPkts"/>
+      <param name="snmp-object"        value="$ipFragmentPackets"/>
+    </leaf>
+    <leaf name="dhcpPacketsToServer">
+      <param name="precedence"         value="905"/>
+      <param name="comment"
+            value="Total DHCP packets destined to a DHCP server"/>
+      <param name="graph-legend"       value="DHCP packets client to server"/>
+      <param name="rrd-ds"             value="dhcpPktsToServ"/>
+      <param name="snmp-object"        value="$dhcpPacketsToServer"/>
+    </leaf>
+    <leaf name="dhcpPacketsToClient">
+      <param name="precedence"         value="904"/>
+      <param name="comment"
+            value="Total DHCP packets destined to DHCP Client"/>
+      <param name="graph-legend"       value="DHCP packets server to client"/>
+      <param name="rrd-ds"             value="dhcpPktsToClient"/>
+      <param name="snmp-object"        value="$dhcpPacketsToClient"/>
+    </leaf>
+    <leaf name="ipInIpPackets">
+      <param name="precedence"         value="903"/>
+      <param name="comment"            value="IP-in-IP packets"/>
+      <param name="graph-legend"       value="IP-in-IP packets received"/>
+      <param name="rrd-ds"             value="ipInIpPackets"/>
+      <param name="snmp-object"        value="$ipInIpPackets"/>
+    </leaf>
+    <leaf name="l2tpControlPackets">
+      <param name="precedence"         value="902"/>
+      <param name="comment"            value="L2TP control packets"/>
+      <param name="graph-legend"       value="L2TP control packets received"/>
+      <param name="rrd-ds"             value="l2tpControlPackets"/>
+      <param name="snmp-object"        value="$l2tpControlPackets"/>
+    </leaf>
+    <leaf name="l2tpDataPackets">
+      <param name="precedence"         value="901"/>
+      <param name="comment"            value="L2TP data packets"/>
+      <param name="graph-legend"       value="L2TP Data packets received"/>
+      <param name="rrd-ds"             value="l2tpDataPackets"/>
+      <param name="snmp-object"        value="$l2tpDataPackets"/>
+    </leaf>
+  </template>
+
+  <!--
+   **************************************************************************
+
+    e100 Series templates
+
+   **************************************************************************
+  -->
+
+  <template name="e100-cpu-subtree">
+    <param name="comment"           value="Overall CPU busy percentage"/>
+    <param name="data-file"         value="%system-id%_cpu.rrd"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+    <param name="rrd-hwpredict"     value="disabled"/>
+    <param name="graph-lower-limit" value="0"/>
+    <param name="graph-upper-limit" value="100"/>
+    <param name="upper-limit"       value="80"/>
+    <param name="vertical-label"    value="Percent"/>
+  </template>
+
+  <template name="e100-cpu">
+    <param name="comment"           value="CPU Utilization on %cpu-name%"/>
+    <param name="graph-legend"      value="CPU usage"/>
+    <param name="graph-title"       value="CPU: %cpu-name%"/>
+    <param name="rrd-ds"            value="%cpu-name%"/>
+    <param name="snmp-object"       value="$cpuUtil.%cpu-index%"/>
+  </template>
+
+  <template name="e100-hdd-subtree">
+    <param name="comment"           value="Storage statistics"/>
+    <param name="data-file"         value="%system-id%_hdd.rrd"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="size,usage"/>
+
+    <!-- Total Size -->
+    <param name="overview-subleave-name-size" value="Size"/>
+    <param name="overview-shortcut-text-size" value="Total"/>
+    <param name="overview-shortcut-title-size"
+          value="Show size of HDD's on one page"/>
+    <param name="overview-page-title-size" value="Total Size"/>
+    <!-- Usage -->
+    <param name="overview-subleave-name-usage" value="Usage"/>
+    <param name="overview-shortcut-text-usage" value="Usage"/>
+    <param name="overview-shortcut-title-usage"
+          value="Show usage consumed of HDD's on one page"/>
+    <param name="overview-page-title-usage" value="Total Used"/>
+  </template>
+
+  <template name="e100-hdd">
+    <param name="comment"           value="HDD: %hdd-name%"/>
+    <param name="graph-title"       value="%system-id%: HDD %hdd-name%"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+    <leaf name="Usage">
+      <param name="precedence"         value="1000"/>
+      <param name="comment"            value="Hdd: Total vs Used"/>
+      <param name="graph-title"        value="%hdd-name%: Total vs Used"/>
+      <param name="vertical-label"     value="Bytes"/>
+      <param name="ds-type"            value="rrd-multigraph"/>
+      <param name="ds-names"           value="size,used"/>
+      <param name="graph-lower-limit"  value="0"/>
+      <!-- Total Parition Size -->
+      <param name="ds-expr-size"      value="{Size_Raw},1024,1024,*,*"/>
+      <param name="graph-legend-size" value="Size"/>
+      <param name="line-style-size"   value="##totalresource"/>
+      <param name="line-color-size"   value="##totalresource"/>
+      <param name="line-order-size"   value="1"/>
+      <!-- Used Partition Size -->
+      <param name="ds-expr-used"      value="{Used_Raw},1024,1024,*,*"/>
+      <param name="graph-legend-used" value="Used"/>
+      <param name="line-style-used"   value="##resourceusage"/>
+      <param name="line-color-used"   value="##resourceusage"/>
+      <param name="line-order-used"   value="2"/>
+    </leaf>
+
+    <leaf name="Size">
+      <param name="precedence"        value="902"/>
+      <param name="comment"           value="Size of %hdd-name%"/>
+      <param name="ds-type"           value="rrd-file"/>
+      <param name="leaf-type"         value="rrd-cdef"/>
+      <param name="rpn-expr"          value="{Size_Raw},1024,1024,*,*"/>
+      <param name="graph-legend"      value="Size of %hdd-name%"/>
+      <param name="graph-title"       value="Size of %hdd-name%"/>
+      <param name="vertical-label"    value="Bytes"/>
+    </leaf>
+
+    <leaf name="Size_Raw">
+      <param name="hidden"            value="yes"/>
+      <param name="precedence"        value="102"/>
+      <param name="comment"           value="Size of %hdd-name%"/>
+      <param name="graph-legend"      value="Size of %hdd-name%"/>
+      <param name="graph-title"       value="Size of %hdd-name%"/>
+      <param name="vertical-label"    value="Bytes"/>
+      <param name="rrd-ds"            value="hdd_%hdd-name%_size"/>
+      <param name="snmp-object"       value="$partitionSize.%hdd-index%"/>
+    </leaf>
+
+    <leaf name="Used">
+      <param name="precedence"        value="901"/>
+      <param name="comment"           value="Usage of %hdd-name%"/>
+      <param name="ds-type"           value="rrd-file"/>
+      <param name="leaf-type"         value="rrd-cdef"/>
+      <param name="rpn-expr"          value="{Used_Raw},1024,1024,*,*"/>
+      <param name="graph-legend"      value="Usage of %hdd-name%"/>
+      <param name="graph-title"       value="Usage of %hdd-name%"/>
+      <param name="vertical-label"    value="Bytes"/>
+    </leaf>
+
+    <leaf name="Used_Raw">
+      <param name="hidden"            value="yes"/>
+      <param name="precedence"        value="101"/>
+      <param name="comment"           value="Usage of %hdd-name%"/>
+      <param name="graph-legend"      value="Usage of %hdd-name%"/>
+      <param name="graph-title"       value="Usage of %hdd-name%"/>
+      <param name="vertical-label"    value="Bytes"/>
+      <param name="rrd-ds"            value="hdd_%hdd-name%_usage"/>
+      <param name="snmp-object"       value="$partitionUsage.%hdd-index%"/>
+    </leaf>
+  </template>
+
+  <template name="e100-mem-subtree">
+    <param name="comment"           value="Memory statistics"/>
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts"     value="usage,total,used"/>
+
+    <!-- Memory Usage (Total vs Used) -->
+    <param name="overview-subleave-name-usage" value="Usage"/>
+    <param name="overview-shortcut-text-usage" value="Memory Usage"/>
+    <param name="overview-shortcut-title-usage"
+           value="Show memory usage of all cpu's on one page"/>
+    <param name="overview-page-title-usage"
+           value="Memory usage"/>
+    <!-- Memory Total -->
+    <param name="overview-subleave-name-total" value="Total"/>
+    <param name="overview-shortcut-text-total" value="Memory Total"/>
+    <param name="overview-shortcut-title-total"
+           value="Show memory total of all cpu's on one page"/>
+    <param name="overview-page-title-total"
+           value="Memory total"/>
+    <!-- Memory Used -->
+    <param name="overview-subleave-name-used" value="Used"/>
+    <param name="overview-shortcut-text-used" value="Memory Used"/>
+    <param name="overview-shortcut-title-used"
+           value="Show memory used of all cpu's on one page"/>
+    <param name="overview-page-title-used"
+           value="Memory used"/>
+  </template>
+
+  <template name="e100-mem">
+    <param name="comment"           value="Memory usage statistics"/>
+    <param name="data-file"         value="%system-id%_mem_%mem-name%.rrd"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+    <leaf name="Usage">
+      <param name="precedence"         value="1000"/>
+      <param name="comment"            value="Total vs Used"/>
+      <param name="graph-title"        value="Total vs Used"/>
+      <param name="vertical-label"     value="MBytes"/>
+      <param name="ds-type"            value="rrd-multigraph"/>
+      <param name="ds-names"           value="total,used"/>
+      <param name="graph-lower-limit"  value="0"/>
+      <!-- Total Memory -->
+      <param name="ds-expr-total"      value="{Total}"/>
+      <param name="graph-legend-total" value="Total"/>
+      <param name="line-style-total"   value="##totalresource"/>
+      <param name="line-color-total"   value="##totalresource"/>
+      <param name="line-order-total"   value="1"/>
+      <!-- Used Memory -->
+      <param name="ds-expr-used"       value="{Used}"/>
+      <param name="graph-legend-used"  value="Used"/>
+      <param name="line-style-used"    value="##resourceusage"/>
+      <param name="line-color-used"    value="##resourceusage"/>
+      <param name="line-order-used"    value="2"/>
+    </leaf>
+
+    <leaf name="Total">
+      <param name="precedence"        value="902"/>
+      <param name="comment"           value="Total memory"/>
+      <param name="graph-legend"      value="Total memory"/>
+      <param name="vertical-label"    value="MBytes"/>
+      <param name="rrd-ds"            value="cpuSdramSize"/>
+      <param name="snmp-object"       value="$cpuSdramSize.%mem-index%"/>
+    </leaf>
+
+    <leaf name="Used">
+      <param name="precedence"        value="901"/>
+      <param name="comment"           value="Used memory"/>
+      <param name="graph-legend"      value="Used memory"/>
+      <param name="vertical-label"    value="MBytes"/>
+      <param name="rrd-ds"            value="cpuSdramUsage"/>
+      <param name="snmp-object"       value="$cpuSdramUsage.%mem-index%"/>
+    </leaf>
+  </template>
+
+  <template name="e100-policymgmt">
+    <subtree name="Policy_Management">
+      <param name="comment"           value="Policy Statistics"/>
+      <param name="data-file"         value="%system-id%_policy.rrd"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+
+      <param name="has-overview-shortcuts" value="yes"/>
+      <param name="overview-shortcuts"     value="usage"/>
+      <!-- Table usage -->
+      <param name="overview-subleave-name-usage"    value="Usage"/>
+      <param name="overview-direct-link-usage"      value="yes"/>
+      <param name="overview-direct-link-view-usage" value="expanded-dir-html"/>
+      <param name="overview-shortcut-text-usage"    value="Table Usage"/>
+      <param name="overview-shortcut-title-usage"
+             value="Show table usage for all"/>
+      <param name="overview-page-title-usage"       value="Table Usage"/>
+
+      <subtree name="Delta_Operations">
+        <param name="precedence"       value="4"/>
+        <param name="comment"          value="Delta processing"/>
+
+        <leaf name="Usage">
+          <param name="precedence"        value="1000"/>
+          <param name="comment"           value="Delta: Received vs Processed"/>
+          <param name="graph-title"       value="Delta: Received vs Processed"/>
+          <param name="vertical-label"    value="Delta count"/>
+          <param name="ds-type"           value="rrd-multigraph"/>
+          <param name="ds-names"          value="recv,proc"/>
+          <param name="graph-lower-limit" value="0"/>
+          <!-- Total Capacity Size -->
+          <param name="ds-expr-recv"      value="{Received}"/>
+          <param name="graph-legend-recv" value="Received"/>
+          <param name="line-style-recv"   value="LINE1"/>
+          <param name="line-color-recv"   value="##two"/>
+          <param name="line-order-recv"   value="1"/>
+          <!-- Used Capacity Size -->
+          <param name="ds-expr-proc"      value="{Processed}"/>
+          <param name="graph-legend-proc" value="Processed"/>
+          <param name="line-style-proc"   value="LINE1"/>
+          <param name="line-color-proc"   value="##three"/>
+          <param name="line-order-proc"   value="2"/>
+        </leaf>
+
+        <leaf name="Received">
+          <param name="precedence"     value="402"/>
+          <param name="comment"        value="Delta ops received from CM"/>
+          <param name="graph-legend"   value="Number of deltas received"/>
+          <param name="graph-title"    value="Delta operations received"/>
+          <param name="vertical-label" value="Deltas"/>
+          <param name="rrd-ds"         value="deltaRecv"/>
+          <param name="snmp-object"    value="$deltaOperationsReceived"/>
+        </leaf>
+
+        <leaf name="Processed">
+          <param name="precedence"     value="401"/>
+          <param name="comment"        value="Delta ops processed by switch"/>
+          <param name="graph-legend"   value="Number of deltas processed"/>
+          <param name="graph-title"    value="Delta operations processed"/>
+          <param name="vertical-label" value="Deltas"/>
+          <param name="rrd-ds"         value="deltaProc"/>
+          <param name="snmp-object"    value="$deltaOperationsProcessed"/>
+        </leaf>
+      </subtree>
+
+      <subtree name="Service_Profile">
+        <param name="precedence"         value="3"/>
+        <param name="comment"            value="Service profile statistics"/>
+        <param name="graph-lower-limit"  value="0"/>
+
+        <leaf name="Usage">
+          <param name="precedence"         value="1000"/>
+          <param name="comment"            value="Profile: Total vs Used"/>
+          <param name="graph-title"        value="Profile: Total vs Used"/>
+          <param name="vertical-label"     value="Number"/>
+          <param name="ds-type"            value="rrd-multigraph"/>
+          <param name="ds-names"           value="cap,use"/>
+          <param name="graph-lower-limit"  value="0"/>
+          <!-- Total Capacity Size -->
+          <param name="ds-expr-cap"        value="{Table_Capacity}"/>
+          <param name="graph-legend-cap"   value="Total"/>
+          <param name="line-style-cap"     value="##totalresource"/>
+          <param name="line-color-cap"     value="##totalresource"/>
+          <param name="line-order-cap"     value="1"/>
+          <!-- Used Capacity Size -->
+          <param name="ds-expr-use"        value="{Table_Usage}"/>
+          <param name="graph-legend-use"   value="Used"/>
+          <param name="line-style-use"     value="##resourceusage"/>
+          <param name="line-color-use"     value="##resourceusage"/>
+          <param name="line-order-use"     value="2"/>
+        </leaf>
+
+        <leaf name="Table_Capacity">
+          <param name="precdecence"    value="302"/>
+          <param name="comment"       value="Number of total profiles allowed"/>
+          <param name="graph-legend"   value="Total number of profiles"/>
+          <param name="graph-title"    value="Service profile capacity"/>
+          <param name="vertical-label" value="Profiles"/>
+          <param name="rrd-ds"         value="srvProfileTblCap"/>
+          <param name="snmp-object"    value="$serviceProfileTblCapacity"/>
+        </leaf>
+
+        <leaf name="Table_Usage">
+          <param name="precdecence"    value="301"/>
+          <param name="comment"        value="Number of total profiles used"/>
+          <param name="graph-legend"   value="current number of profiles"/>
+          <param name="graph-title"    value="Service profile usage"/>
+          <param name="vertical-label" value="Profiles"/>
+          <param name="rrd-ds"         value="srvProfileTblUse"/>
+          <param name="snmp-object"    value="$serviceProfileTblUsage"/>
+        </leaf>
+      </subtree>
+
+      <subtree name="Service_Bundle">
+        <param name="precedence"         value="2"/>
+        <param name="comment"            value="Service bundle statistics"/>
+        <param name="graph-lower-limit"  value="0"/>
+
+        <leaf name="Usage">
+          <param name="precedence"         value="1000"/>
+          <param name="comment"            value="Bundles: Total vs Used"/>
+          <param name="graph-title"        value="Bundles: Total vs Used"/>
+          <param name="vertical-label"     value="Number"/>
+          <param name="ds-type"            value="rrd-multigraph"/>
+          <param name="ds-names"           value="cap,use"/>
+          <param name="graph-lower-limit"  value="0"/>
+          <!-- Total Capacity Size -->
+          <param name="ds-expr-cap"        value="{Table_Capacity}"/>
+          <param name="graph-legend-cap"   value="Total"/>
+          <param name="line-style-cap"     value="##totalresource"/>
+          <param name="line-color-cap"     value="##totalresource"/>
+          <param name="line-order-cap"     value="1"/>
+          <!-- Used Capacity Size -->
+          <param name="ds-expr-use"        value="{Table_Usage}"/>
+          <param name="graph-legend-use"   value="Used"/>
+          <param name="line-style-use"     value="##resourceusage"/>
+          <param name="line-color-use"     value="##resourceusage"/>
+          <param name="line-order-use"     value="2"/>
+        </leaf>
+
+        <leaf name="Table_Capacity">
+          <param name="precdecence"    value="202"/>
+          <param name="comment"        value="Number of total bundles allowed"/>
+          <param name="graph-legend"   value="Total number of bundles"/>
+          <param name="graph-title"    value="Service bundle capacity"/>
+          <param name="vertical-label" value="Bundles"/>
+          <param name="rrd-ds"         value="srvBundleTblCap"/>
+          <param name="snmp-object"    value="$serviceBundleTblCapacity"/>
+        </leaf>
+
+        <leaf name="Table_Usage">
+          <param name="precdecence"    value="201"/>
+          <param name="comment"        value="Number of total bundles used"/>
+          <param name="graph-legend"   value="current number of bundles"/>
+          <param name="graph-title"    value="Service bundle usage"/>
+          <param name="vertical-label" value="Bundles"/>
+          <param name="rrd-ds"         value="srvBundleTblUse"/>
+          <param name="snmp-object"    value="$serviceBundleTblUsage"/>
+        </leaf>
+      </subtree>
+
+      <subtree name="Subnet_Group">
+        <param name="precedence"         value="1"/>
+        <param name="comment"            value="Subnet group statistics"/>
+        <param name="graph-lower-limit"  value="0"/>
+
+        <leaf name="Usage">
+          <param name="precedence"         value="1000"/>
+          <param name="comment"            value="Subnets: Total vs Used"/>
+          <param name="graph-title"        value="Subnets: Total vs Used"/>
+          <param name="vertical-label"     value="Number"/>
+          <param name="ds-type"            value="rrd-multigraph"/>
+          <param name="ds-names"           value="cap,use"/>
+          <param name="graph-lower-limit"  value="0"/>
+          <!-- Total Capacity Size -->
+          <param name="ds-expr-cap"        value="{Table_Capacity}"/>
+          <param name="graph-legend-cap"   value="Total"/>
+          <param name="line-style-cap"     value="##totalresource"/>
+          <param name="line-color-cap"     value="##totalresource"/>
+          <param name="line-order-cap"     value="1"/>
+          <!-- Used Capacity Size -->
+          <param name="ds-expr-use"        value="{Table_Usage}"/>
+          <param name="graph-legend-use"   value="Used"/>
+          <param name="line-style-use"     value="##resourceusage"/>
+          <param name="line-color-use"     value="##resourceusage"/>
+          <param name="line-order-use"     value="2"/>
+        </leaf>
+
+        <leaf name="Table_Capacity">
+          <param name="precdecence"    value="102"/>
+          <param name="comment"        value="Number of total subnets allowed"/>
+          <param name="graph-legend"   value="Total number of entries"/>
+          <param name="graph-title"    value="Subnet group capacity"/>
+          <param name="vertical-label" value="Subnets"/>
+          <param name="rrd-ds"         value="subnetGrpTblCap"/>
+          <param name="snmp-object"    value="$subnetGrpTblCapacity"/>
+        </leaf>
+
+        <leaf name="Table_Usage">
+          <param name="precdecence"    value="101"/>
+          <param name="comment"        value="Number of total subnets used"/>
+          <param name="graph-legend"   value="current number of entries"/>
+          <param name="graph-title"    value="Subnet group usage"/>
+          <param name="vertical-label" value="Subnets"/>
+          <param name="rrd-ds"         value="subnetGrpTblUse"/>
+          <param name="snmp-object"    value="$subnetGrpTblUsage"/>
+        </leaf>
+      </subtree>
+    </subtree>
+  </template>
+
+
+  <template name="e100-submgmt-subtree">
+      <param name="comment"           value="Subscriber Statistics"/>
+      <param name="data-file"         value="%system-id%_subs.rrd"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+
+      <param name="has-overview-shortcuts" value="yes"/>
+      <param name="overview-shortcuts"     value="usage"/>
+      <!-- Table usage -->
+      <param name="overview-subleave-name-usage"    value="Usage"/>
+      <param name="overview-direct-link-usage"      value="yes"/>
+      <param name="overview-direct-link-view-usage" value="expanded-dir-html"/>
+      <param name="overview-shortcut-text-usage"    value="Table Usage"/>
+      <param name="overview-shortcut-title-usage"
+             value="Show table usage for all"/>
+      <param name="overview-page-title-usage"       value="Table Usage"/>
+
+      <subtree name="Subscriber_Management">
+        <param name="precedence"         value="3"/>
+        <param name="comment"            value="Subscriber management stats"/>
+        <param name="graph-lower-limit"  value="0"/>
+
+        <leaf name="Usage">
+          <param name="precedence"         value="1000"/>
+          <param name="comment"            value="Sub Mgmt: Total vs Used"/>
+          <param name="graph-title"        value="Sub Mgmt: Total vs Used"/>
+          <param name="vertical-label"     value="Number"/>
+          <param name="ds-type"            value="rrd-multigraph"/>
+          <param name="ds-names"           value="cap,use"/>
+          <param name="graph-lower-limit"  value="0"/>
+          <!-- Total Capacity Size -->
+          <param name="ds-expr-cap"        value="{Table_Capacity}"/>
+          <param name="graph-legend-cap"   value="Total"/>
+          <param name="line-style-cap"     value="##totalresource"/>
+          <param name="line-color-cap"     value="##totalresource"/>
+          <param name="line-order-cap"     value="1"/>
+          <!-- Used Capacity Size -->
+          <param name="ds-expr-use"        value="{Table_Usage}"/>
+          <param name="graph-legend-use"   value="Used"/>
+          <param name="line-style-use"     value="##resourceusage"/>
+          <param name="line-color-use"     value="##resourceusage"/>
+          <param name="line-order-use"     value="2"/>
+        </leaf>
+
+        <leaf name="Table_Capacity">
+          <param name="precdecence"    value="302"/>
+          <param name="comment"        value="Number of total entries allowed"/>
+          <param name="graph-legend"   value="Total number of entries"/>
+          <param name="graph-title"    value="Subscriber management capacity"/>
+          <param name="vertical-label" value="Entries"/>
+          <param name="rrd-ds"         value="subMgmtTblCap"/>
+          <param name="snmp-object"    value="$subscriberMgmtTblCapacity"/>
+        </leaf>
+
+        <leaf name="Table_Usage">
+          <param name="precdecence"    value="301"/>
+          <param name="comment"        value="Number of total entries used"/>
+          <param name="graph-legend"   value="current number of entries"/>
+          <param name="graph-title"    value="Subscriber management usage"/>
+          <param name="vertical-label" value="Entries"/>
+          <param name="rrd-ds"         value="subMgmtTblUsage"/>
+          <param name="snmp-object"    value="$subscriberMgmtTblUsage"/>
+        </leaf>
+      </subtree>
+
+      <subtree name="Subscriber_Name">
+        <param name="precedence"         value="2"/>
+        <param name="comment"            value="Subscriber name stats"/>
+        <param name="graph-lower-limit"  value="0"/>
+
+        <leaf name="Usage">
+          <param name="precedence"         value="1000"/>
+          <param name="comment"            value="Sub Mgmt: Total vs Used"/>
+          <param name="graph-title"        value="Sub Mgmt: Total vs Used"/>
+          <param name="vertical-label"     value="Number"/>
+          <param name="ds-type"            value="rrd-multigraph"/>
+          <param name="ds-names"           value="cap,use"/>
+          <param name="graph-lower-limit"  value="0"/>
+          <!-- Total Capacity Size -->
+          <param name="ds-expr-cap"        value="{Table_Capacity}"/>
+          <param name="graph-legend-cap"   value="Total"/>
+          <param name="line-style-cap"     value="##totalresource"/>
+          <param name="line-color-cap"     value="##totalresource"/>
+          <param name="line-order-cap"     value="1"/>
+          <!-- Used Capacity Size -->
+          <param name="ds-expr-use"        value="{Table_Usage}"/>
+          <param name="graph-legend-use"   value="Used"/>
+          <param name="line-style-use"     value="##resourceusage"/>
+          <param name="line-color-use"     value="##resourceusage"/>
+          <param name="line-order-use"     value="2"/>
+        </leaf>
+
+        <leaf name="Table_Capacity">
+          <param name="precdecence"    value="202"/>
+          <param name="comment"        value="Number of total entries allowed"/>
+          <param name="graph-legend"   value="Total number of entries"/>
+          <param name="graph-title"    value="Subscriber name capacity"/>
+          <param name="upper-limt"     value="800000"/>
+          <param name="vertical-label" value="Entries"/>
+          <param name="rrd-ds"         value="subNameTblCap"/>
+          <param name="snmp-object"    value="$subscriberNameTblCapacity"/>
+        </leaf>
+
+        <leaf name="Table_Usage">
+          <param name="precdecence"    value="201"/>
+          <param name="comment"        value="Number of total entries used"/>
+          <param name="graph-legend"   value="current number of entries"/>
+          <param name="graph-title"    value="Subscriber name usage"/>
+          <param name="vertical-label" value="Entries"/>
+          <param name="rrd-ds"         value="subNameTblUsage"/>
+          <param name="snmp-object"    value="$subscriberNameTblUsage"/>
+        </leaf>
+      </subtree>
+
+      <subtree name="Subscriber_Count">
+        <param name="precedence"         value="1"/>
+        <param name="comment"            value="Subscriber identification"/>
+        <param name="graph-lower-limit"  value="0"/>
+
+        <leaf name="Usage">
+          <param name="precedence"         value="1000"/>
+          <param name="comment"            value="Sub: Identified vs non"/>
+          <param name="graph-title"        value="Sub: Identified vs non"/>
+          <param name="vertical-label"     value="Subscribers"/>
+          <param name="ds-type"            value="rrd-multigraph"/>
+          <param name="ds-names"           value="id,unid"/>
+          <param name="graph-lower-limit"  value="0"/>
+          <!-- Subscribers Identified -->
+          <param name="ds-expr-id"        value="{Identified}"/>
+          <param name="graph-legend-id"   value="Identified"/>
+          <param name="line-style-id"     value="##totalresource"/>
+          <param name="line-color-id"     value="##totalresource"/>
+          <param name="line-order-id"     value="1"/>
+          <!-- Subscribers unidentified -->
+          <param name="ds-expr-unid"      value="{Unidentified}"/>
+          <param name="graph-legend-unid" value="Unidentified"/>
+          <param name="line-style-unid"   value="##resourceusage"/>
+          <param name="line-color-unid"   value="##resourceusage"/>
+          <param name="line-order-unid"   value="2"/>
+        </leaf>
+
+        <leaf name="Identified">
+          <param name="precdecence"    value="202"/>
+          <param name="comment"        value="Number of identified subs"/>
+          <param name="graph-legend"   value="Identified subscribers"/>
+          <param name="graph-title"    value="Total identified subscribers"/>
+          <param name="vertical-label" value="Entries"/>
+          <param name="rrd-ds"         value="idSubCount"/>
+          <param name="snmp-object"    value="$identifiedSubscriberCount"/>
+        </leaf>
+
+        <leaf name="Unidentified">
+          <param name="precdecence"    value="201"/>
+          <param name="comment"        value="Number of unidentified subs"/>
+          <param name="graph-legend"   value="Unidentified subscribers"/>
+          <param name="graph-title"    value="Total unidentified subscribers"/>
+          <param name="vertical-label" value="Entries"/>
+          <param name="rrd-ds"         value="unidSubCount"/>
+          <param name="snmp-object"    value="$unidentifiedSubscriberCount"/>
+        </leaf>
+      </subtree>
+  </template>
+
+
+  <template name="e100-submgmt-state-subtree">
+    <param name="comment"           value="Subscriber State Statistics"/>
+    <param name="data-file"         value="%system-id%_subs_state.rrd"/>
+    <param name="precedence"        value="1"/>
+  </template>
+
+
+  <template name="e100-submgmt-state">
+    <param name="data-file"         value="%system-id%_subs_state.rrd"/>
+    <param name="comment"           value="State: %state-name%"/>
+    <param name="graph-title"       value="State: %state-name%"/>
+    <param name="graph-legend"      value="Subscriber count"/>
+    <param name="vertical-label"    value="Subscribers"/>
+    <param name="rrd-ds"            value="%state-rrd%"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+    <param name="snmp-object"       value="$subscriberStateCount.%state-idx%"/>
+  </template>
+
+
+  <!--
+   **************************************************************************
+
+    COMMON: Bundle Offer statistics are common between the e30 and e100
+      NOTE: PacketSize information is only available for the e100
+
+   **************************************************************************
+  -->
+  <template name="arbor-bundle-subtree">
+    <param name="graph-lower-limit"  value="0" />
+    <param name="graph-title"        value="%bundle-name%"/>
+
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts"     value="up,down,volume"/>
+    <!-- Up Volume -->
+    <param name="overview-subleave-name-up"      value="Up_bps"/>
+    <param name="overview-direct-link-up"        value="yes"/>
+    <param name="overview-direct-link-view-up"   value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-up"
+           value="Upstream Usage"/>
+    <param name="overview-shortcut-title-up"
+           value="Show upstream bandwidth usage for all bundles"/>
+    <param name="overview-page-title-up"
+           value="Upstream Usage"/>
+    <!-- Down Volume -->
+    <param name="overview-subleave-name-down"    value="Down_bps"/>
+    <param name="overview-direct-link-down"      value="yes"/>
+    <param name="overview-direct-link-view-down" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-down"
+           value="Downstream Usage"/>
+    <param name="overview-shortcut-title-down"
+           value="Show downstream bandwidth usage for all bundles"/>
+    <param name="overview-page-title-down"
+           value="Downstream Usage"/>
+    <!-- InOut Volume -->
+    <param name="overview-subleave-name-volume"    value="Volume"/>
+    <param name="overview-direct-link-volume"      value="yes"/>
+    <param name="overview-direct-link-view-volume" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-volume"
+           value="InOut Usage"/>
+    <param name="overview-shortcut-title-volume"
+           value="Show InOut bandwidth usage for all bundles"/>
+    <param name="overview-page-title-volume"
+           value="Volume Usage"/>
+  </template>
+
+
+  <template name="arbor-bundle">
+    <leaf name="Volume">
+      <param name="comment"           value="InOut volume in kilobytes/s"/>
+      <param name="precedence"        value="1000"/>
+      <param name="ds-type"           value="rrd-multigraph"/>
+      <param name="ds-names"          value="down,up"/>
+      <!-- Volume Download -->
+      <param name="ds-expr-down"      value="{DownVolume},8,*"/>
+      <param name="graph-legend-down" value="Bits per second in"/>
+      <param name="line-style-down"   value="##BpsIn"/>
+      <param name="line-color-down"   value="##BpsIn"/>
+      <param name="line-order-down"   value="1"/>
+      <!-- Volume Upload -->
+      <param name="ds-expr-up"        value="{UpVolume},8,*"/>
+      <param name="graph-legend-up"   value="Bits per second out"/>
+      <param name="line-style-up"     value="##BpsOut"/>
+      <param name="line-color-up"     value="##BpsOut"/>
+      <param name="line-order-up"     value="2"/>
+    </leaf>
+
+    <leaf name="UpVolume">
+      <param name="comment"           value="Upstream volume in kilobytes/s"/>
+      <param name="hidden"            value="yes"/>
+      <param name="rrd-ds"            value="UpVolume"/>
+      <param name="snmp-object"
+            value="$boBundleBytesSent.%bundle-id%.%offer-id%"/>
+      <param name="precedence"        value="902"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+
+    <leaf name="DownVolume">
+      <param name="comment"           value="Downstream volume in kilobytes/s"/>
+      <param name="hidden"            value="yes"/>
+      <param name="rrd-ds"            value="DownVolume"/>
+      <param name="snmp-object"
+            value="$boBundleBytesReceived.%bundle-id%.%offer-id%"/>
+      <param name="precedence"        value="901"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+
+    <leaf name="Up_bps">
+      <param name="comment" value="Upstream bandwidth usage per service"/>
+      <param name="graph-legend"   value="Upstream BW"/>
+      <param name="vertical-label" value="bps"/>
+      <param name="ds-type"        value="rrd-file" />
+      <param name="leaf-type"      value="rrd-cdef" />
+      <param name="rpn-expr"       value="{UpVolume},8,*" />
+      <param name="precedence"     value="802"/>
+    </leaf>
+
+    <leaf name="Down_bps">
+      <param name="comment" value="Downstream bandwidth usage per service"/>
+      <param name="graph-legend"   value="Downstream BW"/>
+      <param name="vertical-label" value="bps"/>
+      <param name="ds-type"        value="rrd-file" />
+      <param name="leaf-type"      value="rrd-cdef" />
+      <param name="rpn-expr"       value="{DownVolume},8,*" />
+      <param name="precedence"     value="801"/>
+    </leaf>
+  </template>
+
+
+  <template name="arbor-bundle-deny">
+    <leaf name="Volume_Denied">
+      <param name="comment"
+                     value="InOut of denied volume in kilobytes/s"/>
+      <param name="precedence"          value="1000"/>
+      <param name="ds-type"             value="rrd-multigraph"/>
+      <param name="ds-names"            value="down,up"/>
+      <!-- Volume Download -->
+      <param name="ds-expr-down"        value="{Deny_DownVolume},8,*"/>
+      <param name="graph-legend-down"   value="Denied Bits per second in"/>
+      <param name="line-style-down"     value="##BpsIn"/>
+      <param name="line-color-down"     value="##BpsIn"/>
+      <param name="line-order-down"     value="1"/>
+      <!-- Volume Upload -->
+      <param name="ds-expr-up"          value="{Deny_UpVolume},8,*"/>
+      <param name="graph-legend-up"     value="Denied Bits per second out"/>
+      <param name="line-style-up"       value="##BpsOut"/>
+      <param name="line-color-up"       value="##BpsOut"/>
+      <param name="line-order-up"       value="2"/>
+    </leaf>
+
+    <leaf name="Deny_UpVolume">
+      <param name="data-file" 
+            value="%system-id%_bo_%offer-rrd%_%bundle-rrd%_deny.rrd"/>
+      <param name="comment"    value="Upstream denied volume in kilobytes/s"/>
+      <param name="hidden"     value="yes"/>
+      <param name="rrd-ds"     value="UpVolumeDeny"/>
+      <param name="snmp-object"
+           value="$boBundleBytesSentDenyPolicyDrop.%bundle-id%.%offer-id%"/>
+      <param name="precedence"        value="602"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="snmp-object-type"  value="COUNTER64"/>
+    </leaf>
+
+    <leaf name="Deny_DownVolume">
+      <param name="data-file" 
+            value="%system-id%_bo_%offer-rrd%_%bundle-rrd%_deny.rrd"/>
+      <param name="comment"    value="Downstream denied volume in kilobytes/s"/>
+      <param name="hidden"     value="yes"/>
+      <param name="rrd-ds"     value="DownVolumeDeny"/>
+      <param name="snmp-object"
+           value="$boBundleBytesReceivedDenyPolicyDrop.%bundle-id%.%offer-id%"/>
+      <param name="precedence"        value="601"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="snmp-object-type"  value="COUNTER64"/>
+    </leaf>
+
+    <leaf name="Denied_Up_bps">
+      <param name="comment"
+            value="Upstream denied bandwidth usage per service"/>
+      <param name="graph-legend"   value="Upstream Denied BW"/>
+      <param name="line-style"     value="##BpsOut"/>
+      <param name="line-color"     value="##BpsOut"/>
+      <param name="vertical-label" value="bps"/>
+      <param name="ds-type"        value="rrd-file" />
+      <param name="leaf-type"      value="rrd-cdef" />
+      <param name="rpn-expr"       value="{Deny_UpVolume},8,*" />
+      <param name="precedence"     value="502"/>
+    </leaf>
+
+    <leaf name="Denied_Down_bps">
+      <param name="comment"
+            value="Downstream denied bandwidth usage per service"/>
+      <param name="graph-legend"   value="Downstream denied BW"/>
+      <param name="line-style"     value="##BpsIn"/>
+      <param name="line-color"     value="##BpsIn"/>
+      <param name="vertical-label" value="bps"/>
+      <param name="ds-type"        value="rrd-file" />
+      <param name="leaf-type"      value="rrd-cdef" />
+      <param name="rpn-expr"       value="{Deny_DownVolume},8,*" />
+      <param name="precedence"     value="501"/>
+    </leaf>
+  </template>
+
+
+  <template name="arbor-bundle-ratelimit">
+    <leaf name="Volume_RateLimit">
+      <param name="comment"
+                     value="InOut of ratelimit volume in kilobytes/s"/>
+      <param name="precedence"          value="1000"/>
+      <param name="ds-type"             value="rrd-multigraph"/>
+      <param name="ds-names"            value="down,up"/>
+      <!-- Volume Download -->
+      <param name="ds-expr-down"        value="{Rate_DownVolume},8,*"/>
+      <param name="graph-legend-down"   value="Rate limit Bits per second in"/>
+      <param name="line-style-down"     value="##BpsIn"/>
+      <param name="line-color-down"     value="##BpsIn"/>
+      <param name="line-order-down"     value="1"/>
+      <!-- Volume Upload -->
+      <param name="ds-expr-up"          value="{Rate_UpVolume},8,*"/>
+      <param name="graph-legend-up"     value="Rate limit Bits per second out"/>
+      <param name="line-style-up"       value="##BpsOut"/>
+      <param name="line-color-up"       value="##BpsOut"/>
+      <param name="line-order-up"       value="2"/>
+    </leaf>
+
+    <leaf name="Rate_UpVolume">
+      <param name="data-file" 
+            value="%system-id%_bo_%offer-rrd%_%bundle-rrd%_ratelimit.rrd"/>
+      <param name="comment"
+            value="Upstream ratelimit volume in kilobytes/s"/>
+      <param name="hidden"            value="yes"/>
+      <param name="rrd-ds"            value="UpVolumeRate"/>
+      <param name="snmp-object"
+            value="$boBundleBytesSentRateLimitDrop.%bundle-id%.%offer-id%"/>
+      <param name="precedence"        value="402"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="snmp-object-type"  value="COUNTER64"/>
+    </leaf>
+
+    <leaf name="Rate_DownVolume">
+      <param name="data-file" 
+            value="%system-id%_bo_%offer-rrd%_%bundle-rrd%_ratelimit.rrd"/>
+      <param name="comment"
+            value="Downstream ratelimit volume in kilobytes/s"/>
+      <param name="hidden"            value="yes"/>
+      <param name="rrd-ds"            value="DownVolumeRate"/>
+      <param name="snmp-object"
+            value="$boBundleBytesReceivedRateLimitDrop.%bundle-id%.%offer-id%"/>
+      <param name="precedence"        value="401"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="snmp-object-type"  value="COUNTER64"/>
+    </leaf>
+
+    <leaf name="Ratelimit_Up_bps">
+      <param name="comment"
+            value="Upstream rate limit bandwidth usage per service"/>
+      <param name="graph-legend"   value="Upstream rate limited in Bps"/>
+      <param name="vertical-label" value="bps"/>
+      <param name="ds-type"        value="rrd-file" />
+      <param name="leaf-type"      value="rrd-cdef" />
+      <param name="rpn-expr"       value="{Rate_UpVolume},8,*" />
+      <param name="precedence"     value="302"/>
+    </leaf>
+
+    <leaf name="Ratelimit_Down_bps">
+      <param name="comment"
+            value="Downstream rate limit bandwidth usage per service"/>
+      <param name="graph-legend"   value="Downstream rate limited in Bps"/>
+      <param name="vertical-label" value="bps"/>
+      <param name="ds-type"        value="rrd-file" />
+      <param name="leaf-type"      value="rrd-cdef" />
+      <param name="rpn-expr"       value="{Rate_DownVolume},8,*" />
+      <param name="precedence"     value="301"/>
+    </leaf>
+  </template>
+
+
+  <template name="arbor-bundle-subcount">
+    <leaf name="Subscriber_Count">
+      <param name="comment"           value="Subscribers using this bundle"/>
+      <param name="data-file"
+            value="%system-id%_bo_%offer-rrd%_%bundle-rrd%_subcount.rrd"/>
+      <param name="graph-legend"      value="subscribers"/>
+      <param name="rrd-ds"            value="subCount"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="snmp-object"
+            value="$boBundleSubCount.%bundle-id%.%offer-id%"/>
+    </leaf>
+  </template>
+
+
+  <template name="arbor-bundle-pktsize">
+    <subtree name="Packet_Sizes">
+      <param name="comment"
+            value="Number of packets sent per grouped packet size"/>
+      <param name="data-file"
+            value="%system-id%_bo_%offer-rrd%_%bundle-rrd%_pktsize.rrd"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+
+      <!-- SUMMARY OF BYTE SIZES -->
+      <leaf name="64Byte">
+        <param name="comment"      value="InOut volume in kbps for 64Byte"/>
+        <param name="precedence"   value="999"/>
+        <param name="ds-type"      value="rrd-multigraph"/>
+        <param name="ds-names"     value="down,up"/>
+        <!-- 64 Byte Volume down -->
+        <!-- 221 (num of packets) * 64 bytes * 8 bits / 300 secs  -->
+        <param name="ds-expr-down"      value="{64Byte_Down},64,*,8,*,300,/"/>
+        <param name="graph-legend-down" value="Approx Bits per second in"/>
+        <param name="line-style-down"   value="##BpsIn"/>
+        <param name="line-color-down"   value="##BpsIn"/>
+        <param name="line-order-down"   value="1"/>
+        <!-- 64 Byte Volume up -->
+        <param name="ds-expr-up"        value="{64Byte_Up},64,*,8,*,300,/"/>
+        <param name="graph-legend-up"   value="Approx Bits per second out"/>
+        <param name="line-style-up"     value="##BpsOut"/>
+        <param name="line-color-up"     value="##BpsOut"/>
+        <param name="line-order-up"     value="1"/>
+      </leaf>
+
+      <leaf name="65Byte_to_127Byte">
+        <param name="comment"
+              value="Approx InOut volume in kbps for 65 to 127Byte"/>
+        <param name="precedence"   value="998"/>
+        <param name="ds-type"      value="rrd-multigraph"/>
+        <param name="ds-names"     value="down,up"/>
+        <!-- 65Byte_to_127Byte Volume down -->
+        <param name="ds-expr-down"
+              value="{65Byte_to_127Byte_Down},64,*,8,*,300,/"/>
+        <param name="graph-legend-down" value="Approx Bits per second in"/>
+        <param name="line-style-down"   value="##BpsIn"/>
+        <param name="line-color-down"   value="##BpsIn"/>
+        <param name="line-order-down"   value="1"/>
+        <!-- 65Byte_to_127Byte Volume up -->
+        <param name="ds-expr-up"
+              value="{65Byte_to_127Byte_Up},64,*,8,*,300,/"/>
+        <param name="graph-legend-up"   value="Approx Bits per second out"/>
+        <param name="line-style-up"     value="##BpsOut"/>
+        <param name="line-color-up"     value="##BpsOut"/>
+        <param name="line-order-up"     value="1"/>
+      </leaf>
+
+      <leaf name="128Byte_to_255Byte">
+        <param name="comment"
+              value="Approx InOut volume in kbps for 128 to 255Byte"/>
+        <param name="precedence"   value="997"/>
+        <param name="ds-type"      value="rrd-multigraph"/>
+        <param name="ds-names"     value="down,up"/>
+        <!-- 128Byte_to_255Byte Volume down -->
+        <param name="ds-expr-down"
+              value="{128Byte_to_255Byte_Down},64,*,8,*,300,/"/>
+        <param name="graph-legend-down" value="Approx Bits per second in"/>
+        <param name="line-style-down"   value="##BpsIn"/>
+        <param name="line-color-down"   value="##BpsIn"/>
+        <param name="line-order-down"   value="1"/>
+        <!-- 128Byte_to_255Byte Volume up -->
+        <param name="ds-expr-up"
+              value="{128Byte_to_255Byte_Up},64,*,8,*,300,/"/>
+        <param name="graph-legend-up"   value="Approx Bits per second out"/>
+        <param name="line-style-up"     value="##BpsOut"/>
+        <param name="line-color-up"     value="##BpsOut"/>
+        <param name="line-order-up"     value="1"/>
+      </leaf>
+
+      <leaf name="256Byte_to_511Byte">
+        <param name="comment"
+              value="Approx InOut volume in kbps for 256 to 511Byte"/>
+        <param name="precedence"   value="996"/>
+        <param name="ds-type"      value="rrd-multigraph"/>
+        <param name="ds-names"     value="down,up"/>
+        <!-- 256Byte_to_511Byte Volume down -->
+        <param name="ds-expr-down"
+              value="{256Byte_to_511Byte_Down},64,*,8,*,300,/"/>
+        <param name="graph-legend-down" value="Approx Bits per second in"/>
+        <param name="line-style-down"   value="##BpsIn"/>
+        <param name="line-color-down"   value="##BpsIn"/>
+        <param name="line-order-down"   value="1"/>
+        <!-- 256Byte_to_511Byte Volume up -->
+        <param name="ds-expr-up"
+              value="{256Byte_to_511Byte_Up},64,*,8,*,300,/"/>
+        <param name="graph-legend-up"   value="Approx Bits per second out"/>
+        <param name="line-style-up"     value="##BpsOut"/>
+        <param name="line-color-up"     value="##BpsOut"/>
+        <param name="line-order-up"     value="1"/>
+      </leaf>
+
+      <leaf name="512Byte_to_1023Byte">
+        <param name="comment"
+              value="Approx InOut volume in kbps for 512 to 1023Byte"/>
+        <param name="precedence"   value="995"/>
+        <param name="ds-type"      value="rrd-multigraph"/>
+        <param name="ds-names"     value="down,up"/>
+        <!-- 512Byte_to_1023Byte Volume down -->
+        <param name="ds-expr-down"
+              value="{512Byte_to_1023Byte_Down},64,*,8,*,300,/"/>
+        <param name="graph-legend-down" value="Approx Bits per second in"/>
+        <param name="line-style-down"   value="##BpsIn"/>
+        <param name="line-color-down"   value="##BpsIn"/>
+        <param name="line-order-down"   value="1"/>
+        <!-- 512Byte_to_1023Byte Volume up -->
+        <param name="ds-expr-up"
+              value="{512Byte_to_1023Byte_Up},64,*,8,*,300,/"/>
+        <param name="graph-legend-up"   value="Approx Bits per second out"/>
+        <param name="line-style-up"     value="##BpsOut"/>
+        <param name="line-color-up"     value="##BpsOut"/>
+        <param name="line-order-up"     value="1"/>
+      </leaf>
+
+      <leaf name="1024Byte_to_1518Byte">
+        <param name="comment"
+              value="Approx InOut volume in kbps for 1024 to 1518Byte"/>
+        <param name="precedence"   value="994"/>
+        <param name="ds-type"      value="rrd-multigraph"/>
+        <param name="ds-names"     value="down,up"/>
+        <!-- 1024Byte_to_1518Byte Volume down -->
+        <param name="ds-expr-down"
+              value="{1024Byte_to_1518Byte_Down},64,*,8,*,300,/"/>
+        <param name="graph-legend-down" value="Approx Bits per second in"/>
+        <param name="line-style-down"   value="##BpsIn"/>
+        <param name="line-color-down"   value="##BpsIn"/>
+        <param name="line-order-down"   value="1"/>
+        <!-- 1024Byte_to_1518Byte Volume up -->
+        <param name="ds-expr-up"
+              value="{1024Byte_to_1518Byte_Up},64,*,8,*,300,/"/>
+        <param name="graph-legend-up"   value="Approx Bits per second out"/>
+        <param name="line-style-up"     value="##BpsOut"/>
+        <param name="line-color-up"     value="##BpsOut"/>
+        <param name="line-order-up"     value="1"/>
+      </leaf>
+
+      <leaf name="1519Byte_and_higher">
+        <param name="comment"
+              value="Approx InOut volume in kbps for 1519 and higher Byte"/>
+        <param name="precedence"   value="993"/>
+        <param name="ds-type"      value="rrd-multigraph"/>
+        <param name="ds-names"     value="down,up"/>
+        <!-- 1519Byte_and_higher Volume down -->
+        <param name="ds-expr-down"
+              value="{1519Byte_and_higher_Down},64,*,8,*,300,/"/>
+        <param name="graph-legend-down" value="Approx Bits per second in"/>
+        <param name="line-style-down"   value="##BpsIn"/>
+        <param name="line-color-down"   value="##BpsIn"/>
+        <param name="line-order-down"   value="1"/>
+        <!-- 1519Byte_and_higher Volume up -->
+        <param name="ds-expr-up"
+              value="{1519Byte_and_higher_Up},64,*,8,*,300,/"/>
+        <param name="graph-legend-up"   value="Bits per second out"/>
+        <param name="line-style-up"     value="##BpsOut"/>
+        <param name="line-color-up"     value="##BpsOut"/>
+        <param name="line-order-up"     value="1"/>
+      </leaf>
+
+      <!--
+        PER PACKET SIZES
+                      64 (only 64byte)
+           65   to   127 
+           128  to   255
+           256  to   511
+           512  to  1023
+           1024 to  1518
+           1519 and higher
+       --> 
+
+      <leaf name="64Byte_Up">
+        <param name="comment"      value="64 Byte packets"/>
+        <param name="graph-legend" value="64 byte"/>
+        <param name="precedence"   value="92"/>
+        <param name="rrd-ds"       value="Sent64"/>
+        <param name="snmp-object"
+              value="$boPacketsSent64.%bundle-id%.%offer-id%"/>
+        <param name="vertical-label" value="packets"/>
+      </leaf>
+  
+      <leaf name="64Byte_Down">
+        <param name="comment"      value="64 Byte packets"/>
+        <param name="graph-legend" value="64 byte"/>
+        <param name="precedence"   value="91"/>
+        <param name="rrd-ds"       value="Recv64"/>
+        <param name="snmp-object"
+              value="$boPacketsReceived64.%bundle-id%.%offer-id%"/>
+        <param name="vertical-label" value="packets"/>
+      </leaf>
+  
+      <leaf name="65Byte_to_127Byte_Up">
+        <param name="comment"      value="65 byte to 127 byte packets"/>
+        <param name="graph-legend" value="65 to 127 byte"/>
+        <param name="precedence"   value="82"/>
+        <param name="rrd-ds"       value="Sent65to127"/>
+        <param name="snmp-object"
+              value="$boPacketsSent65to127.%bundle-id%.%offer-id%"/>
+        <param name="vertical-label" value="packets"/>
+      </leaf>
+  
+      <leaf name="65Byte_to_127Byte_Down">
+        <param name="comment"      value="65 byte to 127 byte packets"/>
+        <param name="graph-legend" value="65 to 127 byte"/>
+        <param name="precedence"   value="81"/>
+        <param name="rrd-ds"       value="Recv65to127"/>
+        <param name="snmp-object"
+              value="$boPacketsReceived65to127.%bundle-id%.%offer-id%"/>
+        <param name="vertical-label" value="packets"/>
+      </leaf>
+  
+      <leaf name="128Byte_to_255Byte_Up">
+        <param name="comment"      value="128 byte to 255 byte packets"/>
+        <param name="graph-legend" value="128 to 255 byte"/>
+        <param name="precedence"   value="72"/>
+        <param name="rrd-ds"       value="Sent128to255"/>
+        <param name="snmp-object"
+              value="$boPacketsSent128to255.%bundle-id%.%offer-id%"/>
+        <param name="vertical-label" value="packets"/>
+      </leaf>
+  
+      <leaf name="128Byte_to_255Byte_Down">
+        <param name="comment"      value="128 byte to 255 byte packets"/>
+        <param name="graph-legend" value="128 to 255 byte"/>
+        <param name="precedence"   value="71"/>
+        <param name="rrd-ds"       value="Recv128to255"/>
+        <param name="snmp-object"
+              value="$boPacketsReceived128to255.%bundle-id%.%offer-id%"/>
+        <param name="vertical-label" value="packets"/>
+      </leaf>
+  
+      <leaf name="256Byte_to_511Byte_Up">
+        <param name="comment"      value="256 byte to 511 byte packets"/>
+        <param name="graph-legend" value="256 to 511 byte"/>
+        <param name="precedence"   value="62"/>
+        <param name="rrd-ds"       value="Sent256to511"/>
+        <param name="snmp-object"
+              value="$boPacketsSent256to511.%bundle-id%.%offer-id%"/>
+        <param name="vertical-label" value="packets"/>
+      </leaf>
+  
+      <leaf name="256Byte_to_511Byte_Down">
+        <param name="comment"      value="256 byte to 511 byte packets"/>
+        <param name="graph-legend" value="256 to 511 byte"/>
+        <param name="precedence"   value="61"/>
+        <param name="rrd-ds"       value="Recv256to511"/>
+        <param name="snmp-object"
+              value="$boPacketsReceived256to511.%bundle-id%.%offer-id%"/>
+        <param name="vertical-label" value="packets"/>
+      </leaf>
+  
+      <leaf name="512Byte_to_1023Byte_Up">
+        <param name="comment"      value="512 byte to 1023 byte packets"/>
+        <param name="graph-legend" value="512 to 1023 byte"/>
+        <param name="precedence"   value="52"/>
+        <param name="rrd-ds"       value="Sent512to1023"/>
+        <param name="snmp-object"
+              value="$boPacketsSent512to1023.%bundle-id%.%offer-id%"/>
+        <param name="vertical-label" value="packets"/>
+      </leaf>
+  
+      <leaf name="512Byte_to_1023Byte_Down">
+        <param name="comment"      value="512 byte to 1023 byte packets"/>
+        <param name="graph-legend" value="512 to 1023 byte"/>
+        <param name="precedence"   value="51"/>
+        <param name="rrd-ds"       value="Recv512to1023"/>
+        <param name="snmp-object"
+              value="$boPacketsReceived512to1023.%bundle-id%.%offer-id%"/>
+        <param name="vertical-label" value="packets"/>
+      </leaf>
+  
+      <leaf name="1024Byte_to_1518Byte_Up">
+        <param name="comment"      value="1024 byte to 1518 byte packets"/>
+        <param name="graph-legend" value="1024 to 1518 byte"/>
+        <param name="precedence"   value="42"/>
+        <param name="rrd-ds"       value="Sent1024to1518"/>
+        <param name="snmp-object"
+              value="$boPacketsSent1024to1518.%bundle-id%.%offer-id%"/>
+        <param name="vertical-label" value="packets"/>
+      </leaf>
+  
+      <leaf name="1024Byte_to_1518Byte_Down">
+        <param name="comment"      value="1024 byte to 1518 byte packets"/>
+        <param name="graph-legend" value="1024 to 1518 byte"/>
+        <param name="precedence"   value="41"/>
+        <param name="rrd-ds"       value="Recv1024to1518"/>
+        <param name="snmp-object"
+              value="$boPacketsReceived1024to1518.%bundle-id%.%offer-id%"/>
+        <param name="vertical-label" value="packets"/>
+      </leaf>
+  
+      <leaf name="1519Byte_and_higher_Up">
+        <param name="comment"      value="1519 byte higher byte packets"/>
+        <param name="graph-legend" value="1519 and higher byte"/>
+        <param name="precedence"   value="32"/>
+        <param name="rrd-ds"       value="Sent1519up"/>
+        <param name="snmp-object"
+              value="$boPacketsSent1519up.%bundle-id%.%offer-id%"/>
+        <param name="vertical-label" value="packets"/>
+      </leaf>
+  
+      <leaf name="1519Byte_and_higher_Down">
+        <param name="comment"      value="1519 byte higher byte packets"/>
+        <param name="graph-legend" value="1519 and higher byte"/>
+        <param name="precedence"   value="31"/>
+        <param name="rrd-ds"       value="Recv1519up"/>
+        <param name="snmp-object"
+              value="$boPacketsReceived1519up.%bundle-id%.%offer-id%"/>
+        <param name="vertical-label" value="packets"/>
+      </leaf>
+    </subtree>
+  </template>
+
+
+  <template name="arbor-flowlkup-subtree">
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="usage,max,curr"/>
+    <!-- Usage -->
+    <param name="overview-subleave-name-usage" value="Usage"/>
+    <param name="overview-shortcut-text-usage"
+          value="Flow Usage summary"/>
+    <param name="overview-shortcut-title-usage"
+          value="Show flow usage summary for all pools on one page"/>
+    <param name="overview-page-title-usage"
+          value="Flow usage"/>
+    <!-- Maximum -->
+    <param name="overview-subleave-name-max" value="Maximum"/>
+    <param name="overview-shortcut-text-max"
+          value="Max cap. of the flow pool summary"/>
+    <param name="overview-shortcut-title-max"
+          value="Show maximum capacity of the flow pools on one page"/>
+    <param name="overview-page-title-max"
+          value="Flow maximum usage"/>
+    <!-- Current -->
+    <param name="overview-subleave-name-curr" value="Current"/>
+    <param name="overview-shortcut-text-curr"
+          value="Curr cap. of the flow pool summary"/>
+    <param name="overview-shortcut-title-curr"
+          value="Show current capacity of the flow pools on one page"/>
+    <param name="overview-page-title-curr"
+          value="Flow current usage"/>
+  </template>
+
+
+  <template name="arbor-flowlkup-leaf">
+    <param name="comment"    value="FlowLookup device %flowdev-index%"/>
+    <param name="data-file"  value="%system-id%_flowlkup_%flowdev-index%.rrd"/>
+    <param name="graph-title"
+          value="FlowLkup device %flowdev-index%: %flowpool-name%"/>
+    <param name="graph-lower-limit" value="0"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+    <leaf name="Usage">
+      <param name="precedence"         value="1000"/>
+      <param name="comment"            value="Maximum vs Current"/>
+      <param name="graph-title"        value="Maximum vs Current"/>
+      <param name="vertical-label"     value="nodes"/>
+      <param name="ds-type"            value="rrd-multigraph"/>
+      <param name="ds-names"           value="total,used"/>
+      <param name="graph-lower-limit"  value="0"/>
+      <!-- Maximum Capacity -->
+      <param name="ds-expr-total"      value="{Maximum}"/>
+      <param name="graph-legend-total" value="Maximum"/>
+      <param name="line-style-total"   value="##totalresource"/>
+      <param name="line-color-total"   value="##totalresource"/>
+      <param name="line-order-total"   value="1"/>
+      <!-- Current Capacity -->
+      <param name="ds-expr-used"       value="{Current}"/>
+      <param name="graph-legend-used"  value="Current"/>
+      <param name="line-style-used"    value="##resourceusage"/>
+      <param name="line-color-used"    value="##resourceusage"/>
+      <param name="line-order-used"    value="2"/>
+    </leaf>
+
+    <leaf name="Maximum">
+      <param name="comment"      value="Maximum capacity of the pool"/>
+      <param name="graph-legend" value="nodes"/>
+      <param name="precedence"   value="902"/>
+      <param name="rrd-ds"       value="maxCapacity_%flowpool-index%"/>
+      <param name="snmp-object"
+            value="$flowPoolName.%flowdev-index%.1.1.3.%flowpool-index%"/>
+    </leaf>
+
+    <leaf name="Current">
+      <param name="comment"      value="Current capacity of the pool"/>
+      <param name="graph-legend" value="nodes"/>
+      <param name="precedence"   value="901"/>
+      <param name="rrd-ds"       value="currentCapacity_%flowpool-index%"/>
+      <param name="snmp-object"
+            value="$flowPoolName.%flowdev-index%.1.1.4.%flowpool-index%"/>
+    </leaf>
+  </template>
+
+
+</datasources>
+
+</configuration>
+
diff --git a/torrus/xmlconfig/vendor/ascend.max.xml b/torrus/xmlconfig/vendor/ascend.max.xml
new file mode 100644 (file)
index 0000000..d312bfa
--- /dev/null
@@ -0,0 +1,107 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003 Roman Hochuli, Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: ascend.max.xml,v 1.1 2010-12-27 00:04:06 ivan Exp $
+  Roman Hochuli <roman@hochu.li>
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+  Ascend MAC Call statistics.
+  Tested with Ascent MAX 4000 with Software-Release feik.m40 7.0.26
+-->
+
+<configuration>
+
+  <definitions>
+    <!-- ASCEND-ADVANCED-AGENT-MIB -->
+    <def name="ascend_wanLineActiveChannels"
+         value="1.3.6.1.4.1.529.4.21.1.7"  />
+    <!-- ASCEND-CALL-MIB -->
+    <def name="ascend_callCurrentDigitalIncoming"
+         value="1.3.6.1.4.1.529.11.7.0"  />
+    <def name="ascend_callCurrentAnalogIncoming"
+         value="1.3.6.1.4.1.529.11.5.0"  />
+  </definitions>
+
+  <datasources>
+
+    <template name="ascend-totalcalls">
+      <param name="comment"     value="Ascend Callstatistics" />
+      <param name="data-file"   value="%system-id%_callstats.rrd" />
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="rrd-hwpredict"       value="disabled" />
+
+      <leaf name="Total_Calls">
+        <param name="comment"
+               value="Current total number of calls" />
+        <param name="ds-type" value="rrd-multigraph"/>
+        <param name="ds-names" value="analog,digital"/>
+
+        <param name="ds-expr-analog"      value="{Total_Analog_Calls}"/>
+        <param name="graph-legend-analog" value="analog calls"/>
+        <param name="line-style-analog"   value="AREA"/>
+        <param name="line-color-analog"   value="##one"/>
+        <param name="line-order-analog"   value="1"/>
+
+        <param name="ds-expr-digital"      value="{Total_Digital_Calls}"/>
+        <param name="graph-legend-digital" value="digital calls"/>
+        <param name="line-style-digital"   value="STACK"/>
+        <param name="line-color-digital"   value="##two"/>
+        <param name="line-order-digital"   value="2"/>
+
+        <param name="vertical-label" value="Lines"/>
+        <param name="precedence"  value="1000" />
+        <param name="graph-lower-limit" value="0" />
+      </leaf>
+
+      <leaf name="Total_Analog_Calls">
+        <param name="hidden" value="yes"/>
+        <param name="comment"
+               value="Current current total number of analog calls" />
+        <param name="snmp-object" value="$ascend_callCurrentAnalogIncoming" />
+        <param name="rrd-ds"      value="CCAnalog" />
+        <param name="precedence"  value="200" />
+        <param name="graph-lower-limit" value="0" />
+      </leaf>
+
+      <leaf name="Total_Digital_Calls">
+        <param name="hidden" value="yes"/>
+        <param name="comment"
+               value="Current total number of ISDN calls" />
+        <param name="snmp-object" value="$ascend_callCurrentDigitalIncoming" />
+        <param name="rrd-ds"      value="CCISDN" />
+        <param name="precedence"  value="300" />
+        <param name="graph-lower-limit" value="0" />
+      </leaf>
+
+    </template>
+
+    <template name="ascend-line-stats">
+      <param name="comment" value="Current active calls in the trunk line"/>
+      <param name="snmp-object"
+             value="$ascend_wanLineActiveChannels.%ascend-ifidx%"/>
+      <param name="data-file"
+             value="%system-id%_linestats_%ascend-ifidx%.rrd" />
+      <param name="rrd-ds"              value="ActiveChannels" />
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="graph-lower-limit"   value="0" />
+      <param name="graph-legend"        value="Channels busy" />
+      <param name="vertical-label" value="Lines"/>
+  </template>
+
+  </datasources>
+</configuration>
diff --git a/torrus/xmlconfig/vendor/atmel.xml b/torrus/xmlconfig/vendor/atmel.xml
new file mode 100644 (file)
index 0000000..ec8d5bd
--- /dev/null
@@ -0,0 +1,686 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2004 Scott Brooks
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  Scott Brooks <sbrooks@binary-solutions.net>
+  Stanislav Sinyagin <ssinyagin@yahoo.com>: reorganised the structure
+  
+  Note:
+  For better discovery speed, use the  discovery parameter as follows:
+    <param name="only-devtypes" value="ATMEL"/>
+-->
+
+<configuration>
+
+  <definitions>
+    <def name="networkSettings"
+         value="1.3.6.1.4.1.410.1.2.8.1.0" />
+    <def name="associatedSTAsNum"
+         value="1.3.6.1.4.1.410.1.2.5.1.0" />
+    <def name="operChannelID"
+         value="1.3.6.1.4.1.410.1.2.1.1.0" />
+    <def name="operRTSThreshold"
+         value="1.3.6.1.4.1.410.1.2.1.4.0" />
+    <def name="operFragmentationThreshold"
+         value="1.3.6.1.4.1.410.1.2.1.5.0" />
+    <def name="wirelessStatistics"
+         value="1.3.6.1.4.1.410.1.2.3.1.0" />
+    <def name="ethernetRxStatistics"
+         value="1.3.6.1.4.1.410.1.1.7.1.0" />
+    <def name="ethernetTxStatistics"
+         value="1.3.6.1.4.1.410.1.1.7.2.0" />
+
+  </definitions>
+  <datasources>
+    
+    <template name="atmel-wireless-transform">
+      <param name="transform-value">
+      my @stats=unpack('VVVVVVVVVVVVVVVVVVVVVV',pack('H*',substr(DOLLAR_,2)));
+      return DOLLARstats[%atmel-stats-member%];
+      </param>
+    </template>
+    
+    <template name="atmel-eth-rx-transform">
+      <param name="transform-value">
+      my @stats=unpack('VVVVVVVVVVVVVVVV',pack('H*',substr(DOLLAR_,2)));
+      return DOLLARstats[%atmel-stats-member%];
+      </param>
+    </template>
+       
+    <template name="atmel-eth-tx-transform">
+      <param name="transform-value">
+      my @stats=unpack('VVVVVVVVVVVV',pack('H*',substr(DOLLAR_,2)));
+      return DOLLARstats[%atmel-stats-member%];
+      </param>
+    </template>
+    
+    <template name="atmel-network-transform">
+      <param name="transform-value">
+      my @stats=unpack('vH12vCCA2CA5A32C',pack('H*',substr(DOLLAR_,2)));
+      return DOLLARstats[%atmel-stats-member%];
+      </param>
+    </template>
+
+    <!-- for future implementation of devices overview -->
+    <template name="atmel-devlist-subtree">
+      <param name="comment" value="Link stats and Network Stats"/>
+      
+      <param name="has-overview-shortcuts" value="yes"/>
+      <param name="overview-shortcuts" value="lstat"/>
+      <param name="overview-subleave-name-lstat" value="linkStats" />
+      <param name="overview-shortcut-text-lstat"
+             value="All Link Stats" />
+      <param name="overview-shortcut-title-lstat"
+             value="Show all devices Link Quality on one page" />
+      <param name="overview-page-title-lstat"
+             value="Link Stats" />
+    </template>
+
+    
+    <template name="atmel-client-stats">
+      <leaf name="Wireless_Quality">
+        <param name="comment">
+        Wireless link quality and Received Signal Strength Indicator
+        </param>
+        <param name="ds-type" value="rrd-multigraph" />
+        <param name="ds-names" value="rssi,lq" />
+
+        <param name="ds-expr-rssi"
+                    value="{RSSI},40,GE,40,{RSSI},IF,40,/,100,*" />
+        <param name="graph-legend-rssi" value="RSSI" />
+        <param name="line-style-rssi" value="LINE2" />
+        <param name="line-color-rssi" value="#00FF00" />
+        <param name="line-order-rssi" value="1" />
+
+        <param name="ds-expr-lq"
+           value="40,{LinkQuality},40,GE,40,{LinkQuality},IF,-,40,/,100,*" />
+        <param name="graph-legend-lq" value="Link Quality" />
+        <param name="line-style-lq" value="LINE2" />
+        <param name="line-color-lq" value="#0000FF" />
+        <param name="line-order-lq" value="2" />
+      </leaf>
+      
+      <leaf name="RSSI">
+        <param name="comment" 
+               value="Recieve Signal Strength Indicator" />
+        <param name="snmp-object" value="$networkSettings" />
+        <param name="rrd-ds" value="rssi" />
+        <param name="rrd-create-dstype" value="GAUGE" />
+        <param name="graph-legend" value="RSSI" />
+        <param name="atmel-stats-member" value="3" />
+        <apply-template name="atmel-network-transform" />
+        <param name="hidden" value="yes" />
+      </leaf>
+      
+      <leaf name="LinkQuality">
+        <param name="comment"  value="Wireless Link Quality" />
+        <param name="snmp-object" value="$networkSettings" />
+        <param name="rrd-ds" value="lq" />
+        <param name="rrd-create-dstype" value="GAUGE" />
+        <param name="graph-legend" value="Link Quality" />
+        <param name="atmel-stats-member" value="6" />
+        <apply-template name="atmel-network-transform" />
+        <param name="hidden" value="yes" />
+      </leaf>
+    </template>
+
+    <template name="atmel-accesspoint-stats">
+      <leaf name="Associated_Stations">
+        <param name="comment"  value="Number of associated stations" />
+        <param name="snmp-object" value="$associatedSTAsNum" />
+        <param name="rrd-ds" value="assoc" />
+        <param name="rrd-create-dstype" value="GAUGE" />
+        <param name="graph-legend" value="Client stations" />
+      </leaf>
+    </template>
+
+    <template name="atmel-device-subtree">
+      <param name="data-file" value="%snmp-host%_connection.rrd" />
+
+      <!-- #############  WIRELESS  ################ -->
+      <subtree name="Wireless_Stats">
+        <param name="comment"  value="Wireless interface statistics" />
+
+        <!-- #####  TRANSMIT STATS ##### -->        
+        <leaf name="txStats">
+          <param name="comment" value="TX Stats" />
+          <param name="ds-type" value="rrd-multigraph" />
+          <param name="ds-names">
+            uniTxPackets,broadcastTxPackets,multicastTxPackets,
+            txBeacon,txACK,txRTS,txCTS
+          </param>
+          <param name="ds-expr-uniTxPackets" value="{uniTxPackets}" />
+          <param name="graph-legend-uniTxPackets" value="Unicast TX" />
+          <param name="line-color-uniTxPackets" value="##one" />
+          <param name="line-order-uniTxPackets" value="1" />
+          <param name="line-style-uniTxPackets" value="LINE2" />
+
+          <param name="ds-expr-broadcastTxPackets"
+                                  value="{broadcastTxPackets}" />
+          <param name="graph-legend-broadcastTxPackets" value="Broadcast TX" />
+          <param name="line-color-broadcastTxPackets" value="##two" />
+          <param name="line-order-broadcastTxPackets" value="2" />
+          <param name="line-style-broadcastTxPackets" value="LINE2" />
+
+          <param name="ds-expr-multicastTxPackets"
+                                value="{multicastTxPackets}" />
+          <param name="graph-legend-multicastTxPackets" value="Multicast TX" />
+          <param name="line-color-multicastTxPackets" value="##three" />
+          <param name="line-order-multicastTxPackets" value="3" />
+          <param name="line-style-multicastTxPackets" value="LINE2" />
+
+          <param name="ds-expr-txBeacon" value="{txBeacon}" />
+          <param name="graph-legend-txBeacon" value="TX Beacons" />
+          <param name="line-color-txBeacon" value="##four" />
+          <param name="line-order-txBeacon" value="4" />
+          <param name="line-style-txBeacon" value="LINE2" />
+
+          <param name="ds-expr-txACK" value="{txACK}" />
+          <param name="graph-legend-txACK" value="TX Acks" />
+          <param name="line-color-txACK" value="##five" />
+          <param name="line-order-txACK" value="5" />
+          <param name="line-style-txACK" value="LINE2" />
+
+          <param name="ds-expr-txRTS" value="{txRTS}" />
+          <param name="graph-legend-txRTS" value="TX RTS" />
+          <param name="line-color-txRTS" value="##six" />
+          <param name="line-order-txRTS" value="6" />
+          <param name="line-style-txRTS" value="LINE2" />
+
+          <param name="ds-expr-txCTS" value="{txCTS}" />
+          <param name="graph-legend-txCTS" value="TX CTS" />
+          <param name="line-color-txCTS" value="##seven" />
+          <param name="line-order-txCTS" value="7" />
+          <param name="line-style-txCTS" value="LINE2" />
+        </leaf>
+
+        <leaf name="uniTxPackets">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="uniTxPackets" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Unicast TX Packets" />
+          <param name="atmel-stats-member" value="0" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+      
+        <leaf name="broadcastTxPackets">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="broadTxPackets" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Broadcast TX Packets" />
+          <param name="atmel-stats-member" value="1" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+      
+        <leaf name="multicastTxPackets">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="multiTxPackets" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Multicast TX Packets" />
+          <param name="atmel-stats-member" value="2" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+      
+        <leaf name="txBeacon">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="txBeacon" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Transmitted Beacons" />
+          <param name="atmel-stats-member" value="3" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+      
+        <leaf name="txACK">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="txACK" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Transmitted ACKs" />
+          <param name="atmel-stats-member" value="4" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+      
+        <leaf name="txRTS">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="txRTS" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Transmitted RTS" />
+          <param name="atmel-stats-member" value="5" />
+          <apply-template name="atmel-wireless-transform" />     
+          <param name="hidden" value="yes" />
+        </leaf>
+      
+        <leaf name="txCTS">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="txCTS" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Transmitted CTS" />
+          <param name="atmel-stats-member" value="6" />
+          <apply-template name="atmel-wireless-transform" />        
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <!-- #####  RECEIVE STATS ##### -->        
+        <leaf name="rxStats">
+          <param name="comment" value="RX Stats" />
+          <param name="ds-type" value="rrd-multigraph" />
+          <param name="ds-names">
+          uniRxPackets,broadcastRxPackets,multicastRxPackets,rxBeacon,
+          rxACK,rxRTS,rxCTS
+          </param>
+
+          <param name="ds-expr-uniRxPackets" value="{uniRxPackets}" />
+          <param name="graph-legend-uniRxPackets" value="Unicast RX" />
+          <param name="line-color-uniRxPackets" value="##one" />
+          <param name="line-order-uniRxPackets" value="1" />
+          <param name="line-style-uniRxPackets" value="LINE2" />
+
+          <param name="ds-expr-broadcastRxPackets"
+                                     value="{broadcastRxPackets}" />
+          <param name="graph-legend-broadcastRxPackets" value="Broadcast RX" />
+          <param name="line-color-broadcastRxPackets" value="##two" />
+          <param name="line-order-broadcastRxPackets" value="2" />
+          <param name="line-style-broadcastRxPackets" value="LINE2" />
+
+          <param name="ds-expr-multicastRxPackets"
+                                     value="{multicastRxPackets}" />
+          <param name="graph-legend-multicastRxPackets" value="Multicast RX" />
+          <param name="line-color-multicastRxPackets" value="##three" />
+          <param name="line-order-multicastRxPackets" value="3" />
+          <param name="line-style-multicastRxPackets" value="LINE2" />
+
+          <param name="ds-expr-rxBeacon" value="{rxBeacon}" />
+          <param name="graph-legend-rxBeacon" value="RX Beacons" />
+          <param name="line-color-rxBeacon" value="##four" />
+          <param name="line-order-rxBeacon" value="4" />
+          <param name="line-style-rxBeacon" value="LINE2" />
+
+          <param name="ds-expr-rxACK" value="{rxACK}" />
+          <param name="graph-legend-rxACK" value="RX Acks" />
+          <param name="line-color-rxACK" value="##five" />
+          <param name="line-order-rxACK" value="5" />
+          <param name="line-style-rxACK" value="LINE2" />
+
+          <param name="ds-expr-rxRTS" value="{rxRTS}" />
+          <param name="graph-legend-rxRTS" value="RX RTS" />
+          <param name="line-color-rxRTS" value="##six" />
+          <param name="line-order-rxRTS" value="6" />
+          <param name="line-style-rxRTS" value="LINE2" />
+
+          <param name="ds-expr-rxCTS" value="{rxCTS}" />
+          <param name="graph-legend-rxCTS" value="RX CTS" />
+          <param name="line-color-rxCTS" value="##seven" />
+          <param name="line-order-rxCTS" value="7" />
+          <param name="line-style-rxCTS" value="LINE2" />
+        </leaf>
+        
+        <leaf name="uniRxPackets">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="uniRxPackets" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Unicast RX Packets" />
+          <param name="atmel-stats-member" value="7" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="broadcastRxPackets">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="broadRxPackets" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Broadcast RX Packets" />
+          <param name="atmel-stats-member" value="8" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="multicastRxPackets">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="multiRxPackets" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Multicast RX Packets" />
+          <param name="atmel-stats-member" value="9" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="rxBeacon">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="rxBeacon" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Received Beacons" />
+          <param name="atmel-stats-member" value="10" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="rxACK">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="rxACK" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Received ACKs" />
+          <param name="atmel-stats-member" value="11" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="rxRTS">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="rxRTS" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Received RTS" />
+          <param name="atmel-stats-member" value="12" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="rxCTS">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="rxCTS" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Received CTS" />
+          <param name="atmel-stats-member" value="13" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+
+        <!-- #####  RECEIVE STATS ##### -->              
+        <leaf name="errorStats">
+          <param name="comment" value="Error Stats" />
+          <param name="ds-type" value="rrd-multigraph" />
+          <param name="ds-names">
+          ackFailure,ctsFailure,retryPackets,receivedDups,failedPackets,
+          agedPackets,fcsError,invalidPLCP
+          </param>
+
+          <param name="ds-expr-ackFailure" value="{ackFailure}" />
+          <param name="graph-legend-ackFailure" value="Failed ACK" />
+          <param name="line-color-ackFailure" value="##one" />
+          <param name="line-order-ackFailure" value="1" />
+          <param name="line-style-ackFailure" value="LINE2" />
+
+          <param name="ds-expr-ctsFailure" value="{ctsFailure}" />
+          <param name="graph-legend-ctsFailure" value="Failed CTS" />
+          <param name="line-color-ctsFailure" value="##two" />
+          <param name="line-order-ctsFailure" value="2" />
+          <param name="line-style-ctsFailure" value="LINE2" />
+
+          <param name="ds-expr-retryPackets" value="{retryPackets}" />
+          <param name="graph-legend-retryPackets" value="Retry Packets" />
+          <param name="line-color-retryPackets" value="##three" />
+          <param name="line-order-retryPackets" value="3" />
+          <param name="line-style-retryPackets" value="LINE2" />
+
+          <param name="ds-expr-receivedDups" value="{receivedDups}" />
+          <param name="graph-legend-receivedDups" value="Received Dups" />
+          <param name="line-color-receivedDups" value="##four" />
+          <param name="line-order-receivedDups" value="four" />
+          <param name="line-style-receivedDups" value="LINE2" />
+
+          <param name="ds-expr-failedPackets" value="{failedPackets}" />
+          <param name="graph-legend-failedPackets" value="Failed Packets" />
+          <param name="line-color-failedPackets" value="##five" />
+          <param name="line-order-failedPackets" value="5" />
+          <param name="line-style-failedPackets" value="LINE2" />
+
+          <param name="ds-expr-agedPackets" value="{agedPackets}" />
+          <param name="graph-legend-agedPackets" value="Aged Packets" />
+          <param name="line-color-agedPackets" value="##six" />
+          <param name="line-order-agedPackets" value="6" />
+          <param name="line-style-agedPackets" value="LINE2" />
+
+          <param name="ds-expr-fcsError" value="{fcsError}" />
+          <param name="graph-legend-fcsError" value="FCS Error" />
+          <param name="line-color-fcsError" value="##seven" />
+          <param name="line-order-fcsError" value="7" />
+          <param name="line-style-fcsError" value="LINE2" />
+
+          <param name="ds-expr-invalidPLCP" value="{invalidPLCP}" />
+          <param name="graph-legend-invalidPLCP" value="Invalid PLCP" />
+          <param name="line-color-invalidPLCP" value="##eight" />
+          <param name="line-order-invalidPLCP" value="8" />
+          <param name="line-style-invalidPLCP" value="LINE2" />
+        </leaf>
+        
+        <leaf name="ackFailure">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="ackFailure" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Failed ACKs" />
+          <param name="atmel-stats-member" value="14" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="ctsFailure">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="ctsFailure" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Failed CTS" />
+          <param name="atmel-stats-member" value="15" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="retryPackets">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="retryPackets" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Retry Packets" />
+          <param name="atmel-stats-member" value="16" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="receivedDups">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="receivedDups" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Received Duplicates" />
+          <param name="atmel-stats-member" value="17" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="failedPackets">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="failedPackets" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Failed Packets" />
+          <param name="atmel-stats-member" value="18" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="agedPackets">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="agedPackets" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Aged Packets" />
+          <param name="atmel-stats-member" value="19" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="fcsError">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="fcsError" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="FCS Error" />
+          <param name="atmel-stats-member" value="20" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="invalidPLCP">
+          <param name="snmp-object" value="$wirelessStatistics" />
+          <param name="rrd-ds" value="invalidPLCP" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="Invalid PLCP" />
+          <param name="atmel-stats-member" value="21" />
+          <apply-template name="atmel-wireless-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+      </subtree>
+      
+      <!-- #############  ETHERNET  ################ -->
+      <subtree name="Ethernet_Stats">
+        <param name="comment"  value="Ethernet interface statistics" />
+    
+        <leaf name="RX_Stats">
+          <param name="comment" value="Ethernet TX Stats" />
+          <param name="ds-type" value="rrd-multigraph" />
+          <param name="ds-names" value="eRxBytes,eRxPackets,eRxCRC" />
+
+          <param name="ds-expr-eRxBytes" value="{eRxBytes}" />
+          <param name="graph-legend-eRxBytes" value="RX Bytes" />
+          <param name="line-color-eRxBytes" value="##one" />
+          <param name="line-order-eRxBytes" value="1" />
+          <param name="line-style-eRxBytes" value="LINE2" />
+
+          <param name="ds-expr-eRxPackets" value="{eRxPackets}" />
+          <param name="graph-legend-eRxPackets" value="RX Packets" />
+          <param name="line-color-eRxPackets" value="##two" />
+          <param name="line-order-eRxPackets" value="2" />
+          <param name="line-style-eRxPackets" value="LINE2" />
+
+          <param name="ds-expr-eRxCRC" value="{eRxCRC}" />
+          <param name="graph-legend-eRxCRC" value="RX CRC" />
+          <param name="line-color-eRxCRC" value="##three" />
+          <param name="line-order-eRxCRC" value="3" />
+          <param name="line-style-eRxCRC" value="LINE2" />
+        </leaf>
+        
+        <leaf name="eRxBytes">
+          <param name="snmp-object" value="$ethernetRxStatistics" />
+          <param name="rrd-ds" value="eRxTotalBytes" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="RX Bytes" />
+          <param name="atmel-stats-member" value="0" />
+          <apply-template name="atmel-eth-rx-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="eRxPackets">
+          <param name="snmp-object" value="$ethernetRxStatistics" />
+          <param name="rrd-ds" value="eRxTotalPackets" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="RX Packets" />
+          <param name="atmel-stats-member" value="1" />
+          <apply-template name="atmel-eth-rx-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="eRxCRC">
+          <param name="snmp-object" value="$ethernetRxStatistics" />
+          <param name="rrd-ds" value="eRxCRC" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="RX CRC" />
+          <param name="atmel-stats-member" value="2" />
+          <apply-template name="atmel-eth-rx-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="TX_Stats">
+          <param name="comment" value="Ethernet TX Stats" />
+          <param name="ds-type" value="rrd-multigraph" />
+          <param name="ds-names" value="eTxBytes,eTxPackets,eTxCRC" />
+
+          <param name="ds-expr-eTxBytes" value="{eTxBytes}" />
+          <param name="graph-legend-eTxBytes" value="TX Bytes" />
+          <param name="line-color-eTxBytes" value="##one" />
+          <param name="line-order-eTxBytes" value="1" />
+          <param name="line-style-eTxBytes" value="LINE2" />
+
+          <param name="ds-expr-eTxPackets" value="{eTxPackets}" />
+          <param name="graph-legend-eTxPackets" value="TX Packets" />
+          <param name="line-color-eTxPackets" value="##two" />
+          <param name="line-order-eTxPackets" value="2" />
+          <param name="line-style-eTxPackets" value="LINE2" />
+
+          <param name="ds-expr-eTxCRC" value="{eTxCRC}" />
+          <param name="graph-legend-eTxCRC" value="TX CRC" />
+          <param name="line-color-eTxCRC" value="##three" />
+          <param name="line-order-eTxCRC" value="3" />
+          <param name="line-style-eTxCRC" value="LINE2" />
+        </leaf>
+        
+        <leaf name="eTxBytes">
+          <param name="snmp-object" value="$ethernetTxStatistics" />
+          <param name="rrd-ds" value="eTxTotalBytes" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="TX Bytes" />
+          <param name="atmel-stats-member" value="0" />
+          <apply-template name="atmel-eth-tx-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="eTxPackets">
+          <param name="snmp-object" value="$ethernetTxStatistics" />
+          <param name="rrd-ds" value="eTxTotalPackets" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="TX Packets" />
+          <param name="atmel-stats-member" value="1" />
+          <apply-template name="atmel-eth-tx-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+        
+        <leaf name="eTxCRC">
+          <param name="snmp-object" value="$ethernetTxStatistics" />
+          <param name="rrd-ds" value="eTxCRC" />
+          <param name="rrd-create-dstype" value="COUNTER" />
+          <param name="graph-legend" value="TX CRC" />
+          <param name="atmel-stats-member" value="2" />
+          <apply-template name="atmel-eth-tx-transform" />
+          <param name="hidden" value="yes" />
+        </leaf>
+      </subtree>
+
+      <!-- #############  CONFIGURATION  ################ -->      
+      <subtree name="Wireless_Configuration">
+
+        <leaf name="channelId">
+          <param name="comment" value="Channel ID" />
+          <param name="snmp-object" value="$operChannelID" />
+          <param name="rrd-ds" value="chid" />
+          <param name="rrd-create-dstype" value="GAUGE" />
+          <param name="graph-legend" value="Ch ID" />
+        </leaf>
+        
+        <leaf name="RTSThreshold">
+          <param name="comment" value="Request to Send Threshold" />
+          <param name="snmp-object" value="$operRTSThreshold" />
+          <param name="rrd-ds" value="rts" />
+          <param name="rrd-create-dstype" value="GAUGE" />
+          <param name="graph-legend" value="RTS" />
+        </leaf>
+        
+        <leaf name="fragThreshold">
+          <param name="comment" value="Fragmentation Threshold" />
+          <param name="snmp-object" value="$operFragmentationThreshold" />
+          <param name="rrd-ds" value="frag" />
+          <param name="rrd-create-dstype" value="GAUGE" />
+          <param name="graph-legend" value="Frag" />
+        </leaf>
+      </subtree>  
+    </template>
+  </datasources>
+</configuration>
diff --git a/torrus/xmlconfig/vendor/betternetworks.xml b/torrus/xmlconfig/vendor/betternetworks.xml
new file mode 100644 (file)
index 0000000..9faa55b
--- /dev/null
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright (C) 2003 Marc Haber, Shawn Ferry, Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+   Marc Haber <mh+rrfw-devel@zugschlus.de>
+
+  Authors: Marc Haber, Shawn Ferry, Stanislav Sinyagin
+  Vendor: betternetworks.xml
+
+  $Id: betternetworks.xml,v 1.1 2010-12-27 00:04:06 ivan Exp $
+-->
+<!--
+    Generic MIB definitions and templates for:
+
+        The templates defined in this file should work with
+        the BetterNetworks ethernet box
+    -->
+<configuration>
+  <definitions>
+    <def name="BNEBsensorValueInt10" value="1.3.6.1.4.1.14848.2.1.2.1.5"/>
+  </definitions>
+
+  <datasources>
+
+    <template name="betternetworks-sensor">
+      <param name="collector-timeoffset-hashstring"
+               value="%system-id%:%bne-sensor-index%" />
+      <param name="data-file"
+               value="%system-id%_sensor_%bne-sensor-index%.rrd"/>
+      <param name="snmp-object"
+               value="$BNEBsensorValueInt10.%bne-sensor-index%"/>
+      <param name="collector-scale"   value="10,/" />
+      <param name="rrd-ds"            value="value"/>
+      <param name="rrd-cf"            value="AVERAGE"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="graph-lower-limit" value="0" />
+      <param name="graph-upper-limit" value="100" />
+      <param name="nodeid"
+               value="sensor//%nodeid-device%//%bne-sensor-index%"/>
+    </template>
+  </datasources>
+</configuration>
diff --git a/torrus/xmlconfig/vendor/casa-cmts.xml b/torrus/xmlconfig/vendor/casa-cmts.xml
new file mode 100644 (file)
index 0000000..4979da0
--- /dev/null
@@ -0,0 +1,198 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2010  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: casa-cmts.xml,v 1.1 2010-12-27 00:04:17 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+ DOCSIS interface, CASA Systems specific
+  
+-->
+
+<configuration>
+
+<definitions>
+  <!--  CASA-DOCS-EXT-MIB::casaCmtsMacExtTable -->
+  <def name="casaCmtsCmTotal"      value="1.3.6.1.4.1.20858.10.22.2.2.1.4"/>
+  <def name="casaCmtsCmActive"     value="1.3.6.1.4.1.20858.10.22.2.2.1.5"/>
+  <def name="casaCmtsCmRegistered" value="1.3.6.1.4.1.20858.10.22.2.2.1.6"/>
+  
+  <!--  CASA-CABLE-CMCPE-MIB::casaCmtsUSModemTable -->
+  <def name="casaCmtsUSActiveModemCount"
+        value="1.3.6.1.4.1.20858.10.12.1.1.1.1"/>
+  <def name="casaCmtsUSRegisteredModemCount"
+        value="1.3.6.1.4.1.20858.10.12.1.1.1.2"/>
+  <def name="casaCmtsUSTotalModemCount"
+        value="1.3.6.1.4.1.20858.10.12.1.1.1.3"/>
+
+  <!--  CASA-CABLE-CMCPE-MIB::casaCmtsDSModemTable -->
+  <def name="casaCmtsDSActiveModemCount"
+        value="1.3.6.1.4.1.20858.10.12.1.2.1.1"/>
+  <def name="casaCmtsDSRegisteredModemCount"
+        value="1.3.6.1.4.1.20858.10.12.1.2.1.2"/>
+  <def name="casaCmtsDSTotalModemCount"
+        value="1.3.6.1.4.1.20858.10.12.1.2.1.3"/>
+  
+        
+</definitions>
+
+<datasources>
+
+  <template name="casa-docsis-mac-subtree">
+    <param name="precedence"           value="-500" />
+    <param name="comment"        value="DOCSIS MAC layer utilization" />
+    <param name="data-file">
+       %system-id%_%interface-nick%_casa_mac.rrd
+    </param>
+    <param name="collector-timeoffset-hashstring"
+                                       value="%system-id%:%interface-nick%" />
+    <param name="descriptive-nickname" value="%system-id%:%interface-name%"/>
+    <param name="graph-title"          value="%descriptive-nickname%" />
+
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="modems"/>
+    <param name="overview-subleave-name-modems" value="Modems"/>
+    <param name="overview-direct-link-modems"      value="yes"/>
+    <param name="overview-direct-link-view-modems" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-modems"
+           value="All modems"/>
+    <param name="overview-shortcut-title-modems"
+           value="Show modem quantities in one page"/>
+    <param name="overview-page-title-modems"
+           value="Modem quantities"/>
+           
+    <param name="rrd-hwpredict"     value="disabled" />
+    
+    <!-- nodeid-docsif is overwritten by devdiscover at the
+         interface level. This definition is here for backward compatibility
+         with older discovery results or for systems which do not use
+         devdiscover -->
+    <param name="nodeid-docsif"
+      value="docs//%nodeid-device%//%interface-nick%//"/>
+  </template>
+
+  <template name="casa-docsis-modem-quantity">
+    <leaf name="Modems">
+      <param name="ds-type"           value="rrd-multigraph" />
+      <param name="ds-names"          value="total,active,registered" />
+      <param name="nodeid"            value="%nodeid-docsif%//modems"/>
+
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="950" />
+      <param name="comment"
+              value="Active and Total modems on the interface" />
+      <param name="vertical-label"    value="Modems" />
+
+      <param name="ds-expr-total">{Modems_Total}</param>
+      <param name="graph-legend-total"  value="Total" />
+      <param name="line-style-total"      value="##totalresource" />
+      <param name="line-color-total"      value="##totalresource" />
+      <param name="line-order-total"      value="1" />
+
+      <param name="ds-expr-active">{Modems_Active}</param>
+      <param name="graph-legend-active"  value="Active" />
+      <param name="line-style-active"    value="##resourcepartusage" />
+      <param name="line-color-active"    value="##resourcepartusage" />
+      <param name="line-order-active"    value="2" />
+      
+      <param name="ds-expr-registered">{Modems_Registered}</param>
+      <param name="graph-legend-registered"  value="Registered" />
+      <param name="line-style-registered"    value="##resourceusage" />
+      <param name="line-color-registered"    value="##resourceusage" />
+      <param name="line-order-registered"    value="3" />
+    </leaf>
+
+    <leaf name="Modems_Total">
+      <param name="snmp-object"
+                value="%casa-docsis-cmtotal%.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Total" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="Total number of modems on the interface since boot"/>
+      <param name="graph-legend" value="Total modems" />
+      <param name="precedence"   value="900" />
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="vertical-label"      value="Modems" />
+      <param name="graph-lower-limit"   value="0" />
+    </leaf>
+    
+    <leaf name="Modems_Active">
+      <param name="snmp-object"
+                value="%casa-docsis-cmactive%.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Active" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="Number of active modems on the interface"/>
+      <param name="graph-legend" value="Active modems" />
+      <param name="precedence"   value="800" />
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="vertical-label"      value="Modems" />
+      <param name="graph-lower-limit"   value="0" />
+      <param name="monitor-action-target"  value="Modems"/>
+    </leaf>
+    
+    <leaf name="Modems_Registered">
+      <param name="snmp-object"
+                value="%casa-docsis-cmregistered%.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Registered" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="Number of registered modems on the interface"/>
+      <param name="graph-legend" value="Registered modems" />
+      <param name="precedence"   value="700" />
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="vertical-label"      value="Modems" />
+      <param name="graph-lower-limit"   value="0" />
+      <param name="monitor-action-target"  value="Modems"/>
+    </leaf>
+
+  </template>
+
+  
+  <template name="casa-docsis-mac-util">
+    <apply-template name="casa-docsis-modem-quantity"/>
+    <param name="casa-docsis-cmtotal" value="$casaCmtsCmTotal"/>
+    <param name="casa-docsis-cmactive" value="$casaCmtsCmActive"/>
+    <param name="casa-docsis-cmregistered" value="$casaCmtsCmRegistered"/>
+  </template>
+
+  
+  <template name="casa-docsis-upstream-util">
+    <apply-template name="casa-docsis-modem-quantity"/>
+    <param name="casa-docsis-cmtotal"
+             value="$casaCmtsUSTotalModemCount"/>
+    <param name="casa-docsis-cmactive"
+             value="$casaCmtsUSActiveModemCount"/>
+    <param name="casa-docsis-cmregistered"
+             value="$casaCmtsUSRegisteredModemCount"/>
+  </template>
+
+  <template name="casa-docsis-downstream-util">
+    <apply-template name="casa-docsis-modem-quantity"/>
+    <param name="casa-docsis-cmtotal"
+             value="$casaCmtsDSTotalModemCount"/>
+    <param name="casa-docsis-cmactive"
+             value="$casaCmtsDSActiveModemCount"/>
+    <param name="casa-docsis-cmregistered"
+             value="$casaCmtsDSRegisteredModemCount"/>
+  </template>
+
+    
+</datasources>
+
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/cisco.firewall.xml b/torrus/xmlconfig/vendor/cisco.firewall.xml
new file mode 100644 (file)
index 0000000..19d85e1
--- /dev/null
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003 Shawn Ferry
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: cisco.firewall.xml,v 1.1 2010-12-27 00:04:17 ivan Exp $
+  Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+
+-->
+
+<!-- Cisco Firewall specific definitions -->
+
+<configuration>
+
+<definitions>
+
+  <!-- v1/OLD-CISCO-INTERFACES-MIB:lifTable -->
+  <def name="cfwBasicEventsTableLastRow"
+       value="1.3.6.1.4.1.9.9.147.1.1.4" />
+  <def name="cfwConnectionStatValue"
+       value="1.3.6.1.4.1.9.9.147.1.2.2.2.1.5" />
+
+</definitions>
+
+<datasources>
+
+  <template name="cisco-firewall-subtree">
+    <param name="rrd-hwpredict" value="disabled" />
+  </template>
+  
+  <template name="cisco-firewall-connections">
+    <leaf name="MaxConnections">
+      <param name="comment">
+        The highest number of connections in use at any one time since
+        system startup
+      </param>
+      <param name="vertical-label" value="Connection Count"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_maxcons.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$cfwConnectionStatValue.40.7"/>
+      <param name="rrd-ds" value="MaxCons"/>
+      <param name="graph-legend" value="Max Connections"/>
+    </leaf>
+    <leaf name="CurrConnections">
+      <param name="comment">
+        The number of connections currently in use.
+      </param>
+      <param name="vertical-label" value="Connection Count"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_currcons.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$cfwConnectionStatValue.40.6"/>
+      <param name="rrd-ds" value="CurrCons"/>
+      <param name="graph-legend" value="Current Connections"/>
+    </leaf>
+  </template>
+
+  <template name="cisco-firewall-events-delta">
+    <leaf name="EventCount">
+    <param name="comment">
+        Number of entries in the event table. (Proxy for load) (experimental)
+    </param>
+    <param name="precedence"   value="-400" />
+    <param name="snmp-object" value="$cfwBasicEventsTableLastRow" />
+      <param name="rrd-ds"            value="LastRow" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="data-file"
+             value="%system-id%_fw_lastrow.rrd" />
+      <param name="graph-legend"      value="Row Count" />
+      <param name="vertical-label"    value="Count" />
+      <param name="graph-lower-limit" value="0"/>
+    </leaf>
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/cisco.generic.xml b/torrus/xmlconfig/vendor/cisco.generic.xml
new file mode 100644 (file)
index 0000000..d07da1d
--- /dev/null
@@ -0,0 +1,336 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: cisco.generic.xml,v 1.1 2010-12-27 00:04:21 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!-- Common Cisco definitions -->
+
+<configuration>
+
+<definitions>
+
+  <!-- CISCO-PROCESS-MIB:cpmCPUTotalTable -->
+  <def name="cpmCPUTotalPhysicalIndex" value="1.3.6.1.4.1.9.9.109.1.1.1.1.2" />
+  <def name="cpmCPUTotal1min"          value="1.3.6.1.4.1.9.9.109.1.1.1.1.4" />
+  <def name="cpmCPUTotal5min"          value="1.3.6.1.4.1.9.9.109.1.1.1.1.5" />
+  <def name="cpmCPUTotal1minRev"       value="1.3.6.1.4.1.9.9.109.1.1.1.1.7" />
+  <def name="cpmCPUTotal5minRev"       value="1.3.6.1.4.1.9.9.109.1.1.1.1.8" />
+
+  <def name="CISCO_CPU_IDX"
+       value="M($cpmCPUTotalPhysicalIndex, %entity-phy-index%)" />
+
+  <!-- OLD-CISCO-CPU-MIB -->
+  <def name="avgBusy1" value="1.3.6.1.4.1.9.2.1.57.0" />
+  <def name="avgBusy5" value="1.3.6.1.4.1.9.2.1.58.0" />
+
+  <!-- CISCO-ENHANCED-MEMPOOL-MIB:cempMemPoolTable -->
+  <def name="cempMemPoolUsed"        value="1.3.6.1.4.1.9.9.221.1.1.1.1.7" />
+  <def name="cempMemPoolFree"        value="1.3.6.1.4.1.9.9.221.1.1.1.1.8" />
+  <def name="cempMemPoolLargestFree" value="1.3.6.1.4.1.9.9.221.1.1.1.1.9" />
+  
+  <!-- CISCO-MEMORY-POOL-MIB:ciscoMemoryPoolTable -->
+  <def name="ciscoMemoryPoolUsed"        value="1.3.6.1.4.1.9.9.48.1.1.1.5" />
+  <def name="ciscoMemoryPoolFree"        value="1.3.6.1.4.1.9.9.48.1.1.1.6" />
+  <def name="ciscoMemoryPoolLargestFree" value="1.3.6.1.4.1.9.9.48.1.1.1.7" />
+
+  <!-- CISCO-ENVMON-MIB:ciscoEnvMonTemperatureStatusTable -->
+  <def name="ciscoEnvMonTemperatureStatusIndex"
+                          value="1.3.6.1.4.1.9.9.13.1.3.1.1" />
+  <def name="ciscoEnvMonTemperatureStatusDescr"
+                          value="1.3.6.1.4.1.9.9.13.1.3.1.2" />
+  <def name="ciscoEnvMonTemperatureStatusValue"
+                          value="1.3.6.1.4.1.9.9.13.1.3.1.3" />
+  <def name="ciscoEnvMonTemperatureStatusState"
+                          value="1.3.6.1.4.1.9.9.13.1.3.1.6" />
+  <def name="ciscoEnvMonSupplyState"
+                          value="1.3.6.1.4.1.9.9.13.1.5.1.3" />
+</definitions>
+
+<datasources>
+
+  <template name="cisco-memusage-subtree">
+    <param name="vertical-label" value="Bytes"/>
+    <param name="rrd-create-dstype" value="GAUGE" />
+    <param name="rrd-hwpredict" value="disabled" />
+    <param name="graph-lower-limit" value="0" />
+
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="memuse"/>
+    <param name="overview-subleave-name-memuse" value="Usage"/>
+    <param name="overview-shortcut-text-memuse"
+           value="All pools usage"/>
+    <param name="overview-shortcut-title-memuse"
+           value="Show all memory pools usage in one page"/>
+    <param name="overview-page-title-memuse"
+           value="Memory Usage Graphs"/>
+          
+    <param name="descriptive-nickname"
+           value="%system-id%:%mempool-name% Memory"/>
+  </template>
+
+  <template name="cisco-enh-mempool">
+    <param name="data-file"
+             value="%system-id%_memusage_%mempool-phyindex%.rrd"/>
+    <leaf name="Usage">
+      <param name="precedence" value="1000"/>
+      <param name="comment" value="Total vs. Used Memory"/>
+      <param name="title"   value="%mempool-name% Memory Usage"/>
+      <param name="ds-type" value="rrd-multigraph"/>
+      <param name="ds-names" value="total,used"/>
+      <!-- total -->
+      <param name="ds-expr-total" value="{Free},{Used},+"/>
+      <param name="graph-legend-total" value="Total"/>
+      <param name="line-style-total" value="##totalresource"/>
+      <param name="line-color-total" value="##totalresource"/>
+      <param name="line-order-total" value="1"/>
+      <!-- used -->
+      <param name="ds-expr-used" value="{Used}"/>
+      <param name="graph-legend-used" value="Used"/>
+      <param name="line-style-used" value="##resourceusage"/>
+      <param name="line-color-used" value="##resourceusage"/>
+      <param name="line-order-used" value="2"/>
+    </leaf>
+    <leaf name="Free">
+      <param name="snmp-object"  value="$cempMemPoolFree.%mempool-index%"/>
+      <param name="rrd-ds"       value="Pool%mempool-poolindex%Free"/>
+      <param name="graph-legend" value="%mempool-name% memory free" />
+      <param name="comment"      value="Bytes Free in %mempool-name% pool"/>
+    </leaf>
+    <leaf name="Used">
+      <param name="snmp-object"  value="$cempMemPoolUsed.%mempool-index%"/>
+      <param name="rrd-ds"       value="Pool%mempool-poolindex%Used"/>
+      <param name="graph-legend" value="%mempool-name% memory free" />
+      <param name="comment"      value="Bytes Used in %mempool-name%"/>
+    </leaf>
+    <leaf name="LargestFree">
+      <param name="snmp-object"
+             value="$cempMemPoolLargestFree.%mempool-index%"/>
+      <param name="rrd-ds"       value="Pool%mempool-poolindex%LargestFree"/>
+      <param name="graph-legend" value="%mempool-name% largest free block" />
+      <param name="comment" value="Largest free block in %mempool-name% pool"/>
+    </leaf>
+  </template>
+
+  <template name="cisco-mempool">
+    <param name="data-file"    value="%system-id%_memusage.rrd"/>
+    <leaf name="Usage">
+      <param name="precedence" value="1000"/>
+      <param name="comment" value="Total vs. Used Memory"/>
+      <param name="title"   value="%mempool-name% Memory Usage"/>
+      <param name="ds-type" value="rrd-multigraph"/>
+      <param name="ds-names" value="total,used"/>
+      <!-- total -->
+      <param name="ds-expr-total" value="{Free},{Used},+"/>
+      <param name="graph-legend-total" value="Total"/>
+      <param name="line-style-total" value="##totalresource"/>
+      <param name="line-color-total" value="##totalresource"/>
+      <param name="line-order-total" value="1"/>
+      <!-- used -->
+      <param name="ds-expr-used" value="{Used}"/>
+      <param name="graph-legend-used" value="Used"/>
+      <param name="line-style-used" value="##resourceusage"/>
+      <param name="line-color-used" value="##resourceusage"/>
+      <param name="line-order-used" value="2"/>
+    </leaf>
+    <leaf name="Free">
+      <param name="snmp-object"  value="$ciscoMemoryPoolFree.%mempool-type%"/>
+      <param name="rrd-ds"       value="Pool%mempool-type%Free"/>
+      <param name="graph-legend" value="%mempool-name% memory free" />
+      <param name="comment"      value="Bytes Free in %mempool-name% pool"/>
+    </leaf>
+    <leaf name="Used">
+      <param name="snmp-object"  value="$ciscoMemoryPoolUsed.%mempool-type%"/>
+      <param name="rrd-ds"       value="Pool%mempool-type%Used"/>
+      <param name="graph-legend" value="%mempool-name% memory free" />
+      <param name="comment"      value="Bytes Used in %mempool-name%"/>
+    </leaf>
+    <leaf name="LargestFree">
+      <param name="snmp-object"
+             value="$ciscoMemoryPoolLargestFree.%mempool-type%"/>
+      <param name="rrd-ds"       value="Pool%mempool-type%LargestFree"/>
+      <param name="graph-legend" value="%mempool-name% largest free block" />
+      <param name="comment" value="Largest free block in %mempool-name% pool"/>
+    </leaf>
+  </template>
+
+  <template name="cisco-cpu-usage-subtree">
+    <param name="cisco-cpu-indexmap" value="$CISCO_CPU_IDX" />
+    <param name="data-file"  value="%system-id%_cpu_%cisco-cpu-ref%.rrd" />
+    <param name="rrd-create-dstype"  value="GAUGE" />
+    <param name="rrd-hwpredict"      value="disabled" />
+    <param name="graph-lower-limit"  value="0" />
+    <param name="graph-upper-limit"  value="100" />
+    <param name="upper-limit"        value="80" />
+    <param name="vertical-label"     value="Percent"/>
+
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="cpu5"/>
+    <param name="overview-subleave-name-cpu5" value="CPU_Total_5min"/>
+    <param name="overview-shortcut-text-cpu5"
+           value="All CPUs usage"/>
+    <param name="overview-shortcut-title-cpu5"
+           value="Show all CPUs 5 minute average usage in one page"/>
+    <param name="overview-page-title-cpu5"
+           value="CPU Usage Graphs"/>
+           
+    <param name="descriptive-nickname"
+           value="%system-id%:CPU #%cisco-cpu-ref%"/>
+  </template>
+
+  <template name="cisco-cpu">
+    <leaf name="CPU_Total_1min">
+      <param name="precedence"         value="-200" />
+      <param name="snmp-object"
+             value="$cpmCPUTotal1min.%cisco-cpu-indexmap%"/>
+      <param name="rrd-ds"             value="Total1min" />
+      <param name="comment">
+          The overall CPU busy percentage in the last 1 minute period
+      </param>
+      <param name="graph-legend"       value="CPU usage" />
+    </leaf>
+    <leaf name="CPU_Total_5min">
+      <param name="precedence"         value="-200" />
+      <param name="snmp-object"
+             value="$cpmCPUTotal5min.%cisco-cpu-indexmap%"/>
+      <param name="rrd-ds"             value="Total5min" />
+      <param name="comment">
+          The overall CPU busy percentage in the last 5 minute period
+      </param>
+      <param name="graph-legend"       value="CPU usage" />
+    </leaf>
+  </template>
+
+  <template name="cisco-cpu-revised">
+    <leaf name="CPU_Total_1min">
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_cpu_%cisco-cpu-ref%.rrd" />
+      <param name="precedence"         value="-200" />
+      <param name="snmp-object"
+             value="$cpmCPUTotal1minRev.%cisco-cpu-indexmap%"/>
+      <param name="rrd-ds"             value="Total1min" />
+      <param name="comment">
+          The overall CPU busy percentage in the last 1 minute period
+      </param>
+      <param name="graph-legend"       value="CPU usage" />
+      <param name="graph-lower-limit"  value="0" />
+      <param name="graph-upper-limit"  value="100" />
+      <param name="upper-limit"        value="80" />
+      <param name="vertical-label"     value="Percent"/>
+    </leaf>
+    <leaf name="CPU_Total_5min">
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_cpu_%cisco-cpu-ref%.rrd" />
+      <param name="precedence"         value="-200" />
+      <param name="snmp-object"
+             value="$cpmCPUTotal5minRev.%cisco-cpu-indexmap%"/>
+      <param name="rrd-ds"             value="Total5min" />
+      <param name="comment">
+          The overall CPU busy percentage in the last 5 minute period
+      </param>
+      <param name="graph-legend"       value="CPU usage" />
+      <param name="graph-lower-limit"  value="0" />
+      <param name="upper-limit"        value="80" />
+      <param name="vertical-label"     value="Percent"/>
+    </leaf>
+  </template>
+
+  <template name="old-cisco-cpu">
+    <leaf name="CPU_Total_1min">
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"      value="%system-id%_cpu.rrd" />
+      <param name="precedence"         value="-200" />
+      <param name="snmp-object"        value="$avgBusy1"/>
+      <param name="rrd-ds"             value="Total1min" />
+      <param name="comment">
+          The overall CPU busy percentage in the last 1 minute period
+      </param>
+      <param name="graph-legend"       value="CPU usage" />
+      <param name="graph-lower-limit"  value="0" />
+      <param name="graph-upper-limit"  value="100" />
+      <param name="upper-limit"        value="80" />
+      <param name="vertical-label"     value="Percent"/>
+    </leaf>
+    <leaf name="CPU_Total_5min">
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"      value="%system-id%_cpu.rrd" />
+      <param name="precedence"         value="-200" />
+      <param name="snmp-object"        value="$avgBusy5"/>
+      <param name="rrd-ds"             value="Total5min" />
+      <param name="comment">
+          The overall CPU busy percentage in the last 5 minute period
+      </param>
+      <param name="graph-legend"       value="CPU usage" />
+      <param name="graph-lower-limit"  value="0" />
+      <param name="upper-limit"        value="80" />
+      <param name="vertical-label"     value="Percent"/>
+    </leaf>
+  </template>
+
+  <template name="cisco-temperature-subtree">
+    <param name="comment"             value="Cisco Temperature Sensors"/>
+    <param name="precedence"          value="-500"/>
+    <param name="rrd-create-dstype"   value="GAUGE"/>
+    <param name="rrd-hwpredict"       value="disabled" />
+  </template>
+  
+  <!-- template to be applied inside the sensor leaf.
+       Two parameters must be defined: sensor-index and sensor-description -->
+  <template name="cisco-temperature-sensor">
+    <param name="comment"      value="%sensor-description%"/>
+    <param name="rrd-ds"       value="sensor_%sensor-index%"/>
+    <param name="snmp-object"
+           value="$ciscoEnvMonTemperatureStatusValue.%sensor-index%"/>
+    <param name="graph-legend"      value="%sensor-description%"/>
+    <param name="graph-lower-limit" value="15"/>
+    <param name="graph-upper-limit" value="70"/>
+    <param name="vertical-label"  value="degrees Celsius"/>
+  </template>
+
+  <!-- Temperature measured in degrees Fahrenheit -->
+  <template name="cisco-temperature-sensor-fahrenheit">
+    <param name="comment"      value="%sensor-description%"/>
+    <param name="rrd-ds"       value="sensor_%sensor-index%"/>
+    <param name="snmp-object"
+           value="$ciscoEnvMonTemperatureStatusValue.%sensor-index%"/>
+    <param name="collector-scale" value="1.8,*,32,+" />
+    <param name="graph-legend"      value="%sensor-description%"/>
+    <param name="graph-lower-limit" value="59"/>
+    <param name="graph-upper-limit" value="158"/>
+    <param name="vertical-label"  value="degrees Fahrenheit"/>
+  </template>
+
+  <template name="cisco-power-supply">
+    <param name="comment"            value="Power supply #%power-index%"/>
+    <param name="rrd-ds"             value="power_%power-index%"/>
+    <param name="rrd-create-dstype"  value="GAUGE"/>
+    <param name="snmp-object"
+           value="$ciscoEnvMonSupplyState.%power-index%"/>
+    <param name="graph-legend"       value="Power supply #%power-index%"/>
+    <param name="vertical-label"     value="1 = Normal"/>
+    <param name="rrd-hwpredict"      value="disabled" />
+  </template>
+  
+  
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/cisco.ios.docsis.xml b/torrus/xmlconfig/vendor/cisco.ios.docsis.xml
new file mode 100644 (file)
index 0000000..1e90b8b
--- /dev/null
@@ -0,0 +1,255 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003  Roman Hochuli, Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: cisco.ios.docsis.xml,v 1.1 2010-12-27 00:04:27 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+ DOCSIS interface, Cisco specific
+ MIB used:
+ CISCO-DOCS-EXT-MIB:cdxCmtsMacExtTable
+ CISCO-DOCS-EXT-MIB:cdxIfUpstreamChannelExtTable
+  
+-->
+
+<configuration>
+
+<definitions>
+  <!--  CISCO-DOCS-EXT-MIB::cdxCmtsMacExtTable -->
+  <def name="cdxCmtsCmTotal"      value="1.3.6.1.4.1.9.9.116.1.3.3.1.4"/>
+  <def name="cdxCmtsCmActive"     value="1.3.6.1.4.1.9.9.116.1.3.3.1.5"/>
+  <def name="cdxCmtsCmRegistered" value="1.3.6.1.4.1.9.9.116.1.3.3.1.6"/>
+  
+  <!--  CISCO-DOCS-EXT-MIB:cdxIfUpstreamChannelExtTable -->
+  <def name="cdxIfUpChannelCmTotal"   value="1.3.6.1.4.1.9.9.116.1.4.1.1.3"/>
+  <def name="cdxIfUpChannelCmActive"  value="1.3.6.1.4.1.9.9.116.1.4.1.1.4"/>
+  <def name="cdxIfUpChannelCmRegistered"
+                                      value="1.3.6.1.4.1.9.9.116.1.4.1.1.5"/>
+  <def name="cdxIfUpChannelAvgUtil"   value="1.3.6.1.4.1.9.9.116.1.4.1.1.7"/>
+  <def name="cdxIfUpChannelAvgContSlots"
+                                      value="1.3.6.1.4.1.9.9.116.1.4.1.1.8"/>
+  <def name="cdxIfUpChannelMaxUGSLastFiveMins"
+                                      value="1.3.6.1.4.1.9.9.116.1.4.1.1.14"/>
+</definitions>
+
+<datasources>
+
+  <template name="cisco-docsis-mac-subtree">
+    <param name="precedence"           value="-500" />
+    <param name="comment"        value="DOCSIS MAC layer utilization" />
+    <param name="data-file">
+       %system-id%_%interface-nick%_cdx_mac.rrd
+    </param>
+    <param name="collector-timeoffset-hashstring"
+                                       value="%system-id%:%interface-nick%" />
+    <param name="descriptive-nickname" value="%system-id%:%interface-name%"/>
+    <param name="graph-title"          value="%descriptive-nickname%" />
+
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="modems"/>
+    <param name="overview-subleave-name-modems" value="Modems"/>
+    <param name="overview-direct-link-modems"      value="yes"/>
+    <param name="overview-direct-link-view-modems" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-modems"
+           value="All modems"/>
+    <param name="overview-shortcut-title-modems"
+           value="Show modem quantities in one page"/>
+    <param name="overview-page-title-modems"
+           value="Modem quantities"/>
+           
+    <param name="rrd-hwpredict"     value="disabled" />
+    
+    <!-- nodeid-docsif is overwritten by devdiscover at the
+         interface level. This definition is here for backward compatibility
+         with older discovery results or for systems which do not use
+         devdiscover -->
+    <param name="nodeid-docsif"
+      value="docs//%nodeid-device%//%interface-nick%//"/>
+  </template>
+
+  <template name="cisco-docsis-modem-quantity">
+    <leaf name="Modems">
+      <param name="ds-type"           value="rrd-multigraph" />
+      <param name="ds-names"          value="total,active,registered" />
+      <param name="nodeid"            value="%nodeid-docsif%//modems"/>
+
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="950" />
+      <param name="comment"
+              value="Active and Total modems on the interface" />
+      <param name="vertical-label"    value="Modems" />
+
+      <param name="ds-expr-total">{Modems_Total}</param>
+      <param name="graph-legend-total"  value="Total" />
+      <param name="line-style-total"      value="##totalresource" />
+      <param name="line-color-total"      value="##totalresource" />
+      <param name="line-order-total"      value="1" />
+
+      <param name="ds-expr-active">{Modems_Active}</param>
+      <param name="graph-legend-active"  value="Active" />
+      <param name="line-style-active"    value="##resourcepartusage" />
+      <param name="line-color-active"    value="##resourcepartusage" />
+      <param name="line-order-active"    value="2" />
+      
+      <param name="ds-expr-registered">{Modems_Registered}</param>
+      <param name="graph-legend-registered"  value="Registered" />
+      <param name="line-style-registered"    value="##resourceusage" />
+      <param name="line-color-registered"    value="##resourceusage" />
+      <param name="line-order-registered"    value="3" />
+    </leaf>
+
+    <leaf name="Modems_Total">
+      <param name="snmp-object"
+                value="%cisco-docsis-cmtotal%.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Total" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="Total number of modems on the interface since boot"/>
+      <param name="graph-legend" value="Total modems" />
+      <param name="precedence"   value="900" />
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="vertical-label"      value="Modems" />
+      <param name="graph-lower-limit"   value="0" />
+    </leaf>
+    
+    <leaf name="Modems_Active">
+      <param name="snmp-object"
+                value="%cisco-docsis-cmactive%.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Active" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="Number of active modems on the interface"/>
+      <param name="graph-legend" value="Active modems" />
+      <param name="precedence"   value="800" />
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="vertical-label"      value="Modems" />
+      <param name="graph-lower-limit"   value="0" />
+      <param name="monitor-action-target"  value="Modems"/>
+    </leaf>
+    
+    <leaf name="Modems_Registered">
+      <param name="snmp-object"
+                value="%cisco-docsis-cmregistered%.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Registered" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="Number of registered modems on the interface"/>
+      <param name="graph-legend" value="Registered modems" />
+      <param name="precedence"   value="700" />
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="vertical-label"      value="Modems" />
+      <param name="graph-lower-limit"   value="0" />
+      <param name="monitor-action-target"  value="Modems"/>
+    </leaf>
+
+  </template>
+
+  
+  <template name="cisco-docsis-mac-util">
+    <apply-template name="cisco-docsis-modem-quantity"/>
+    <param name="cisco-docsis-cmtotal" value="$cdxCmtsCmTotal"/>
+    <param name="cisco-docsis-cmactive" value="$cdxCmtsCmActive"/>
+    <param name="cisco-docsis-cmregistered" value="$cdxCmtsCmRegistered"/>
+  </template>
+
+  
+  <template name="cisco-docsis-upstream-util">
+    <apply-template name="cisco-docsis-modem-quantity"/>
+    <param name="cisco-docsis-cmtotal" value="$cdxIfUpChannelCmTotal"/>
+    <param name="cisco-docsis-cmactive" value="$cdxIfUpChannelCmActive"/>
+    <param name="cisco-docsis-cmregistered"
+                                     value="$cdxIfUpChannelCmRegistered"/>
+
+    <leaf name="Util_Summary">
+      <param name="ds-type"           value="rrd-multigraph" />
+      <param name="ds-names"          value="util,cont" />
+      <param name="nodeid"            value="%nodeid-docsif%//util"/>
+      <param name="graph-lower-limit" value="0" />
+      <param name="graph-upper-limit" value="100" />
+
+      <param name="precedence"        value="950" />
+      <param name="comment"
+        value="Upstream channel utilization and free contention mini-slots" />
+      <param name="vertical-label"    value="Percent" />
+
+      <param name="ds-expr-util"       value="{Util}"/>
+      <param name="graph-legend-util"  value="Utilization" />
+      <param name="line-style-util"    value="##resourceusage" />
+      <param name="line-color-util"    value="##resourceusage" />
+      <param name="line-order-util"    value="1" />
+
+      <param name="ds-expr-cont"       value="{ContSlots}"/>
+      <param name="graph-legend-cont"  value="Free contention slots" />
+      <param name="line-style-cont"    value="##SingleGraph" />
+      <param name="line-color-cont"    value="##green" />
+      <param name="line-order-cont"    value="2" />
+    </leaf>
+        
+    <leaf name="Util">
+      <param name="snmp-object"
+                value="$cdxIfUpChannelAvgUtil.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Util" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="The average percentage of upstream channel utilization"/>
+      <param name="graph-legend" value="Channel Utilization" />
+      <param name="precedence"   value="700" />
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="vertical-label"      value="Percent" />
+      <param name="graph-lower-limit"   value="0" />
+      <param name="graph-upper-limit"   value="100" />
+      <param name="upper-limit"         value="90" />
+      <param name="monitor-action-target"  value="Util_Summary"/>
+    </leaf>
+
+    <leaf name="ContSlots">
+      <param name="snmp-object"
+                value="$cdxIfUpChannelAvgContSlots.%ifindex-map%"/>
+      <param name="rrd-ds"       value="ContSlots" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="The average percentage of contention mini-slots"/>
+      <param name="graph-legend" value="Cintention mini-slots" />
+      <param name="precedence"   value="600" />
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="vertical-label"      value="Percent" />
+      <param name="graph-lower-limit"   value="0" />
+      <param name="graph-upper-limit"   value="100" />
+      <param name="lower-limit"         value="10" />
+      <param name="monitor-action-target"  value="Util_Summary"/>
+    </leaf>
+    
+    <iftrue var="CiscoIOS_Docsis::ugs-supported">    
+      <leaf name="Active_UGS">
+        <param name="snmp-object"
+                  value="$cdxIfUpChannelMaxUGSLastFiveMins.%ifindex-map%"/>
+        <param name="rrd-ds"       value="ActiveUGS" />
+        <param name="comment"
+            value="the number of active Unsolicited Grant Services"/>
+        <param name="graph-legend" value="Active UGS" />
+        <param name="precedence"   value="600" />
+        <param name="rrd-create-dstype"   value="GAUGE" />
+        <param name="vertical-label"      value="UGS" />
+        <param name="graph-lower-limit"   value="0" />
+      </leaf>
+    </iftrue>
+  </template>
+  
+</datasources>
+
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/cisco.ios.mac-accounting.xml b/torrus/xmlconfig/vendor/cisco.ios.mac-accounting.xml
new file mode 100644 (file)
index 0000000..49bc979
--- /dev/null
@@ -0,0 +1,126 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: cisco.ios.mac-accounting.xml,v 1.1 2010-12-27 00:04:24 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!--
+  This file defines the template for MAC accounting
+  on Cisco routers. It may be useful for per-BGP peer statistics
+  on an Ethernet media.
+
+  See also "examples/cisco-mac-accounting.xml" for a working example.
+ -->
+
+<configuration>
+
+<definitions>
+
+  <!-- CISCO-IP-STAT-MIB:cipMacTable -->
+  <def name="cipMacHCSwitchedBytes" value="1.3.6.1.4.1.9.9.84.1.2.3.1.2" />
+
+</definitions>
+
+
+<datasources>
+
+  <template name="cisco-macacc-subtree">
+    <param name="snmp-object">
+      $cipMacHCSwitchedBytes.%ifindex-map%.%direction%.%peer-macoid%
+    </param>
+    <param name="snmp-object-type"  value="COUNTER64" />
+    <param name="ext-dstype"        value="COUNTER64" />
+
+    <param name="data-file">
+      %system-id%_%interface-nick%_%peer-macaddr%_macacc.rrd
+    </param>
+
+    <param name="rrd-ds" value="%direction%" />
+    <param name="rrd-create-dstype" value="COUNTER" />
+    <param name="graph-title" value="%descriptive-nickname%" />
+    <param name="graph-lower-limit" value="0" />
+
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="traffic"/>
+    <param name="overview-subleave-name-traffic" value="InOut_bps"/>
+    <param name="overview-shortcut-text-traffic"
+           value="All traffic"/>
+    <param name="overview-shortcut-title-traffic"
+           value="Show traffic for all interfaces on one page"/>
+    <param name="overview-page-title-traffic"
+           value="Input/Output Graphs"/>    
+  </template>
+
+
+  <template name="cisco-macacc">
+    <leaf name="Bytes_In">
+      <param name="comment"          value="Input bytes per second" />
+      <param name="direction"        value="1" />
+      <param name="hidden"           value="yes" />
+      <param name="graph-legend"     value="Bytes in" />
+    </leaf>
+
+    <leaf name="Bytes_Out">
+      <param name="comment"          value="Output bytes per second" />
+      <param name="direction"        value="2" />
+      <param name="hidden"           value="yes" />
+      <param name="graph-legend"     value="Bytes out" />
+    </leaf>
+
+    <leaf name="In_bps">
+      <param name="comment"          value="Input bits per second" />
+      <param name="ds-type"          value="rrd-file" />
+      <param name="leaf-type"        value="rrd-cdef" />
+      <param name="rpn-expr"         value="{Bytes_In},8,*" />
+      <param name="graph-legend"     value="Bits in" />
+    </leaf>
+
+    <leaf name="Out_bps">
+      <param name="comment"          value="Output bits per second" />
+      <param name="ds-type"          value="rrd-file" />
+      <param name="leaf-type"        value="rrd-cdef" />
+      <param name="rpn-expr"         value="{Bytes_Out},8,*" />
+      <param name="graph-legend"     value="Bits out" />
+    </leaf>
+
+    <leaf name="InOut_bps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{Bytes_In},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="AREA" />
+      <param name="line-color-in"    value="#00FF00" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{Bytes_Out},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="LINE2" />
+      <param name="line-color-out"   value="#0000FF" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/cisco.ios.xml b/torrus/xmlconfig/vendor/cisco.ios.xml
new file mode 100644 (file)
index 0000000..34c7869
--- /dev/null
@@ -0,0 +1,941 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: cisco.ios.xml,v 1.1 2010-12-27 00:04:13 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+-->
+
+<!-- Cisco IOS specific definitions -->
+
+<configuration>
+
+<definitions>
+
+  <!-- v1/OLD-CISCO-INTERFACES-MIB:lifTable -->
+  <def name="locIfInBitsSec"    value="1.3.6.1.4.1.9.2.2.1.1.6" />
+  <def name="locIfOutBitsSec"   value="1.3.6.1.4.1.9.2.2.1.1.8" />
+  <def name="locIfLoad"         value="1.3.6.1.4.1.9.2.2.1.1.24" />
+
+  <!-- CISCO-RTTMON-MIB -->
+  <def name="rttMonLatestRttOperCompletionTime"
+                          value="1.3.6.1.4.1.9.9.42.1.2.10.1.1" />
+
+  <!-- OLD-CISCO-MEMORY-MIB -->
+  <def name="bufferElFree"      value="1.3.6.1.4.1.9.2.1.9.0"/>
+  <def name="bufferElMax"       value="1.3.6.1.4.1.9.2.1.10.0"/>
+  <def name="bufferElHit"       value="1.3.6.1.4.1.9.2.1.11.0"/>
+  <def name="bufferElMiss"      value="1.3.6.1.4.1.9.2.1.12.0"/>
+  <def name="bufferElCreate"    value="1.3.6.1.4.1.9.2.1.13.0"/>
+  <def name="bufferSmSize"      value="1.3.6.1.4.1.9.2.1.14.0"/>
+  <def name="bufferSmTotal"     value="1.3.6.1.4.1.9.2.1.15.0"/>
+  <def name="bufferSmFree"      value="1.3.6.1.4.1.9.2.1.16.0"/>
+  <def name="bufferSmMax"       value="1.3.6.1.4.1.9.2.1.17.0"/>
+  <def name="bufferSmHit"       value="1.3.6.1.4.1.9.2.1.18.0"/>
+  <def name="bufferSmMiss"      value="1.3.6.1.4.1.9.2.1.19.0"/>
+  <def name="bufferSmTrim"      value="1.3.6.1.4.1.9.2.1.20.0"/>
+  <def name="bufferSmCreate"    value="1.3.6.1.4.1.9.2.1.21.0"/>
+  <def name="bufferMdSize"      value="1.3.6.1.4.1.9.2.1.22.0"/>
+  <def name="bufferMdTotal"     value="1.3.6.1.4.1.9.2.1.23.0"/>
+  <def name="bufferMdFree"      value="1.3.6.1.4.1.9.2.1.24.0"/>
+  <def name="bufferMdMax"       value="1.3.6.1.4.1.9.2.1.25.0"/>
+  <def name="bufferMdHit"       value="1.3.6.1.4.1.9.2.1.26.0"/>
+  <def name="bufferMdMiss"      value="1.3.6.1.4.1.9.2.1.27.0"/>
+  <def name="bufferMdTrim"      value="1.3.6.1.4.1.9.2.1.28.0"/>
+  <def name="bufferMdCreate"    value="1.3.6.1.4.1.9.2.1.29.0"/>
+  <def name="bufferBgSize"      value="1.3.6.1.4.1.9.2.1.30.0"/>
+  <def name="bufferBgTotal"     value="1.3.6.1.4.1.9.2.1.31.0"/>
+  <def name="bufferBgFree"      value="1.3.6.1.4.1.9.2.1.32.0"/>
+  <def name="bufferBgMax"       value="1.3.6.1.4.1.9.2.1.33.0"/>
+  <def name="bufferBgHit"       value="1.3.6.1.4.1.9.2.1.34.0"/>
+  <def name="bufferBgMiss"      value="1.3.6.1.4.1.9.2.1.35.0"/>
+  <def name="bufferBgTrim"      value="1.3.6.1.4.1.9.2.1.36.0"/>
+  <def name="bufferBgCreate"    value="1.3.6.1.4.1.9.2.1.37.0"/>
+  <def name="bufferLgSize"      value="1.3.6.1.4.1.9.2.1.38.0"/>
+  <def name="bufferLgTotal"     value="1.3.6.1.4.1.9.2.1.39.0"/>
+  <def name="bufferLgFree"      value="1.3.6.1.4.1.9.2.1.40.0"/>
+  <def name="bufferLgMax"       value="1.3.6.1.4.1.9.2.1.41.0"/>
+  <def name="bufferLgHit"       value="1.3.6.1.4.1.9.2.1.42.0"/>
+  <def name="bufferLgMiss"      value="1.3.6.1.4.1.9.2.1.43.0"/>
+  <def name="bufferLgTrim"      value="1.3.6.1.4.1.9.2.1.44.0"/>
+  <def name="bufferLgCreate"    value="1.3.6.1.4.1.9.2.1.45.0"/>
+  <def name="bufferFail"        value="1.3.6.1.4.1.9.2.1.46.0"/>
+  <def name="bufferNoMem"       value="1.3.6.1.4.1.9.2.1.47.0"/>
+  <def name="bufferHgSize"      value="1.3.6.1.4.1.9.2.1.62.0"/>
+  <def name="bufferHgTotal"     value="1.3.6.1.4.1.9.2.1.63.0"/>
+  <def name="bufferHgFree"      value="1.3.6.1.4.1.9.2.1.64.0"/>
+  <def name="bufferHgMax"       value="1.3.6.1.4.1.9.2.1.65.0"/>
+  <def name="bufferHgHit"       value="1.3.6.1.4.1.9.2.1.66.0"/>
+  <def name="bufferHgMiss"      value="1.3.6.1.4.1.9.2.1.67.0"/>
+  <def name="bufferHgTrim"      value="1.3.6.1.4.1.9.2.1.68.0"/>
+  <def name="bufferHgCreate"    value="1.3.6.1.4.1.9.2.1.69.0"/>
+
+  <!-- CISCO-IPSEC-FLOW-MONITOR-MIB -->
+  <def name="cipSecGlobalActiveTunnels"
+                                      value="1.3.6.1.4.1.9.9.171.1.3.1.1.0"/>
+  <def name="cipSecGlobalHcInOctets"  value="1.3.6.1.4.1.9.9.171.1.3.1.4.0"/>
+  <def name="cipSecGlobalInPkts"      value="1.3.6.1.4.1.9.9.171.1.3.1.9.0"/>
+  <def name="cipSecGlobalInDrops"     value="1.3.6.1.4.1.9.9.171.1.3.1.10.0"/>
+  <def name="cipSecGlobalHcOutOctets" value="1.3.6.1.4.1.9.9.171.1.3.1.17.0"/>
+  <def name="cipSecGlobalOutPkts"     value="1.3.6.1.4.1.9.9.171.1.3.1.22.0"/>
+  <def name="cipSecGlobalOutDrops"    value="1.3.6.1.4.1.9.9.171.1.3.1.23.0"/>
+
+  <!-- CISCO-BGP4-MIB -->
+  <def name="cbgpPeerAcceptedPrefixes"
+          value="1.3.6.1.4.1.9.9.187.1.2.4.1.1"/>
+          
+  <!-- CISCO-CAR-MIB -->
+  <def name="ccarStatCurBurst"
+          value="1.3.6.1.4.1.9.9.113.1.2.1.1.5"/>
+  <def name="ccarStatHCSwitchedPkts"
+          value="1.3.6.1.4.1.9.9.113.1.2.1.1.10"/>
+  <def name="ccarStatHCSwitchedBytes"
+          value="1.3.6.1.4.1.9.9.113.1.2.1.1.11"/>
+  <def name="ccarStatHCFilteredPkts"
+          value="1.3.6.1.4.1.9.9.113.1.2.1.1.12"/>
+  <def name="ccarStatHCFilteredBytes"
+          value="1.3.6.1.4.1.9.9.113.1.2.1.1.13"/>
+
+  <!-- CISCO-VPDN-MGMT-MIB -->
+  <def name="cvpdnSystemTunnelTotal"
+          value="1.3.6.1.4.1.9.10.24.1.1.4.1.2"/>
+  <def name="cvpdnSystemSessionTotal"
+          value="1.3.6.1.4.1.9.10.24.1.1.4.1.3"/>
+  <def name="cvpdnSystemDeniedUsersTotal"
+          value="1.3.6.1.4.1.9.10.24.1.1.4.1.4"/>
+
+</definitions>
+
+<datasources>
+
+  <template name="cisco-interface-counters">
+
+    <leaf name="InOut_bps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{locIfInBitsSec}" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="AREA" />
+      <param name="line-color-in"    value="#00FF00" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{locIfOutBitsSec}" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="LINE2" />
+      <param name="line-color-out"   value="#0000FF" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+
+    <leaf name="ifInErrors">
+      <param name="snmp-object"       value="$ifInErrors.$IFIDX_DESCR" />
+      <param name="rrd-ds"            value="ifInErrors" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-hwpredict"     value="disabled" />
+      <param name="comment"
+             value="Input error counter for the interface" />
+      <param name="graph-legend"      value="Errors in" />
+    </leaf>
+
+    <leaf name="ifOutErrors">
+      <param name="snmp-object"       value="$ifOutErrors.$IFIDX_DESCR" />
+      <param name="rrd-ds"            value="ifOutErrors" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-hwpredict"     value="disabled" />
+      <param name="comment"
+             value="Output error counter for the interface" />
+      <param name="graph-legend"      value="Errors out" />
+    </leaf>
+
+    <leaf name="locIfInBitsSec">
+      <param name="snmp-object"       value="$locIfInBitsSec.$IFIDX_DESCR" />
+      <param name="rrd-ds" value="locIfInBitsSec" />
+      <param name="rrd-create-dstype" value="GAUGE" />
+      <param name="comment"
+             value="5-minute average of input bits per second"/>
+      <param name="graph-legend"      value="Bits in" />
+    </leaf>
+
+    <leaf name="locIfOutBitsSec">
+      <param name="snmp-object"       value="$locIfOutBitsSec.$IFIDX_DESCR" />
+      <param name="rrd-ds"            value="locIfOutBitsSec" />
+      <param name="rrd-create-dstype" value="GAUGE" />
+      <param name="comment"
+             value="5-minute average of output bits per second"/>
+      <param name="graph-legend"      value="Bits out" />
+    </leaf>
+
+    <leaf name="locIfLoad">
+      <param name="snmp-object"       value="$locIfLoad.$IFIDX_DESCR" />
+      <param name="rrd-ds"            value="locIfLoad" />
+      <param name="rrd-create-dstype" value="GAUGE" />
+      <param name="comment"
+             value="The loading factor of the interface" />
+      <param name="graph-legend"      value="Interface load" />
+    </leaf>
+
+  </template>
+
+  <!-- Read-only view to those leaves updated by
+       cisco-interface-counters  template -->
+
+  <template name="read-cisco-interface-counters">
+
+    <!-- You must specify data-file and data-dir parameters -->
+
+    <leaf name="InOut_bps">
+      <param name="comment" value="Input and Output bits per second graphs" />
+      <param name="precedence"       value="1000" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{InBps}" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="AREA" />
+      <param name="line-color-in"    value="#00FF00" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{OutBps}" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="LINE2" />
+      <param name="line-color-out"   value="#0000FF" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+
+    <leaf name="InErrors">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="rrd-ds"            value="ifInErrors" />
+      <param name="rrd-hwpredict"     value="disabled" />
+      <param name="comment"
+             value="Input error counter for the interface" />
+      <param name="graph-legend"      value="Errors in" />
+    </leaf>
+
+    <leaf name="OutErrors">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="rrd-ds"            value="ifOutErrors" />
+      <param name="rrd-hwpredict"     value="disabled" />
+      <param name="comment"
+             value="Output error counter for the interface" />
+      <param name="graph-legend"      value="Errors out" />
+    </leaf>
+
+    <leaf name="InBps">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="rrd-ds"            value="locIfInBitsSec" />
+      <param name="comment"
+             value="5-minute average of input bits per second"/>
+      <param name="graph-legend"      value="Bits in" />
+    </leaf>
+
+    <leaf name="OutBps">
+      <param name="ds-type"           value="rrd-file" />
+      <param name="leaf-type"         value="rrd-def" />
+      <param name="rrd-cf"            value="AVERAGE" />
+      <param name="rrd-ds"            value="locIfOutBitsSec" />
+      <param name="comment"
+             value="5-minute average of output bits per second"/>
+      <param name="graph-legend"      value="Bits out" />
+    </leaf>
+
+  </template>
+
+  <!-- Common definitions for SAA/RTTMON subtree -->
+  <template name="cisco-saa-subtree">
+    <param name="comment"      value="Cisco Service Assurance Agent"/>
+    <param name="precedence"   value="-400" />
+    
+    <param name="has-overview-shortcuts"    value="yes"/>
+    <param name="overview-shortcuts"        value="rt"/>
+    <param name="overview-subleave-name-rt"    value="LatestCompletionTime"/>
+    <param name="overview-shortcut-text-rt"
+           value="All responce times"/>
+    <param name="overview-shortcut-title-rt"
+           value="Show all responce time graphs in one page"/>
+    <param name="overview-page-title-rt"
+           value="Responce Time Graphs"/>
+           
+    <param name="rrd-hwpredict"     value="disabled" />
+  </template>
+
+  <!-- RTT Echo statitsics -->
+  <template name="cisco-rtt-echo-subtree">
+    <leaf name="LatestCompletionTime">
+      <param name="snmp-object"
+             value="$rttMonLatestRttOperCompletionTime.%rtt-index%" />
+      <param name="rrd-ds"            value="complTime" />
+      <param name="rrd-create-dstype" value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_rtt_%rtt-index%.rrd" />
+      <param name="graph-legend"      value="rtr %rtt-index%" />
+      <param name="vertical-label"    value="milliseconds" />
+      <param name="graph-lower-limit" value="0"/>
+    </leaf>
+  </template>
+
+  <!-- OLD-CISCO-MEMORY-MIB templates -->
+
+  <template name="old-cisco-memory-buffers">
+    <subtree name="Buffer_Usage">
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-hwpredict"     value="disabled" />
+      <param name="data-file"         value="%system-id%_cisco-buffers.rrd" />
+      <param name="comment"           value="Buffer usage statistics" />
+      <param name="precedence"        value="-100" />
+      <leaf name="Buffer_Stats">
+        <param name="precedence"        value="1000" />
+        <param name="comment" value="Hits, Misses and Failures"/>
+        <param name="ds-type" value="rrd-multigraph"/>
+        <param name="ds-names" value="afail,mfail,hit,miss"/>
+        <!-- afail -->
+        <param name="ds-expr-afail" value="{Allocation_Failures}"/>
+        <param name="graph-legend-afail" value="Allocation Failures"/>
+        <param name="line-style-afail" value="LINE2"/>
+        <param name="line-color-afail" value="##red"/>
+        <param name="line-order-afail" value="4"/>
+        <!-- mfail -->
+        <param name="ds-expr-mfail" value="{No_Memory_Failures}"/>
+        <param name="graph-legend-mfail" value="No Memory Failures"/>
+        <param name="line-style-mfail" value="LINE2"/>
+        <param name="line-color-mfail" value="##red25"/>
+        <param name="line-order-mfail" value="3"/>
+        <!-- miss -->
+        <param name="ds-expr-miss" value="{Misses}"/>
+        <param name="graph-legend-miss" value="Misses"/>
+        <param name="line-style-miss" value="LINE2"/>
+        <param name="line-color-miss" value="##red75"/>
+        <param name="line-order-miss" value="2"/>
+        <!-- hit -->
+        <param name="ds-expr-hit" value="{Hits}"/>
+        <param name="graph-legend-hit" value="Hits"/>
+        <param name="line-style-hit" value="LINE2"/>
+        <param name="line-color-hit" value="##blue"/>
+        <param name="line-order-hit" value="1"/>
+      </leaf>
+      <leaf name="Allocation_Failures">
+        <param name="snmp-object"     value="$bufferFail"/>
+        <param name="rrd-ds"          value="bufferFail" />
+        <param name="comment" value="Number of Buffer Allocation Failures"/>
+        <param name="graph-legend"    value="Allocation Failures" />
+        <param name="precedence"        value="-100" />
+        <param name="vertical-label"    value="fps"/>
+      </leaf>
+      <leaf name="No_Memory_Failures">
+        <param name="snmp-object"     value="$bufferNoMem"/>
+        <param name="rrd-ds"          value="bufferNoMem" />
+        <param name="comment">
+          Number of Buffer Create Failures due to No Memory
+        </param>
+        <param name="graph-legend"    value="No Mem Failures" />
+        <param name="precedence"        value="-100" />
+        <param name="vertical-label"    value="fps"/>
+      </leaf>
+      <leaf name="Free">
+        <param name="precedence"        value="-200" />
+        <param name="rrd-create-dstype" value="GAUGE" />
+        <param name="snmp-object"     value="$bufferElFree"/>
+        <param name="rrd-ds"          value="bufferElFree" />
+        <param name="comment" value="Number of Free Buffers"/>
+        <param name="graph-legend"    value="Free Buffers" />
+        <param name="vertical-label"    value="Total Free Buffers"/>
+      </leaf>
+      <leaf name="Max">
+        <param name="precedence"        value="-200" />
+        <param name="rrd-create-dstype" value="GAUGE" />
+        <param name="snmp-object"     value="$bufferElMax"/>
+        <param name="rrd-ds"          value="bufferElMax" />
+        <param name="comment" value="Max Buffers"/>
+        <param name="graph-legend"    value="Max Buffers" />
+        <param name="vertical-label"    value="Total Max Buffers"/>
+      </leaf>
+      <leaf name="Hits">
+        <param name="precedence"        value="-200" />
+        <param name="snmp-object"     value="$bufferElHit"/>
+        <param name="rrd-ds"          value="bufferElHit" />
+        <param name="comment" value="Buffer Hits"/>
+        <param name="graph-legend"    value="Buffer Hits" />
+        <param name="vertical-label"    value="Total hps"/>
+      </leaf>
+      <leaf name="Misses">
+      <param name="precedence"        value="-200" />
+        <param name="snmp-object"     value="$bufferElMiss"/>
+        <param name="rrd-ds"          value="bufferElMiss" />
+        <param name="comment" value="Buffer Misses"/>
+        <param name="graph-legend"    value="Buffer Misses" />
+        <param name="vertical-label"    value="Total mps"/>
+      </leaf>
+      <leaf name="Creates">
+      <param name="precedence"        value="-200" />
+        <param name="snmp-object"     value="$bufferElCreate"/>
+        <param name="rrd-ds"          value="bufferElCreate" />
+        <param name="comment" value="Buffer Creates"/>
+        <param name="graph-legend"    value="Buffer Creates" />
+        <param name="vertical-label"    value="Total cps"/>
+      </leaf>
+      <subtree name="Small_Buffers">
+        <param name="precedence"        value="-300" />
+        <leaf name="Free">
+          <param name="rrd-create-dstype" value="GAUGE" />
+          <param name="snmp-object"     value="$bufferSmFree"/>
+          <param name="rrd-ds"          value="bufferSmFree" />
+          <param name="comment" value="Number of Free Small Buffers"/>
+          <param name="graph-legend"    value="Free Small Buffers" />
+          <param name="vertical-label"    value="Free Buffers"/>
+        </leaf>
+        <leaf name="Max">
+          <param name="rrd-create-dstype" value="GAUGE" />
+          <param name="snmp-object"     value="$bufferSmMax"/>
+          <param name="rrd-ds"          value="bufferSmMax" />
+          <param name="comment" value="Max Small Buffers"/>
+          <param name="graph-legend"    value="Max Small Buffers" />
+          <param name="vertical-label"    value="Max Buffers"/>
+        </leaf>
+        <leaf name="Hits">
+          <param name="snmp-object"     value="$bufferSmHit"/>
+          <param name="rrd-ds"          value="bufferSmHit" />
+          <param name="comment" value="Small Buffer Hits"/>
+          <param name="graph-legend"    value="Small Buffer Hits" />
+          <param name="vertical-label"    value="hps"/>
+        </leaf>
+        <leaf name="Misses">
+          <param name="snmp-object"     value="$bufferSmMiss"/>
+          <param name="rrd-ds"          value="bufferSmMiss" />
+          <param name="comment" value="Small Buffer Misses"/>
+          <param name="graph-legend"    value="Small Buffer Misses" />
+          <param name="vertical-label"    value="mps"/>
+        </leaf>
+        <leaf name="Creates">
+          <param name="snmp-object"     value="$bufferSmCreate"/>
+          <param name="rrd-ds"          value="bufferSmCreate" />
+          <param name="comment" value="Small Buffer Creates"/>
+          <param name="graph-legend"    value="Small Buffer Creates" />
+          <param name="vertical-label"    value="cps"/>
+        </leaf>
+        <leaf name="Trims">
+          <param name="snmp-object"     value="$bufferSmTrim"/>
+          <param name="rrd-ds"          value="bufferSmTrim" />
+          <param name="comment" value="Small Buffer Trims"/>
+          <param name="graph-legend"    value="Small Buffer Trims" />
+          <param name="vertical-label"    value="tps"/>
+        </leaf>
+      </subtree>
+      <subtree name="Medium_Buffers">
+        <param name="precedence"        value="-400" />
+        <leaf name="Free">
+          <param name="rrd-create-dstype" value="GAUGE" />
+          <param name="snmp-object"     value="$bufferMdFree"/>
+          <param name="rrd-ds"          value="bufferMdFree" />
+          <param name="comment" value="Number of Free Medium Buffers"/>
+          <param name="graph-legend"    value="Free Medium Buffers" />
+          <param name="vertical-label"    value="Count"/>
+        </leaf>
+        <leaf name="Max">
+          <param name="rrd-create-dstype" value="GAUGE" />
+          <param name="snmp-object"     value="$bufferMdMax"/>
+          <param name="rrd-ds"          value="bufferMdMax" />
+          <param name="comment" value="Max Medium Buffers"/>
+          <param name="graph-legend"    value="Max Medium Buffers" />
+        </leaf>
+        <leaf name="Hits">
+          <param name="snmp-object"     value="$bufferMdHit"/>
+          <param name="rrd-ds"          value="bufferMdHit" />
+          <param name="comment" value="Medium Buffer Hits"/>
+          <param name="graph-legend"    value="Medium Buffer Hits" />
+          <param name="vertical-label"    value="hps"/>
+        </leaf>
+        <leaf name="Misses">
+          <param name="snmp-object"     value="$bufferMdMiss"/>
+          <param name="rrd-ds"          value="bufferMdMiss" />
+          <param name="comment" value="Medium Buffer Misses"/>
+          <param name="graph-legend"    value="Medium Buffer Misses" />
+          <param name="vertical-label"    value="mps"/>
+        </leaf>
+        <leaf name="Creates">
+          <param name="snmp-object"     value="$bufferMdCreate"/>
+          <param name="rrd-ds"          value="bufferMdCreate" />
+          <param name="comment" value="Medium Buffer Creates"/>
+          <param name="graph-legend"    value="Medium Buffer Creates" />
+          <param name="vertical-label"    value="cps"/>
+        </leaf>
+        <leaf name="Trims">
+          <param name="snmp-object"     value="$bufferMdTrim"/>
+          <param name="rrd-ds"          value="bufferMdTrim" />
+          <param name="comment" value="Medium Buffer Trims"/>
+          <param name="graph-legend"    value="Medium Buffer Trims" />
+          <param name="vertical-label"    value="tps"/>
+        </leaf>
+      </subtree>
+      <subtree name="Big_Buffers">
+        <param name="precedence"        value="-500" />
+        <leaf name="Free">
+          <param name="rrd-create-dstype" value="GAUGE" />
+          <param name="snmp-object"     value="$bufferBgFree"/>
+          <param name="rrd-ds"          value="bufferBgFree" />
+          <param name="comment" value="Number of Free Big Buffers"/>
+          <param name="graph-legend"    value="Free Big Buffers" />
+          <param name="vertical-label"    value="Count"/>
+        </leaf>
+        <leaf name="Max">
+          <param name="rrd-create-dstype" value="GAUGE" />
+          <param name="snmp-object"     value="$bufferBgMax"/>
+          <param name="rrd-ds"          value="bufferBgMax" />
+          <param name="comment" value="Max Big Buffers"/>
+          <param name="graph-legend"    value="Max Big Buffers" />
+          <param name="vertical-label"    value="Count"/>
+        </leaf>
+        <leaf name="Hits">
+          <param name="snmp-object"     value="$bufferBgHit"/>
+          <param name="rrd-ds"          value="bufferBgHit" />
+          <param name="comment" value="Big Buffer Hits"/>
+          <param name="graph-legend"    value="Big Buffer Hits" />
+          <param name="vertical-label"    value="hps"/>
+        </leaf>
+        <leaf name="Misses">
+          <param name="snmp-object"     value="$bufferBgMiss"/>
+          <param name="rrd-ds"          value="bufferBgMiss" />
+          <param name="comment" value="Big Buffer Misses"/>
+          <param name="graph-legend"    value="Big Buffer Misses" />
+          <param name="vertical-label"    value="mps"/>
+        </leaf>
+        <leaf name="Creates">
+          <param name="snmp-object"     value="$bufferBgCreate"/>
+          <param name="rrd-ds"          value="bufferBgCreate" />
+          <param name="comment" value="Big Buffer Creates"/>
+          <param name="graph-legend"    value="Big Buffer Creates" />
+          <param name="vertical-label"    value="cps"/>
+        </leaf>
+        <leaf name="Trims">
+          <param name="snmp-object"     value="$bufferBgTrim"/>
+          <param name="rrd-ds"          value="bufferBgTrim" />
+          <param name="comment" value="Big Buffer Trims"/>
+          <param name="graph-legend"    value="Big Buffer Trims" />
+          <param name="vertical-label"    value="tps"/>
+        </leaf>
+      </subtree>
+      <subtree name="Large_Buffers">
+        <param name="precedence"        value="-600" />
+        <leaf name="Free">
+          <param name="rrd-create-dstype" value="GAUGE" />
+          <param name="snmp-object"     value="$bufferLgFree"/>
+          <param name="rrd-ds"          value="bufferLgFree" />
+          <param name="comment" value="Number of Free Large Buffers"/>
+          <param name="graph-legend"    value="Free Large Buffers" />
+          <param name="vertical-label"    value="Count"/>
+        </leaf>
+        <leaf name="Max">
+          <param name="rrd-create-dstype" value="GAUGE" />
+          <param name="snmp-object"     value="$bufferLgMax"/>
+          <param name="rrd-ds"          value="bufferLgMax" />
+          <param name="comment" value="Max Large Buffers"/>
+          <param name="graph-legend"    value="Max Large Buffers" />
+          <param name="vertical-label"    value="Count"/>
+        </leaf>
+        <leaf name="Hits">
+          <param name="snmp-object"     value="$bufferLgHit"/>
+          <param name="rrd-ds"          value="bufferLgHit" />
+          <param name="comment" value="Large Buffer Hits"/>
+          <param name="graph-legend"    value="Large Buffer Hits" />
+          <param name="vertical-label"    value="hps"/>
+        </leaf>
+        <leaf name="Misses">
+          <param name="snmp-object"     value="$bufferLgMiss"/>
+          <param name="rrd-ds"          value="bufferLgMiss" />
+          <param name="comment" value="Large Buffer Misses"/>
+          <param name="graph-legend"    value="Large Buffer Misses" />
+          <param name="vertical-label"    value="mps"/>
+        </leaf>
+        <leaf name="Creates">
+          <param name="snmp-object"     value="$bufferLgCreate"/>
+          <param name="rrd-ds"          value="bufferLgCreate" />
+          <param name="comment" value="Large Buffer Creates"/>
+          <param name="graph-legend"    value="Large Buffer Creates" />
+          <param name="vertical-label"    value="cps"/>
+        </leaf>
+        <leaf name="Trims">
+          <param name="snmp-object"     value="$bufferLgTrim"/>
+          <param name="rrd-ds"          value="bufferLgTrim" />
+          <param name="comment" value="Large Buffer Trims"/>
+          <param name="graph-legend"    value="Large Buffer Trims" />
+          <param name="vertical-label"    value="tps"/>
+        </leaf>
+      </subtree>
+      <subtree name="Huge_Buffers">
+        <param name="precedence"        value="-700" />
+        <leaf name="Free">
+          <param name="rrd-create-dstype" value="GAUGE" />
+          <param name="snmp-object"     value="$bufferHgFree"/>
+          <param name="rrd-ds"          value="bufferHgFree" />
+          <param name="comment" value="Number of Free Huge Buffers"/>
+          <param name="graph-legend"    value="Free Huge Buffers" />
+          <param name="vertical-label"    value="Count"/>
+        </leaf>
+        <leaf name="Max">
+          <param name="rrd-create-dstype" value="GAUGE" />
+          <param name="snmp-object"     value="$bufferHgMax"/>
+          <param name="rrd-ds"          value="bufferHgMax" />
+          <param name="comment" value="Max Huge Buffers"/>
+          <param name="graph-legend"    value="Max Huge Buffers" />
+          <param name="vertical-label"    value="Count"/>
+        </leaf>
+        <leaf name="Hits">
+          <param name="snmp-object"     value="$bufferHgHit"/>
+          <param name="rrd-ds"          value="bufferHgHit" />
+          <param name="comment" value="Huge Buffer Hits"/>
+          <param name="graph-legend"    value="Huge Buffer Hits" />
+          <param name="vertical-label"    value="hps"/>
+        </leaf>
+        <leaf name="Misses">
+          <param name="snmp-object"     value="$bufferHgMiss"/>
+          <param name="rrd-ds"          value="bufferHgMiss" />
+          <param name="comment" value="Huge Buffer Misses"/>
+          <param name="graph-legend"    value="Huge Buffer Misses" />
+          <param name="vertical-label"    value="mps"/>
+        </leaf>
+        <leaf name="Creates">
+          <param name="snmp-object"     value="$bufferHgCreate"/>
+          <param name="rrd-ds"          value="bufferHgCreate" />
+          <param name="comment" value="Huge Buffer Creates"/>
+          <param name="graph-legend"    value="Huge Buffer Creates" />
+          <param name="vertical-label"    value="cps"/>
+        </leaf>
+        <leaf name="Trims">
+          <param name="snmp-object"     value="$bufferHgTrim"/>
+          <param name="rrd-ds"          value="bufferHgTrim" />
+          <param name="comment" value="Huge Buffer Trims"/>
+          <param name="graph-legend"    value="Huge Buffer Trims" />
+          <param name="vertical-label"    value="tps"/>
+        </leaf>
+      </subtree>
+    </subtree>
+  </template>
+
+  
+  <template name="cisco-ipsec-flow-globals">
+    <subtree name="IPSec_Statistics">
+      <param name="node-display-name" value="IPSec Statistics" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="rrd-hwpredict"     value="disabled" />
+      <param name="data-file"  value="%system-id%_cisco-ipsec-globals.rrd" />
+      <param name="comment"    value="IPSec traffic statistics" />
+      <param name="precedence"        value="-200" />
+      
+      <leaf name="Active_Tunnels">
+        <param name="snmp-object"     value="$cipSecGlobalActiveTunnels"/>
+        <param name="rrd-create-dstype" value="GAUGE" />
+        <param name="rrd-ds"            value="ActiveTunnels" />
+        <param name="comment"   value="Currently active IPSec tunnels" />
+        <param name="graph-legend"   value="Active tunnels" />
+        <param name="vertical-label" value="" />
+        <param name="graph-lower-limit" value="0"/>
+        <param name="precedence"        value="1000" />
+      </leaf>
+
+      <leaf name="InOut_bps">
+        <param name="comment"
+               value="Input and Output encrypted bits per second" />
+        <param name="vertical-label"   value="bps" />
+        <param name="graph-lower-limit" value="0" />
+        <param name="precedence"       value="900" />
+        <param name="ds-type"          value="rrd-multigraph" />
+        <param name="ds-names"         value="in,out" />
+
+        <param name="ds-expr-in"       value="{Bytes_In},8,*" />
+        <param name="graph-legend-in"  value="Bits per second in" />
+        <param name="line-style-in"    value="##BpsIn" />
+        <param name="line-color-in"    value="##BpsIn" />
+        <param name="line-order-in"    value="1" />
+
+        <param name="ds-expr-out"      value="{Bytes_Out},8,*" />
+        <param name="graph-legend-out" value="Bits per second out" />
+        <param name="line-style-out"   value="##BpsOut" />
+        <param name="line-color-out"   value="##BpsOut" />
+        <param name="line-order-out"   value="2" />
+      </leaf>
+      
+      <leaf name="Bytes_In">
+        <param name="snmp-object"     value="$cipSecGlobalHcInOctets"/>
+        <param name="snmp-object-type"  value="COUNTER64" />
+        <param name="rrd-ds"            value="InOctets" />
+        <param name="comment"   value="Input bytecount of encrypted packets" />
+        <param name="graph-legend"   value="Bytes in" />
+        <param name="vertical-label" value="Bps" />
+        <param name="graph-lower-limit" value="0"/>
+        <param name="precedence"        value="990" />
+      </leaf>
+      
+      <leaf name="Bytes_Out">
+        <param name="snmp-object"     value="$cipSecGlobalHcOutOctets"/>
+        <param name="snmp-object-type"  value="COUNTER64" />
+        <param name="rrd-ds"          value="OutOctets" />
+        <param name="comment" value="Output bytecount of encrypted packets" />
+        <param name="graph-legend"   value="Bytes out" />
+        <param name="vertical-label" value="Bps" />
+        <param name="graph-lower-limit" value="0"/>
+        <param name="precedence"        value="980" />
+      </leaf>
+      
+      <leaf name="Packets_In">
+        <param name="snmp-object"     value="$cipSecGlobalInPkts"/>
+        <param name="rrd-ds"          value="InPkts" />
+        <param name="comment"   value="Input counter of encrypted packets" />
+        <param name="graph-legend"   value="Packets in" />
+        <param name="vertical-label" value="pps" />
+        <param name="graph-lower-limit" value="0"/>
+        <param name="precedence"        value="890" />
+      </leaf>
+
+      <leaf name="Packets_Out">
+        <param name="snmp-object"     value="$cipSecGlobalOutPkts"/>
+        <param name="rrd-ds"          value="OutPkts" />
+        <param name="comment"   value="Output counter of encrypted packets" />
+        <param name="graph-legend"   value="Packets out" />
+        <param name="vertical-label" value="pps" />
+        <param name="graph-lower-limit" value="0"/>
+        <param name="precedence"        value="880" />
+      </leaf>
+
+      <leaf name="Dropped_In">
+        <param name="snmp-object"     value="$cipSecGlobalInDrops"/>
+        <param name="rrd-ds"          value="InDrops" />
+        <param name="comment"   value="Input count of dropped packets" />
+        <param name="graph-legend"   value="Dropped in" />
+        <param name="vertical-label" value="pps" />
+        <param name="graph-lower-limit" value="0"/>
+        <param name="precedence"        value="790" />
+      </leaf>
+      
+      <leaf name="Dropped_Out">
+        <param name="snmp-object"     value="$cipSecGlobalOutDrops"/>
+        <param name="rrd-ds"          value="OutDrops" />
+        <param name="comment"   value="Output count of dropped packets" />
+        <param name="graph-legend"   value="Dropped out" />
+        <param name="vertical-label" value="pps" />
+        <param name="graph-lower-limit" value="0"/>
+        <param name="precedence"        value="780" />
+      </leaf>
+    </subtree>
+  </template>
+
+  <template name="cisco-bgp">
+    <param name="data-file">
+      %system-id%_%peer-index%_cbgp.rrd
+    </param>
+
+    <param name="rrd-create-dstype" value="GAUGE" />
+    <param name="graph-title" value="%descriptive-nickname%" />
+    <param name="graph-lower-limit" value="0" />
+    <param name="vertical-label" value="prefixes" />
+    <param name="graph-legend"    value="Accepted" />      
+    <param name="snmp-object"
+          value="$cbgpPeerAcceptedPrefixes.%peer-index%"/>
+    <param name="rrd-ds"          value="Accepted" />
+  </template>
+
+
+  <template name="cisco-car-subtree">
+    <param name="data-file">
+      %system-id%_%interface-nick%_%car-direction%_%car-index%_ccar.rrd
+    </param>
+
+    <param name="descriptive-nickname" value="%system-id%:%interface-name%"/>
+    <param name="collector-timeoffset-hashstring"
+                                      value="%system-id%:%interface-nick%"/>
+    <param name="graph-title" value="%descriptive-nickname%" />
+    <param name="graph-lower-limit" value="0" />    
+  </template>
+  
+  <template name="cisco-car">
+    <leaf name="Current_Burst">
+      <param name="comment"     value="Current received burst size" />
+      <param name="graph-legend"    value="Burst" />      
+      <param name="snmp-object"
+          value="$ccarStatCurBurst.%ifindex-map%.%car-direction%.%car-index%"/>
+      <param name="rrd-ds"          value="Burst" />
+      <param name="rrd-create-dstype" value="GAUGE" />
+      <param name="vertical-label" value="bytes" />
+    </leaf>
+    
+    <leaf name="Switched_Packets">
+      <param name="comment"
+         value="Packets per second permitted by the rate limit" />
+      <param name="graph-legend"    value="Switched Packets" />      
+      <param name="snmp-object">
+         $ccarStatHCSwitchedPkts.%ifindex-map%.%car-direction%.%car-index%
+      </param>
+      <param name="rrd-ds"          value="SwPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="snmp-object-type"  value="COUNTER64" />
+      <param name="vertical-label" value="pps" />
+    </leaf>
+
+    <leaf name="Switched_Bytes">
+      <param name="comment"
+         value="Bytes per second permitted by the rate limit" />
+      <param name="graph-legend"    value="Switched Bytes" />      
+      <param name="snmp-object">
+         $ccarStatHCSwitchedBytes.%ifindex-map%.%car-direction%.%car-index%
+      </param>
+      <param name="rrd-ds"          value="SwBytes" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="snmp-object-type"  value="COUNTER64" />
+      <param name="vertical-label" value="bytes/s" />
+      <param name="hidden" value="yes" />
+    </leaf>
+
+    <leaf name="Filtered_Packets">
+      <param name="comment"
+         value="Packets per second filtered by the rate limit" />
+      <param name="graph-legend"    value="Filtered Packets" />      
+      <param name="snmp-object">
+         $ccarStatHCFilteredPkts.%ifindex-map%.%car-direction%.%car-index%
+      </param>
+      <param name="rrd-ds"          value="FltrPkts" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="snmp-object-type"  value="COUNTER64" />
+      <param name="vertical-label" value="pps" />
+    </leaf>
+
+    <leaf name="Filtered_Bytes">
+      <param name="comment"
+         value="Bytes per second filtered by the rate limit" />
+      <param name="graph-legend"    value="Filtered Bytes" />      
+      <param name="snmp-object">
+         $ccarStatHCFilteredBytes.%ifindex-map%.%car-direction%.%car-index%
+      </param>
+      <param name="rrd-ds"          value="FltrBytes" />
+      <param name="rrd-create-dstype" value="COUNTER" />
+      <param name="snmp-object-type"  value="COUNTER64" />
+      <param name="vertical-label" value="bytes/s" />
+      <param name="hidden" value="yes" />
+    </leaf>
+
+    <leaf name="Switched_Bps">
+      <param name="comment"
+         value="Bit per second permitted by the rate limit" />
+      <param name="vertical-label" value="bps" />
+      
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="bytes" />
+
+      <param name="ds-expr-bytes"    value="{Switched_Bytes},8,*" />
+      <param name="graph-legend-bytes"  value="Switched" />
+      <param name="line-style-bytes"    value="##SingleGraph" />
+      <param name="line-color-bytes"    value="##SingleGraph" />
+      <param name="line-order-bytes"    value="1" />      
+    </leaf>
+    
+    <leaf name="Filtered_Bps">
+      <param name="comment"
+         value="Bit per second filtered by the rate limit" />
+      <param name="vertical-label" value="bps" />
+      
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="bytes" />
+
+      <param name="ds-expr-bytes"    value="{Filtered_Bytes},8,*" />
+      <param name="graph-legend-bytes"  value="Filtered" />
+      <param name="line-style-bytes"    value="##SingleGraph" />
+      <param name="line-color-bytes"    value="##SingleGraph" />
+      <param name="line-order-bytes"    value="1" />      
+    </leaf>            
+  </template>
+
+
+  <template name="cisco-vpdn-subtree">
+    <param name="has-overview-shortcuts"    value="yes"/>
+    <param name="overview-shortcuts"        value="tunnel,session,deny"/>
+    <!-- Total Tunnels -->
+    <param name="overview-subleave-name-tunnel"  value="Tunnel_Total"/>
+    <param name="overview-shortcut-text-tunnel"
+           value="All VPDN tunnels"/>
+    <param name="overview-shortcut-title-tunnel"
+           value="Show all VPDN tunnels graphs in one page"/>
+    <param name="overview-page-title-tunnel"
+           value="VPDN Total Number"/>
+    <!-- Total Sessions -->
+    <param name="overview-subleave-name-session"  value="Session_Total"/>
+    <param name="overview-shortcut-text-session"
+           value="All VPDN sessions"/>
+    <param name="overview-shortcut-title-session"
+           value="Show all VPDN session graphs in one page"/>
+    <param name="overview-page-title-session"
+           value="VPDN Total Sessions"/>
+    <!-- Denied Users -->
+    <param name="overview-subleave-name-deny"  value="Denied_Users"/>
+    <param name="overview-shortcut-text-deny"
+           value="All denied users"/>
+    <param name="overview-shortcut-title-deny"
+           value="Show all denied user graphs in one page"/>
+    <param name="overview-page-title-deny"
+           value="VPDN denied users"/>
+  </template>
+
+  <template name="cisco-vpdn-leaf">
+    <param name="data-file"      value="%system-id%_cisco-vpdn_%tunFile%.rrd" />
+    <param name="precedence"     value="-200" />
+    <param name="rrd-hwpredict"  value="disabled" />
+    <param name="rrd-create-dstype" value="GAUGE" />
+
+    <leaf name="Tunnel_Total">
+      <param name="snmp-object"
+         value="$cvpdnSystemTunnelTotal.%tunIndex%" />
+      <param name="rrd-ds"            value="cvpdnSysTunTotal" />
+      <param name="comment"   
+             value="Total number of active VPDN tunnels" />
+      <param name="graph-legend"      value="Number of VPDN tunnels" />
+      <param name="vertical-label"    value="tunnels" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="999" />
+    </leaf>
+
+    <leaf name="Session_Total">
+      <param name="snmp-object"
+         value="$cvpdnSystemSessionTotal.%tunIndex%" />
+      <param name="rrd-ds"            value="cvpdnSysSessTotal" />
+      <param name="comment"   
+             value="Total number of active sessions in active VPDN tunnels" />
+      <param name="graph-legend"      value="Number of sessions" />
+      <param name="vertical-label"    value="sessions" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="998" />
+    </leaf>
+
+    <leaf name="Denied_Users">
+      <param name="snmp-object"
+         value="$cvpdnSystemDeniedUsersTotal.%tunIndex%" />
+      <param name="rrd-ds"            value="cvpdnSysDenyUsers" />
+      <param name="comment"   
+             value="Total number of denied users to all VPDN tunnels "/>
+      <param name="graph-legend"      value="Number of denied users" />
+      <param name="vertical-label"    value="attempts" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="997" />
+    </leaf>
+  </template>
+    
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/cisco.sce.xml b/torrus/xmlconfig/vendor/cisco.sce.xml
new file mode 100644 (file)
index 0000000..e1d7493
--- /dev/null
@@ -0,0 +1,668 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2007 Jon Nistor
+   Copyright (C) 2007 Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: cisco.sce.xml,v 1.1 2010-12-27 00:04:07 ivan Exp $
+  Jon Nistor <nistor at snickers dot org>
+
+-->
+<!-- Cisco Service Control Engine specific definitions -->
+
+<configuration>
+
+<definitions>
+  <!-- PCUBE-SE-MIB::diskGrp -->
+  <def name="diskNumUsedBytes" value="1.3.6.1.4.1.5655.4.1.5.1.0" />
+  <def name="diskNumFreeBytes" value="1.3.6.1.4.1.5655.4.1.5.2.0" />
+
+  <!-- PCUBE-SE-MIB::rdrFormatterGrp -->
+  <def name="rdrFormatterNumReportsDiscarded"
+                                         value="1.3.6.1.4.1.5655.4.1.6.4.0" />
+  <def name="rdrFormatterReportRate"     value="1.3.6.1.4.1.5655.4.1.6.6.0" />
+  <def name="rdrFormatterReportRatePeak" value="1.3.6.1.4.1.5655.4.1.6.7.0" />
+  <def name="rdrFormatterCategoryNumReportsSent"
+                                  value="1.3.6.1.4.1.5655.4.1.6.11.1.3" />
+  <def name="rdrFormatterCategoryNumReportsDiscarded"
+                                  value="1.3.6.1.4.1.5655.4.1.6.11.1.4" />
+  <def name="rdrFormatterCategoryReportRate"
+                                  value="1.3.6.1.4.1.5655.4.1.6.11.1.5" />
+  <def name="rdrFormatterCategoryReportRatePeak"
+                                  value="1.3.6.1.4.1.5655.4.1.6.11.1.6" />
+  <def name="rdrFormatterCategoryNumReportsQueued" 
+                                  value="1.3.6.1.4.1.5655.4.1.6.11.1.8" />
+
+  <!-- PCUBE-SE-MIB::subscribersInfoEntry -->
+  <def name="subNumIntroduced"    value="1.3.6.1.4.1.5655.4.1.8.1.1.1.1" />
+  <def name="subNumFree"          value="1.3.6.1.4.1.5655.4.1.8.1.1.2.1" />
+  <def name="subNumIpAddrMappings"
+                                  value="1.3.6.1.4.1.5655.4.1.8.1.1.3.1" />
+  <def name="subNumIpAddrMappingsFree"
+                                  value="1.3.6.1.4.1.5655.4.1.8.1.1.4.1" />
+  <def name="subNumIpRangeMappings"
+                                  value="1.3.6.1.4.1.5655.4.1.8.1.1.5.1" />
+  <def name="subNumIpRangeMappingsFree"
+                                  value="1.3.6.1.4.1.5655.4.1.8.1.1.6.1" />
+  <def name="subNumVlanMappings"  value="1.3.6.1.4.1.5655.4.1.8.1.1.7.1" />
+  <def name="subNumVlanMappingsFree"
+                                  value="1.3.6.1.4.1.5655.4.1.8.1.1.8.1" />
+  <def name="subNumActive"        value="1.3.6.1.4.1.5655.4.1.8.1.1.9.1" />
+  <def name="subNumActivePeak"    value="1.3.6.1.4.1.5655.4.1.8.1.1.10.1" />
+  <def name="subNumUpdates"       value="1.3.6.1.4.1.5655.4.1.8.1.1.12.1" />
+  <def name="subNumTpIpRanges"    value="1.3.6.1.4.1.5655.4.1.8.1.1.14.1" />
+  <def name="subNumTpIpRangesFree"
+                                  value="1.3.6.1.4.1.5655.4.1.8.1.1.15.1" />
+  <def name="subNumAnonymous"     value="1.3.6.1.4.1.5655.4.1.8.1.1.16.1" />
+  <def name="subNumWithSessions"  value="1.3.6.1.4.1.5655.4.1.8.1.1.17.1" />
+
+
+  <!-- PCUBE-SE-MIB::tpInfoEntry -->
+  <def name="tpNumActiveFlows"     value="1.3.6.1.4.1.5655.4.1.9.1.1.5.1" />
+  <def name="tpNumTcpActiveFlows"  value="1.3.6.1.4.1.5655.4.1.9.1.1.8.1" />
+  <def name="tpNumUdpActiveFlows"  value="1.3.6.1.4.1.5655.4.1.9.1.1.11.1" />
+  <def name="tpTotalNumDiscardedPacketsDueToBwLimit"
+                                   value="1.3.6.1.4.1.5655.4.1.9.1.1.19.1" />
+  <def name="tpTotalNumWredDiscardedPackets"
+                                   value="1.3.6.1.4.1.5655.4.1.9.1.1.20.1" />
+  <def name="tpHandledPacketsRate" value="1.3.6.1.4.1.5655.4.1.9.1.1.29.1" />
+  <def name="tpHandledFlowsRate"   value="1.3.6.1.4.1.5655.4.1.9.1.1.32.1" />
+  <def name="tpCpuUtilization"     value="1.3.6.1.4.1.5655.4.1.9.1.1.35.1" />
+  <def name="tpFlowsCapacityUtilization"
+                                   value="1.3.6.1.4.1.5655.4.1.9.1.1.38.1" />
+
+  <!-- PCUBE-SE-MIB::txQueuesTable -->
+  <def name="txQueuesUtilization"
+                                   value="1.3.6.1.4.1.5655.4.1.11.1.1.6.1" />
+  
+  <!-- CISCO-SCAS-BB-MIB::linkServiceUsageTable -->
+  <def name="linkServiceUsageUpVolume"
+                                 value="1.3.6.1.4.1.5655.4.2.2.1.1.1.1" />
+  <def name="linkServiceUsageDownVolume"
+                                 value="1.3.6.1.4.1.5655.4.2.2.1.1.2.1" />
+  <def name="linkServiceUsageConcurrentSessions"
+                                 value="1.3.6.1.4.1.5655.4.2.2.1.1.5.1" />
+  
+                                   
+</definitions>
+
+
+<datasources>
+  <template name="cisco-sce-disk">
+    <param name="scedisk-datafile"  value="%system-id%_SCE_disk.rrd"/>
+    <subtree name="SCE_Disk">
+      <param name="comment">
+        Disk usage information
+      </param>
+      <param name="data-file"         value="%scedisk-datafile%"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="vertical-label"    value="Bytes"/>
+
+      <leaf name="Usage">
+        <param name="precedence"         value="1000"/>
+        <param name="comment"            value="Total vs Used disk space"/>
+        <param name="graph-title"        value="Disk Usage"/>
+        <param name="ds-type"            value="rrd-multigraph"/>
+        <param name="ds-names"           value="total,used"/>
+        <param name="graph-lower-limit"  value="0"/>
+        <!-- total -->
+        <param name="ds-expr-total"      value="{Used},{Free},+"/>
+        <param name="graph-legend-total" value="Total"/>
+        <param name="line-style-total"   value="##totalresource"/>
+        <param name="line-color-total"   value="##totalresource"/>
+        <param name="line-order-total"   value="1"/>
+        <!-- used -->
+        <param name="ds-expr-used"       value="{Used}"/>
+        <param name="graph-legend-used"  value="Used"/>
+        <param name="line-style-used"    value="##resourceusage"/>
+        <param name="line-color-used"    value="##resourceusage"/>
+        <param name="line-order-used"    value="2"/>
+      </leaf>
+      
+      <leaf name="Used">
+        <param name="comment"         value="The number of used bytes"/>
+        <param name="graph-legend"    value="Space used"/>
+        <param name="rrd-ds"          value="usedBytes"/>
+        <param name="snmp-object"     value="$diskNumUsedBytes"/>
+      </leaf>
+      
+      <leaf name="Free">
+        <param name="comment"         value="The number of free bytes"/>
+        <param name="graph-legend"    value="Space available"/>
+        <param name="rrd-ds"          value="freeBytes"/>
+        <param name="snmp-object"     value="$diskNumFreeBytes"/>
+      </leaf>
+    </subtree>
+  </template>
+    
+  <template name="cisco-sce-rdr">
+    <param name="scerdr-datafile"  value="%system-id%_SCE_RDR.rrd"/>
+    <subtree name="SCE_RDR">
+      <param name="comment">
+        Raw Data Record information
+      </param>
+      <param name="data-file"         value="%scerdr-datafile%"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="vertical-label"    value="RDRs/s"/>
+      <leaf name="Report_Rate_vs_Peak">
+        <param name="comment"
+                       value="The rate of RDR exports vs the peak recorded"/>
+        <param name="precedence"          value="1000"/>
+        <param name="ds-type"             value="rrd-multigraph"/>
+        <param name="ds-names"            value="rate,peak"/>
+        <!-- Reports per second Peak -->
+        <param name="ds-expr-peak"        value="{Report_RatePeak}"/>
+        <param name="graph-legend-peak"   value="Reports per second Peak"/>
+        <param name="line-style-peak"     value="##totalresource"/>
+        <param name="line-color-peak"     value="##totalresource"/>
+        <param name="line-order-peak"     value="1"/>
+        <!-- Reports per second -->
+        <param name="ds-expr-rate"        value="{Report_Rate}"/>
+        <param name="graph-legend-rate"   value="Reports per second"/>
+        <param name="line-style-rate"     value="##resourceusage"/>
+        <param name="line-color-rate"     value="##resourceusage"/>
+        <param name="line-order-rate"     value="2"/>
+      </leaf>
+
+      <leaf name="Report_Rate">
+        <param name="comment"  value="The rate of reports sent per second"/>
+        <param name="graph-legend"    value="Reports per second"/>
+        <param name="rrd-ds"          value="reportRate"/>
+        <param name="snmp-object"     value="$rdrFormatterReportRate"/>
+      </leaf>
+      
+      <leaf name="Report_RatePeak">
+        <param name="comment"         value="The max rate of reports sent"/>
+        <param name="graph-legend"    value="Reports per second peak"/>
+        <param name="rrd-ds"          value="reportRatePeak"/>
+        <param name="snmp-object"     value="$rdrFormatterReportRatePeak"/>
+      </leaf>
+      
+      <leaf name="Reports_Discarded">
+        <param name="comment"     value="Total number of reports discarded"/>
+        <param name="graph-legend"    value="Num of reports"/>
+        <param name="rrd-ds"          value="reportsDiscarded"/>
+        <param name="snmp-object"  value="$rdrFormatterNumReportsDiscarded"/>
+      </leaf>
+      
+    </subtree>
+  </template>
+
+  <template name="cisco-sce-rdr-category-subtree">
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="rate,discards"/>
+    <!-- Rate --> 
+    <param name="overview-subleave-name-rate" value="Report_Rate"/>
+    <param name="overview-shortcut-text-rate"
+           value="All Report Rates"/>
+    <param name="overview-shortcut-title-rate"
+           value="Show RDR Report Rate for all categories on one page"/>
+    <param name="overview-page-title-rate"
+           value="Category RDR Report Rates"/>
+    <!-- Discards -->
+    <param name="overview-subleave-name-discards" value="Reports_Discarded"/>
+    <param name="overview-shortcut-text-discards"
+           value="All Report Discards"/>
+    <param name="overview-shortcut-title-discards"
+           value="Show discarded RDR rate on one page"/>
+    <param name="overview-page-title-discards"
+           value="RDR Reports discarded"/>
+  </template>
+
+  <template name="cisco-sce-rdr-category">
+    <param name="comment"            value="%sce-rdr-comment%"/>
+    <param name="data-file"
+        value="%system-id%_SCE_RDR_category_%sce-rdr-index%.rrd"/>
+    <param name="rrd-create-dstype"  value="GAUGE"/>
+    <param name="vertical-label"     value="RDRs/s"/>
+    <param name="graph-lower-limit"  value="0" />
+    <param name="graph-title"        value="%system-id%:%sce-rdr-comment%"/>
+
+      <leaf name="Report_Rate_vs_Peak">
+        <param name="comment"
+                       value="The rate of RDR exports vs the peak recorded"/>
+        <param name="precedence"          value="1000"/>
+        <param name="ds-type"             value="rrd-multigraph"/>
+        <param name="ds-names"            value="rate,peak"/>
+        <!-- Reports per second Peak -->
+        <param name="ds-expr-peak"        value="{Report_RatePeak}"/>
+        <param name="graph-legend-peak"   value="Reports per second Peak"/>
+        <param name="line-style-peak"     value="##totalresource"/>
+        <param name="line-color-peak"     value="##totalresource"/>
+        <param name="line-order-peak"     value="1"/>
+        <!-- Reports per second -->
+        <param name="ds-expr-rate"        value="{Report_Rate}"/>
+        <param name="graph-legend-rate"   value="Reports per second"/>
+        <param name="line-style-rate"     value="##resourceusage"/>
+        <param name="line-color-rate"     value="##resourceusage"/>
+        <param name="line-order-rate"     value="2"/>
+      </leaf>
+
+      <leaf name="Report_Rate">
+        <param name="comment"  value="The rate of reports sent per second"/>
+        <param name="graph-legend"    value="Reports per second"/>
+        <param name="rrd-ds"          value="reportRate"/>
+        <param name="snmp-object"
+              value="$rdrFormatterCategoryReportRate.%sce-rdr-index%"/>
+      </leaf>
+
+      <leaf name="Report_RatePeak">
+        <param name="comment"         value="The max rate of reports sent"/>
+        <param name="graph-legend"    value="Reports per second peak"/>
+        <param name="rrd-ds"          value="reportRatePeak"/>
+        <param name="snmp-object"
+              value="$rdrFormatterCategoryReportRatePeak.%sce-rdr-index%"/>
+      </leaf>
+      
+      <leaf name="Reports_Discarded">
+        <param name="comment"     value="Total number of reports discarded"/>
+        <param name="graph-legend"    value="Num of reports"/>
+        <param name="rrd-ds"          value="reportsDiscarded"/>
+        <param name="snmp-object"
+           value="$rdrFormatterCategoryNumReportsDiscarded.%sce-rdr-index%"/>
+      </leaf>
+      
+  </template>
+
+
+  <template name="cisco-sce-subscribers">
+    <subtree name="SCE_Subscribers">
+      <param name="comment">
+        Subscriber usage information
+      </param>
+      <param name="data-file"         value="%system-id%_SCE_subscribers.rrd"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="vertical-label"    value="Subscribers"/>
+
+      <leaf name="Introduced">
+        <param name="comment"
+                          value="Number of subscribers introduced to the SCE"/>
+        <param name="graph-legend"    value="used"/>
+        <param name="rrd-ds"          value="NumIntroduced"/>
+        <param name="snmp-object"     value="$subNumIntroduced"/>
+      </leaf>
+      
+      <leaf name="Free">
+        <param name="comment"         value="Number of subscribers available"/>
+        <param name="graph-legend"    value="available"/>
+        <param name="rrd-ds"          value="NumFree"/>
+        <param name="snmp-object"     value="$subNumFree"/>
+      </leaf>
+      
+      <leaf name="IP_Addr_Mappings">
+        <param name="comment"    value="Number of IP to subscriber mappings"/>
+        <param name="graph-legend"    value="used"/>
+        <param name="rrd-ds"          value="NumIpAddrMap"/>
+        <param name="snmp-object"     value="$subNumIpAddrMappings"/>
+      </leaf>
+      
+      <leaf name="IP_Addr_Mappings_Free">
+        <param name="comment"
+                     value="Number of IP to subscriber mappings available"/>
+        <param name="graph-legend"    value="available"/>
+        <param name="rrd-ds"          value="NumIpAddrMapFree"/>
+        <param name="snmp-object"     value="$subNumIpAddrMappingsFree"/>
+      </leaf>
+      
+      <leaf name="IP_Range_Mappings">
+        <param name="comment"  value="Number of IP-range to subs mappings"/>
+        <param name="graph-legend"    value="used"/>
+        <param name="rrd-ds"          value="NumIpRangeMap"/>
+        <param name="snmp-object"     value="$subNumIpRangeMappings"/>
+      </leaf>
+      
+      <leaf name="IP_Range_Mappings_Free">
+        <param name="comment"
+                      value="Number of IP-range to subs mappings available"/>
+        <param name="graph-legend"    value="available"/>
+        <param name="rrd-ds"          value="NumIpRangeMapFree"/>
+        <param name="snmp-object"     value="$subNumIpRangeMappingsFree"/>
+      </leaf>
+      
+      <leaf name="Vlan_Mappings">
+        <param name="comment"
+                     value="Number of used 'VLAN to subscribers' mappings"/>
+        <param name="graph-legend"    value="vlans"/>
+        <param name="rrd-ds"          value="NumVlanMap"/>
+        <param name="snmp-object"     value="$subNumVlanMappings"/>
+      </leaf>
+      
+      <leaf name="Vlan_Mappings_Free">
+        <param name="comment"
+                     value="Number of free 'VLAN to subscriber' mappings"/>
+        <param name="graph-legend"    value="vlans"/>
+        <param name="rrd-ds"          value="NumVlanMapFree"/>
+        <param name="snmp-object"     value="$subNumVlanMappingsFree"/>
+      </leaf>
+      
+      <leaf name="Subs_Active">
+        <param name="comment"         value="Number of active subscribers"/>
+        <param name="graph-legend"    value="subs"/>
+        <param name="rrd-ds"          value="NumActive"/>
+        <param name="snmp-object"     value="$subNumActive"/>
+      </leaf>
+      
+      <leaf name="Subs_Active_Peak">
+        <param name="comment"
+                      value="Number of peak active subscribers"/>
+        <param name="graph-legend"    value="subs"/>
+        <param name="rrd-ds"          value="NumActivePeak"/>
+        <param name="snmp-object"     value="$subNumActivePeak"/>
+      </leaf>
+            
+      <leaf name="TP_IP_Ranges">
+        <param name="comment"
+                     value="Number of 'Traffic Processor IP ranges' used"/>
+        <param name="graph-legend"    value="subs"/>
+        <param name="rrd-ds"          value="NumTpIpRange"/>
+        <param name="snmp-object"     value="$subNumTpIpRanges"/>
+      </leaf>
+      
+      <leaf name="TP_IP_Ranges_Free">
+        <param name="comment"
+                       value="Number of free 'Traffic Processor IP ranges'"/>
+        <param name="graph-legend"    value="subs"/>
+        <param name="rrd-ds"          value="NumTpIpRangeFree"/>
+        <param name="snmp-object"     value="$subNumTpIpRangesFree"/>
+      </leaf>
+      
+      <leaf name="Anonymous">
+        <param name="comment"         value="Number of anonymous subscribers"/>
+        <param name="graph-legend"    value="anonymous subs"/>
+        <param name="rrd-ds"          value="NumAnonymous"/>
+        <param name="snmp-object"     value="$subNumAnonymous"/>
+      </leaf>
+      
+      <leaf name="With_Sessions">
+        <param name="comment"
+                       value="Number of subscribers with open sessions"/>
+        <param name="graph-legend"    value="subs"/>
+        <param name="rrd-ds"          value="NumWithSessions"/>
+        <param name="snmp-object"     value="$subNumWithSessions"/>
+      </leaf>
+      
+    </subtree>
+  </template>
+
+  <template name="cisco-sce-tp-subtree">
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="util,discards"/>
+    <!-- Utilization -->
+    <param name="overview-subleave-name-util" value="CPU_Utilization"/>
+    <param name="overview-shortcut-text-util"
+           value="All CPU Utilization"/>
+    <param name="overview-shortcut-title-util"
+           value="Show CPU utilization for all TPs on one page"/>
+    <param name="overview-page-title-util"
+           value="Traffic Processors Utilization"/>
+    <!-- Discards -->
+    <param name="overview-subleave-name-discards" value="Packets_Discarded"/>
+    <param name="overview-shortcut-text-discards"
+           value="All Discards"/>
+    <param name="overview-shortcut-title-discards"
+           value="Show discarded packet graphs on one page"/>
+    <param name="overview-page-title-discards"
+           value="Packets discarded"/>
+  </template>
+
+  
+  <template name="cisco-sce-tp">
+    <param name="data-file"         value="%system-id%_SCE_tp.rrd"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+    <leaf name="Packets">
+      <param name="comment"
+                   value="Packet rate processed by TP"/>
+      <param name="graph-legend"    value="Processed"/>
+      <param name="vertical-label"  value="pps"/>
+      <param name="rrd-ds"          value="Packets_%sce-tp-index%"/>
+      <param name="snmp-object"
+                value="$tpHandledPacketsRate.%sce-tp-index%"/>
+    </leaf>
+
+    <leaf name="Packets_Discarded">
+      <param name="comment"
+                   value="Discarded packets due to BW limit"/>
+      <param name="graph-legend"    value="Discarded"/>
+      <param name="vertical-label"  value="pps"/>
+      <param name="rrd-ds"          value="PacketsDisc_%sce-tp-index%"/>
+      <param name="snmp-object"
+            value="$tpTotalNumDiscardedPacketsDueToBwLimit.%sce-tp-index%"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+
+    <leaf name="Packets_WRED_Discarded">
+      <param name="comment"
+                   value="Discarded packets due to queue overflow"/>
+      <param name="graph-legend"    value="WRED Discarded"/>
+      <param name="vertical-label"  value="pps"/>
+      <param name="rrd-ds"          value="PacketsWred_%sce-tp-index%"/>
+      <param name="snmp-object"
+            value="$tpTotalNumWredDiscardedPackets.%sce-tp-index%"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+        
+    <leaf name="Flows_Rate">
+      <param name="comment"
+                   value="Flows rate processed by TP"/>
+      <param name="graph-legend"    value="Processed"/>
+      <param name="vertical-label"  value="flows/s"/>
+      <param name="rrd-ds"          value="FlowsRate_%sce-tp-index%"/>
+      <param name="snmp-object"
+                value="$tpHandledFlowsRate.%sce-tp-index%"/>
+    </leaf>
+        
+    <leaf name="Flows_Active">
+      <param name="comment"
+                   value="Number of active flows"/>
+      <param name="graph-legend"    value="Active"/>
+      <param name="vertical-label"  value="flows"/>
+      <param name="rrd-ds"          value="FlowsActive_%sce-tp-index%"/>
+      <param name="snmp-object"
+                value="$tpNumActiveFlows.%sce-tp-index%"/>
+    </leaf>
+
+    <leaf name="Flows_Active_TCP">
+      <param name="comment"
+                   value="Number of active TCP flows"/>
+      <param name="graph-legend"    value="TCP"/>
+      <param name="vertical-label"  value="flows"/>
+      <param name="rrd-ds"          value="FlowsTCP_%sce-tp-index%"/>
+      <param name="snmp-object"
+                value="$tpNumTcpActiveFlows.%sce-tp-index%"/>
+    </leaf>
+
+    <leaf name="Flows_Active_UDP">
+      <param name="comment"
+                   value="Number of active UDP flows"/>
+      <param name="graph-legend"    value="UDP"/>
+      <param name="vertical-label"  value="flows"/>
+      <param name="rrd-ds"          value="FlowsUDP_%sce-tp-index%"/>
+      <param name="snmp-object"
+                value="$tpNumUdpActiveFlows.%sce-tp-index%"/>
+    </leaf>
+
+    <leaf name="CPU_Utilization">
+      <param name="comment"
+                   value="Utilization of TP"/>
+      <param name="graph-legend"    value="Util"/>
+      <param name="vertical-label"  value="percent"/>
+      <param name="rrd-ds"          value="Util_%sce-tp-index%"/>
+      <param name="snmp-object"
+                value="$tpCpuUtilization.%sce-tp-index%"/>
+      <param name="line-style"         value="##resourceusage" />
+      <param name="line-color"         value="##resourceusage" />
+      <param name="graph-lower-limit"  value="0" />
+      <param name="graph-upper-limit"  value="100" />
+    </leaf>
+
+    <leaf name="Flows_Utilization">
+      <param name="comment"
+                   value="Flows capacity utilization"/>
+      <param name="graph-legend"    value="Flows Util"/>
+      <param name="vertical-label"  value="percent"/>
+      <param name="rrd-ds"          value="FlowsUtil_%sce-tp-index%"/>
+      <param name="snmp-object"
+                value="$tpFlowsCapacityUtilization.%sce-tp-index%"/>
+      <param name="line-style"         value="##resourceusage" />
+      <param name="line-color"         value="##resourceusage" />
+      <param name="graph-lower-limit"  value="0" />
+      <param name="graph-upper-limit"  value="100" />
+    </leaf>
+                        
+  </template>
+
+    
+  <template name="cisco-sce-queues-subtree">
+    <param name="data-file"      value="%system-id%_SCE_queues.rrd"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+    <param name="vertical-label"    value="Percent"/>
+    <param name="graph-legend"      value="Queue utilization"/>
+    <param name="graph-title"       value="Queue Utilization"/>
+    <param name="rrd-ds"        value="%sce-port-index%_%sce-queue-index%"/>
+    <param name="snmp-object"
+        value="$txQueuesUtilization.%sce-port-index%.%sce-queue-index%"/>
+    <param name="graph-lower-limit" value="0" />
+  </template>
+
+
+  <template name="cisco-sce-gc-subtree">  
+    <param name="data-file"
+        value="%system-id%_SCE_gc_%sce-link-index%_%sce-gc-index%.rrd"/>
+    <param name="graph-lower-limit" value="0" />
+    <param name="graph-title"        value="%sce-service-name%"/>
+    
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="up,down,sessions"/>
+    <!-- Up Volume -->
+    <param name="overview-subleave-name-up"    value="Up_bps"/>
+    <param name="overview-direct-link-up"      value="yes"/>
+    <param name="overview-direct-link-view-up" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-up"
+           value="Upstream Usage"/>
+    <param name="overview-shortcut-title-up"
+           value="Show upstream bandwidth usage for all services"/>
+    <param name="overview-page-title-up"
+           value="Upstream Usage"/>
+    <!-- Down Volume -->
+    <param name="overview-subleave-name-down"  value="Down_bps"/>
+    <param name="overview-direct-link-down"      value="yes"/>
+    <param name="overview-direct-link-view-down" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-down"
+           value="Downstream Usage"/>
+    <param name="overview-shortcut-title-down"
+           value="Show downstream bandwidth usage for all services"/>
+    <param name="overview-page-title-down"
+           value="Downstream Usage"/>
+    <!-- Sessions -->
+    <param name="overview-subleave-name-sessions" value="Concurrent_Sessions"/>
+    <param name="overview-direct-link-sessions"      value="yes"/>
+    <param name="overview-direct-link-view-sessions"
+                                            value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-sessions"
+           value="Sessions"/>
+    <param name="overview-shortcut-title-sessions"
+           value="Show numbers of concurrent sessions for all services"/>
+    <param name="overview-page-title-sessions"
+           value="Concurrent Sessions"/>
+           
+  </template>
+  
+  <template name="cisco-sce-gcounter">
+    <leaf name="Volume">
+      <param name="comment"
+                     value="InOut volume in kilobytes/s"/>
+      <param name="precedence"          value="1000"/>
+      <param name="ds-type"             value="rrd-multigraph"/>
+      <param name="ds-names"            value="down,up"/>
+      <!-- Volume Download -->
+      <param name="ds-expr-down"        value="{DownVolume},8192,*"/>
+      <param name="graph-legend-down"   value="Bits per second in"/>
+      <param name="line-style-down"     value="##BpsIn"/>
+      <param name="line-color-down"     value="##BpsIn"/>
+      <param name="line-order-down"     value="1"/>
+      <!-- Volume Upload -->
+      <param name="ds-expr-up"          value="{UpVolume},8192,*"/>
+      <param name="graph-legend-up"     value="Bits per second out"/>
+      <param name="line-style-up"       value="##BpsOut"/>
+      <param name="line-color-up"       value="##BpsOut"/>
+      <param name="line-order-up"       value="2"/>
+    </leaf>
+  
+    <leaf name="UpVolume">
+      <param name="comment"
+              value="Upstream volume in kilobytes/s"/>
+      <param name="hidden"          value="yes"/>
+      <param name="rrd-ds"          value="UpVolume"/>
+      <param name="rrd-create-max"  value="200000"/>
+      <param name="snmp-object"
+        value="$linkServiceUsageUpVolume.%sce-link-index%.%sce-gc-index%"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="precedence" value="90"/>
+    </leaf>
+
+    <leaf name="DownVolume">
+      <param name="comment"
+              value="Downstream volume in kilobytes/s"/>
+      <param name="hidden"          value="yes"/>
+      <param name="rrd-ds"          value="DownVolume"/>
+      <param name="rrd-create-max"  value="200000"/>
+      <param name="snmp-object"
+        value="$linkServiceUsageDownVolume.%sce-link-index%.%sce-gc-index%"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="precedence" value="85"/>
+    </leaf>
+    
+    <leaf name="Up_bps">
+      <param name="comment"
+              value="Upstream bandwidth usage per service"/>
+      <param name="graph-legend"    value="Upstream BW"/>
+      <param name="vertical-label"  value="bps"/>
+      <param name="ds-type"         value="rrd-file" />
+      <param name="leaf-type"       value="rrd-cdef" />
+      <param name="rpn-expr"        value="{UpVolume},8192,*" />    
+      <param name="precedence"      value="70"/>
+    </leaf>
+    
+    <leaf name="Down_bps">
+      <param name="comment"
+              value="Downstream bandwidth usage per service"/>
+      <param name="graph-legend"    value="Downstream BW"/>
+      <param name="vertical-label"  value="bps"/>
+      <param name="ds-type"         value="rrd-file" />
+      <param name="leaf-type"       value="rrd-cdef" />
+      <param name="rpn-expr"        value="{DownVolume},8192,*" />    
+      <param name="precedence"      value="65"/>
+    </leaf>
+
+    <leaf name="Concurrent_Sessions">
+      <param name="comment"
+              value="Number of concurrent sessions per service"/>
+      <param name="graph-legend"    value="Sessions"/>
+      <param name="vertical-label"  value=""/>
+      <param name="rrd-ds"          value="Sessions"/>
+      <param name="snmp-object"
+  value="$linkServiceUsageConcurrentSessions.%sce-link-index%.%sce-gc-index%"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="precedence"      value="50"/>
+    </leaf>
+        
+  </template>
+
+</datasources>
+
+</configuration>
+
diff --git a/torrus/xmlconfig/vendor/cisco.vdsl-line.xml b/torrus/xmlconfig/vendor/cisco.vdsl-line.xml
new file mode 100644 (file)
index 0000000..49921c3
--- /dev/null
@@ -0,0 +1,168 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2005  Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+   $Id: cisco.vdsl-line.xml,v 1.1 2010-12-27 00:04:07 ivan Exp $
+-->
+
+
+<!--
+   Cisco VDSL line statistics
+   Tested with: Catalyst 2950 LRE
+-->
+
+
+<configuration>
+
+<definitions>
+  <!-- CISCO-IETF-VDSL-LINE-MIB -->
+  <def name="cvdslCurrSnrMgn"         value="1.3.6.1.4.1.9.10.87.1.1.2.1.5" />
+  <def name="cvdslCurrAtn"            value="1.3.6.1.4.1.9.10.87.1.1.2.1.6" />
+</definitions>
+
+<datasources>
+
+  <template name="cvdsl-subtree">
+    <param name="precedence"     value="-600" />
+    <param name="comment"        value="VDSL line statistics" />
+
+    <param name="data-file"
+               value="%system-id%_%interface-nick%_cvdsl.rrd" />
+
+    <param name="collector-timeoffset-hashstring"
+                                       value="%system-id%:%interface-nick%" />
+    <param name="descriptive-nickname" value="%system-id%:%interface-name%"/>
+    <param name="graph-title"          value="%descriptive-nickname%" />
+
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts" value="snr,atn"/>
+    
+    <param name="overview-subleave-name-snr" value="SNR_Margin"/>
+    <param name="overview-direct-link-snr"      value="yes"/>
+    <param name="overview-direct-link-view-snr" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-snr"
+           value="All SNR"/>
+    <param name="overview-shortcut-title-snr"
+           value="Show SNR Margin graphs for all VDSL lines in one page"/>
+    <param name="overview-page-title-snr"
+           value="SNR Margin Graphs"/>
+
+    <param name="overview-subleave-name-atn" value="Attenuation"/>
+    <param name="overview-direct-link-atn"      value="yes"/>
+    <param name="overview-direct-link-view-atn" value="expanded-dir-html"/>
+    <param name="overview-shortcut-text-atn"
+           value="All Attenuation"/>
+    <param name="overview-shortcut-title-atn"
+           value="Show attenuation graphs for all VDSL lines in one page"/>
+    <param name="overview-page-title-atn"
+           value="Attenuation Graphs"/>
+                      
+    <param name="rrd-hwpredict"     value="disabled" />
+  </template>
+
+
+  <template name="cvdsl-interface">
+  
+    <!-- ********   SNR Margin ************ -->
+    <leaf name="Vtuc_SnrMgn">
+      <param name="comment"            value="VTUC SNR Margin" />
+      <param name="snmp-object"  value="$cvdslCurrSnrMgn.%ifindex-map%.1" />
+      <param name="collector-scale"    value="DUP,100,GT,10,1,IF,/" />
+      <param name="rrd-ds"             value="VtucSnrMgn" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="hidden"             value="yes" />
+    </leaf>
+
+    <leaf name="Vtur_SnrMgn">
+      <param name="comment"            value="VTUR SNR Margin" />
+      <param name="snmp-object"  value="$cvdslCurrSnrMgn.%ifindex-map%.2" />
+      <param name="collector-scale"    value="DUP,100,GT,10,1,IF,/" />
+      <param name="rrd-ds"             value="VturSnrMgn" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="hidden"             value="yes" />
+    </leaf>
+
+    <leaf name="SNR_Margin">
+      <param name="comment"            value="VTUC and VTUR SNR Margin" />
+      <param name="precedence"         value="100" />
+      <param name="ds-type"            value="rrd-multigraph" />
+      <param name="ds-names"           value="vtuc,vtur" />
+
+      <param name="ds-expr-vtuc"       value="{Vtuc_SnrMgn}" />
+      <param name="graph-legend-vtuc"  value="VTUC SNR Margin" />
+      <param name="line-style-vtuc"    value="##nearend" />
+      <param name="line-color-vtuc"    value="##nearend" />
+      <param name="line-order-vtuc"    value="1" />
+
+      <param name="ds-expr-vtur"       value="{Vtur_SnrMgn}" />
+      <param name="graph-legend-vtur"  value="VTUR SNR Margin" />
+      <param name="line-style-vtur"    value="##farend" />
+      <param name="line-color-vtur"    value="##farend" />
+      <param name="line-order-vtur"    value="2" />
+
+      <param name="vertical-label"      value="dB" />
+      <param name="graph-lower-limit"   value="0" />
+    </leaf>
+
+    <!-- ********   Attenuation ************ -->
+    <leaf name="Vtuc_Atn">
+      <param name="comment"            value="VTUC Attenuation" />
+      <param name="snmp-object"  value="$cvdslCurrAtn.%ifindex-map%.1" />
+      <param name="collector-scale"    value="10,/" />
+      <param name="rrd-ds"             value="VtucAtn" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="hidden"             value="yes" />
+    </leaf>
+
+    <leaf name="Vtur_Atn">
+      <param name="comment"            value="VTUR Attenuation" />
+      <param name="snmp-object"  value="$cvdslCurrAtn.%ifindex-map%.2" />
+      <param name="collector-scale"    value="10,/" />
+      <param name="rrd-ds"             value="VturAtn" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="hidden"             value="yes" />
+    </leaf>
+
+    <leaf name="Attenuation">
+      <param name="comment"            value="VTUC and VTUR Attenuation" />
+      <param name="precedence"         value="200" />
+      <param name="ds-type"            value="rrd-multigraph" />
+      <param name="ds-names"           value="vtuc,vtur" />
+
+      <param name="ds-expr-vtuc"       value="{Vtuc_Atn}" />
+      <param name="graph-legend-vtuc"  value="VTUC Attn" />
+      <param name="line-style-vtuc"    value="##nearend" />
+      <param name="line-color-vtuc"    value="##nearend" />
+      <param name="line-order-vtuc"    value="1" />
+
+      <param name="ds-expr-vtur"       value="{Vtur_Atn}" />
+      <param name="graph-legend-vtur"  value="VTUR Attn" />
+      <param name="line-style-vtur"    value="##farend" />
+      <param name="line-color-vtur"    value="##farend" />
+      <param name="line-order-vtur"    value="2" />
+
+      <param name="vertical-label"      value="dB" />
+      <param name="graph-lower-limit"   value="0" />
+    </leaf>
+
+    
+
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/compaq.cim.xml b/torrus/xmlconfig/vendor/compaq.cim.xml
new file mode 100644 (file)
index 0000000..c225399
--- /dev/null
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003  Shawn Ferry
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: compaq.cim.xml,v 1.1 2010-12-27 00:04:25 ivan Exp $
+
+  Compaq Insight Manager
+  MIB files available at
+  http://h18023.www1.hp.com/support/files/server/us/download/19885.html
+-->
+
+<configuration>
+<definitions>
+  <def name="cpqHeTemperatureTable"       value="1.3.6.1.4.1.232.6.2.6.8"/>
+  <def name="cpqHeTemperatureChassis"     value="1.3.6.1.4.1.232.6.2.6.8.1.1"/>
+  <def name="cpqHeTemperatureIndex"       value="1.3.6.1.4.1.232.6.2.6.8.1.2"/>
+  <def name="cpqHeTemperatureLocale"      value="1.3.6.1.4.1.232.6.2.6.8.1.3"/>
+  <def name="cpqHeTemperatureCelsius"     value="1.3.6.1.4.1.232.6.2.6.8.1.4"/>
+  <def name="cpqHeTemperatureHwLocation"  value="1.3.6.1.4.1.232.6.2.6.8.1.8"/>
+  <def name="cpqHeCorrMemTotalErrs"       value="1.3.6.1.4.1.232.6.2.3.3.0"/>
+</definitions>
+
+<datasources>
+  <template name="cpq-cim-temperature-sensor">
+    <param name="data-file"
+           value="%system-id%_cimsensor_%cpq-cim-sensor-nick%.rrd"/>
+    <param name="rrd-ds"            value="sensor"/>
+    <param name="snmp-object"
+           value="$cpqHeTemperatureCelsius.%cpq-cim-sensor-index%"/>
+    <param name="graph-legend"      value="DegC"/>
+    <param name="graph-lower-limit" value="15"/>
+    <param name="graph-upper-limit" value="70"/>
+    <param name="vertical-label"    value="degrees Celsius"/>
+    <param name="rrd-hwpredict"   value="disabled" />
+  </template>
+
+  <template name="cpq-cim-corr-mem-errs">
+    <leaf name="Memory_Correctable_Errors">
+      <param name="data-file"         value="%system-id%_cim_memerr.rrd"/>
+      <param name="comment"           value="Correctable Memory Errors"/>
+      <param name="rrd-ds"            value="correctable_errors"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="rrd-hwpredict"   value="disabled" />
+      <param name="snmp-object"       value="$cpqHeCorrMemTotalErrs"/>
+      <param name="graph-legend"      value="Correctable Errors"/>
+      <param name="vertical-label"    value="Correctable Errors"/>
+      <param name="precedence"        value="-200"/>
+    </leaf>
+  </template>
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/empire.systemedge.ntregperf.xml b/torrus/xmlconfig/vendor/empire.systemedge.ntregperf.xml
new file mode 100644 (file)
index 0000000..e549835
--- /dev/null
@@ -0,0 +1,1204 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003  Shawn Ferry
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: empire.systemedge.ntregperf.xml,v 1.1 2010-12-27 00:04:07 ivan Exp $
+
+  Compaq Insight Manager
+
+-->
+
+<configuration>
+<definitions>
+  <!-- Index is INDEX.0 for 1-128 -->
+  <def name="empireNtregperf" value="1.3.6.1.4.1.546.5.7"/>
+</definitions>
+
+<datasources>
+
+
+  <template name="EmpireSystemedge::NTREGPERF_1.0">
+    <param name="snmp-object"       value="$empireNtregperf.1.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="1"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_2.0">
+    <param name="snmp-object"       value="$empireNtregperf.2.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="2"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_3.0">
+    <param name="snmp-object"       value="$empireNtregperf.3.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="3"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_4.0">
+    <param name="snmp-object"       value="$empireNtregperf.4.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="4"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_5.0">
+    <param name="snmp-object"       value="$empireNtregperf.5.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="5"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_6.0">
+    <param name="snmp-object"       value="$empireNtregperf.6.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="6"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_7.0">
+    <param name="snmp-object"       value="$empireNtregperf.7.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="7"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_8.0">
+    <param name="snmp-object"       value="$empireNtregperf.8.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="8"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_9.0">
+    <param name="snmp-object"       value="$empireNtregperf.9.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="9"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_10.0">
+    <param name="snmp-object"       value="$empireNtregperf.10.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="10"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::TCPConnectionsActive"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_11.0">
+    <param name="snmp-object"       value="$empireNtregperf.11.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="11"/>
+    <apply-template
+        name="EmpireSystemedge::NTREGPERF::TCPConnectionsEstablished"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_12.0">
+    <param name="snmp-object"       value="$empireNtregperf.12.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="12"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::TCPConnectionsPassive"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_13.0">
+    <param name="snmp-object"       value="$empireNtregperf.13.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="13"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::TCPConnectionsReset"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_14.0">
+    <param name="snmp-object"       value="$empireNtregperf.14.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="14"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::TCPConnectionFailures"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_15.0">
+    <param name="snmp-object"       value="$empireNtregperf.15.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="15"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::ProcessorInterruptsSec"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_16.0">
+    <param name="snmp-object"       value="$empireNtregperf.16.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="16"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_17.0">
+    <param name="snmp-object"       value="$empireNtregperf.17.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="17"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_18.0">
+    <param name="snmp-object"       value="$empireNtregperf.18.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="18"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_19.0">
+    <param name="snmp-object"       value="$empireNtregperf.19.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="19"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_20.0">
+    <param name="snmp-object"       value="$empireNtregperf.20.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="20"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_21.0">
+    <param name="snmp-object"       value="$empireNtregperf.21.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="21"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_22.0">
+    <param name="snmp-object"       value="$empireNtregperf.22.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="22"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_23.0">
+    <param name="snmp-object"       value="$empireNtregperf.23.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="23"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_24.0">
+    <param name="snmp-object"       value="$empireNtregperf.24.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="24"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_25.0">
+    <param name="snmp-object"       value="$empireNtregperf.25.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="25"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_26.0">
+    <param name="snmp-object"       value="$empireNtregperf.26.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="26"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_27.0">
+    <param name="snmp-object"       value="$empireNtregperf.27.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="27"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_28.0">
+    <param name="snmp-object"       value="$empireNtregperf.28.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="28"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_29.0">
+    <param name="snmp-object"       value="$empireNtregperf.29.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="29"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_30.0">
+    <param name="snmp-object"       value="$empireNtregperf.30.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="30"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::DNSTotalQueryReceived"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_31.0">
+    <param name="snmp-object"       value="$empireNtregperf.31.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="31"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::DNSTotalResponseSent"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_32.0">
+    <param name="snmp-object"       value="$empireNtregperf.32.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="32"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_33.0">
+    <param name="snmp-object"       value="$empireNtregperf.33.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="33"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_34.0">
+    <param name="snmp-object"       value="$empireNtregperf.34.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="34"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_35.0">
+    <param name="snmp-object"       value="$empireNtregperf.35.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="35"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_36.0">
+    <param name="snmp-object"       value="$empireNtregperf.36.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="36"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_37.0">
+    <param name="snmp-object"       value="$empireNtregperf.37.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="37"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_38.0">
+    <param name="snmp-object"       value="$empireNtregperf.38.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="38"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_39.0">
+    <param name="snmp-object"       value="$empireNtregperf.39.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="39"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_40.0">
+    <param name="snmp-object"       value="$empireNtregperf.40.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="40"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_41.0">
+    <param name="snmp-object"       value="$empireNtregperf.41.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="41"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_42.0">
+    <param name="snmp-object"       value="$empireNtregperf.42.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="42"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_43.0">
+    <param name="snmp-object"       value="$empireNtregperf.43.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="43"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_44.0">
+    <param name="snmp-object"       value="$empireNtregperf.44.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="44"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_45.0">
+    <param name="snmp-object"       value="$empireNtregperf.45.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="45"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_46.0">
+    <param name="snmp-object"       value="$empireNtregperf.46.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="46"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_47.0">
+    <param name="snmp-object"       value="$empireNtregperf.47.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="47"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_48.0">
+    <param name="snmp-object"       value="$empireNtregperf.48.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="48"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_49.0">
+    <param name="snmp-object"       value="$empireNtregperf.49.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="49"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_50.0">
+    <param name="snmp-object"       value="$empireNtregperf.50.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="50"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_51.0">
+    <param name="snmp-object"       value="$empireNtregperf.51.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="51"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_52.0">
+    <param name="snmp-object"       value="$empireNtregperf.52.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="52"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_53.0">
+    <param name="snmp-object"       value="$empireNtregperf.53.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="53"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_54.0">
+    <param name="snmp-object"       value="$empireNtregperf.54.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="54"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_55.0">
+    <param name="snmp-object"       value="$empireNtregperf.55.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="55"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_56.0">
+    <param name="snmp-object"       value="$empireNtregperf.56.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="56"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_57.0">
+    <param name="snmp-object"       value="$empireNtregperf.57.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="57"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_58.0">
+    <param name="snmp-object"       value="$empireNtregperf.58.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="58"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_59.0">
+    <param name="snmp-object"       value="$empireNtregperf.59.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="59"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_60.0">
+    <param name="snmp-object"       value="$empireNtregperf.60.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="60"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_61.0">
+    <param name="snmp-object"       value="$empireNtregperf.61.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="61"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_62.0">
+    <param name="snmp-object"       value="$empireNtregperf.62.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="62"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_63.0">
+    <param name="snmp-object"       value="$empireNtregperf.63.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="63"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_64.0">
+    <param name="snmp-object"       value="$empireNtregperf.64.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="64"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_65.0">
+    <param name="snmp-object"       value="$empireNtregperf.65.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="65"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_66.0">
+    <param name="snmp-object"       value="$empireNtregperf.66.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="66"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_67.0">
+    <param name="snmp-object"       value="$empireNtregperf.67.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="67"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_68.0">
+    <param name="snmp-object"       value="$empireNtregperf.68.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="68"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_69.0">
+    <param name="snmp-object"       value="$empireNtregperf.69.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="69"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_70.0">
+    <param name="snmp-object"       value="$empireNtregperf.70.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="70"/>
+    <apply-template
+        name="EmpireSystemedge::NTREGPERF::MSExchangeISActiveUserCount"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_71.0">
+    <param name="snmp-object"       value="$empireNtregperf.71.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="71"/>
+    <apply-template
+        name="EmpireSystemedge::NTREGPERF::MSExchangeISVirusFilesScanned"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_72.0">
+    <param name="snmp-object"       value="$empireNtregperf.72.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="72"/>
+    <apply-template
+        name="EmpireSystemedge::NTREGPERF::MSExchangeISVirusFilesQuarantined"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_73.0">
+    <param name="snmp-object"       value="$empireNtregperf.73.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="73"/>
+    <apply-template
+        name="EmpireSystemedge::NTREGPERF::MSExchangeISVirusFilesCleaned"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_74.0">
+    <param name="snmp-object"       value="$empireNtregperf.74.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="74"/>
+    <apply-template
+        name="EmpireSystemedge::NTREGPERF::MSExchangeISMailboxMessagesSubmitted"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_75.0">
+    <param name="snmp-object"       value="$empireNtregperf.75.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="75"/>
+    <apply-template
+        name="EmpireSystemedge::NTREGPERF::MSExchangeISMailboxMessagesDelivered"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_76.0">
+    <param name="snmp-object"       value="$empireNtregperf.76.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="76"/>
+    <apply-template
+        name="EmpireSystemedge::NTREGPERF::MSExchangeISMailboxReceiveQueue"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_77.0">
+    <param name="snmp-object"       value="$empireNtregperf.77.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="77"/>
+    <apply-template
+        name="EmpireSystemedge::NTREGPERF::MSExchangeISMailboxSendQueueSize"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_78.0">
+    <param name="snmp-object"       value="$empireNtregperf.78.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="78"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_79.0">
+    <param name="snmp-object"       value="$empireNtregperf.79.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="79"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_80.0">
+    <param name="snmp-object"       value="$empireNtregperf.80.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="80"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_81.0">
+    <param name="snmp-object"       value="$empireNtregperf.81.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="81"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_82.0">
+    <param name="snmp-object"       value="$empireNtregperf.82.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="82"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_83.0">
+    <param name="snmp-object"       value="$empireNtregperf.83.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="83"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_84.0">
+    <param name="snmp-object"       value="$empireNtregperf.84.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="84"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_85.0">
+    <param name="snmp-object"       value="$empireNtregperf.85.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="85"/>
+    <apply-template
+        name="EmpireSystemedge::NTREGPERF::MSExchangeISVMTotal16MBFree"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_86.0">
+    <param name="snmp-object"       value="$empireNtregperf.86.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="86"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_87.0">
+    <param name="snmp-object"       value="$empireNtregperf.87.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="87"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_88.0">
+    <param name="snmp-object"       value="$empireNtregperf.88.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="88"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_89.0">
+    <param name="snmp-object"       value="$empireNtregperf.89.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="89"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_90.0">
+    <param name="snmp-object"       value="$empireNtregperf.90.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="90"/>
+    <apply-template
+        name="EmpireSystemedge::NTREGPERF::SMTPDSTotalMessagesSent"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_91.0">
+    <param name="snmp-object"       value="$empireNtregperf.91.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="91"/>
+    <apply-template
+        name="EmpireSystemedge::NTREGPERF::SMTPDSCurrentActiveConnections"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_92.0">
+    <param name="snmp-object"       value="$empireNtregperf.92.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="92"/>
+    <apply-template
+        name="EmpireSystemedge::NTREGPERF::SMTPRSTotalMessagesReceived"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_93.0">
+    <param name="snmp-object"       value="$empireNtregperf.93.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="93"/>
+    <apply-template
+        name="EmpireSystemedge::NTREGPERF::SMTPRSActiveConnections"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_94.0">
+    <param name="snmp-object"       value="$empireNtregperf.94.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="94"/>
+    <apply-template
+        name="EmpireSystemedge::NTREGPERF::SMTPSSUncheckedmessagescount"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_95.0">
+    <param name="snmp-object"       value="$empireNtregperf.95.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="95"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_96.0">
+    <param name="snmp-object"       value="$empireNtregperf.96.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="96"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_97.0">
+    <param name="snmp-object"       value="$empireNtregperf.97.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="97"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_98.0">
+    <param name="snmp-object"       value="$empireNtregperf.98.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="98"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_99.0">
+    <param name="snmp-object"       value="$empireNtregperf.99.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="99"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_100.0">
+    <param name="snmp-object"       value="$empireNtregperf.100.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="100"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_101.0">
+    <param name="snmp-object"       value="$empireNtregperf.101.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="101"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_102.0">
+    <param name="snmp-object"       value="$empireNtregperf.102.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="102"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_103.0">
+    <param name="snmp-object"       value="$empireNtregperf.103.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="103"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_104.0">
+    <param name="snmp-object"       value="$empireNtregperf.104.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="104"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_105.0">
+    <param name="snmp-object"       value="$empireNtregperf.105.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="105"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_106.0">
+    <param name="snmp-object"       value="$empireNtregperf.106.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="106"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_107.0">
+    <param name="snmp-object"       value="$empireNtregperf.107.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="107"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_108.0">
+    <param name="snmp-object"       value="$empireNtregperf.108.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="108"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_109.0">
+    <param name="snmp-object"       value="$empireNtregperf.109.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="109"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_110.0">
+    <param name="snmp-object"       value="$empireNtregperf.110.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="110"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_111.0">
+    <param name="snmp-object"       value="$empireNtregperf.111.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="111"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_112.0">
+    <param name="snmp-object"       value="$empireNtregperf.112.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="112"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_113.0">
+    <param name="snmp-object"       value="$empireNtregperf.113.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="113"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_114.0">
+    <param name="snmp-object"       value="$empireNtregperf.114.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="114"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_115.0">
+    <param name="snmp-object"       value="$empireNtregperf.115.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="115"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_116.0">
+    <param name="snmp-object"       value="$empireNtregperf.116.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="116"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_117.0">
+    <param name="snmp-object"       value="$empireNtregperf.117.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="117"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_118.0">
+    <param name="snmp-object"       value="$empireNtregperf.118.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="118"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_119.0">
+    <param name="snmp-object"       value="$empireNtregperf.119.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="119"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_120.0">
+    <param name="snmp-object"       value="$empireNtregperf.120.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="120"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_121.0">
+    <param name="snmp-object"       value="$empireNtregperf.121.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="121"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_122.0">
+    <param name="snmp-object"       value="$empireNtregperf.122.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="122"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_123.0">
+    <param name="snmp-object"       value="$empireNtregperf.123.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="123"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_124.0">
+    <param name="snmp-object"       value="$empireNtregperf.124.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="124"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_125.0">
+    <param name="snmp-object"       value="$empireNtregperf.125.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="125"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_126.0">
+    <param name="snmp-object"       value="$empireNtregperf.126.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="126"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_127.0">
+    <param name="snmp-object"       value="$empireNtregperf.127.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="127"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF_128.0">
+    <param name="snmp-object"       value="$empireNtregperf.128.0"/>
+    <param name="rrd-ds"            value="ntregperf"/>
+    <param name="INDEX"             value="128"/>
+    <apply-template name="EmpireSystemedge::NTREGPERF::"/>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::">
+  </template>
+
+<!-- Value Measurements -->
+
+  <template name="EmpireSystemedge::NTREGPERF::TCPConnectionsActive">
+    <leaf name="TCPConnectionsActive">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_TCPConnectionsActive.rrd"/>
+      <param name="comment"           value="TCP Connections Active"/>
+      <param name="graph-legend"      value="TCP Connections Active"/>
+      <param name="vertical-label"    value="Active"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::TCPConnectionsEstablished">
+    <leaf name="TCPConnectionsEstablished">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_TCPConnectionsEstablished.rrd"/>
+      <param name="comment"           value="TCP Connections Established"/>
+      <param name="graph-legend"      value="TCP Connections Established"/>
+      <param name="vertical-label"    value="Established"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::TCPConnectionsPassive">
+    <leaf name="TCPConnectionsPassive">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_TCPConnectionsPassive.rrd"/>
+      <param name="comment"           value="TCP Connections Passive"/>
+      <param name="graph-legend"      value="TCP Connections Passive"/>
+      <param name="vertical-label"    value="Passive"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::TCPConnectionsReset">
+    <leaf name="TCPConnectionsReset">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_TCPConnectionsReset.rrd"/>
+      <param name="comment"           value="TCP Connections Reset"/>
+      <param name="graph-legend"      value="TCP Connections Reset"/>
+      <param name="vertical-label"    value="Reset"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::TCPConnectionFailures">
+    <leaf name="TCPConnectionFailures">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_TCPConnectionFailures.rrd"/>
+      <param name="comment"           value="TCP Connection Failures"/>
+      <param name="graph-legend"      value="TCP Connection Failures"/>
+      <param name="vertical-label"    value="Failures"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::ProcessorInterruptsSec">
+    <leaf name="ProcessorInterruptsSec">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_ProcessorInterruptssec.rrd"/>
+      <param name="comment"           value="Processor Interrupts/sec"/>
+      <param name="graph-legend"      value="Processor Interrupts/sec"/>
+      <param name="vertical-label"    value="Interrupts/sec"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::DNSTotalQueryReceived">
+    <leaf name="DNSTotalQueryReceived">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_DNSTotalQueryReceived.rrd"/>
+      <param name="comment"           value="DNS Total Query Received"/>
+      <param name="graph-legend"      value="DNS Total Query Received"/>
+      <param name="vertical-label"    value="Received"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::DNSTotalResponseSent">
+    <leaf name="DNSTotalResponseSent">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_DNSTotalResponseSent.rrd"/>
+      <param name="comment"           value="DNS Total Response Sent"/>
+      <param name="graph-legend"      value="DNS Total Response Sent"/>
+      <param name="vertical-label"    value="Sent"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::MSExchangeISActiveUserCount">
+    <leaf name="MSExchangeISActiveUserCount">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_MSExchangeISActiveUserCount.rrd"/>
+      <param name="comment"           value="MSExchangeIS Active User Count"/>
+      <param name="graph-legend"      value="MSExchangeIS Active User Count"/>
+      <param name="vertical-label"    value="Count"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::MSExchangeISVirusFilesScanned">
+    <leaf name="MSExchangeISVirusFilesScanned">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_MSExchangeISVirusFilesScanned.rrd"/>
+      <param name="comment"           value="MSExchangeIS Virus Files Scanned"/>
+      <param name="graph-legend"      value="MSExchangeIS Virus Files Scanned"/>
+      <param name="vertical-label"    value="Scanned"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::MSExchangeISVirusFilesQuarantined">
+    <leaf name="MSExchangeISVirusFilesQuarantined">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_MSExchangeISVirusFilesQuarantined.rrd"/>
+      <param name="comment"           value="MSExchangeIS Virus Files Quarantined"/>
+      <param name="graph-legend"      value="MSExchangeIS Virus Files Quarantined"/>
+      <param name="vertical-label"    value="Quarantined"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::MSExchangeISVirusFilesCleaned">
+    <leaf name="MSExchangeISVirusFilesCleaned">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_MSExchangeISVirusFilesCleaned.rrd"/>
+      <param name="comment"           value="MSExchangeIS Virus Files Cleaned"/>
+      <param name="graph-legend"      value="MSExchangeIS Virus Files Cleaned"/>
+      <param name="vertical-label"    value="Cleaned"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+  <template
+  name="EmpireSystemedge::NTREGPERF::MSExchangeISMailboxMessagesSubmitted">
+    <leaf name="MSExchangeISMailboxMessagesSubmitted">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_MSExchangeISMailboxMessagesSubmitted.rrd"/>
+      <param name="comment"
+        value="MSExchangeIS Mailbox MessagesSubmitted"/>
+      <param name="graph-legend"
+        value="MSExchangeIS Mailbox Messages Submitted"/>
+      <param name="vertical-label"    value="Messages"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+  <template
+  name="EmpireSystemedge::NTREGPERF::MSExchangeISMailboxMessagesDelivered">
+    <leaf name="MSExchangeISMailboxMessagesDelivered">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_MSExchangeISMailboxMessagesDelivered.rrd"/>
+      <param name="comment"
+        value="MSExchangeIS Mailbox Messages Delivered"/>
+      <param name="graph-legend"
+        value="MSExchangeIS Mailbox Messages Delivered"/>
+      <param name="vertical-label"    value="Messages"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::MSExchangeISMailboxReceiveQueue">
+    <leaf name="MSExchangeISMailboxReceiveQueue">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_MSExchangeISMailboxReceiveQueue.rrd"/>
+      <param name="comment"
+        value="MSExchangeIS Mailbox Receive Queue Size"/>
+      <param name="graph-legend"
+        value="MSExchangeIS Mailbox Receive Queue Size"/>
+      <param name="vertical-label"    value="Queue"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::MSExchangeISMailboxSendQueueSize">
+    <leaf name="MSExchangeISMailboxSendQueueSize">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_MSExchangeISMailboxSendQueueSize.rrd"/>
+      <param name="comment"           value="MSExchangeIS Mailbox Send Queue Size"/>
+      <param name="graph-legend"      value="MSExchangeIS Mailbox Send Queue Size"/>
+      <param name="vertical-label"    value="Size"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::MSExchangeISVMTotal16MBFree">
+    <leaf name="MSExchangeISVMTotal16MBFree">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_MSExchangeISVMTotal16MBFree.rrd"/>
+      <param name="comment"           value="MSExchangeIS VM Total 16MB Free"/>
+      <param name="graph-legend"      value="MSExchangeIS VM Total 16MB Free"/>
+      <param name="vertical-label"    value="Free"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="monitor"           value="fail_le"/>
+      <param name="monitor-vars"      value="fail=3"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::SMTPDSTotalMessagesSent">
+    <leaf name="SMTPDSTotalMessagesSent">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_SMTPDSTotalMessagesSent.rrd"/>
+      <param name="comment"           value="SMTPDS Total Messages Sent"/>
+      <param name="graph-legend"      value="SMTPDS Total Messages Sent"/>
+      <param name="vertical-label"    value="Sent"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::SMTPDSCurrentActiveConnections">
+    <leaf name="SMTPDSCurrentActiveConnections">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_SMTPDSCurrentActiveConnections.rrd"/>
+      <param name="comment"           value="SMTPDS Current Active Connections"/>
+      <param name="graph-legend"      value="SMTPDS Current Active Connections"/>
+      <param name="vertical-label"    value="Connections"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::SMTPRSTotalMessagesReceived">
+    <leaf name="SMTPRSTotalMessagesReceived">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_SMTPRSTotalMessagesReceived.rrd"/>
+      <param name="comment"           value="SMTPRS Total Messages Received"/>
+      <param name="graph-legend"      value="SMTPRS Total Messages Received"/>
+      <param name="vertical-label"    value="Received"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::SMTPRSActiveConnections">
+    <leaf name="SMTPRSActiveConnections">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_SMTPRSActiveConnections.rrd"/>
+      <param name="comment"           value="SMTPRS Active Connections"/>
+      <param name="graph-legend"      value="SMTPRS Active Connections"/>
+      <param name="vertical-label"    value="Connections"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+    </leaf>
+  </template>
+
+  <template name="EmpireSystemedge::NTREGPERF::SMTPSSUncheckedmessagescount">
+    <leaf name="SMTPSSUncheckedmessagescount">
+      <param name="data-file"
+        value="%snmp-host%_ntregperf_SMTPSSUncheckedmessagescount.rrd"/>
+      <param name="comment"           value="SMTPSS Unchecked messages count"/>
+      <param name="graph-legend"      value="SMTPSS Unchecked messages count"/>
+      <param name="vertical-label"    value="count"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+    </leaf>
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/empire.systemedge.xml b/torrus/xmlconfig/vendor/empire.systemedge.xml
new file mode 100644 (file)
index 0000000..f3c80fa
--- /dev/null
@@ -0,0 +1,1959 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (C) 2003 Shawn Ferry
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+Shawn Ferry <sferry at sevenspace dot com > <lalartu at obscure dot org>
+
+Author: Shawn Ferry
+Vendor: EMPIRE
+Tested Versions: Sysedge 4.1p3
+
+$Id: empire.systemedge.xml,v 1.1 2010-12-27 00:04:09 ivan Exp $
+-->
+<!--
+Generic definitions and templates for:
+Empire (Concord) SystemEDGE MIB
+http://www.empire.com/products/systemedge/index.htm
+http://www.concord.com/solutions/products/sysedge.shtml
+-->
+<configuration>
+  <include filename="generic/monitors.xml"/>
+  <definitions>
+    <!--
+
+        STILL NEED SETUP
+
+        -->
+    <!-- flag -->
+    <def name="empire_sysedgeMode" value="1.3.6.1.4.1.546.1.1.1.17.0"/>
+    <!--
+
+
+        STILL NEED SETUP
+
+
+       -->
+    <!-- Memory -->
+    <def name="empire_memory" value="1.3.6.1.4.1.546.1.1.1.3.0"/>
+    <def name="empire_totalSwap" value="1.3.6.1.4.1.546.1.1.1.9.12.0"/>
+    <def name="empire_swapInUse" value="1.3.6.1.4.1.546.1.1.7.8.13.0"/>
+    <def name="empire_virtualMem" value="1.3.6.1.4.1.546.1.1.1.9.7.0"/>
+    <def name="empire_memInUse" value="1.3.6.1.4.1.546.1.1.7.8.9.0"/>
+    <def name="empire_activeMem" value="1.3.6.1.4.1.546.1.1.7.8.10.0"/>
+    <def name="empire_swapCapacity" value="1.3.6.1.4.1.546.1.1.7.8.30.0"/>
+    <def name="empire_memCapacity" value="1.3.6.1.4.1.546.1.1.7.8.31.0"/>
+    <def name="empire_memInUseCapacity" value="1.3.6.1.4.1.546.1.1.7.8.32.0"/>
+    <!-- Low level counters -->
+    <!-- process counters -->
+    <def name="empire_numSwitches" value="1.3.6.1.4.1.546.1.1.7.8.14.0"/>
+    <def name="empire_numTraps" value="1.3.6.1.4.1.546.1.1.7.8.15.0"/>
+    <def name="empire_numSyscalls" value="1.3.6.1.4.1.546.1.1.7.8.16.0"/>
+    <def name="empire_numInterrupts" value="1.3.6.1.4.1.546.1.1.7.8.17.0"/>
+    <!-- swap counters -->
+    <def name="empire_numPageSwapIns" value="1.3.6.1.4.1.546.1.1.7.8.18.0"/>
+    <def name="empire_numPageSwapOuts" value="1.3.6.1.4.1.546.1.1.7.8.19.0"/>
+    <def name="empire_numSwapIns" value="1.3.6.1.4.1.546.1.1.7.8.20.0"/>
+    <def name="empire_numSwapOuts" value="1.3.6.1.4.1.546.1.1.7.8.21.0"/>
+    <def name="empire_numPageIns" value="1.3.6.1.4.1.546.1.1.7.8.22.0"/>
+    <def name="empire_numPageOuts" value="1.3.6.1.4.1.546.1.1.7.8.23.0"/>
+    <def name="empire_numPageReclaims" value="1.3.6.1.4.1.546.1.1.7.8.24.0"/>
+    <def name="empire_numPageFaults" value="1.3.6.1.4.1.546.1.1.7.8.25.0"/>
+    <!-- Counters -->
+    <def name="empire_numProcs" value="1.3.6.1.4.1.546.1.1.7.8.11.0"/>
+    <def name="empire_numOpenFiles" value="1.3.6.1.4.1.546.1.1.7.8.12.0"/>
+    <!-- Process Status -->
+    <def name="empire_runQLen" value="1.3.6.1.4.1.546.1.1.7.8.4.0"/>
+    <def name="empire_pageWaitNum" value="1.3.6.1.4.1.546.1.1.7.8.5.0"/>
+    <def name="empire_diskWaitNum" value="1.3.6.1.4.1.546.1.1.7.8.6.0"/>
+    <def name="empire_swapActive" value="1.3.6.1.4.1.546.1.1.7.8.7.0"/>
+    <def name="empire_sleepActive" value="1.3.6.1.4.1.546.1.1.7.8.8.0"/>
+    <!-- Individual CPU Stats -->
+    <def name="empire_cpuTable" value="1.3.6.1.4.1.546.13.1.1"/>
+    <def name="empire_cpuIndex" value="1.3.6.1.4.1.546.13.1.1.1"/>
+    <def name="empire_cpuDescr" value="1.3.6.1.4.1.546.13.1.1.2"/>
+    <def name="empire_cpuIdle" value="1.3.6.1.4.1.546.13.1.1.3"/>
+    <def name="empire_cpuUser" value="1.3.6.1.4.1.546.13.1.1.4"/>
+    <def name="empire_cpuSys" value="1.3.6.1.4.1.546.13.1.1.5"/>
+    <def name="empire_cpuWait" value="1.3.6.1.4.1.546.13.1.1.6"/>
+    <def name="empire_cpuLastUpdate" value="1.3.6.1.4.1.546.13.1.1.7"/>
+    <def name="empire_cpuIdlePercent" value="1.3.6.1.4.1.546.13.1.1.8"/>
+    <def name="empire_cpuUserPercent" value="1.3.6.1.4.1.546.13.1.1.9"/>
+    <def name="empire_cpuSysPercent" value="1.3.6.1.4.1.546.13.1.1.10"/>
+    <def name="empire_cpuWaitPercent" value="1.3.6.1.4.1.546.13.1.1.11"/>
+    <def name="empire_cpu_IDX" value="M($empire_cpuIndex,%INDEX%)"/>
+    <!-- Load Average -->
+    <def name="empire_loadAverage1Min" value="1.3.6.1.4.1.546.1.1.7.8.26.0"/>
+    <def name="empire_loadAverage5Min" value="1.3.6.1.4.1.546.1.1.7.8.27.0"/>
+    <def name="empire_loadAverage15Min" value="1.3.6.1.4.1.546.1.1.7.8.28.0"/>
+    <!-- Overall CPU stats -->
+    <def name="empire_cpuTotalIdle" value="1.3.6.1.4.1.546.13.2.0"/>
+    <def name="empire_cpuTotalUser" value="1.3.6.1.4.1.546.13.3.0"/>
+    <def name="empire_cpuTotalSys" value="1.3.6.1.4.1.546.13.4.0"/>
+    <def name="empire_cpuTotalWait" value="1.3.6.1.4.1.546.13.5.0"/>
+    <def name="empire_cpuTotalIdlePercent" value="1.3.6.1.4.1.546.13.7.0"/>
+    <def name="empire_cpuTotalUserPercent" value="1.3.6.1.4.1.546.13.8.0"/>
+    <def name="empire_cpuTotalSysPercent" value="1.3.6.1.4.1.546.13.9.0"/>
+    <def name="empire_cpuTotalWaitPercent" value="1.3.6.1.4.1.546.13.10.0"/>
+    <!-- Storage Table-->
+    <def name="empire_devIndex" value="1.3.6.1.4.1.546.1.1.1.7.1.1"/>
+    <def name="empire_devDevice" value="1.3.6.1.4.1.546.1.1.1.7.1.2"/>
+    <def name="empire_devMntPt" value="1.3.6.1.4.1.546.1.1.1.7.1.3"/>
+    <def name="empire_devBsize" value="1.3.6.1.4.1.546.1.1.1.7.1.4"/>
+    <def name="empire_devTblks" value="1.3.6.1.4.1.546.1.1.1.7.1.5"/>
+    <def name="empire_devFblks" value="1.3.6.1.4.1.546.1.1.1.7.1.6"/>
+    <def name="empire_devTfiles" value="1.3.6.1.4.1.546.1.1.1.7.1.7"/>
+    <def name="empire_devFfiles" value="1.3.6.1.4.1.546.1.1.1.7.1.8"/>
+    <def name="empire_devCapacity" value="1.3.6.1.4.1.546.1.1.1.7.1.14"/>
+    <def name="empire_devInodeCapacity" value="1.3.6.1.4.1.546.1.1.1.7.1.15"/>
+    <def name="empire_dev_IDX" value="M($empire_devMntPt,%storage-description%)"/>
+    <!-- "Disk" Stats Table -->
+    <def name="empire_diskStatsIndex" value="1.3.6.1.4.1.546.12.1.1.1"/>
+    <def name="empire_diskStatsQueueLength" value="1.3.6.1.4.1.546.12.1.1.2"/>
+    <def name="empire_diskStatsServiceTime" value="1.3.6.1.4.1.546.12.1.1.3"/>
+    <def name="empire_diskStatsUtilization" value="1.3.6.1.4.1.546.12.1.1.4"/>
+    <def name="empire_diskStatsKBTransfered" value="1.3.6.1.4.1.546.12.1.1.5"/>
+    <def name="empire_diskStatsTransfers" value="1.3.6.1.4.1.546.12.1.1.6"/>
+    <def name="empire_diskStatsReads" value="1.3.6.1.4.1.546.12.1.1.7"/>
+    <def name="empire_diskStatsWrites" value="1.3.6.1.4.1.546.12.1.1.8"/>
+    <def name="empire_diskStatsHostIndex" value="1.3.6.1.4.1.546.12.1.1.9"/>
+    <def name="empire_disk_stats_IDX" value="M($empire_diskStatsHostIndex,%HRINDEX%)"/>
+  </definitions>
+  <datasources>
+
+    <template name="sysedge_opmode">
+      <leaf name="SysedgeOpMode">
+        <param name="vertical-label" value="Mode"/>
+        <param name="comment">
+            Sysedge Operation Mode 1=Full 2=Not Licensed
+        </param>
+        <param name="data-file" value="%system-id%_sysedge_opmode.rrd"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_sysedgeMode"/>
+        <param name="rrd-ds" value="sysedge_opmode"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="line-color" value="##one"/>
+        <param name="line-style" value="LINE2"/>
+        <param name="graph-legend" value="SysedgeOpMode"/>
+        <param name="rrd-cf" value="LAST"/>
+        <param name="rrd-create-rra" value="RRA:LAST:0:1:10080"/>
+        <param name="monitor" value="fail_eq"/>
+        <param name="monitor-vars" value="fail=2"/>
+      </leaf>
+    </template>
+    <!--
+
+        Empire Memory
+
+        -->
+    <template name="empire-memory">
+      <subtree name="Memory">
+        <param name="comment" value="System Memory Stats and Usage"/>
+        <leaf name="MemoryUsage">
+          <param name="vertical-label" value="Bytes"/>
+          <param name="rrd-scaling-base" value="1024"/>
+          <param name="comment" value="Memory: Total, Used and Active"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="total,inuse,active"/>
+          <!-- Active -->
+          <param name="ds-expr-total" value="{Memory}"/>
+          <param name="graph-legend-total" value="Memory"/>
+          <param name="line-style-total" value="AREA"/>
+          <param name="line-color-total" value="##two"/>
+          <param name="line-order-total" value="1"/>
+          <!-- InUse -->
+          <param name="ds-expr-inuse" value="{MemInUse}"/>
+          <param name="graph-legend-inuse" value="MemInUse"/>
+          <param name="line-style-inuse" value="AREA"/>
+          <param name="line-color-inuse" value="##three"/>
+          <param name="line-order-inuse" value="2"/>
+          <!-- Active -->
+          <param name="ds-expr-active" value="{ActiveMem}"/>
+          <param name="graph-legend-active" value="ActiveMem"/>
+          <param name="line-style-active" value="AREA"/>
+          <param name="line-color-active" value="##four"/>
+          <param name="line-order-active" value="3"/>
+        </leaf>
+        <leaf name="MemoryActive">
+          <param name="vertical-label" value="Bytes"/>
+          <param name="rrd-scaling-base" value="1024"/>
+          <param name="comment" value="Memory, Used vs Active"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="active,inuse"/>
+          <!-- Active -->
+          <param name="ds-expr-active" value="{ActiveMem}"/>
+          <param name="graph-legend-active" value="ActiveMem"/>
+          <param name="line-style-active" value="AREA"/>
+          <param name="line-color-active" value="##four"/>
+          <param name="line-order-active" value="2"/>
+          <!-- InUse -->
+          <param name="ds-expr-inuse" value="{MemInUse}"/>
+          <param name="graph-legend-inuse" value="MemInUse"/>
+          <param name="line-style-inuse" value="AREA"/>
+          <param name="line-color-inuse" value="##three"/>
+          <param name="line-order-inuse" value="1"/>
+        </leaf>
+        <leaf name="SwapUsage">
+          <param name="vertical-label" value="Bytes"/>
+          <param name="rrd-scaling-base" value="1024"/>
+          <param name="comment" value="Swap, Total vs Used"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="total,used"/>
+          <!-- Total -->
+          <param name="ds-expr-total" value="{TotalSwap}"/>
+          <param name="graph-legend-total" value="TotalSwap"/>
+          <param name="line-style-total" value="AREA"/>
+          <param name="line-color-total" value="##two"/>
+          <param name="line-order-total" value="1"/>
+          <!-- InUse -->
+          <param name="ds-expr-used" value="{SwapInUse}"/>
+          <param name="graph-legend-used" value="SwapInUse"/>
+          <param name="line-style-used" value="AREA"/>
+          <param name="line-color-used" value="##three"/>
+          <param name="line-order-used" value="2"/>
+        </leaf>
+        <leaf name="TotalSwap">
+          <param name="data-file" value="%system-id%_empire-totalswap.rrd"/>
+          <param name="vertical-label" value="Bytes"/>
+          <param name="rrd-scaling-base" value="1024"/>
+          <param name="hidden" value="yes"/>
+          <param name="comment" value="Total Swap Space"/>
+          <param name="leaf-type" value="rrd-def"/>
+          <param name="collector-scale" value="1024,*"/>
+          <param name="snmp-object" value="$empire_totalSwap"/>
+          <param name="rrd-ds" value="totalSwap"/>
+          <param name="rrd-cf" value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="line-color" value="##one"/>
+          <param name="graph-legend" value="TotalSwap"/>
+        </leaf>
+        <leaf name="SwapInUse">
+          <param name="data-file" value="%system-id%_empire-swapinuse.rrd"/>
+          <param name="vertical-label" value="Bytes"/>
+          <param name="rrd-scaling-base" value="1024"/>
+          <param name="hidden" value="yes"/>
+          <param name="comment" value="Used Swap Space"/>
+          <param name="leaf-type" value="rrd-def"/>
+          <param name="collector-scale" value="1024,*"/>
+          <param name="snmp-object" value="$empire_swapInUse"/>
+          <param name="rrd-ds" value="swapInUse"/>
+          <param name="rrd-cf" value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="line-color" value="##one"/>
+          <param name="graph-legend" value="SwapInUse"/>
+        </leaf>
+        <leaf name="Memory">
+          <param name="data-file" value="%system-id%_empire-memory.rrd"/>
+          <param name="vertical-label" value="Bytes"/>
+          <param name="rrd-scaling-base" value="1024"/>
+          <param name="hidden" value="yes"/>
+          <param name="comment" value="Real Memory"/>
+          <param name="leaf-type" value="rrd-def"/>
+          <param name="collector-scale" value="1024,*"/>
+          <param name="snmp-object" value="$empire_memory"/>
+          <param name="rrd-ds" value="memory"/>
+          <param name="rrd-cf" value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="line-color" value="##one"/>
+          <param name="graph-legend" value="Memory"/>
+        </leaf>
+        <leaf name="MemInUse">
+          <param name="data-file" value="%system-id%_empire-meminuse.rrd"/>
+          <param name="vertical-label" value="Bytes"/>
+          <param name="rrd-scaling-base" value="1024"/>
+          <param name="hidden" value="yes"/>
+          <param name="comment" value="Real Memory In Use"/>
+          <param name="leaf-type" value="rrd-def"/>
+          <param name="collector-scale" value="1024,*"/>
+          <param name="snmp-object" value="$empire_memInUse"/>
+          <param name="rrd-ds" value="memInUse"/>
+          <param name="rrd-cf" value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="line-color" value="##one"/>
+          <param name="line-style" value="AREA"/>
+          <param name="graph-legend" value="MemInUse"/>
+        </leaf>
+        <leaf name="ActiveMem">
+          <param name="data-file" value="%system-id%_empire-activemem.rrd"/>
+          <param name="vertical-label" value="Bytes"/>
+          <param name="rrd-scaling-base" value="1024"/>
+          <param name="hidden" value="yes"/>
+          <param name="comment" value="Active Real Memory"/>
+          <param name="leaf-type" value="rrd-def"/>
+          <param name="collector-scale" value="1024,*"/>
+          <param name="snmp-object" value="$empire_activeMem"/>
+          <param name="rrd-ds" value="activeMem"/>
+          <param name="rrd-cf" value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="line-color" value="##one"/>
+          <param name="line-style" value="AREA"/>
+          <param name="graph-legend" value="ActiveMem"/>
+        </leaf>
+        <leaf name="SwapCapacity">
+          <param name="data-file" value="%system-id%_empire-swapcap.rrd"/>
+          <param name="vertical-label" value="Percent Used"/>
+          <param name="comment" value="Percentage of Swap Used"/>
+          <param name="leaf-type" value="rrd-def"/>
+          <param name="snmp-object" value="$empire_swapCapacity"/>
+          <param name="rrd-ds" value="swapCapacity"/>
+          <param name="rrd-cf" value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="line-color" value="##one"/>
+          <param name="line-style" value="AREA"/>
+          <param name="graph-legend" value="SwapCapacity"/>
+        </leaf>
+        <leaf name="MemInUseCapacity">
+          <param name="data-file" value="%system-id%_empire-meminusecap.rrd"/>
+          <param name="vertical-label" value="Percent Used"/>
+          <param name="comment" value="Percentage of Memory Used"/>
+          <param name="leaf-type" value="rrd-def"/>
+          <param name="snmp-object" value="$empire_memCapacity"/>
+          <param name="rrd-ds" value="memCapacity"/>
+          <param name="rrd-cf" value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="line-color" value="##one"/>
+          <param name="line-style" value="AREA"/>
+          <param name="graph-legend" value="MemCapacity"/>
+          <param name="monitor" value="fail_gt"/>
+          <param name="monitor-vars" value="fail=97"/>
+        </leaf>
+      </subtree>
+    </template>
+    <!--
+            Empire Swap Counters
+                empire-swap-counters-numpagefaults
+                empire-swap-counters-numpagereclaims
+                empire-swap-counters-numswapouts
+                empire-swap-counters-numswapouts-multi
+                empire-swap-counters-numswapins
+                empire-swap-counters-numswapins-multi
+                empire-swap-counters-numpageswapouts
+                empire-swap-counters-numpageswapouts-multi
+                empire-swap-counters-numpageswapins
+                empire-swap-counters-numpageswapins-multi
+
+
+
+
+            -->
+    <!-- Windows does not support swap counters -->
+    <template name="empire-swap-counters-nt">
+      <apply-template name="empire-swap-counters-common"/>
+      <subtree name="Memory">
+        <leaf name="SwapCounters">
+          <param name="ds-names" value="pagein,pageout"/>
+          <apply-template name="empire-swap-counters-numpageins-multi"/>
+          <apply-template name="empire-swap-counters-numpageouts-multi"/>
+        </leaf>
+        <apply-template name="empire-swap-counters-numpageins"/>
+        <apply-template name="empire-swap-counters-numpageouts"/>
+        <apply-template name="empire-swap-counters-numpagefaults"/>
+      </subtree>
+    </template>
+    <template name="empire-swap-counters-nt40Intel">
+      <apply-template name="empire-swap-counters-nt"/>
+    </template>
+    <template name="empire-swap-counters-nt50Intel">
+      <apply-template name="empire-swap-counters-nt"/>
+    </template>
+    <template name="empire-swap-counters-unix">
+      <apply-template name="empire-swap-counters-common"/>
+      <subtree name="Memory">
+        <leaf name="SwapCounters">
+          <param name="ds-names" value="pagein,pageout,swapin,swapout"/>
+          <apply-template name="empire-swap-counters-numpageswapins-multi"/>
+          <apply-template name="empire-swap-counters-numpageswapouts-multi"/>
+          <apply-template name="empire-swap-counters-numswapins-multi"/>
+          <apply-template name="empire-swap-counters-numswapouts-multi"/>
+        </leaf>
+        <apply-template name="empire-swap-counters-numpageswapins"/>
+        <apply-template name="empire-swap-counters-numpageswapouts"/>
+        <apply-template name="empire-swap-counters-numswapins"/>
+        <apply-template name="empire-swap-counters-numswapouts"/>
+        <apply-template name="empire-swap-counters-numpagefaults"/>
+        <apply-template name="empire-swap-counters-numpagereclaims"/>
+      </subtree>
+    </template>
+    <template name="empire-swap-counters-solarisSparc">
+      <apply-template name="empire-swap-counters-unix"/>
+    </template>
+    <template name="empire-swap-counters-aix5RS6000">
+      <apply-template name="empire-swap-counters-common"/>
+      <subtree name="Memory">
+        <leaf name="SwapCounters">
+          <param name="ds-names" value="pagein,pageout"/>
+          <apply-template name="empire-swap-counters-numpageswapins-multi"/>
+          <apply-template name="empire-swap-counters-numpageswapouts-multi"/>
+        </leaf>
+        <apply-template name="empire-swap-counters-numpageswapins"/>
+        <apply-template name="empire-swap-counters-numpageswapouts"/>
+        <apply-template name="empire-swap-counters-numpagefaults"/>
+        <apply-template name="empire-swap-counters-numpagereclaims"/>
+      </subtree>
+    </template>
+    <template name="empire-swap-counters-linuxIntel">
+      <apply-template name="empire-swap-counters-common"/>
+      <subtree name="Memory">
+        <leaf name="SwapCounters">
+          <param name="ds-names" value="pagein,pageout"/>
+          <apply-template name="empire-swap-counters-numpageswapins-multi"/>
+          <apply-template name="empire-swap-counters-numpageswapouts-multi"/>
+        </leaf>
+        <apply-template name="empire-swap-counters-numpageswapins"/>
+        <apply-template name="empire-swap-counters-numpageswapouts"/>
+      </subtree>
+    </template>
+    <template name="empire-swap-counters-common">
+      <subtree name="Memory">
+        <leaf name="SwapCounters">
+          <param name="vertical-label" value="Count"/>
+          <param name="comment" value="System Swap Stats"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ignore-limits" value="yes"/>
+        </leaf>
+      </subtree>
+    </template>
+    <template name="empire-swap-counters-numswapins-multi">
+      <!-- in -->
+      <param name="ds-expr-swapin" value="{NumSwapIns},-1,*"/>
+      <param name="graph-legend-swapin" value="SwapIns"/>
+      <param name="line-style-swapin" value="AREA"/>
+      <param name="line-color-swapin" value="##green"/>
+      <param name="line-order-swapin" value="1"/>
+    </template>
+    <template name="empire-swap-counters-numpageswapins-multi">
+      <!-- pageswapin -->
+      <param name="ds-expr-pagein" value="{NumPageSwapIns},-1,*"/>
+      <param name="graph-legend-pagein" value="ProcessSwapIns"/>
+      <param name="line-style-pagein" value="LINE2"/>
+      <param name="line-color-pagein" value="##green75"/>
+      <param name="line-order-pagein" value="3"/>
+    </template>
+    <template name="empire-swap-counters-numpageins-multi">
+      <!-- pagein -->
+      <param name="ds-expr-pagein" value="{NumPageIns},-1,*"/>
+      <param name="graph-legend-pagein" value="PageIns"/>
+      <param name="line-style-pagein" value="LINE2"/>
+      <param name="line-color-pagein" value="##green75"/>
+      <param name="line-order-pagein" value="3"/>
+    </template>
+    <template name="empire-swap-counters-numswapouts-multi">
+      <!-- out -->
+      <param name="ds-expr-swapout" value="{NumSwapOuts}"/>
+      <param name="graph-legend-swapout" value="SwapOuts"/>
+      <param name="line-style-swapout" value="AREA"/>
+      <param name="line-color-swapout" value="##blue"/>
+      <param name="line-order-swapout" value="2"/>
+    </template>
+    <template name="empire-swap-counters-numpageswapouts-multi">
+      <!-- pageout -->
+      <param name="ds-expr-pageout" value="{NumPageSwapOuts}"/>
+      <param name="graph-legend-pageout" value="ProcessSwapOuts"/>
+      <param name="line-style-pageout" value="LINE2"/>
+      <param name="line-color-pageout" value="##blue75"/>
+      <param name="line-order-pageout" value="4"/>
+    </template>
+    <template name="empire-swap-counters-numpageouts-multi">
+      <!-- pageout -->
+      <param name="ds-expr-pageout" value="{NumPageOuts}"/>
+      <param name="graph-legend-pageout" value="PageOuts"/>
+      <param name="line-style-pageout" value="LINE2"/>
+      <param name="line-color-pageout" value="##blue75"/>
+      <param name="line-order-pageout" value="4"/>
+    </template>
+    <template name="empire-swap-counters-numpageins">
+      <leaf name="NumPageIns">
+        <param name="data-file" value="%system-id%_empire-numpageins.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="hidden" value="yes"/>
+        <param name="comment" value="Number of Page Ins"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_numPageIns"/>
+        <param name="rrd-ds" value="numPageIns"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="line-color" value="##one"/>
+        <param name="graph-legend" value="PageIns"/>
+      </leaf>
+    </template>
+    <template name="empire-swap-counters-numpageouts">
+      <leaf name="NumPageOuts">
+        <param name="data-file" value="%system-id%_empire-numpageouts.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="hidden" value="yes"/>
+        <param name="comment" value="Number of Page Outs"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_numPageOuts"/>
+        <param name="rrd-ds" value="numPageOuts"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="line-color" value="##one"/>
+        <param name="graph-legend" value="PageOuts"/>
+      </leaf>
+    </template>
+    <template name="empire-swap-counters-numpageswapins">
+      <leaf name="NumPageSwapIns">
+        <param name="data-file" value="%system-id%_empire-numpageswapins.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="hidden" value="yes"/>
+        <param name="comment" value="Number of Page Swap Ins"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_numPageSwapIns"/>
+        <param name="rrd-ds" value="numPageSwapIns"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="line-color" value="##one"/>
+        <param name="graph-legend" value="PageSwapIns"/>
+      </leaf>
+    </template>
+    <template name="empire-swap-counters-numpageswapouts">
+      <leaf name="NumPageSwapOuts">
+        <param name="data-file" value="%system-id%_empire-numpageswapouts.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="hidden" value="yes"/>
+        <param name="comment" value="Number of Page Swap Outs"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_numPageSwapOuts"/>
+        <param name="rrd-ds" value="numPageSwapOuts"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="line-color" value="##one"/>
+        <param name="graph-legend" value="PageSwapOuts"/>
+      </leaf>
+    </template>
+    <template name="empire-swap-counters-numswapins">
+      <leaf name="NumSwapIns">
+        <param name="data-file" value="%system-id%_empire-numswapins.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="hidden" value="yes"/>
+        <param name="comment" value="Number of Process Swap Ins"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_numSwapIns"/>
+        <param name="rrd-ds" value="numSwapIns"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="line-color" value="##one"/>
+        <param name="graph-legend" value="SwapIns"/>
+      </leaf>
+    </template>
+    <template name="empire-swap-counters-numswapouts">
+      <leaf name="NumSwapOuts">
+        <param name="data-file" value="%system-id%_empire-numswapouts.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="hidden" value="yes"/>
+        <param name="comment" value="Number of Process Swap Outs"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_numSwapOuts"/>
+        <param name="rrd-ds" value="numSwapOuts"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="line-color" value="##one"/>
+        <param name="graph-legend" value="SwapOuts"/>
+      </leaf>
+    </template>
+    <template name="empire-swap-counters-numpagereclaims">
+      <leaf name="NumPageReclaims">
+        <param name="data-file" value="%system-id%_empire-numpagereclaims.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="comment">
+          Number of Pages Reclaimed from the free list
+        </param>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_numPageReclaims"/>
+        <param name="rrd-ds" value="numPageReclaims"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="line-color" value="##one"/>
+        <param name="graph-legend" value="PageReclaims"/>
+      </leaf>
+    </template>
+    <template name="empire-swap-counters-numpagefaults">
+      <leaf name="NumPageFaults">
+        <param name="data-file" value="%system-id%_empire-numpagefaults.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="comment">
+          Number of attemps to access a page not in memory
+        </param>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_numPageFaults"/>
+        <param name="rrd-ds" value="numPageFaults"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="line-color" value="##one"/>
+        <param name="graph-legend" value="PageFaults"/>
+      </leaf>
+    </template>
+    <!--
+
+        Empire Counters
+        Templates:
+            empire-counters-numtraps
+            empire-counters-numtraps-multi
+            empire-counters-numswitches
+            empire-counters-numswitches-multi
+            empire-counters-numsyscalls
+            empire-counters-numsyscalls-multi
+            empire-counters-numinterrupts
+            empire-counters-numinterrupts-multi
+            (in common)empire-counters-numprocs
+            (in common)empire-counters-numopenfiles
+
+
+        -->
+    <!-- windows does not support traps -->
+    <template name="empire-counters-nt">
+      <apply-template name="empire-counters-common"/>
+      <subtree name="Counters">
+        <leaf name="ProcessCounters">
+          <param name="comment" value="Switches, Syscalls, Interrupts"/>
+          <param name="ds-names" value="switches,syscalls,interrupts"/>
+          <apply-template name="empire-counters-numswitches-multi"/>
+          <apply-template name="empire-counters-numsyscalls-multi"/>
+          <apply-template name="empire-counters-numinterrupts-multi"/>
+        </leaf>
+        <apply-template name="empire-counters-numswitches"/>
+        <apply-template name="empire-counters-numsyscalls"/>
+        <apply-template name="empire-counters-numinterrupts"/>
+      </subtree>
+    </template>
+    <template name="empire-counters-nt40Intel">
+      <apply-template name="empire-counters-nt"/>
+    </template>
+    <template name="empire-counters-nt50Intel">
+      <apply-template name="empire-counters-nt"/>
+    </template>
+    <template name="empire-counters-unix">
+      <apply-template name="empire-counters-common"/>
+      <subtree name="Counters">
+        <leaf name="ProcessCounters">
+          <param name="comment" value="Switches, Syscalls, Interrupts"/>
+          <param name="ds-names" value="switches,syscalls,interrupts"/>
+          <apply-template name="empire-counters-numswitches-multi"/>
+          <apply-template name="empire-counters-numsyscalls-multi"/>
+          <apply-template name="empire-counters-numinterrupts-multi"/>
+        </leaf>
+        <apply-template name="empire-counters-numswitches"/>
+        <apply-template name="empire-counters-numsyscalls"/>
+        <apply-template name="empire-counters-numinterrupts"/>
+      </subtree>
+    </template>
+    <template name="empire-counters-solarisSparc">
+      <apply-template name="empire-counters-common"/>
+      <subtree name="Counters">
+        <leaf name="ProcessCounters">
+          <param name="comment">
+            Switches, Syscalls, Interrupts and Traps
+          </param>
+          <param name="ds-names" value="switches,syscalls,interrupts,traps"/>
+          <apply-template name="empire-counters-numswitches-multi"/>
+          <apply-template name="empire-counters-numsyscalls-multi"/>
+          <apply-template name="empire-counters-numinterrupts-multi"/>
+          <apply-template name="empire-counters-numtraps-multi"/>
+        </leaf>
+        <apply-template name="empire-counters-numswitches"/>
+        <apply-template name="empire-counters-numsyscalls"/>
+        <apply-template name="empire-counters-numinterrupts"/>
+        <apply-template name="empire-counters-numtraps"/>
+      </subtree>
+    </template>
+    <template name="empire-counters-aix5RS6000">
+      <apply-template name="empire-counters-unix"/>
+      <subtree name="Counters">
+        <leaf name="ProcessCounters">
+          <param name="comment">
+            Switches, Syscalls, Interrupts and Traps
+          </param>
+          <param name="ds-names" value="switches,syscalls,interrupts,traps"/>
+          <apply-template name="empire-counters-numtraps-multi"/>
+        </leaf>
+        <apply-template name="empire-counters-numtraps"/>
+      </subtree>
+    </template>
+
+    <template name="empire-counters-linuxIntel">
+      <apply-template name="empire-counters-common"/>
+      <subtree name="Counters">
+        <leaf name="ProcessCounters">
+          <param name="comment" value="Switches,Interrupts"/>
+          <param name="ds-names" value="switches,interrupts"/>
+          <apply-template name="empire-counters-numswitches-multi"/>
+          <apply-template name="empire-counters-numinterrupts-multi"/>
+        </leaf>
+        <apply-template name="empire-counters-numswitches"/>
+        <apply-template name="empire-counters-numinterrupts"/>
+      </subtree>
+    </template>
+    <!--  Counter Sub Templates -->
+    <template name="empire-counters-common">
+      <subtree name="Counters">
+        <param name="comment" value="System Counters"/>
+        <leaf name="ProcessCounters">
+          <param name="vertical-label" value="Count"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+        </leaf>
+        <apply-template name="empire-counters-numprocs"/>
+        <apply-template name="empire-counters-numopenfiles"/>
+      </subtree>
+    </template>
+    <template name="empire-counters-numswitches-multi">
+      <!-- Switches -->
+      <param name="ds-expr-switches" value="{NumSwitches}"/>
+      <param name="graph-legend-switches" value="Switches"/>
+      <param name="line-style-switches" value="LINE2"/>
+      <param name="line-color-switches" value="##one"/>
+      <param name="line-order-switches" value="1"/>
+    </template>
+    <template name="empire-counters-numsyscalls-multi">
+      <!-- Syscalls -->
+      <param name="ds-expr-syscalls" value="{NumSyscalls}"/>
+      <param name="graph-legend-syscalls" value="Syscalls"/>
+      <param name="line-style-syscalls" value="LINE2"/>
+      <param name="line-color-syscalls" value="##three"/>
+      <param name="line-order-syscalls" value="3"/>
+    </template>
+    <template name="empire-counters-numinterrupts-multi">
+      <!-- Interrupts -->
+      <param name="ds-expr-interrupts" value="{NumInterrupts}"/>
+      <param name="graph-legend-interrupts" value="Interrupts"/>
+      <param name="line-style-interrupts" value="LINE2"/>
+      <param name="line-color-interrupts" value="##four"/>
+      <param name="line-order-interrupts" value="4"/>
+    </template>
+    <template name="empire-counters-numtraps-multi">
+      <!-- Traps -->
+      <param name="ds-expr-traps" value="{NumTraps}"/>
+      <param name="graph-legend-traps" value="Traps"/>
+      <param name="line-style-traps" value="LINE2"/>
+      <param name="line-color-traps" value="##two"/>
+      <param name="line-order-traps" value="2"/>
+    </template>
+    <template name="empire-counters-numtraps">
+      <leaf name="NumTraps">
+        <param name="data-file" value="%system-id%_empire-numtraps.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="hidden" value="yes"/>
+        <param name="comment" value="Number of Traps"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_numTraps"/>
+        <param name="rrd-ds" value="numTraps"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="line-color" value="##one"/>
+        <param name="graph-legend" value="Traps"/>
+      </leaf>
+    </template>
+    <template name="empire-counters-numswitches">
+      <leaf name="NumSwitches">
+        <param name="data-file" value="%system-id%_empire-numswitches.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="hidden" value="yes"/>
+        <param name="comment" value="Number of Context Switches"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_numSwitches"/>
+        <param name="rrd-ds" value="numSwitches"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="line-color" value="##one"/>
+        <param name="graph-legend" value="Context Switches"/>
+      </leaf>
+    </template>
+    <template name="empire-counters-numsyscalls">
+      <leaf name="NumSyscalls">
+        <param name="data-file" value="%system-id%_empire-numsyscalls.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="hidden" value="yes"/>
+        <param name="comment" value="Number of System Calls"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_numSyscalls"/>
+        <param name="rrd-ds" value="numSyscalls"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="line-color" value="##one"/>
+        <param name="graph-legend" value="SystemCalls"/>
+      </leaf>
+    </template>
+    <template name="empire-counters-numinterrupts">
+      <leaf name="NumInterrupts">
+        <param name="data-file" value="%system-id%_empire-numinterrupts.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="hidden" value="yes"/>
+        <param name="comment" value="Number of Interrupts"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_numInterrupts"/>
+        <param name="rrd-ds" value="numSyscalls"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="line-color" value="##one"/>
+        <param name="graph-legend" value="NumInterrupts"/>
+      </leaf>
+    </template>
+    <template name="empire-counters-numprocs">
+      <leaf name="NumProcs">
+        <param name="data-file" value="%system-id%_empire-numprocs.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="comment" value="Number of Processes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_numProcs"/>
+        <param name="rrd-ds" value="numProcs"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="line-color" value="##one"/>
+        <param name="graph-legend" value="Processes"/>
+      </leaf>
+    </template>
+    <template name="empire-counters-numopenfiles">
+      <leaf name="NumOpenFiles">
+        <param name="data-file" value="%system-id%_empire-numopenfiles.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="comment" value="Number of Open Files"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_numOpenFiles"/>
+        <param name="rrd-ds" value="numOpenFiles"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="line-color" value="##one"/>
+        <param name="graph-legend" value="Open Files"/>
+      </leaf>
+    </template>
+    <!--
+
+        Empire Process Stats
+
+        -->
+    <template name="empire-runq">
+      <subtree name="ProcessStats">
+        <param name="comment" value="System Level Process Stats"/>
+        <leaf name="RunQLength">
+          <param name="vertical-label" value="Count"/>
+          <param name="data-file" value="%system-id%_empire-runq.rrd"/>
+          <param name="comment" value="Jobs waiting in Run Queue"/>
+          <param name="leaf-type" value="rrd-def"/>
+          <param name="snmp-object" value="$empire_runQLen"/>
+          <param name="rrd-ds" value="runQlen"/>
+          <param name="rrd-cf" value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="line-color" value="##one"/>
+          <param name="graph-legend" value="Jobs in Queue"/>
+        </leaf>
+      </subtree>
+    </template>
+    <template name="empire-pagewait">
+      <subtree name="ProcessStats">
+        <leaf name="PageWaitNum">
+          <param name="vertical-label" value="Count"/>
+          <param name="data-file" value="%system-id%_empire-pagewait.rrd"/>
+          <param name="comment" value="Jobs Waiting on Page I/O"/>
+          <param name="leaf-type" value="rrd-def"/>
+          <param name="snmp-object" value="$empire_pageWaitNum"/>
+          <param name="rrd-ds" value="pageWaitNum"/>
+          <param name="rrd-cf" value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="line-color" value="##one"/>
+          <param name="graph-legend" value="Page Wait"/>
+        </leaf>
+      </subtree>
+    </template>
+    <template name="empire-diskwait">
+      <subtree name="ProcessStats">
+        <leaf name="DiskWaitNum">
+          <param name="vertical-label" value="Count"/>
+          <param name="data-file" value="%system-id%_empire-diskwait.rrd"/>
+          <param name="comment" value="Jobs Waiting on Disk I/O"/>
+          <param name="leaf-type" value="rrd-def"/>
+          <param name="snmp-object" value="$empire_diskWaitNum"/>
+          <param name="rrd-ds" value="diskWaitNum"/>
+          <param name="rrd-cf" value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="line-color" value="##one"/>
+          <param name="graph-legend" value="Disk Wait"/>
+        </leaf>
+      </subtree>
+    </template>
+    <template name="empire-swapactive">
+      <subtree name="ProcessStats">
+        <leaf name="SwapActive">
+          <param name="vertical-label" value="Count"/>
+          <param name="data-file" value="%system-id%_empire-swapactive.rrd"/>
+          <param name="comment" value="Active Swapped out Jobs"/>
+          <param name="leaf-type" value="rrd-def"/>
+          <param name="snmp-object" value="$empire_swapActive"/>
+          <param name="rrd-ds" value="swapActive"/>
+          <param name="rrd-cf" value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="line-color" value="##one"/>
+          <param name="graph-legend" value="Swapped Jobs"/>
+        </leaf>
+      </subtree>
+    </template>
+    <template name="empire-sleepactive">
+      <subtree name="ProcessStats">
+        <leaf name="SleepActive">
+          <param name="vertical-label" value="Count"/>
+          <param name="data-file" value="%system-id%_empire-sleepactive.rrd"/>
+          <param name="comment" value="Active Sleeping Jobs"/>
+          <param name="leaf-type" value="rrd-def"/>
+          <param name="snmp-object" value="$empire_sleepActive"/>
+          <param name="rrd-ds" value="sleepActive"/>
+          <param name="rrd-cf" value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="line-color" value="##one"/>
+          <param name="graph-legend" value="Sleeping Jobs"/>
+        </leaf>
+      </subtree>
+    </template>
+    <!--
+
+        Empire Load Average
+
+        -->
+    <template name="empire-load">
+      <subtree name="LoadAverage">
+        <param name="comment" value="System Load Averages"/>
+        <leaf name="LoadAverage">
+          <param name="vertical-label" value="Load Average"/>
+          <param name="comment" value="1, 5, and 15 Minute Load Average"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="one,five,fifteen"/>
+          <!-- SYS -->
+          <param name="ds-expr-one" value="{loadAverage1Min},100,/"/>
+          <param name="graph-legend-one" value="1 Minute"/>
+          <param name="line-style-one" value="LINE2"/>
+          <param name="line-color-one" value="##one"/>
+          <param name="line-order-one" value="1"/>
+          <!-- USER -->
+          <param name="ds-expr-five" value="{loadAverage5Min},100,/"/>
+          <param name="graph-legend-five" value="5 Minutes"/>
+          <param name="line-style-five" value="LINE2"/>
+          <param name="line-color-five" value="##two"/>
+          <param name="line-order-five" value="2"/>
+          <!-- WAIT -->
+          <param name="ds-expr-fifteen" value="{loadAverage15Min},100,/"/>
+          <param name="graph-legend-fifteen" value="15 Minute"/>
+          <param name="line-style-fifteen" value="LINE2"/>
+          <param name="line-color-fifteen" value="##three"/>
+          <param name="line-order-fifteen" value="3"/>
+        </leaf>
+        <!-- Component  -->
+        <leaf name="loadAverage1Min">
+          <param name="vertical-label" value="Load Average"/>
+          <param name="data-file" value="%system-id%_empire-load1m.rrd"/>
+          <param name="hidden" value="yes"/>
+          <param name="leaf-type" value="rrd-def"/>
+          <param name="snmp-object" value="$empire_loadAverage1Min"/>
+          <param name="rrd-ds" value="loadAverage1Min"/>
+          <param name="rrd-cf" value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="line-color" value="##one"/>
+          <param name="comment" value="One Minute Load Average"/>
+          <param name="graph-legend" value="1 Min"/>
+        </leaf>
+        <leaf name="loadAverage5Min">
+          <param name="vertical-label" value="Load Average"/>
+          <param name="data-file" value="%system-id%_empire-load5m.rrd"/>
+          <param name="hidden" value="yes"/>
+          <param name="leaf-type" value="rrd-def"/>
+          <param name="snmp-object" value="$empire_loadAverage5Min"/>
+          <param name="rrd-ds" value="loadAverage5Min"/>
+          <param name="rrd-cf" value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="line-color" value="##two"/>
+          <param name="comment" value="Five Minute Load Average"/>
+          <param name="graph-legend" value="5 Min"/>
+        </leaf>
+        <leaf name="loadAverage15Min">
+          <param name="vertical-label" value="Load Average"/>
+          <param name="data-file" value="%system-id%_empire-load15m.rrd"/>
+          <param name="hidden" value="yes"/>
+          <param name="leaf-type" value="rrd-def"/>
+          <param name="snmp-object" value="$empire_loadAverage15Min"/>
+          <param name="rrd-ds" value="loadAverage15Min"/>
+          <param name="rrd-cf" value="AVERAGE"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="line-color" value="##three"/>
+          <param name="comment" value="Fifteen Minute Load Average"/>
+          <param name="graph-legend" value="15 Min"/>
+        </leaf>
+      </subtree>
+    </template>
+    <!--
+
+
+        Empire Total CPU Percent
+            empire-total-cpu-sysp
+            empire-total-cpu-sysp-multi
+            empire-total-cpu-userp
+            empire-total-cpu-userp-multi
+            empire-total-cpu-idlep
+            empire-total-cpu-idlep-multi
+            empire-total-cpu-waitp
+            empire-total-cpu-waitp-multi
+        -->
+    <template name="empire-total-cpu-unix">
+      <apply-template name="empire-total-cpu-common"/>
+      <subtree name="TotalCpu">
+        <leaf name="CpuTotalPercentUsage">
+          <param name="comment">
+            Cpu Idle, Sys, User and Wait Percentage
+          </param>
+          <param name="ds-names" value="sys,user,wait,idle"/>
+          <apply-template name="empire-total-cpu-sysp-multi"/>
+          <apply-template name="empire-total-cpu-userp-multi"/>
+          <apply-template name="empire-total-cpu-idlep-multi"/>
+          <apply-template name="empire-total-cpu-waitp-multi"/>
+        </leaf>
+        <apply-template name="empire-total-cpu-sysp"/>
+        <apply-template name="empire-total-cpu-userp"/>
+        <apply-template name="empire-total-cpu-idlep"/>
+        <apply-template name="empire-total-cpu-waitp"/>
+      </subtree>
+    </template>
+    <template name="empire-total-cpu-solarisSparc">
+      <apply-template name="empire-total-cpu-unix"/>
+    </template>
+    <template name="empire-total-cpu-aix5RS6000">
+      <apply-template name="empire-total-cpu-unix"/>
+    </template>
+    <template name="empire-total-cpu-linuxIntel">
+      <apply-template name="empire-total-cpu-common"/>
+      <subtree name="TotalCpu">
+        <leaf name="CpuTotalPercentUsage">
+          <param name="comment" value="Cpu Idle, Sys and User Percentage"/>
+          <param name="ds-names" value="sys,user,idle"/>
+          <apply-template name="empire-total-cpu-sysp-multi"/>
+          <apply-template name="empire-total-cpu-userp-multi"/>
+          <apply-template name="empire-total-cpu-idlep-multi"/>
+        </leaf>
+        <apply-template name="empire-total-cpu-sysp"/>
+        <apply-template name="empire-total-cpu-userp"/>
+        <apply-template name="empire-total-cpu-idlep"/>
+      </subtree>
+    </template>
+    <template name="empire-total-cpu-nt">
+      <apply-template name="empire-total-cpu-common"/>
+      <subtree name="TotalCpu">
+        <leaf name="CpuTotalPercentUsage">
+          <param name="comment" value="Cpu Idle, Sys and User Percentage"/>
+          <param name="ds-names" value="sys,user,idle"/>
+          <apply-template name="empire-total-cpu-sysp-multi"/>
+          <apply-template name="empire-total-cpu-userp-multi"/>
+          <apply-template name="empire-total-cpu-idlep-multi"/>
+        </leaf>
+        <apply-template name="empire-total-cpu-sysp"/>
+        <apply-template name="empire-total-cpu-userp"/>
+        <apply-template name="empire-total-cpu-idlep"/>
+      </subtree>
+    </template>
+    <template name="empire-total-cpu-nt40Intel">
+      <apply-template name="empire-total-cpu-nt"/>
+    </template>
+    <template name="empire-total-cpu-nt50Intel">
+      <apply-template name="empire-total-cpu-nt"/>
+    </template>
+    <template name="empire-total-cpu-common">
+      <subtree name="TotalCpu">
+        <param name="comment" value="Combined Stats for All CPUs"/>
+        <leaf name="CpuTotalPercentUsage">
+          <param name="vertical-label" value="Percent"/>
+          <param name="graph-upper-limit" value="100"/>
+          <param name="graph-rigid-boundaries" value="yes"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+        </leaf>
+      </subtree>
+    </template>
+    <template name="empire-total-cpu-waitp-multi">
+      <!-- WAIT -->
+      <param name="ds-expr-wait" value="{cpuTotalWaitPercent}"/>
+      <param name="graph-legend-wait" value="Percent Wait"/>
+      <param name="line-style-wait" value="STACK"/>
+      <param name="line-color-wait" value="##three"/>
+      <param name="line-order-wait" value="3"/>
+    </template>
+    <template name="empire-total-cpu-waitp">
+      <leaf name="cpuTotalWaitPercent">
+        <param name="vertical-label" value="Percent"/>
+        <param name="data-file" value="%system-id%_empire-tcpu-waitp.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuTotalWaitPercent"/>
+        <param name="graph-upper-limit" value="100"/>
+        <param name="graph-rigid-boundaries" value="yes"/>
+        <param name="rrd-ds" value="TotalWaitPercent"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment">
+          Percentage of CPU Held by Waiting Processes (CPU /USED/ Waiting)
+        </param>
+        <param name="graph-legend" value="Percent Wait"/>
+      </leaf>
+    </template>
+    <template name="empire-total-cpu-sysp-multi">
+      <!-- SYS -->
+      <param name="ds-expr-sys" value="{cpuTotalSysPercent}"/>
+      <param name="graph-legend-sys" value="Percent sys"/>
+      <param name="line-style-sys" value="AREA"/>
+      <param name="line-color-sys" value="##one"/>
+      <param name="line-order-sys" value="1"/>
+    </template>
+    <template name="empire-total-cpu-userp-multi">
+      <!-- USER -->
+      <param name="ds-expr-user" value="{cpuTotalUserPercent}"/>
+      <param name="graph-legend-user" value="Percent user"/>
+      <param name="line-style-user" value="STACK"/>
+      <param name="line-color-user" value="##two"/>
+      <param name="line-order-user" value="2"/>
+    </template>
+    <template name="empire-total-cpu-idlep-multi">
+      <!-- IDLE -->
+      <param name="ds-expr-idle" value="{cpuTotalIdlePercent}"/>
+      <param name="graph-legend-idle" value="Percent Idle"/>
+      <param name="line-style-idle" value="STACK"/>
+      <param name="line-color-idle" value="##gray"/>
+      <param name="line-order-idle" value="4"/>
+    </template>
+    <template name="empire-total-cpu-sysp">
+      <leaf name="cpuTotalSysPercent">
+        <param name="vertical-label" value="Percent"/>
+        <param name="data-file" value="%system-id%_empire-tcpu-sysp.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuTotalSysPercent"/>
+        <param name="graph-upper-limit" value="100"/>
+        <param name="graph-rigid-boundaries" value="yes"/>
+        <param name="rrd-ds" value="TotalSysPercent"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment">
+          Percentage of CPU used by System Operation
+        </param>
+        <param name="graph-legend" value="Percent Sys"/>
+      </leaf>
+    </template>
+    <template name="empire-total-cpu-userp">
+      <leaf name="cpuTotalUserPercent">
+        <param name="vertical-label" value="Percent"/>
+        <param name="data-file" value="%system-id%_empire-tcpu-userp.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuTotalUserPercent"/>
+        <param name="graph-upper-limit" value="100"/>
+        <param name="graph-rigid-boundaries" value="yes"/>
+        <param name="rrd-ds" value="TotalUserPercent"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment">
+          Percentage of CPU used by User Processes
+        </param>
+        <param name="graph-legend" value="Percent User"/>
+      </leaf>
+    </template>
+    <template name="empire-total-cpu-idlep">
+      <leaf name="cpuTotalIdlePercent">
+        <param name="vertical-label" value="Percent"/>
+        <param name="data-file" value="%system-id%_empire-tcpu-idlep.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuTotalIdlePercent"/>
+        <param name="graph-upper-limit" value="100"/>
+        <param name="graph-rigid-boundaries" value="yes"/>
+        <param name="rrd-ds" value="TotalIdlePercent"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment" value="Percentage of CPU unused"/>
+        <param name="graph-legend" value="Percent Idle"/>
+      </leaf>
+    </template>
+    <!--
+
+
+        Empire Total CPU Raw
+            empire-total-cpu-sys
+            empire-total-cpu-sys-multi
+            empire-total-cpu-user
+            empire-total-cpu-user-multi
+            empire-total-cpu-idle
+            empire-total-cpu-idle-multi
+            empire-total-cpu-wait
+            empire-total-cpu-wait-multi
+
+
+        -->
+    <template name="empire-total-cpu-raw-unix">
+      <apply-template name="empire-total-cpu-raw-common"/>
+      <subtree name="TotalRawCpu">
+        <leaf name="RawCpuTime">
+          <param name="comment" value="Cpu Idle, Sys, User and Wait usage"/>
+          <param name="ds-names" value="sys,user,wait,idle"/>
+          <apply-template name="empire-total-cpu-sys-multi"/>
+          <apply-template name="empire-total-cpu-user-multi"/>
+          <apply-template name="empire-total-cpu-wait-multi"/>
+          <apply-template name="empire-total-cpu-idle-multi"/>
+        </leaf>
+        <apply-template name="empire-total-cpu-sys"/>
+        <apply-template name="empire-total-cpu-user"/>
+        <apply-template name="empire-total-cpu-wait"/>
+        <apply-template name="empire-total-cpu-idle"/>
+      </subtree>
+    </template>
+    <template name="empire-total-cpu-raw-solarisSparc">
+      <apply-template name="empire-total-cpu-raw-unix"/>
+    </template>
+    <template name="empire-total-cpu-raw-aix5RS6000">
+      <apply-template name="empire-total-cpu-raw-unix"/>
+    </template>
+    <template name="empire-total-cpu-raw-linuxIntel">
+      <apply-template name="empire-total-cpu-raw-common"/>
+      <subtree name="TotalRawCpu">
+        <leaf name="RawCpuTime">
+          <param name="comment" value="Cpu Idle, Sys and User Usage"/>
+          <param name="ds-names" value="sys,user,idle"/>
+          <apply-template name="empire-total-cpu-sys-multi"/>
+          <apply-template name="empire-total-cpu-user-multi"/>
+          <apply-template name="empire-total-cpu-idle-multi"/>
+        </leaf>
+        <apply-template name="empire-total-cpu-sys"/>
+        <apply-template name="empire-total-cpu-user"/>
+        <apply-template name="empire-total-cpu-idle"/>
+      </subtree>
+    </template>
+    <template name="empire-total-cpu-raw-nt">
+      <apply-template name="empire-total-cpu-raw-common"/>
+      <subtree name="TotalRawCpu">
+        <leaf name="RawCpuTime">
+          <param name="comment" value="Cpu Idle, Sys and User Usage"/>
+          <param name="ds-names" value="sys,user,idle"/>
+          <apply-template name="empire-total-cpu-sys-multi"/>
+          <apply-template name="empire-total-cpu-user-multi"/>
+          <apply-template name="empire-total-cpu-idle-multi"/>
+        </leaf>
+        <apply-template name="empire-total-cpu-sys"/>
+        <apply-template name="empire-total-cpu-user"/>
+        <apply-template name="empire-total-cpu-idle"/>
+      </subtree>
+    </template>
+    <template name="empire-total-cpu-raw-nt40Intel">
+      <apply-template name="empire-total-cpu-raw-nt"/>
+    </template>
+    <template name="empire-total-cpu-raw-nt50Intel">
+      <apply-template name="empire-total-cpu-raw-nt"/>
+    </template>
+    <template name="empire-total-cpu-raw-common">
+      <subtree name="TotalRawCpu">
+        <param name="comment" value="Total System CPU Stats in Ticks"/>
+        <param name="hidden" value="yes"/>
+        <leaf name="RawCpuTime">
+          <param name="vertical-label" value="Ticks"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+        </leaf>
+      </subtree>
+    </template>
+    <template name="empire-total-cpu-sys-multi">
+      <!-- SYS -->
+      <param name="ds-expr-sys" value="{cpuTotalSys}"/>
+      <param name="graph-legend-sys" value="sys"/>
+      <param name="line-style-sys" value="AREA"/>
+      <param name="line-color-sys" value="##one"/>
+      <param name="line-order-sys" value="1"/>
+    </template>
+    <template name="empire-total-cpu-user-multi">
+      <!-- USER -->
+      <param name="ds-expr-user" value="{cpuTotalUser}"/>
+      <param name="graph-legend-user" value="user"/>
+      <param name="line-style-user" value="STACK"/>
+      <param name="line-color-user" value="##two"/>
+      <param name="line-order-user" value="2"/>
+      <param name="line-order-wait" value="3"/>
+    </template>
+    <template name="empire-total-cpu-idle-multi">
+      <!-- IDLE -->
+      <param name="ds-expr-idle" value="{cpuTotalIdle}"/>
+      <param name="graph-legend-idle" value="Idle"/>
+      <param name="line-style-idle" value="STACK"/>
+      <param name="line-color-idle" value="##gray"/>
+      <param name="line-order-idle" value="4"/>
+    </template>
+    <template name="empire-total-cpu-wait-multi">
+      <!-- WAIT -->
+      <param name="ds-expr-wait" value="{cpuTotalWait}"/>
+      <param name="graph-legend-wait" value="Wait"/>
+      <param name="line-style-wait" value="STACK"/>
+      <param name="line-color-wait" value="##three"/>
+    </template>
+    <template name="empire-total-cpu-sys">
+      <leaf name="cpuTotalSys">
+        <param name="vertical-label" value="Ticks"/>
+        <param name="data-file" value="%system-id%_empire-tcpu-raw-sys.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuTotalSys"/>
+        <param name="rrd-ds" value="TotalSys"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment" value="CPU used by System Operation"/>
+        <param name="graph-legend" value="Sys"/>
+      </leaf>
+    </template>
+    <template name="empire-total-cpu-user">
+      <leaf name="cpuTotalUser">
+        <param name="vertical-label" value="Ticks"/>
+        <param name="data-file" value="%system-id%_empire-tcpu-raw-user.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuTotalUser"/>
+        <param name="rrd-ds" value="TotalUser"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment" value="CPU used by User Processes"/>
+        <param name="graph-legend" value="User"/>
+      </leaf>
+    </template>
+    <template name="empire-total-cpu-idle">
+      <leaf name="cpuTotalIdle">
+        <param name="vertical-label" value="Ticks"/>
+        <param name="data-file" value="%system-id%_empire-tcpu-raw-idle.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuTotalIdle"/>
+        <param name="rrd-ds" value="TotalIdle"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment" value="CPU unused"/>
+        <param name="graph-legend" value="Idle"/>
+      </leaf>
+    </template>
+    <template name="empire-total-cpu-wait">
+      <leaf name="cpuTotalWait">
+        <param name="vertical-label" value="Ticks"/>
+        <param name="data-file" value="%system-id%_empire-tcpu-raw-wait.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuTotalWait"/>
+        <param name="rrd-ds" value="TotalWait"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment">
+          CPU Held by Waiting Processes (CPU /USED/ Waiting)
+        </param>
+        <param name="graph-legend" value="Wait"/>
+      </leaf>
+    </template>
+    <!--
+
+        Empire Per CPU Percent
+            empire-cpu-syspct
+            empire-cpu-syspct-multi
+            empire-cpu-userpct
+            empire-cpu-userpct-multi
+            empire-cpu-idlepct
+            empire-cpu-idlepct-multi
+            empire-cpu-waitpct
+            empire-cpu-waitpct-multi
+
+        -->
+    <template name="empire-cpu-subtree">
+      <param name="comment" value="Per-CPU Usage"/>
+      <param name="precedence" value="-400"/>
+      
+      <param name="has-overview-shortcuts" value="yes"/>
+      <param name="overview-shortcuts" value="cpu"/>
+      <param name="overview-subleave-name-cpu" value="CpuPercentUsage"/>
+      <param name="overview-shortcut-text-cpu"
+          value="All CPUs"/>
+      <param name="overview-shortcut-title-cpu"
+          value="Show Percent CPU usage for each cpu"/>
+      <param name="overview-page-title-cpu" value="CPU Percent Usage Graphs"/>
+    </template>
+    <template name="empire-cpu-nt">
+      <apply-template name="empire-cpu-common"/>
+      <leaf name="CpuPercentUsage">
+        <param name="comment" value="Cpu Idle, Sys and User Percentage"/>
+        <param name="ds-names" value="sys,user,idle"/>
+        <apply-template name="empire-cpu-syspct-multi"/>
+        <apply-template name="empire-cpu-idlepct-multi"/>
+        <apply-template name="empire-cpu-userpct-multi"/>
+      </leaf>
+      <apply-template name="empire-cpu-syspct"/>
+      <apply-template name="empire-cpu-idlepct"/>
+      <apply-template name="empire-cpu-userpct"/>
+    </template>
+    <template name="empire-cpu-nt40Intel">
+      <apply-template name="empire-cpu-nt"/>
+    </template>
+    <template name="empire-cpu-nt50Intel">
+      <apply-template name="empire-cpu-nt"/>
+    </template>
+    <template name="empire-cpu-unix">
+      <apply-template name="empire-cpu-common"/>
+      <leaf name="CpuPercentUsage">
+        <param name="comment">
+          Cpu Idle, Sys, User and Wait Percentage
+        </param>
+        <param name="ds-names" value="sys,user,idle,wait"/>
+        <apply-template name="empire-cpu-syspct-multi"/>
+        <apply-template name="empire-cpu-idlepct-multi"/>
+        <apply-template name="empire-cpu-userpct-multi"/>
+        <apply-template name="empire-cpu-waitpct-multi"/>
+      </leaf>
+      <apply-template name="empire-cpu-syspct"/>
+      <apply-template name="empire-cpu-idlepct"/>
+      <apply-template name="empire-cpu-userpct"/>
+      <apply-template name="empire-cpu-waitpct"/>
+    </template>
+    <template name="empire-cpu-solarisSparc">
+      <apply-template name="empire-cpu-unix"/>
+    </template>
+    <template name="empire-cpu-aix5RS6000">
+      <apply-template name="empire-cpu-unix"/>
+    </template>
+    <template name="empire-cpu-linuxIntel">
+      <apply-template name="empire-cpu-common"/>
+      <leaf name="CpuPercentUsage">
+        <param name="comment" value="Cpu Idle, Sys and User Percentage"/>
+        <param name="ds-names" value="sys,user,idle"/>
+        <apply-template name="empire-cpu-syspct-multi"/>
+        <apply-template name="empire-cpu-idlepct-multi"/>
+        <apply-template name="empire-cpu-userpct-multi"/>
+      </leaf>
+      <apply-template name="empire-cpu-syspct"/>
+      <apply-template name="empire-cpu-idlepct"/>
+      <apply-template name="empire-cpu-userpct"/>
+    </template>
+    <template name="empire-cpu-common">
+      <leaf name="CpuPercentUsage">
+        <param name="vertical-label" value="Percent"/>
+        <param name="graph-upper-limit" value="100"/>
+        <param name="graph-rigid-boundaries" value="yes"/>
+        <param name="ds-type" value="rrd-multigraph"/>
+      </leaf>
+    </template>
+    <template name="empire-cpu-syspct-multi">
+      <!-- SYS -->
+      <param name="ds-expr-sys" value="{cpuSysPercent}"/>
+      <param name="graph-legend-sys" value="Percent sys"/>
+      <param name="line-style-sys" value="AREA"/>
+      <param name="line-color-sys" value="##one"/>
+      <param name="line-order-sys" value="1"/>
+    </template>
+    <template name="empire-cpu-userpct-multi">
+      <!-- USER -->
+      <param name="ds-expr-user" value="{cpuUserPercent}"/>
+      <param name="graph-legend-user" value="Percent user"/>
+      <param name="line-style-user" value="STACK"/>
+      <param name="line-color-user" value="##two"/>
+      <param name="line-order-user" value="2"/>
+    </template>
+    <template name="empire-cpu-idlepct-multi">
+      <!-- IDLE -->
+      <param name="ds-expr-idle" value="{cpuIdlePercent}"/>
+      <param name="graph-legend-idle" value="Percent Idle"/>
+      <param name="line-style-idle" value="STACK"/>
+      <param name="line-color-idle" value="##gray"/>
+      <param name="line-order-idle" value="4"/>
+    </template>
+    <template name="empire-cpu-waitpct-multi">
+      <!-- WAIT -->
+      <param name="ds-expr-wait" value="{cpuWaitPercent}"/>
+      <param name="graph-legend-wait" value="Percent Wait"/>
+      <param name="line-style-wait" value="STACK"/>
+      <param name="line-color-wait" value="##three"/>
+      <param name="line-order-wait" value="3"/>
+    </template>
+    <template name="empire-cpu-syspct">
+      <leaf name="cpuSysPercent">
+        <param name="vertical-label" value="Percent"/>
+        <param name="data-file" value="%system-id%_empire-cpu%cpu%-syspct.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuSysPercent.$empire_cpu_IDX"/>
+        <param name="graph-upper-limit" value="100"/>
+        <param name="graph-rigid-boundaries" value="yes"/>
+        <param name="rrd-ds" value="SysPercent"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment">
+          Percentage of CPU used by System Operation
+        </param>
+        <param name="graph-legend" value="Percent Sys"/>
+      </leaf>
+    </template>
+    <template name="empire-cpu-userpct">
+      <leaf name="cpuUserPercent">
+        <param name="vertical-label" value="Percent"/>
+        <param name="data-file" value="%system-id%_empire-cpu%cpu%-userpct.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuUserPercent.$empire_cpu_IDX"/>
+        <param name="graph-upper-limit" value="100"/>
+        <param name="graph-rigid-boundaries" value="yes"/>
+        <param name="rrd-ds" value="UserPercent"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment">
+          Percentage of CPU used by User Processes
+        </param>
+        <param name="graph-legend" value="Percent User"/>
+      </leaf>
+    </template>
+    <template name="empire-cpu-idlepct">
+      <leaf name="cpuIdlePercent">
+        <param name="vertical-label" value="Percent"/>
+        <param name="data-file" value="%system-id%_empire-cpu%cpu%-idlepct.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuIdlePercent.$empire_cpu_IDX"/>
+        <param name="graph-upper-limit" value="100"/>
+        <param name="graph-rigid-boundaries" value="yes"/>
+        <param name="rrd-ds" value="IdlePercent"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment" value="Percentage of CPU unused"/>
+        <param name="graph-legend" value="Percent Idle"/>
+      </leaf>
+    </template>
+    <template name="empire-cpu-waitpct">
+      <leaf name="cpuWaitPercent">
+        <param name="vertical-label" value="Percent"/>
+        <param name="data-file" value="%system-id%_empire-cpu%cpu%-waitpct.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuWaitPercent.$empire_cpu_IDX"/>
+        <param name="graph-upper-limit" value="100"/>
+        <param name="graph-rigid-boundaries" value="yes"/>
+        <param name="rrd-ds" value="WaitPercent"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment">
+          Percentage of CPU Held by Waiting Processes (CPU /USED/ Waiting)
+        </param>
+        <param name="graph-legend" value="Percent Wait"/>
+      </leaf>
+    </template>
+    <!--
+
+        Empire CPU Raw
+            empire-cpu-sys
+            empire-cpu-sys-multi
+            empire-cpu-user
+            empire-cpu-user-multi
+            empire-cpu-idle
+            empire-cpu-idle-multi
+            empire-cpu-wait
+            empire-cpu-wait-multi
+
+        -->
+    <template name="empire-cpu-raw-unix">
+      <apply-template name="empire-cpu-raw-common"/>
+      <subtree name="RawCpu">
+        <leaf name="RawCpuTime">
+          <param name="comment" value="Cpu Idle, Sys, User and Wait Time"/>
+          <param name="ds-names" value="sys,user,wait,idle"/>
+          <apply-template name="empire-cpu-sys-multi"/>
+          <apply-template name="empire-cpu-user-multi"/>
+          <apply-template name="empire-cpu-wait-multi"/>
+          <apply-template name="empire-cpu-idle-multi"/>
+        </leaf>
+        <apply-template name="empire-cpu-sys"/>
+        <apply-template name="empire-cpu-user"/>
+        <apply-template name="empire-cpu-wait"/>
+        <apply-template name="empire-cpu-idle"/>
+      </subtree>
+    </template>
+    <template name="empire-cpu-raw-solarisSparc">
+      <apply-template name="empire-cpu-raw-unix"/>
+    </template>
+    <template name="empire-cpu-raw-aix5RS6000">
+      <apply-template name="empire-cpu-raw-unix"/>
+    </template>
+    <template name="empire-cpu-raw-linuxIntel">
+      <apply-template name="empire-cpu-raw-common"/>
+      <subtree name="RawCpu">
+        <leaf name="RawCpuTime">
+          <param name="comment" value="Cpu Idle, Sys, and User Time"/>
+          <param name="ds-names" value="sys,user,idle"/>
+          <apply-template name="empire-cpu-sys-multi"/>
+          <apply-template name="empire-cpu-user-multi"/>
+          <apply-template name="empire-cpu-idle-multi"/>
+        </leaf>
+        <apply-template name="empire-cpu-sys"/>
+        <apply-template name="empire-cpu-user"/>
+        <apply-template name="empire-cpu-idle"/>
+      </subtree>
+    </template>
+    <template name="empire-cpu-raw-nt">
+      <apply-template name="empire-cpu-raw-common"/>
+      <subtree name="RawCpu">
+        <leaf name="RawCpuTime">
+          <param name="comment" value="Cpu Idle, Sys and User"/>
+          <param name="ds-names" value="sys,user,idle"/>
+          <apply-template name="empire-cpu-sys-multi"/>
+          <apply-template name="empire-cpu-user-multi"/>
+          <apply-template name="empire-cpu-idle-multi"/>
+        </leaf>
+        <apply-template name="empire-cpu-sys"/>
+        <apply-template name="empire-cpu-user"/>
+        <apply-template name="empire-cpu-idle"/>
+      </subtree>
+    </template>
+    <template name="empire-cpu-raw-nt40Intel">
+      <apply-template name="empire-cpu-raw-nt"/>
+    </template>
+    <template name="empire-cpu-raw-nt50Intel">
+      <apply-template name="empire-cpu-raw-nt"/>
+    </template>
+    <template name="empire-cpu-raw-common">
+      <subtree name="RawCpu">
+        <param name="comment" value="Per-Cpu Stats in Ticks"/>
+        <param name="hidden" value="yes"/>
+        <leaf name="RawCpuTime">
+          <param name="vertical-label" value="Ticks"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+        </leaf>
+      </subtree>
+    </template>
+    <template name="empire-cpu-sys-multi">
+      <!-- SYS -->
+      <param name="ds-expr-sys" value="{cpuSys}"/>
+      <param name="graph-legend-sys" value="sys"/>
+      <param name="line-style-sys" value="AREA"/>
+      <param name="line-color-sys" value="##one"/>
+      <param name="line-order-sys" value="1"/>
+    </template>
+    <template name="empire-cpu-user-multi">
+      <!-- USER -->
+      <param name="ds-expr-user" value="{cpuUser}"/>
+      <param name="graph-legend-user" value="user"/>
+      <param name="line-style-user" value="STACK"/>
+      <param name="line-color-user" value="##two"/>
+      <param name="line-order-user" value="2"/>
+    </template>
+    <template name="empire-cpu-idle-multi">
+      <!-- IDLE -->
+      <param name="ds-expr-idle" value="{cpuIdle}"/>
+      <param name="graph-legend-idle" value="Idle"/>
+      <param name="line-style-idle" value="STACK"/>
+      <param name="line-color-idle" value="##gray"/>
+      <param name="line-order-idle" value="4"/>
+    </template>
+    <template name="empire-cpu-wait-multi">
+      <!-- WAIT -->
+      <param name="ds-expr-wait" value="{cpuWait}"/>
+      <param name="graph-legend-wait" value="Wait"/>
+      <param name="line-style-wait" value="STACK"/>
+      <param name="line-color-wait" value="##three"/>
+      <param name="line-order-wait" value="3"/>
+    </template>
+    <template name="empire-cpu-sys">
+      <leaf name="cpuSys">
+        <param name="data-file" value="%system-id%_empire-cpu%cpu%-raw-sys.rrd"/>
+        <param name="vertical-label" value="Ticks"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuSys.$empire_cpu_IDX"/>
+        <param name="rrd-ds" value="Sys"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment" value="CPU used by System Operation"/>
+        <param name="graph-legend" value="Sys"/>
+      </leaf>
+    </template>
+    <template name="empire-cpu-user">
+      <leaf name="cpuUser">
+        <param name="data-file" value="%system-id%_empire-cpu%cpu%-raw-user.rrd"/>
+        <param name="vertical-label" value="Ticks"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuUser.$empire_cpu_IDX"/>
+        <param name="rrd-ds" value="User"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment" value="CPU used by User Processes"/>
+        <param name="graph-legend" value="User"/>
+      </leaf>
+    </template>
+    <template name="empire-cpu-idle">
+      <leaf name="cpuIdle">
+        <param name="data-file" value="%system-id%_empire-cpu%cpu%-raw-idle.rrd"/>
+        <param name="vertical-label" value="Ticks"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuIdle.$empire_cpu_IDX"/>
+        <param name="rrd-ds" value="Idle"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment" value="CPU unused"/>
+        <param name="graph-legend" value="Idle"/>
+      </leaf>
+    </template>
+    <template name="empire-cpu-wait">
+      <leaf name="cpuWait">
+        <param name="data-file" value="%system-id%_empire-cpu%cpu%-raw-wait.rrd"/>
+        <param name="vertical-label" value="Ticks"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_cpuWait.$empire_cpu_IDX"/>
+        <param name="rrd-ds" value="Wait"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment"> CPU Held by Waiting Processes (CPU /USED/
+          Waiting) </param>
+        <param name="graph-legend" value="Wait"/>
+      </leaf>
+    </template>
+    <!--
+
+
+        Empire Device Template (Disks)
+
+
+        -->
+    <template name="empire-device-subtree">
+      <param name="comment" value="Per-Mount Usage"/>
+      <param name="precedence" value="-400"/>
+      <param name="has-overview-shortcuts" value="yes"/>
+      <param name="overview-shortcuts" value="disk"/>
+      <param name="overview-subleave-name-disk" value="DiskSpace"/>
+      <param name="overview-shortcut-text-disk"
+          value="All Disk Space"/>
+      <param name="overview-shortcut-title-disk"
+          value="Show Disk Space usage for Each Mount"/>
+      <param name="overview-page-title-disk" value="Disk Space Usage Graphs"/>
+    </template>
+    <template name="empire-device">
+      <leaf name="DiskSpace">
+        <param name="vertical-label" value="Bytes"/>
+        <param name="rrd-scaling-base" value="1024"/>
+        <param name="comment" value="Total vs. Used Disk Space"/>
+        <param name="ds-type" value="rrd-multigraph"/>
+        <param name="ds-names" value="used,total"/>
+        <param name="ds-expr-total"> {devTblks} </param>
+        <param name="graph-legend-total" value="Disk Space Total"/>
+        <param name="line-style-total" value="AREA"/>
+        <param name="line-color-total" value="##two"/>
+        <param name="line-order-total" value="1"/>
+        <!-- USED -->
+        <param name="ds-expr-used"> {devTblks},{devFblks},- </param>
+        <param name="graph-legend-used" value="Disk Space Used"/>
+        <param name="line-style-used" value="AREA"/>
+        <param name="line-color-used" value="##three"/>
+        <param name="line-order-used" value="2"/>
+      </leaf>
+      <leaf name="devFblks">
+        <param name="data-file" value="%system-id%_empire-%storage-nick%-fblocks.rrd"/>
+        <param name="vertical-label" value="Bytes"/>
+        <param name="rrd-scaling-base" value="1024"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_devFblks.$empire_dev_IDX"/>
+        <param name="rrd-ds" value="empire_devFblks"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment" value="Disk Space Free (Bytes)"/>
+        <param name="graph-legend" value="Disk Space Free"/>
+      </leaf>
+      <leaf name="devTblks">
+        <param name="data-file" value="%system-id%_empire-%storage-nick%-tblocks.rrd"/>
+        <param name="vertical-label" value="Bytes"/>
+        <param name="rrd-scaling-base" value="1024"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_devTblks.$empire_dev_IDX"/>
+        <param name="rrd-ds" value="empire_devTblks"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment" value="Total Disk Space (Bytes)"/>
+        <param name="graph-legend" value="Total Disk Space"/>
+      </leaf>
+    </template>
+    <!--
+
+        Empire Disk Stats Template
+            empire-disk-stats-queuelength
+            empire-disk-stats-servicetime
+            empire-disk-stats-utilization
+            empire-disk-stats-bytestransfered
+            empire-disk-stats-transferes
+            empire-disk-stats-reads
+            empire-disk-stats-writes
+
+        -->
+    <template name="empire-disk-stats-subtree">
+      <param name="comment" value="Per-Disk Utilization"/>
+      <param name="precedence" value="-400"/>
+      <param name="has-overview-shortcuts" value="yes"/>
+      <param name="overview-shortcuts" value="util"/>
+      <param name="overview-subleave-name-util" value="Utilization"/>
+      <param name="overview-shortcut-text-util"
+              value="All disks"/>
+      <param name="overview-shortcut-title-util"
+              value="Show Stats for all Disks"/>
+      <param name="overview-page-title-util" value="Device for all Disks"/>
+    </template>
+
+    <template name="empire-disk-stats-unix">
+        <apply-template name="empire-disk-stats-queuelength"/>
+        <apply-template name="empire-disk-stats-servicetime"/>
+        <apply-template name="empire-disk-stats-utilization"/>
+        <apply-template name="empire-disk-stats-bytestransfered"/>
+        <apply-template name="empire-disk-stats-transferes"/>
+        <apply-template name="empire-disk-stats-reads"/>
+        <apply-template name="empire-disk-stats-writes"/>
+    </template>
+
+    <template name="empire-disk-stats-solarisSparc">
+        <apply-template name="empire-disk-stats-queuelength"/>
+        <apply-template name="empire-disk-stats-servicetime"/>
+        <apply-template name="empire-disk-stats-utilization"/>
+        <apply-template name="empire-disk-stats-bytestransfered"/>
+        <apply-template name="empire-disk-stats-transferes"/>
+        <apply-template name="empire-disk-stats-reads"/>
+        <apply-template name="empire-disk-stats-writes"/>
+    </template>
+
+    <template name="empire-disk-stats-aix5RS6000">
+        <apply-template name="empire-disk-stats-servicetime"/>
+        <apply-template name="empire-disk-stats-utilization"/>
+        <apply-template name="empire-disk-stats-bytestransfered"/>
+        <apply-template name="empire-disk-stats-transferes"/>
+        <apply-template name="empire-disk-stats-reads"/>
+        <apply-template name="empire-disk-stats-writes"/>
+    </template>
+
+    <template name="empire-disk-stats-linuxIntel">
+        <apply-template name="empire-disk-stats-bytestransfered"/>
+        <apply-template name="empire-disk-stats-transferes"/>
+        <apply-template name="empire-disk-stats-reads"/>
+        <apply-template name="empire-disk-stats-writes"/>
+    </template>
+
+    <template name="empire-disk-stats-nt">
+        <apply-template name="empire-disk-stats-queuelength"/>
+        <apply-template name="empire-disk-stats-servicetime"/>
+        <apply-template name="empire-disk-stats-utilization"/>
+        <apply-template name="empire-disk-stats-bytestransfered"/>
+        <apply-template name="empire-disk-stats-transferes"/>
+        <apply-template name="empire-disk-stats-reads"/>
+        <apply-template name="empire-disk-stats-writes"/>
+    </template>
+
+    <template name="empire-disk-stats-nt40Intel">
+      <apply-template name="empire-disk-stats-nt"/>
+    </template>
+
+    <template name="empire-disk-stats-nt50Intel">
+      <apply-template name="empire-disk-stats-nt"/>
+    </template>
+
+    <template name="empire-disk-stats-queuelength">
+      <leaf name="QueueLength">
+        <param name="data-file" value="%system-id%_empire-%disk-stats-nick%-qlen.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="hidden" value="no"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_diskStatsQueueLength.$empire_disk_stats_IDX"/>
+        <param name="rrd-ds" value="QueueLength"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment" value="Ave. Events Waiting in Service Queue"/>
+        <param name="graph-legend" value="Device Queue Length"/>
+      </leaf>
+    </template>
+    <template name="empire-disk-stats-servicetime">
+      <leaf name="ServiceTime">
+        <param name="data-file" value="%system-id%_empire-%disk-stats-nick%-svct.rrd"/>
+        <param name="vertical-label" value="Time"/>
+        <param name="hidden" value="no"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_diskStatsServiceTime.$empire_disk_stats_IDX"/>
+        <param name="rrd-ds" value="ServiceTime"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment" value="Ave. Time to Service a Request (ms)"/>
+        <param name="graph-legend" value="Device Service Time"/>
+      </leaf>
+    </template>
+    <template name="empire-disk-stats-utilization">
+      <leaf name="Utilization">
+        <param name="data-file" value="%system-id%_empire-%disk-stats-nick%-util.rrd"/>
+        <param name="vertical-label" value="Percent"/>
+        <param name="hidden" value="no"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_diskStatsUtilization.$empire_disk_stats_IDX"/>
+        <param name="rrd-ds" value="Utilization"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment" value="Percent of time disk was busy"/>
+        <param name="graph-legend" value="Device Utilization"/>
+      </leaf>
+    </template>
+    <template name="empire-disk-stats-bytestransfered">
+      <leaf name="BytesTransfered">
+        <param name="data-file" value="%system-id%_empire-%disk-stats-nick%-bytest.rrd"/>
+        <param name="vertical-label" value="Bytes"/>
+        <param name="hidden" value="no"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="collector-scale" value="1024,*"/>
+        <param name="rrd-scaling-base" value="1024"/>
+        <param name="snmp-object" value="$empire_diskStatsKBTransfered.$empire_disk_stats_IDX"/>
+        <param name="rrd-ds" value="KBTransfered"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment" value="Bytes Transfered"/>
+        <param name="graph-legend" value="Bytes Transfered"/>
+      </leaf>
+    </template>
+    <template name="empire-disk-stats-transferes">
+      <leaf name="Transfers">
+        <param name="data-file" value="%system-id%_empire-%disk-stats-nick%-xfers.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="hidden" value="no"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_diskStatsTransfers.$empire_disk_stats_IDX"/>
+        <param name="rrd-ds" value="Transfers"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment" value="Transfers"/>
+        <param name="graph-legend" value="Transfers"/>
+      </leaf>
+    </template>
+    <template name="empire-disk-stats-reads">
+      <leaf name="Reads">
+        <param name="data-file" value="%system-id%_empire-%disk-stats-nick%-reads.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="hidden" value="no"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_diskStatsReads.$empire_disk_stats_IDX"/>
+        <param name="rrd-ds" value="Reads"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment" value="Reads"/>
+        <param name="graph-legend" value="Reads"/>
+      </leaf>
+    </template>
+    <template name="empire-disk-stats-writes">
+      <leaf name="Writes">
+        <param name="data-file" value="%system-id%_empire-%disk-stats-nick%-writes.rrd"/>
+        <param name="vertical-label" value="Count"/>
+        <param name="hidden" value="no"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$empire_diskStatsWrites.$empire_disk_stats_IDX"/>
+        <param name="rrd-ds" value="Writes"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment" value="Writes"/>
+        <param name="graph-legend" value="Writes"/>
+      </leaf>
+    </template>
+  </datasources>
+</configuration>
diff --git a/torrus/xmlconfig/vendor/f5.bigip.xml b/torrus/xmlconfig/vendor/f5.bigip.xml
new file mode 100644 (file)
index 0000000..dd74973
--- /dev/null
@@ -0,0 +1,842 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003 Shawn Ferry
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: f5.bigip.xml,v 1.1 2010-12-27 00:04:25 ivan Exp $
+  Shawn Ferry <sferry at sevenspace dot com> <lalartu at obscure dot org>
+
+  Tested With: BIG-IP Version 4.5PTF-03 Build2
+
+-->
+
+<!-- Cisco Firewall specific definitions -->
+
+<configuration>
+
+<definitions>
+
+  <!-- LOAD-BAL-SYSTEM-MIB -->
+  <!-- 4.x -->
+  <!--      F5                             1.3.6.1.4.1.3375 -->
+  <!--      f5systems                      1.3.6.1.4.1.3375.1 -->
+  <!--      loadbal                        1.3.6.1.4.1.3375.1.1 -->
+  <!--      globals                        1.3.6.1.4.1.3375.1.1.1 -->
+  <def name="globalStatCurrentConn" value="1.3.6.1.4.1.3375.1.1.1.2.10.0"/>
+  <def name="globalStatMaxConn" value="1.3.6.1.4.1.3375.1.1.1.2.11.0"/>
+  <def name="globalStatTotalConn" value="1.3.6.1.4.1.3375.1.1.1.2.12.0"/>
+
+  <def name="globalStatMemoryPoolTotal" value="1.3.6.1.4.1.3375.1.1.1.2.14.0"/>
+  <def name="globalStatMemoryPoolUsed" value="1.3.6.1.4.1.3375.1.1.1.2.15.0"/>
+  <def name="globalStatVirtualServerDupSynSSL"
+    value="1.3.6.1.4.1.3375.1.1.1.2.22.0"/> <!-- new -->
+
+  <def name="globalStatMaxConnPortDeny" value="1.3.6.1.4.1.3375.1.1.1.2.26.0"/>
+  <def name="globalStatSSLTimeouts" value="1.3.6.1.4.1.3375.1.1.1.2.35.0"/>
+  <!-- new -->
+  <def name="globalStatMemoryErrors" value="1.3.6.1.4.1.3375.1.1.1.2.42.0"/>
+  <def name="globalStatMemoryInUse" value="1.3.6.1.4.1.3375.1.1.1.2.44.0"/>
+  <def name="globalStatMemoryCurrentSize"
+       value="1.3.6.1.4.1.3375.1.1.1.2.46.0"/>
+
+  <!-- Virtual Servers                      1.3.6.1.4.1.3375.1.1.3 -->
+  <def name="virtualServerConnLimit" value="1.3.6.1.4.1.3375.1.1.3.2.1.4"/>
+  <def name="virtualServerOctetsIn" value="1.3.6.1.4.1.3375.1.1.3.2.1.13"/>
+  <def name="virtualServerOctetsOut" value="1.3.6.1.4.1.3375.1.1.3.2.1.14"/>
+  <def name="virtualServerPacketsIn" value="1.3.6.1.4.1.3375.1.1.3.2.1.15"/>
+  <def name="virtualServerPacketsOut" value="1.3.6.1.4.1.3375.1.1.3.2.1.16"/>
+  <def name="virtualServerCurrentConn" value="1.3.6.1.4.1.3375.1.1.3.2.1.17"/>
+  <def name="virtualServerMaxConn" value="1.3.6.1.4.1.3375.1.1.3.2.1.18"/>
+  <def name="virtualServerTotalConn" value="1.3.6.1.4.1.3375.1.1.3.2.1.19"/>
+
+
+  <!-- Pool                     1.3.6.1.4.1.3375.1.1.7 -->
+  <def name="poolBitsin" value="1.3.6.1.4.1.3375.1.1.7.2.1.5"/>
+  <def name="poolBitsout" value="1.3.6.1.4.1.3375.1.1.7.2.1.6"/>
+  <def name="poolPktsin" value="1.3.6.1.4.1.3375.1.1.7.2.1.9"/>
+  <def name="poolPktsout" value="1.3.6.1.4.1.3375.1.1.7.2.1.10"/>
+  <def name="poolCurrentConn" value="1.3.6.1.4.1.3375.1.1.7.2.1.14"/>
+  <def name="poolTotalConn" value="1.3.6.1.4.1.3375.1.1.7.2.1.15"/>
+
+  <!-- Pool Member                    1.3.6.1.4.1.3375.1.1.8 -->
+  <def name="poolMemberBitsin" value="1.3.6.1.4.1.3375.1.1.8.2.1.9"/>
+  <def name="poolMemberBitsout" value="1.3.6.1.4.1.3375.1.1.8.2.1.10"/>
+  <def name="poolMemberPktsin" value="1.3.6.1.4.1.3375.1.1.8.2.1.13"/>
+  <def name="poolMemberPktsout" value="1.3.6.1.4.1.3375.1.1.8.2.1.14"/>
+  <def name="poolMemberConnLimit" value="1.3.6.1.4.1.3375.1.1.8.2.1.17"/>
+  <def name="poolMemberCurrentConn" value="1.3.6.1.4.1.3375.1.1.8.2.1.19"/>
+  <def name="poolMemberTotalConn" value="1.3.6.1.4.1.3375.1.1.8.2.1.20"/>
+
+  <!-- SSL Proxy                           1.3.6.1.4.1.3375.1.1.9 -->
+  <!-- SSL sslProxyTable                   1.3.6.1.4.1.3375.1.1.9.2 -->
+  <!-- SSL sslProxyEntry                   1.3.6.1.4.1.3375.1.1.9.2.1 -->
+  <def name="sslProxyOrigIpAddress" value="1.3.6.1.4.1.3375.1.1.9.2.1.1"/>
+  <def name="sslProxyOrigPort" value="1.3.6.1.4.1.3375.1.1.9.2.1.2"/>
+  <def name="sslProxyDestIpAddress" value="1.3.6.1.4.1.3375.1.1.9.2.1.3"/>
+  <def name="sslProxyDestPort" value="1.3.6.1.4.1.3375.1.1.9.2.1.4"/>
+  <def name="sslProxyBitsin" value="1.3.6.1.4.1.3375.1.1.9.2.1.17"/>
+  <def name="sslProxyBitsout" value="1.3.6.1.4.1.3375.1.1.9.2.1.18"/>
+  <def name="sslProxyPktsin" value="1.3.6.1.4.1.3375.1.1.9.2.1.19"/>
+  <def name="sslProxyPktsout" value="1.3.6.1.4.1.3375.1.1.9.2.1.20"/>
+  <def name="sslProxyConnLimit" value="1.3.6.1.4.1.3375.1.1.9.2.1.23"/>
+  <def name="sslProxyMaxConn" value="1.3.6.1.4.1.3375.1.1.9.2.1.24"/>
+  <def name="sslProxyCurrentConn" value="1.3.6.1.4.1.3375.1.1.9.2.1.25"/>
+  <def name="sslProxyTotalConn" value="1.3.6.1.4.1.3375.1.1.9.2.1.26"/>
+  <def name="sslProxyClientInvalidVersions"
+                value="1.3.6.1.4.1.3375.1.1.9.2.1.32"/>
+  <def name="sslProxyServerInvalidVersions"
+                value="1.3.6.1.4.1.3375.1.1.9.2.1.33"/>
+
+
+  <!-- 3.x -->
+  <def name="contot"       value="1.3.6.1.4.1.3375.1.1.51.0"/>
+  <def name="conmax"       value="1.3.6.1.4.1.3375.1.1.53.0"/>
+  <def name="memoryUsed"       value="1.3.6.1.4.1.3375.1.1.77.0"/>
+  <def name="memoryTotal"       value="1.3.6.1.4.1.3375.1.1.78.0"/>
+
+</definitions>
+
+<datasources>
+
+  <template name="BigIp_4.x">
+    <leaf name="MaxConnections">
+      <param name="hidden" value="yes"/>
+      <param name="comment">
+          Max Connections per second
+      </param>
+      <param name="vertical-label" value="connections/s"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_cons.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$globalStatMaxConn"/>
+      <param name="rrd-ds" value="MaxConn"/>
+      <param name="graph-legend" value="MaxConns"/>
+    </leaf>
+    <leaf name="ConnectionRate">
+      <param name="comment">
+        Connections per second
+      </param>
+      <param name="vertical-label" value="connections/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_cons.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$globalStatTotalConn"/>
+      <param name="rrd-ds" value="ConnRate"/>
+      <param name="graph-legend" value="Connections per second"/>
+    </leaf>
+    <leaf name="ActiveConnections">
+      <param name="comment">
+        Active Connections
+      </param>
+      <param name="vertical-label" value="connections"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_cons.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$globalStatCurrentConn"/>
+      <param name="rrd-ds" value="ActvConn"/>
+      <param name="graph-legend" value="Active Connections"/>
+    </leaf>
+    <leaf name="MemoryPoolTotal">
+      <param name="comment">
+        Total memory pool available on system.
+      </param>
+      <param name="rrd-scaling-base" value="1024"/>
+      <param name="vertical-label" value="Memory Total"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_mem.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$globalStatMemoryPoolTotal"/>
+      <param name="rrd-ds" value="MemPoolTotal"/>
+      <param name="graph-legend" value="MemPoolTotal"/>
+    </leaf>
+    <leaf name="MemoryPoolUsed">
+      <param name="comment">
+        Total memory pool currently in use by system.
+      </param>
+      <param name="rrd-scaling-base" value="1024"/>
+      <param name="vertical-label" value="Memory Used"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_mem.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$globalStatMemoryPoolUsed"/>
+      <param name="rrd-ds" value="MemPoolUsed"/>
+      <param name="graph-legend" value="MemPoolUsed"/>
+    </leaf>
+    <leaf name="MaxConnPortDeny">
+      <param name="comment">
+        Total number of connections denied because maximum connections
+        count exceeded.
+      </param>
+      <param name="vertical-label" value="denies/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_cons.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$globalStatMaxConnPortDeny"/>
+      <param name="rrd-ds" value="MaxConnDeny"/>
+      <param name="graph-legend" value="Denies"/>
+    </leaf>
+    <leaf name="MemoryErrors">
+      <param name="comment">
+        Memory allocation errors per second
+      </param>
+      <param name="vertical-label" value="Memory Errors/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_mem.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$globalStatMemoryErrors"/>
+      <param name="rrd-ds" value="MemErrors"/>
+      <param name="graph-legend" value="MemErrors"/>
+    </leaf>
+    <leaf name="MemoryInUse">
+      <param name="hidden" value="yes"/>
+      <param name="comment">
+        Current amount of memory in use.
+      </param>
+      <param name="rrd-scaling-base" value="1024"/>
+      <param name="vertical-label" value="Memory Used"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_mem.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$globalStatMemoryInUse"/>
+      <param name="rrd-ds" value="MemInUse"/>
+      <param name="graph-legend" value="MemInUse"/>
+    </leaf>
+    <leaf name="MemorySize">
+      <param name="hidden" value="yes"/>
+      <param name="comment">
+        Current memory size.
+      </param>
+      <param name="rrd-scaling-base" value="1024"/>
+      <param name="vertical-label" value="Memory Size"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_mem.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$globalStatMemoryCurrentSize"/>
+      <param name="rrd-ds" value="MemSize"/>
+      <param name="graph-legend" value="MemSize"/>
+    </leaf>
+  </template>
+
+  <template name="BigIp_4.x_pool-actvconn-overview">
+      <param name="comment" value="Per Poo; Active Connections"/>
+      <param name="precedence" value="-400"/>
+      <param name="has-overview-shortcuts" value="yes"/>
+      <param name="overview-shortcuts" value="active"/>
+      <param name="overview-subleave-name-active" value="ActiveConnections"/>
+      <param name="overview-shortcut-text-active"
+             value="All Active Connections"/>
+      <param name="overview-shortcut-title-active"
+             value="Show Active Connections Per Pool"/>
+      <param name="overview-page-title-active"
+             value="Active Connections Per Pool"/>
+  </template>
+
+  <template name="BigIp_4.x_pool">
+    <param name="comment" value="%descr%"/>
+    <leaf name="ConnectionRate">
+      <param name="comment">
+        Connections per second to %descr%
+      </param>
+      <param name="vertical-label" value="connections/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_pool_%nick%.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$poolTotalConn.%INDEX%"/>
+      <param name="rrd-ds" value="ConnRate"/>
+      <param name="graph-legend" value="Connections per second"/>
+    </leaf>
+    <leaf name="ActiveConnections">
+      <param name="comment">
+        Active Connections to %descr%
+      </param>
+      <param name="vertical-label" value="connections"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_pool_%nick%.rrd"/>
+      <param name="precedence" value="-300"/>
+      <param name="snmp-object" value="$poolCurrentConn.%INDEX%"/>
+      <param name="rrd-ds" value="ActvConn"/>
+      <param name="graph-legend" value="Active Connections"/>
+    </leaf>
+    <leaf name="inoutBps">
+      <param name="comment" value="input and output bits/s %descr%" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="-400" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{Bitsin},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{Bitsout},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+    <leaf name="Bitsin">
+      <param name="comment">
+        Bits IN for %descr%
+      </param>
+      <param name="vertical-label" value="Bps"/>
+      <param name="graph-legend" value="Bits IN"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_pool_%nick%.rrd"/>
+      <param name="precedence" value="-1000"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="snmp-object" value="$poolBitsin.%INDEX%"/>
+      <param name="rrd-ds" value="Bitsin"/>
+    </leaf>
+    <leaf name="Bitsout">
+      <param name="comment">
+        Bits OUT for %descr%
+      </param>
+      <param name="vertical-label" value="Bps"/>
+      <param name="graph-legend" value="Bits OUT"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_pool_%nick%.rrd"/>
+      <param name="precedence" value="-1000"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="snmp-object" value="$poolBitsout.%INDEX%"/>
+      <param name="rrd-ds" value="Bitsout"/>
+    </leaf>
+    <leaf name="inoutPackets">
+      <param name="comment" value="input and output Packets/s for %descr%" />
+      <param name="vertical-label"   value="pps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="-400" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{Packetsin}" />
+      <param name="graph-legend-in"  value="Packets per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{Packetsout}" />
+      <param name="graph-legend-out" value="Packets per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+    <leaf name="Packetsin">
+      <param name="comment">
+        Packets IN for %descr%
+      </param>
+      <param name="vertical-label" value="pps"/>
+      <param name="graph-legend" value="Packets IN"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_pool_%nick%.rrd"/>
+      <param name="precedence" value="-1100"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="snmp-object" value="$poolPktsin.%INDEX%"/>
+      <param name="rrd-ds" value="Packetsin"/>
+    </leaf>
+    <leaf name="Packetsout">
+      <param name="comment">
+        Packets OUT for %descr%
+      </param>
+      <param name="vertical-label" value="pps"/>
+      <param name="graph-legend" value="Packets OUT"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_pool_%nick%.rrd"/>
+      <param name="precedence" value="-1100"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="snmp-object" value="$poolPktsout.%INDEX%"/>
+      <param name="rrd-ds" value="Packetsout"/>
+    </leaf>
+  </template>
+
+  <template name="BigIp_4.x_virtualServer-actvconn-overview">
+      <param name="comment"
+             value="Per Virtual Server(VIP) Active Connections"/>
+      <param name="precedence" value="-400"/>
+      <param name="has-overview-shortcuts" value="yes"/>
+      <param name="overview-shortcuts" value="active"/>
+      <param name="overview-subleave-name-active" value="ActiveConnections"/>
+      <param name="overview-shortcut-text-active"
+             value="All Active Connections"/>
+      <param name="overview-shortcut-title-active"
+             value="Show Active Connections Per Virtual Server(VIP)"/>
+      <param name="overview-page-title-active"
+             value="Active Connections Per Virtual Server(VIP)"/>
+  </template>
+  <template name="BigIp_4.x_virtualServer-connrate-overview">
+      <param name="comment" value="Per Virtual Server(VIP) Connections/s"/>
+      <param name="precedence" value="-400"/>
+      <param name="has-overview-shortcuts" value="yes"/>
+      <param name="overview-shortcuts" value="rate"/>
+      <param name="overview-subleave-name-rate" value="ConnectionRate"/>
+      <param name="overview-shortcut-text-rate"
+             value="All Connection Rates"/>
+      <param name="overview-shortcut-title-rate"
+             value="Show Connections/s Per Virtual Server(VIP)"/>
+      <param name="overview-page-title-rate"
+             value="Connections/s Per Virtual Server(VIP)"/>
+  </template>
+
+  <template name="BigIp_4.x_virtualServer">
+    <param name="comment" value="%descr%"/>
+    <leaf name="ConnectionLimit">
+      <param name="comment">
+          Max Allowed Connections to %descr%
+      </param>
+      <param name="vertical-label" value="connections"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_VSstat_%nick%.rrd"/>
+      <param name="precedence" value="-300"/>
+      <param name="snmp-object" value="$virtualServerConnLimit.%INDEX%"/>
+      <param name="rrd-ds" value="ConnLimit"/>
+      <param name="graph-legend" value="Connection Limit"/>
+    </leaf>
+    <leaf name="ConnectionRate">
+      <param name="comment">
+        Connections per second to %descr%
+      </param>
+      <param name="vertical-label" value="connections/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_VSstat_%nick%.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$virtualServerTotalConn.%INDEX%"/>
+      <param name="rrd-ds" value="ConnRate"/>
+      <param name="graph-legend" value="Connections per second"/>
+    </leaf>
+    <leaf name="ActiveConnections">
+      <param name="comment">
+        Active Connections to %descr%
+      </param>
+      <param name="vertical-label" value="connections"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_VSstat_%nick%.rrd"/>
+      <param name="precedence" value="-300"/>
+      <param name="snmp-object" value="$virtualServerCurrentConn.%INDEX%"/>
+      <param name="rrd-ds" value="ActvConn"/>
+      <param name="graph-legend" value="Active Connections"/>
+    </leaf>
+    <leaf name="InOutBps">
+      <param name="comment" value="Input and Output bits/s %descr%" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="-400" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{OctetsIn},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{OctetsOut},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+    <leaf name="OctetsIn">
+      <param name="comment">
+        Octets IN for %descr%
+      </param>
+      <param name="vertical-label" value="Bps"/>
+      <param name="graph-legend" value="Bytes IN"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_VSstat_%nick%.rrd"/>
+      <param name="precedence" value="-1000"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="snmp-object" value="$virtualServerOctetsIn.%INDEX%"/>
+      <param name="rrd-ds" value="OctetsIn"/>
+    </leaf>
+    <leaf name="OctetsOut">
+      <param name="comment">
+        Octets OUT for %descr%
+      </param>
+      <param name="vertical-label" value="Bps"/>
+      <param name="graph-legend" value="Bytes OUT"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_VSstat_%nick%.rrd"/>
+      <param name="precedence" value="-1000"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="snmp-object" value="$virtualServerOctetsOut.%INDEX%"/>
+      <param name="rrd-ds" value="OctetsOut"/>
+    </leaf>
+    <leaf name="InOutPackets">
+      <param name="comment" value="Input and Output Packets/s for %descr%" />
+      <param name="vertical-label"   value="pps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="-400" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{PacketsIn}" />
+      <param name="graph-legend-in"  value="Packets per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{PacketsOut}" />
+      <param name="graph-legend-out" value="Packets per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+    <leaf name="PacketsIn">
+      <param name="comment">
+        Packets IN for %descr%
+      </param>
+      <param name="vertical-label" value="pps"/>
+      <param name="graph-legend" value="Packets IN"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_VSstat_%nick%.rrd"/>
+      <param name="precedence" value="-1100"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="snmp-object" value="$virtualServerPacketsIn.%INDEX%"/>
+      <param name="rrd-ds" value="PacketsIn"/>
+    </leaf>
+    <leaf name="PacketsOut">
+      <param name="comment">
+        Packets OUT for %descr%
+      </param>
+      <param name="vertical-label" value="pps"/>
+      <param name="graph-legend" value="Packets OUT"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_VSstat_%nick%t.rrd"/>
+      <param name="precedence" value="-1100"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="snmp-object" value="$virtualServerPacketsOut.%INDEX%"/>
+      <param name="rrd-ds" value="PacketsOut"/>
+    </leaf>
+  </template>
+
+
+  <template name="BigIp_4.x_poolMember-actvconn-overview">
+      <param name="comment" value="Per Pool Member Active Connections"/>
+      <param name="precedence" value="-400"/>
+      <param name="has-overview-shortcuts" value="yes"/>
+      <param name="overview-shortcuts" value="active"/>
+      <param name="overview-subleave-name-active" value="ActiveConnections"/>
+      <param name="overview-shortcut-text-active"
+             value="All Active Connections"/>
+      <param name="overview-shortcut-title-active"
+             value="Show Active Connections Per Pool Member"/>
+      <param name="overview-page-title-active"
+             value="Active Connections Per Pool Member"/>
+  </template>
+
+  <template name="BigIp_4.x_poolMember">
+    <param name="comment" value="%descr%"/>
+    <leaf name="ConnectionLimit">
+      <param name="comment">
+          Max Allowed Connections to %descr%
+      </param>
+      <param name="vertical-label" value="connections"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_poolmember_%nick%.rrd"/>
+      <param name="precedence" value="-300"/>
+      <param name="snmp-object" value="$poolMemberConnLimit.%INDEX%"/>
+      <param name="rrd-ds" value="ConnLimit"/>
+      <param name="graph-legend" value="Connection Limit"/>
+    </leaf>
+    <leaf name="ConnectionRate">
+      <param name="comment">
+        Connections per second to %descr%
+      </param>
+      <param name="vertical-label" value="connections/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_poolmember_%nick%.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$poolMemberTotalConn.%INDEX%"/>
+      <param name="rrd-ds" value="ConnRate"/>
+      <param name="graph-legend" value="Connections per second"/>
+    </leaf>
+    <leaf name="ActiveConnections">
+      <param name="comment">
+        Active Connections to %descr%
+      </param>
+      <param name="vertical-label" value="connections"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_poolmember_%nick%.rrd"/>
+      <param name="precedence" value="-300"/>
+      <param name="snmp-object" value="$poolMemberCurrentConn.%INDEX%"/>
+      <param name="rrd-ds" value="ActvConn"/>
+      <param name="graph-legend" value="Active Connections"/>
+    </leaf>
+    <leaf name="inoutBps">
+      <param name="comment" value="input and output bits/s %descr%" />
+      <param name="vertical-label"   value="bps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="-400" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{Bitsin},8,*" />
+      <param name="graph-legend-in"  value="Bits per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{Bitsout},8,*" />
+      <param name="graph-legend-out" value="Bits per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+    <leaf name="Bitsin">
+      <param name="comment">
+        Bits IN for %descr%
+      </param>
+      <param name="vertical-label" value="Bps"/>
+      <param name="graph-legend" value="Bits IN"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_poolmember_%nick%.rrd"/>
+      <param name="precedence" value="-1000"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="snmp-object" value="$poolMemberBitsin.%INDEX%"/>
+      <param name="rrd-ds" value="Bitsin"/>
+    </leaf>
+    <leaf name="Bitsout">
+      <param name="comment">
+        Bits OUT for %descr%
+      </param>
+      <param name="vertical-label" value="Bps"/>
+      <param name="graph-legend" value="Bits OUT"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_poolmember_%nick%.rrd"/>
+      <param name="precedence" value="-1000"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="snmp-object" value="$poolMemberBitsout.%INDEX%"/>
+      <param name="rrd-ds" value="Bitsout"/>
+    </leaf>
+    <leaf name="inoutPackets">
+      <param name="comment" value="input and output Packets/s for %descr%" />
+      <param name="vertical-label"   value="pps" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="rrd-hwpredict"    value="disabled" />
+      <param name="precedence"       value="-400" />
+      <param name="ds-type"          value="rrd-multigraph" />
+      <param name="ds-names"         value="in,out" />
+
+      <param name="ds-expr-in"       value="{Packetsin}" />
+      <param name="graph-legend-in"  value="Packets per second in" />
+      <param name="line-style-in"    value="##BpsIn" />
+      <param name="line-color-in"    value="##BpsIn" />
+      <param name="line-order-in"    value="1" />
+
+      <param name="ds-expr-out"      value="{Packetsout}" />
+      <param name="graph-legend-out" value="Packets per second out" />
+      <param name="line-style-out"   value="##BpsOut" />
+      <param name="line-color-out"   value="##BpsOut" />
+      <param name="line-order-out"   value="2" />
+    </leaf>
+    <leaf name="Packetsin">
+      <param name="comment">
+        Packets IN for %descr%
+      </param>
+      <param name="vertical-label" value="pps"/>
+      <param name="graph-legend" value="Packets IN"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_poolmember_%nick%.rrd"/>
+      <param name="precedence" value="-1100"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="snmp-object" value="$poolMemberPktsin.%INDEX%"/>
+      <param name="rrd-ds" value="Packetsin"/>
+    </leaf>
+    <leaf name="Packetsout">
+      <param name="comment">
+        Packets OUT for %descr%
+      </param>
+      <param name="vertical-label" value="pps"/>
+      <param name="graph-legend" value="Packets OUT"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_poolmember_%nick%.rrd"/>
+      <param name="precedence" value="-1100"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="snmp-object" value="$poolMemberPktsout.%INDEX%"/>
+      <param name="rrd-ds" value="Packetsout"/>
+    </leaf>
+  </template>
+
+  <template name="BigIp_4.x_sslProxy_Global">
+    <leaf name="DupSynSSL">
+      <param name="comment" value="Duplicate SYNs for SSL Traffic"/>
+      <param name="vertical-label" value="SYN/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_globalssl.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$globalStatVirtualServerDupSynSSL"/>
+      <param name="rrd-ds" value="DupSynSSL"/>
+      <param name="graph-legend" value="DupSynSSL"/>
+    </leaf>
+    <leaf name="SSLTimeouts">
+      <param name="comment" value="SSL Timeouts/s"/>
+      <param name="vertical-label" value="Timeouts/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_globalssl.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$globalStatSSLTimeouts"/>
+      <param name="rrd-ds" value="SSLTimeouts"/>
+      <param name="graph-legend" value="SSL Timeouts/s"/>
+    </leaf>
+  </template>
+
+  <template name="BigIp_4.x_sslProxy-currconn-overview">
+      <param name="comment" value="Per SSL Proxy Current Connections"/>
+      <param name="precedence" value="-400"/>
+      <param name="has-overview-shortcuts" value="yes"/>
+      <param name="overview-shortcuts" value="ssl"/>
+      <param name="overview-subleave-name-ssl" value="CurrentConn"/>
+      <param name="overview-shortcut-text-ssl"
+             value="All Current Connections"/>
+      <param name="overview-shortcut-title-ssl"
+             value="Show Current Connections Per SSL Proxy"/>
+      <param name="overview-page-title-ssl"
+             value="Current Connections Per SSL Proxy"/>
+  </template>
+
+  <template name="BigIp_4.x_sslProxy">
+    <param name="comment" value="%descr% Connection Limit: %connLimit%"/>
+    <leaf name="BitsIn">
+      <param name="comment" value="SSL Proxy %descr% Bits In"/>
+      <param name="vertical-label" value="BitsIn/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_sslproxy_%nick%.rrd"/>
+      <param name="precedence" value="-1000"/>
+      <param name="snmp-object" value="$sslProxyBitsin.%INDEX%"/>
+      <param name="rrd-ds" value="Bitsin"/>
+      <param name="graph-legend" value="Bits In/s"/>
+    </leaf>
+    <leaf name="BitsOut">
+      <param name="comment" value="SSL Proxy %descr% Bits Out"/>
+      <param name="vertical-label" value="BitsOut/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_sslproxy_%nick%.rrd"/>
+      <param name="precedence" value="-1000"/>
+      <param name="snmp-object" value="$sslProxyBitsout.%INDEX%"/>
+      <param name="rrd-ds" value="Bitsout"/>
+      <param name="graph-legend" value="Bits Out"/>
+    </leaf>
+    <leaf name="PktsIn">
+      <param name="comment" value="SSL Proxy %descr% Packets In"/>
+      <param name="vertical-label" value="PacketsIn/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_sslproxy_%nick%.rrd"/>
+      <param name="precedence" value="-100"/>
+      <param name="snmp-object" value="$sslProxyPktsin.%INDEX%"/>
+      <param name="rrd-ds" value="Pktsin"/>
+      <param name="graph-legend" value="Packets In"/>
+    </leaf>
+    <leaf name="PktsOut">
+      <param name="comment" value="SSL Proxy %descr% Packets Out"/>
+      <param name="vertical-label" value="PacketsOut/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_sslproxy_%nick%.rrd"/>
+      <param name="precedence" value="-100"/>
+      <param name="snmp-object" value="$sslProxyPktsout.%INDEX%"/>
+      <param name="rrd-ds" value="Pktsout"/>
+      <param name="graph-legend" value="Packets Out"/>
+    </leaf>
+    <leaf name="MaxConn">
+      <param name="comment" value="SSL Proxy %descr% Max Connections"/>
+      <param name="vertical-label" value="MaxConnections"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_sslproxy_%nick%.rrd"/>
+      <param name="precedence" value="-500"/>
+      <param name="snmp-object" value="$sslProxyMaxConn.%INDEX%"/>
+      <param name="rrd-ds" value="MaxConn"/>
+      <param name="graph-legend" value="Max Connections"/>
+    </leaf>
+    <leaf name="CurrentConn">
+      <param name="comment" value="SSL Proxy %descr% Current Connections"/>
+      <param name="vertical-label" value="CurrentConnections"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_sslproxy_%nick%.rrd"/>
+      <param name="precedence" value="-600"/>
+      <param name="snmp-object" value="$sslProxyCurrentConn.%INDEX%"/>
+      <param name="rrd-ds" value="CurrentConn"/>
+      <param name="graph-legend" value="Current Connections"/>
+    </leaf>
+    <leaf name="TotalConn">
+      <param name="comment" value="SSL Proxy %descr% Connections/s"/>
+      <param name="vertical-label" value="Connections/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_sslproxy_%nick%.rrd"/>
+      <param name="precedence" value="-700"/>
+      <param name="snmp-object" value="$sslProxyTotalConn.%INDEX%"/>
+      <param name="rrd-ds" value="TotalConn"/>
+      <param name="graph-legend" value="Connections/s"/>
+    </leaf>
+    <leaf name="ClientInvalidVersions">
+      <param name="comment" value="SSL Proxy %descr% Client Invalid Versions/s"/>
+      <param name="vertical-label" value="InvalidVersions/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_sslproxy_%nick%.rrd"/>
+      <param name="precedence" value="-700"/>
+      <param name="snmp-object" value="$sslProxyClientInvalidVersions.%INDEX%"/>
+      <param name="rrd-ds" value="ClientInvalidVer"/>
+      <param name="graph-legend" value="InvalidVersions/s"/>
+    </leaf>
+    <leaf name="ServerInvalidVersions">
+      <param name="comment" value="SSL Proxy %descr% Server Invalid Versions/s"/>
+      <param name="vertical-label" value="InvalidVersions/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_sslproxy_%nick%.rrd"/>
+      <param name="precedence" value="-700"/>
+      <param name="snmp-object" value="$sslProxyServerInvalidVersions.%INDEX%"/>
+      <param name="rrd-ds" value="ServerInvalidVer"/>
+      <param name="graph-legend" value="InvalidVersions/s"/>
+    </leaf>
+  </template>
+
+
+  <template name="BigIp_3.x">
+    <leaf name="MaxConnections">
+      <param name="hidden" value="yes"/>
+      <param name="comment">
+          Max Connections per second
+      </param>
+      <param name="vertical-label" value="connections/s"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_3.x_cons.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$conmax"/>
+      <param name="rrd-ds" value="MaxConn"/>
+      <param name="graph-legend" value="MaxConns"/>
+    </leaf>
+    <leaf name="ConnectionRate">
+      <param name="comment">
+        Connections per second
+      </param>
+      <param name="vertical-label" value="connections/s"/>
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_3.x_cons.rrd"/>
+      <param name="precedence" value="-200"/>
+      <param name="snmp-object" value="$contot"/>
+      <param name="rrd-ds" value="ConnRate"/>
+      <param name="graph-legend" value="Connections per second"/>
+    </leaf>
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/foundry.xml b/torrus/xmlconfig/vendor/foundry.xml
new file mode 100644 (file)
index 0000000..8fd06a0
--- /dev/null
@@ -0,0 +1,268 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2008 Roman Hochuli
+   Copyright (C) 2010 Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: foundry.xml,v 1.1 2010-12-27 00:04:17 ivan Exp $
+  Roman Hochuli <roman@hochu.li>
+
+-->
+<!-- Common Foundry definitions -->
+<configuration>
+  <definitions>
+    <!-- Froundry Enterprise MIB OID -->
+    <!-- Temperature of the chassis. Each Unit is 0.5 degrees Celsius -->
+    <def name="fdrySnChasActualTemperature"
+           value="1.3.6.1.4.1.1991.1.1.1.1.18.0"/>
+    <def name="fdrySnAgentTempValues"
+           value="1.3.6.1.4.1.1991.1.1.2.13.1.1.4"/>
+    <def name="fdrySnAgentTempValue"
+           value="1.3.6.1.4.1.1991.1.1.2.13.1.1.4"/>
+           
+    <!-- CPU utilization -->
+    <def name="fdrySnAgGblCpuUtil1SecAvg"
+           value="1.3.6.1.4.1.1991.1.1.2.1.50.0"/>
+    <def name="fdrySnAgGblCpuUtil5SecAvg"
+           value="1.3.6.1.4.1.1991.1.1.2.1.51.0"/>
+    <def name="fdrySnAgGblCpuUtil1MinAvg"
+           value="1.3.6.1.4.1.1991.1.1.2.1.52.0"/>
+    <def name="fdrySnAgentCpuUtilValue"
+           value="1.3.6.1.4.1.1991.1.1.2.11.1.1.4"/>
+    <def name="fdrySnAgentCpuUtil100thPercent"
+           value="1.3.6.1.4.1.1991.1.1.2.11.1.1.6"/>
+           
+    <!-- Dynamic memory utilizaion -->
+    <def name="fdry_snAgGlbDynMemUtil"
+           value="1.3.6.1.4.1.1991.1.1.2.1.53.0"/> <!-- Percentage -->
+    <def name="fdry_snAgGlbDynMemTotal"
+           value="1.3.6.1.4.1.1991.1.1.2.1.54.0"/> <!-- Bytes      -->
+    <def name="fdry_snAgGlbDynMemFree"
+           value="1.3.6.1.4.1.1991.1.1.2.1.55.0"/> <!-- Bytes      -->
+           
+    <def name="fdrySnAgentBrdMemoryTotal"
+           value="1.3.6.1.4.1.1991.1.1.2.2.1.1.24"/>
+    <def name="fdrySnAgentBrdMemoryAvailable"
+           value="1.3.6.1.4.1.1991.1.1.2.2.1.1.25"/>
+  </definitions>
+
+  
+  <datasources>
+    
+    <template name="fdry-chass-temperature">
+      <param name="comment" value="management module temperature"/>
+      <param name="graph-title" value="%system-id%"/>
+      <param name="data-file" value="%system-id%_chassis_tempstats.rrd"/>      
+      <param name="rrd-ds" value="chassis_actual"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="collector-scale" value="2,/"/>
+      <param name="snmp-object"  value="$fdrySnChasActualTemperature"/>
+      <param name="graph-legend" value="Chassis temperature"/>
+      <param name="vertical-label" value="Degrees Celsius"/>
+      <param name="graph-upper-limit" value="%fdry-chastemp-shutdown%"/>
+      <param name="upper-limit" value="%fdry-chastemp-warning%"/>
+    </template>
+    
+    <template name="fdry-board-overview">
+     <param name="has-overview-shortcuts" value="yes"/>
+     <param name="overview-shortcuts" value="all"/>
+
+     <param name="overview-subleave-name-all">
+        Memory_Statistics/Memory_Overview,
+        CPU_Statistics/CPU_Overview,
+        Temperature_Statistics/Temperature_Overview
+     </param>     
+     <param name="overview-shortcut-text-all"
+           value="Overview"/>
+     <param name="overview-shortcut-title-all"
+           value="All important graphs on one page"/>
+     <param name="overview-page-title-all"
+           value="Linecard overview"/>
+     <param name="overview-direct-link-all" value="yes"/>
+    </template>
+    
+    <template name="fdry-board-subtree">
+      <param name="comment" value="%fdry-board-descr%"/>
+      <param name="graph-title"
+          value="%system-id% Linecard %fdry-board-index%"/>
+      <param name="data-file"
+          value="%system-id%_linecard_%fdry-board-index%_%fdry-datafile%.rrd"/>
+    </template>
+    
+    <template name="fdry-board-memstats">
+      <param name="comment" value="Linecard-specific memory statistics"/>
+      <param name="fdry-datafile" value="memorystats"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="rrd-hwpredict" value="disabled"/>
+      
+      <leaf name="Memory_Overview">
+        <param name="comment" value="Board memory statistics combined"/>
+        <param name="ds-type" value="rrd-multigraph"/>
+        <param name="ds-names" value="total,avail,free"/>
+        
+        <param name="ds-expr-free"
+           value="{Memory_Total},{Memory_Available},-"/>
+        <param name="graph-legend-free" value="Memory Used"/>
+        <param name="line-style-free" value="AREA"/>
+        <param name="line-color-free" value="##three"/>
+        <param name="line-order-free" value="2"/>
+        
+        <param name="ds-expr-avail" value="{Memory_Available}"/>
+        <param name="graph-legend-avail" value="Memory Available"/>
+        <param name="line-style-avail" value="AREA"/>
+        <param name="line-color-avail" value="##one"/>
+        <param name="line-order-avail" value="3"/>
+        <param name="line-stack-avail" value="yes"/>
+        
+        <param name="ds-expr-total" value="{Memory_Total}"/>
+        <param name="graph-legend-total" value="Memory Total"/>
+        <param name="line-style-total" value="LINE2"/>
+        <param name="line-color-total" value="##two"/>
+        <param name="line-order-total" value="5"/>
+        
+        <param name="vertical-label" value="Bytes"/>
+        <param name="precedence" value="1000"/>
+        <param name="graph-lower-limit" value="0"/>
+      </leaf>
+      
+      <leaf name="Memory_Total">
+        <param name="precedence" value="999"/>
+        <param name="rrd-ds" value="MemTotal"/>
+        <param name="snmp-object"
+           value="$fdrySnAgentBrdMemoryTotal.%fdry-board-index%"/>
+        <param name="comment" value="Number of total memory in bytes"/>
+        <param name="graph-legend" value="Total Memory"/>
+      </leaf>
+      
+      <leaf name="Memory_Available">
+        <param name="precedence" value="998"/>
+        <param name="rrd-ds" value="MemAvail"/>
+        <param name="snmp-object"
+           value="$fdrySnAgentBrdMemoryAvailable.%fdry-board-index%"/>
+        <param name="comment" value="Number of available memory in bytes"/>
+        <param name="graph-legend" value="Available Memory"/>
+      </leaf>
+    </template>
+
+
+    
+    <template name="fdry-board-cpustats">
+      <param name="comment" value="Linecard-specific cpu statistics"/>
+      <param name="fdry-datafile" value="cpustats"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="rrd-hwpredict" value="disabled"/>
+      
+      <leaf name="CPU_Overview">
+        <param name="comment" value="Board cpu statistics combined"/>
+        <param name="ds-type" value="rrd-multigraph"/>
+        <param name="ds-names" value="5sec,1min,5min"/>
+        
+        <param name="ds-expr-5sec" value="{CPU_Total_5sec}"/>
+        <param name="graph-legend-5sec" value="5 second cpu usage"/>
+        <param name="line-style-5sec" value="LINE1"/>
+        <param name="line-color-5sec" value="##one"/>
+        <param name="line-order-5sec" value="1"/>
+        
+        <param name="ds-expr-1min" value="{CPU_Total_1min}"/>
+        <param name="graph-legend-1min" value="1 minute cpu usage"/>
+        <param name="line-style-1min" value="LINE1"/>
+        <param name="line-color-1min" value="##two"/>
+        <param name="line-order-1min" value="2"/>
+        
+        <param name="ds-expr-5min" value="{CPU_Total_5min}"/>
+        <param name="graph-legend-5min" value="5 minute cpu usage"/>
+        <param name="line-style-5min" value="LINE1"/>
+        <param name="line-color-5min" value="##three"/>
+        <param name="line-order-5min" value="3"/>
+        
+        <param name="graph-lower-limit" value="0"/>
+        <param name="graph-upper-limit" value="100"/>
+        <param name="upper-limit" value="80"/>
+        <param name="vertical-label" value="Percent"/>
+      </leaf>
+
+      <leaf name="CPU_Total_5sec">
+        <param name="precedence" value="-200"/>
+        <param name="snmp-object"
+          value="%fdry-cpu-base%.%fdry-board-index%.1.5"/>
+        <param name="rrd-ds" value="Total5sec"/>
+        <param name="collector-scale" value="0.01,*"/>
+        <param name="comment">
+          The overall CPU busy percentage in the last 5 second period average
+        </param>
+        <param name="graph-legend" value="5 second cpu usage"/>
+        <param name="graph-lower-limit" value="0"/>
+        <param name="graph-upper-limit" value="100"/>
+        <param name="upper-limit" value="80"/>
+        <param name="vertical-label" value="Percent"/>
+      </leaf>
+      
+      <leaf name="CPU_Total_1min">
+        <param name="precedence" value="-201"/>
+        <param name="snmp-object"
+          value="%fdry-cpu-base%.%fdry-board-index%.1.60"/>
+        <param name="rrd-ds" value="Total1min"/>
+        <param name="collector-scale" value="0.01,*"/>
+        <param name="comment">
+          The overall CPU busy percentage in the last 1 minute period average
+        </param>
+        <param name="graph-legend" value="1 minute cpu usage"/>
+        <param name="graph-lower-limit" value="0"/>
+        <param name="graph-upper-limit" value="100"/>
+        <param name="upper-limit" value="80"/>
+        <param name="vertical-label" value="Percent"/>
+      </leaf>
+      
+      <leaf name="CPU_Total_5min">
+        <param name="precedence" value="-202"/>
+        <param name="snmp-object"
+          value="%fdry-cpu-base%.%fdry-board-index%.1.300"/>
+        <param name="rrd-ds" value="Total5min"/>
+        <param name="collector-scale" value="0.01,*"/>
+        <param name="comment">
+         The overall CPU busy percentage in the last 5 minute period average
+        </param>
+        <param name="graph-legend" value="5 minutes cpu usage"/>
+        <param name="graph-lower-limit" value="0"/>
+        <param name="graph-upper-limit" value="100"/>
+        <param name="upper-limit" value="80"/>
+        <param name="vertical-label" value="Percent"/>
+      </leaf>
+    </template>
+
+
+    <template name="fdry-board-tempstats">
+      <param name="comment" value="Linecard-specific temperature sensors"/>
+      <param name="fdry-datafile" value="tempstats"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="rrd-hwpredict" value="disabled"/>
+    </template>
+      
+
+    <template name="fdry-board-temp-sensor-halfcelsius">
+      <param name="comment" value="%sensor-description%"/>
+      <param name="precedence" value="%sensor-precedence%"/>
+      <param name="rrd-ds" value="sensor_%sensor-index%"/>
+      <param name="collector-scale" value="2,/"/>
+      <param name="snmp-object"
+        value="$fdrySnAgentTempValue.%fdry-board-index%.%sensor-index%"/>
+      <param name="graph-legend" value="%sensor-short%"/>
+      <param name="vertical-label" value="Degrees Celsius"/>
+    </template>
+        
+  </datasources>
+</configuration>
diff --git a/torrus/xmlconfig/vendor/ftos.xml b/torrus/xmlconfig/vendor/ftos.xml
new file mode 100644 (file)
index 0000000..45d76bc
--- /dev/null
@@ -0,0 +1,155 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2009 Jon Nistor
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: ftos.xml,v 1.1 2010-12-27 00:04:18 ivan Exp $
+  Jon Nistor <nistor at snickers dot org>
+
+-->
+<!-- Tested on Force10 E300 -->
+
+<configuration>
+
+<definitions>
+
+  <!-- F10-CHASSIS-MIB::chSysCardTable -->
+  <def name="chSysCardUpperTemp" value="1.3.6.1.4.1.6027.3.1.1.2.3.1.8"/>
+
+  <!-- F10-CHASSIS-MIB::chRpmUtilTable -->
+  <def name="chRpmCpuUtil5Sec"   value="1.3.6.1.4.1.6027.3.1.1.3.7.1.3"/>
+  <def name="chRpmCpuUtil1Min"   value="1.3.6.1.4.1.6027.3.1.1.3.7.1.4"/>
+  <def name="chRpmCpuUtil5Min"   value="1.3.6.1.4.1.6027.3.1.1.3.7.1.5"/>
+
+  <def name="chRpmMemUsageUtil"  value="1.3.6.1.4.1.6027.3.1.1.3.7.1.6"/>
+
+  <def name="chSysPowerSupplyOperStatus"
+                                 value="1.3.6.1.4.1.6027.3.1.1.2.1.1.2"/>
+
+</definitions>
+
+
+<datasources>
+  <template name="ftos-cpu-subtree">
+    <param name="data-file"         value="%system-id%_cpu_%cpu-index%.rrd"/>
+    <param name="comment"           value="Overall CPU busy percentage"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+    <param name="rrd-hwpredict"     value="disabled"/>
+    <param name="graph-title"       value="%system-id%: CPU %cpu-index%"/>
+    <param name="graph-lower-limit" value="0"/>
+    <param name="graph-upper-limit" value="100"/>
+    <param name="upper-limit"       value="80"/>
+    <param name="vertical-label"    value="Percent"/>
+
+    <param name="has-overview-shortcuts"     value="yes"/>
+    <param name="overview-shortcuts"         value="5sec,1min,5min"/>
+    <!-- CPU usage / 5 Sec -->
+    <param name="overview-subleave-name-5sec"  value="Util_5_Sec"/>
+    <param name="overview-shortcut-text-5sec"  value="All CPUs usage 5 secs"/>
+    <param name="overview-shortcut-title-5sec"
+           value="Show all CPUs utilization for last 5 seconds in one page"/>
+    <param name="overview-page-title-5sec" value="CPU Usage Graphs"/>
+    <!-- CPU usage / 1 Min -->
+    <param name="overview-subleave-name-1min"  value="Util_1_Min"/>
+    <param name="overview-shortcut-text-1min"  value="All CPUs usage 1 min"/>
+    <param name="overview-shortcut-title-1min"
+           value="Show all CPUs utilization for last 1 minute in one page"/>
+    <param name="overview-page-title-1min" value="CPU Usage Graphs"/>
+    <!-- CPU usage / 5 Min -->
+    <param name="overview-subleave-name-5min"  value="Util_5_Min"/>
+    <param name="overview-shortcut-text-5min"  value="All CPUs usage 5 min"/>
+    <param name="overview-shortcut-title-5min"
+           value="Show all CPUs utilization for last 5 minute in one page"/>
+    <param name="overview-page-title-5min" value="CPU Usage Graphs"/>
+  </template>
+
+
+  <template name="ftos-cpu">
+    <leaf name="Util_5_Sec">
+        <param name="precedence"    value="999"/>
+        <param name="rrd-ds"        value="chRpmCpuUtil5Sec"/>
+        <param name="snmp-object"   value="$chRpmCpuUtil5Sec.%cpu-index%"/>
+        <param name="comment"       value="CPU utilization for last 5 seconds"/>
+        <param name="graph-legend"  value="CPU util"/>
+    </leaf>
+    <leaf name="Util_1_Min">
+        <param name="precedence"    value="998"/>
+        <param name="rrd-ds"        value="chRpmCpuUtil1Min"/>
+        <param name="snmp-object"   value="$chRpmCpuUtil1Min.%cpu-index%"/>
+        <param name="comment"       value="CPU utilization for last 1 minute"/>
+        <param name="graph-legend"  value="CPU util"/>
+    </leaf>
+    <leaf name="Util_5_Min">
+        <param name="precedence"    value="997"/>
+        <param name="rrd-ds"        value="chRpmCpuUtil5Min"/>
+        <param name="snmp-object"   value="$chRpmCpuUtil5Min.%cpu-index%"/>
+        <param name="comment"       value="CPU utilization for last 5 minutes"/>
+        <param name="graph-legend"  value="CPU util"/>
+    </leaf>
+  </template>
+
+
+  <template name="ftos-power-supply-leaf">
+    <param name="comment"           value="Power supply #%power-index%"/>
+    <param name="graph-legend"      value="Power supply #%power-index%"/>
+    <param name="graph-title"       value="%system-id%: Power %power-index%"/>
+    <param name="rrd-ds"            value="power_%power-index%"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+    <param name="rrd-hwpredict"     value="disabled" />
+    <param name="snmp-object"
+          value="$chSysPowerSupplyOperStatus.%power-index%"/>
+    <param name="vertical-label"     value="1 = Normal, 2 = Down"/>
+  </template>
+
+
+  <template name="ftos-temperature-subtree">
+    <param name="comment"             value="Temperature Sensors"/>
+    <param name="precedence"          value="-500"/>
+    <param name="rrd-create-dstype"   value="GAUGE"/>
+    <param name="rrd-hwpredict"       value="disabled" />
+  </template>
+
+  <!-- template to be applied inside the sensor leaf.
+       Two parameters must be defined: sensor-index and sensor-description -->
+  <template name="ftos-temperature-sensor">
+    <param name="comment"      value="%sensor-description%"/>
+    <param name="rrd-ds"       value="sensor_%sensor-index%"/>
+    <param name="snmp-object"
+           value="$chSysCardUpperTemp.%sensor-index%"/>
+    <param name="graph-legend"      value="%sensor-description%"/>
+    <param name="graph-lower-limit" value="15"/>
+    <param name="graph-upper-limit" value="70"/>
+    <param name="vertical-label"    value="degrees Celsius"/>
+  </template>
+
+  <!-- Temperature measured in degrees Fahrenheit -->
+  <template name="ftos-temperature-sensor-fahrenheit">
+    <param name="comment"      value="%sensor-description%"/>
+    <param name="rrd-ds"       value="sensor_%sensor-index%"/>
+    <param name="snmp-object"
+           value="$chSysCardUpperTemp.%sensor-index%"/>
+    <param name="collector-scale"   value="1.8,*,32,+" />
+    <param name="graph-legend"      value="%sensor-description%"/>
+    <param name="graph-lower-limit" value="59"/>
+    <param name="graph-upper-limit" value="158"/>
+    <param name="vertical-label"    value="degrees Fahrenheit"/>
+  </template>
+
+
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/hp.hpux.xml b/torrus/xmlconfig/vendor/hp.hpux.xml
new file mode 100644 (file)
index 0000000..ced0f82
--- /dev/null
@@ -0,0 +1,278 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003  Stanislav Sinyagin
+   Copyright (C) 2003  Aaron S. Bush  <abush at microelectronics dot com>
+
+   File: vendor/hp.hpux.xml
+   Description: HPUX System monitor definitions
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+-->
+
+<!--
+    Tested with HPUX 11.00
+-->
+
+<configuration>
+
+<definitions>
+  <!-- HP MIB -->
+  <def name="hpuxSystemUserCPU"
+                          value="1.3.6.1.4.1.11.2.3.1.1.13" />
+  <def name="hpuxSystemSysCPU"
+                          value="1.3.6.1.4.1.11.2.3.1.1.14" />
+  <def name="hpuxSystemIdleCPU"
+                          value="1.3.6.1.4.1.11.2.3.1.1.15" />
+  <def name="hpuxSystemNiceCPU"
+                          value="1.3.6.1.4.1.11.2.3.1.1.16" />
+
+  <!-- returns lvol path; i.e. "/dev/vg00/lvol1" -->
+  <def name="hpuxFileSystemName"
+                          value="1.3.6.1.4.1.11.2.3.1.2.2.1.3" />
+
+  <def name="hpuxFileSystemBlock"
+                          value="1.3.6.1.4.1.11.2.3.1.2.2.1.4" />
+  <def name="hpuxFileSystemBfree"
+                          value="1.3.6.1.4.1.11.2.3.1.2.2.1.5" />
+  <def name="hpuxFileSystemBavail"
+                          value="1.3.6.1.4.1.11.2.3.1.2.2.1.6" />
+  <def name="hpuxFileSystemFiles"
+                          value="1.3.6.1.4.1.11.2.3.1.2.2.1.8" />
+  <def name="hpuxFileSystemFfree"
+                          value="1.3.6.1.4.1.11.2.3.1.2.2.1.9" />
+
+  <!-- returns mount point name; i.e. "/stand" -->
+  <def name="hpuxFileSystemDir"
+                          value="1.3.6.1.4.1.11.2.3.1.2.2.1.10" />
+
+  <!-- FileSystem indices -->
+  <def name="FSIDX_DIR"   value="M($hpuxFileSystemDir, %filesystem-name%)" />
+  <def name="FSIDX_NAME"  value="M($hpuxFileSystemName, %filesystem-name%)" />
+
+</definitions>
+
+<datasources>
+
+  <template name="hpux-cpu">
+    <param name="data-file" value="%system-id%_CPU_Utilization.rrd" />
+
+    <leaf name="CPU_Utilization">
+        <param name="comment"
+               value="User, System, Idle, and Nice CPU Utilization" />
+        <param name="precedence"        value="1000" />
+        <param name="ds-type"           value="rrd-multigraph" />
+        <param name="ds-names"          value="user,system,idle,nice" />
+
+        <param name="ds-expr-user"      value="{User_CPU}" />
+        <param name="graph-legend-user" value="User" />
+        <param name="line-style-user"   value="AREA" />
+        <param name="line-order-user"   value="1" />
+        <param name="line-color-user"   value="#FF0000" />
+
+        <param name="ds-expr-system"    value="{System_CPU}" />
+        <param name="graph-legend-system"       value="System" />
+        <param name="line-style-system" value="STACK" />
+        <param name="line-order-system" value="2" />
+        <param name="line-color-system" value="#FFFF00" />
+
+        <param name="ds-expr-idle"      value="{Idle_CPU}" />
+        <param name="graph-legend-idle" value="Idle" />
+        <param name="line-style-idle"   value="STACK" />
+        <param name="line-order-idle"   value="3" />
+        <param name="line-color-idle"   value="#00FF00" />
+
+        <param name="ds-expr-nice"      value="{Nice_CPU}" />
+        <param name="graph-legend-nice" value="Nice" />
+        <param name="line-style-nice"   value="STACK" />
+        <param name="line-order-nice"   value="4" />
+        <param name="line-color-nice"   value="#99CCFF" />
+    </leaf> <!-- CPU_Utilization -->
+
+    <leaf name="User_CPU">
+      <param name="snmp-object"        value="$hpuxSystemUserCPU.0"/>
+      <param name="rrd-ds"             value="hpuxSystemUserCPU" />
+      <param name="rrd-create-dstype"  value="COUNTER" />
+      <param name="comment">
+          Average time in seconds spent by all processors in User mode.
+      </param>
+      <param name="graph-legend"       value="User CPU" />
+    </leaf>
+
+    <leaf name="System_CPU">
+      <param name="snmp-object"        value="$hpuxSystemSysCPU.0"/>
+      <param name="rrd-ds"             value="hpuxSystemSysCPU" />
+      <param name="rrd-create-dstype"  value="COUNTER" />
+      <param name="comment">
+          Average time in seconds spent by all processors in System mode.
+      </param>
+      <param name="graph-legend"       value="System CPU" />
+    </leaf>
+
+    <leaf name="Idle_CPU">
+      <param name="snmp-object"        value="$hpuxSystemIdleCPU.0"/>
+      <param name="rrd-ds"             value="hpuxSystemIdleCPU" />
+      <param name="rrd-create-dstype"  value="COUNTER" />
+      <param name="comment">
+          Average time in seconds spent by all processors in Idle mode.
+      </param>
+      <param name="graph-legend"       value="Idle CPU" />
+    </leaf>
+
+    <leaf name="Nice_CPU">
+      <param name="snmp-object"        value="$hpuxSystemNiceCPU.0"/>
+      <param name="rrd-ds"             value="hpuxSystemNiceCPU" />
+      <param name="rrd-create-dstype"  value="COUNTER" />
+      <param name="comment">
+          Average time in seconds spent by all processors in Nice mode.
+      </param>
+      <param name="graph-legend"       value="Nice CPU" />
+    </leaf>
+  </template> <!-- hpux-cpu -->
+
+
+  <template name="hpux-filesystem">
+    <param name="data-file" value="%system-id%_%filesystem%.rrd" />
+
+    <leaf name="FileSystem_Usage_Bytes">
+        <param name="comment"           value="File system usage" />
+        <param name="ds-type"           value="rrd-multigraph" />
+        <param name="ds-names"          value="btotal,bfree,bfreeu" />
+        <param name="precedence"        value="900" />
+
+        <param name="ds-expr-btotal"    value="{Blocks_Total},1024,*" />
+        <param name="graph-legend-btotal"       value="Blocks Total" />
+        <param name="line-style-btotal" value="AREA" />
+        <param name="line-order-btotal" value="1" />
+        <param name="line-color-btotal" value="#00FF00" />
+
+        <param name="ds-expr-bfree"     value="{Blocks_Free},1024,*" />
+        <param name="graph-legend-bfree"        value="Blocks Free" />
+        <param name="line-style-bfree"  value="AREA" />
+        <param name="line-order-bfree"  value="2" />
+        <param name="line-color-bfree"  value="#0000FF" />
+
+        <param name="ds-expr-bfreeu"    value="{Blocks_Avail},1024,*" />
+        <param name="graph-legend-bfreeu"
+               value="Blocks Avail. (non-superuser)" />
+        <param name="line-style-bfreeu" value="AREA" />
+        <param name="line-order-bfreeu" value="3" />
+        <param name="line-color-bfreeu" value="#FFFF00" />
+    </leaf>
+
+    <leaf name="Blocks_Total">
+      <param name="snmp-object"    value="$hpuxFileSystemBlock.$FSIDX_DIR"/>
+      <param name="rrd-ds"             value="hpuxFSBlocks" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="comment">
+          Total blocks in file system.
+      </param>
+      <param name="graph-legend"       value="Blocks Total" />
+    </leaf>
+
+    <leaf name="Bytes_Total">
+      <param name="ds-type"             value="rrd-file" />
+      <param name="leaf-type"           value="rrd-cdef" />
+      <param name="rpn-expr"            value="{Blocks_Total},1024,*" />
+      <param name="comment">
+          Total bytes in files system.
+      </param>
+      <param name="graph-legend"       value="Bytes Total" />
+    </leaf>
+
+    <leaf name="Blocks_Free">
+      <param name="snmp-object"    value="$hpuxFileSystemBfree.$FSIDX_DIR"/>
+      <param name="rrd-ds"             value="hpuxFSBfree" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="comment">
+          Free blocks in file system.
+      </param>
+      <param name="graph-legend"       value="Blocks Free" />
+    </leaf>
+
+    <leaf name="Bytes_Free">
+      <param name="ds-type"             value="rrd-file" />
+      <param name="leaf-type"           value="rrd-cdef" />
+      <param name="rpn-expr"            value="{Blocks_Free},1024,*" />
+      <param name="comment">
+          Free bytes in files system.
+      </param>
+      <param name="graph-legend"       value="Bytes Free" />
+    </leaf>
+
+    <leaf name="Blocks_Avail">
+      <param name="snmp-object"   value="$hpuxFileSystemBavail.$FSIDX_DIR"/>
+      <param name="rrd-ds"             value="hpuxFSBavail" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="comment">
+          Free blocks avail to non-superuser.
+      </param>
+      <param name="graph-legend"       value="Blocks Avail" />
+    </leaf>
+
+    <leaf name="Bytes_Avail">
+      <param name="ds-type"             value="rrd-file" />
+      <param name="leaf-type"           value="rrd-cdef" />
+      <param name="rpn-expr"            value="{Blocks_Avail},1024,*" />
+      <param name="comment">
+          Free bytes avail to non-superuser.
+      </param>
+      <param name="graph-legend"       value="Bytes Avail" />
+    </leaf>
+
+    <leaf name="FileSystem_Node">
+        <param name="comment"           value="File system inode usage" />
+        <param name="ds-type"           value="rrd-multigraph" />
+        <param name="ds-names"          value="itotal,ifree" />
+        <param name="precedence"        value="800" />
+
+        <param name="ds-expr-itotal"    value="{Nodes_Total}" />
+        <param name="graph-legend-itotal"       value="inode Total" />
+        <param name="graph-legend"
+               value="%itotal% {itotal} %Nodes_Total% {Nodes_Total}" />
+        <param name="line-style-itotal" value="AREA" />
+        <param name="line-order-itotal" value="1" />
+        <param name="line-color-itotal" value="#00FF00" />
+
+        <param name="ds-expr-ifree"     value="{Nodes_Free}" />
+        <param name="graph-legend-ifree"        value="inode Free" />
+        <param name="line-style-ifree"  value="AREA" />
+        <param name="line-order-ifree"  value="1" />
+        <param name="line-color-ifree"  value="#0000FF" />
+    </leaf>
+
+    <leaf name="Nodes_Total">
+      <param name="snmp-object"   value="$hpuxFileSystemFiles.$FSIDX_DIR"/>
+      <param name="rrd-ds"             value="hpuxFSFiles" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="comment">
+          Total file nodes in file system.
+      </param>
+      <param name="graph-legend"       value="Nodes Total" />
+    </leaf>
+
+    <leaf name="Nodes_Free">
+      <param name="snmp-object"   value="$hpuxFileSystemFfree.$FSIDX_DIR"/>
+      <param name="rrd-ds"             value="hpuxFSFfree" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="comment">
+          Free file nodes in file system.
+      </param>
+      <param name="graph-legend"       value="Nodes Free" />
+    </leaf>
+
+  </template>  <!-- hpux-filesystem -->
+
+</datasources>
+</configuration>
diff --git a/torrus/xmlconfig/vendor/jacarta.xml b/torrus/xmlconfig/vendor/jacarta.xml
new file mode 100644 (file)
index 0000000..3dab3eb
--- /dev/null
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright (C) 2010 Roman Hochuli
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+   Jacarta iMeter-Products
+
+  $Id: jacarta.xml,v 1.1 2010-12-27 00:04:23 ivan Exp $
+-->
+
+
+<configuration>
+  <definitions>
+    <def name="jacarta_sensorEntry"
+         value="1.3.6.1.4.1.19011.2.3.1.1"/>
+     <def name="jacarta_sensorValue"
+          value="1.3.6.1.4.1.19011.2.3.1.1.4"/>
+  </definitions>
+
+  <datasources>
+
+    <template name="imeter-sensor">
+      <param name="collector-timeoffset-hashstring"
+               value="%system-id%:%imeter-sensor-index%" />
+      <param name="data-file"
+               value="%system-id%_sensor_%imeter-sensor-index%.rrd"/>
+      <param name="rrd-ds"            value="value"/>
+      <param name="rrd-cf"            value="AVERAGE"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="nodeid"
+               value="sensor//%nodeid-device%//%imeter-sensor-index%"/>
+    </template>
+     
+    <template name="imeter-humi-sensor">
+      <apply-template name="imeter-sensor"/>
+      <param name="snmp-object"
+               value="$jacarta_sensorValue.%imeter-sensor-index%"/>
+      <param name="graph-lower-limit" value="0" />
+      <param name="graph-upper-limit" value="100" />
+      <param name="upper-limit" value="90" />
+      <param name="vertical-label" value="Percent" />
+      <param name="comment" value="Humidity sensor" />
+    </template>
+
+    <template name="imeter-temp-sensor">
+      <apply-template name="imeter-sensor"/>
+      <param name="snmp-object"
+               value="$jacarta_sensorValue.%imeter-sensor-index%"/>
+      <param name="graph-lower-limit" value="0" />
+      <param name="graph-upper-limit" value="50" />
+      <param name="upper-limit" value="35" />
+      <param name="vertical-label" value="Degrees Celsius" />
+      <param name="comment" value="Temperature sensor" />
+    </template>
+
+    <template name="imeter-amps-sensor">
+      <apply-template name="imeter-sensor"/>
+      <param name="snmp-object"
+               value="$jacarta_sensorValue.%imeter-sensor-index%"/>
+      <param name="collector-scale"   value="10,/" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="graph-upper-limit" value="38" />
+      <param name="upper-limit" value="32" />
+      <param name="vertical-label" value="Ampere" />
+      <param name="comment" value="Electrical current meter" />
+    </template>
+
+
+  </datasources>
+</configuration>
diff --git a/torrus/xmlconfig/vendor/junos.xml b/torrus/xmlconfig/vendor/junos.xml
new file mode 100644 (file)
index 0000000..5b2af89
--- /dev/null
@@ -0,0 +1,775 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2007 Jon Nistor
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: junos.xml,v 1.1 2010-12-27 00:04:23 ivan Exp $
+  Jon Nistor <nistor at snickers dot org>
+
+-->
+<!-- Tested on Juniper Operating system for M/T series routers -->
+
+<configuration>
+
+<definitions>
+  <!-- JUNIPER-MIB::chassis -->
+  <def name="jnxOperatingTemp"        value="1.3.6.1.4.1.2636.3.1.13.1.7"/>
+  <def name="jnxOperatingCPU"         value="1.3.6.1.4.1.2636.3.1.13.1.8"/>
+  <def name="jnxOperatingISR"         value="1.3.6.1.4.1.2636.3.1.13.1.9"/>
+  <def name="jnxOperatingBuffer"      value="1.3.6.1.4.1.2636.3.1.13.1.11"/>
+  <def name="jnxOperatingHeap"        value="1.3.6.1.4.1.2636.3.1.13.1.12"/>
+  <def name="jnxOperatingMemory"      value="1.3.6.1.4.1.2636.3.1.13.1.15"/>
+
+  <!-- JUNIPER-FIREWALL-MIB -->
+  <def name="jnxFWCounterPacketCount" value="1.3.6.1.4.1.2636.3.5.2.1.4"/>
+  <def name="jnxFWCounterByteCount"   value="1.3.6.1.4.1.2636.3.5.2.1.5"/>
+
+  <!-- JUNIPER-COS-MIB -->
+  <def name="jnxCosQstatQedPkts"      value="1.3.6.1.4.1.2636.3.15.4.1.3"/>
+  <def name="jnxCosQstatQedPktRate"   value="1.3.6.1.4.1.2636.3.15.4.1.4"/>
+  <def name="jnxCosQstatQedBytes"     value="1.3.6.1.4.1.2636.3.15.4.1.5"/>
+  <def name="jnxCosQstatQedByteRate"  value="1.3.6.1.4.1.2636.3.15.4.1.6"/>
+
+  <def name="jnxCosQstatTxedPkts"     value="1.3.6.1.4.1.2636.3.15.4.1.7"/>
+  <def name="jnxCosQstatTxedPktRate"  value="1.3.6.1.4.1.2636.3.15.4.1.8"/>
+  <def name="jnxCosQstatTxedBytes"    value="1.3.6.1.4.1.2636.3.15.4.1.9"/>
+  <def name="jnxCosQstatTxedByteRate" value="1.3.6.1.4.1.2636.3.15.4.1.10"/>
+
+  <def name="jnxCosQstatTailDropPkts"    value="1.3.6.1.4.1.2636.3.15.4.1.11"/>
+  <def name="jnxCosQstatTailDropPktRate" value="1.3.6.1.4.1.2636.3.15.4.1.12"/>
+
+  <def name="jnxCosQstatTotalRedDropPkts"
+             value="1.3.6.1.4.1.2636.3.15.4.1.13" />
+  <def name="jnxCosQstatTotalRedDropPktRate"
+             value="1.3.6.1.4.1.2636.3.15.4.1.14" />
+  <def name="jnxCosQstatLpNonTcpRedDropPkts"
+             value="1.3.6.1.4.1.2636.3.15.4.1.15" />
+  <def name="jnxCosQstatLpNonTcpRDropPktRate"
+             value="1.3.6.1.4.1.2636.3.15.4.1.16" />
+  <def name="jnxCosQstatLpTcpRedDropPkts"
+             value="1.3.6.1.4.1.2636.3.15.4.1.17" />
+  <def name="jnxCosQstatLpTcpRedDropPktRate"
+             value="1.3.6.1.4.1.2636.3.15.4.1.18" />
+  <def name="jnxCosQstatHpNonTcpRedDropPkts"
+             value="1.3.6.1.4.1.2636.3.15.4.1.19" />
+  <def name="jnxCosQstatHpNonTcpRDropPktRate"
+             value="1.3.6.1.4.1.2636.3.15.4.1.20" />
+  <def name="jnxCosQstatHpTcpRedDropPkts"
+             value="1.3.6.1.4.1.2636.3.15.4.1.21" />
+  <def name="jnxCosQstatHpTcpRedDropPktRate"
+             value="1.3.6.1.4.1.2636.3.15.4.1.22" />
+  <def name="jnxCosQstatTotalRedDropBytes"
+             value="1.3.6.1.4.1.2636.3.15.4.1.23" />
+  <def name="jnxCosQstatTotalRedDropByteRate"
+             value="1.3.6.1.4.1.2636.3.15.4.1.24" />
+  <def name="jnxCosQstatLpNonTcpRedDropBytes"
+             value="1.3.6.1.4.1.2636.3.15.4.1.25" />
+  <def name="jnxCosQstatLpNonTcpRDropByteRate"
+             value="1.3.6.1.4.1.2636.3.15.4.1.26" />
+  <def name="jnxCosQstatLpTcpRedDropBytes"
+             value="1.3.6.1.4.1.2636.3.15.4.1.27" />
+  <def name="jnxCosQstatLpTcpRedDropByteRate"
+             value="1.3.6.1.4.1.2636.3.15.4.1.28" />
+  <def name="jnxCosQstatHpNonTcpRedDropBytes"
+             value="1.3.6.1.4.1.2636.3.15.4.1.29" />
+  <def name="jnxCosQstatHpNonTcpRDropByteRate"
+             value="1.3.6.1.4.1.2636.3.15.4.1.30" />
+  <def name="jnxCosQstatHpTcpRedDropBytes"
+             value="1.3.6.1.4.1.2636.3.15.4.1.31" />
+  <def name="jnxCosQstatHpTcpRedDropByteRate"
+             value="1.3.6.1.4.1.2636.3.15.4.1.32" />
+
+  <!-- JUNIPER-RPF-MIB::jnxRpfStatsTable -->
+  <def name="jnxRpfStatsPackets" value="1.3.6.1.4.1.2636.3.17.1.1.1.3"/>
+  <def name="jnxRpfStatsBytes"   value="1.3.6.1.4.1.2636.3.17.1.1.1.4"/>
+</definitions>
+
+
+<datasources>
+  <template name="junos-cos-subtree">
+    <param name="comment"     value="Class of Service"/>
+  </template>
+
+
+  <template name="junos-cos-subtree-interface">
+    <param name="has-overview-shortcuts"     value="yes"/>
+    <param name="overview-shortcuts"
+           value="queuedPktRate,queuedByteRate,queuedBpsRate,
+                  xmitPktRate,xmitByteRate,xmitBpsRate"/>
+    <!-- Queued Packet Rate -->
+    <param name="overview-subleave-name-queuedPktRate"
+           value="Queued_Packet_Rate"/>
+    <param name="overview-shortcut-text-queuedPktRate"
+           value="All queued packet rates"/>
+    <param name="overview-shortcut-title-queuedPktRate"
+           value="Show all queued packet rates in one page"/>
+    <param name="overview-page-title-queuedPktRate"
+           value="Output queued packet rates per class"/>
+    <!-- Queued Byte Rate -->
+    <param name="overview-subleave-name-queuedByteRate"
+           value="Queued_Byte_Rate"/>
+    <param name="overview-shortcut-text-queuedByteRate"
+           value="All queued byte rates"/>
+    <param name="overview-shortcut-title-queuedByteRate"
+           value="Show all queued byte rates in one page"/>
+    <param name="overview-page-title-queuedByteRate"
+           value="Output queued byte rates per class"/>
+    <!-- Queued Byte Rate (in BPS) -->
+    <param name="overview-subleave-name-queuedBpsRate"
+           value="Queued_Bps_Rate"/>
+    <param name="overview-shortcut-text-queuedBpsRate"
+           value="All queued bit rates (in Bps)"/>
+    <param name="overview-shortcut-title-queuedBpsRate"
+           value="Show all queued bit rates in one page"/>
+    <param name="overview-page-title-queuedBpsRate"
+           value="Output queued byte rates per class"/>
+    <!-- Transmitted Packet Rate -->
+    <param name="overview-subleave-name-xmitPktRate"
+           value="Transmitted_Packet_Rate"/>
+    <param name="overview-shortcut-text-xmitPktRate"
+           value="All queue packet transmit rates"/>
+    <param name="overview-shortcut-title-xmitPktRate"
+           value="Show all queue packet transmit rates in one page"/>
+    <param name="overview-page-title-xmitPktRate"
+           value="Output queue packet transmitted rates per class"/>
+    <!-- Transmitted Byte Rate -->
+    <param name="overview-subleave-name-xmitByteRate"
+           value="Transmitted_Byte_Rate"/>
+    <param name="overview-shortcut-text-xmitByteRate"
+           value="All queue byte transmit rates"/>
+    <param name="overview-shortcut-title-xmitByteRate"
+           value="Show all queue byte transmit rates in one page"/>
+    <param name="overview-page-title-xmitByteRate"
+           value="Output queue byte transmitted rates per class"/>
+    <!-- Transmitted Byte Rate (in BPS) -->
+    <param name="overview-subleave-name-xmitBpsRate"
+           value="Transmitted_Bps_Rate"/>
+    <param name="overview-shortcut-text-xmitBpsRate"
+           value="All queue bit transmit rates (in Bps)"/>
+    <param name="overview-shortcut-title-xmitBpsRate"
+           value="Show all queue bit transmit rates in one page"/>
+    <param name="overview-page-title-xmitBpsRate"
+           value="Output queue bit transmitted rates per class"/>
+  </template>
+
+
+  <template name="junos-cos-leaf">
+    <param name="comment"            value="%cos-name%"/>
+    <param name="data-file"
+           value="%system-id%_cos_%ifName%_out_%cos-name%.rrd"/>
+    <param name="graph-title"        value="%system-id%:%ifName%:%cos-name%"/>
+    <param name="graph-lower-limit"  value="0"/>
+    <param name="snmp-object-type"   value="COUNTER64" />
+
+    <!-- Queued packet/byte stats -->
+    <leaf name="Queued_Packets">
+        <param name="comment"
+               value="Total number of packets queued"/>
+        <param name="graph-legend"       value="Packets"/>
+        <param name="precedence"         value="904"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="QedPkts"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatQedPkts.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Queued_Packet_Rate">
+        <param name="comment"
+               value="The rate at which packets were queued"/>
+        <param name="graph-legend"       value="Packets per second"/>
+        <param name="precedence"         value="903"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-ds"             value="QedPktRate"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatQedPktRate.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Queued_Bytes">
+        <param name="comment"
+               value="Number of bytes queued at the output"/>
+        <param name="graph-legend"       value="Bytes"/>
+        <param name="precedence"         value="902"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="QedBytes"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatQedBytes.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Queued_Byte_Rate">
+        <param name="comment"
+               value="The rate at which bytes were queued"/>
+        <param name="graph-legend"       value="Packets per second"/>
+        <param name="precedence"         value="901"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-ds"             value="QedByteRate"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatQedByteRate.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Queued_Bps_Rate">
+        <param name="comment"
+               value="The rate at which bytes were queued (shown in Bps)"/>
+        <param name="graph-legend"       value="Bits per second"/>
+        <param name="precedence"         value="800"/>
+        <param name="vertical-label"     value="bps"/>
+        <param name="ds-type"            value="rrd-file"/>
+        <param name="leaf-type"          value="rrd-cdef"/>
+        <param name="rpn-expr"           value="{Queued_Byte_Rate},8,*"/>
+    </leaf>
+
+    <!-- Transmitted packet/byte stats -->
+    <leaf name="Transitmitted_Packets">
+        <param name="comment"
+               value="Number of packets transmitted on the queue"/>
+        <param name="graph-legend"       value="Packets"/>
+        <param name="precedence"         value="804"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="TxedPkts"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatTxedPkts.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Transmitted_Packet_Rate">
+        <param name="comment"
+               value="Output queue's packet transmit rate"/>
+        <param name="graph-legend"       value="Packets per second"/>
+        <param name="precedence"         value="803"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-ds"             value="TxedPktRate"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatTxedPktRate.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Transmitted_Bytes">
+        <param name="comment"
+               value="Number of bytes transmitted on the queue"/>
+        <param name="graph-legend"       value="Packets"/>
+        <param name="precedence"         value="802"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="TxedBytes"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatTxedBytes.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Transmitted_Byte_Rate">
+        <param name="comment"
+               value="The queue's current transmit rate in bytes per second"/>
+        <param name="graph-legend"       value="Bytes per second"/>
+        <param name="precedence"         value="801"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-ds"             value="TxedByteRate"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatTxedByteRate.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Transmitted_Bps_Rate">
+        <param name="comment"
+               value="Queue's current transmit rate in bits per second"/>
+        <param name="graph-legend"       value="Bits per second"/>
+        <param name="precedence"         value="800"/>
+        <param name="vertical-label"     value="bps"/>
+        <param name="ds-type"            value="rrd-file"/>
+        <param name="leaf-type"          value="rrd-cdef"/>
+        <param name="rpn-expr"           value="{Transmitted_Byte_Rate},8,*"/>
+    </leaf>
+  </template>
+
+
+  <template name="junos-cos-tail">
+    <param name="comment"            value="%cos-name%"/>
+    <param name="data-file"
+           value="%system-id%_cos_tail_%ifName%_out_%cos-name%.rrd"/>
+    <param name="graph-title"        value="%system-id%:%ifName%:%cos-name%"/>
+    <param name="graph-lower-limit"  value="0"/>
+
+    <!-- Tail-dropped packet stats --> 
+    <leaf name="Tail_Dropped_Packets">
+        <param name="comment"
+               value="Number of packets tail dropped"/>
+        <param name="graph-legend"       value="Packets"/>
+        <param name="precedence"         value="702"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="TailDropPkts"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatTailDropPkts.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Tail_Dropped_Packet_Rate">
+        <param name="comment"
+               value="Tail drop packet rate for the queue"/>
+        <param name="graph-legend"       value="Packets per second"/>
+        <param name="precedence"         value="701"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-ds"             value="TailDropPktRate"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatTailDropPktRate.%ifIndex%.%cos-index%"/>
+    </leaf>
+  </template>
+
+
+  <template name="junos-cos-red">
+    <param name="comment"            value="%cos-name%"/>
+    <param name="data-file"
+           value="%system-id%_cos_red_%ifName%_out_%cos-name%.rrd"/>
+    <param name="graph-title"        value="%system-id%:%ifName%:%cos-name%"/>
+    <param name="graph-lower-limit"  value="0"/>
+
+    <!-- RED-dropped packet stats -->
+    <leaf name="Dropped_Packets">
+        <param name="comment"
+               value="Total number of packets dropped due to RED"/>
+        <param name="graph-legend"       value="Packets"/>
+        <param name="precedence"         value="610"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="TotalRedDropPkts"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatTotalRedDropPkts.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Dropped_Packet_Rate">
+        <param name="comment"
+               value="Most recent estimate of per-second RED-dropped pkts"/>
+        <param name="graph-legend"       value="Packets per second"/>
+        <param name="precedence"         value="609"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-ds"             value="TotalRedDropPktRate"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatTotalRedDropPktRate.%ifIndex%.%cos-index%"/>
+    </leaf>
+
+
+    <!-- RED: PLP Packet information -->
+    <leaf name="Low_priority_Non_TCP_Dropped_Packets">
+        <param name="comment"
+               value="Low Priority - PLP Non-TCP packets RED-dropped"/>
+        <param name="graph-legend"       value="Packets"/>
+        <param name="precedence"         value="608"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="LpNonTcpRedDropPkts"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatLpNonTcpRedDropPkts.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Low_priority_Non_TCP_Dropped_Packet_Rate">
+        <param name="comment"
+               value="Low Priority - PLP rate of Non-TCP packets RED-dropped"/>
+        <param name="graph-legend"       value="Packets per second"/>
+        <param name="precedence"         value="607"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-ds"             value="LpNonTcpRDropPktRat"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatLpNonTcpRDropPktRate.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Low_priority_TCP_Dropped_Packets">
+        <param name="comment"
+               value="Low Priority - PLP TCP packets RED-dropped"/>
+        <param name="graph-legend"       value="Packets"/>
+        <param name="precedence"         value="606"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="LpTcpRedDropPkts"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatLpTcpRedDropPkts.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Low_priority_TCP_Dropped_Packet_Rate">
+        <param name="comment"
+               value="Low Priority - PLP rate of TCP packets RED-dropped"/>
+        <param name="graph-legend"       value="Packets per second"/>
+        <param name="precedence"         value="605"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-ds"             value="LpTcpRedDropPktRate"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatLpTcpRedDropPktRate.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="High_priority_Non_TCP_Dropped_Packets">
+        <param name="comment"
+               value="High Priority - PLP Non-TCP packets RED-dropped"/>
+        <param name="graph-legend"       value="Packets"/>
+        <param name="precedence"         value="604"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="HpNonTcpRedDropPkts"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatHpNonTcpRedDropPkts.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="High_priority_Non_TCP_Dropped_Packet_Rate">
+        <param name="comment"
+               value="High Priority - PLP rate of non-TCP packets RED-dropped"/>
+        <param name="graph-legend"       value="Packets per second"/>
+        <param name="precedence"         value="603"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-ds"             value="HpNonTcpRDropPktRat"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatHpNonTcpRDropPktRate.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="High_priority_TCP_Dropped_Packets">
+        <param name="comment"
+               value="High Priority - PLP TCP packets RED-dropped"/>
+        <param name="graph-legend"       value="Packets"/>
+        <param name="precedence"         value="602"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="HpTcpRedDropPkts"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatHpTcpRedDropPkts.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="High_priority_TCP_Dropped_Packet_Rate">
+        <param name="comment"
+               value="High Priority - PLP rate of TCP packets RED-dropped"/>
+        <param name="graph-legend"       value="Packets per second"/>
+        <param name="precedence"         value="601"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="HpTcpRedDropPktRate"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatHpTcpRedDropPktRate.%ifIndex%.%cos-index%"/>
+    </leaf>
+
+
+    <!-- RED-dropped byte stats -->
+    <leaf name="Total_Dropped_Bytes">
+        <param name="comment"
+               value="Total number of bytes RED-dropped at the output"/>
+        <param name="graph-legend"       value="Packets"/>
+        <param name="precedence"         value="510"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="TotalRedDropBytes"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatTotalRedDropBytes.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Total_Dropped_Byte_Rate">
+        <param name="comment"
+               value="Rate at which bytes were RED-dropped"/>
+        <param name="graph-legend"       value="Bytes per second"/>
+        <param name="precedence"         value="509"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-ds"             value="TotalRedDropByteRat"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatTotalRedDropByteRate.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Low_priority_Non_TCP_Dropped_Bytes">
+        <param name="comment"
+               value="Low Priority - PLP Non-TCP bytes RED-dropped"/>
+        <param name="graph-legend"       value="Bytes"/>
+        <param name="precedence"         value="508"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="LpNonTcpRedDropByte"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatLpNonTcpRedDropBytes.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Low_priority_Non_TCP_Dropped_Packet_Rate">
+        <param name="comment"
+               value="Low Priority - PLP rate of non-TCP bytes RED-dropped"/>
+        <param name="graph-legend"       value="Bytes per second"/>
+        <param name="precedence"         value="507"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-ds"             value="LpNonTcpRDropByteR"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatLpNonTcpRDropByteRate.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Low_priority_TCP_Dropped_Bytes">
+        <param name="comment"
+               value="Low Priority - PLP TCP byte RED-dropped"/>
+        <param name="graph-legend"       value="Bytes"/>
+        <param name="precedence"         value="506"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="LpTcpRedDropBytes"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatLpTcpRedDropBytes.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="Low_priority_TCP_Dropped_Byte_Rate">
+        <param name="comment"
+               value="Low Priority - PLP rate of TCP bytes RED-dropped"/>
+        <param name="graph-legend"       value="Bytes per second"/>
+        <param name="precedence"         value="505"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-ds"             value="LpTcpRedDropByteRat"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatLpTcpRedDropByteRate.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="High_priority_Non_TCP_Dropped_Bytes">
+        <param name="comment"
+               value="High Priority - PLP Non-TCP bytes RED-dropped"/>
+        <param name="graph-legend"       value="Bytes"/>
+        <param name="precedence"         value="504"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="HpNonTcpRedDropByte"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatHpNonTcpRedDropBytes.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="High_priority_Non_TCP_Dropped_Byte_Rate">
+        <param name="comment"
+               value="High Priority - PLP rate of non-TCP bytes RED-dropped"/>
+        <param name="graph-legend"       value="Bytes per second"/>
+        <param name="precedence"         value="503"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-ds"             value="HpNonTcpRDropByteR"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatHpNonTcpRDropByteRate.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="High_priority_TCP_Dropped_Bytes">
+        <param name="comment"
+               value="High Priority - PLP TCP bytes RED-dropped"/>
+        <param name="graph-legend"       value="Bytes"/>
+        <param name="precedence"         value="502"/>
+        <param name="rrd-create-dstype"  value="COUNTER"/>
+        <param name="rrd-ds"             value="HpTcpRedDropBytes"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatHpTcpRedDropBytes.%ifIndex%.%cos-index%"/>
+    </leaf>
+    <leaf name="High_priority_TCP_Dropped_Byte_Rate">
+        <param name="comment"
+               value="High Priority - PLP rate of TCP bytes RED-dropped"/>
+        <param name="graph-legend"       value="Bytes per second"/>
+        <param name="precedence"         value="501"/>
+        <param name="rrd-create-dstype"  value="GAUGE"/>
+        <param name="rrd-ds"             value="HpTcpRedDropByteR"/>
+        <param name="snmp-object"
+               value="$jnxCosQstatHpTcpRedDropByteRate.%ifIndex%.%cos-index%"/>
+    </leaf>
+  </template>
+
+
+  <template name="junos-cpu-subtree">
+    <param name="data-file"         value="%system-id%_cpu_%cpu-index%.rrd"/>
+    <param name="comment"           value="Overall CPU busy percentage"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+    <param name="rrd-hwpredict"     value="disabled"/>
+    <param name="graph-lower-limit" value="0"/>
+    <param name="graph-upper-limit" value="100"/>
+    <param name="upper-limit"       value="80"/>
+    <param name="vertical-label"    value="Percent"/>
+
+    <param name="has-overview-shortcuts"     value="yes"/>
+    <param name="overview-shortcuts"         value="cpu"/>
+    <!-- CPU usage -->
+    <param name="overview-subleave-name-cpu" value="CPU_Total"/>
+    <param name="overview-shortcut-text-cpu" value="All CPUs usage"/>
+    <param name="overview-shortcut-title-cpu"
+           value="Show all CPUs minute average usage in one page"/>
+    <param name="overview-page-title-cpu"    value="CPU Usage Graphs"/>
+    <param name="descriptive-nickname"
+           value="%system-id%:CPU #%comment%"/>
+  </template>
+
+
+  <template name="junos-cpu">
+    <leaf name="CPU_Total">
+        <param name="rrd-ds"        value="cpuUsage"/>
+        <param name="snmp-object"   value="$jnxOperatingCPU.%cpu-index%"/>
+        <param name="comment"       value="The overall CPU busy percentage"/>
+        <param name="graph-legend"  value="CPU usage"/>
+    </leaf>
+  </template>
+
+
+  <template name="junos-firewall-subtree">
+    <param name="comment"           value="Firewall filter statistics"/>
+  </template>
+
+
+  <template name="junos-firewall-filter-subtree">
+    <param name="has-overview-shortcuts"         value="yes"/>
+    <param name="overview-shortcuts"             value="bps,packets"/>
+    <param name="graph-title"     value="%system-id%:%fw-filter%:%fw-counter%"/>
+    <!-- Bytes -->
+    <param name="overview-subleave-name-bps"     value="Bps"/>
+    <param name="overview-shortcut-text-bps"     value="All Bps rates"/>
+    <param name="overview-shortcut-title-bps"
+           value="Show bps rates on one page"/>
+    <param name="overview-page-title-bps"
+           value="Bps rates per firewall filter counter"/>
+    <!-- Packets -->
+    <param name="overview-subleave-name-packets" value="Packets"/>
+    <param name="overview-shortcut-text-packets" value="All packet rates"/>
+    <param name="overview-shortcut-title-packets"
+           value="Show packet rates on one page"/>
+    <param name="overview-page-title-packets"
+           value="Packet rates per firewall filter counter/policer"/>
+  </template>
+
+
+  <template name="junos-firewall-filter">
+    <param name="data-file"
+          value="%system-id%_fw_%fw-filter%_%fw-counter%.rrd"/>
+    <param name="rrd-create-dstype" value="COUNTER"/>
+    <param name="snmp-object-type"  value="COUNTER64"/>
+    <param name="rrd-hwpredict"     value="disabled"/>
+    <param name="graph-title"     value="%system-id%:%fw-filter%:%fw-counter%"/>
+  </template>
+
+
+  <template name="junos-firewall-filter-counter">
+   <leaf name="Bps">
+      <param name="comment"             value="Bits per second"/>
+      <param name="ds-type"             value="rrd-multigraph"/>
+      <param name="ds-names"            value="bytes"/>
+      <!-- Multigraph -->
+      <param name="ds-expr-bytes"       value="{Bytes},8,*"/>
+      <param name="graph-legend-bytes"  value="Bits per second"/>
+      <param name="line-style-bytes"    value="LINE2"/>
+      <param name="line-color-bytes"    value="##two"/>
+      <param name="line-order-bytes"    value="1"/>
+    </leaf>
+    <leaf name="Bytes">
+      <param name="comment"        value="Number of bytes being counted"/>
+      <param name="rrd-ds"         value="Bytes"/>
+      <param name="graph-legend"   value="Bytes"/>
+      <param name="vertical-label" value="Bytes/s"/>
+      <param name="snmp-object"    value="$jnxFWCounterByteCount.%fw-index%"/>
+    </leaf>
+  </template>
+
+
+  <template name="junos-firewall-filter-policer">
+    <leaf name="Packets">
+      <param name="comment"        value="Number of packets being counted"/>
+      <param name="rrd-ds"         value="Packets"/>
+      <param name="graph-legend"   value="Packets"/>
+      <param name="vertical-label" value="pps"/>
+      <param name="snmp-object"    value="$jnxFWCounterPacketCount.%fw-index%"/>
+    </leaf>
+  </template>
+
+
+  <template name="junos-memory-subtree">
+    <param name="data-file"         value="%system-id%_mem_%mem-indexFix%.rrd"/>
+    <param name="comment"           value="DRAM, buffer and heap information"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+    <param name="rrd-hwpredict"     value="disabled" />
+    <param name="graph-lower-limit" value="0" />
+
+    <param name="has-overview-shortcuts" value="yes"/>
+    <param name="overview-shortcuts"     value="mem,buffer,heap"/>
+    <!-- DRAM size -->
+    <param name="overview-subleave-name-mem" value="Memory"/>
+    <param name="overview-shortcut-text-mem" value="All memory sizes"/>
+    <param name="overview-shortcut-title-mem"
+           value="Show all memory size in one page"/>
+    <param name="overview-page-title-mem"
+           value="Memory Size Graphs"/>     
+    <!-- Buffer pool utilization -->
+    <param name="overview-subleave-name-buffer" value="Buffer_utilization"/>
+    <param name="overview-shortcut-text-buffer" value="All buffer pool util"/>
+    <param name="overview-shortcut-title-buffer"
+           value="Show all buffer pool utilization in one page"/>
+    <param name="overview-page-title-buffer"
+           value="Buffer Pool Graphs"/>     
+    <!-- Heap utilization -->
+    <param name="overview-subleave-name-heap" value="Heap_utilization"/>
+    <param name="overview-shortcut-text-heap" value="All Heap Utilization"/>
+    <param name="overview-shortcut-title-heap"
+           value="Show all heap utilization in one page"/>
+    <param name="overview-page-title-heap"
+           value="Heap Utilization Graphs"/>     
+
+    <param name="descriptive-nickname"
+           value="%system-id%: Memory Size"/>
+  </template>
+
+
+  <template name="junos-memory">
+    <leaf name="Memory">
+      <param name="comment"        value="Memory size in bytes"/>
+      <param name="precedence"     value="1000"/>
+      <param name="snmp-object"    value="$jnxOperatingMemory.%mem-index%"/>
+      <param name="rrd-ds"         value="dram_%mem-indexFix%"/>
+      <param name="graph-legend"   value="Memory Size"/>
+      <param name="line-style"     value="##totalresource"/>
+      <param name="line-color"     value="##totalresource"/>
+      <param name="vertical-label" value="Bytes"/>
+    </leaf>
+    <leaf name="Buffer_utilization">
+      <param name="comment"           value="Buffer pool util in percentage"/>
+      <param name="snmp-object"       value="$jnxOperatingBuffer.%mem-index%"/>
+      <param name="rrd-ds"            value="buffer_%mem-indexFix%"/>
+      <param name="graph-legend"      value="Buffer Pool Utilization"/>
+      <param name="graph-upper-limit" value="100"/>
+      <param name="upper-limit"       value="80"/>
+      <param name="line-style"        value="##resourceusage" />
+      <param name="line-color"        value="##resourceusage" />
+      <param name="vertical-label"    value="Percent"/>
+    </leaf>
+    <leaf name="Heap_utilization">
+      <param name="comment"           value="Heap util in percentage"/>
+      <param name="snmp-object"       value="$jnxOperatingHeap.%mem-index%"/>
+      <param name="rrd-ds"            value="heap_%mem-indexFix%"/>
+      <param name="graph-legend"      value="Heap Utilization"/>
+      <param name="graph-upper-limit" value="100"/>
+      <param name="upper-limit"       value="80"/>
+      <param name="line-style"        value="##resourceusage" />
+      <param name="line-color"        value="##resourceusage" />
+      <param name="vertical-label"    value="Percent"/>
+    </leaf> 
+  </template>
+
+
+  <template name="junos-rpf-subtree">
+    <param name="comment"           value="Reverse Path Forwarding statistics"/>
+    <param name="has-overview-shortcuts"         value="yes"/>
+    <param name="overview-shortcuts"             value="bytes,packets"/>
+    <param name="graph-title"                    value="%system-id%:%ifName%"/>
+    <!-- Bytes -->
+    <param name="overview-subleave-name-bytes"     value="Bytes"/>
+    <param name="overview-shortcut-text-bytes"     value="Bytes received"/>
+    <param name="overview-shortcut-title-bytes"
+           value="Show bytes received on one page"/>
+    <param name="overview-page-title-bytes"
+           value="Bytes received on interface"/>
+    <!-- Packets -->
+    <param name="overview-subleave-name-packets" value="Packets"/>
+    <param name="overview-shortcut-text-packets" value="Packets received"/>
+    <param name="overview-shortcut-title-packets"
+           value="Show packets on one page"/>
+    <param name="overview-page-title-packets"
+           value="Packets received on one page"/>
+  </template>
+
+
+  <template name="junos-rpf">
+    <param name="comment"            value="%ifAddrType%: %ifName%"/>
+    <param name="data-file"
+           value="%system-id%_rpf_%ifAddrType%_%ifNameT%.rrd"/>
+    <param name="graph-title"        value="%system-id%:%ifName%:%ifAddrType%"/>
+    <param name="graph-lower-limit"  value="0"/>
+    <param name="rrd-create-dstype"  value="COUNTER"/>
+    <param name="snmp-object-type"   value="COUNTER64" />
+
+    <leaf name="Packets">
+        <param name="precedence"    value="999"/>
+        <param name="rrd-ds"        value="Pkts"/>
+        <param name="snmp-object"   value="$jnxRpfStatsPackets.%rpfIndex%"/>
+        <param name="comment"
+               value="Number of packets rejected due to RPF processing"/>
+        <param name="graph-legend"  value="RPF rejects"/>
+    </leaf>
+    <leaf name="Bytes">
+        <param name="precedence"    value="998"/>
+        <param name="rrd-ds"        value="Bytes"/>
+        <param name="snmp-object"   value="$jnxRpfStatsBytes.%rpfIndex%"/>
+        <param name="comment"
+               value="Number of bytes rejected due to RPF processing"/>
+        <param name="graph-legend"  value="RPF rejects"/>
+    </leaf>
+  </template>
+
+
+  <template name="junos-temperature-subtree">
+    <param name="data-file"   value="%system-id%_sensor_%sensor-indexFix%.rrd"/>
+    <param name="comment"           value="Temperature Sensors"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+    <param name="rrd-hwpredict"     value="disabled"/>
+    <param name="graph-title"       value="%system-id%:%sensor-desc%"/>
+  </template>
+
+
+  <template name="junos-temperature-sensor">
+    <param name="rrd-ds"            value="sensor_%sensor-indexFix%"/>
+    <param name="snmp-object"       value="$jnxOperatingTemp.%sensor-index%"/>
+    <param name="graph-legend"      value="%sensor-desc%"/>
+    <param name="graph-lower-limit" value="15"/>
+    <param name="graph-upper-limit" value="70"/>
+    <param name="vertical-label"    value="degrees Celsius"/>
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/liebert.xml b/torrus/xmlconfig/vendor/liebert.xml
new file mode 100644 (file)
index 0000000..223bd0e
--- /dev/null
@@ -0,0 +1,405 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2008 Jon Nistor
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: liebert.xml,v 1.1 2010-12-27 00:04:25 ivan Exp $
+  Jon Nistor <nistor at snickers dot org>
+
+-->
+<!--
+     Liebert HVAC systems
+ -->
+
+<configuration>
+
+<definitions>
+  <!-- LIEBERT-GP-ENVIRONMENTAL-MIB -->
+  <!-- Temperature: Fahrenheit (not used due to celcius being converted) -->
+  <def name="TempSettingDegF"     value="1.3.6.1.4.1.476.1.42.3.4.1.2.1.0"/>
+  <def name="TempToleranceDegF"   value="1.3.6.1.4.1.476.1.42.3.4.1.2.2.0"/>
+  <def name="TempMeasurementDegF" value="1.3.6.1.4.1.476.1.42.3.4.1.2.3.1.3.0"/>
+  <def name="TempHighThreshDegF"  value="1.3.6.1.4.1.476.1.42.3.4.1.2.3.1.4.0"/>
+  <def name="TempLowThreshDegF"   value="1.3.6.1.4.1.476.1.42.3.4.1.2.3.1.5.0"/>
+  <!-- Temperature: Celcius (not used due to preferred indexing -->
+  <def name="TempSettingDegC"     value="1.3.6.1.4.1.476.1.42.3.4.1.3.1.0"/>
+  <def name="TempToleranceDegC"   value="1.3.6.1.4.1.476.1.42.3.4.1.3.2.0"/>
+  <def name="TempMeasurementDegC" value="1.3.6.1.4.1.476.1.42.3.4.1.3.3.1.3.0"/>
+  <def name="TempHighThreshDegC"  value="1.3.6.1.4.1.476.1.42.3.4.1.3.3.1.4.0"/>
+  <def name="TempLowThreshDegC"   value="1.3.6.1.4.1.476.1.42.3.4.1.3.3.1.5.0"/>
+
+  <!-- Temperature: Generic -->
+  <def name="TempBase"         value="1.3.6.1.4.1.476.1.42.3.4.1"/>
+  <def name="TempSetting"      value="$TempBase.%temp-idx%.1.0"/>
+  <def name="TempTolerance"    value="$TempBase.%temp-idx%.2.0"/>
+  <def name="TempMeasurement"  value="$TempBase.%temp-idx%.3.1.3.%sensor-idx%"/>
+  <def name="TempHighThresh"   value="$TempBase.%temp-idx%.3.1.4.%sensor-idx%"/>
+  <def name="TempLowThresh"    value="$TempBase.%temp-idx%.3.1.5.%sensor-idx%"/>
+
+  <!-- Humidity -->
+  <def name="HumiditySettingRel"     value="1.3.6.1.4.1.476.1.42.3.4.2.2.1.0"/>
+  <def name="HumidityToleranceRel"   value="1.3.6.1.4.1.476.1.42.3.4.2.2.2.0"/>
+  <def name="HumidityMeasurementRel"
+      value="1.3.6.1.4.1.476.1.42.3.4.2.2.3.1.3.%humid-idx%"/>
+  <def name="HumidityHighThresholdRel"
+      value="1.3.6.1.4.1.476.1.42.3.4.2.2.3.1.4.%humid-idx%"/>
+  <def name="HumidityLowThresholdRel"
+      value="1.3.6.1.4.1.476.1.42.3.4.2.2.3.1.5.%humid-idx%"/>
+
+  <!-- State -->
+  <def name="StateSystem"         value="1.3.6.1.4.1.476.1.42.3.4.3.1.0"/>
+  <def name="StateCooling"        value="1.3.6.1.4.1.476.1.42.3.4.3.2.0"/>
+  <def name="StateHeating"        value="1.3.6.1.4.1.476.1.42.3.4.3.3.0"/>
+  <def name="StateHumidifying"    value="1.3.6.1.4.1.476.1.42.3.4.3.4.0"/>
+  <def name="StateDehumidifying"  value="1.3.6.1.4.1.476.1.42.3.4.3.5.0"/>
+  <def name="StateEconoCycle"     value="1.3.6.1.4.1.476.1.42.3.4.3.6.0"/>
+  <def name="lgpEnvStateCoolingCapacity"
+                                  value="1.3.6.1.4.1.476.1.42.3.4.3.9.0"/>
+  <def name="lgpEnvStateHeatingCapacity" 
+                                  value="1.3.6.1.4.1.476.1.42.3.4.3.10.0"/>
+
+  <!-- Statistics -->
+  <def name="StatsComp1RunHr"     value="1.3.6.1.4.1.476.1.42.3.4.6.1.0"/>
+  <def name="StatsComp2RunHr"     value="1.3.6.1.4.1.476.1.42.3.4.6.2.0"/>
+  <def name="StatsFanRunHr"       value="1.3.6.1.4.1.476.1.42.3.4.6.3.0"/>
+  <def name="StatsHumRunHr"       value="1.3.6.1.4.1.476.1.42.3.4.6.4.0"/>
+  <def name="StatsReheat1RunHr"   value="1.3.6.1.4.1.476.1.42.3.4.6.7.0"/>
+  <def name="StatsReheat2RunHr"   value="1.3.6.1.4.1.476.1.42.3.4.6.8.0"/>
+  <def name="StatsReheat3RunHr"   value="1.3.6.1.4.1.476.1.42.3.4.6.9.0"/>
+
+</definitions>
+<datasources>
+
+  <template name="temperature-subtree">
+    <param name="comment"         value="Temperature in degrees %temp-scale%"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+    <leaf name="Setting">
+      <param name="precedence"        value="999"/>
+      <param name="comment"           value="Current temperature setting"/>
+      <param name="graph-legend"      value="Setting"/>
+      <param name="graph-title"       value="Temperature setting"/>
+      <param name="graph-lower-limit" value="%temp-lower%"/>
+      <param name="graph-upper-limit" value="%temp-upper"/>
+      <param name="rrd-ds"            value="tempSetting"/>
+      <param name="snmp-object"       value="$TempSetting"/>
+    </leaf>
+    <leaf name="Tolerance">
+      <param name="precedence"      value="998"/>
+      <param name="comment"         value="Acceptable variance from setting"/>
+      <param name="graph-legend"    value="Tolerance"/>
+      <param name="graph-title"     value="Temperature tolerance"/>
+      <param name="collector-scale" value="0.1,*"/>
+      <param name="rrd-ds"          value="tempTolerance"/>
+      <param name="snmp-object"     value="$TempTolerance"/>
+    </leaf>
+  </template>
+
+  <template name="temperature-sensor">
+    <param name="data-file"    value="%system-id%_sensor_%tmp-idx%.rrd"/>
+
+    <leaf name="Overview">
+      <param name="precedence"        value="1000"/>
+      <param name="comment"           value="Overview of temperatures"/>
+      <param name="graph-title"       value="Ambient Temperature"/>
+      <param name="ds-type"           value="rrd-multigraph"/>
+      <param name="ds-names"          value="meas,high,low"/>
+      <param name="graph-lower-limit" value="0"/>
+      <!-- measurements -->
+      <param name="ds-expr-meas"      value="{Measurement}"/>
+      <param name="graph-legend-meas" value="Current temperature"/>
+      <param name="line-style-meas"   value="LINE2"/>
+      <param name="line-color-meas"   value="##one"/>
+      <param name="line-order-meas"   value="1"/>
+      <!-- high threshold -->
+      <param name="ds-expr-high"      value="{High_Threshold}"/>
+      <param name="graph-legend-high" value="High threshold marker"/>
+      <param name="line-style-high"   value="LINE2"/>
+      <param name="line-color-high"   value="##two"/>
+      <param name="line-order-high"   value="2"/>
+      <!-- low threshold -->
+      <param name="ds-expr-low"       value="{Low_Threshold}"/>
+      <param name="graph-legend-low"  value="Low threshold marker"/>
+      <param name="line-style-low"    value="LINE2"/>
+      <param name="line-color-low"    value="##three"/>
+      <param name="line-order-low"    value="3"/>
+    </leaf>
+
+    <leaf name="Measurement">
+      <param name="precedence"        value="999"/>
+      <param name="comment"           value="Current ambient temperature"/>
+      <param name="graph-legend"      value="Sensor: %temp-idx%"/>
+      <param name="graph-lower-limit" value="15"/>
+      <param name="graph-upper-limit" value="70"/>
+      <param name="vertical-label"    value="degrees Celsius"/>
+      <param name="rrd-ds"            value="sensor_%temp-idx%"/>
+      <param name="snmp-object"       value="$TempMeasurement"/>
+    </leaf>
+
+    <leaf name="High_Threshold">
+      <param name="precedence"        value="998"/>
+      <param name="comment"           value="High threshold marker"/>
+      <param name="graph-legend"      value="Sensor: %temp-idx%"/>
+      <param name="vertical-label"    value="degrees Celcius"/>
+      <param name="rrd-ds"            value="TempHighThresh"/>
+      <param name="snmp-object"       value="$TempHighThresh"/>
+    </leaf>
+
+    <leaf name="Low_Threshold">
+      <param name="precedence"        value="997"/>
+      <param name="comment"           value="Low threshold marker"/>
+      <param name="graph-legend"      value="Sensor: %temp-idx%"/>
+      <param name="vertical-label"    value="degrees Celcius"/>
+      <param name="rrd-ds"            value="TempLowThresh"/>
+      <param name="snmp-object"       value="$TempLowThresh"/>
+    </leaf>
+  </template>
+
+  <!-- Temperature measured in degrees Fahrenheit -->
+  <template name="temperature-sensor-fahrenheit">
+    <param name="data-file" 
+          value="%system-id%_sensor_%tmp-idx%_fahrenheit.rrd"/>
+
+    <leaf name="Overview">
+      <param name="precedence"        value="1000"/>
+      <param name="comment"           value="Overview of temperatures"/>
+      <param name="graph-title"       value="Ambient Temperature"/>
+      <param name="ds-type"           value="rrd-multigraph"/>
+      <param name="ds-names"          value="meas,high,low"/>
+      <param name="graph-lower-limit" value="0"/>
+      <!-- measurements -->
+      <param name="ds-expr-meas"      value="{Measurement}"/>
+      <param name="graph-legend-meas" value="Current temperature"/>
+      <param name="line-style-meas"   value="LINE2"/>
+      <param name="line-color-meas"   value="##one"/>
+      <param name="line-order-meas"   value="1"/>
+      <!-- high threshold -->
+      <param name="ds-expr-high"      value="{High_Threshold}"/>
+      <param name="graph-legend-high" value="High threshold marker"/>
+      <param name="line-style-high"   value="LINE2"/>
+      <param name="line-color-high"   value="##two"/>
+      <param name="line-order-high"   value="2"/>
+      <!-- low threshold -->
+      <param name="ds-expr-low"       value="{Low_Threshold}"/>
+      <param name="graph-legend-low"  value="Low threshold marker"/>
+      <param name="line-style-low"    value="LINE2"/>
+      <param name="line-color-low"    value="##three"/>
+      <param name="line-order-low"    value="3"/>
+    </leaf>
+
+    <leaf name="Measurement">
+      <param name="precedence"        value="999"/>
+      <param name="comment"           value="Current ambient temperature"/>
+      <param name="graph-legend"      value="Sensor: %temp-idx%"/>
+      <param name="graph-lower-limit" value="15"/>
+      <param name="graph-upper-limit" value="70"/>
+      <param name="vertical-label"    value="degrees Celsius"/>
+      <param name="collector-scale"   value="1.8,*,32,+" />
+      <param name="rrd-ds"            value="sensor_%temp-idx%"/>
+      <param name="snmp-object"       value="$TempMeasurement"/>
+    </leaf>
+
+    <leaf name="High_Threshold">
+      <param name="precedence"        value="998"/>
+      <param name="comment"           value="High threshold marker"/>
+      <param name="graph-legend"      value="Sensor: %temp-idx%"/>
+      <param name="vertical-label"    value="degrees Fahrenheit"/>
+      <param name="collector-scale"   value="1.8,*,32,+" />
+      <param name="rrd-ds"            value="TempHighThresh"/>
+      <param name="snmp-object"       value="$TempHighThresh"/>
+    </leaf>
+
+    <leaf name="Low_Threshold">
+      <param name="precedence"        value="997"/>
+      <param name="comment"           value="Low threshold marker"/>
+      <param name="graph-legend"      value="Sensor: %temp-idx%"/>
+      <param name="vertical-label"    value="degrees Fahrenheit"/>
+      <param name="collector-scale"   value="1.8,*,32,+" />
+      <param name="rrd-ds"            value="TempLowThresh"/>
+      <param name="snmp-object"       value="$TempLowThresh"/>
+    </leaf>
+  </template>
+
+  <!-- HUMIDITY -->
+  <template name="humidity-subtree">
+    <param name="comment"           value="Environmental Humidity Group"/>
+    <param name="data-file"         value="%system-id%_humidity.rrd"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+    <leaf name="Setting">
+      <param name="precedence"      value="999"/>
+      <param name="comment"         value="Current Realitive Humidity setting"/>
+      <param name="graph-legend"    value="Setting"/>
+      <param name="graph-title"     value="Humidity setting"/>
+      <param name="vertical-label"  value="percent"/>
+      <param name="rrd-ds"          value="humidSetting"/>
+      <param name="snmp-object"     value="$HumiditySettingRel"/>
+    </leaf>
+    <leaf name="Tolerance">
+      <param name="precedence"      value="998"/>
+      <param name="comment"         value="Acceptable variance from setting"/>
+      <param name="graph-legend"    value="Tolerance"/>
+      <param name="graph-title"     value="Temperature tolerance"/>
+      <param name="vertical-label"  value="percent"/>
+      <param name="rrd-ds"          value="humidTolerance"/>
+      <param name="snmp-object"     value="$HumidityToleranceRel"/>
+    </leaf>
+  </template>
+
+
+  <template name="humidity-sensor">
+    <param name="data-file"    value="%system-id%_sensor_%humid-idx%.rrd"/>
+
+    <leaf name="Overview">
+      <param name="precedence"        value="1000"/>
+      <param name="comment"           value="Overview of humidity"/>
+      <param name="graph-title"       value="Humidity"/>
+      <param name="vertical-label"    value="percent"/>
+      <param name="ds-type"           value="rrd-multigraph"/>
+      <param name="ds-names"          value="meas,high,low"/>
+      <param name="graph-lower-limit" value="0"/>
+      <!-- measurements -->
+      <param name="ds-expr-meas"      value="{Measurement}"/>
+      <param name="graph-legend-meas" value="Measured Humidity"/>
+      <param name="line-style-meas"   value="LINE2"/>
+      <param name="line-color-meas"   value="##one"/>
+      <param name="line-order-meas"   value="1"/>
+      <!-- high threshold -->
+      <param name="ds-expr-high"      value="{High_Threshold}"/>
+      <param name="graph-legend-high" value="High threshold marker"/>
+      <param name="line-style-high"   value="LINE2"/>
+      <param name="line-color-high"   value="##two"/>
+      <param name="line-order-high"   value="2"/>
+      <!-- low threshold -->
+      <param name="ds-expr-low"       value="{Low_Threshold}"/>
+      <param name="graph-legend-low"  value="Low threshold marker"/>
+      <param name="line-style-low"    value="LINE2"/>
+      <param name="line-color-low"    value="##three"/>
+      <param name="line-order-low"    value="3"/>
+    </leaf>
+
+    <leaf name="Measurement">
+      <param name="precedence"        value="999"/>
+      <param name="comment"           value="Current Realitive Humidity"/>
+      <param name="graph-legend"      value="Sensor: %humid-idx%"/>
+      <param name="vertical-label"    value="percent"/>
+      <param name="rrd-ds"            value="sensor_%humid-idx%"/>
+      <param name="snmp-object"       value="$HumidityMeasurementRel"/>
+    </leaf>
+
+    <leaf name="High_Threshold">
+      <param name="precedence"        value="998"/>
+      <param name="comment"           value="High threshold marker"/>
+      <param name="graph-legend"      value="Sensor: %humid-idx%"/>
+      <param name="vertical-label"    value="percent"/>
+      <param name="rrd-ds"            value="HumidHighThresh"/>
+      <param name="snmp-object"       value="$HumidityHighThresholdRel"/>
+    </leaf>
+
+    <leaf name="Low_Threshold">
+      <param name="precedence"        value="997"/>
+      <param name="comment"           value="Low threshold marker"/>
+      <param name="graph-legend"      value="Sensor: %humid-idx%"/>
+      <param name="vertical-label"    value="percent"/>
+      <param name="rrd-ds"            value="HumidLowThresh"/>
+      <param name="snmp-object"       value="$HumidityLowThresholdRel"/>
+    </leaf>
+  </template>
+
+
+  <template name="state-subtree">
+    <param name="comment"         value="Environmental State Group"/>
+    <param name="data-file"       value="%system-id%_state.rrd"/>
+    <param name="rrd-create-dstype" value="GAUGE"/>
+
+    <leaf name="System">
+      <param name="precedence"   value="999"/>
+      <param name="comment"      value="State of the system"/>
+      <param name="graph-legend" value="state: on(1) off(2) standby(3)"/>
+      <param name="graph-title"  value="System State"/>
+      <param name="rrd-ds"       value="StateSystem"/>
+      <param name="snmp-object"  value="$StateSystem"/>
+    </leaf>
+    <leaf name="Cooling">
+      <param name="precedence"   value="998"/>
+      <param name="comment"      value="State of the cooling subsystem"/>
+      <param name="graph-legend" value="state: on(1) off(2)"/>
+      <param name="graph-title"  value="Cooling State"/>
+      <param name="rrd-ds"       value="StateCooling"/>
+      <param name="snmp-object"  value="$StateCooling"/>
+    </leaf>
+    <leaf name="Heating">
+      <param name="precedence"   value="997"/>
+      <param name="comment"      value="State of the heating subsystem"/>
+      <param name="graph-legend" value="state: on(1) off(2)"/>
+      <param name="graph-title"  value="Heating State"/>
+      <param name="rrd-ds"       value="StateHeating"/>
+      <param name="snmp-object"  value="$StateHeating"/>
+    </leaf>
+    <leaf name="Humidifying">
+      <param name="precedence"   value="996"/>
+      <param name="comment"      value="State of the humidifier subsystem"/>
+      <param name="graph-legend" value="state: on(1) off(2)"/>
+      <param name="graph-title"  value="Humidifier State"/>
+      <param name="rrd-ds"       value="StateHumidifying"/>
+      <param name="snmp-object"  value="$StateHumidifying"/>
+    </leaf>
+    <leaf name="Dehumidifying">
+      <param name="precedence"   value="995"/>
+      <param name="comment"      value="State of the dehumidifier subsystem"/>
+      <param name="graph-legend" value="state: on(1) off(2)"/>
+      <param name="graph-title"  value="Dehumidifier State"/>
+      <param name="rrd-ds"       value="StateDehumidifying"/>
+      <param name="snmp-object"  value="$StateDehumidifying"/>
+    </leaf>
+    <leaf name="Econo_Cycle">
+      <param name="precedence"   value="994"/>
+      <param name="comment"      value="State of the Econ-o-cycle subsystem"/>
+      <param name="graph-legend" value="state: on(1) off(2)"/>
+      <param name="graph-title"  value="Econ-o-cycle State"/>
+      <param name="rrd-ds"       value="StateEconoCycle"/>
+      <param name="snmp-object"  value="$StateEconoCycle"/>
+    </leaf>
+  </template>
+
+
+  <template name="state-capacity">
+    <leaf name="Cooling">
+      <param name="data-file"    value="%system-id%_state_capacity.rrd"/>
+      <param name="precedence"   value="993"/>
+      <param name="comment"      value="cooling capacity presently in use"/>
+      <param name="graph-legend" value="percent"/>
+      <param name="graph-title"  value="Cooling Capacity"/>
+      <param name="rrd-ds"       value="cooling"/>
+      <param name="snmp-object"  value="$lgpEnvStateCoolingCapacity"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+    </leaf>
+    <leaf name="Heating">
+      <param name="data-file"    value="%system-id%_state_capacity.rrd"/>
+      <param name="precedence"   value="992"/>
+      <param name="comment"      value="heating capacity presently in use"/>
+      <param name="graph-legend" value="percent"/>
+      <param name="graph-title"  value="Heating Capacity"/>
+      <param name="rrd-ds"       value="heating"/>
+      <param name="snmp-object"  value="$lgpEnvStateHeatingCapacity"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+    </leaf>
+  </template>
+
+</datasources>
+
+</configuration>
+
diff --git a/torrus/xmlconfig/vendor/microsoft.windows.xml b/torrus/xmlconfig/vendor/microsoft.windows.xml
new file mode 100644 (file)
index 0000000..6af0fb4
--- /dev/null
@@ -0,0 +1,470 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2004  Shawn Ferry
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: microsoft.windows.xml,v 1.1 2010-12-27 00:04:24 ivan Exp $
+
+  Microsoft IIS (FTP and HTTP) statistics
+  http://www.microsoft.com/technet/prodtechnol/winntas/reskit/net/sur_mib.asp
+
+-->
+
+<configuration>
+<definitions>
+    <!-- IIS FTP service -->
+    <def name="msFtptotalBytesSentLowWord"
+                                value="1.3.6.1.4.1.311.1.7.2.1.2.0"/>
+    <def name="msFtptotalBytesReceivedLowWord"
+                                value="1.3.6.1.4.1.311.1.7.2.1.4.0"/>
+    <def name="msFtptotalFilesSent"
+                                value="1.3.6.1.4.1.311.1.7.2.1.5.0"/>
+    <def name="msFtptotalFilesReceived"
+                                value="1.3.6.1.4.1.311.1.7.2.1.6.0"/>
+    <def name="msFtpcurrentAnonymousUsers"
+                                value="1.3.6.1.4.1.311.1.7.2.1.7.0"/>
+    <def name="msFtpcurrentNonAnonymousUsers"
+                                value="1.3.6.1.4.1.311.1.7.2.1.8.0"/>
+    <def name="msFtptotalAnonymousUsers"
+                                value="1.3.6.1.4.1.311.1.7.2.1.9.0"/>
+    <def name="msFtptotalNonAnonymousUsers"
+                                value="1.3.6.1.4.1.311.1.7.2.1.10.0"/>
+    <def name="msFtpcurrentConnections"
+                                value="1.3.6.1.4.1.311.1.7.2.1.13.0"/>
+    <def name="msFtpconnectionAttempts"
+                                value="1.3.6.1.4.1.311.1.7.2.1.15.0"/>
+    <def name="msFtplogonAttempts"
+                                value="1.3.6.1.4.1.311.1.7.2.1.16.0"/>
+
+    <!-- IIS HTTP service -->
+    <def name="msHttptotalBytesSentLowWord"
+                                value="1.3.6.1.4.1.311.1.7.3.1.2.0"/>
+    <def name="msHttptotalBytesReceivedLowWord"
+                                value="1.3.6.1.4.1.311.1.7.3.1.4.0"/>
+    <def name="msHttptotalFilesSent"
+                                value="1.3.6.1.4.1.311.1.7.3.1.5.0"/>
+    <def name="msHttptotalFilesReceived"
+                                value="1.3.6.1.4.1.311.1.7.3.1.6.0"/>
+    <def name="msHttpcurrentAnonymousUsers"
+                                value="1.3.6.1.4.1.311.1.7.3.1.7.0"/>
+    <def name="msHttpcurrentNonAnonymousUsers"
+                                value="1.3.6.1.4.1.311.1.7.3.1.8.0"/>
+    <def name="msHttptotalAnonymousUsers"
+                                value="1.3.6.1.4.1.311.1.7.3.1.9.0"/>
+    <def name="msHttptotalNonAnonymousUsers"
+                                value="1.3.6.1.4.1.311.1.7.3.1.10.0"/>
+    <def name="msHttpcurrentConnections"
+                                value="1.3.6.1.4.1.311.1.7.3.1.13.0"/>
+    <def name="msHttpconnectionAttempts"
+                                value="1.3.6.1.4.1.311.1.7.3.1.15.0"/>
+    <def name="msHttplogonAttempts"
+                                value="1.3.6.1.4.1.311.1.7.3.1.16.0"/>
+    <def name="msHttptotalOptions"      value="1.3.6.1.4.1.311.1.7.3.1.17.0"/>
+    <def name="msHttptotalGets"         value="1.3.6.1.4.1.311.1.7.3.1.18.0"/>
+    <def name="msHttptotalPosts"        value="1.3.6.1.4.1.311.1.7.3.1.19.0"/>
+    <def name="msHttptotalHeads"        value="1.3.6.1.4.1.311.1.7.3.1.20.0"/>
+    <def name="msHttptotalPuts"         value="1.3.6.1.4.1.311.1.7.3.1.21.0"/>
+    <def name="msHttptotalDeletes"      value="1.3.6.1.4.1.311.1.7.3.1.22.0"/>
+    <def name="msHttptotalTraces"       value="1.3.6.1.4.1.311.1.7.3.1.23.0"/>
+    <def name="msHttptotalMove"         value="1.3.6.1.4.1.311.1.7.3.1.24.0"/>
+    <def name="msHttptotalCopy"         value="1.3.6.1.4.1.311.1.7.3.1.25.0"/>
+    <def name="msHttptotalMkcol"        value="1.3.6.1.4.1.311.1.7.3.1.26.0"/>
+    <def name="msHttptotalPropfind"     value="1.3.6.1.4.1.311.1.7.3.1.27.0"/>
+    <def name="msHttptotalProppatch"    value="1.3.6.1.4.1.311.1.7.3.1.28.0"/>
+    <def name="msHttptotalSearch"       value="1.3.6.1.4.1.311.1.7.3.1.29.0"/>
+    <def name="msHttptotalLock"         value="1.3.6.1.4.1.311.1.7.3.1.30.0"/>
+    <def name="msHttptotalUnlock"       value="1.3.6.1.4.1.311.1.7.3.1.31.0"/>
+    <def name="msHttptotalOthers"       value="1.3.6.1.4.1.311.1.7.3.1.32.0"/>
+    <def name="msHttpcurrentCGIRequests"
+                                        value="1.3.6.1.4.1.311.1.7.3.1.33.0"/>
+    <def name="msHttpcurrentBGIRequests"
+                                        value="1.3.6.1.4.1.311.1.7.3.1.34.0"/>
+    <def name="msHttptotalCGIRequests"  value="1.3.6.1.4.1.311.1.7.3.1.35.0"/>
+    <def name="msHttptotalBGIRequests"  value="1.3.6.1.4.1.311.1.7.3.1.36.0"/>
+    <def name="msHttpcurrentBlockedRequests"
+                                        value="1.3.6.1.4.1.311.1.7.3.1.39.0"/>
+    <def name="msHttptotalBlockedRequests"
+                                        value="1.3.6.1.4.1.311.1.7.3.1.40.0"/>
+    <def name="msHttptotalAllowedRequests"
+                                        value="1.3.6.1.4.1.311.1.7.3.1.41.0"/>
+    <def name="msHttptotalRejectedRequests"
+                                        value="1.3.6.1.4.1.311.1.7.3.1.42.0"/>
+    <def name="msHttptotalNotFoundErrors"
+                                        value="1.3.6.1.4.1.311.1.7.3.1.43.0"/>
+    <def name="msHttptotalLockedErrors" value="1.3.6.1.4.1.311.1.7.3.1.44.0"/>
+    <def name="msHttpmeasuredBandwidth" value="1.3.6.1.4.1.311.1.7.3.1.45.0"/>
+
+</definitions>
+
+<datasources>
+    <template name="microsoft-iis-ftp-stats">
+      <subtree name="FTP">
+
+        <param name="data-file" value="%system-id%_msftp.rrd"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="descriptive-nickname" value="%system-id% MSFTP"/>
+        <param name="graph-title" value="%descriptive-nickname%" />
+
+        <leaf name="Bytes_Sent">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="bytes_sent_low"/>
+            <param name="snmp-object" value="$msFtptotalBytesSentLowWord"/>
+            <param name="vertical-label" value="Bps"/>
+            <param name="graph-legend" value="Bytes Sent"/>
+            <param name="comment" value="Bytes Sent"/>
+        </leaf>
+        <leaf name="Bytes_Received">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="bytes_received_low"/>
+            <param name="snmp-object" value="$msFtptotalBytesReceivedLowWord"/>
+            <param name="vertical-label" value="Bps"/>
+            <param name="graph-legend" value="Bytes Received"/>
+            <param name="comment" value="Bytes Received"/>
+        </leaf>
+        <leaf name="Current_Anon_Users">
+            <!-- mib says counter -->
+            <param name="rrd-create-dstype" value="GAUGE"/>
+            <param name="rrd-ds" value="curr_anon_users"/>
+            <param name="snmp-object" value="$msFtpcurrentAnonymousUsers"/>
+            <param name="vertical-label" value="Users"/>
+            <param name="graph-legend" value="Anon Users"/>
+            <param name="comment" value="Current Anon Users"/>
+        </leaf>
+        <leaf name="Current_Known_Users">
+            <!-- mib says counter -->
+            <param name="rrd-create-dstype" value="GAUGE"/>
+            <param name="rrd-ds" value="curr_known_users"/>
+            <param name="snmp-object" value="$msFtpcurrentNonAnonymousUsers"/>
+            <param name="vertical-label" value="Users"/>
+            <param name="graph-legend" value="Known Users"/>
+            <param name="comment" value="Current Known Users"/>
+        </leaf>
+        <leaf name="Anon_Users">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="total_anon_users"/>
+            <param name="snmp-object" value="$msFtptotalAnonymousUsers"/>
+            <param name="vertical-label" value="Users/s"/>
+            <param name="graph-legend" value="Anon Users"/>
+            <param name="comment" value="Anon Users/s"/>
+        </leaf>
+        <leaf name="Known_Users">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="total_known_users"/>
+            <param name="snmp-object" value="$msFtptotalNonAnonymousUsers"/>
+            <param name="vertical-label" value="Users/s"/>
+            <param name="graph-legend" value="Known Users"/>
+            <param name="comment" value="Known Users/s"/>
+        </leaf>
+        <leaf name="Current_Connections">
+            <param name="rrd-create-dstype" value="GAUGE"/>
+            <param name="rrd-ds" value="current_connections"/>
+            <param name="snmp-object" value="$msFtpcurrentConnections"/>
+            <param name="vertical-label" value="Connections"/>
+            <param name="graph-legend" value="Connections"/>
+            <param name="comment" value="Current Connections"/>
+        </leaf>
+        <leaf name="Attempted_Connection">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="connection_attempts"/>
+            <param name="snmp-object" value="$msFtpconnectionAttempts"/>
+            <param name="vertical-label" value="Connections/s"/>
+            <param name="graph-legend" value="Connection Attempts"/>
+            <param name="comment" value="Connection Rate"/>
+        </leaf>
+        <leaf name="Attempted_Logons">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="logon_attempts"/>
+            <param name="snmp-object" value="$msFtplogonAttempts"/>
+            <param name="vertical-label" value="Connections/s"/>
+            <param name="graph-legend" value="Logon Attempts"/>
+            <param name="comment" value="Logon Rate"/>
+        </leaf>
+      </subtree>
+    </template>
+
+    <template name="microsoft-iis-http-requests">
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="rrd-ds" value="req_%iis-req-type%"/>
+      <param name="vertical-label" value="req/s"/>
+      <param name="graph-legend" value="%iis-req-type% Requests"/>
+      <param name="comment" value="%iis-req-type% Requests Rate"/>
+    </template>
+
+    <template name="microsoft-iis-http-stats">
+      <subtree name="HTTP">
+
+        <param name="data-file" value="%system-id%_msftp.rrd"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="descriptive-nickname" value="%system-id% MSHTTP"/>
+        <param name="graph-title" value="%descriptive-nickname%" />
+
+        <leaf name="Bytes_Sent">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="bytes_sent_low"/>
+            <param name="snmp-object" value="$msHttptotalBytesSentLowWord"/>
+            <param name="vertical-label" value="Bps"/>
+            <param name="graph-legend" value="Bytes Sent"/>
+            <param name="comment" value="Bytes Sent"/>
+        </leaf>
+        <leaf name="Bytes_Received">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="bytes_received_low"/>
+            <param name="snmp-object"
+                   value="$msHttptotalBytesReceivedLowWord"/>
+            <param name="vertical-label" value="Bps"/>
+            <param name="graph-legend" value="Bytes Received"/>
+            <param name="comment" value="Bytes Received"/>
+        </leaf>
+        <leaf name="Files_Sent">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="files_sent"/>
+            <param name="snmp-object" value="$msHttptotalFilesSent"/>
+            <param name="vertical-label" value="Files/s"/>
+            <param name="graph-legend" value="Files Sent"/>
+            <param name="comment" value="Files Sent"/>
+        </leaf>
+        <leaf name="Files_Received">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="files_received"/>
+            <param name="snmp-object" value="$msHttptotalFilesReceived"/>
+            <param name="vertical-label" value="Files/s"/>
+            <param name="graph-legend" value="Files Received"/>
+            <param name="comment" value="Files Received"/>
+        </leaf>
+        <leaf name="Current_Anon_Users">
+            <!-- mib says counter -->
+            <param name="rrd-create-dstype" value="GAUGE"/>
+            <param name="rrd-ds" value="curr_anon_users"/>
+            <param name="snmp-object" value="$msHttpcurrentAnonymousUsers"/>
+            <param name="vertical-label" value="Users"/>
+            <param name="graph-legend" value="Anon Users"/>
+            <param name="comment" value="Current Anon Users"/>
+        </leaf>
+        <leaf name="Current_Known_Users">
+            <!-- mib says counter -->
+            <param name="rrd-create-dstype" value="GAUGE"/>
+            <param name="rrd-ds" value="curr_known_users"/>
+            <param name="snmp-object" value="$msHttpcurrentNonAnonymousUsers"/>
+            <param name="vertical-label" value="Users"/>
+            <param name="graph-legend" value="Known Users"/>
+            <param name="comment" value="Current Known Users"/>
+        </leaf>
+        <leaf name="Anon_Users">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="total_anon_users"/>
+            <param name="snmp-object" value="$msHttptotalAnonymousUsers"/>
+            <param name="vertical-label" value="Users/s"/>
+            <param name="graph-legend" value="Anon Users"/>
+            <param name="comment" value="Anon Users/s"/>
+        </leaf>
+        <leaf name="Known_Users">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="total_known_users"/>
+            <param name="snmp-object" value="$msHttptotalNonAnonymousUsers"/>
+            <param name="vertical-label" value="Users/s"/>
+            <param name="graph-legend" value="Known Users"/>
+            <param name="comment" value="Known Users/s"/>
+        </leaf>
+        <leaf name="Current_Connections">
+            <param name="rrd-create-dstype" value="GAUGE"/>
+            <param name="rrd-ds" value="current_connections"/>
+            <param name="snmp-object" value="$msHttpcurrentConnections"/>
+            <param name="vertical-label" value="Connections"/>
+            <param name="graph-legend" value="Connections"/>
+            <param name="comment" value="Current Connections"/>
+        </leaf>
+        <leaf name="Attempted_Connection">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="connection_attempts"/>
+            <param name="snmp-object" value="$msHttpconnectionAttempts"/>
+            <param name="vertical-label" value="Connections/s"/>
+            <param name="graph-legend" value="Connection Attempts"/>
+            <param name="comment" value="Connection Rate"/>
+        </leaf>
+        <leaf name="Attempted_Logons">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="logon_attempts"/>
+            <param name="snmp-object" value="$msHttplogonAttempts"/>
+            <param name="vertical-label" value="Connections/s"/>
+            <param name="graph-legend" value="Logon Attempts"/>
+            <param name="comment" value="Logon Rate"/>
+        </leaf>
+        <leaf name="Request_OPTION">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="OPTION"/>
+            <param name="snmp-object" value="$msHttptotalOptions"/>
+        </leaf>
+        <leaf name="Request_GET">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="GET"/>
+            <param name="snmp-object" value="$msHttptotalGets"/>
+        </leaf>
+        <leaf name="Request_POST">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="POST"/>
+            <param name="snmp-object" value="$msHttptotalPosts"/>
+        </leaf>
+        <leaf name="Request_HEAD">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="HEAD"/>
+            <param name="snmp-object" value="$msHttptotalHeads"/>
+        </leaf>
+        <leaf name="Request_PUT">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="PUT"/>
+            <param name="snmp-object" value="$msHttptotalPuts"/>
+        </leaf>
+        <leaf name="Request_DELETE">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="DELETE"/>
+            <param name="snmp-object" value="$msHttptotalDeletes"/>
+        </leaf>
+        <leaf name="Request_TRACE">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="TRACE"/>
+            <param name="snmp-object" value="$msHttptotalTraces"/>
+        </leaf>
+        <leaf name="Request_MOVE">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="MOVE"/>
+            <param name="snmp-object" value="$msHttptotalMove"/>
+        </leaf>
+        <leaf name="Request_COPY">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="COPY"/>
+            <param name="snmp-object" value="$msHttptotalCopy"/>
+        </leaf>
+        <leaf name="Request_MKCOL">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="MKCOL"/>
+            <param name="snmp-object" value="$msHttptotalMkcol"/>
+        </leaf>
+        <leaf name="Request_PROPFIND">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="PROPFIND"/>
+            <param name="snmp-object" value="$msHttptotalPropfind"/>
+        </leaf>
+        <leaf name="Request_PROPPATCH">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="PROPPATCH"/>
+            <param name="snmp-object" value="$msHttptotalProppatch"/>
+        </leaf>
+        <leaf name="Request_SEARCH">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="SEARCH"/>
+            <param name="snmp-object" value="$msHttptotalSearch"/>
+        </leaf>
+        <leaf name="Request_LOCK">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="LOCK"/>
+            <param name="snmp-object" value="$msHttptotalLock"/>
+        </leaf>
+        <leaf name="Request_UNLOCK">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="UNLOCK"/>
+            <param name="snmp-object" value="$msHttptotalUnlock"/>
+        </leaf>
+        <leaf name="Request_OTHER">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="OTHER"/>
+            <param name="snmp-object" value="$msHttptotalOthers"/>
+        </leaf>
+        <leaf name="Current_CGI">
+            <param name="rrd-create-dstype" value="GAUGE"/>
+            <!-- mib say counter -->
+            <param name="rrd-ds" value="current_cgi"/>
+            <param name="snmp-object" value="$msHttpcurrentCGIRequests"/>
+            <param name="vertical-label" value="Requests"/>
+            <param name="graph-legend" value="CGI Requests"/>
+            <param name="comment" value="Current CGI Requests"/>
+        </leaf>
+        <leaf name="Current_BGI">
+            <param name="rrd-create-dstype" value="GAUGE"/>
+            <!-- mib say counter -->
+            <param name="rrd-ds" value="current_bgi"/>
+            <param name="snmp-object" value="$msHttpcurrentBGIRequests"/>
+            <param name="vertical-label" value="Requests"/>
+            <param name="graph-legend" value="BGI Requests"/>
+            <param name="comment" value="Current BGI Requests"/>
+        </leaf>
+        <leaf name="Request_CGI">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="CGI"/>
+            <param name="snmp-object" value="$msHttptotalCGIRequests"/>
+        </leaf>
+        <leaf name="Request_BGI">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="BGI"/>
+            <param name="snmp-object" value="$msHttptotalBGIRequests"/>
+        </leaf>
+        <leaf name="Throttle_Current">
+            <param name="rrd-create-dstype" value="GAUGE"/>
+            <!-- mib say counter -->
+            <param name="rrd-ds" value="throttle_blocked"/>
+            <param name="snmp-object" value="$msHttpcurrentBlockedRequests"/>
+            <param name="vertical-label" value="Connections"/>
+            <param name="graph-legend" value="Blocked Connections"/>
+            <param name="comment" value="Blocked Requests due to Throttling"/>
+        </leaf>
+        <leaf name="Throttle_Rate">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="throttle_rate"/>
+            <param name="snmp-object" value="$msHttptotalBlockedRequests"/>
+            <param name="vertical-label" value="Connections/s"/>
+            <param name="graph-legend" value="Blocked Connections"/>
+            <param name="comment" value="Throttle Rate"/>
+        </leaf>
+        <leaf name="Throttle_Allowed">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="throttle_allowed"/>
+            <param name="snmp-object" value="$msHttptotalAllowedRequests"/>
+            <param name="vertical-label" value="Connections/s"/>
+            <param name="graph-legend" value="Allowed Connections"/>
+            <param name="comment" value="Allowed Rate"/>
+        </leaf>
+        <leaf name="Throttle_Rejected">
+            <param name="rrd-create-dstype" value="COUNTER"/>
+            <param name="rrd-ds" value="throttle_rejected"/>
+            <param name="snmp-object" value="$msHttptotalRejectedRequests"/>
+            <param name="vertical-label" value="Connections/s"/>
+            <param name="graph-legend" value="Rejected Connections"/>
+            <param name="comment" value="Rejected Rate"/>
+        </leaf>
+        <leaf name="Requests_NotFound">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="NotFound"/>
+            <param name="snmp-object" value="$msHttptotalNotFoundErrors"/>
+        </leaf>
+        <leaf name="Requests_Locked">
+            <apply-template name="microsoft-iis-http-requests"/>
+            <param name="iis-req-type" value="LockedResource"/>
+            <param name="snmp-object" value="$msHttptotalLockedErrors"/>
+        </leaf>
+        <leaf name="IO_Bandwidth">
+            <param name="rrd-create-dstype" value="GAUGE"/>
+            <!-- mib says counter -->
+            <param name="rrd-ds" value="measuredbandwidth"/>
+            <param name="snmp-object" value="$msHttpmeasuredBandwidth"/>
+            <param name="vertical-label" value="bps"/>
+            <param name="graph-legend" value="IO Bandwidth"/>
+            <param name="comment" value="Measured One Minute Bandwidth"/>
+        </leaf>
+      </subtree>
+    </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/motorola.bsr.xml b/torrus/xmlconfig/vendor/motorola.bsr.xml
new file mode 100644 (file)
index 0000000..28a20bf
--- /dev/null
@@ -0,0 +1,140 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003  Roman Hochuli, Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: motorola.bsr.xml,v 1.1 2010-12-27 00:04:06 ivan Exp $
+  Stanislav Sinyagin <ssinyagin@yahoo.com>
+
+ DOCSIS interface, Motorola BSR specific
+ MIB used:
+ RDN-CMTS-MIB::rdnCmtsUpstreamChannelTable
+  
+-->
+
+<configuration>
+
+<definitions>
+  <!--  RDN-CMTS-MIB::rdnCmtsUpstreamChannelTable -->
+  <def name="rdnCmtsUSTotalModemCount"
+              value="1.3.6.1.4.1.4981.2.1.2.1.6"/>
+  <def name="rdnCmtsUSRegisteredModemCount"
+              value="1.3.6.1.4.1.4981.2.1.2.1.7"/>
+  <def name="rdnCmtsUSUnregisteredModemCount"
+              value="1.3.6.1.4.1.4981.2.1.2.1.8"/>
+  <def name="rdnCmtsUSOfflineModemCount"
+              value="1.3.6.1.4.1.4981.2.1.2.1.9"/>
+</definitions>
+
+<datasources>
+
+
+  <template name="motorola-bsr-docsis-upstream-util">
+    <leaf name="Modems">
+      <param name="ds-type"           value="rrd-multigraph" />
+      <param name="ds-names"        value="registered,unregistered,offline" />
+      <param name="nodeid"            value="%nodeid-docsif%//modems"/>
+      
+      <param name="graph-lower-limit" value="0" />
+      <param name="precedence"        value="950" />
+      <param name="comment"
+       value="Registered, Unregistered and Offline modems on the interface" />
+      <param name="vertical-label"    value="Modems" />
+
+      <param name="ds-expr-registered">{Modems_Registered}</param>
+      <param name="graph-legend-registered"  value="Registered" />
+      <param name="line-style-registered"    value="AREA" />
+      <param name="line-color-registered"    value="##blue" />
+      <param name="line-order-registered"    value="1" />
+
+      <param name="ds-expr-unregistered">{Modems_Unregistered}</param>
+      <param name="graph-legend-unregistered"  value="Unregistered" />
+      <param name="line-style-unregistered"    value="STACK" />
+      <param name="line-color-unregistered"    value="##crimson" />
+      <param name="line-order-unregistered"    value="2" />
+
+      <param name="ds-expr-offline">{Modems_Offline}</param>
+      <param name="graph-legend-offline"  value="Offline" />
+      <param name="line-style-offline"    value="STACK" />
+      <param name="line-color-offline"    value="##silver" />
+      <param name="line-order-offline"    value="3" />
+    </leaf>
+
+    <leaf name="Modems_Total">
+      <param name="snmp-object"
+                value="$rdnCmtsUSTotalModemCount.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Total" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="Total number of modems on the interface since boot"/>
+      <param name="graph-legend" value="Total modems" />
+      <param name="precedence"   value="900" />
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="vertical-label"      value="Modems" />
+      <param name="graph-lower-limit"   value="0" />
+    </leaf>
+    
+    <leaf name="Modems_Registered">
+      <param name="snmp-object"
+                value="$rdnCmtsUSRegisteredModemCount.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Registered" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="Number of registered modems on the interface"/>
+      <param name="graph-legend" value="Active modems" />
+      <param name="precedence"   value="800" />
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="vertical-label"      value="Modems" />
+      <param name="graph-lower-limit"   value="0" />
+      <param name="monitor-action-target"  value="Modems"/>
+    </leaf>
+    
+    <leaf name="Modems_Unregistered">
+      <param name="snmp-object"
+                value="$rdnCmtsUSUnregisteredModemCount.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Unregistered" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="Number of not yet registered modems on the interface"/>
+      <param name="graph-legend" value="Unregistered modems" />
+      <param name="precedence"   value="900" />
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="vertical-label"      value="Modems" />
+      <param name="graph-lower-limit"   value="0" />
+      <param name="monitor-action-target"  value="Modems"/>
+    </leaf>
+
+    <leaf name="Modems_Offline">
+      <param name="snmp-object"
+                value="$rdnCmtsUSOfflineModemCount.%ifindex-map%"/>
+      <param name="rrd-ds"       value="Offline" />
+      <param name="hidden"       value="yes"/>
+      <param name="comment"
+          value="Number of offline modems on the interface"/>
+      <param name="graph-legend" value="Unregistered modems" />
+      <param name="precedence"   value="1000" />
+      <param name="rrd-create-dstype"   value="GAUGE" />
+      <param name="vertical-label"      value="Modems" />
+      <param name="graph-lower-limit"   value="0" />
+      <param name="monitor-action-target"  value="Modems"/>
+    </leaf>
+    
+  </template>
+  
+</datasources>
+
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/netapp.filer.xml b/torrus/xmlconfig/vendor/netapp.filer.xml
new file mode 100644 (file)
index 0000000..949b00b
--- /dev/null
@@ -0,0 +1,2206 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003  Shawn Ferry
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: netapp.filer.xml,v 1.1 2010-12-27 00:04:19 ivan Exp $
+
+  NetApp Filer
+
+-->
+
+<configuration>
+<definitions>
+  <!-- sysStat                                   1.3.6.1.4.1.789.1.2 -->
+  <!--   CPU                                     1.3.6.1.4.1.789.1.2.1 -->
+  <def name="netapp_cpuUpTime"            value="1.3.6.1.4.1.789.1.2.1.1.0"/>
+  <def name="netapp_cpuBusyTime"          value="1.3.6.1.4.1.789.1.2.1.2.0"/>
+  <def name="netapp_cpuBusyTimePerCent"   value="1.3.6.1.4.1.789.1.2.1.3.0"/>
+  <def name="netapp_cpuIdleTime"          value="1.3.6.1.4.1.789.1.2.1.4.0"/>
+  <def name="netapp_cpuIdleTimePerCent"   value="1.3.6.1.4.1.789.1.2.1.5.0"/>
+  <def name="netapp_cpuSwitchInvocations" value="1.3.6.1.4.1.789.1.2.1.7.0"/>
+  <def name="netapp_cpuContextSwitches"   value="1.3.6.1.4.1.789.1.2.1.8.0"/>
+  <def name="netapp_cpuInterrupts"        value="1.3.6.1.4.1.789.1.2.1.9.0"/>
+  <def name="netapp_cpuNonCPInterrupts"   value="1.3.6.1.4.1.789.1.2.1.10.0"/>
+  <def name="netapp_cpuCPInterruptPercent"
+                                          value="1.3.6.1.4.1.789.1.2.1.11.0"/>
+  <def name="netapp_cpuNonCPInterruptPercent"
+                                          value="1.3.6.1.4.1.789.1.2.1.12.0"/>
+  <def name="netapp_cpuTotalDomainSwitches"
+                                          value="1.3.6.1.4.1.789.1.2.1.13.0"/>
+                                          
+  <!--   misc                                    1.3.6.1.4.1.789.1.2.2 -->
+  <!-- High values are being ignored, as they should not be needed to
+    calculate rate, unless the device can wrap a 32bit counter in one period
+    -->
+  <def name="netapp_miscLowNfsOps"        value="1.3.6.1.4.1.789.1.2.2.6.0"/>
+  <def name="netapp_miscLowCifsOps"       value="1.3.6.1.4.1.789.1.2.2.8.0"/>
+  <def name="netapp_miscLowHttpOps"       value="1.3.6.1.4.1.789.1.2.2.10.0"/>
+  <def name="netapp_miscLowNetRcvdBytes"  value="1.3.6.1.4.1.789.1.2.2.12.0"/>
+  <def name="netapp_miscLowNetSentBytes"  value="1.3.6.1.4.1.789.1.2.2.14.0"/>
+  <def name="netapp_miscLowDiskReadBytes" value="1.3.6.1.4.1.789.1.2.2.16.0"/>
+  <def name="netapp_miscLowDiskWriteBytes" value="1.3.6.1.4.1.789.1.2.2.18.0"/>
+  <def name="netapp_miscLowTapeReadBytes" value="1.3.6.1.4.1.789.1.2.2.20.0"/>
+  <def name="netapp_miscLowTapeWriteBytes" value="1.3.6.1.4.1.789.1.2.2.22.0"/>
+  <def name="netapp_miscCacheAge"         value="1.3.6.1.4.1.789.1.2.2.23.0"/>
+  
+  <!--   cp (consistency point)            1.3.6.1.4.1.789.1.2.6 -->
+  <!-- Not Implementing/Applying This, this will not make good rates -->
+  <!-- This needs a Delta function that does not calculate rate i.e. It would
+    be reasonable to see when these happen, but I would not expect to see them
+    frequently ehough for validity as a rate -->
+  <def name="netapp_cpTime"              value="1.3.6.1.4.1.789.1.2.6.1.0"/>
+  <def name="netapp_cpFromTimerOps"      value="1.3.6.1.4.1.789.1.2.6.2.0"/>
+  <def name="netapp_cpFromSnapshotOps"   value="1.3.6.1.4.1.789.1.2.6.3.0"/>
+  <def name="netapp_cpFromHighWaterOps"  value="1.3.6.1.4.1.789.1.2.6.4.0"/>
+  <def name="netapp_cpFromLowWaterOps"   value="1.3.6.1.4.1.789.1.2.6.5.0"/>
+  <def name="netapp_cpFromLogFullOps"    value="1.3.6.1.4.1.789.1.2.6.6.0"/>
+  <def name="netapp_cpFromCpOps"         value="1.3.6.1.4.1.789.1.2.6.7.0"/>
+  <def name="netapp_cpTotalOps"          value="1.3.6.1.4.1.789.1.2.6.8.0"/>
+  <def name="netapp_cpFromFlushOps"      value="1.3.6.1.4.1.789.1.2.6.9.0"/>
+  <def name="netapp_cpFromSyncOps"       value="1.3.6.1.4.1.789.1.2.6.10.0"/>
+  
+  <!-- NFS                                 1.3.6.1.4.1.789.1.3 -->
+  <!--   Total NFS                         1.3.6.1.4.1.789.1.3.2 -->
+  <!--     Total RPC Stats                 1.3.6.1.4.1.789.1.3.2.1 -->
+  <def name="netapp_trpcCalls"      value="1.3.6.1.4.1.789.1.3.2.1.1.0"/>
+  <def name="netapp_trpcBadCalls"   value="1.3.6.1.4.1.789.1.3.2.1.2.0"/>
+  <def name="netapp_trpcNullRecvs"  value="1.3.6.1.4.1.789.1.3.2.1.3.0"/>
+  <def name="netapp_trpcBadLens"    value="1.3.6.1.4.1.789.1.3.2.1.4.0"/>
+  <def name="netapp_trpcServXDRCalls"   value="1.3.6.1.4.1.789.1.3.2.1.5.0"/>
+  
+  <!--     Total NFS Stats                 1.3.6.1.4.1.789.1.3.2.2  -->
+  <def name="netapp_tnfsCalls"      value="1.3.6.1.4.1.789.1.3.2.2.1.0"/>
+  <def name="netapp_tnfsServBadCalls" value="1.3.6.1.4.1.789.1.3.2.2.2.0"/>
+  
+  <!--     Total NFS v2                    1.3.6.1.4.1.789.1.3.2.2.3 -->
+  <!--       Total NFS v2 tv2Calls         1.3.6.1.4.1.789.1.3.2.2.3.1 -->
+  <def name="netapp_tv2cNulls"    value="1.3.6.1.4.1.789.1.3.2.2.3.1.1.0"/>
+  <def name="netapp_tv2cGetattrs" value="1.3.6.1.4.1.789.1.3.2.2.3.1.2.0"/>
+  <def name="netapp_tv2cSetattrs" value="1.3.6.1.4.1.789.1.3.2.2.3.1.3.0"/>
+  <def name="netapp_tv2cRoots"    value="1.3.6.1.4.1.789.1.3.2.2.3.1.4.0"/>
+  <def name="netapp_tv2cLookups"  value="1.3.6.1.4.1.789.1.3.2.2.3.1.5.0"/>
+  <def name="netapp_tv2cReadlinks"  value="1.3.6.1.4.1.789.1.3.2.2.3.1.6.0"/>
+  <def name="netapp_tv2cReads"    value="1.3.6.1.4.1.789.1.3.2.2.3.1.7.0"/>
+  <def name="netapp_tv2cWrcaches" value="1.3.6.1.4.1.789.1.3.2.2.3.1.8.0"/>
+  <def name="netapp_tv2cWrites"   value="1.3.6.1.4.1.789.1.3.2.2.3.1.9.0"/>
+  <def name="netapp_tv2cCreates"  value="1.3.6.1.4.1.789.1.3.2.2.3.1.10.0"/>
+  <def name="netapp_tv2cRemoves"  value="1.3.6.1.4.1.789.1.3.2.2.3.1.11.0"/>
+  <def name="netapp_tv2cRenames"  value="1.3.6.1.4.1.789.1.3.2.2.3.1.12.0"/>
+  <def name="netapp_tv2cLinks"    value="1.3.6.1.4.1.789.1.3.2.2.3.1.13.0"/>
+  <def name="netapp_tv2cSymlinks" value="1.3.6.1.4.1.789.1.3.2.2.3.1.14.0"/>
+  <def name="netapp_tv2cMkdirs"   value="1.3.6.1.4.1.789.1.3.2.2.3.1.15.0"/>
+  <def name="netapp_tv2cRmdirs"   value="1.3.6.1.4.1.789.1.3.2.2.3.1.16.0"/>
+  <def name="netapp_tv2cReaddirs" value="1.3.6.1.4.1.789.1.3.2.2.3.1.17.0"/>
+  <def name="netapp_tv2cStatfss"  value="1.3.6.1.4.1.789.1.3.2.2.3.1.18.0"/>
+  
+  <!-- Total NFS v2 tv2Percent           1.3.6.1.4.1.789.1.3.2.2.3.2 -->
+  <def name="netapp_tv2pNulls"    value="1.3.6.1.4.1.789.1.3.2.2.3.2.1.0"/>
+  <def name="netapp_tv2pGetattrs" value="1.3.6.1.4.1.789.1.3.2.2.3.2.2.0"/>
+  <def name="netapp_tv2pSetattrs" value="1.3.6.1.4.1.789.1.3.2.2.3.2.3.0"/>
+  <def name="netapp_tv2pRoots"    value="1.3.6.1.4.1.789.1.3.2.2.3.2.4.0"/>
+  <def name="netapp_tv2pLookups"  value="1.3.6.1.4.1.789.1.3.2.2.3.2.5.0"/>
+  <def name="netapp_tv2pReadlinks"  value="1.3.6.1.4.1.789.1.3.2.2.3.2.6.0"/>
+  <def name="netapp_tv2pReads"    value="1.3.6.1.4.1.789.1.3.2.2.3.2.7.0"/>
+  <def name="netapp_tv2pWrcaches" value="1.3.6.1.4.1.789.1.3.2.2.3.2.8.0"/>
+  <def name="netapp_tv2pWrites"   value="1.3.6.1.4.1.789.1.3.2.2.3.2.9.0"/>
+  <def name="netapp_tv2pCreates"  value="1.3.6.1.4.1.789.1.3.2.2.3.2.10.0"/>
+  <def name="netapp_tv2pRemoves"  value="1.3.6.1.4.1.789.1.3.2.2.3.2.11.0"/>
+  <def name="netapp_tv2pRenames"  value="1.3.6.1.4.1.789.1.3.2.2.3.2.12.0"/>
+  <def name="netapp_tv2pLinks"    value="1.3.6.1.4.1.789.1.3.2.2.3.2.13.0"/>
+  <def name="netapp_tv2pSymlinks" value="1.3.6.1.4.1.789.1.3.2.2.3.2.14.0"/>
+  <def name="netapp_tv2pMkdirs"   value="1.3.6.1.4.1.789.1.3.2.2.3.2.15.0"/>
+  <def name="netapp_tv2pRmdirs"   value="1.3.6.1.4.1.789.1.3.2.2.3.2.16.0"/>
+  <def name="netapp_tv2pReaddirs" value="1.3.6.1.4.1.789.1.3.2.2.3.2.17.0"/>
+  <def name="netapp_tv2pStatfss"  value="1.3.6.1.4.1.789.1.3.2.2.3.2.18.0"/>
+
+  <!-- Total NFS v2 Cached Calls         1.3.6.1.4.1.789.1.3.2.2.3.3 -->
+  <def name="netapp_tv2ccNulls"   value="1.3.6.1.4.1.789.1.3.2.2.3.3.1.0"/>
+  <def name="netapp_tv2ccGetattrs"  value="1.3.6.1.4.1.789.1.3.2.2.3.3.2.0"/>
+  <def name="netapp_tv2ccSetattrs"  value="1.3.6.1.4.1.789.1.3.2.2.3.3.3.0"/>
+  <def name="netapp_tv2ccRoots"   value="1.3.6.1.4.1.789.1.3.2.2.3.3.4.0"/>
+  <def name="netapp_tv2ccLookups" value="1.3.6.1.4.1.789.1.3.2.2.3.3.5.0"/>
+  <def name="netapp_tv2ccReadlinks" value="1.3.6.1.4.1.789.1.3.2.2.3.3.6.0"/>
+  <def name="netapp_tv2ccReads"   value="1.3.6.1.4.1.789.1.3.2.2.3.3.7.0"/>
+  <def name="netapp_tv2ccWrcaches"  value="1.3.6.1.4.1.789.1.3.2.2.3.3.8.0"/>
+  <def name="netapp_tv2ccWrites"  value="1.3.6.1.4.1.789.1.3.2.2.3.3.9.0"/>
+  <def name="netapp_tv2ccCreates" value="1.3.6.1.4.1.789.1.3.2.2.3.3.10.0"/>
+  <def name="netapp_tv2ccRemoves" value="1.3.6.1.4.1.789.1.3.2.2.3.3.11.0"/>
+  <def name="netapp_tv2ccRenames" value="1.3.6.1.4.1.789.1.3.2.2.3.3.12.0"/>
+  <def name="netapp_tv2ccLinks"   value="1.3.6.1.4.1.789.1.3.2.2.3.3.13.0"/>
+  <def name="netapp_tv2ccSymlinks"  value="1.3.6.1.4.1.789.1.3.2.2.3.3.14.0"/>
+  <def name="netapp_tv2ccMkdirs"  value="1.3.6.1.4.1.789.1.3.2.2.3.3.15.0"/>
+  <def name="netapp_tv2ccRmdirs"  value="1.3.6.1.4.1.789.1.3.2.2.3.3.16.0"/>
+  <def name="netapp_tv2ccReaddirs"  value="1.3.6.1.4.1.789.1.3.2.2.3.3.17.0"/>
+  <def name="netapp_tv2ccStatfss" value="1.3.6.1.4.1.789.1.3.2.2.3.3.18.0"/>
+
+  <!-- Total NFS v2 Cached Pct           1.3.6.1.4.1.789.1.3.2.2.3.4 -->
+  <def name="netapp_tv2cpNulls"   value="1.3.6.1.4.1.789.1.3.2.2.3.4.1.0"/>
+  <def name="netapp_tv2cpGetattrs"  value="1.3.6.1.4.1.789.1.3.2.2.3.4.2.0"/>
+  <def name="netapp_tv2cpSetattrs"  value="1.3.6.1.4.1.789.1.3.2.2.3.4.3.0"/>
+  <def name="netapp_tv2cpRoots"   value="1.3.6.1.4.1.789.1.3.2.2.3.4.4.0"/>
+  <def name="netapp_tv2cpLookups" value="1.3.6.1.4.1.789.1.3.2.2.3.4.5.0"/>
+  <def name="netapp_tv2cpReadlinks" value="1.3.6.1.4.1.789.1.3.2.2.3.4.6.0"/>
+  <def name="netapp_tv2cpReads"   value="1.3.6.1.4.1.789.1.3.2.2.3.4.7.0"/>
+  <def name="netapp_tv2cpWrcaches"  value="1.3.6.1.4.1.789.1.3.2.2.3.4.8.0"/>
+  <def name="netapp_tv2cpWrites"  value="1.3.6.1.4.1.789.1.3.2.2.3.4.9.0"/>
+  <def name="netapp_tv2cpCreates" value="1.3.6.1.4.1.789.1.3.2.2.3.4.10.0"/>
+  <def name="netapp_tv2cpRemoves" value="1.3.6.1.4.1.789.1.3.2.2.3.4.11.0"/>
+  <def name="netapp_tv2cpRenames" value="1.3.6.1.4.1.789.1.3.2.2.3.4.12.0"/>
+  <def name="netapp_tv2cpLinks"   value="1.3.6.1.4.1.789.1.3.2.2.3.4.13.0"/>
+  <def name="netapp_tv2cpSymlinks"  value="1.3.6.1.4.1.789.1.3.2.2.3.4.14.0"/>
+  <def name="netapp_tv2cpMkdirs"  value="1.3.6.1.4.1.789.1.3.2.2.3.4.15.0"/>
+  <def name="netapp_tv2cpRmdirs"  value="1.3.6.1.4.1.789.1.3.2.2.3.4.16.0"/>
+  <def name="netapp_tv2cpReaddirs"  value="1.3.6.1.4.1.789.1.3.2.2.3.4.17.0"/>
+  <def name="netapp_tv2cpStatfss" value="1.3.6.1.4.1.789.1.3.2.2.3.4.18.0"/>
+
+  <!-- Total NFS v3                      1.3.6.1.4.1.789.1.3.2.2.4 -->
+  <!-- Total NFS v3 tv3Calls             1.3.6.1.4.1.789.1.3.2.2.4.1 -->
+  <def name="netapp_tv3cNulls"    value="1.3.6.1.4.1.789.1.3.2.2.4.1.1.0"/>
+  <def name="netapp_tv3cGetattrs" value="1.3.6.1.4.1.789.1.3.2.2.4.1.2.0"/>
+  <def name="netapp_tv3cSetattrs" value="1.3.6.1.4.1.789.1.3.2.2.4.1.3.0"/>
+  <def name="netapp_tv3cLookups"  value="1.3.6.1.4.1.789.1.3.2.2.4.1.4.0"/>
+  <def name="netapp_tv3cAccesss"  value="1.3.6.1.4.1.789.1.3.2.2.4.1.5.0"/>
+  <def name="netapp_tv3cReadlinks"  value="1.3.6.1.4.1.789.1.3.2.2.4.1.6.0"/>
+  <def name="netapp_tv3cReads"    value="1.3.6.1.4.1.789.1.3.2.2.4.1.7.0"/>
+  <def name="netapp_tv3cWrites"   value="1.3.6.1.4.1.789.1.3.2.2.4.1.8.0"/>
+  <def name="netapp_tv3cCreates"  value="1.3.6.1.4.1.789.1.3.2.2.4.1.9.0"/>
+  <def name="netapp_tv3cMkdirs"   value="1.3.6.1.4.1.789.1.3.2.2.4.1.10.0"/>
+  <def name="netapp_tv3cSymlinks" value="1.3.6.1.4.1.789.1.3.2.2.4.1.11.0"/>
+  <def name="netapp_tv3cMknods"   value="1.3.6.1.4.1.789.1.3.2.2.4.1.12.0"/>
+  <def name="netapp_tv3cRemoves"  value="1.3.6.1.4.1.789.1.3.2.2.4.1.13.0"/>
+  <def name="netapp_tv3cRmdirs"   value="1.3.6.1.4.1.789.1.3.2.2.4.1.14.0"/>
+  <def name="netapp_tv3cRenames"  value="1.3.6.1.4.1.789.1.3.2.2.4.1.15.0"/>
+  <def name="netapp_tv3cLinks"    value="1.3.6.1.4.1.789.1.3.2.2.4.1.16.0"/>
+  <def name="netapp_tv3cReaddirs" value="1.3.6.1.4.1.789.1.3.2.2.4.1.17.0"/>
+  <def name="netapp_tv3cReaddirPluss"
+                                  value="1.3.6.1.4.1.789.1.3.2.2.4.1.18.0"/>
+  <def name="netapp_tv3cFsstats"  value="1.3.6.1.4.1.789.1.3.2.2.4.1.19.0"/>
+  <def name="netapp_tv3cFsinfos"  value="1.3.6.1.4.1.789.1.3.2.2.4.1.20.0"/>
+  <def name="netapp_tv3cPathconfs"  value="1.3.6.1.4.1.789.1.3.2.2.4.1.21.0"/>
+  <def name="netapp_tv3cCommits"  value="1.3.6.1.4.1.789.1.3.2.2.4.1.22.0"/>
+
+  <!-- Total NFS v3 tv3Percent           1.3.6.1.4.1.789.1.3.2.2.4.2 -->
+  <def name="netapp_tv3pNulls"    value="1.3.6.1.4.1.789.1.3.2.2.4.2.1.0"/>
+  <def name="netapp_tv3pGetattrs" value="1.3.6.1.4.1.789.1.3.2.2.4.2.2.0"/>
+  <def name="netapp_tv3pSetattrs" value="1.3.6.1.4.1.789.1.3.2.2.4.2.3.0"/>
+  <def name="netapp_tv3pLookups"  value="1.3.6.1.4.1.789.1.3.2.2.4.2.4.0"/>
+  <def name="netapp_tv3pAccesss"  value="1.3.6.1.4.1.789.1.3.2.2.4.2.5.0"/>
+  <def name="netapp_tv3pReadlinks"  value="1.3.6.1.4.1.789.1.3.2.2.4.2.6.0"/>
+  <def name="netapp_tv3pReads"    value="1.3.6.1.4.1.789.1.3.2.2.4.2.7.0"/>
+  <def name="netapp_tv3pWrites"   value="1.3.6.1.4.1.789.1.3.2.2.4.2.8.0"/>
+  <def name="netapp_tv3pCreates"  value="1.3.6.1.4.1.789.1.3.2.2.4.2.9.0"/>
+  <def name="netapp_tv3pMkdirs"   value="1.3.6.1.4.1.789.1.3.2.2.4.2.10.0"/>
+  <def name="netapp_tv3pSymlinks" value="1.3.6.1.4.1.789.1.3.2.2.4.2.11.0"/>
+  <def name="netapp_tv3pMknods"   value="1.3.6.1.4.1.789.1.3.2.2.4.2.12.0"/>
+  <def name="netapp_tv3pRemoves"  value="1.3.6.1.4.1.789.1.3.2.2.4.2.13.0"/>
+  <def name="netapp_tv3pRmdirs"   value="1.3.6.1.4.1.789.1.3.2.2.4.2.14.0"/>
+  <def name="netapp_tv3pRenames"  value="1.3.6.1.4.1.789.1.3.2.2.4.2.15.0"/>
+  <def name="netapp_tv3pLinks"    value="1.3.6.1.4.1.789.1.3.2.2.4.2.16.0"/>
+  <def name="netapp_tv3pReaddirs" value="1.3.6.1.4.1.789.1.3.2.2.4.2.17.0"/>
+  <def name="netapp_tv3pReaddirPluss"
+                                  value="1.3.6.1.4.1.789.1.3.2.2.4.2.18.0"/>
+  <def name="netapp_tv3pFsstats"  value="1.3.6.1.4.1.789.1.3.2.2.4.2.19.0"/>
+  <def name="netapp_tv3pFsinfos"  value="1.3.6.1.4.1.789.1.3.2.2.4.2.20.0"/>
+  <def name="netapp_tv3pPathconfs"  value="1.3.6.1.4.1.789.1.3.2.2.4.2.21.0"/>
+  <def name="netapp_tv3pCommits"  value="1.3.6.1.4.1.789.1.3.2.2.4.2.22.0"/>
+
+  <!-- Total NFS v3 tv3CachedCalls       1.3.6.1.4.1.789.1.3.2.2.4.3 -->
+  <def name="netapp_tv3ccNulls"   value="1.3.6.1.4.1.789.1.3.2.2.4.3.1.0"/>
+  <def name="netapp_tv3ccGetattrs"   value="1.3.6.1.4.1.789.1.3.2.2.4.3.2.0"/>
+  <def name="netapp_tv3ccSetattrs"   value="1.3.6.1.4.1.789.1.3.2.2.4.3.3.0"/>
+  <def name="netapp_tv3ccLookups" value="1.3.6.1.4.1.789.1.3.2.2.4.3.4.0"/>
+  <def name="netapp_tv3ccAccesss" value="1.3.6.1.4.1.789.1.3.2.2.4.3.5.0"/>
+  <def name="netapp_tv3ccReadlinks"  value="1.3.6.1.4.1.789.1.3.2.2.4.3.6.0"/>
+  <def name="netapp_tv3ccReads"   value="1.3.6.1.4.1.789.1.3.2.2.4.3.7.0"/>
+  <def name="netapp_tv3ccWrites"  value="1.3.6.1.4.1.789.1.3.2.2.4.3.8.0"/>
+  <def name="netapp_tv3ccCreates" value="1.3.6.1.4.1.789.1.3.2.2.4.3.9.0"/>
+  <def name="netapp_tv3ccMkdirs"  value="1.3.6.1.4.1.789.1.3.2.2.4.3.10.0"/>
+  <def name="netapp_tv3ccSymlinks" value="1.3.6.1.4.1.789.1.3.2.2.4.3.11.0"/>
+  <def name="netapp_tv3ccMknods"  value="1.3.6.1.4.1.789.1.3.2.2.4.3.12.0"/>
+  <def name="netapp_tv3ccRemoves" value="1.3.6.1.4.1.789.1.3.2.2.4.3.13.0"/>
+  <def name="netapp_tv3ccRmdirs"  value="1.3.6.1.4.1.789.1.3.2.2.4.3.14.0"/>
+  <def name="netapp_tv3ccRenames" value="1.3.6.1.4.1.789.1.3.2.2.4.3.15.0"/>
+  <def name="netapp_tv3ccLinks"   value="1.3.6.1.4.1.789.1.3.2.2.4.3.16.0"/>
+  <def name="netapp_tv3ccReaddirs" value="1.3.6.1.4.1.789.1.3.2.2.4.3.17.0"/>
+  <def name="netapp_tv3ccReaddirPluss"
+                                  value="1.3.6.1.4.1.789.1.3.2.2.4.3.18.0"/>
+  <def name="netapp_tv3ccFsstats" value="1.3.6.1.4.1.789.1.3.2.2.4.3.19.0"/>
+  <def name="netapp_tv3ccFsinfos" value="1.3.6.1.4.1.789.1.3.2.2.4.3.20.0"/>
+  <def name="netapp_tv3ccPathconfs" value="1.3.6.1.4.1.789.1.3.2.2.4.3.21.0"/>
+  <def name="netapp_tv3ccCommits" value="1.3.6.1.4.1.789.1.3.2.2.4.3.22.0"/>
+
+  <!-- Total NFS v3 tv3CachedPercent     1.3.6.1.4.1.789.1.3.2.2.4.4 -->
+  <def name="netapp_tv3cpNulls"   value="1.3.6.1.4.1.789.1.3.2.2.4.4.1.0"/>
+  <def name="netapp_tv3cpGetattrs" value="1.3.6.1.4.1.789.1.3.2.2.4.4.2.0"/>
+  <def name="netapp_tv3cpSetattrs" value="1.3.6.1.4.1.789.1.3.2.2.4.4.3.0"/>
+  <def name="netapp_tv3cpLookups" value="1.3.6.1.4.1.789.1.3.2.2.4.4.4.0"/>
+  <def name="netapp_tv3cpAccesss" value="1.3.6.1.4.1.789.1.3.2.2.4.4.5.0"/>
+  <def name="netapp_tv3cpReadlinks"  value="1.3.6.1.4.1.789.1.3.2.2.4.4.6.0"/>
+  <def name="netapp_tv3cpReads"   value="1.3.6.1.4.1.789.1.3.2.2.4.4.7.0"/>
+  <def name="netapp_tv3cpWrites"  value="1.3.6.1.4.1.789.1.3.2.2.4.4.8.0"/>
+  <def name="netapp_tv3cpCreates" value="1.3.6.1.4.1.789.1.3.2.2.4.4.9.0"/>
+  <def name="netapp_tv3cpMkdirs"  value="1.3.6.1.4.1.789.1.3.2.2.4.4.10.0"/>
+  <def name="netapp_tv3cpSymlinks" value="1.3.6.1.4.1.789.1.3.2.2.4.4.11.0"/>
+  <def name="netapp_tv3cpMknods"  value="1.3.6.1.4.1.789.1.3.2.2.4.4.12.0"/>
+  <def name="netapp_tv3cpRemoves" value="1.3.6.1.4.1.789.1.3.2.2.4.4.13.0"/>
+  <def name="netapp_tv3cpRmdirs"  value="1.3.6.1.4.1.789.1.3.2.2.4.4.14.0"/>
+  <def name="netapp_tv3cpRenames" value="1.3.6.1.4.1.789.1.3.2.2.4.4.15.0"/>
+  <def name="netapp_tv3cpLinks"   value="1.3.6.1.4.1.789.1.3.2.2.4.4.16.0"/>
+  <def name="netapp_tv3cpReaddirs" value="1.3.6.1.4.1.789.1.3.2.2.4.4.17.0"/>
+  <def name="netapp_tv3cpReaddirPluss"
+                                  value="1.3.6.1.4.1.789.1.3.2.2.4.4.18.0"/>
+  <def name="netapp_tv3cpFsstats" value="1.3.6.1.4.1.789.1.3.2.2.4.4.19.0"/>
+  <def name="netapp_tv3cpFsinfos" value="1.3.6.1.4.1.789.1.3.2.2.4.4.20.0"/>
+  <def name="netapp_tv3cpPathconfs" value="1.3.6.1.4.1.789.1.3.2.2.4.4.21.0"/>
+  <def name="netapp_tv3cpCommits" value="1.3.6.1.4.1.789.1.3.2.2.4.4.22.0"/>
+  
+  <!-- Total NFS reply Cache             1.3.6.1.4.1.789.1.3.2.2.5 -->
+  <def name="netapp_trcInProgressHits" value="1.3.6.1.4.1.789.1.3.2.2.5.1.0"/>
+  <def name="netapp_trcMisses"    value="1.3.6.1.4.1.789.1.3.2.2.5.3.0"/>
+  <def name="netapp_trcNonIdemDoneHits" value="1.3.6.1.4.1.789.1.3.2.2.5.4.0"/>
+  <def name="netapp_trcNonIdemNotDoneHits"
+                                  value="1.3.6.1.4.1.789.1.3.2.2.5.5.0"/>
+                                  
+  <!-- TCP reply cache stats are not returned from OnTap 6.3.1 -->
+  <!-- UDP reply cache stats are not returned from OnTap 6.3.1 -->
+  <!-- Total NFS rw Stats                1.3.6.1.4.1.789.1.3.2.2.6 -->
+  <!-- Total NFS v2 Read Stats           1.3.6.1.4.1.789.1.3.2.2.6.1 -->
+  <!-- Total NFS v2 Write Stats          1.3.6.1.4.1.789.1.3.2.2.6.2 -->
+  <!-- Total NFS v3 Read Stats           1.3.6.1.4.1.789.1.3.2.2.6.3 -->
+  <def name="netapp_tv3Read512Calls" value="1.3.6.1.4.1.789.1.3.2.2.6.3.1.0"/>
+  <def name="netapp_tv3Read1KCalls" value="1.3.6.1.4.1.789.1.3.2.2.6.3.2.0"/>
+  <def name="netapp_tv3Read2KCalls" value="1.3.6.1.4.1.789.1.3.2.2.6.3.3.0"/>
+  <def name="netapp_tv3Read4KCalls" value="1.3.6.1.4.1.789.1.3.2.2.6.3.4.0"/>
+  <def name="netapp_tv3Read8KCalls" value="1.3.6.1.4.1.789.1.3.2.2.6.3.5.0"/>
+  <def name="netapp_tv3Read16KCalls" value="1.3.6.1.4.1.789.1.3.2.2.6.3.6.0"/>
+  <def name="netapp_tv3Read32KCalls" value="1.3.6.1.4.1.789.1.3.2.2.6.3.7.0"/>
+  <def name="netapp_tv3Read64KCalls" value="1.3.6.1.4.1.789.1.3.2.2.6.3.8.0"/>
+  <def name="netapp_tv3Read128KCalls" value="1.3.6.1.4.1.789.1.3.2.2.6.3.9.0"/>
+  <!-- Total NFS v3 Write Stats          1.3.6.1.4.1.789.1.3.2.2.6.4 -->
+  <def name="netapp_tv3Write512Calls" value="1.3.6.1.4.1.789.1.3.2.2.6.4.1.0"/>
+  <def name="netapp_tv3Write1KCalls" value="1.3.6.1.4.1.789.1.3.2.2.6.4.2.0"/>
+  <def name="netapp_tv3Write2KCalls" value="1.3.6.1.4.1.789.1.3.2.2.6.4.3.0"/>
+  <def name="netapp_tv3Write4KCalls" value="1.3.6.1.4.1.789.1.3.2.2.6.4.4.0"/>
+  <def name="netapp_tv3Write8KCalls" value="1.3.6.1.4.1.789.1.3.2.2.6.4.5.0"/>
+  <def name="netapp_tv3Write16KCalls" value="1.3.6.1.4.1.789.1.3.2.2.6.4.6.0"/>
+  <def name="netapp_tv3Write32KCalls" value="1.3.6.1.4.1.789.1.3.2.2.6.4.7.0"/>
+  <def name="netapp_tv3Write64KCalls" value="1.3.6.1.4.1.789.1.3.2.2.6.4.8.0"/>
+  <def name="netapp_tv3Write128KCalls"
+                                     value="1.3.6.1.4.1.789.1.3.2.2.6.4.9.0"/>
+
+</definitions>
+
+<datasources>
+
+
+  <template name="netapp-cpu">
+    <subtree name="Netapp_CPU">
+      <param name="comment" value="NetApp CPU Stats"/>
+      <leaf name="CpuUpTime">
+        <param name="hidden" value="yes"/>
+        <param name="data-file" value="%system-id%_CPU.rrd"/>
+        <param name="vertical-label"  value="Ticks"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment"      value="CPU Time"/>
+        <param name="rrd-ds"       value="cpuUpTime"/>
+        <param name="snmp-object"  value="$netapp_cpuUpTime"/>
+        <param name="graph-legend" value="CPU Time"/>
+      </leaf>
+      <leaf name="CpuBusyTime">
+        <param name="hidden" value="yes"/>
+        <param name="data-file" value="%system-id%_CPU.rrd"/>
+        <param name="vertical-label"  value="Ticks"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment"      value="CPU Busy Time"/>
+        <param name="rrd-ds"       value="cpuBusyTime"/>
+        <param name="snmp-object"  value="$netapp_cpuBusyTime"/>
+        <param name="graph-legend" value="CPU Busy Time"/>
+      </leaf>
+      <leaf name="CpuBusyTimePerCent">
+        <param name="data-file" value="%system-id%_CPU.rrd"/>
+        <param name="vertical-label"  value="Ticks"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment"      value="CPU Busy Time Percent"/>
+        <param name="rrd-ds"       value="cpuBusyTimePerCent"/>
+        <param name="snmp-object"  value="$netapp_cpuBusyTimePerCent"/>
+        <param name="graph-legend" value="CPU Busy Time Percent"/>
+        <param name="vertical-label"  value="Percent"/>
+      </leaf>
+      <leaf name="CpuIdleTime">
+        <param name="hidden" value="yes"/>
+        <param name="data-file" value="%system-id%_CPU.rrd"/>
+        <param name="vertical-label"  value="Ticks"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment"      value="CPU Idle Time since boot"/>
+        <param name="rrd-ds"       value="cpuIdleTime"/>
+        <param name="snmp-object"  value="$netapp_cpuIdleTime"/>
+        <param name="graph-legend" value="CPU Idle Time"/>
+      </leaf>
+      <leaf name="CpuIdleTimePerCent">
+        <param name="data-file" value="%system-id%_CPU.rrd"/>
+        <param name="vertical-label"  value="Ticks"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment"      value="CPU Idle Time Percent since boot"/>
+        <param name="rrd-ds"       value="cpuIdleTimePerCent"/>
+        <param name="snmp-object"  value="$netapp_cpuIdleTimePerCent"/>
+        <param name="graph-legend" value="CPU Idle Time Percent"/>
+        <param name="vertical-label"  value="Percent"/>
+      </leaf>
+      <leaf name="CpuSwitchInvocations">
+        <param name="data-file" value="%system-id%_CPU.rrd"/>
+        <param name="vertical-label"  value="Ticks"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment"     value="The number of sk_switch invocations"/>
+        <param name="rrd-ds"       value="SwitchInvocations"/>
+        <param name="snmp-object"  value="$netapp_cpuSwitchInvocations"/>
+        <param name="graph-legend" value="sk_switch invocations"/>
+        <param name="vertical-label"  value="Switches"/>
+      </leaf>
+      <leaf name="CpuInterrupts">
+        <param name="data-file" value="%system-id%_CPU.rrd"/>
+        <param name="vertical-label"  value="Ticks"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment"      value="CPU Interrupts"/>
+        <param name="rrd-ds"       value="cpuInterrupts"/>
+        <param name="snmp-object"  value="$netapp_cpuInterrupts"/>
+        <param name="graph-legend" value="CPU Interrupts"/>
+        <param name="vertical-label"  value="Interrupts"/>
+      </leaf>
+      <leaf name="CpuNonCPInterrupts">
+        <param name="data-file" value="%system-id%_CPU.rrd"/>
+        <param name="vertical-label"  value="Ticks"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment"      value="CPU NonCPInterrupts"/>
+        <param name="rrd-ds"       value="cpuNonCPInterrupts"/>
+        <param name="snmp-object"  value="$netapp_cpuNonCPInterrupts"/>
+        <param name="graph-legend" value="CPU NonCPInterrupts"/>
+        <param name="vertical-label"  value="Interrupts"/>
+      </leaf>
+      <leaf name="CpuCPInterruptPercent">
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="data-file" value="%system-id%_CPU.rrd"/>
+        <param name="vertical-label"  value="Ticks"/>
+        <param name="comment"      value="CPU CPInterruptPercent"/>
+        <param name="rrd-ds"       value="cpuCPIntPercent"/>
+        <param name="snmp-object"  value="$netapp_cpuCPInterruptPercent"/>
+        <param name="graph-legend" value="CPU CP Interrupts Percent"/>
+        <param name="vertical-label"  value="Percent"/>
+      </leaf>
+      <leaf name="CpuNonCPInterruptPercent">
+        <param name="data-file" value="%system-id%_CPU.rrd"/>
+        <param name="vertical-label"  value="Ticks"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="comment"      value="CPU Non-CP Interrupts Percent"/>
+        <param name="rrd-ds"       value="cpuNonCPIntPercent"/>
+        <param name="snmp-object"  value="$netapp_cpuNonCPInterruptPercent"/>
+        <param name="graph-legend" value="NonCP Interrupts Percent"/>
+        <param name="vertical-label"  value="Percent"/>
+      </leaf>
+      <leaf name="CpuTotalDomainSwitches">
+        <param name="data-file" value="%system-id%_CPU.rrd"/>
+        <param name="vertical-label"  value="Switches"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment"      value="CPU Domain Switches"/>
+        <param name="rrd-ds"       value="TotDomainSwitches"/>
+        <param name="snmp-object"  value="$netapp_cpuTotalDomainSwitches"/>
+        <param name="graph-legend" value="Domain Switches"/>
+        <param name="vertical-label"  value="Switches"/>
+      </leaf>
+    </subtree>
+  </template>
+  <template name="netapp-misc">
+    <subtree name="NetApp_General">
+      <param name="NetApp General Stats"/>
+      <leaf name="NfsOps">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="data-file" value="%system-id%_misc.rrd"/>
+        <param name="vertical-label"  value="Operations/s"/>
+        <param name="comment"      value="NFS Operations"/>
+        <param name="rrd-ds"       value="miscLowNfsOps"/>
+        <param name="snmp-object"  value="$netapp_miscLowNfsOps"/>
+        <param name="graph-legend" value="NFS Operations/s"/>
+      </leaf>
+      <leaf name="CifsOps">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="data-file" value="%system-id%_misc.rrd"/>
+        <param name="vertical-label"  value="Operations/s"/>
+        <param name="comment"      value="CIFS Operations"/>
+        <param name="rrd-ds"       value="miscLowCifsOps"/>
+        <param name="snmp-object"  value="$netapp_miscLowCifsOps"/>
+        <param name="graph-legend" value="CIFS Operations/s"/>
+      </leaf>
+      <leaf name="HttpOps">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="data-file" value="%system-id%_misc.rrd"/>
+        <param name="vertical-label"  value="Operations/s"/>
+        <param name="comment"      value="HTTP Operations"/>
+        <param name="rrd-ds"       value="miscLowHttpOps"/>
+        <param name="snmp-object"  value="$netapp_miscLowHttpOps"/>
+        <param name="graph-legend" value="HTTP Operations/s"/>
+      </leaf>
+      <leaf name="NetRcvdBytes">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="data-file" value="%system-id%_misc.rrd"/>
+        <param name="vertical-label"  value="Operations/s"/>
+        <param name="comment"      value="Network Received Bytes/s"/>
+        <param name="rrd-ds"       value="miscLowNetRcvdBytes"/>
+        <param name="snmp-object"  value="$netapp_miscLowNetRcvdBytes"/>
+        <param name="graph-legend" value="Network Received Bytes/s"/>
+      </leaf>
+      <leaf name="NetSentBytes">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="data-file" value="%system-id%_misc.rrd"/>
+        <param name="vertical-label"  value="Operations/s"/>
+        <param name="comment"      value="Network Sent Bytes/s"/>
+        <param name="rrd-ds"       value="miscLowNetSentBytes"/>
+        <param name="snmp-object"  value="$netapp_miscLowNetSentBytes"/>
+        <param name="graph-legend" value="Network Sent Bytes/s"/>
+      </leaf>
+      <leaf name="DiskReadBytes">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="data-file" value="%system-id%_misc.rrd"/>
+        <param name="vertical-label"  value="Reads/s"/>
+        <param name="comment"      value="Disk Read Bytes/s"/>
+        <param name="rrd-ds"       value="LowDiskReadBytes"/>
+        <param name="snmp-object"  value="$netapp_miscLowDiskReadBytes"/>
+        <param name="graph-legend" value="Disk Received Bytes/s"/>
+      </leaf>
+      <leaf name="DiskWriteBytes">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="data-file" value="%system-id%_misc.rrd"/>
+        <param name="vertical-label"  value="Writes/s"/>
+        <param name="comment"      value="Disk Write Bytes/s"/>
+        <param name="rrd-ds"       value="LowDiskWriteBytes"/>
+        <param name="snmp-object"  value="$netapp_miscLowDiskWriteBytes"/>
+        <param name="graph-legend" value="Disk Write Bytes/s"/>
+      </leaf>
+      <leaf name="TapeReadBytes">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="data-file" value="%system-id%_misc.rrd"/>
+        <param name="vertical-label"  value="Operations/s"/>
+        <param name="comment"      value="Tape Received Bytes/s"/>
+        <param name="rrd-ds"       value="LowTapeReadBytes"/>
+        <param name="snmp-object"  value="$netapp_miscLowTapeReadBytes"/>
+        <param name="graph-legend" value="Tape Received Bytes/s"/>
+      </leaf>
+      <leaf name="TapeWriteBytes">
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="data-file" value="%system-id%_misc.rrd"/>
+        <param name="vertical-label"  value="Operations/s"/>
+        <param name="comment"      value="Tape Write Bytes/s"/>
+        <param name="rrd-ds"       value="LowTapeWriteBytes"/>
+        <param name="snmp-object"  value="$netapp_miscLowTapeWriteBytes"/>
+        <param name="graph-legend" value="Tape Write Bytes/s"/>
+      </leaf>
+      <leaf name="CacheAge">
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="data-file" value="%system-id%_misc.rrd"/>
+        <param name="vertical-label"  value="Minutes"/>
+        <param name="comment"      value="Cache Age in Minutes"/>
+        <param name="rrd-ds"       value="miscCacheAge"/>
+        <param name="snmp-object"  value="$netapp_miscCacheAge"/>
+        <param name="graph-legend" value="Cache Age"/>
+      </leaf>
+    </subtree>
+  </template>
+  <template name="netapp-cp">
+    <subtree name="ConsistencyPoints">
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_cp.rrd"/>
+      <param name="vertical-label"  value="Operations/s"/>
+        <leaf name="cpTime">
+            <param name="vertical-label"  value="Ticks"/>
+            <param name="comment"      value="Time Spent Processing CPs"/>
+            <param name="rrd-ds"       value="cpTime"/>
+            <param name="snmp-object"  value="$netapp_cpTime"/>
+            <param name="graph-legend" value="CP Time"/>
+        </leaf>
+        <leaf name="cpFromTimerOps">
+            <param name="comment"      value="CP Operations from Timer"/>
+            <param name="rrd-ds"       value="cpFromTimerOps"/>
+            <param name="snmp-object"  value="$netapp_cpFromTimerOps"/>
+            <param name="graph-legend" value="CPs From Timer "/>
+        </leaf>
+    </subtree>
+  </template>
+  <template name="netapp-nfsv2">
+    <subtree name="nfsv2_Calls">
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_nfsv2.rrd"/>
+      <param name="vertical-label"  value="Calls"/>
+      <leaf name="Null">
+        <param name="comment"      value="Do Nothing Requests"/>
+        <param name="rrd-ds"       value="tv2cNull"/>
+        <param name="snmp-object"  value="$netapp_tv2cNulls"/>
+        <param name="graph-legend" value="Null Requests/s"/>
+      </leaf>
+      <leaf name="Getattrs">
+        <param name="comment"      value="Get File Attributes"/>
+        <param name="rrd-ds"       value="tv2cGetattrs"/>
+        <param name="snmp-object"  value="$netapp_tv2cGetattrs"/>
+        <param name="graph-legend" value="Getattrs Requests/s"/>
+      </leaf>
+      <leaf name="Setattrs">
+        <param name="comment"      value="Set File Attributes"/>
+        <param name="rrd-ds"       value="tv2cSetattrs"/>
+        <param name="snmp-object"  value="$netapp_tv2cSetattrs"/>
+        <param name="graph-legend" value="Setattrs Requests/s"/>
+      </leaf>
+      <leaf name="Roots">
+        <param name="comment"      value="Get Filesystem Root"/>
+        <param name="rrd-ds"       value="tv2cRoots"/>
+        <param name="snmp-object"  value="$netapp_tv2cRoots"/>
+        <param name="graph-legend" value="Root Requests/s"/>
+      </leaf>
+      <leaf name="Lookups">
+        <param name="comment"      value="Look Up File Name"/>
+        <param name="rrd-ds"       value="tv2cLookups"/>
+        <param name="snmp-object"  value="$netapp_tv2cLookups"/>
+        <param name="graph-legend" value="Lookup Requests/s"/>
+      </leaf>
+      <leaf name="Readlinks">
+        <param name="comment"      value="Read From Symbolic Link"/>
+        <param name="rrd-ds"       value="tv2cReadlinks"/>
+        <param name="snmp-object"  value="$netapp_tv2cReadlinks"/>
+        <param name="graph-legend" value="Readlinks Requests/s"/>
+      </leaf>
+      <leaf name="Reads">
+        <param name="comment"      value="Reads"/>
+        <param name="rrd-ds"       value="tv2cReads"/>
+        <param name="snmp-object"  value="$netapp_tv2cReads"/>
+        <param name="graph-legend" value="Read Requests/s"/>
+      </leaf>
+      <leaf name="Wrcaches">
+        <param name="comment"      value="Write to Cache"/>
+        <param name="rrd-ds"       value="tv2cWrcaches"/>
+        <param name="snmp-object"  value="$netapp_tv2cWrcaches"/>
+        <param name="graph-legend" value="Write Cache Requests/s"/>
+      </leaf>
+      <leaf name="Writes">
+        <param name="comment"      value="Write to File"/>
+        <param name="rrd-ds"       value="tv2cWrites"/>
+        <param name="snmp-object"  value="$netapp_tv2cWrites"/>
+        <param name="graph-legend" value="Write Requests/s"/>
+      </leaf>
+      <leaf name="Creates">
+        <param name="comment"      value="Create File"/>
+        <param name="rrd-ds"       value="tv2cCreates"/>
+        <param name="snmp-object"  value="$netapp_tv2cCreates"/>
+        <param name="graph-legend" value="Create Requests/s"/>
+      </leaf>
+      <leaf name="Remove">
+        <param name="comment"      value="Remove File"/>
+        <param name="rrd-ds"       value="tv2cRemoves"/>
+        <param name="snmp-object"  value="$netapp_tv2cRemoves"/>
+        <param name="graph-legend" value="Remove Requests/s"/>
+      </leaf>
+      <leaf name="Rename">
+        <param name="comment"      value="Rename File"/>
+        <param name="rrd-ds"       value="tv2cRenames"/>
+        <param name="snmp-object"  value="$netapp_tv2cRenames"/>
+        <param name="graph-legend" value="Rename Requests/s"/>
+      </leaf>
+      <leaf name="Link">
+        <param name="comment"      value="Create Link to File"/>
+        <param name="rrd-ds"       value="tv2cLinks"/>
+        <param name="snmp-object"  value="$netapp_tv2cLinks"/>
+        <param name="graph-legend" value="Link Requests/s"/>
+      </leaf>
+      <leaf name="SymLink">
+        <param name="comment"      value="Create SymLink to File"/>
+        <param name="rrd-ds"       value="tv2cSymlinks"/>
+        <param name="snmp-object"  value="$netapp_tv2cSymlinks"/>
+        <param name="graph-legend" value="SymLink Requests/s"/>
+      </leaf>
+      <leaf name="Mkdir">
+        <param name="comment"      value="Create Directory"/>
+        <param name="rrd-ds"       value="tv2cMkdirs"/>
+        <param name="snmp-object"  value="$netapp_tv2cMkdirs"/>
+        <param name="graph-legend" value="Mkdir Requests/s"/>
+      </leaf>
+      <leaf name="Rmdir">
+        <param name="comment"      value="Remove Directory"/>
+        <param name="rrd-ds"       value="tv2cRmdirs"/>
+        <param name="snmp-object"  value="$netapp_tv2cRmdirs"/>
+        <param name="graph-legend" value="Rmdir Requests/s"/>
+      </leaf>
+      <leaf name="Readdir">
+        <param name="comment"      value="Read From Directory"/>
+        <param name="rrd-ds"       value="tv2cReaddirs"/>
+        <param name="snmp-object"  value="$netapp_tv2cReaddirs"/>
+        <param name="graph-legend" value="Readdir Requests/s"/>
+      </leaf>
+      <leaf name="Statfs">
+        <param name="comment"      value="Get FS Attributes"/>
+        <param name="rrd-ds"       value="tv2cStatfss"/>
+        <param name="snmp-object"  value="$netapp_tv2cStatfss"/>
+        <param name="graph-legend" value="Statfs Requests/s"/>
+      </leaf>
+    </subtree>
+    <subtree name="nfsv2_Percent">
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_nfsv2.rrd"/>
+      <param name="vertical-label"  value="Percent Calls"/>
+      <leaf name="Null">
+        <param name="comment"      value="Percent Do Nothing Requests"/>
+        <param name="rrd-ds"       value="tv2pNull"/>
+        <param name="snmp-object"  value="$netapp_tv2pNulls"/>
+        <param name="graph-legend" value="Percent Null Requests"/>
+      </leaf>
+      <leaf name="Getattrs">
+        <param name="comment"      value="Percent Get File Attributes"/>
+        <param name="rrd-ds"       value="tv2pGetattrs"/>
+        <param name="snmp-object"  value="$netapp_tv2pGetattrs"/>
+        <param name="graph-legend" value="Percent Getattrs Requests"/>
+      </leaf>
+      <leaf name="Setattrs">
+        <param name="comment"      value="Percent Set File Attributes"/>
+        <param name="rrd-ds"       value="tv2pSetattrs"/>
+        <param name="snmp-object"  value="$netapp_tv2pSetattrs"/>
+        <param name="graph-legend" value="Percent Setattrs Requests"/>
+      </leaf>
+      <leaf name="Roots">
+        <param name="comment"      value="Percent Get Filesystem Root"/>
+        <param name="rrd-ds"       value="tv2pRoots"/>
+        <param name="snmp-object"  value="$netapp_tv2pRoots"/>
+        <param name="graph-legend" value="Percent Root Requests"/>
+      </leaf>
+      <leaf name="Lookups">
+        <param name="comment"      value="Percent Look Up File Name"/>
+        <param name="rrd-ds"       value="tv2pLookups"/>
+        <param name="snmp-object"  value="$netapp_tv2pLookups"/>
+        <param name="graph-legend" value="Percent Lookup Requests"/>
+      </leaf>
+      <leaf name="Readlinks">
+        <param name="comment"      value="Percent Read From Symbolic Link"/>
+        <param name="rrd-ds"       value="tv2pReadlinks"/>
+        <param name="snmp-object"  value="$netapp_tv2pReadlinks"/>
+        <param name="graph-legend" value="Percent Readlinks Requests"/>
+      </leaf>
+      <leaf name="Reads">
+        <param name="comment"      value="Percent Reads"/>
+        <param name="rrd-ds"       value="tv2pReads"/>
+        <param name="snmp-object"  value="$netapp_tv2pReads"/>
+        <param name="graph-legend" value="Percent Read Requests"/>
+      </leaf>
+      <leaf name="Wrcaches">
+        <param name="comment"      value="Percent Write to Cache"/>
+        <param name="rrd-ds"       value="tv2pWrcaches"/>
+        <param name="snmp-object"  value="$netapp_tv2pWrcaches"/>
+        <param name="graph-legend" value="Percent Write Cache Requests"/>
+      </leaf>
+      <leaf name="Writes">
+        <param name="comment"      value="Percent Write to File"/>
+        <param name="rrd-ds"       value="tv2pWrites"/>
+        <param name="snmp-object"  value="$netapp_tv2pWrites"/>
+        <param name="graph-legend" value="Percent Write Requests"/>
+      </leaf>
+      <leaf name="Creates">
+        <param name="comment"      value="Percent Create File"/>
+        <param name="rrd-ds"       value="tv2pCreates"/>
+        <param name="snmp-object"  value="$netapp_tv2pCreates"/>
+        <param name="graph-legend" value="Percent Create Requests"/>
+      </leaf>
+      <leaf name="Remove">
+        <param name="comment"      value="Percent Remove File"/>
+        <param name="rrd-ds"       value="tv2pRemoves"/>
+        <param name="snmp-object"  value="$netapp_tv2pRemoves"/>
+        <param name="graph-legend" value="Percent Remove Requests"/>
+      </leaf>
+      <leaf name="Rename">
+        <param name="comment"      value="Percent Rename File"/>
+        <param name="rrd-ds"       value="tv2pRenames"/>
+        <param name="snmp-object"  value="$netapp_tv2pRenames"/>
+        <param name="graph-legend" value="Percent Rename Requests"/>
+      </leaf>
+      <leaf name="Link">
+        <param name="comment"      value="Percent Create Link to File"/>
+        <param name="rrd-ds"       value="tv2pLinks"/>
+        <param name="snmp-object"  value="$netapp_tv2pLinks"/>
+        <param name="graph-legend" value="Percent Link Requests"/>
+      </leaf>
+      <leaf name="SymLink">
+        <param name="comment"      value="Percent Create SymLink to File"/>
+        <param name="rrd-ds"       value="tv2pSymlinks"/>
+        <param name="snmp-object"  value="$netapp_tv2pSymlinks"/>
+        <param name="graph-legend" value="Percent SymLink Requests"/>
+      </leaf>
+      <leaf name="Mkdir">
+        <param name="comment"      value="Percent Create Directory"/>
+        <param name="rrd-ds"       value="tv2pMkdirs"/>
+        <param name="snmp-object"  value="$netapp_tv2pMkdirs"/>
+        <param name="graph-legend" value="Percent Mkdir Requests"/>
+      </leaf>
+      <leaf name="Rmdir">
+        <param name="comment"      value="Percent Remove Directory"/>
+        <param name="rrd-ds"       value="tv2pRmdirs"/>
+        <param name="snmp-object"  value="$netapp_tv2pRmdirs"/>
+        <param name="graph-legend" value="Percent Rmdir Requests"/>
+      </leaf>
+      <leaf name="Readdir">
+        <param name="comment"      value="Percent Read From Directory"/>
+        <param name="rrd-ds"       value="tv2pReaddirs"/>
+        <param name="snmp-object"  value="$netapp_tv2pReaddirs"/>
+        <param name="graph-legend" value="Percent Readdir Requests"/>
+      </leaf>
+      <leaf name="Statfs">
+        <param name="comment"      value="Percent Get FS Attributes"/>
+        <param name="rrd-ds"       value="tv2pStatfss"/>
+        <param name="snmp-object"  value="$netapp_tv2pStatfss"/>
+        <param name="graph-legend" value="Percent Statfs Requests"/>
+      </leaf>
+    </subtree>
+    <subtree name="nfsv2_CacheCalls">
+      <param name="rrd-create-dstype" value="COUNTER"/>
+      <param name="data-file" value="%system-id%_nfsv2.rrd"/>
+      <param name="vertical-label"  value="Cached Calls"/>
+      <leaf name="Null">
+        <param name="comment"      value="Do Nothing Requests"/>
+        <param name="rrd-ds"       value="tv2ccNull"/>
+        <param name="snmp-object"  value="$netapp_tv2ccNulls"/>
+        <param name="graph-legend" value="Cached Null Requests/s"/>
+      </leaf>
+      <leaf name="Getattrs">
+        <param name="comment"      value="Get File Attributes"/>
+        <param name="rrd-ds"       value="tv2ccGetattrs"/>
+        <param name="snmp-object"  value="$netapp_tv2ccGetattrs"/>
+        <param name="graph-legend" value="Cached Getattrs Requests/s"/>
+      </leaf>
+      <leaf name="Setattrs">
+        <param name="comment"      value="Set File Attributes"/>
+        <param name="rrd-ds"       value="tv2ccSetattrs"/>
+        <param name="snmp-object"  value="$netapp_tv2ccSetattrs"/>
+        <param name="graph-legend" value="Cached Setattrs Requests/s"/>
+      </leaf>
+      <leaf name="Roots">
+        <param name="comment"      value="Get Filesystem Root"/>
+        <param name="rrd-ds"       value="tv2ccRoots"/>
+        <param name="snmp-object"  value="$netapp_tv2ccRoots"/>
+        <param name="graph-legend" value="Cached Root Requests/s"/>
+      </leaf>
+      <leaf name="Lookups">
+        <param name="comment"      value="Look Up File Name"/>
+        <param name="rrd-ds"       value="tv2ccLookups"/>
+        <param name="snmp-object"  value="$netapp_tv2ccLookups"/>
+        <param name="graph-legend" value="Cached Lookup Requests/s"/>
+      </leaf>
+      <leaf name="Readlinks">
+        <param name="comment"      value="Read From Symbolic Link"/>
+        <param name="rrd-ds"       value="tv2ccReadlinks"/>
+        <param name="snmp-object"  value="$netapp_tv2ccReadlinks"/>
+        <param name="graph-legend" value="Cached Readlinks Requests/s"/>
+      </leaf>
+      <leaf name="Reads">
+        <param name="comment"      value="Reads"/>
+        <param name="rrd-ds"       value="tv2ccReads"/>
+        <param name="snmp-object"  value="$netapp_tv2ccReads"/>
+        <param name="graph-legend" value="Cached Read Requests/s"/>
+      </leaf>
+      <leaf name="Wrcaches">
+        <param name="comment"      value="Write to Cache"/>
+        <param name="rrd-ds"       value="tv2ccWrcaches"/>
+        <param name="snmp-object"  value="$netapp_tv2ccWrcaches"/>
+        <param name="graph-legend" value="Cached Write Cache Requests/s"/>
+      </leaf>
+      <leaf name="Writes">
+        <param name="comment"      value="Write to File"/>
+        <param name="rrd-ds"       value="tv2ccWrites"/>
+        <param name="snmp-object"  value="$netapp_tv2ccWrites"/>
+        <param name="graph-legend" value="Cached Write Requests/s"/>
+      </leaf>
+      <leaf name="Creates">
+        <param name="comment"      value="Create File"/>
+        <param name="rrd-ds"       value="tv2ccCreates"/>
+        <param name="snmp-object"  value="$netapp_tv2ccCreates"/>
+        <param name="graph-legend" value="Cached Create Requests/s"/>
+      </leaf>
+      <leaf name="Remove">
+        <param name="comment"      value="Remove File"/>
+        <param name="rrd-ds"       value="tv2ccRemoves"/>
+        <param name="snmp-object"  value="$netapp_tv2ccRemoves"/>
+        <param name="graph-legend" value="Cached Remove Requests/s"/>
+      </leaf>
+      <leaf name="Rename">
+        <param name="comment"      value="Rename File"/>
+        <param name="rrd-ds"       value="tv2ccRenames"/>
+        <param name="snmp-object"  value="$netapp_tv2ccRenames"/>
+        <param name="graph-legend" value="Cached Rename Requests/s"/>
+      </leaf>
+      <leaf name="Link">
+        <param name="comment"      value="Create Link to File"/>
+        <param name="rrd-ds"       value="tv2ccLinks"/>
+        <param name="snmp-object"  value="$netapp_tv2ccLinks"/>
+        <param name="graph-legend" value="Cached Link Requests/s"/>
+      </leaf>
+      <leaf name="SymLink">
+        <param name="comment"      value="Create SymLink to File"/>
+        <param name="rrd-ds"       value="tv2ccSymlinks"/>
+        <param name="snmp-object"  value="$netapp_tv2ccSymlinks"/>
+        <param name="graph-legend" value="Cached SymLink Requests/s"/>
+      </leaf>
+      <leaf name="Mkdir">
+        <param name="comment"      value="Create Directory"/>
+        <param name="rrd-ds"       value="tv2ccMkdirs"/>
+        <param name="snmp-object"  value="$netapp_tv2ccMkdirs"/>
+        <param name="graph-legend" value="Cached Mkdir Requests/s"/>
+      </leaf>
+      <leaf name="Rmdir">
+        <param name="comment"      value="Remove Directory"/>
+        <param name="rrd-ds"       value="tv2ccRmdirs"/>
+        <param name="snmp-object"  value="$netapp_tv2ccRmdirs"/>
+        <param name="graph-legend" value="Cached Rmdir Requests/s"/>
+      </leaf>
+      <leaf name="Readdir">
+        <param name="comment"      value="Read From Directory"/>
+        <param name="rrd-ds"       value="tv2ccReaddirs"/>
+        <param name="snmp-object"  value="$netapp_tv2ccReaddirs"/>
+        <param name="graph-legend" value="Cached Readdir Requests/s"/>
+      </leaf>
+      <leaf name="Statfs">
+        <param name="comment"      value="Get FS Attributes"/>
+        <param name="rrd-ds"       value="tv2ccStatfss"/>
+        <param name="snmp-object"  value="$netapp_tv2ccStatfss"/>
+        <param name="graph-legend" value="Cached Statfs Requests/s"/>
+      </leaf>
+    </subtree>
+  </template>
+  <template name="netapp-nfsv3">
+      <subtree name="NFSv3_Calls_vs_Cache">
+        <param name="comment" value="NFS v3 Calls vs Cached Calls"/>
+        <param name="vertical-label" value="Requests/s"/>
+        <leaf name="Null">
+          <param name="comment" value="Do Nothing (Null) Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Null}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Null}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Getattrs">
+          <param name="comment" value="Get Attribute Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Getattrs}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Getattrs}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Setattrs">
+          <param name="comment" value="Set Attribute Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Setattrs}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Setattrs}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Lookups">
+          <param name="comment" value="Lookup File Name Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Lookups}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Lookups}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Access">
+          <param name="comment" value="Check Access Permission Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Access}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Access}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Readlinks">
+          <param name="comment" value="Read From Symbolic Link Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Readlinks}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache"
+                                   value="{../nfsv3_CachedCalls/Readlinks}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Reads">
+          <param name="comment" value="Read From File Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Reads}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Reads}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Writes">
+          <param name="comment" value="Write To File Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Writes}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Writes}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Creates">
+          <param name="comment" value="Create File Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Creates}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Creates}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Mkdir">
+          <param name="comment" value="Make Directory Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Mkdir}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Mkdir}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="SymLink">
+          <param name="comment" value="Create SymLink Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/SymLink}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/SymLink}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Mknod">
+          <param name="comment" value="Create Device Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Mknod}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Mknod}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Remove">
+          <param name="comment" value="Remove File Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Remove}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Remove}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Rmdir">
+          <param name="comment" value="Remove Directory Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Rmdir}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Rmdir}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Rename">
+          <param name="comment" value="Rename File Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Rename}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Rename}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Link">
+          <param name="comment" value="Create Link Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Link}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Link}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Readdir">
+          <param name="comment" value="Read From Directory Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Readdir}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Readdir}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="ReaddirPlus">
+          <param name="comment" value="Extended Read From Directory Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/ReaddirPlus}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache"
+                                 value="{../nfsv3_CachedCalls/ReaddirPlus}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Fsstat">
+          <param name="comment" value="Dynamic File System Info Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Fsstat}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Fsstat}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Fsinfos">
+          <param name="comment" value="Static File System Info Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Fsinfos}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Fsinfos}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Pathconf">
+          <param name="comment" value="POSIX Info Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Pathconf}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Pathconf}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Commit">
+          <param name="comment" value="Commit Cached Server Data Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Calls/Commit}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedCalls/Commit}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+      </subtree>
+      <subtree name="NFSv3_Percent_Calls_vs_Cache">
+        <param name="comment" value="NFS v3 Percent Calls vs Cached Calls"/>
+        <param name="vertical-label" value="Requests/s"/>
+        <leaf name="Null">
+          <param name="comment" value="Do Nothing (Null) Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Null}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedPercent/Null}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Getattrs">
+          <param name="comment" value="Get Attribute Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Getattrs}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache"
+                                   value="{../nfsv3_CachedPercent/Getattrs}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Setattrs">
+          <param name="comment" value="Set Attribute Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Setattrs}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache"
+                                  value="{../nfsv3_CachedPercent/Setattrs}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Lookups">
+          <param name="comment" value="Lookup File Name Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Lookups}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache"
+                                    value="{../nfsv3_CachedPercent/Lookups}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Access">
+          <param name="comment" value="Check Access Permission Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Access}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedPercent/Access}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Readlinks">
+          <param name="comment" value="Read From Symbolic Link Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Readlinks}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache"
+                                  value="{../nfsv3_CachedPercent/Readlinks}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Reads">
+          <param name="comment" value="Read From File Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Reads}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedPercent/Reads}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Writes">
+          <param name="comment" value="Write To File Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Writes}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedPercent/Writes}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Creates">
+          <param name="comment" value="Create File Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Creates}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache"
+                                     value="{../nfsv3_CachedPercent/Creates}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Mkdir">
+          <param name="comment" value="Make Directory Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Mkdir}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedPercent/Mkdir}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="SymLink">
+          <param name="comment" value="Create SymLink Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/SymLink}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache"
+                                   value="{../nfsv3_CachedPercent/SymLink}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Mknod">
+          <param name="comment" value="Create Device Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Mknod}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedPercent/Mknod}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Remove">
+          <param name="comment" value="Remove File Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Remove}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedPercent/Remove}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Rmdir">
+          <param name="comment" value="Remove Directory Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Rmdir}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedPercent/Rmdir}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Rename">
+          <param name="comment" value="Rename File Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Rename}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedPercent/Rename}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Link">
+          <param name="comment" value="Create Link Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Link}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedPercent/Link}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Readdir">
+          <param name="comment" value="Read From Directory Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Readdir}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache"
+                                     value="{../nfsv3_CachedPercent/Readdir}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="ReaddirPlus">
+          <param name="comment" value="Extended Read From Directory Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/ReaddirPlus}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache"
+                                 value="{../nfsv3_CachedPercent/ReaddirPlus}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Fsstat">
+          <param name="comment" value="Dynamic File System Info Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Fsstat}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedPercent/Fsstat}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Fsinfos">
+          <param name="comment" value="Static File System Info Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Fsinfos}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache"
+                                    value="{../nfsv3_CachedPercent/Fsinfos}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Pathconf">
+          <param name="comment" value="POSIX Info Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Pathconf}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache"
+                                    value="{../nfsv3_CachedPercent/Pathconf}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+        <leaf name="Commit">
+          <param name="comment" value="Commit Cached Server Data Requests"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="calls,cache"/>
+          <!-- Calls -->
+          <param name="ds-expr-calls" value="{../nfsv3_Percent/Commit}"/>
+          <param name="graph-legend-calls" value="Requests"/>
+          <param name="line-style-calls" value="AREA"/>
+          <param name="line-color-calls" value="##two"/>
+          <param name="line-order-calls" value="1"/>
+          <!-- Cache -->
+          <param name="ds-expr-cache" value="{../nfsv3_CachedPercent/Commit}"/>
+          <param name="graph-legend-cache" value="Cached Results"/>
+          <param name="line-style-cache" value="LINE1"/>
+          <param name="line-color-cache" value="##three"/>
+          <param name="line-order-cache" value="2"/>
+        </leaf>
+      </subtree>
+      <subtree name="nfsv3_Calls">
+        <param name="hidden" value="yes"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="data-file" value="%system-id%_nfsv3.rrd"/>
+        <param name="vertical-label"  value="Calls"/>
+        <leaf name="Null">
+          <param name="comment"      value="Do Nothing Requests"/>
+          <param name="rrd-ds"       value="tv3cNull"/>
+          <param name="snmp-object"  value="$netapp_tv3cNulls"/>
+          <param name="graph-legend" value="Null Requests/s"/>
+        </leaf>
+        <leaf name="Getattrs">
+          <param name="comment"      value="Get File Attributes"/>
+          <param name="rrd-ds"       value="tv3cGetattrs"/>
+          <param name="snmp-object"  value="$netapp_tv3cGetattrs"/>
+          <param name="graph-legend" value="Getattrs Requests/s"/>
+        </leaf>
+        <leaf name="Setattrs">
+          <param name="comment"      value="Set File Attributes"/>
+          <param name="rrd-ds"       value="tv3cSetattrs"/>
+          <param name="snmp-object"  value="$netapp_tv3cSetattrs"/>
+          <param name="graph-legend" value="Setattrs Requests/s"/>
+        </leaf>
+        <leaf name="Lookups">
+          <param name="comment"      value="Look Up File Name"/>
+          <param name="rrd-ds"       value="tv3cLookups"/>
+          <param name="snmp-object"  value="$netapp_tv3cLookups"/>
+          <param name="graph-legend" value="Lookup Requests/s"/>
+        </leaf>
+        <leaf name="Access">
+          <param name="comment"      value="Check Access Permission"/>
+          <param name="rrd-ds"       value="tv3cAccesss"/>
+          <param name="snmp-object"  value="$netapp_tv3cAccesss"/>
+          <param name="graph-legend" value="Permission Requests/s"/>
+        </leaf>
+        <leaf name="Readlinks">
+          <param name="comment"      value="Read From Symbolic Link"/>
+          <param name="rrd-ds"       value="tv3cReadlinks"/>
+          <param name="snmp-object"  value="$netapp_tv3cReadlinks"/>
+          <param name="graph-legend" value="Readlinks Requests/s"/>
+        </leaf>
+        <leaf name="Reads">
+          <param name="comment"      value="Reads"/>
+          <param name="rrd-ds"       value="tv3cReads"/>
+          <param name="snmp-object"  value="$netapp_tv3cReads"/>
+          <param name="graph-legend" value="Read Requests/s"/>
+        </leaf>
+        <leaf name="Writes">
+          <param name="comment"      value="Write to File"/>
+          <param name="rrd-ds"       value="tv3cWrites"/>
+          <param name="snmp-object"  value="$netapp_tv3cWrites"/>
+          <param name="graph-legend" value="Write Requests/s"/>
+        </leaf>
+        <leaf name="Creates">
+          <param name="comment"      value="Create File"/>
+          <param name="rrd-ds"       value="tv3cCreates"/>
+          <param name="snmp-object"  value="$netapp_tv3cCreates"/>
+          <param name="graph-legend" value="Create Requests/s"/>
+        </leaf>
+        <leaf name="Mkdir">
+          <param name="comment"      value="Create Directory"/>
+          <param name="rrd-ds"       value="tv3cMkdirs"/>
+          <param name="snmp-object"  value="$netapp_tv3cMkdirs"/>
+          <param name="graph-legend" value="Mkdir Requests/s"/>
+        </leaf>
+        <leaf name="SymLink">
+          <param name="comment"      value="Create SymLink to File"/>
+          <param name="rrd-ds"       value="tv3cSymlinks"/>
+          <param name="snmp-object"  value="$netapp_tv3cSymlinks"/>
+          <param name="graph-legend" value="SymLink Requests/s"/>
+        </leaf>
+        <leaf name="Mknod">
+          <param name="comment"      value="Create a Device"/>
+          <param name="rrd-ds"       value="tv3cMknods"/>
+          <param name="snmp-object"  value="$netapp_tv3cMknods"/>
+          <param name="graph-legend" value="Mknod Requests/s"/>
+        </leaf>
+        <leaf name="Remove">
+          <param name="comment"      value="Remove File"/>
+          <param name="rrd-ds"       value="tv3cRemoves"/>
+          <param name="snmp-object"  value="$netapp_tv3cRemoves"/>
+          <param name="graph-legend" value="Remove Requests/s"/>
+        </leaf>
+        <leaf name="Rmdir">
+          <param name="comment"      value="Remove Directory"/>
+          <param name="rrd-ds"       value="tv3cRmdirs"/>
+          <param name="snmp-object"  value="$netapp_tv3cRmdirs"/>
+          <param name="graph-legend" value="Rmdir Requests/s"/>
+        </leaf>
+        <leaf name="Rename">
+          <param name="comment"      value="Rename File"/>
+          <param name="rrd-ds"       value="tv3cRenames"/>
+          <param name="snmp-object"  value="$netapp_tv3cRenames"/>
+          <param name="graph-legend" value="Rename Requests/s"/>
+        </leaf>
+        <leaf name="Link">
+          <param name="comment"      value="Create Link to File"/>
+          <param name="rrd-ds"       value="tv3cLinks"/>
+          <param name="snmp-object"  value="$netapp_tv3cLinks"/>
+          <param name="graph-legend" value="Link Requests/s"/>
+        </leaf>
+        <leaf name="Readdir">
+          <param name="comment"      value="Read From Directory"/>
+          <param name="rrd-ds"       value="tv3cReaddirs"/>
+          <param name="snmp-object"  value="$netapp_tv3cReaddirs"/>
+          <param name="graph-legend" value="Readdir Requests/s"/>
+        </leaf>
+        <leaf name="ReaddirPlus">
+          <param name="comment"      value="Extended Read From Directory"/>
+          <param name="rrd-ds"       value="tv3cReaddirPluss"/>
+          <param name="snmp-object"  value="$netapp_tv3cReaddirPluss"/>
+          <param name="graph-legend" value="Readdir Requests/s"/>
+        </leaf>
+        <leaf name="Fsstat">
+          <param name="comment"      value="Dynamic File System Information"/>
+          <param name="rrd-ds"       value="tv3cFsstats"/>
+          <param name="snmp-object"  value="$netapp_tv3cFsstats"/>
+          <param name="graph-legend" value="FS Dynamic info Requests/s"/>
+        </leaf>
+        <leaf name="Fsinfos">
+          <param name="comment"      value="Static File System Information"/>
+          <param name="rrd-ds"       value="tv3cFsinfos"/>
+          <param name="snmp-object"  value="$netapp_tv3cFsinfos"/>
+          <param name="graph-legend" value="FS Static info Requests/s"/>
+        </leaf>
+        <leaf name="Pathconf">
+          <param name="comment"      value="POSIX Info Requests"/>
+          <param name="rrd-ds"       value="tv3cPathconfs"/>
+          <param name="snmp-object"  value="$netapp_tv3cPathconfs"/>
+          <param name="graph-legend" value="POSIX info Requests/s"/>
+        </leaf>
+        <leaf name="Commit">
+          <param name="comment"  value="Commit Cached Server Data Requests"/>
+          <param name="rrd-ds"       value="tv3cCommits"/>
+          <param name="snmp-object"  value="$netapp_tv3cCommits"/>
+          <param name="graph-legend" value="Commit Requests/s"/>
+        </leaf>
+      </subtree>
+      <subtree name="nfsv3_Percent">
+        <param name="hidden" value="yes"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="data-file" value="%system-id%_nfsv3.rrd"/>
+        <param name="vertical-label"  value="Calls"/>
+        <leaf name="Null">
+          <param name="comment"      value="Do Nothing Requests"/>
+          <param name="rrd-ds"       value="tv3pNull"/>
+          <param name="snmp-object"  value="$netapp_tv3pNulls"/>
+          <param name="graph-legend" value="Null Requests/s"/>
+        </leaf>
+        <leaf name="Getattrs">
+          <param name="comment"      value="Get File Attributes"/>
+          <param name="rrd-ds"       value="tv3pGetattrs"/>
+          <param name="snmp-object"  value="$netapp_tv3pGetattrs"/>
+          <param name="graph-legend" value="Getattrs Requests/s"/>
+        </leaf>
+        <leaf name="Setattrs">
+          <param name="comment"      value="Set File Attributes"/>
+          <param name="rrd-ds"       value="tv3pSetattrs"/>
+          <param name="snmp-object"  value="$netapp_tv3pSetattrs"/>
+          <param name="graph-legend" value="Setattrs Requests/s"/>
+        </leaf>
+        <leaf name="Lookups">
+          <param name="comment"      value="Look Up File Name"/>
+          <param name="rrd-ds"       value="tv3pLookups"/>
+          <param name="snmp-object"  value="$netapp_tv3pLookups"/>
+          <param name="graph-legend" value="Lookup Requests/s"/>
+        </leaf>
+        <leaf name="Access">
+          <param name="comment"      value="Check Access Permission"/>
+          <param name="rrd-ds"       value="tv3pAccesss"/>
+          <param name="snmp-object"  value="$netapp_tv3pAccesss"/>
+          <param name="graph-legend" value="Permission Requests/s"/>
+        </leaf>
+        <leaf name="Readlinks">
+          <param name="comment"      value="Read From Symbolic Link"/>
+          <param name="rrd-ds"       value="tv3pReadlinks"/>
+          <param name="snmp-object"  value="$netapp_tv3pReadlinks"/>
+          <param name="graph-legend" value="Readlinks Requests/s"/>
+        </leaf>
+        <leaf name="Reads">
+          <param name="comment"      value="Reads"/>
+          <param name="rrd-ds"       value="tv3pReads"/>
+          <param name="snmp-object"  value="$netapp_tv3pReads"/>
+          <param name="graph-legend" value="Read Requests/s"/>
+        </leaf>
+        <leaf name="Writes">
+          <param name="comment"      value="Write to File"/>
+          <param name="rrd-ds"       value="tv3pWrites"/>
+          <param name="snmp-object"  value="$netapp_tv3pWrites"/>
+          <param name="graph-legend" value="Write Requests/s"/>
+        </leaf>
+        <leaf name="Creates">
+          <param name="comment"      value="Create File"/>
+          <param name="rrd-ds"       value="tv3pCreates"/>
+          <param name="snmp-object"  value="$netapp_tv3pCreates"/>
+          <param name="graph-legend" value="Create Requests/s"/>
+        </leaf>
+        <leaf name="Mkdir">
+          <param name="comment"      value="Create Directory"/>
+          <param name="rrd-ds"       value="tv3pMkdirs"/>
+          <param name="snmp-object"  value="$netapp_tv3pMkdirs"/>
+          <param name="graph-legend" value="Mkdir Requests/s"/>
+        </leaf>
+        <leaf name="SymLink">
+          <param name="comment"      value="Create SymLink to File"/>
+          <param name="rrd-ds"       value="tv3pSymlinks"/>
+          <param name="snmp-object"  value="$netapp_tv3pSymlinks"/>
+          <param name="graph-legend" value="SymLink Requests/s"/>
+        </leaf>
+        <leaf name="Mknod">
+          <param name="comment"      value="Create a Device"/>
+          <param name="rrd-ds"       value="tv3pMknods"/>
+          <param name="snmp-object"  value="$netapp_tv3pMknods"/>
+          <param name="graph-legend" value="Mknod Requests/s"/>
+        </leaf>
+        <leaf name="Remove">
+          <param name="comment"      value="Remove File"/>
+          <param name="rrd-ds"       value="tv3pRemoves"/>
+          <param name="snmp-object"  value="$netapp_tv3pRemoves"/>
+          <param name="graph-legend" value="Remove Requests/s"/>
+        </leaf>
+        <leaf name="Rmdir">
+          <param name="comment"      value="Remove Directory"/>
+          <param name="rrd-ds"       value="tv3pRmdirs"/>
+          <param name="snmp-object"  value="$netapp_tv3pRmdirs"/>
+          <param name="graph-legend" value="Rmdir Requests/s"/>
+        </leaf>
+        <leaf name="Rename">
+          <param name="comment"      value="Rename File"/>
+          <param name="rrd-ds"       value="tv3pRenames"/>
+          <param name="snmp-object"  value="$netapp_tv3pRenames"/>
+          <param name="graph-legend" value="Rename Requests/s"/>
+        </leaf>
+        <leaf name="Link">
+          <param name="comment"      value="Create Link to File"/>
+          <param name="rrd-ds"       value="tv3pLinks"/>
+          <param name="snmp-object"  value="$netapp_tv3pLinks"/>
+          <param name="graph-legend" value="Link Requests/s"/>
+        </leaf>
+        <leaf name="Readdir">
+          <param name="comment"      value="Read From Directory"/>
+          <param name="rrd-ds"       value="tv3pReaddirs"/>
+          <param name="snmp-object"  value="$netapp_tv3pReaddirs"/>
+          <param name="graph-legend" value="Readdir Requests/s"/>
+        </leaf>
+        <leaf name="ReaddirPlus">
+          <param name="comment"      value="Extended Read From Directory"/>
+          <param name="rrd-ds"       value="tv3pReaddirPluss"/>
+          <param name="snmp-object"  value="$netapp_tv3pReaddirPluss"/>
+          <param name="graph-legend" value="Readdir Requests/s"/>
+        </leaf>
+        <leaf name="Fsstat">
+          <param name="comment"      value="Dynamic File System Information"/>
+          <param name="rrd-ds"       value="tv3pFsstats"/>
+          <param name="snmp-object"  value="$netapp_tv3pFsstats"/>
+          <param name="graph-legend" value="FS Dynamic info Requests/s"/>
+        </leaf>
+        <leaf name="Fsinfos">
+          <param name="comment"      value="Static File System Information"/>
+          <param name="rrd-ds"       value="tv3pFsinfos"/>
+          <param name="snmp-object"  value="$netapp_tv3pFsinfos"/>
+          <param name="graph-legend" value="FS Static info Requests/s"/>
+        </leaf>
+        <leaf name="Pathconf">
+          <param name="comment"      value="POSIX Info Requests"/>
+          <param name="rrd-ds"       value="tv3pPathconfs"/>
+          <param name="snmp-object"  value="$netapp_tv3pPathconfs"/>
+          <param name="graph-legend" value="POSIX info Requests/s"/>
+        </leaf>
+        <leaf name="Commit">
+          <param name="comment"  value="Commit Cached Server Data Requests"/>
+          <param name="rrd-ds"       value="tv3pCommits"/>
+          <param name="snmp-object"  value="$netapp_tv3pCommits"/>
+          <param name="graph-legend" value="Commit Requests/s"/>
+        </leaf>
+      </subtree>
+      <subtree name="nfsv3_CachedCalls">
+        <param name="hidden" value="yes"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="data-file" value="%system-id%_nfsv3.rrd"/>
+        <param name="vertical-label"  value="Calls"/>
+        <leaf name="Null">
+          <param name="comment"      value="Do Nothing Requests"/>
+          <param name="rrd-ds"       value="tv3ccNull"/>
+          <param name="snmp-object"  value="$netapp_tv3ccNulls"/>
+          <param name="graph-legend" value="Null Requests/s"/>
+        </leaf>
+        <leaf name="Getattrs">
+          <param name="comment"      value="Get File Attributes"/>
+          <param name="rrd-ds"       value="tv3ccGetattrs"/>
+          <param name="snmp-object"  value="$netapp_tv3ccGetattrs"/>
+          <param name="graph-legend" value="Getattrs Requests/s"/>
+        </leaf>
+        <leaf name="Setattrs">
+          <param name="comment"      value="Set File Attributes"/>
+          <param name="rrd-ds"       value="tv3ccSetattrs"/>
+          <param name="snmp-object"  value="$netapp_tv3ccSetattrs"/>
+          <param name="graph-legend" value="Setattrs Requests/s"/>
+        </leaf>
+        <leaf name="Lookups">
+          <param name="comment"      value="Look Up File Name"/>
+          <param name="rrd-ds"       value="tv3ccLookups"/>
+          <param name="snmp-object"  value="$netapp_tv3ccLookups"/>
+          <param name="graph-legend" value="Lookup Requests/s"/>
+        </leaf>
+        <leaf name="Access">
+          <param name="comment"      value="Check Access Permission"/>
+          <param name="rrd-ds"       value="tv3ccAccesss"/>
+          <param name="snmp-object"  value="$netapp_tv3ccAccesss"/>
+          <param name="graph-legend" value="Permission Requests/s"/>
+        </leaf>
+        <leaf name="Readlinks">
+          <param name="comment"      value="Read From Symbolic Link"/>
+          <param name="rrd-ds"       value="tv3ccReadlinks"/>
+          <param name="snmp-object"  value="$netapp_tv3ccReadlinks"/>
+          <param name="graph-legend" value="Readlinks Requests/s"/>
+        </leaf>
+        <leaf name="Reads">
+          <param name="comment"      value="Reads"/>
+          <param name="rrd-ds"       value="tv3ccReads"/>
+          <param name="snmp-object"  value="$netapp_tv3ccReads"/>
+          <param name="graph-legend" value="Read Requests/s"/>
+        </leaf>
+        <leaf name="Writes">
+          <param name="comment"      value="Write to File"/>
+          <param name="rrd-ds"       value="tv3ccWrites"/>
+          <param name="snmp-object"  value="$netapp_tv3ccWrites"/>
+          <param name="graph-legend" value="Write Requests/s"/>
+        </leaf>
+        <leaf name="Creates">
+          <param name="comment"      value="Create File"/>
+          <param name="rrd-ds"       value="tv3ccCreates"/>
+          <param name="snmp-object"  value="$netapp_tv3ccCreates"/>
+          <param name="graph-legend" value="Create Requests/s"/>
+        </leaf>
+        <leaf name="Mkdir">
+          <param name="comment"      value="Create Directory"/>
+          <param name="rrd-ds"       value="tv3ccMkdirs"/>
+          <param name="snmp-object"  value="$netapp_tv3ccMkdirs"/>
+          <param name="graph-legend" value="Mkdir Requests/s"/>
+        </leaf>
+        <leaf name="SymLink">
+          <param name="comment"      value="Create SymLink to File"/>
+          <param name="rrd-ds"       value="tv3ccSymlinks"/>
+          <param name="snmp-object"  value="$netapp_tv3ccSymlinks"/>
+          <param name="graph-legend" value="SymLink Requests/s"/>
+        </leaf>
+        <leaf name="Mknod">
+          <param name="comment"      value="Create a Device"/>
+          <param name="rrd-ds"       value="tv3ccMknods"/>
+          <param name="snmp-object"  value="$netapp_tv3ccMknods"/>
+          <param name="graph-legend" value="Mknod Requests/s"/>
+        </leaf>
+        <leaf name="Remove">
+          <param name="comment"      value="Remove File"/>
+          <param name="rrd-ds"       value="tv3ccRemoves"/>
+          <param name="snmp-object"  value="$netapp_tv3ccRemoves"/>
+          <param name="graph-legend" value="Remove Requests/s"/>
+        </leaf>
+        <leaf name="Rmdir">
+          <param name="comment"      value="Remove Directory"/>
+          <param name="rrd-ds"       value="tv3ccRmdirs"/>
+          <param name="snmp-object"  value="$netapp_tv3ccRmdirs"/>
+          <param name="graph-legend" value="Rmdir Requests/s"/>
+        </leaf>
+        <leaf name="Rename">
+          <param name="comment"      value="Rename File"/>
+          <param name="rrd-ds"       value="tv3ccRenames"/>
+          <param name="snmp-object"  value="$netapp_tv3ccRenames"/>
+          <param name="graph-legend" value="Rename Requests/s"/>
+        </leaf>
+        <leaf name="Link">
+          <param name="comment"      value="Create Link to File"/>
+          <param name="rrd-ds"       value="tv3ccLinks"/>
+          <param name="snmp-object"  value="$netapp_tv3ccLinks"/>
+          <param name="graph-legend" value="Link Requests/s"/>
+        </leaf>
+        <leaf name="Readdir">
+          <param name="comment"      value="Read From Directory"/>
+          <param name="rrd-ds"       value="tv3ccReaddirs"/>
+          <param name="snmp-object"  value="$netapp_tv3ccReaddirs"/>
+          <param name="graph-legend" value="Readdir Requests/s"/>
+        </leaf>
+        <leaf name="ReaddirPlus">
+          <param name="comment"      value="Extended Read From Directory"/>
+          <param name="rrd-ds"       value="tv3ccReaddirPluss"/>
+          <param name="snmp-object"  value="$netapp_tv3ccReaddirPluss"/>
+          <param name="graph-legend" value="Readdir Requests/s"/>
+        </leaf>
+        <leaf name="Fsstat">
+          <param name="comment"      value="Dynamic File System Information"/>
+          <param name="rrd-ds"       value="tv3ccFsstats"/>
+          <param name="snmp-object"  value="$netapp_tv3ccFsstats"/>
+          <param name="graph-legend" value="FS Dynamic info Requests/s"/>
+        </leaf>
+        <leaf name="Fsinfos">
+          <param name="comment"      value="Static File System Information"/>
+          <param name="rrd-ds"       value="tv3ccFsinfos"/>
+          <param name="snmp-object"  value="$netapp_tv3ccFsinfos"/>
+          <param name="graph-legend" value="FS Static info Requests/s"/>
+        </leaf>
+        <leaf name="Pathconf">
+          <param name="comment"      value="POSIX Info Requests"/>
+          <param name="rrd-ds"       value="tv3ccPathconfs"/>
+          <param name="snmp-object"  value="$netapp_tv3ccPathconfs"/>
+          <param name="graph-legend" value="POSIX info Requests/s"/>
+        </leaf>
+        <leaf name="Commit">
+          <param name="comment"  value="Commit Cached Server Data Requests"/>
+          <param name="rrd-ds"       value="tv3ccCommits"/>
+          <param name="snmp-object"  value="$netapp_tv3ccCommits"/>
+          <param name="graph-legend" value="Commit Requests/s"/>
+        </leaf>
+      </subtree>
+      <subtree name="nfsv3_CachedPercent">
+        <param name="hidden" value="yes"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="data-file" value="%system-id%_nfsv3.rrd"/>
+        <param name="vertical-label"  value="Calls"/>
+        <leaf name="Null">
+          <param name="comment"      value="Do Nothing Requests"/>
+          <param name="rrd-ds"       value="tv3cpNull"/>
+          <param name="snmp-object"  value="$netapp_tv3cpNulls"/>
+          <param name="graph-legend" value="Null Requests/s"/>
+        </leaf>
+        <leaf name="Getattrs">
+          <param name="comment"      value="Get File Attributes"/>
+          <param name="rrd-ds"       value="tv3cpGetattrs"/>
+          <param name="snmp-object"  value="$netapp_tv3cpGetattrs"/>
+          <param name="graph-legend" value="Getattrs Requests/s"/>
+        </leaf>
+        <leaf name="Setattrs">
+          <param name="comment"      value="Set File Attributes"/>
+          <param name="rrd-ds"       value="tv3cpSetattrs"/>
+          <param name="snmp-object"  value="$netapp_tv3cpSetattrs"/>
+          <param name="graph-legend" value="Setattrs Requests/s"/>
+        </leaf>
+        <leaf name="Lookups">
+          <param name="comment"      value="Look Up File Name"/>
+          <param name="rrd-ds"       value="tv3cpLookups"/>
+          <param name="snmp-object"  value="$netapp_tv3cpLookups"/>
+          <param name="graph-legend" value="Lookup Requests/s"/>
+        </leaf>
+        <leaf name="Access">
+          <param name="comment"      value="Check Access Permission"/>
+          <param name="rrd-ds"       value="tv3cpAccesss"/>
+          <param name="snmp-object"  value="$netapp_tv3cpAccesss"/>
+          <param name="graph-legend" value="Permission Requests/s"/>
+        </leaf>
+        <leaf name="Readlinks">
+          <param name="comment"      value="Read From Symbolic Link"/>
+          <param name="rrd-ds"       value="tv3cpReadlinks"/>
+          <param name="snmp-object"  value="$netapp_tv3cpReadlinks"/>
+          <param name="graph-legend" value="Readlinks Requests/s"/>
+        </leaf>
+        <leaf name="Reads">
+          <param name="comment"      value="Reads"/>
+          <param name="rrd-ds"       value="tv3cpReads"/>
+          <param name="snmp-object"  value="$netapp_tv3cpReads"/>
+          <param name="graph-legend" value="Read Requests/s"/>
+        </leaf>
+        <leaf name="Writes">
+          <param name="comment"      value="Write to File"/>
+          <param name="rrd-ds"       value="tv3cpWrites"/>
+          <param name="snmp-object"  value="$netapp_tv3cpWrites"/>
+          <param name="graph-legend" value="Write Requests/s"/>
+        </leaf>
+        <leaf name="Creates">
+          <param name="comment"      value="Create File"/>
+          <param name="rrd-ds"       value="tv3cpCreates"/>
+          <param name="snmp-object"  value="$netapp_tv3cpCreates"/>
+          <param name="graph-legend" value="Create Requests/s"/>
+        </leaf>
+        <leaf name="Mkdir">
+          <param name="comment"      value="Create Directory"/>
+          <param name="rrd-ds"       value="tv3cpMkdirs"/>
+          <param name="snmp-object"  value="$netapp_tv3cpMkdirs"/>
+          <param name="graph-legend" value="Mkdir Requests/s"/>
+        </leaf>
+        <leaf name="SymLink">
+          <param name="comment"      value="Create SymLink to File"/>
+          <param name="rrd-ds"       value="tv3cpSymlinks"/>
+          <param name="snmp-object"  value="$netapp_tv3cpSymlinks"/>
+          <param name="graph-legend" value="SymLink Requests/s"/>
+        </leaf>
+        <leaf name="Mknod">
+          <param name="comment"      value="Create a Device"/>
+          <param name="rrd-ds"       value="tv3cpMknods"/>
+          <param name="snmp-object"  value="$netapp_tv3cpMknods"/>
+          <param name="graph-legend" value="Mknod Requests/s"/>
+        </leaf>
+        <leaf name="Remove">
+          <param name="comment"      value="Remove File"/>
+          <param name="rrd-ds"       value="tv3cpRemoves"/>
+          <param name="snmp-object"  value="$netapp_tv3cpRemoves"/>
+          <param name="graph-legend" value="Remove Requests/s"/>
+        </leaf>
+        <leaf name="Rmdir">
+          <param name="comment"      value="Remove Directory"/>
+          <param name="rrd-ds"       value="tv3cpRmdirs"/>
+          <param name="snmp-object"  value="$netapp_tv3cpRmdirs"/>
+          <param name="graph-legend" value="Rmdir Requests/s"/>
+        </leaf>
+        <leaf name="Rename">
+          <param name="comment"      value="Rename File"/>
+          <param name="rrd-ds"       value="tv3cpRenames"/>
+          <param name="snmp-object"  value="$netapp_tv3cpRenames"/>
+          <param name="graph-legend" value="Rename Requests/s"/>
+        </leaf>
+        <leaf name="Link">
+          <param name="comment"      value="Create Link to File"/>
+          <param name="rrd-ds"       value="tv3cpLinks"/>
+          <param name="snmp-object"  value="$netapp_tv3cpLinks"/>
+          <param name="graph-legend" value="Link Requests/s"/>
+        </leaf>
+        <leaf name="Readdir">
+          <param name="comment"      value="Read From Directory"/>
+          <param name="rrd-ds"       value="tv3cpReaddirs"/>
+          <param name="snmp-object"  value="$netapp_tv3cpReaddirs"/>
+          <param name="graph-legend" value="Readdir Requests/s"/>
+        </leaf>
+        <leaf name="ReaddirPlus">
+          <param name="comment"      value="Extended Read From Directory"/>
+          <param name="rrd-ds"       value="tv3cpReaddirPluss"/>
+          <param name="snmp-object"  value="$netapp_tv3cpReaddirPluss"/>
+          <param name="graph-legend" value="Readdir Requests/s"/>
+        </leaf>
+        <leaf name="Fsstat">
+          <param name="comment"      value="Dynamic File System Information"/>
+          <param name="rrd-ds"       value="tv3cpFsstats"/>
+          <param name="snmp-object"  value="$netapp_tv3cpFsstats"/>
+          <param name="graph-legend" value="FS Dynamic info Requests/s"/>
+        </leaf>
+        <leaf name="Fsinfos">
+          <param name="comment"      value="Static File System Information"/>
+          <param name="rrd-ds"       value="tv3cpFsinfos"/>
+          <param name="snmp-object"  value="$netapp_tv3cpFsinfos"/>
+          <param name="graph-legend" value="FS Static info Requests/s"/>
+        </leaf>
+        <leaf name="Pathconf">
+          <param name="comment"      value="POSIX Info Requests"/>
+          <param name="rrd-ds"       value="tv3cpPathconfs"/>
+          <param name="snmp-object"  value="$netapp_tv3cpPathconfs"/>
+          <param name="graph-legend" value="POSIX info Requests/s"/>
+        </leaf>
+        <leaf name="Commit">
+          <param name="comment"  value="Commit Cached Server Data Requests"/>
+          <param name="rrd-ds"       value="tv3cpCommits"/>
+          <param name="snmp-object"  value="$netapp_tv3cpCommits"/>
+          <param name="graph-legend" value="Commit Requests/s"/>
+        </leaf>
+      </subtree>
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/netbotz.xml b/torrus/xmlconfig/vendor/netbotz.xml
new file mode 100644 (file)
index 0000000..78f3bae
--- /dev/null
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Copyright (C) 2009 Stanislav Sinyagin
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+   Marc Haber <mh+rrfw-devel@zugschlus.de>
+
+   NetBotz modular sensors
+
+  $Id: netbotz.xml,v 1.1 2010-12-27 00:04:06 ivan Exp $
+-->
+
+
+<configuration>
+  <definitions>
+   <def name="netbotz_tempSensorValue"
+        value="1.3.6.1.4.1.5528.100.4.1.1.1.2"/>
+   <def name="netbotz_humiSensorValue"
+        value="1.3.6.1.4.1.5528.100.4.1.2.1.2"/>
+   <def name="netbotz_dewPointSensorValue"
+        value="1.3.6.1.4.1.5528.100.4.1.3.1.2"/>
+   <def name="netbotz_audioSensorValue"
+        value="1.3.6.1.4.1.5528.100.4.1.4.1.2"/>
+   <def name="netbotz_airFlowSensorValue"
+        value="1.3.6.1.4.1.5528.100.4.1.5.1.2"/>
+   <def name="netbotz_doorSwitchSensorValue"
+        value="1.3.6.1.4.1.5528.100.4.2.2.1.2"/>
+  </definitions>
+
+  <datasources>
+
+    <template name="netbotz-sensor">
+      <param name="collector-timeoffset-hashstring"
+               value="%system-id%:%netbotz-sensor-index%" />
+      <param name="data-file"
+               value="%system-id%_sensor_%netbotz-sensor-index%.rrd"/>
+      <param name="rrd-ds"            value="value"/>
+      <param name="rrd-cf"            value="AVERAGE"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="nodeid"
+               value="sensor//%nodeid-device%//%netbotz-sensor-index%"/>
+    </template>
+     
+    <template name="netbotz-temp-sensor">
+      <apply-template name="netbotz-sensor"/>
+      <param name="snmp-object"
+               value="$netbotz_tempSensorValue.%netbotz-sensor-index%"/>
+      <param name="collector-scale"   value="10,/" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="graph-upper-limit" value="50" />
+      <param name="upper-limit" value="35" />
+      <param name="vertical-label" value="Degrees Celsius" />
+      <param name="comment" value="Temperature sensor" />
+    </template>
+
+
+    <template name="netbotz-humi-sensor">
+      <apply-template name="netbotz-sensor"/>
+      <param name="snmp-object"
+               value="$netbotz_humiSensorValue.%netbotz-sensor-index%"/>
+      <param name="collector-scale"   value="10,/" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="graph-upper-limit" value="100" />
+      <param name="upper-limit" value="90" />
+      <param name="vertical-label" value="Percent" />
+      <param name="comment" value="Humidity sensor" />
+    </template>
+
+    <template name="netbotz-dew-sensor">
+      <apply-template name="netbotz-sensor"/>
+      <param name="snmp-object"
+               value="$netbotz_dewPointSensorValue.%netbotz-sensor-index%"/>
+      <param name="collector-scale"   value="10,/" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="graph-upper-limit" value="30" />
+      <param name="vertical-label" value="Degrees Celsius" />
+      <param name="comment" value="Dew point sensor" />
+    </template>
+
+    <template name="netbotz-audio-sensor">
+      <apply-template name="netbotz-sensor"/>
+      <param name="snmp-object"
+               value="$netbotz_audioSensorValue.%netbotz-sensor-index%"/>
+      <param name="collector-scale"   value="10,/" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="graph-upper-limit" value="100" />
+      <param name="comment" value="Audio level sensor" />
+    </template>
+
+    <template name="netbotz-air-sensor">
+      <apply-template name="netbotz-sensor"/>
+      <param name="snmp-object"
+               value="$netbotz_airFlowSensorValue.%netbotz-sensor-index%"/>
+      <param name="collector-scale"   value="10,/" />
+      <param name="graph-lower-limit" value="0" />
+      <param name="vertical-label" value="m/min" />
+      <param name="comment" value="Air flow sensor" />
+    </template>
+
+    <template name="netbotz-door-sensor">
+      <apply-template name="netbotz-sensor"/>
+      <param name="snmp-object"
+               value="$netbotz_doorSwitchSensorValue.%netbotz-sensor-index%"/>
+      <param name="graph-lower-limit" value="0" />
+      <param name="vertical-label" value="0=open 1=closed" />
+      <param name="comment" value="Door switch sensor" />
+    </template>
+        
+  </datasources>
+</configuration>
diff --git a/torrus/xmlconfig/vendor/netscreen.xml b/torrus/xmlconfig/vendor/netscreen.xml
new file mode 100644 (file)
index 0000000..0a3f0dc
--- /dev/null
@@ -0,0 +1,128 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2003  Shawn Ferry
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: netscreen.xml,v 1.1 2010-12-27 00:04:21 ivan Exp $
+
+  NetScreen Firewall
+
+-->
+
+<configuration>
+<definitions>
+  <def name="nsResCpuAvg"       value="1.3.6.1.4.1.3224.16.1.1.0"/>
+  <def name="nsResCpuLast1Min"  value="1.3.6.1.4.1.3224.16.1.2.0"/>
+  <def name="nsResCpuLast5Min"  value="1.3.6.1.4.1.3224.16.1.3.0"/>
+  <def name="nsResCpuLast15Min" value="1.3.6.1.4.1.3224.16.1.4.0"/>
+
+  <def name="nsResMemAllocate"  value="1.3.6.1.4.1.3224.16.2.1.0"/>
+  <def name="nsResMemLeft"      value="1.3.6.1.4.1.3224.16.2.2.0"/>
+  <def name="nsResMemFrag"      value="1.3.6.1.4.1.3224.16.2.3.0"/>
+
+  <!-- Active Sessions Does not appear to be supported -->
+  <def name="nsResSessActive"      value="1.3.6.1.4.1.3224.16.3.1.0"/>
+
+  <def name="nsResSessAllocate"    value="1.3.6.1.4.1.3224.16.3.2.0"/>
+  <def name="nsResSessMaxium"      value="1.3.6.1.4.1.3224.16.3.3.0"/>
+  <def name="nsResSessFailed"      value="1.3.6.1.4.1.3224.16.3.4.0"/>
+</definitions>
+
+<datasources>
+
+  <template name="netscreen-cpu-stats">
+    <subtree name="NetScreen_CPU">
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_netscreen_CPU.rrd"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="graph-upper-limit" value="100"/>
+      <param name="vertical-label"  value="Percent"/>
+      <leaf name="CpuAvg">
+        <param name="comment"      value="Average CPU Utilization"/>
+        <param name="rrd-ds"       value="CpuAvg"/>
+        <param name="snmp-object"  value="$nsResCpuAvg"/>
+        <param name="graph-legend" value="Average CPU"/>
+      </leaf>
+      <leaf name="Cpu1Min">
+        <param name="comment"      value="One Minute CPU Utilization"/>
+        <param name="rrd-ds"       value="Cpu1Min"/>
+        <param name="snmp-object"  value="$nsResCpuLast1Min"/>
+        <param name="graph-legend" value="1-minute CPU"/>
+      </leaf>
+      <leaf name="Cpu5Min">
+        <param name="comment"      value="Five Minute CPU Utilization"/>
+        <param name="rrd-ds"       value="Cpu5Min"/>
+        <param name="snmp-object"  value="$nsResCpuLast5Min"/>
+        <param name="graph-legend" value="5-minute CPU"/>
+      </leaf>
+      <leaf name="Cpu15Min">
+        <param name="comment"      value="Fifteen Minute CPU Utilization"/>
+        <param name="rrd-ds"       value="Cpu15Min"/>
+        <param name="snmp-object"  value="$nsResCpuLast15Min"/>
+        <param name="graph-legend" value="15-minute CPU"/>
+      </leaf>
+    </subtree>
+  </template>
+
+  <template name="netscreen-memory-stats">
+    <subtree name="NetScreen_Memory">
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_netscreen_memory.rrd"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="vertical-label"  value="Bytes"/>
+      <leaf name="Allocated_Memory">
+        <param name="comment"      value="Memory Used"/>
+        <param name="rrd-ds"       value="Allocated"/>
+        <param name="snmp-object"  value="$nsResMemAllocate"/>
+        <param name="graph-legend" value="Memory Used"/>
+      </leaf>
+      <leaf name="Free_Memory">
+        <param name="comment"      value="Memory Free"/>
+        <param name="rrd-ds"       value="Free"/>
+        <param name="snmp-object"  value="$nsResMemAllocate"/>
+        <param name="graph-legend" value="Memory Free"/>
+      </leaf>
+      <leaf name="Fragmented_Memory">
+        <param name="comment"      value="Memory Fragments"/>
+        <param name="rrd-ds"       value="Fragments"/>
+        <param name="snmp-object"  value="$nsResMemFrag"/>
+        <param name="graph-legend" value="Memory Fragments"/>
+      </leaf>
+    </subtree>
+  </template>
+
+  <template name="netscreen-sessions-stats">
+      <param name="rrd-create-dstype" value="GAUGE"/>
+      <param name="data-file" value="%system-id%_netscreen_sessions.rrd"/>
+      <param name="graph-lower-limit" value="0"/>
+      <param name="vertical-label" value="sessions"/>
+      <leaf name="Allocated_Sessions">
+        <param name="comment"      value="Allocated Sessions"/>
+        <param name="rrd-ds"       value="allocate_sessions"/>
+        <param name="snmp-object"  value="$nsResSessAllocate"/>
+        <param name="graph-legend" value="Sessions Allocated"/>
+      </leaf>
+      <leaf name="Failed_Sessions">
+        <param name="comment"      value="Failed Sessions"/>
+        <param name="rrd-ds"       value="failed_sessions"/>
+        <param name="snmp-object"  value="$nsResSessFailed"/>
+        <param name="graph-legend" value="Sessions Failed"/>
+      </leaf>
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/paradyne.xdsl.xml b/torrus/xmlconfig/vendor/paradyne.xdsl.xml
new file mode 100644 (file)
index 0000000..203e89a
--- /dev/null
@@ -0,0 +1,159 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2002  Stanislav Sinyagin
+   Copyright (C) 2003  Gord Philpott <gphilpot@mnsi.net>
+
+   File: vendor/paradyne.xdsl.xml
+   Description: Paradyne GranDSLAM definitions and templates for Torrus.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+   $Id: paradyne.xdsl.xml,v 1.1 2010-12-27 00:04:06 ivan Exp $
+-->
+
+
+<!--
+   File Overview:
+   - Several Paradyne DSL cards are supported in this file
+   - ADSL cards are supported through generic/rfc2662.adsl-line.xml
+
+   Requirements:
+   - A Paradyne GranDSLAM 2.0 with any of the following Hotwire cards: ADSL,
+     ReachDSL, G.SHDSL
+   - Torrus 0.1.4 or newer
+
+   Test Environment:
+   - Torrus 0.1.4
+   - Paradyne GranDSLAM 2.0 DSLAM
+   - Hotwire DSL; Model: 8000-B2-211; S/W Release : M04.02.27
+   - Paradyne Hotwire ATM ADSL Line Card;
+     Model: 8365-B1-000; S/W Release: 02.03.54
+   - Paradyne Hotwire ATM G.SHDSL Line Card;
+     Model: 8385-B1-000; S/W Release: 02.03.45
+   - Hotwire IP ReachDSL Line Card; Model: 8314-B3-000; S/W Release: 04.03.10
+
+   To do (GORD):
+   - Margin is big negative number for some interfaces.
+     Are they administratively down? Then RFC2863_IF_MIB excludes them by
+     default. Are they administratively up, but physically down?
+     Then we probably need to optionally exclude them from configuration.
+   - Graph decoration parameters:
+     vertical-label, graph-lower-limit, normal-level, lower-limit
+   - Nice readable names for leaves
+-->
+
+
+<configuration>
+
+<definitions>
+  <!-- HOTWIRE-XDSL-INTERFACE-MIB -->
+  <def name="xdslDevIfStatsElapsedTimeLinkUp"
+                value="1.3.6.1.4.1.1795.2.24.2.6.8.1.1.1.1.4" />
+  <def name="xdslDevIfStatsUpStreamSpeed"
+                value="1.3.6.1.4.1.1795.2.24.2.6.8.1.1.1.1.6" />
+  <def name="xdslDevIfStatsCentralRecMargin"
+                value="1.3.6.1.4.1.1795.2.24.2.6.8.1.1.1.1.8" />
+  <def name="xdslDevIfStatsCentralRecAttenuationEstimate"
+                value="1.3.6.1.4.1.1795.2.24.2.6.8.1.1.1.1.9" />
+  <def name="xdslDevIfStatsRemoteRecMargin"
+                value="1.3.6.1.4.1.1795.2.24.2.6.8.1.1.1.1.15" />
+  <def name="xdslDevIfStatsRemoteRecAttenuationEstimate"
+                value="1.3.6.1.4.1.1795.2.24.2.6.8.1.1.1.1.16" />
+</definitions>
+
+<datasources>
+
+  <!-- ####### START: Paradyne Hotwire ATM xDSL Line Card Template ####### -->
+  <template name="paradyne-xdsl-interface">
+
+    <leaf name="xdslTimeLinkUp">
+      <param name="comment"            value="xdsl Elapsed Time Link Up" />
+      <param name="snmp-object">
+        $xdslDevIfStatsElapsedTimeLinkUp.%ifindex-map%.%xdsl-stats-interval%
+      </param>
+      <param name="rrd-ds"             value="xdslTimeLinkUp" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_xdsl.rrd" />
+    </leaf>
+
+    <leaf name="ifSpeed_Downstream">
+      <param name="comment"            value="xdsl Downstream Speed" />
+      <param name="snmp-object"        value="$ifSpeed.%ifindex-map%" />
+      <param name="rrd-ds"             value="ifSpeedDownstream" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_xdsl.rrd" />
+    </leaf>
+
+    <leaf name="xdslUpStreamSpeed">
+      <param name="comment"            value="xdsl UpStream Speed" />
+      <param name="snmp-object">
+        $xdslDevIfStatsUpStreamSpeed.%ifindex-map%.%xdsl-stats-interval%
+      </param>
+      <param name="rrd-ds"             value="xdslUpStreamSpeed" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_xdsl.rrd" />
+    </leaf>
+
+    <leaf name="xdslCentRecMargin">
+      <param name="comment"            value="xdsl Central Rec Margin" />
+      <param name="snmp-object">
+        $xdslDevIfStatsCentralRecMargin.%ifindex-map%.%xdsl-stats-interval%
+      </param>
+      <param name="rrd-ds"             value="xdslCRecMargin" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_xdsl.rrd" />
+    </leaf>
+
+    <leaf name="xdslCentRecAttenEst">
+      <param name="comment"   value="xdsl Central Rec Attenuation Estimate" />
+      <param name="snmp-object">
+       $xdslDevIfStatsCentralRecAttenuationEstimate.%ifindex-map%.%xdsl-stats-interval%
+      </param>
+      <param name="rrd-ds"             value="xdslCRecAttenEst" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_xdsl.rrd" />
+    </leaf>
+
+    <leaf name="xdslRemRecMargin">
+      <param name="comment"            value="xdsl Remote Rec Margin" />
+      <param name="snmp-object">
+       $xdslDevIfStatsRemoteRecMargin.%ifindex-map%.%xdsl-stats-interval%
+      </param>
+      <param name="rrd-ds"             value="xdslRRecMargin" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_xdsl.rrd" />
+    </leaf>
+
+    <leaf name="xdslRemRecAttenEst">
+      <param name="comment"     value="xdsl Remote Rec Attenuation Estimate" />
+      <param name="snmp-object">
+       $xdslDevIfStatsRemoteRecAttenuationEstimate.%ifindex-map%.%xdsl-stats-interval%
+      </param>
+      <param name="rrd-ds"             value="xdslRRecAttenEst" />
+      <param name="rrd-create-dstype"  value="GAUGE" />
+      <param name="data-file"
+             value="%system-id%_%interface-nick%_xdsl.rrd" />
+    </leaf>
+  </template>
+
+</datasources>
+
+</configuration>
diff --git a/torrus/xmlconfig/vendor/symmetricom.xml b/torrus/xmlconfig/vendor/symmetricom.xml
new file mode 100644 (file)
index 0000000..69d1154
--- /dev/null
@@ -0,0 +1,82 @@
+<?xml version="1.0"?>
+<!--
+   Copyright (C) 2007 Jon Nistor
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+  $Id: symmetricom.xml,v 1.1 2010-12-27 00:04:25 ivan Exp $
+  Jon Nistor <nistor at snickers dot org>
+
+-->
+<!-- Symmetricom specific definitions -->
+
+<configuration>
+
+<definitions>
+  <!-- SYMM-SMI -->
+  <def name="ntpSysPrecision"    value="1.3.6.1.4.1.9070.1.2.3.1.5.1.1.3.0"/>
+  <def name="ntpSysPoll"         value="1.3.6.1.4.1.9070.1.2.3.1.5.1.1.8.0"/>
+  <def name="ntpSysPktsReceived" value="1.3.6.1.4.1.9070.1.2.3.1.5.1.1.17.0"/>
+
+</definitions>
+
+
+<datasources>
+  <template name="ntp-stats">
+    <param name="ntpcommon-datafile"  value="%system-id%_NTP_stats.rrd"/>
+    <subtree name="NTP_Stats">
+      <param name="comment">
+        NTP Statistics
+      </param>
+      <param name="data-file"         value="%ntpcommon-datafile%"/>
+      <param name="rrd-create-dstype" value="GAUGE"/>
+
+      <leaf name="Precision">
+        <param name="comment"
+              value="Clock precision in secs to the nearest power of two"/>
+        <param name="graph-legend"    value="Clock precision"/>
+        <param name="vertical-label"  value="log2(sec)"/>
+        <param name="precedence"      value="999"/>
+        <param name="rrd-ds"          value="ntpSysPrecision"/>
+        <param name="rrd-create-min"  value="U"/>
+        <param name="snmp-object"     value="$ntpSysPrecision"/>
+      </leaf>
+      
+      <leaf name="Poll">
+        <param name="comment"
+              value="Min interval between transmitted messages"/>
+        <param name="graph-legend"    value="Polling Interval"/>
+        <param name="vertical-label"  value="Seconds"/>
+        <param name="precedence"      value="998"/>
+        <param name="rrd-ds"          value="ntpSysPoll"/>
+        <param name="snmp-object"     value="$ntpSysPoll"/>
+      </leaf>
+
+      <leaf name="Packts_Received">
+        <param name="comment"
+              value="Number of NTP packets received by SyncServer"/>
+        <param name="graph-legend"    value="Num of NTP Packets Received"/>
+        <param name="vertical-label"  value="Total"/>
+        <param name="precedence"      value="997"/>
+        <param name="rrd-ds"          value="ntpSysPktsReceived"/>
+        <param name="snmp-object"     value="$ntpSysPktsReceived"/>
+      </leaf>
+    </subtree>
+  </template>
+
+</datasources>
+
+</configuration>
+
diff --git a/torrus/xmlconfig/vendor/ucd.ucd-snmp.xml b/torrus/xmlconfig/vendor/ucd.ucd-snmp.xml
new file mode 100644 (file)
index 0000000..287d12b
--- /dev/null
@@ -0,0 +1,523 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (C) 2003 Shawn Ferry
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+
+Shawn Ferry <sferry at sevenspace dot com > <lalartu at obscure dot org>
+
+Author: Shawn Ferry
+Vendor: UCD-SNMP-MIB
+Tested Versions: 0.1.1,0.1.2d
+
+
+$Id $
+@(#) 10/18/03 ucd-snmp.xml 1.8 (10/18/03 19:24:09) sferry
+
+-->
+<!--
+Generic definitions and templates for:
+    UCD-SNMP-MIB
+-->
+<configuration>
+  <definitions>
+    <!-- Memory -->
+    <def name="ucd_memTotalSwap"         value="1.3.6.1.4.1.2021.4.3.0"/>
+    <def name="ucd_memAvailSwap"         value="1.3.6.1.4.1.2021.4.4.0"/>
+    <def name="ucd_memTotalReal"         value="1.3.6.1.4.1.2021.4.5.0"/>
+    <def name="ucd_memAvailReal"         value="1.3.6.1.4.1.2021.4.6.0"/>
+    <def name="ucd_memTotalFree"         value="1.3.6.1.4.1.2021.4.11.0"/>
+
+    <!-- System Stat -->
+    <def name="ucd_ssSwapIn"             value="1.3.6.1.4.1.2021.11.3.0"/>
+    <def name="ucd_ssSwapOut"            value="1.3.6.1.4.1.2021.11.4.0"/>
+
+    <!-- CPU -->
+    <def name="ucd_ssCpuRawUser"         value="1.3.6.1.4.1.2021.11.50.0"/>
+    <def name="ucd_ssCpuRawNice"         value="1.3.6.1.4.1.2021.11.51.0"/>
+    <def name="ucd_ssCpuRawSystem"       value="1.3.6.1.4.1.2021.11.52.0"/>
+    <def name="ucd_ssCpuRawIdle"         value="1.3.6.1.4.1.2021.11.53.0"/>
+    <def name="ucd_ssCpuRawWait"         value="1.3.6.1.4.1.2021.11.54.0"/>
+    <def name="ucd_ssCpuRawKernel"       value="1.3.6.1.4.1.2021.11.55.0"/>
+    <def name="ucd_ssCpuRawInterrupts"   value="1.3.6.1.4.1.2021.11.56.0"/>
+    <def name="ucd_ssCpuRawSoftIRQ"      value="1.3.6.1.4.1.2021.11.61.0"/>
+
+    <!-- Block IO -->
+    <def name="ucd_ssIORawSent"          value="1.3.6.1.4.1.2021.11.57.0"/>
+    <def name="ucd_ssIORawReceived"      value="1.3.6.1.4.1.2021.11.58.0"/>
+    <def name="ucd_ssRawInterrupts"      value="1.3.6.1.4.1.2021.11.59.0"/>
+    <def name="ucd_ssRawContexts"        value="1.3.6.1.4.1.2021.11.60.0"/>
+
+    <!-- Load Average -->
+    <def name="ucd_laLoad"               value="1.3.6.1.4.1.2021.10.1.3"/>
+
+  </definitions>
+
+  <datasources>
+
+      <!-- REAL MEMORY -->
+
+      <template name="ucdsnmp-memory-real">
+        <leaf name="Memory_Real">
+          <param name="comment" value="Real Memory"/>
+          <param name="vertical-label" value="Bytes"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="rrd-scaling-base" value="1024"/>
+          <param name="ds-names" value="total,avail"/>
+          <!-- TOTAL -->
+          <param name="ds-expr-total" value="{ucd_memTotalReal},1024,*"/>
+          <param name="graph-legend-total" value="Total Real"/>
+          <param name="line-style-total" value="##totalresource"/>
+          <param name="line-color-total" value="##totalresource"/>
+          <param name="line-order-total" value="1"/>
+          <!-- AVAIL -->
+          <param name="ds-expr-avail" value="{ucd_memAvailReal},1024,*"/>
+          <param name="graph-legend-avail" value="Available Real"/>
+          <param name="line-style-avail" value="##resourceusage"/>
+          <param name="line-color-avail" value="##resourceusage"/>
+          <param name="line-order-avail" value="2"/>
+        </leaf>
+
+        <leaf name="ucd_memTotalReal">
+          <param name="data-file" value="%system-id%_ucd-memreal.rrd"/>
+          <param name="hidden" value="yes"/>
+          <param name="snmp-object" value="$ucd_memTotalReal"/>
+          <param name="rrd-ds" value="ucd_memTotalReal"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="comment" value="Total Real Space"/>
+          <param name="graph-legend" value="Total Real Space"/>
+          <param name="rrd-scaling-base" value="1024"/>
+          <param name="vertical-label" value="Kilobytes"/>
+        </leaf>
+
+        <leaf name="ucd_memAvailReal">
+          <param name="data-file" value="%system-id%_ucd-memreal.rrd"/>
+          <param name="hidden" value="yes"/>
+          <param name="snmp-object" value="$ucd_memAvailReal"/>
+          <param name="rrd-ds" value="ucd_memAvailReal"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="comment" value="Available Real Space"/>
+          <param name="graph-legend" value="Available Real Space"/>
+          <param name="rrd-scaling-base" value="1024"/>
+          <param name="vertical-label" value="Kilobytes"/>
+        </leaf>
+      </template>
+
+      <!-- SWAP MEMORY -->
+
+      <template name="ucdsnmp-memory-swap">
+        <leaf name="Memory_Swap">
+          <param name="comment" value="Swap Space"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="rrd-scaling-base" value="1024"/>
+          <param name="ds-names" value="total,avail"/>
+          <!-- TOTAL -->
+          <param name="ds-expr-total" value="{ucd_memTotalSwap},1024,*"/>
+          <param name="graph-legend-total" value="Total Swap"/>
+          <param name="line-style-total" value="##totalresource"/>
+          <param name="line-color-total" value="##totalresource"/>
+          <param name="line-order-total" value="1"/>
+          <!-- AVAIL -->
+          <param name="ds-expr-avail" value="{ucd_memAvailSwap},1024,*"/>
+          <param name="graph-legend-avail" value="Available Swap"/>
+          <param name="line-style-avail" value="##resourceusage"/>
+          <param name="line-color-avail" value="##resourceusage"/>
+          <param name="line-order-avail" value="2"/>
+        </leaf>
+
+        <leaf name="ucd_memAvailSwap">
+          <param name="data-file" value="%system-id%_ucd-memswap.rrd"/>
+          <param name="hidden" value="yes"/>
+          <param name="snmp-object" value="$ucd_memAvailSwap"/>
+          <param name="rrd-ds" value="ucd_memAvailSwap"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="comment" value="Available Swap Space"/>
+          <param name="graph-legend" value="Available Swap Space"/>
+          <param name="rrd-scaling-base" value="1024"/>
+        </leaf>
+
+        <leaf name="ucd_memTotalSwap">
+          <param name="data-file" value="%system-id%_ucd-memswap.rrd"/>
+          <param name="hidden" value="yes"/>
+          <param name="snmp-object" value="$ucd_memTotalSwap"/>
+          <param name="rrd-ds" value="ucd_memTotalSwap"/>
+          <param name="rrd-create-dstype" value="GAUGE"/>
+          <param name="comment" value="Total Swap Space"/>
+          <param name="graph-legend" value="Total Swap Space"/>
+          <param name="rrd-scaling-base" value="1024"/>
+        </leaf>
+      </template>
+
+
+    <!-- UCD Block IO Template  -->
+
+    <template name="ucdsnmp-blockio">
+        <leaf name="BlockIO">
+          <param name="comment" value="Block Device Requests and Responses"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="requested,received"/>
+
+          <param name="ds-expr-received" value="{IORawReceived}"/>
+          <param name="graph-legend-received" value="Requests Received"/>
+          <param name="line-style-received" value="##in"/>
+          <param name="line-color-received" value="##in"/>
+          <param name="line-order-received" value="1"/>
+
+          <param name="ds-expr-requested" value="{IORawSent}"/>
+          <param name="graph-legend-requested" value="Requests Sent"/>
+          <param name="line-style-requested" value="##out"/>
+          <param name="line-color-requested" value="##out"/>
+          <param name="line-order-requested" value="2"/>
+        </leaf>
+
+        <leaf name="IORawReceived">
+          <param name="hidden" value="yes"/>
+          <param name="snmp-object" value="$ucd_ssIORawReceived"/>
+          <param name="data-file" value="%system-id%_ucd-blockio.rrd"/>
+          <param name="rrd-ds" value="ucd_ssIORawReceived"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="comment" value="Requests Received From a Block Device"/>
+          <param name="graph-legend" value="Requests Received"/>
+        </leaf>
+
+        <leaf name="IORawSent">
+          <param name="hidden" value="yes"/>
+          <param name="snmp-object" value="$ucd_ssIORawSent"/>
+          <param name="data-file" value="%system-id%_ucd-blockio.rrd"/>
+          <param name="rrd-ds" value="ucd_ssIORawSent"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="comment" value="Requests Sent to a Block Device"/>
+          <param name="graph-legend" value="Requests Sent"/>
+        </leaf>
+    </template>
+
+    <!--
+         UCD context and interrupts Template
+      -->
+    <template name="ucdsnmp-raw-interrupts">
+
+        <leaf name="Interrupts">
+          <param name="comment" value="Context Switches and Interrupts"/>
+          <param name="ds-type" value="rrd-multigraph"/>
+          <param name="ds-names" value="context,interrupts"/>
+          <!-- Interrupts -->
+          <param name="ds-expr-interrupts" value="{RawInterrupts}"/>
+          <param name="graph-legend-interrupts" value="Interrupts"/>
+          <param name="line-style-interrupts" value="LINE2"/>
+          <param name="line-color-interrupts" value="##one"/>
+          <param name="line-order-interrupts" value="1"/>
+          <!-- Contexts -->
+          <param name="ds-expr-context" value="{RawContexts}"/>
+          <param name="graph-legend-context" value="Context Switches"/>
+          <param name="line-style-context" value="LINE2"/>
+          <param name="line-color-context" value="##two"/>
+          <param name="line-order-context" value="2"/>
+        </leaf>
+
+        <leaf name="RawInterrupts">
+          <param name="hidden" value="yes"/>
+          <param name="snmp-object" value="$ucd_ssRawInterrupts"/>
+          <param name="data-file"
+                   value="%system-id%_ucd-context_interrupts.rrd"/>
+          <param name="rrd-ds" value="ucd_ssRawInterrupts"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="comment" value="Interrupts"/>
+          <param name="graph-legend" value="Interrupts"/>
+        </leaf>
+        <leaf name="RawContexts">
+          <param name="hidden" value="yes"/>
+          <param name="snmp-object" value="$ucd_ssRawContexts"/>
+          <param name="data-file"
+                   value="%system-id%_ucd-context_interrupts.rrd"/>
+          <param name="rrd-ds" value="ucd_ssRawContexts"/>
+          <param name="rrd-create-dstype" value="COUNTER"/>
+          <param name="comment" value="Context Switches"/>
+          <param name="graph-legend" value="Context Switches"/>
+        </leaf>
+    </template>
+
+    <!--  Cpu Templates  -->
+
+    <template name="ucdsnmp-cpu-user-multi">
+      <param name="ds-expr-user" value="{CpuRawUser}"/>
+      <param name="graph-legend-user" value="User"/>
+      <param name="line-style-user" value="STACK"/>
+      <param name="line-color-user" value="##one"/>
+      <param name="line-order-user" value="2"/>
+    </template>
+
+    <template name="ucdsnmp-cpu-user">
+      <leaf name="CpuRawUser">
+        <param name="vertical-label" value="Ticks"/>
+        <param name="data-file" value="%system-id%_ucd_ssCpu.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$ucd_ssCpuRawUser"/>
+        <param name="rrd-ds" value="User"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment">
+            Time Used by User Processes
+        </param>
+        <param name="graph-legend" value="User"/>
+      </leaf>
+    </template>
+
+    <template name="ucdsnmp-cpu-system-multi">
+      <!-- System -->
+      <param name="ds-expr-sys" value="{CpuRawSystem}"/>
+      <param name="graph-legend-sys" value="System"/>
+      <param name="line-style-sys" value="AREA"/>
+      <param name="line-color-sys" value="##two"/>
+      <param name="line-order-sys" value="1"/>
+    </template>
+
+    <template name="ucdsnmp-cpu-system">
+      <leaf name="CpuRawSystem">
+        <param name="vertical-label" value="Ticks"/>
+        <param name="data-file" value="%system-id%_ucd_ssCpu.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$ucd_ssCpuRawSystem"/>
+        <param name="rrd-ds" value="System"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment">
+            Time Used by System Processes
+        </param>
+        <param name="graph-legend" value="System"/>
+      </leaf>
+    </template>
+
+    <template name="ucdsnmp-cpu-wait-multi">
+      <param name="ds-expr-wait" value="{CpuRawWait}"/>
+      <param name="graph-legend-wait" value="Wait"/>
+      <param name="line-style-wait" value="STACK"/>
+      <param name="line-color-wait" value="##three"/>
+      <param name="line-order-wait" value="3"/>
+    </template>
+
+    <template name="ucdsnmp-cpu-wait">
+      <leaf name="CpuRawWait">
+        <param name="vertical-label" value="Ticks"/>
+        <param name="data-file" value="%system-id%_ucd_ssCpu.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$ucd_ssCpuRawWait"/>
+        <param name="rrd-ds" value="Wait"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment">
+            Time Used Processes
+        </param>
+        <param name="graph-legend" value="Wait"/>
+      </leaf>
+    </template>
+
+    <template name="ucdsnmp-cpu-kernel-multi">
+      <param name="ds-expr-kernel" value="{CpuRawKernel}"/>
+      <param name="graph-legend-kernel" value="Kernel"/>
+      <param name="line-style-kernel" value="STACK"/>
+      <param name="line-color-kernel" value="##four"/>
+      <param name="line-order-kernel" value="4"/>
+    </template>
+
+    <template name="ucdsnmp-cpu-kernel">
+      <leaf name="CpuRawKernel">
+        <param name="vertical-label" value="Ticks"/>
+        <param name="data-file" value="%system-id%_ucd_ssCpu.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$ucd_ssCpuRawKernel"/>
+        <param name="rrd-ds" value="Kernel"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment">
+            Time Used by Kernel
+        </param>
+        <param name="graph-legend" value="Kernel"/>
+      </leaf>
+    </template>
+
+    <template name="ucdsnmp-cpu-idle-multi">
+      <param name="ds-expr-idle" value="{CpuRawIdle}"/>
+      <param name="graph-legend-idle" value="Idle"/>
+      <param name="line-style-idle" value="STACK"/>
+      <param name="line-color-idle" value="##gray"/>
+      <param name="line-order-idle" value="100"/>
+    </template>
+
+    <template name="ucdsnmp-cpu-idle">
+      <leaf name="CpuRawIdle">
+        <param name="vertical-label" value="Ticks"/>
+        <param name="data-file" value="%system-id%_ucd_ssCpu.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$ucd_ssCpuRawIdle"/>
+        <param name="rrd-ds" value="Idle"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment">
+            Time Idle
+        </param>
+        <param name="graph-legend" value="Idle"/>
+      </leaf>
+    </template>
+
+    <template name="ucdsnmp-cpu-nice-multi">
+      <param name="ds-expr-nice" value="{CpuRawNice}"/>
+      <param name="graph-legend-nice" value="Nice"/>
+      <param name="line-style-nice" value="STACK"/>
+      <param name="line-color-nice" value="##five"/>
+      <param name="line-order-nice" value="5"/>
+    </template>
+
+    <template name="ucdsnmp-cpu-nice">
+      <leaf name="CpuRawNice">
+        <param name="vertical-label" value="Ticks"/>
+        <param name="data-file" value="%system-id%_ucd_ssCpu.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$ucd_ssCpuRawNice"/>
+        <param name="rrd-ds" value="Nice"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment">
+            Time Used by Nice Processes
+        </param>
+        <param name="graph-legend" value="Nice"/>
+      </leaf>
+    </template>
+
+    <template name="ucdsnmp-cpu-interrupts-multi">
+      <param name="ds-expr-int" value="{CpuRawInterrupts}"/>
+      <param name="graph-legend-int" value="Interrupts"/>
+      <param name="line-style-int" value="STACK"/>
+      <param name="line-color-int" value="##six"/>
+      <param name="line-order-int" value="6"/>
+    </template>
+
+    <template name="ucdsnmp-cpu-interrupts">
+      <leaf name="CpuRawInterrupts">
+        <param name="vertical-label" value="Ticks"/>
+        <param name="data-file" value="%system-id%_ucd_ssCpu.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$ucd_ssCpuRawInterrupts"/>
+        <param name="rrd-ds" value="Interrupts"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment">
+            Time Used for Interrupt Processing
+        </param>
+        <param name="graph-legend" value="Interrupts"/>
+      </leaf>
+    </template>
+
+    <template name="ucdsnmp-cpu-softirq-multi">
+      <param name="ds-expr-softirq" value="{CpuRawSoftIRQ}"/>
+      <param name="graph-legend-softirq" value="SoftIRQ"/>
+      <param name="line-style-softirq" value="STACK"/>
+      <param name="line-color-softirq" value="##seven"/>
+      <param name="line-order-softirq" value="7"/>
+    </template>
+
+    <template name="ucdsnmp-cpu-softirq">
+      <leaf name="CpuRawSoftIRQ">
+        <param name="vertical-label" value="Ticks"/>
+        <param name="data-file" value="%system-id%_ucd_ssCpu.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$ucd_ssCpuRawSoftIRQ"/>
+        <param name="rrd-ds" value="SoftIRQ"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="COUNTER"/>
+        <param name="comment">
+            Time Used for Software Interrupt Processing
+        </param>
+        <param name="graph-legend" value="SoftIRQs"/>
+      </leaf>
+    </template>
+
+
+    <!-- LOAD AVERAGE -->
+    <template name="ucdsnmp-load-average">
+      <leaf name="Load_Average">
+        <param name="vertical-label" value="Load Average"/>
+        <param name="comment" value="1, 5, and 15 Minute Load Average"/>
+        <param name="ds-type" value="rrd-multigraph"/>
+        <param name="ds-names" value="one,five,fifteen"/>
+
+        <param name="ds-expr-one" value="{loadAverage1Min},100,/"/>
+        <param name="graph-legend-one" value="1 Minute"/>
+        <param name="line-style-one" value="LINE2"/>
+        <param name="line-color-one" value="##one"/>
+        <param name="line-order-one" value="1"/>
+
+        <param name="ds-expr-five" value="{loadAverage5Min},100,/"/>
+        <param name="graph-legend-five" value="5 Minutes"/>
+        <param name="line-style-five" value="LINE2"/>
+        <param name="line-color-five" value="##two"/>
+        <param name="line-order-five" value="2"/>
+
+        <param name="ds-expr-fifteen" value="{loadAverage15Min},100,/"/>
+        <param name="graph-legend-fifteen" value="15 Minutes"/>
+        <param name="line-style-fifteen" value="LINE2"/>
+        <param name="line-color-fifteen" value="##three"/>
+        <param name="line-order-fifteen" value="3"/>
+      </leaf>
+
+      <leaf name="loadAverage1Min">
+        <param name="vertical-label" value="Load Average"/>
+        <param name="data-file" value="%system-id%_ucd-loadave.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$ucd_laLoad.1"/>
+        <param name="rrd-ds" value="loadAverage1Min"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="line-color" value="##one"/>
+        <param name="comment" value="One Minute Load Average"/>
+        <param name="graph-legend" value="1 Min"/>
+      </leaf>
+      <leaf name="loadAverage5Min">
+        <param name="vertical-label" value="Load Average"/>
+        <param name="data-file" value="%system-id%_ucd-loadave.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$ucd_laLoad.2"/>
+        <param name="rrd-ds" value="loadAverage5Min"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="line-color" value="##two"/>
+        <param name="comment" value="Five Minute Load Average"/>
+        <param name="graph-legend" value="5 Min"/>
+      </leaf>
+      <leaf name="loadAverage15Min">
+        <param name="vertical-label" value="Load Average"/>
+        <param name="data-file" value="%system-id%_ucd-loadave.rrd"/>
+        <param name="hidden" value="yes"/>
+        <param name="leaf-type" value="rrd-def"/>
+        <param name="snmp-object" value="$ucd_laLoad.3"/>
+        <param name="rrd-ds" value="loadAverage15Min"/>
+        <param name="rrd-cf" value="AVERAGE"/>
+        <param name="rrd-create-dstype" value="GAUGE"/>
+        <param name="line-color" value="##three"/>
+        <param name="comment" value="Fifteen Minute Load Average"/>
+        <param name="graph-legend" value="15 Min"/>
+      </leaf>
+    </template>
+  </datasources>
+</configuration>