# -----------------------------------------------------------------------
#  Copyright 2003-2006 by Alex Peeters [alex.peeters@citap.be]
# -----------------------------------------------------------------------

# General - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Author       : Alex Peeters [alex.peeters@citap.be]
Latest update: 09 Sep 2006
Version      : 3.000.011


# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# TODO  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# TODO CURRENT VERSION  - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# ASAP  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

                               ASNMTAP::Asnmtap::Plugins::WSFR
                               ...

                               - http://search.cpan.org/~tonvoon/Nagios-Plugin-0.10
                               - /lib/Nagios/Plugin/Performance.pm
                               - ...

                               ASNMTAP::Asnmtap::Plugins::SOAP
                               - $SOAP::Constants::PATCH_HTTP_KEEPALIVE = 1;

WSRF:
To use the Container you need to install the SOAP::Lite, LWP, XML::DOM, DateTime, DateTime::Format::Epoch and DateTime::Format::W3CDTF modules. 
To use WS-Security for signing or verifying messages you will also need: Crypt::OpenSSL::RSA, MIME::Base64, Digest::SHA1, and Crypt::OpenSSL::X509 and XML::Canonocalize.

Dependencies WSRF::Lite:
XML::DOM 							1.44
DateTime 							0.34
DateTime::Format::Epoch             0.10
DateTime::Format::W3CDTF
Digest::SHA1 						2.11
Crypt::OpenSSL::RSA                 0.23
Crypt::OpenSSL::X509                0.3.1
HTTP::Daemon::SSL         		    1.02
XML::CanonicalizeXML                0.03

-  if ( $debug >= 4 ) {
-    eval "use SOAP::Lite +trace => 'all'";
-  } elsif ($debug == 1) {
-    eval "use SOAP::Lite +trace => qw( debug )";
-  } else {
-    eval "use SOAP::Lite";
-  }

+ if ( $debug >= 4 ) {
+   eval "use WSRF::Lite +trace => 'all'";
+ } elsif ($debug == 1) {
+   eval "use WSRF::Lite +trace => qw( debug )";
+ } else {
+   eval "use WSRF::Lite";
+ }

+ $ENV{WSS_SIGN} = 'true';

  my ($alert, $error, $result);

- my $service = new SOAP::Lite

+ my $service = WSRF::Lite
+ -> wsaddress  ( WSRF::WS_Address->new()->Address( $parms{proxy} ) )

# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

'statusMessage': varchar -> memo ASAP !!!

http://search.cpan.org/~cbarratt/File-RsyncP-0.52/lib/File/RsyncP.pm
or
http://www.cis.upenn.edu/~bcpierce/unison/

# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#!/bin/sh
# ---------------------------------------------------------------
#  Copyright 2003-2006 Alex Peeters [alex.peeters@citap.be]
# ---------------------------------------------------------------
# This shell script takes care of starting and stopping

AMNAME="Collector ASNMTAP probe00-environment-probe" AMPATH=/asnmtap-3.000.xxx/applications
AMCMD=collector.pl
AMPARA="--hostname=probedev --mode=C --collectorlist=CollectorCT-probe00-environment-probe --dumphttp=U --status=N --debug=F --screenDebug=F --allDebug=F --nokDebug=F" PIDPATH=/asnmtap-3.000.xxx/pid
PIDNAME=CollectorCT-probe00-environment-probe.pid

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

[ -f $AMPATH/$AMCMD ] || exit 0

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

MANPATH=${MANPATH:+$MANPATH:}/opt/asnmtap/cpan-shared/share/man
export MANPATH PERL5LIB

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

start() {
  # Start daemons
  if [ -f $PIDPATH/$PIDNAME ]
  then
    echo "'$AMNAME' already running, otherwise remove '$PIDNAME'"
  else
    echo "Start: '$AMNAME' ..."
    cd $AMPATH

   PATH=$PATH MANPATH=$MANPATH PERL5LIB=$PERL5LIB LANG=$HTTPD_LANG LD_LIBRARY_PATH=/usr/local/ssl/lib:/usr/local/lib/mysql:/usr/local/lib:/usr/lib ./$AMCMD $AMPARA &
  fi
}

# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#!/bin/sh

PERL5LIB=${PERL5LIB:+$PERL5LIB:}/opt/supervision/cpan-shared/lib/perl5
MANPATH=${MANPATH:+$MANPATH:}/opt/supervision/cpan-sharedshare/man
export PERL5LIB MANPATH

AMPATH=/opt/asnmtap-3.000.xxx/applications

cd $AMPATH; /usr/local/bin/perl archive.pl -A ArchiveCT -c T -r T -d F

# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

replace

  rsync -e "ssh -i $KeyRsync" -a $Delete $AdditionalParams $Source $Target

with

  ssh=<sshpath>
  ...
  $Rsync -e "$ssh -i $KeyRsync" -a $Delete $AdditionalParams $Source $Target

# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  
when:

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

replace

  my $prompt = ( $opt_n || grep /^LIB=/, @ARGV ) ? 0 : 1;

with

  my $prompt = ( $opt_n || grep /^LIB=/, @ARGV ) ? 1 : 1;

# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

<!--<SCRIPT language="Javascript">
   document.SAMLRedirectionForm.submit();
</SCRIPT>-->

# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

NCPL CPAN modules not used by ASNMTAP:
   CGI::Simple
   Net::Nslookup
   Tie::IxHash

# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

send email on stop daemon

Detailed Statistics and Report Generation: Adding a checkbox, to choose output destination: HTML/PDF 

yyyymmdd-test-ukey.sql-LOAD-DATA-FAILED !!!

chromeless function update for MSIE 7.0 en Firefox !!!


Trendline Correction Reports (for the Collector):
- De beste manier is volgens mij lineair te gaan interpoleren en te gaan 
  kijken naar de richtingscofficint van de rechte. Het algoritme kan ik 
  echter niet zo direct neerschrijven ...
- Steekproefgemiddelde berekenen
  - http://www.let.leidenuniv.nl/history/res/stat/html/les8.html
  - trendline email -> no automatically updates -> table plugins: field trendlineAutoUpdate []


500 SSL negotiation failed
- http://www.issociate.de/board/post/214066/LWP_and_SSL.html
  SSL: { if (index($response->status_line, 'SSL negotiation failed') !=-1) { sleep 1; redo SSL unless $tries++ == 3; } }
  - or
  SSL: { if ( 'SSL negotiation failed' =~ /$response->status_line/ ) { sleep 1; redo SSL unless $tries++ == 3; } }


Apache:
- Browser Agent: BrowserMatch: Mozilla/3.0, nokeepalive, force-response-1.0
  - verify if the env-variable keepalive and/or force-response-1.1 exists
- BrowserMatch regex [!]env-variable[=value] [[!]env-variable[=value]] ...
  vi /etc/httpd/conf/httpd.conf or vi /usr/local/apache2/conf/httpd.conf
  BrowserMatch "Mozilla/4.0 (compatible; MSIE 7.0; ASNMTAP; U; ASNMTAP-3.000.011 postfix; nl-BE; rv:3.000.011) Gecko/200607xx libwww-perl/5.805", keepalive, force-response-1.1
                                                                       n nnn nnn                    n nnn nnn        nnnnnnnn             n nnn

smoothline (spline layers) for trendline and bar statistics

update into all tables the numeric int where needed: http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html

database-purge-perfdata, archiver.pl, generateCollectorDaemonSchedulingReports.pl, generateReports.pl 
& holidayBundleSetDowntimes.pl laten uitvoeren door de enkelvoudig crontab script.

Bekijken van de rechten die apache nodig heeft: htmlroot, log, master, slave, pid, results, ...
fixRights script om rechten (chmod en chown) te zetten automatisch aanmaken and launch fixRights before restart daemon.

'Problem regarding finding master or slave' in grafieken. Misschien beter in menu onderdukken.

Menu voor Moderator, Admin en Sadmin aanpassen ingeval van Distributed servers. Hier moeten sommige menuonderdelen onderdrukt worden.

generateReports.sh:	error undefined value wanneer er geen records zijn :)

