The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

ASNMTAP::Asnmtap::Applications is a Perl module that provides a nice object oriented interface for ASNMTAP Applications

Description

ASNMTAP::Asnmtap::Applications Subclass of ASNMTAP::Asnmtap

This version is still the old ASNMTAP Applications v3.000.001 addapted for using with the new ASNMTAP::Asnmtap, ASNMTAP::Asnmtap::Plugins and ASNMTAP::Asnmtap::Plugins::Nagios plugins.

We are working onto an new Object Oriented version for the ASNMTAP Applications

CONFIG FILES

located at /opt/asnmtap/applications
Applications.cnf

General configuration file for the ASNMTAP Applications

log4perl.cnf

General configuration file for the log4perl integration for the ASNMTAP Applications

HTML to PDF

For testing HTML to PDF you can rename /opt/asnmtap/applications/htmlroot/img/logos/bodyimage.gif-orig to /opt/asnmtap/applications/htmlroot/img/logos/bodyimage.gif

You can lateron copy your wanted bodyimage picture to /opt/asnmtap/applications/htmlroot/img/logos/bodyimage.gif or you can change te parameter <COMMON><HTMLTOPDF>OPTIONS into the Applications.cnf config file.

 <COMMON>
   <HTMLTOPDF>
     OPTIONS --bodyimage /opt/asnmtap/applications/htmlroot/img/logos/bodyimage.gif --charset iso-8859-1 --format pdf14 --size A4 --landscape --browserwidth 1280 --top 10mm --bottom 10mm --left 10mm --right 10mm --fontsize 10.0 --fontspacing 1.2 --headingfont Helvetica --bodyfont Helvetica --headfootsize 10.0 --headfootfont Helvetica --embedfonts --pagemode fullscreen --permissions no-copy,print --no-links --color --quiet --webpage
   </HTMLTOPDF>
 </COMMON>

If you change the --bodyimage parameter, don't forget also to change the same parameter into the file /opt/asnmtap/applications/htmlroot/cgi-bin/htmldoc.sh for the on the fly HTML to PDF generating.

located at /opt/asnmtap/applications/etc
ArchiveCT

the config file used by the program archive.pl

when the Application CGI module and CGI applications are installed, this config file is automatically generated by the program generateConfig.pl

format
 format: <resultsdir>#[<catalogID>_]<uniqueKey>#check_nnn[|[<catalogID>_]<uniqueKey>#check_mmm]

   <resultsdir> : results subdir where the data from the collector is located
   <catalogID>  : unique catalogID
   <uniqueKey>  : unique key for this plugin
   check_nnn    : plugin name
example
 more /opt/asnmtap/applications/etc/ArchiveCT

 # ArchiveCT - CTP-CENTRAL, generated on 2010/dd/mm 17:58:36, ASNMTAP v3.002.003 or higher
 #
 # <resultsdir>#[<catalogID>_]<uniqueKey>#check_nnn[|[<catalogID>_]<uniqueKey>#check_mmm]
 #
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 #
 _ASNMTAP#_ASNMTAP#CID_collectorDaemonSchedulingReports.pl
 #
 test-01#CID_DUMMY-T1#check_dummy.pl
 #
 test-02#CID_DUMMY-T2#check_dummy.pl
 #
 test-03#CID_DUMMY-T3#check_dummy.pl
 #
 test-04#CID_DUMMY-T4#check_dummy.pl
 #
 test-05#CID_DUMMY-T5#check_dummy.pl
 #
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 # Einde ArchiveCT - CTP-CENTRAL
located at /opt/asnmtap/applications/master
rsync-wrapper-failover-*.sh
rsync
 mkdir /home/asnmtap/.ssh
 chown -R asnmtap:asnmtap /home/asnmtap/.ssh

 ssh-keygen -t rsa -f /home/asnmtap/.ssh/rsync -N ""
 # or
 ssh-keygen -t dsa -f /home/asnmtap/.ssh/rsync -N ""
testing
 ssh -i /home/asnmtap/.ssh/rsync asnmtap@probe
   ... Access Denied! Sorry
   Connection to probe closed.

 rsync -e "ssh -i /home/asnmtap/.ssh/rsync" -a /opt/asnmtap/results/test/ asnmtap@probe.citap.be:/opt/asnmtap/results/test/ -v -c -z --exclude=*-all.txt --exclude=*-nok.txt --exclude=*-KnownError --exclude=*.tmp --exclude=*.sql
   building file list ... done
   ./
   yyyymmdd-check_dummy-PROBE-01-T1-csv.txt
   ...

 /opt/asnmtap/applications/slave/rsync-mirror-distributed-probe.citap.be.sh
   building file list ... done
   yyyymmdd-check_dummy-PROBE-01-T5-csv.txt
   ...
   sent nnnn bytes received nnnn bytes nnnn.nn bytes/sec
   total size is nnnn speedup is nnnn.nn

   when problems: check value off 'KeyRsync'
linux
standalone
 ln -s /opt/asnmtap/applications/master/root-display.sh /etc/init.d/root-display

 ln -s /etc/init.d/root-display /etc/rc3.d/S99root-display
 ln -s /etc/init.d/root-display /etc/rc3.d/K99root-display
 ln -s /etc/init.d/root-display /etc/rc2.d/S99root-display
 ln -s /etc/init.d/root-display /etc/rc2.d/K99root-display
 
 ln -s /opt/asnmtap/applications/master/root-collector.sh /etc/init.d/root-collector

 ln -s /etc/init.d/root-collector /etc/rc3.d/S99root-collector
 ln -s /etc/init.d/root-collector /etc/rc3.d/K99root-collector
 ln -s /etc/init.d/root-collector /etc/rc2.d/S99root-collector
 ln -s /etc/init.d/root-collector /etc/rc2.d/K99root-collector

 ln -s /opt/asnmtap/applications/bin/root-importDataThroughCatalog.sh /etc/init.d/root-importDataThroughCatalog

 ln -s /etc/init.d/root-importDataThroughCatalog /etc/rc3.d/S99root-importDataThroughCatalog
 ln -s /etc/init.d/root-importDataThroughCatalog /etc/rc3.d/K99root-importDataThroughCatalog
 ln -s /etc/init.d/root-importDataThroughCatalog /etc/rc2.d/S99root-importDataThroughCatalog
 ln -s /etc/init.d/root-importDataThroughCatalog /etc/rc2.d/K99root-importDataThroughCatalog
failover
 more /opt/asnmtap.sh
 #!/bin/sh
 # ---------------------------------------------------------------
 # © Copyright 2004-2011 Alex Peeters [alex.peeters@citap.be]
 # ---------------------------------------------------------------
 # This shell script takes care of starting and stopping

 AMNAME="All ASNMTAP"

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 start() {
   # Start daemons
   echo "Start: '$AMNAME' ..."
   /etc/init.d/root-display start
   /etc/init.d/root-collector start
   /etc/init.d/root-importDataThroughCatalog start
 }

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 stop() {
   # Stop daemons
   echo "Stop: '$AMNAME' ..."
   /etc/init.d/root-display stop
   /etc/init.d/root-collector stop
   /etc/init.d/root-importDataThroughCatalog stop
 }

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 # See how we were called.
 case "$1" in
   start)
            start
            ;;
   stop)
            stop
            ;;
   *)
            echo "Usage: '$AMNAME' {start|stop}"
            exit 1
 esac

 exit 0

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 ln -s /opt/asnmtap.sh /etc/init.d/asnmtap

 ln -s /etc/init.d/asnmtap /etc/rc3.d/S99asnmtap
 ln -s /etc/init.d/asnmtap /etc/rc3.d/K99asnmtap
 ln -s /etc/init.d/asnmtap /etc/rc2.d/S99asnmtap
 ln -s /etc/init.d/asnmtap /etc/rc2.d/K99asnmtap
solaris
standalone
 ln -s /opt/asnmtap/applications/master/root-display.sh   /etc/init.d/root-display

 ln -s /etc/init.d/root-display /etc/rc3.d/S99root-display
 ln -s /etc/init.d/root-display /etc/rc3.d/K99root-display
 ln -s /etc/init.d/root-display /etc/rc0.d/S99root-display
 ln -s /etc/init.d/root-display /etc/rc0.d/K99root-display
 
 ln -s /opt/asnmtap/applications/master/root-collector.sh /etc/init.d/root-collector

 ln -s /etc/init.d/root-collector /etc/rc3.d/S99root-collector
 ln -s /etc/init.d/root-collector /etc/rc3.d/K99root-collector
 ln -s /etc/init.d/root-collector /etc/rc0.d/S99root-collector
 ln -s /etc/init.d/root-collector /etc/rc0.d/K99root-collector

 ln -s /opt/asnmtap/applications/bin/root-importDataThroughCatalog.sh /etc/init.d/root-importDataThroughCatalog

 ln -s /etc/init.d/root-importDataThroughCatalog /etc/rc3.d/S99root-importDataThroughCatalog
 ln -s /etc/init.d/root-importDataThroughCatalog /etc/rc3.d/K99root-importDataThroughCatalog
 ln -s /etc/init.d/root-importDataThroughCatalog /etc/rc2.d/S99root-importDataThroughCatalog
 ln -s /etc/init.d/root-importDataThroughCatalog /etc/rc2.d/K99root-importDataThroughCatalog
failover
 more /opt/asnmtap.sh
 #!/bin/sh
 # ---------------------------------------------------------------
 # © Copyright 2004-2009 Alex Peeters [alex.peeters@citap.be]
 # ---------------------------------------------------------------
 # This shell script takes care of starting and stopping

 AMNAME="All ASNMTAP"

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 start() {
   # Start daemons
   echo "Start: '$AMNAME' ..."
   /etc/init.d/root-display start
   /etc/init.d/root-collector start
   /etc/init.d/root-importDataThroughCatalog start
 }

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 stop() {
   # Stop daemons
   echo "Stop: '$AMNAME' ..."
   /etc/init.d/root-display stop
   /etc/init.d/root-collector stop
   /etc/init.d/root-importDataThroughCatalog stop
 }

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 # See how we were called.
 case "$1" in
   start)
            start
            ;;
   stop)
            stop
            ;;
   *)
            echo "Usage: '$AMNAME' {start|stop}"
            exit 1
 esac

 exit 0

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 ln -s /opt/asnmtap.sh /etc/init.d/asnmtap

 ln -s /etc/init.d/asnmtap /etc/rc3.d/S99asnmtap
 ln -s /etc/init.d/asnmtap /etc/rc3.d/K99asnmtap
 ln -s /etc/init.d/asnmtap /etc/rc2.d/S99asnmtap
 ln -s /etc/init.d/asnmtap /etc/rc2.d/K99asnmtap
