ASNMTAP
view release on metacpan or search on metacpan
lib/ASNMTAP/Asnmtap/Applications.pod view on Meta::CPAN
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
=back
=back
=back
=back
=head1 PROGRAMS
=over 4
=item located at /opt/asnmtap/applications
=over 4
=item 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
=item archive.sh
=over 4
=item Central ASNMTAP
archive.pl -A ArchiveCT -c F -r T -d T
=item Central Apache
archive.pl -c T -r F -d F
=item Distributed ASNMTAP
archive.pl -A ArchiveCT -c T -r T -d F
=back
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
=back
=item located at /opt/asnmtap/applications/bin
=over 4
=item generateCollectorDaemonSchedulingReports.pl
this program generating automatically Collector Daemon Scheduling Reports in PDF format
Located at URL: http://asnmtap.citap.be/results/_ASNMTAP/reports/
=item 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
=item generateReports.pl
this program generate automatically reports in PDF format, defined by the CGI program reports.pl
=item 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
=item holidayBundleSetDowntimes.pl
this program automatically set the plugin downtimes, defined by the CGI program plugin.pl and holidaysBundle.pl
=item 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
=item importDataThroughCatalog.pl
this program imports automatically the data for other distributed/federated catalog members, defined by the CGI program catalog.pl
=item 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
=back
=item located at /opt/asnmtap/applications/sbin
=over 4
=item 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 !
=item 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
=item perfparse_asnmtap_pulp_command.pl
... TODO ... NO PART OF NORMAL SETUP ...
=item perfparse_crontab.sh
... TODO ... NO PART OF NORMAL SETUP ...
=item perfparse_crontab_failed.sh
... TODO ... NO PART OF NORMAL SETUP ...
=item perfparse_debug.sh
... TODO ... NO PART OF NORMAL SETUP ...
=item 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 ...
=back
=back
=head1 INSTALL
when i have more time, this will also be automated, but for now ...
=over 4
=item user asnmtap
DON't run the ASNMTAP Applications under the ROOT account, use one dedicated account for the ASNMTAP Applications instead!
lib/ASNMTAP/Asnmtap/Applications.pod view on Meta::CPAN
/usr/sbin/groupadd asnmtapcmd
/usr/sbin/usermod -G asnmtapcmd asnmtap
/usr/sbin/usermod -G asnmtapcmd nobody
=item .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
=item .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
=item .bash_profile example
MAIL=/usr/mail/${LOGNAME:?}
export PATH
umask 022
=item 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
=back
=item Apache
=over 4
=item Install for HTTPS support
install openssh, openssl, openssl096 & openssl-devel
=item 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>
lib/ASNMTAP/Asnmtap/Applications.pod view on Meta::CPAN
</VirtualHost>
=item 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
=item 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
=item maximum timeslot interval greather then 2 hours:
asyncroon scheduling required
=item Perl
=over 4
=item update every CPAN module that is outdated
perl -MCPAN -e 'CPAN::Shell->install(CPAN::Shell->r)'
=item 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 INS...
'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
( run in 0.709 second using v1.01-cache-2.11-cpan-39bf76dae61 )