ASNMTAP
view release on metacpan or search on metacpan
lib/ASNMTAP/Asnmtap/Applications.pod view on Meta::CPAN
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...
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...
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
=item 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!!!
=back
=item 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 !!!
=back
=item 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
=item Perfparse integration
Perfparse (http://perfparse.sourceforge.net/)
We use the 'Pipe to Perfparse' methode
=over 4
=item 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
=item Installing Perfparse database
cd /export/download/perfparse-0.106.1/scripts
cat mysql_create.sql | mysql -u root -p -D asnmtap
=item 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"
=item 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/"
=item 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
=item 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...
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
=back
=item SNMPTT integration
... TODO ... NO PART OF NORMAL SETUP ...
=over 4
=item 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 ...
=item Configuration of SNMPTT for ASNMTAP
... TODO ... NO PART OF NORMAL SETUP ...
=over 4
=item 1
plugins/templates/snmptt/snmptt-bea-weblogic.conf
lib/ASNMTAP/Asnmtap/Applications.pod view on Meta::CPAN
openssl x509 -in citap-server.crt -text -noout
=item 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
=back
=back
=item MySQL
=over 4
=item 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 prob...
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 co...
=over 4
=item 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 w...
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 b...
=item RESET MASTER
Deletes all binary logs listed in the index file, resetting the binlog index file to be empty
=item 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 informa...
=item 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 ...
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...
=back
=item 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;
=item 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';
( run in 0.947 second using v1.01-cache-2.11-cpan-5837b0d9d2c )