located at /opt/asnmtap/applications/slave
linux
failover
 more /opt/asnmtap.sh
 #!/bin/sh
 # ---------------------------------------------------------------
 # © Copyright 2004-2011 Alex Peeters [alex.peeters@citap.be]
 # ---------------------------------------------------------------
 # This shell script takes care of starting and stopping

 AMNAME="All ASNMTAP"

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 start() {
   # Start daemons
   echo "Start: '$AMNAME' ..."
   /etc/init.d/root-display start
   /etc/init.d/root-collector start
   /etc/init.d/root-importDataThroughCatalog start
 }

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 stop() {
   # Stop daemons
   echo "Stop: '$AMNAME' ..."
   /etc/init.d/root-display stop
   /etc/init.d/root-collector stop
   /etc/init.d/root-importDataThroughCatalog stop
 }

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 # See how we were called.
 case "$1" in
   start)
            start
            ;;
   stop)
            stop
            ;;
   *)
            echo "Usage: '$AMNAME' {start|stop}"
            exit 1
 esac

 exit 0

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 ln -s /opt/asnmtap.sh /etc/init.d/asnmtap

 /etc/rc3.d/S99asnmtap /etc/init.d/asnmtap
 /etc/rc3.d/K99asnmtap /etc/init.d/asnmtap
 /etc/rc2.d/S99asnmtap /etc/init.d/asnmtap
 /etc/rc2.d/K99asnmtap /etc/init.d/asnmtap
solaris
failover
 more /opt/asnmtap.sh
 #!/bin/sh
 # ---------------------------------------------------------------
 # © Copyright 2004-2011 Alex Peeters [alex.peeters@citap.be]
 # ---------------------------------------------------------------
 # This shell script takes care of starting and stopping

 AMNAME="All ASNMTAP"

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 start() {
   # Start daemons
   echo "Start: '$AMNAME' ..."
   /etc/init.d/root-display start
   /etc/init.d/root-collector start
   /etc/init.d/root-importDataThroughCatalog start
 }

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 stop() {
   # Stop daemons
   echo "Stop: '$AMNAME' ..."
   /etc/init.d/root-display stop
   /etc/init.d/root-collector stop
   /etc/init.d/root-importDataThroughCatalog stop
 }

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 # See how we were called.
 case "$1" in
   start)
 #            start
            ;;
   stop)
 #            stop
            ;;
   *)
            echo "Usage: '$AMNAME' {start|stop}"
            exit 1
 esac

 exit 0

 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 ln -s /opt/asnmtap.sh /etc/init.d/asnmtap

 /etc/rc3.d/S99asnmtap /etc/init.d/asnmtap
 /etc/rc3.d/K99asnmtap /etc/init.d/asnmtap
 /etc/rc0.d/S99asnmtap /etc/init.d/asnmtap
 /etc/rc0.d/K99asnmtap /etc/init.d/asnmtap

PROGRAMS

located at /opt/asnmtap/applications
archive.pl

the Archiver.

 This perl program
 - create automatically new comments and events archive tables when needed.
 - archiving the comments and events to the correspondending archiving tables
 - removes the old unused cgisess files
 - make backups and zips the csv, sql error, week, debug and report files
 - removes the old zipped csv, sql error, week, debug and report files
archive.sh
Central ASNMTAP
 archive.pl -A ArchiveCT -c F -r T -d T
Central Apache
 archive.pl -c T -r F -d F
Distributed ASNMTAP
 archive.pl -A ArchiveCT -c T -r T -d F

Shell script to run archive.pl with the default command line options

 cd /opt/asnmtap/applications/
 cp archive.sh-orig archive.sh
 chmod 755 archive.sh

 crontab -e
  0  1 * * * /opt/asnmtap/applications/archive.sh > /dev/null

 cd /opt/asnmtap/applications/
 mv archive.sh-orig archive-apache.sh
 chmod 755 archive-apache.sh
 chown <apache>:<apache> archive-apache.sh

 su - <apache>
 crontab -e
  0  1 * * * /opt/asnmtap/applications/archive-apache.sh > /dev/null
located at /opt/asnmtap/applications/bin
generateCollectorDaemonSchedulingReports.pl

this program generating automatically Collector Daemon Scheduling Reports in PDF format

 Located at URL: http://asnmtap.citap.be/results/_ASNMTAP/reports/
generateCollectorDaemonSchedulingReports.sh

Shell script to run generateCollectorDaemonSchedulingReports.pl with the default command line options

 cd /opt/asnmtap/applications/bin
 mv generateCollectorDaemonSchedulingReports.sh-orig generateCollectorDaemonSchedulingReports.sh
 chmod 755 generateCollectorDaemonSchedulingReports.sh

 crontab -e
  0  0 * * * /opt/asnmtap/applications/bin/generateCollectorDaemonSchedulingReports.sh > /dev/null
generateReports.pl

this program generate automatically reports in PDF format, defined by the CGI program reports.pl

generateReports.sh

Shell script to run generateReports.pl with the default command line options

 cd /opt/asnmtap/applications/bin
 mv generateReports.sh-orig generateReports.sh
 chmod 755 generateReports.sh

 crontab -e
 30  0 * * * /opt/asnmtap/applications/bin/generateReports.sh > /dev/null
holidayBundleSetDowntimes.pl

this program automatically set the plugin downtimes, defined by the CGI program plugin.pl and holidaysBundle.pl

holidayBundleSetDowntimes.sh

Shell script to run holidayBundleSetDowntimes.pl with the default command line options

 cd /opt/asnmtap/applications/bin
 mv holidayBundleSetDowntimes.sh-orig holidayBundleSetDowntimes.sh
 chmod 755 holidayBundleSetDowntimes.sh

 crontab -e
 15  0 * * * /opt/asnmtap/applications/bin/holidayBundleSetDowntimes.sh > /dev/null
importDataThroughCatalog.pl

this program imports automatically the data for other distributed/federated catalog members, defined by the CGI program catalog.pl

importDataThroughCatalog.sh

Shell script to run importDataThroughCatalog.pl with the default command line options

 cd /opt/asnmtap/applications/bin
 mv generateReports.sh-orig importDataThroughCatalog.sh
 chmod 755 importDataThroughCatalog.sh

 crontab -e
 30  0 * * * /opt/asnmtap/applications/bin/importDataThroughCatalog.sh --type=CONFIG > /dev/null
 */5 * * * * /opt/asnmtap/applications/bin/importDataThroughCatalog.sh --type=DATA > /dev/null
located at /opt/asnmtap/applications/sbin
bash_stop_root.sh

Shell script to run CollectorCT-*.sh and DisplayCT-*.sh with uid protection.

 cd /opt/asnmtap/applications/sbin
 mv bash_stop_root.sh-orig bash_stop_root.sh
 chmod 755 bash_stop_root.sh

 Modify when required:

 STOP_ROOT=TRUE
   NOTICE: ASNMPTAP has been configured not to run as root !
   WARNING: Running ASNMPTAP as root is not recommended !

 ASNMPTAP_UID=32006
 ASNMPTAP_USER=asnmtap
   NOTICE: ASNMPTAP must be started with shell uid(user) !

 HTTPD_UID=99
   NOTICE: ASNMPTAP must be started with httpd uid !
sshWrapperASNMTAP.pl

ASNMTAP ssh wrapper script for ssh execution through a rsa or dsa key

 Accepted ssh calls are as follows:

   'script $APPLICATIONPATH/master/DisplayCT-<daemon name>.sh stop|start|restart|reload'
   'script $APPLICATIONPATH/slave/DisplayCT-<daemon name>.sh stop|start|restart|reload'

   'script $APPLICATIONPATH/master/CollectorCT-<daemon name>.sh stop|start|restart|reload'
   'script $APPLICATIONPATH/slave/CollectorCT-<daemon name>.sh stop|start|restart|reload'

   'remove $PIDPATH/DisplayCT-<daemon name>.pid'
   'remove $PIDPATH/CollectorCT-<daemon name>.pid'

   'killall <pid>'

 '../' are forbidden into a directory of filename for security reasons !!!

 You need to create an ssh account:

   ssh-keygen -t dsa -f /home/asnmtap/.ssh/asnmtap

   vi /home/asnmtap/.ssh/authorized_keys
   from="localhost", command="/opt/asnmtap/applications/sbin/sshWrapperASNMTAP.pl" ssh-dss AAAAB3Nza...+90k63Mx...3OmZOk= alex.peeters@citap.be
 or with
   from="localhost", command="ASNMTAP_PERL5LIB=/opt/asnmtap/cpan-shared/lib/perl5; /opt/asnmtap/applications/sbin/sshWrapperASNMTAP.pl" ssh-dss AAAAB3Nza...+90k63Mx...3OmZOk= alex.peeters@citap.be

   vi hosts.allow
   ssh: localhost

   vi hosts.deny
   ssh: ALL

   ssh  -i '/home/asnmtap/.ssh/asnmtap' asnmtap@localhost 'killall number'
   ssh  -i '/home/asnmtap/.ssh/asnmtap' asnmtap@localhost 'remove /opt/asnmtap/pid/CollectorCT-zombie.pid'
   ssh  -i '/home/asnmtap/.ssh/asnmtap' asnmtap@localhost 'script /opt/asnmtap/applications/master/CollectorCT-test.sh stop'

 Test sshWrapperASNMTAP.pl:

    ssh  -i '/home/asnmtap/.ssh/ssh' asnmtap@localhost 'killall number'
      SSH REQUEST FAILED INSPECTION - SKIPPING 'killall number'
      EVALUATING 'killall number'
    or
      Couldn't open log '/opt/asnmtap/log/sshWrapperASNMTAP.log'!

    chmod 664 /opt/asnmtap/log/sshWrapperASNMTAP.log 

    ssh  -i '/home/asnmtap/.ssh/ssh' asnmtap@localhost 'script /opt/asnmtap/applications/master/CollectorCT-Configsol2-environment-probe.sh stop'
      EVALUATING 'script /opt/asnmtap/applications/master/CollectorCT-Configsol2-environment-probe.sh stop'
      SSH REQUEST PASSED INSPECTION - INITIATING '/opt/asnmtap/applications/master/CollectorCT-Configsol2-environment-probe.sh stop'
      EXECUTE '/opt/asnmtap/applications/master/CollectorCT-Configsol2-environment-probe.sh stop'
      '/opt/asnmtap/applications/master/CollectorCT-Configsol2-environment-probe.sh stop' COMPLETED

    ssh  -i '/home/asnmtap/.ssh/ssh' asnmtap@localhost 'remove /opt/asnmtap/pid/CollectorCT-Configsol2-environment-probe.pid'
      EVALUATING 'remove /opt/asnmtap/pid/CollectorCT-Configsol2-environment-probe.pid'
      SSH REQUEST PASSED INSPECTION - INITIATING '/bin/rm /opt/asnmtap/pid/CollectorCT-Configsol2-environment-probe.pid'
      EXECUTE '/bin/rm /opt/asnmtap/pid/CollectorCT-Configsol2-environment-probe.pid'
      '/bin/rm /opt/asnmtap/pid/CollectorCT-Configsol2-environment-probe.pid' COMPLETED
  
    more /opt/asnmtap/log/sshWrapperASNMTAP.log 
      ... EVALUATING: 'killall number'
      ... SSH REQUEST FAILED INSPECTION - SKIPPING 'killall number'
      ...

 Dependencies:

 - Getopt::Long