Email message restarted means start/stop/restart. Message should also been start, stop or restart instead of restarted !!!

Rsync: KeyRsync kan verschillend zijn per server

Display & Collector startup script: hostname = Central FQDN Database Server by default. For a probe must this be the central database server


# General - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

depricate --httpdump & --dumphttp: tijdelijk voor backwards compatibiliteit !!!

Implementation from 'HTML::HTMLDoc::PDF ' located at 'http://search.cpan.org/~mfrankl/HTML-HTMLDoc-0.10/'

http://search.cpan.org/~bmorrow/PerlInterp-0.03/Perl.pm

Innodb Tranasction, bij mislukking is csv bestand wegschrijven en via archiver.pl importeren.


# Plugins - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Extra controle voor plugins.pl en/of generateConfig.pl
- controle of de opgegeven helpPluginFilename files bestaan op disk 
- upload van PDF's (WORD to PDF ?)

Indien een mailtest offline is -> intresseert het resultaat ons niet, display offline, plugin toch draaien maar die mails deleten. 
MAW Bij plugin moet dit kunnen worden opgegeven als plugintype of iets dergelijks!!!

Warning and Critical: checking threshold range format

Performance Data: checking the expected format
- 'label'=value[UOM];[warn];[crit];[min];[max]

voor plugins, ook optie delete voorzien voor plugins dewelke door acrhiver na x maanden mogen opgekuist worden


# Display - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Restart Collector and Display: Ledig geworden collector moet overal worden verwijderd !!!

multioffline, status in database offline -> in display als nog te testen weergaven

offline door holiday of scheduling niet in condenced view

offline door comment in condenced view

proxy caching statische pagina's

.cache files                                                     <- sound

applications/custom/display.pm                         <- custom function

On demand run icoontje naar de hamertjes & vraagtekens.

Openen van 'Help en Commands' into new window!


# Reports - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

reports, deselecteren wat niet geselecteerd mag worden voor de datum keuze

mogelijkheid om bepaalde applicaties niet in de view te steken gedurende bepaalde uren. 

Bij Reports -> Problem details -> link maken naar 'Debug Report'

Statistics: Monthly Average <- ASAP

Een optie "send pdf by email" bij de repports. 

Ingeven downtimes, inetctrl, ..., die niet aangekondigd werden, ingeven op 
een later tijdstip.  Dit zou moeten mogelijk zijn om bv de statistieken te 
kunnen corrigeren.

Oproepen van voorgedefineerde stats:
-> http://asnmtap.citap.be/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends.pl?pagedir=test&pageset=index&debug=F&CGISESSID=9d47b3a72238e67381c46df51b903baa&detailed=on&uKey1=DUMMY-T5&uKey2=none&uKey3=none&startDate=2005-12-31&endDate=&inputType=fromto&year=2005&week=52&month=12&quarter=4&statuspie=on&errorpie=off&bar=off&hourlyAvg=off&dailyAvg=off&details=off&topx=off&pf=off&htmlToPdf=1


# Applications  - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Email mailtemplates om mailboodschappen taalonafhangkelijk te maken
-> "Geachte, Cher,\n\n$header\n\n$CcommentData\n\n-- $APPLICATION\n$DEPARTMENT\n$BUSINESS\n"

In collector daemon sheduling reports alleen de collectors laten zien voor overeenkomstige probe of server.

Comments kunnen zetten op een groep testen via multiselect
# update comments set activationTime='hh:mm:ss', activationTimeslot='1149836400', suspentionDate='yyyy-mm-dd',  suspentionTimeslot='hh:mm:ss', suspentionTimeslot='1149854400', downtime=1 where entryDate='yyyy-mm-dd' and remoteUser='...'


useraccounts flag voor wel of geen email

rename uKey of andere key plus overal waar gebruikt en delete plugin, ... met alle dependencies,

delete user gaat niet omwille van de contrains met comments en events. delete waarbij contrain tijdelijk afzetten

In view.pl -> selecteer + groeptitle toevoegen

In view.pl -> omvormen naar multiselect 'Display Daemon'