perfparse_asnmtap_pulp_command.pl
 ... TODO ... NO PART OF NORMAL SETUP ...
perfparse_crontab.sh
 ... TODO ... NO PART OF NORMAL SETUP ...
perfparse_crontab_failed.sh
 ... TODO ... NO PART OF NORMAL SETUP ...
perfparse_debug.sh
 ... TODO ... NO PART OF NORMAL SETUP ...
purge_table.pl
 perl /opt/asnmtap/applications/sbin/purge_table.pl -H dtbs.citap.be -D snmptt -T 'snmptt_archive' -u asnmtap -p asnmtap --ago='-14 days'

 perl /opt/asnmtap/applications/sbin/purge_table.pl -H dtbs.citap.be -D snmptt -T 'snmptt_unknown_archive' -u asnmtap -p asnmtap --ago='-14 days'

 ... TODO ... NO PART OF NORMAL SETUP ...

INSTALL

when i have more time, this will also be automated, but for now ...

user asnmtap

DON't run the ASNMTAP Applications under the ROOT account, use one dedicated account for the ASNMTAP Applications instead!

create user asnmtap
 groupadd -g 32005 asnmtap
 useradd -u 32005 -g asnmtap -c ASNMTAP Configuration User -d /home/asnmtap -s /bin/ksh -m asnmtap

 /usr/sbin/groupadd asnmtapcmd
 /usr/sbin/usermod -G asnmtapcmd asnmtap
 /usr/sbin/usermod -G asnmtapcmd nobody
.cronprofile example
 PATH=/usr/local/bin:/usr/local/sbin:/usr/sbin:/etc:/usr/ccs/bin:/usr/bin:/opt/csw/bin:/usr/ucb:${PATH}

 LD_LIBRARY_PATH=/opt/asnmtap/ssl/lib:/usr/local/lib/mysql:/usr/local/lib:/usr/lib/:${LD_LIBRARY_PATH}

 http_proxy=http://proxy.citap.be:8080
 ftp_proxy=http://proxy.citap.be:8080

 alias su=/usr/bin/su
 alias perl=/usr/bin/env perl

 if [ -d /opt/asnmtap/cpan-shared/lib/perl5 ]; then
   PERL5LIB=${PERL5LIB:+$PERL5LIB:}/opt/asnmtap/cpan-shared/lib/perl5
   MANPATH=${MANPATH:+$MANPATH:}/opt/asnmtap/cpan-shared/share/man
 fi

 umask 022
.profile example
 export PATH=/usr/local/bin:/usr/local/sbin:/usr/sbin:/etc:/usr/ccs/bin:/usr/bin:/opt/csw/bin:/usr/ucb:${PATH}

 export LD_LIBRARY_PATH=/opt/asnmtap/ssl/lib:/usr/local/lib/mysql:/usr/local/lib:/usr/lib/:${LD_LIBRARY_PATH}

 export http_proxy=http://proxy.citap.be:8080
 export ftp_proxy=http://proxy.citap.be:8080

 alias su=/usr/bin/su
 alias perl=/usr/bin/env perl

 if [ -d /opt/asnmtap/cpan-shared/lib/perl5 ]; then
   PERL5LIB=${PERL5LIB:+$PERL5LIB:}/opt/asnmtap/cpan-shared/lib/perl5
   MANPATH=${MANPATH:+$MANPATH:}/opt/asnmtap/cpan-shared/share/man
   export MANPATH PERL5LIB
 fi

 umask 022
.bash_profile example
 MAIL=/usr/mail/${LOGNAME:?}

 export PATH

 umask 022
create ssh key