http://asnmtap.citap.be/asnmtap/nav/index/reports-index.html 
hier url naar de plugin times in plaatsen, is makkelijker om te onthouden 


# BUGS  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

It's not a bug, it's a feature!

1) malformed header from script. Bad header=    : generateChart-new.pl, referer: http://asnmtap.citap.be/cgi-bin/detailedStatisticsReportGenerationAndCompareResponsetimeTrends-new.pl


# NEW NEXT VERSION  - - - - - - - - - - - - - - - - - - - - - - - - - - -
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Embedded Perl ondersteuning aangaande de plugins!!!

SNMP compatibility regarding the return status off the plugins

http://www.hswn.dk/hobbitsw/

Big Brother / Hobbit compatibility for easy addaptation off these plugins


# Applications  - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Debug files into glob field database.


# Collector - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

nieuwe crontab optie: seconds om een crontab te kunnen verschuiven

Debug file for UNKNOWN !!!

  
Sending 'Notifications'
-----------------------

CREATE TABLE `timeperiods` (
  `timeperiod` varchar(15) NOT NULL default '',
  `name` varchar(64) NOT NULL default '',
  `sunday` varchar(15) default '',
  `monday` varchar(15) default '00:00-24:00',
  `tuesday` varchar(15) default '00:00-24:00',
  `wednesday` varchar(15) default '00:00-24:00',
  `thursday` varchar(15) default '00:00-24:00',
  `friday` varchar(15) default '00:00-24:00',
  `saturday` varchar(15) default '',
  `activated` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`timeperiod`)
) TYPE=InnoDB;

# 00:00-24:00 or 00:00-09:00,17:00-24:00 or 00:00-09:00,12:00-44:00,17:00-24:00

plugins -> `timeperiod`, `notificationEnabled`, `notificationOptions`
users   -> `timeperiod`, `notificationEnabled`, `notificationOptions`, `notificationFormat`, `notificationWhen`,
                          [0|1]                   [1|2|3] or [W|C|U]    email to start ?      [n fails], after
                                          [WARNING|CRITICAL|UNKNOWN]    email, pager, sms     test fails n times
                         `notificationInterval`,                       `notificationRecovered`
                          [0|n min], 0 once                             [0|n|F], 
                          repeat every n min until problem solved       n: send notification when problem is solved after after n times ok, 
						                                                f: send notification when problem is solved using formule
                                                                           formule: min 3 <= (30 min / interval) <= max 9


Notification send where plugins->`notificationEnabled` is set
  to the users where users->`notificationEnabled` is set
  for the users->`pagedirs` into the range from plugins->`pagedirs`
    /<pagedir 1>/<pagedir 2>/<pagedir n>/ into the range from /<pagedir 1>/<pagedir 2>/<pagedir m>/
  for the plugins->`timeperiod` into the range from users->`timeperiod`


# /cgi-bin/admin/titles.pl  - - - - - - - - - - - - - - - - - - - - - - -
Webinterface to add, edit and delete titles


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

SNMPTT testing:
---------------

Try the following:

-Copy examples\snmptt.conf.generic to /etc/snmp/
-Change:

 snmptt_conf_files = <<END
 /etc/snmp/snmptt.conf
 /etc/snmp/snmptt-udc-snmp.conf
 /etc/snmp/snmptt-bea-weblogic.conf
 END

 to:

 snmptt_conf_files = <<END
 /etc/snmp/snmptt.conf.generic
 END

-shut down snmptt
-shut down snmptrapd
-extract the snmptt-unknown-300-test-traps.tgz file to /var/spool/snmptt/ (attached to this bug report)
-purge your snmptt_unknown table
-set statistics_interval = 10 in snmptt.ini to enable statistics monitoring (every 10 seconds)
-start snmptt in daemon mode
-wait until /var/spool/snmptt is empty
-wait 30 seconds
-check syslog to see how many traps were processed.  You *should* see:
 Total traps received=300,Total traps translated=0,Total traps ignored=0,Total unknown traps=300
-check the snmptt_unknown table to see how many records there are.  You should see 300.

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