...

 <slave server>:
   ssh-keygen -q -t rsa -f /home/asnmtap/.ssh/ssh -N ''
 or
   ssh-keygen -q -t dsa -f /home/asnmtap/.ssh/ssh -N ''

 chmod go-w   /home/asnmtap/
 chmod 700    /home/asnmtap/.ssh
 chmod go-rwx /home/asnmtap/.ssh/*

 chmod 644 ssh.pub
 chown asnmtap:asnmtap ssh.pub

 chmod 600 ssh
 chown apache:asnmtap ssh

 cat /home/asnmtap/.ssh/ssh.pub >> /home/asnmtap/.ssh/authorized_keys
 chmod 600 /home/asnmtap/.ssh/authorized_keys

 vi /home/asnmtap/.ssh/authorized_keys
   add command='/opt/asnmtap/applications/sbin/sshWrapperASNMTAP.pl' before ssh.pub
 or
   add command='ASNMTAP_PERL5LIB=/opt/asnmtap/cpan-shared/lib/perl5; /opt/asnmtap/applications/sbin/sshWrapperASNMTAP.pl' before ssh.pub
Apache
Install for HTTPS support
 install openssh, openssl, openssl096 & openssl-devel
add /etc/httpd/conf.d/asnmtap.conf
 Link index.html and index-cv.html to the default screens
 [/opt/asnmtap/applications/htmlroot]# ln -s citap.html  index.html
 [/opt/asnmtap/applications/htmlroot]# ln -s citap-cv.html  index-cv.html

 vi /etc/httpd/conf.d/asnmtap.conf

 AddHandler cgi-script .cgi .pl

 DirectoryIndex index.htm index.html index.html.var index.shtml index.cfm index.pl

 <VirtualHost *:80>
   ServerName asnmtap.citap.com
   ServerAlias asnmtap.citap.be
   ServerAdmin webmaster@citap.com
   DocumentRoot /opt/asnmtap/applications/htmlroot
   ErrorLog /var/log/httpd/asnmtap.citap.com-error.log
   CustomLog /var/log/httpd/asnmtap.citap.com-combined.log combined
   IndexIgnore *.png *nok.txt *all.txt *.html
   IndexOptions NameWidth=* FancyIndexing FoldersFirst SuppressDescription
   IndexOrderDefault Ascending Name

   Alias /asnmtap "/opt/asnmtap/applications/htmlroot"

   <Directory "/opt/asnmtap/applications/htmlroot">
     AllowOverride AuthConfig
     Options FollowSymLinks
     Order allow,deny
     Allow from all
   </Directory>

   Alias /results "/opt/asnmtap/results"

   <Directory "/opt/asnmtap/results">
     HeaderName HEADER.html
     ReadmeName FOOTER.html
     AllowOverride AuthConfig
     Options Indexes
   # Options Indexes FollowSymLinks
     Order allow,deny
     Allow from all
   </Directory>

   Alias /config "/opt/asnmtap/applications/tmp/config"

   <Directory "/opt/asnmtap/applications/tmp/config">
     HeaderName HEADER.html
     ReadmeName FOOTER.html
     AllowOverride AuthConfig
     Options Indexes
   # Options Indexes FollowSymLinks
     Order allow,deny
     Allow from all
   </Directory>

   ScriptAlias /asnmtap/cgi-bin/ "/opt/asnmtap/applications/htmlroot/cgi-bin/"

   <Directory "/opt/asnmtap/applications/htmlroot/cgi-bin">
     AllowOverride AuthConfig
     Options ExecCGI
     Order allow,deny
     Allow from all
   </Directory>
 </VirtualHost>
Install Mysql client
 Use rpm or download the source, for version 4.0 or later 'gzip' needed

 when the sourecode used (gcc, g++, binutils & make needed):
   ./configure --without-server
   make
   make install

 yum install mysql-devel
collector.pl need in general
onto the master and slave server:

Standalone monitoring example

MySQL 5.0.x

 database:

  SQLyog -> Db -> Import from SQL Statements ... -> \opt\asnmtap-3.002.xxx\applications\tools\mysql\asnmtap-3.002.003_mysql-v5.0.x.sql
  or
  mysql -u root -p  < /opt/asnmtap/applications/tools/mysql/asnmtap-3.002.003_mysql-v5.0.x.sql

 triggers to make fast display possible for heavy environment:

  SQLyog -> Db -> Import from SQL Statements ... -> \opt\asnmtap-3.002.xxx\applications\tools\mysql\asnmtap-3.002.003_mysql-v5.0.x-trigger-events.sql
  or
  mysql -u root -p  < /opt/asnmtap/applications/tools/mysql/asnmtap-3.002.003_mysql-v5.0.x-trigger-events.sql

  SQLyog -> Db -> Import from SQL Statements ... -> \opt\asnmtap-3.002.xxx\applications\tools\mysql\applications/tools/mysql/asnmtap-3.002.003_mysql-v5.0.x-trigger-eventsUpdate.sql
  or
  mysql -u root -p  < /opt/asnmtap/applications/tools/mysql/applications/tools/mysql/asnmtap-3.002.003_mysql-v5.0.x-trigger-eventsUpdate.sql

  SQLyog -> Db -> Import from SQL Statements ... -> \opt\asnmtap-3.002.xxx\applications\tools\mysql\asnmtap-3.002.003_mysql-v5.0.x-trigger-eventsDisplayData.sql
  or
  mysql -u root -p  < /opt/asnmtap/applications/tools/mysql/asnmtap-3.002.003_mysql-v5.0.x-trigger-eventsDisplayData.sql

Distributed monitoring example

MySQL 5.0.x

 SQLyog -> Db -> Import from SQL Statements ... -> \opt\asnmtap-3.002.xxx\applications\tools\mysql\asnmtap-3.002.003-distributed_mysql-v5.0.x.sql
 or
 mysql -u root -p  < /opt/asnmtap/applications/tools/mysql/asnmtap-3.002.003-distributed_mysql-v5.0.x.sql
onto the master server:
 mysql -u root -p
 mysql> GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, CREATE, CREATE TEMPORARY TABLES, DROP ON asnmtap.* TO 'asnmtap'@'localhost' IDENTIFIED BY 'passwd'; 
 mysql> GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, CREATE, CREATE TEMPORARY TABLES, DROP ON asnmtap.* TO 'asnmtap'@'hostname-master-server' IDENTIFIED BY 'passwd'; 
 mysql> GRANT SELECT ON asnmtap.* TO 'asnmtapro'@'hostname-master-server' IDENTIFIED BY 'passwd-ro';
 mysql> GRANT SELECT, SUPER, REPLICATION CLIENT, REPLICATION SLAVE, RELOAD ON asnmtap.* TO 'replication'@'hostname-slave-server' IDENTIFIED BY 'passwd-replication';
 mysql> FLUSH TABLES WITH READ LOCK;
 mysql> QUIT;

 when master is in production before the slave exist
   mysqldump -u root -p asnmtap > asnmtap.sql
 or for big tables
   make sure mysqld is dead!!!
   tar -cvf /tmp/mysql-snapshot.tar /path/to/data-dir

 mysql -u root -p
 mysql> SHOW MASTER STATUS;
 #      If the master has been previously running without --log-bin enabled, the log
 #      name and position values displayed by SHOW MASTER STATUS will be empty.
 mysql> UNLOCK TABLES;
 mysql> QUIT;

 Write down the parrameters from SHOW MASTER STATUS when master already exists !!!

 Make sure the [mysqld] section of the `my.cnf' file on the master host includes a log-bin option. The section should also have a server-id=master_id option, where master_id must be an integer value from 1 to 2^32 - 1.

 vi /etc/my.cnf
 [mysqld]
   datadir=/var/lib/mysql
   socket=/var/lib/mysql/mysql.sock
   port=3306

   server-id=1
   log-bin=asnmtap
   log-slave-updates
   binlog-ignore-db=mysql
   replicate-ignore-db=mysql
   report-host=slave-server.citap.com
   auto_increment_increment = 2
   auto_increment_offset = 1

 [mysql.server]
   user=mysql
   basedir=/var/lib

 [safe_mysqld]
   err-log=/var/log/mysqld.log
   pid-file=/var/run/mysqld/mysqld.pid

 # If those options are not present, add them and restart the server.

 mysql -u root -p
 mysql> SHOW MASTER STATUS;
 # +---------------+----------+--------------+------------------+
 # |      File     | Position | Binlog_Do_DB | Binlog_Ignore_DB |
 # +---------------+----------+--------------+------------------+
 # | mysql-bin.001 | 73       | checklist    | mysql            |
 # +---------------+----------+--------------+------------------+
 mysql> QUIT;

 Write down the parrameters from SHOW MASTER STATUS, when master didn't exists befire!!!

 The File column shows the name of the log, while Position shows the offset. In the above example, the binary log value is mysql-bin.001 and the offset is 73. Record the values. You will need to use them later when you are setting up the slave. Once you have taken the snapshot and recorded the log name and offset, you can re-enable write activity on the master:
onto the slave server:
 Make sure there are NO update queries on the slave server at this point!!!

 mysql -u root -p
 mysql> STOP SLAVE;                                     <-- if replication was running
 mysql> QUIT;

 when master is in production before the slave exist:

   mysql -u root -p
   mysql> CREATE DATABASE asnmtap;
   mysql> QUIT;
   mysql -u root -p asnmtap < asnmtap.sql
   mysql -u root -p
 or
   make sure mysqld is dead!!!
   copy and untar mysql-snapshot.tar created earlier

 mysql -u root -p
 mysql> GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, CREATE, CREATE TEMPORARY TABLES, DROP ON asnmtap.* TO 'asnmtap'@'localhost' IDENTIFIED BY 'passwd'; 
 mysql> GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, CREATE, CREATE TEMPORARY TABLES, DROP ON asnmtap.* TO 'asnmtap'@'hostname-master-server' IDENTIFIED BY 'passwd'; 
 mysql> GRANT SELECT ON asnmtap.* TO 'asnmtapro'@'hostname-slave-server' IDENTIFIED BY 'passwd-ro';
 mysql> GRANT SELECT, SUPER, REPLICATION CLIENT, REPLICATION SLAVE, RELOAD ON asnmtap.* TO 'replication'@'hostname-master-server' IDENTIFIED BY 'passwd-replication';
 mysql> FLUSH TABLES WITH READ LOCK;
 mysql> QUIT;

 Stop the server that is to be used as a slave server and add the following to its `my.cnf' file. The slave_id value, like the master_id value, must be an integer value from 1 to 2^32 - 1. In addition, it is very important that the ID of the slave be different than the ID of the master. If you are setting up multiple slaves, each one must have a server-id value that differs from that of the master and from each of the other slaves. Think of server-id values as something similar to IP addresses: These IDs uniquely identify each server instance in the community of replication partners. If you don't specify a server-id value, it will be set to 1 if you have not defined master-host, else it will be set to 2. Note that in the case of server-id omission, a master will refuse connections from all slaves, and a slave will refuse to connect to a master. Thus, omitting server-id is only good for backup with a binary log.

 vi /etc/my.cnf
 [mysqld]
   datadir=/var/lib/mysql
   socket=/var/lib/mysql/mysql.sock
   port=3306

   server-id=2
   log-bin=asnmtap
   log-slave-updates
   binlog-ignore-db=mysql
   replicate-ignore-db=mysql
   report-host=master-server.citap.com
   auto_increment_increment = 2
   auto_increment_offset = 2

 [mysql.server]
   user=mysql
   basedir=/var/lib

 [safe_mysqld]
   err-log=/var/log/mysqld.log
   pid-file=/var/run/mysqld/mysqld.pid

 Start the slave server. If it has been replicating previously, start the slave server with the --skip-slave-start option. You also may want to start the slave server with the --log-warnings option. That way, you will get more messages about problems (for example, network or connection problems). If you made a backup of the master server's data using mysqldump, load the dump file into the slave server:

 Execute the following command on the slave, replacing the values within <> with the actual values relevant to your system:

       This is where you put the values you got earlier from SHOW MASTER STATUS from 2)

 mysql> CHANGE MASTER TO
          MASTER_HOST='<master hostname>',
          MASTER_USER='<replication username>',
          MASTER_PASSWORD='<replication password>',
          MASTER_LOG_FILE='<recorded log file name>',   <-- replace with the value show 'SHOW MASTER STATUS' on the master server
          MASTER_LOG_POS=<recorded log offset>;         <-- replace with the value show 'SHOW MASTER STATUS' on the master server

 mysql> START SLAVE;                                    <-- if you want to restart replication

 mysql> SHOW MASTER STATUS;
        write down the values

 mysql> QUIT;

 At this point you got master -> slave replication
onto the master server, part II:
 copy the slave server *.bin.* (binary logs), put it in the master server mysql data dir

 mysql> STOP SLAVE;                                     <-- if replication was running
        This is where you put the values you got earlier from SHOW MASTER STATUS from 3)

 mysql> CHANGE MASTER TO
          MASTER_HOST='<slave hostname>',
          MASTER_USER='<replication username>',
          MASTER_PASSWORD='<replication password>',
          MASTER_LOG_FILE='<recorded log file name>',   <-- replace with the value show 'SHOW MASTER STATUS' on the master server
          MASTER_LOG_POS=<recorded log offset>;         <-- replace with the value show 'SHOW MASTER STATUS' on the master server

 mysql> START SLAVE;                                    <-- if you want to restart replication

 At this point you got master -> slave -> master replication

 You can now execute any query on any of them, and it will appear on both. 

 We will do it always onto the master server, unless the master server is down then we uses the slave server!!!
Update your ASNMTAP configuration
 vi /opt/asnmtap/Asnmtap.cnf

 Here you can modify all the varibales used by the ASNMTAP package !!!

 vi /opt/asnmtap/applications/Applications.cnf

 URL: http://asnmtap.citap.be/asnmtap/cgi-bin/sadmin/index.pl

 regarding the server administrator, the default username: `sadmin` and password: `a1A`

 Now you can build your config !!!
Install perl modules from CPAN
 export http_proxy=http://proxy:8080
 export ftp_proxy=http://proxy:8080

 perl -MCPAN -e shell
 install Bundle::CPAN
 install Bundle::DBI
 install Bundle::DBD::mysql                             # need mysql-devel
Perfparse integration

Perfparse (http://perfparse.sourceforge.net/)

We use the 'Pipe to Perfparse' methode

Compiling Perfparse
 wget http://belnet.dl.sourceforge.net/sourceforge/perfparse/perfparse-0.106.1.tar.gz
 cd /export/download/
 tar -xvzf perfparse-0.106.1.tar.gz
 cd /export/download/perfparse-0.106.1
 ./configure --prefix=/opt/asnmtap/perfparse --with-imagedir=/opt/asnmtap/applications/htmlroot/img/ --with-cgidir=/opt/asnmtap/applications/htmlroot/cgi-bin --with-http_image_path=/asnmtap/img --with-data-source=asnmtap --disable-phpui
 make
 make install-strip
Installing Perfparse database
 cd /export/download/perfparse-0.106.1/scripts
 cat mysql_create.sql | mysql -u root -p -D asnmtap
Configuration of Perfparse v19 for ASNMTAP
 cp /opt/asnmtap/perfparse/etc/perfparse.cfg.example /opt/asnmtap/perfparse/etc/perfparse.cfg

 First you should edit '/opt/asnmtap/perfparse/etc/perfparse.cfg', adding the correct database settings (if using something other than 'nagios' as DB name, username, and password). The options are :

 Use_Storage_Mysql (only in perfparsed; considered as enabled in perfparse-log2mysql)

 vi /opt/asnmtap/perfparse/etc/perfparse.cfg
   ...
   Service_Log "-"
   ...
   # Error handling :
   Error_Log =                  "/opt/asnmtap/log/perfparse-asnmtap-all"
   Drop_File =                  "/opt/asnmtap/log/perfparse-asnmtap-drop"
   ...

  # Database managment :
  # ====================
  Use_Storage_Mysql =              "yes"

  No_Raw_Data =                    "no"
  No_Bin_Data =                    "no"

  # Database Authentication
  DB_User =                    "asnmtap"
  DB_Name =                    "perfparse_asnmtap"
  DB_Pass =                    "passwd"
  DB_Host =                    "localhost"
Configuration of Perfparse v20 for ASNMTAP
 cp /opt/asnmtap/perfparse/etc/perfparse20.cfg.example /opt/asnmtap/perfparse/etc/perfparse20.cfg

 First you should edit '/opt/asnmtap/perfparse/etc/perfparse20.cfg', adding the correct database settings (if using something other than 'nagios' as DB name, username, and password). The options are :

 Use_Storage_Mysql (only in perfparsed; considered as enabled in perfparse-log2mysql)

 vi /opt/asnmtap/perfparse/etc/perfparse20.cfg
   ...
   Service_Log "-"
   ...
   # Error handling :
   Error_Log =                 "/opt/asnmtap/log/perfparse-asnmtap-all"
   Drop_File =                 "/opt/asnmtap/log/perfparse-asnmtap-drop"
   ...

  # Database managment :
  # ====================
  Storage_Modules_Load =       "mysql"
  Use_Storage_Mysql    =       "yes"

  No_Raw_Data =                "no"
  No_Bin_Data =                "no"

  # Database Authentication
  DB_User     =                "asnmtap"
  DB_Name     =                "perfparse_asnmtap_v20"
  DB_Pass     =                "passwd"
  DB_Host     =                "localhost"
        DB_Socket   =                "/tmp/mysql.sock"

        # PHPGui
        PHP_Lang    = "en"
        PHP_Style   = "" # "flo"
        http_image_path = "/asnmtap/perfparse20/img/"
Testing configuration
 http://asnmtap.citap.be/asnmtap/cgi-bin/perfparse.cgi
 > An error occured with the SQL:
 >   "Could not connect to MySQL using:  Database  = 'asnmtap',  Host  = '127.0.0.1',  Username =  'asnmtap', Password  = 'asnmtap'"
 >
 > Failure Message:
 >   "Access denied for user: 'asnmtap@localhost.localdomain' (Using password: YES)"

 You need to verify your access right for the database

 Host & Service string from Nagios:
   "$TIMET$"\t"$HOSTNAME$"\t"$SERVICEDESC$"\t"$OUTPUT$"\t"$SERVICESTATE$"\t"$PERFDATA$"\n

   $TIMET$              $HOSTNAME$                          $SERVICEDESC$               $OUTPUT$                                                                                        $SERVICESTATE$  $PERFDATA$
   1107692805   chablis.dvkhosting.com  process ColdFusion      OK - 40 processes running with command name cfusion     OK                              label=1;2;3;4;5

   Test ASNMTAP Perfparse integration:
   /usr/bin/printf "%b" "1107692900\tDUMMY-T1\tDUMMY-T1\tCRITICAL - Check Dummy: +DUMMY-T2+\tCRITICAL\ttperfdata=1;1;;;\n" | /opt/asnmtap/perfparse/bin/perfparse-log2mysql -c /opt/asnmtap/perfparse/etc/perfparse.cfg

   Look for results into the database and the logfile located at /opt/asnmtap/log/perfparse-asnmtap-all.yyyymmdd.log

   more /opt/asnmtap/log/perfparse-asmtap-all.yyyymmdd.log 
   yyyy/mm/dd hh:mmss1 [   storage.c:95    nnnn  ] storage_mysql module successfully loaded
Database Maintenance

Deletion policies are defined at various places with default and user-defined policies available. A policy defines the time at which data is permanently deleted from the DB. The data is deleted by running the provided program 'perfparse-db-purge'. It is advised that this is run daily at some time when the server is at low load.

 To purge the Database daily using 'perfparse-db-purge' from crontab, you might use something like this:

 # Purge PerfParse Database daily at 3 AM.
 0 3 * * * /opt/asnmtap/perfparse/bin/perfparse-db-purge > /dev/null
SNMPTT integration
 ... TODO ... NO PART OF NORMAL SETUP ...
Install SNMPTT

Install net-snmp 5.4.x

 ... TODO ... NO PART OF NORMAL SETUP ...

 MySQL 5.0.x

  SQLyog -> Db -> Import from SQL Statements ... -> \opt\asnmtap-3.001.xxx\plugins\templates\snmptt\snmptt-3.002.003-v5.0.x.sql
  SQLyog -> Db -> Import from SQL Statements ... -> \opt\asnmtap-3.001.xxx\plugins\templates\snmptt\create_weblogic_configuration_database_with_SNMP-3.002.003_mysql-v5.0.x.SQL
  or
  mysql -u root -p  < /opt/asnmtap/plugins/templates/snmptt/snmptt-3.002.003-v5.0.x.sql
  mysql -u root -p  < /opt/asnmtap/plugins/templates/snmptt/create_weblogic_configuration_database_with_SNMP-3.002.003_mysql-v5.0.x.SQL

 ... TODO ... NO PART OF NORMAL SETUP ...
Configuration of SNMPTT for ASNMTAP
 ... TODO ... NO PART OF NORMAL SETUP ...
  1.  plugins/templates/snmptt/snmptt-bea-weblogic.conf
    
     ... TODO ... NO PART OF NORMAL SETUP ...
    
     plugins/templates/snmptt/snmptt-oracle.conf
    
     ... TODO ... NO PART OF NORMAL SETUP ...
    
     plugins/templates/snmptt/snmptt.ini
    
     ... TODO ... NO PART OF NORMAL SETUP ...
  2.  plugins/snmptt/create_weblogic_configuration_database_with_SNMP.pl
    
     ... TODO ... NO PART OF NORMAL SETUP ...
  3.  plugins/snmptt/create_weblogic_configuration_for_SNMPTT.pl
    
     ... TODO ... NO PART OF NORMAL SETUP ...
  4. 4a ASNMTAP

     plugins/snmptt/create_ASNMTAP_weblogic_configuration_for_SNMP.pl
    
     ... TODO ... NO PART OF NORMAL SETUP ...
    
     plugins/snmptt/check_SNMPTT_oracle.pl
    
     ... TODO ... NO PART OF NORMAL SETUP ...
    
     plugins/snmptt/check_SNMPTT_probe.pl
    
     ... TODO ... NO PART OF NORMAL SETUP ...
    
     plugins/snmptt/check_SNMPTT_weblogic.pl
    
     ... TODO ... NO PART OF NORMAL SETUP ...
    
     plugins/templates/check_template-cluster.pl
    
     ... TODO ... NO PART OF NORMAL SETUP ...
    
     plugins/templates/check_template-SNMPTT.pl
    
     ... TODO ... NO PART OF NORMAL SETUP ...
  5. 4b Nagios

     plugins/snmptt/create_NCPL_weblogic_configuration_for_SNMP.pl
    
     ... TODO ... NO PART OF NORMAL SETUP ...
    
     plugins/nagios/check_snmptt_traps.pl
    
     ... TODO ... NO PART OF NORMAL SETUP ...
    
     plugins/nagios/check_snmptt_traps.plN
    
     ... TODO ... NO PART OF NORMAL SETUP ...
  6.  plugins/snmptt/snmptt_traps_remove_pending_and_duplicated.pl
    
     ... TODO ... NO PART OF NORMAL SETUP ...
Testing configuration
 ... TODO ... NO PART OF NORMAL SETUP ...
NagTrap integration
 ... TODO ... NO PART OF NORMAL SETUP ...
Install NagTrap
 ... TODO ... NO PART OF NORMAL SETUP ...
Configuration of NagTrap for ASNMTAP
 more /opt/asnmtap/applications/htmlroot/snmptraps/.htaccess
 AuthName "CITAP's Nagios Access"
 AuthType Basic
 AuthUserFile /etc/httpd/conf/nagios-htpasswd.users
 require valid-user

 ... TODO ... NO PART OF NORMAL SETUP ...
Testing configuration
 ... TODO ... NO PART OF NORMAL SETUP ...
Install HTML to PDF converter for Perl

HTMLDOC: http://www.htmldoc.org/

Downloading the Software
 Get the software from http://www.htmldoc.org/
   cd /export/download
   wget http://ftp.easysw.com/pub/htmldoc/1.8.27/htmldoc-1.8.27-source.tar.gz
Installing the Software
Linux
 cd /export/download/directory
 rpm -i htmldoc-1.8.27-linux-intel.rpm
 /usr/bin/htmldoc
Solaris
 cd /export/download/directory
 tar -xvzf htmldoc-1.8.27-source.tar.gz
 cd /export/download/htmldoc-1.8.27
 ./configure
 make
 make install
Licensing the Software

The HTMLDOC License window is shown the first time you run the software.

Click on the Update License button to add a license to your system

 perl -MCPAN -e shell
 install HTML::HTMLDoc

 ln -s /usr/bin/htmldoc /opt/asnmtap/applications/htmlroot/cgi-bin/htmldoc.cgi

 vi httpd.conf
 AcceptPathInfo On
 AddHandler cgi-script .cgi .pl
 Options ExecCGI FollowSymLinks
Testing the Software
 htmldoc -f '/opt/asnmtap/results/_ASNMTAP/reports/yyyydmmdd-collectorDaemonSchedulingReports.pl-_ASNMTAP-probe02-Daily.pdf' --bodyimage /opt/asnmtap/applications/htmlroot/img/logos/bodyimage.gif --charset iso-8859-1 --format pdf14 --size A4 --landscape --browserwidth 1280 --top 21mm --bottom 10mm --left 26mm --right 10mm --fontsize 8.0 --fontspacing 1.2 --headingfont Helvetica --bodyfont Helvetica --headfootsize 8.0 --headfootfont Helvetica --embedfonts --pagemode fullscreen --permissions no-copy,print --no-links --color --quiet --webpage 'http://localhost/asnmtap/cgi-bin/moderator/collectorDaemonSchedulingReports.pl?htmlToPdf=1&amp;sqlPeriode=3600&amp;width=1000&amp;xOffset=300&amp;yOffset=42&amp;labelOffset=32&amp;AreaBOffset=78&amp;hightMin=195'
 cd /opt/asnmtap/applications/bin
 ./generateCollectorDaemonSchedulingReports.pl -D L
 ls /opt/asnmtap/results/_ASNMTAP/reports/
Install ChartDirector 4.x for Perl
Linux installation
 download chartdir_perl_linux.tar.gz from http://www.advsofteng.com/
   wget http://www.advsofteng.com/chartdir_perl_linux.tar.gz
   mv chartdir_perl_linux.tar.gz /opt/.
   cd /opt
   tar -xvzf chartdir_perl_linux.tar.gz
   rm chartdir_perl_linux.tar.gz
Solaris installation
 download chartdir_perl_sunos.tar.gz from http://www.advsofteng.com/
   wget http://www.advsofteng.com/chartdir_perl_sunos.tar.gz
   mv chartdir_perl_sunos.tar.gz /opt/.
   cd /opt
   tar -xvzf chartdir_perl_sunos.tar.gz
   rm chartdir_perl_sunos.tar.gz
ASNMTAP Chartdirector configuration
 Applications.cnf

 <COMMON>
 ...
   <CHARTDIRECTOR>
     LIB             /opt/ChartDirector/lib/.
   </CHARTDIRECTOR>
 ...
 </COMMON>
ASNMTAP Tunneling localhost configuration
 Applications.cnf

 <COMMON>
 ...
   HTTPSSERVER       asnmtap.citap.be
   REMOTE_HOST       localhost.citap.be
   REMOTE_ADDR       127.0.0.1 ...
 </COMMON>

  through browser with normal access:
    http://asnmtap.citap.be:8080/asnmtap/nav/test/T/
    http://asnmtap.citap.be:8080/asnmtap/cgi-bin/moderator/index.pl
    http://asnmtap.citap.be:8080/asnmtap/cgi-bin/admin/index.pl
    http://asnmtap.citap.be:8080/asnmtap/cgi-bin/sadmin/index.pl

  ssh -l nagios -i ~/.ssh/nagios_dsa.id -o TCPKeepAlive=yes -L 8080:127.0.0.1:80 -N nagios@asnmtap.citap.be &

  through browser with localhost tunneling:
    http://localhost.citap.be:8080/asnmtap/nav/test/T/
    http://localhost:8080/asnmtap/cgi-bin/moderator/index.pl
    http://localhost:8080/asnmtap/cgi-bin/admin/index.pl
    http://localhost:8080/asnmtap/cgi-bin/sadmin/index.pl
Install Awstats
 Applications.cnf

 <COMMON>
 ...
   <AWSTATS>
     ENABLED         1                      # '0' or '1'
   </AWSTATS>
 ...
 </COMMON>

 vi /usr/local/apache2/conf/httpd.conf
 CustomLog logs/access_log combined

 wget http://belnet.dl.sourceforge.net/sourceforge/awstats/awstats-6.5.tgz
 tar -xvzf awstats-6.5.gz
 chown -R asnmtap:asnmtap awstats-6.5
 mv awstats-6.5 /usr/local/
 mv /usr/local/awstats-6.5 /usr/local/awstats
 cd /usr/local/awstats/tools
 ./awstats_configure.pl

 mkdir /var/lib
 mkdir /var/lib/awstats

 chown -R nobody /usr/local/awstats/wwwroot


 vi /usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf
 # replace
 SiteDomain=""
 # with
 SiteDomain="citap.be"
 ...
 # replace
 HostAliases="localhost 127.0.0.1 REGEX[myserver\.com$"
 # with
 HostAliases="localhost 127.0.0.1 asnmtap]"
 ...
 # replace
 LogFile="/var/log/httpd/mylog.log"
 # with
 LogFile="/var/log/httpd/asnmtap.citap.be-combined.log"


 cd /usr/local/awstats
 ./awstats_configure.pl

 /etc/init.d/httpd restart

 /usr/bin/env perl /usr/local/awstats/awstats_updateall.pl now -awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -configdir=/usr/local/awstats/etc/


 vi /var/spool/cron/crontabs/root
 15 * * * * /usr/local/awstats/tools/awstats_updateall.pl now > /dev/null

 http://awstats.sourceforge.net/docs/awstats_setup.html

HOWTO

Apache and ASNMTAP not installed into '/opt/asnmtap/'
 when ASNMTAP is not installed into '/opt/asnmtap/' you need to add SetEnv ASNMTAP_PATH to your webserver config

 more /etc/httpd/conf.d/asnmtap.conf
 ...
 <VirtualHost *:80>
   ...
   SetEnv ASNMTAP_PATH /opt/asnmtap-3.001.xxx-other/
   ...
 </VirtualHost>
SQL statement to query one results from the database
 SELECT id, title, status, endDate, endTime, statusMessage, step, timeslot FROM `events` where uKey = '<uKey>' and endDate = 'yyyy-mm-dd' order by id desc limit 1;

 status
 ----------------------------------------------------------------------------------------
 OK             no problems
 WARNING        indicates that there is something wrong, but not critical
 CRITICAL       indicates a critical problem
 UNKNOWN        indicates that we don't now the correct status
 NO-TEST        there is no test for this timeslot
 OFFLINE        this application is offline (no test sheduled for this timeslot)
 <NIHIL>        problem with the execution from the plugin

  <keyl>
 --------
 DUMMY-T1
 DUMMY-T2
 DUMMY-T3
 DUMMY-T4
 DUMMY-T5
run archiver.pl on cygwin
 Install libpng... needed, install this now

 mount -f -s -b "D:/cygwin/usr/sbin" "/usr/sbin" <-- to update the registry

 cygrunsrv --install "CYGWIN crontab" --path /usr/sbin/cron.exe -a '-D' -e CYGWIN=ntsec
 cygrunsrv --stop    "CYGWIN crontab"
 cygrunsrv --start   "CYGWIN crontab"
 cygrunsrv --remove  "CYGWIN crontab"

 0   2 * * * cd /opt/asnmtap/applications; ./archive.sh > /dev/null  <-- crontab op master server
 30 23 * * * cd /opt/asnmtap/applications/bin; ./holidayBundleSetDowntimes.sh > /dev/null  <-- crontab op master server
maximum timeslot interval greather then 2 hours:

asyncroon scheduling required

Perl
update every CPAN module that is outdated

perl -MCPAN -e 'CPAN::Shell->install(CPAN::Shell->r)'

using CPAN with a non-root account for ASNMTAP
 mkdir /opt/asnmtap/cpan-shared
 mkdir /opt/asnmtap/cpan-shared/lib
 mkdir /opt/asnmtap/cpan-shared/lib/perl5
 mkdir /opt/asnmtap/cpan-shared/share
 mkdir /opt/asnmtap/cpan-shared/share/man
 mkdir /opt/asnmtap/cpan-shared/share/man/man1
 mkdir /opt/asnmtap/cpan-shared/share/man/man3

 chmod -R 775 /opt/asnmtap/cpan-shared
 chown -R asnmtap:asnmtapcmd /opt/asnmtap/cpan-shared

 mkdir -p ~/.cpan/CPAN
 chown -R asnmtap:asnmtap ~/.cpan/CPAN

 cd  ~/.cpan/CPAN

 vi MyConfig.pm
 # <-- MyConfig.pm
 $CPAN::Config = {
  'build_cache' => q[10],
  'build_dir' => q[/home/asnmtap/.cpan/build],
  'cache_metadata' => q[1],
  'cpan_home' => q[/home/asnmtap/.cpan],
  'ftp' => q[/usr/kerberos/bin/ftp],
  'ftp_proxy' => q[http://proxyorg:8080],
  'getcwd' => q[cwd],
  'gpg' => q[/usr/bin/gpg],
  'gzip' => q[/bin/gzip],
  'histfile' => q[/home/asnmtap/.cpan/histfile],
  'histsize' => q[100],
  'http_proxy' => q[http://proxyorg:8080],
  'inactivity_timeout' => q[0],
  'index_expire' => q[1],
  'inhibit_startup_message' => q[0],
  'keep_source_where' => q[/home/asnmtap/.cpan/sources],
  'links' => q[],
  'make' => q[/usr/local/bin/make],
  'make_arg' => q[],
  'make_install_arg' => q[],
  'makepl_arg' => q[PREFIX=/opt/asnmtap/cpan-shared SITELIBEXP=/opt/asnmtap/cpan-shared/lib/perl5 LIB=/opt/asnmtap/cpan-shared/lib/perl5 INSTALLMAN1DIR=/opt/asnmtap/cpan-shared/share/man/man1 INSTALLMAN3DIR=/opt/asnmtap/cpan-shared/share/man/man3 INSTALLSITEMAN1DIR=/opt/asnmtap/cpan-shared/share/man/man1 INSTALLSITEMAN3DIR=/opt/asnmtap/cpan-shared/share/man/man3],
  'ncftp' => q[],
  'ncftpget' => q[],
  'no_proxy' => q[],
  'pager' => q[/usr/bin/less],
  'prerequisites_policy' => q[ask],
  'proxy_user' => q[],
  'scan_cache' => q[atstart],
  'shell' => q[/bin/bash],
  'tar' => q[/bin/tar],
  'term_is_latin' => q[1],
  'unzip' => q[/usr/bin/unzip],
  'urllist' => [q[http://cpan.llarian.net/], q[http://ftp.easynet.be/pub/CPAN/], q[http://cpan.mirrors.skynet.be/pub/CPAN], q[http://ftp.belnet.be/packages/cpan/], q[ftp://http.kulnet.kuleuven.ac.be/pub/mirror/CPAN/], q[http://ftp.scarlet.be/pub/cpan/]],
  'wget' => q[/usr/bin/wget],
 };
 1;
 __END__
 # MyConfig.pm -->


 su - asnmtap
 perl -c MyConfig.pm
 perl -MCPAN -e 'reload index'


 vi ~/.bash_profile
 ...
 export PATH=/usr/local/bin:/usr/local/sbin:/usr/sbin:/etc:/usr/ccs/bin:/usr/bin:/opt/csw/bin:/usr/ucb:/usr/local/mysql/bin:${PATH}

 if [ -d /opt/asnmtap/cpan-shared/lib/perl5 ]; then
   PERL5LIB=${PERL5LIB:+$PERL5LIB:}/opt/asnmtap/cpan-shared/lib/perl5
   MANPATH=${MANPATH:+$MANPATH:}/opt/asnmtap/cpan-shared/share/man
   export MANPATH PERL5LIB
 fi

 export LD_LIBRARY_PATH=/opt/asnmtap/ssl/lib:/usr/local/lib/mysql:/usr/local/lib:/usr/lib:${LD_LIBRARY_PATH}
 ...

 vi /etc/init.d/httpd
 ...
 if [ -d /opt/asnmtap/cpan-shared/lib/perl5 ]; then
   PERL5LIB=${PERL5LIB:+$PERL5LIB:}/opt/asnmtap/cpan-shared/lib/perl5
   MANPATH=${MANPATH:+$MANPATH:}/opt/asnmtap/cpan-shared/share/man
   export MANPATH PERL5LIB
 fi
 ...
 start() {
          echo -n $"Starting $prog: "
          check13 || exit 1
          PATH=$PATH MANPATH=$MANPATH PERL5LIB=$PERL5LIB LANG=$HTTPD_LANG daemon $httpd $OPTIONS
          RETVAL=$?
          echo
          [ $RETVAL = 0 ] && touch ${lockfile}
          return $RETVAL
 }
 ...


 sudo /etc/init.d/httpd restart


 more /etc/httpd/conf.d/asnmtap.conf
 ...
 <VirtualHost *:80>
   ...
   SetEnv PERL5LIB /opt/asnmtap/cpan-shared/lib/perl5
   ...
 </VirtualHost>


 # Module section  - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 vi Makefile.pl
 ...
 use lib qw(/opt/asnmtap/cpan-shared/lib/perl5/.);
 ...

 # Configuration section - - - - - - - - - - - - - - - - - - - - - - - - -
 If you're not the Perl administrator you probably don't have permission to install a module to its default location.
 Then you should install it for your own use into your home directory or other directory like so:

 perl Makefile.PL PREFIX=/opt/asnmtap/cpan-shared SITELIBEXP=/opt/asnmtap/cpan-shared/lib/perl5 LIB=/opt/asnmtap/cpan-shared/lib/perl5 INSTALLMAN1DIR=/opt/asnmtap/cpan-shared/share/man/man1 INSTALLMAN3DIR=/opt/asnmtap/cpan-shared/share/man/man3 INSTALLSITEMAN1DIR=/opt/asnmtap/cpan-shared/share/man/man1 INSTALLSITEMAN3DIR=/opt/asnmtap/cpan-shared/share/man/man3
 or
 perl Makefile.PL INSTALL_BASE=/opt/asnmtap/cpan-shared

 This will put modules into /opt/asnmtap/cpan-shared/lib/perl5, man pages into /opt/asnmtap/cpan-shared/man and programs into /opt/asnmtap/cpan-shared/bin.

   INSTALLARCHLIB     INSTALL_BASE/lib/perl5/$Config{archname}
   INSTALLPRIVLIB     INSTALL_BASE/lib/perl5
   INSTALLBIN         INSTALL_BASE/bin
   INSTALLSCRIPT      INSTALL_BASE/bin
   INSTALLMAN1DIR     INSTALL_BASE/man/man1
   INSTALLMAN3DIR     INSTALL_BASE/man/man3

 make
 make install
Apache
How create simple test certificates with openssl?

http://www.vanemery.com/Linux/Apache/apache-SSL.html

Step 1: Setup your own CA (Certificate Authority)
 openssl genrsa -des3 -out server-ca.key 2048
 openssl req -new -x509 -days 3650 -key server-ca.key -out server-ca.crt
 # To remove the pass phrase from the key file, execute this: 
 openssl rsa -in server-ca.key -out server-ca-nopass.key
 openssl x509 -in server-ca.crt -text -noout
Step 2: Make a key and a certificate for the web server:
 openssl genrsa -des3 -out citap-server.key 1024
 openssl req -new -key citap-server.key -out citap-server.csr
   ...
   Common Name (eg, your name or your server's hostname) []:secure.citap.com <=== This must be the real FQDN of your server!!!
 openssl rsa -in citap-server.key -out citap-server-nopass.key
 openssl x509 -req -in citap-server.csr -out citap-server.crt -sha1 -CA server-ca.crt -CAkey server-ca.key -CAcreateserial -days 3650
 openssl x509 -in citap-server.crt -text -noout
Step 3: Creating Client Certificates for Authentication
 openssl genrsa -des3 -out alex-peeters.key 1024
 openssl req -new -key alex-peeters.key -out alex-peeters.csr
 openssl x509 -req -in alex-peeters.csr -out alex-peeters.crt -sha1 -CA server-ca.crt -CAkey server-ca.key -CAcreateserial -days 3650
 openssl pkcs12 -export -in alex-peeters.crt -inkey alex-peeters.key -name "Alex Peeters" -out alex-peeters.p12
 openssl pkcs12 -in alex-peeters.p12 -clcerts -nokeys -info

 when:
   [error] Re-negotiation handshake failed: Not accepted by client!?
   [error] Certificate Verification: Error (20): unable to get local issuer certificate

 vi /etc/httpd/cond.d/ssl.conf
   SSLCertificateFile /etc/httpd/conf/ssl.crt/citap-server.crt
   SSLCertificateKeyFile /etc/httpd/conf/ssl.key/citap-server.key
   SSLCertificateChainFile /etc/httpd/conf/ssl.crt/server-ca.crt
   SSLCACertificateFile /etc/httpd/conf/ssl.crt/server-ca.crt
MySQL
A -> B -> C -> A replication

MySQL Reference Manual http://mysqld.active-venture.com/

It is safe to connect servers in a circular master/slave relationship with log-slave-updates enabled. Note, however, that many queries will not work correctly in this kind of setup unless your client code is written to take care of the potential problems that can happen from updates that occur in different sequence on different servers. This means that you can do a setup like the following:

A -> B -> C -> A

Server IDs are encoded in the binary log events. A will know when an event it reads had originally been created by A, so A will not execute it and there will be no infinite loop. But this circular setup will work only if you only if you perform no conflicting updates between the tables. In other words, if you insert data in A and C, you should never insert a row in A that may have a conflicting key with a row insert in C. You should also not update the same rows on two servers if the order in which the updates are applied matters.

PURGE MASTER LOGS

PURGE {MASTER|BINARY} LOGS TO 'log_name'

PURGE {MASTER|BINARY} LOGS BEFORE 'date'

Deletes all the binary logs listed in the log index that are strictly prior to the specified log or date. The logs also are removed from this list recorded in the log index file, so that the given log now becomes the first.

If you have an active slave that is currently reading one of the logs you are trying to delete, this command does nothing and fails with an error. However, if you have a dormant slave, and happen to purge one of the logs it wants to read, the slave will be unable to replicate once it comes up. The command is safe to run while slaves are replicating. You do not need to stop them.

You must first check all the slaves with SHOW SLAVE STATUS to see which log they are reading, then do a listing of the logs on the master with SHOW MASTER LOGS, find the earliest log among all the slaves (if all the slaves are up to date, this will be the last log on the list), backup all the logs you are about do delete (optional) and purge up to the target log.

RESET MASTER

Deletes all binary logs listed in the index file, resetting the binlog index file to be empty

RESET SLAVE

Makes the slave forget its replication position in the master's binlogs. This statement is meant to be used for a clean start: it deletes the `master.info' and `relay-log.info' files, all the relay logs, and starts a new relay log.

Note: All relay logs are deleted, even if they had not been totally executed by the slave SQL thread. (This is a condition likely to exist on a replication slave that is highly loaded, or if you have issued a STOP SLAVE statement.) Connection information stored in the `master.info' file is immediately reset to the values specified in the corresponding startup options, if they were specified. This information includes values such as master host, master port, master user, and master password. If the slave SQL thread was in the middle of replicating temporary tables when it was stopped, and RESET SLAVE is issued, these replicated temporary tables are deleted on the slave.

How do I configure a slave if the master is already running and I do not want to stop it?

There are several options. If you have taken a backup of the master at some point and recorded the binlog name and offset ( from the output of SHOW MASTER STATUS ) corresponding to the snapshot, do the following:

Make sure the slave is assigned a unique server ID.

Execute the following statement on the slave, filling in appropriate values for each parameter:

 mysql> CHANGE MASTER TO
   ->     MASTER_HOST='master_host-name',
   ->     MASTER_USER='master_user_name',
   ->     MASTER_PASSWORD='master_pass',
   ->     MASTER_LOG_FILE='recorded_log_name',
   ->     MASTER_LOG_POS=recorded_log_pos;

Execute START SLAVE on the slave.

If you do not have a backup of the master already, here is a quick way to do it consistently:

 FLUSH TABLES WITH READ LOCK 
 gtar zcf /tmp/backup.tar.gz /var/lib/mysql (or a variation of this) 
 SHOW MASTER STATUS - make sure to record the output - you will need it later 
 UNLOCK TABLES 

An alternative is taking an SQL dump of the master instead of a binary copy like above; for this you can use mysqldump --master-data on your master and later run this SQL dump into your slave. However, this is slower than makeing a binary copy.

No matter which of the two methods you use, afterwards follow the instructions for the case when you have a snapshot and have recorded the log name and offset. You can use the same snapshot to set up several slaves. As long as the binary logs of the master are left intact, you can wait as long as several days or in some cases maybe a month to set up a slave once you have the snapshot of the master. In theory the waiting gap can be infinite. The two practical limitations is the diskspace of the master getting filled with old logs, and the amount of time it will take the slave to catch up.

You can also use LOAD DATA FROM MASTER. This is a convenient command that takes a snapshot, restores it to the slave, and adjusts the log name and offset on theslave all at once. In the future, LOAD DATA FROM MASTER will be the recommended way to set up a slave. Be warned, howerver, that the read lock may be held for a long time if you use this command. It is not yet implemented as efficiently as we would like to have it. If you have large tables, the preferred method at this time is still with a local tar snapshot after executing FLUSH TABLES WITH READ LOCK.

Contrains

Foreign keys definitions are subject to the following conditions:

Both tables must be InnoDB type!

In the referencing table, there must be an index where the foreign key columns are listed as the first columns in the same order.

In the referenced table, there must be an index where the referenced columns are listed as the first columns in the same order.

Index prefixes on foreign key columns are not supported. One consequence of this is that BLOB and TEXT columns cannot be included in a foreign key, because indexes on those columns must always include a prefix length.

 [CONSTRAINT symbol] FOREIGN KEY [id] (index_col_name, ...)
   REFERENCES tbl_name (index_col_name, ...)
   [ON DELETE {RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT}]
   [ON UPDATE {RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT}]

 SET FOREIGN_KEY_CHECKS = 0; or SET FOREIGN_KEY_CHECKS = 1;
How to import a *.sql generated recovery file?
 mysql -u root -p
   -> USE asnmtap;

      If you use LOAD DATA INFILE ... the file must be on the server
   -> LOAD DATA LOW_PRIORITY INFILE '<filename>.sql' INTO TABLE events FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\\n';

      If you use LOAD DATA LOCAL INFILE ... the file is expected to be on the client.
      If you specify the keyword LOW_PRIORITY, execution of the LOAD DATA statement is delayed until no other clients are reading from the table. 
   -> LOAD DATA LOW_PRIORITY LOCAL INFILE '<filename>.sql' INTO TABLE events FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\\n';
How to import drop a InnoDB table that is referenced by a FOREIGN KEY constraint?

InnoDB does not allow you to drop a table that is referenced by a FOREIGN KEY constraint, unless you do SET FOREIGN_KEY_CHECKS=0. When you drop a table, the constraints that were defined in its create statement are also dropped.

REQUIREMENTS

Linux (Centos/Redhat EL3 and EL4)
 Staring from a core installation you need:

 rpm -i autoconf-2.60.noarch.rpm
 rpm -i automake-1.10.noarch.rpm

 rpm -i libtool-1.5.6-4.EL4.1.i386.rpm
 rpm -i libtool-libs-1.5.6-4.EL4.1.i386.rpm

 rpm -i libstdc++-devel-3.4.5-2.i386.rpm
 rpm -i gcc-c++-3.4.6.i386.rpm

 rpm -i libpng10-1.0.16-1.i386.rpm
 rpm -i libpng10-devel-1.0.16-1.i386.rpm

 rpm -i libpng-1.2.16.el4.2.i386.rpm
 rpm -i libpng-devel-1.2.16.el4.2.i386.rpm

 rpm -i libjpeg-6b-33.i386.rpm
 rpm -i libjpeg-devel-6b-33.i386.rpm

 rpm -i freetype-2.3.1.i386.rpm
 rpm -i freetype-devel-2.3.1.i386.rpm
 rpm -i freetype-utils-2.3.1.i386.rpm

 rpm -i fontconfig-2.4.2.i386.rpm
 rpm -i fontconfig-devel-2.4.2.i386.rpm

 rpm -i glib2-2.13.0.i386.rpm
 rpm -i glib2-devel-2.13.0.i386.rpm

 rpm -i zlib-devel-1.2.3.i386.rpm
 rpm -i e2fsprogs-devel-1.35-12.3.EL4.i386.rpm
 rpm -i krb5-devel-1.3.4-27.i386.rpm
 rpm -i openssl-devel-0.9.8e.i386.rpm

 rpm -i gd-2.0.33-4.4E.1.i386.rpm
 rpm -i gd-devel-2.0.33-4.4E.1.i386.rpm
 rpm -i gd-progs-2.0.33-4.4E.1.i386.rpm

 rpm -i libmcrypt-2.5.7-1.2.el4.rf.i386.rpm
 rpm -i libxml2-2.6.26.i386.rpm

 rpm -i httpd-2.0.59.ent.i386.rpm
 rpm -i httpd-suexec-2.0.59.ent.i386.rpm
 rpm -i mysql-5.0.29.RHEL4.1.i386.rpm
 rpm -i mysql-devel-5.0.29.RHEL4.1.i386.rpm

 perl -MCPAN -e 'install Bundle::CPAN'
 perl -MCPAN -e 'install Pod::Coverage'
 perl -MCPAN -e 'install Test::Pod'
 perl -MCPAN -e 'install Module::Signature'

 rpm -i perl-HTML-Tagset-3.03-30.noarch.rpm
 rpm -i perl-HTML-Parser-3.35-6.i386.rpm
 rpm -i perl-URI-1.30-4.noarch.rpm
 rpm -i perl-libwww-perl-5.79-5.noarch.rpm
 rpm -i perl-Crypt-SSLeay-0.51-5.i386.rpm
 rpm -i perl-Date-Calc-5.3-9.i386.rpm

 rpm -i perl-DBI-1.40-8.i386.rpm
 rpm -i perl-DBD-MySQL-2.9004-3.1.i386.rpm

 rpm -i perl-Time-HiRes-1.55-3.i386.rpm

 rpm -i perl-XML-Parser-2.34-5.i386.rpm
 rpm -i perl-XML-Dumper-0.71-2.noarch.rpm
Solaris 9
 Starting from a core installation you need:
sunfreeware.com
 pkgadd -d bash-3.1-sol9-sparc-local
 pkgadd -d coreutils-4.5.4-sol9-sparc-local
 pkgadd -d libiconv-1.8-sol9-sparc-local
 pkgadd -d ncurses-5.4-sol9-sparc-local
 pkgadd -d perl-5.8.8-sol9-sparc-local
 pkgadd -d popt-1.7-sol9-sparc-local
 pkgadd -d tar-1.15.1-sol9-sparc-local
 pkgadd -d tcp_wrappers-7.6-sol9-sparc-local
 pkgadd -d tcpdump-3.9.3-sol9-sparc-local
 pkgadd -d wget-1.10.2-sol9-sparc-local
 pkgadd -d zlib-1.2.3-sol9-sparc-local

 pkgadd -d apache-2.0.55-sol9-sparc-local
 pkgadd -d autoconf-2.59-sol9-sparc-local
 pkgadd -d automake-1.9-sol9-sparc-local
 pkgadd -d bison-1.875d-sol9-sparc-local
 pkgadd -d bzip2-1.0.2-sol9-sparc-local
 pkgadd -d db-4.2.52.NC-sol9-sparc-local
 pkgadd -d diffutils-2.8.1-sol9-sparc-local
 pkgadd -d expat-1.95.5-sol9-sparc-local
 pkgadd -d flex-2.5.31-sol9-sparc-local
 pkgadd -d fping-2.4b2-sol9-sparc-local
 pkgadd -d fontconfig-2.2.98-sol9-sparc-local
 pkgadd -d freetype-2.1.9-sol9-sparc-local
 pkgadd -d gcc-3.4.2-sol9-sparc-local
 pkgadd -d gd-2.0.33-sol9-sparc-local
 pkgadd -d gdbm-1.8.3-sol9-sparc-local
 pkgadd -d glib-2.6.2-sol9-sparc-local
 pkgadd -d jpeg-6b-sol9-sparc-local
 pkgadd -d libnet-1.1.1-sol9-sparc-local
 pkgadd -d libpcap-0.9.3-sol9-sparc-local
 pkgadd -d libpng-1.2.8-sol9-sparc-local
 pkgadd -d librsync-0.9.7-sol9-sparc-local
 pkgadd -d libtool-1.5-sol9-sparc-local
 pkgadd -d libxml2-2.6.16-sol9-sparc-local
 pkgadd -d m4-1.4.2-sol9-sparc-local
 pkgadd -d make-3.80-sol9-sparc-local
 pkgadd -d mrtg-2.10.15-sol9-sparc-local
 pkgadd -d openssl-0.9.8b-sol9-sparc-local
 pkgadd -d openssl-0.9.7g-sol9-sparc-local
 pkgadd -d pkgconfig-0.15.0-sol9-sparc-local
 pkgadd -d prngd-0.9.25-sol9-sparc-local
 pkgadd -d readline-5.1-sol9-sparc-local
 pkgadd -d rsync-2.6.8-sol9-sparc-local
 pkgadd -d texinfo-4.2-sol9-sparc-local
 pkgadd -d unzip-5.50-sol9-sparc-local
 pkgadd -d xpm-3.4k-sol9-sparc-local
blastwave.org
 pkgadd -d pkg_get.pkg
 pkgadd -d common-1.4.3,REV=2006.01.22-SunOS5.8-sparc-CSW.pkg
 pkgadd -d awstats-6.4-SunOS5.8-all-CSW.pkg
 pkgadd -d binutils-2.16.1-SunOS5.8-sparc-CSW.pkg
libmcrypt
 tar -xvzf libmcrypt-2.5.7.tar.gz
 cd libmcrypt-2.5.7
 ./configure
 make
 make install
MySQL
 MySQL 5.0.x and 5.1.x are supported

 tar -xvzf mysql-5.0.20.tar.gz or higher
 cd mysql-5.0.20
 ./configure --without-server --enable-local-infile 
 make
 make install

 /usr/local/bin/mysql_client_test --host asnmtap
Perl
 perl -MCPAN -e 'reload index'
 perl -MCPAN -e 'install Date::Manip'
 perl -MCPAN -e 'install LWP::UserAgent'
 perl -MCPAN -e 'install Statistics::Descriptive'
 perl -MCPAN -e 'install Text::ParseWords'
 perl -MCPAN -e 'install Test::Pod'
 perl -MCPAN -e 'install Net::Daemon'
 perl -MCPAN -e 'install Bundle::DBI'
 perl -MCPAN -e 'install Bundle::DBD::mysql'
 perl -MCPAN -e 'install Net::SNMP'
 perl -MCPAN -e 'install Config::IniFiles'

EXPORT

...

AUTHOR

Alex Peeters [alex.peeters@citap.be]

SEE ALSO

ASNMTAP::Asnmtap, ASNMTAP::Asnmtap::Applications::CGI, ASNMTAP::Asnmtap::Applications::Collector, ASNMTAP::Asnmtap::Applications::Display

DEPENDENCIES

 ASNMTAP::Time
 ASNMTAP::Asnmtap
 Carp
 Config::General
 Config::General::Interpolated
 Getopt::Long
 HTML::Entities
 Mail::Sendmail
 Time::Local

COPYRIGHT NOTICE

(c) Copyright 2000-2011 by Alex Peeters [alex.peeters@citap.be], All Rights Reserved.

ASNMTAP is based on 'Process System daemons v1.60.17-01', Alex Peeters [alex.peeters@citap.be]

 Purpose: CronTab (CT, sysdCT),
          Disk Filesystem monitoring (DF, sysdDF),
          Intrusion Detection for FW-1 (ID, sysdID)
          Process System daemons (PS, sysdPS),
          Reachability of Remote Hosts on a network (RH, sysdRH),
          Rotate Logfiles (system activity files) (RL),
          Remote Socket monitoring (RS, sysdRS),
          System Activity monitoring (SA, sysdSA).

'Process System daemons' is based on 'sysdaemon 1.60' written by Trans-Euro I.T Ltd

LICENSE

This ASNMTAP CPAN library and Plugin templates are free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The other parts of ASNMTAP may be used and modified free of charge by anyone so long as this copyright notice and the comments above remain intact. By using this code you agree to indemnify Alex Peeters from any liability that might arise from it's use.

Selling the code for this program without prior written consent is expressly forbidden. In other words, please ask first before you try and make money off of my program.

Obtain permission before redistributing this software over the Internet or in any other medium. In all cases copyright and header must remain intact.

4 POD Errors

The following errors were encountered while parsing the POD:

Around line 173:

Non-ASCII character seen before =encoding in '©'. Assuming CP1252

Around line 1292:

Expected '=item 4'

Around line 1318:

Expected '=item 5'

Around line 1332:

You have '=item 5' instead of the expected '=item 6'