ASNMTAP
view release on metacpan or search on metacpan
applications/archive.pl view on Meta::CPAN
$dbh->disconnect or $rv = errorTrapDBI("Sorry, the database was unable to add your entry.", $debug);
}
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub doBackupCsvSqlErrorWeekDebugReport {
my ($RESULTSPATH, $DEBUGDIR, $REPORTDIR, $gzipEpoch, $removeAllNokEpoch, $removeGzipEpoch, $removeDebugEpoch, $removeReportsEpoch, $removeWeeksEpoch, $firstDayOfWeekEpoch, $yesterdayEpoch, $currentEpoch) = @_;
print EMAILREPORT "\nDo backup, csv, sql, error, week, and debug files:\n--------------------------------------------------\n" unless ( $debug );
my ($darchivelist, $dtest, $pagedir, $ttest, $command, $rvOpendir, $path, $filename, $debugPath, $debugFilename, $reportPath, $reportFilename, $weekFilename);
my @files = ();
foreach $darchivelist (@archivelisttable) {
($pagedir, $ttest) = split(/\#/, $darchivelist, 2);
my @stest = split(/\|/, $ttest);
$path = $RESULTSPATH .'/'. $pagedir;
$debugPath = $path .'/'. $DEBUGDIR;
$reportPath = $path .'/'. $REPORTDIR;
applications/archive.pl view on Meta::CPAN
sub print_help () {
print_revision($PROGNAME, $version);
print "ASNMTAP Archiver for the '$APPLICATION'
-A, --archivelist=<filename>
FILENAME : filename from the archivelist for the html output loop (default undef)
-c, --cgisess=F|T
F(alse) : don't remove the cgisess files
T(true) : remove the cgisess files (default)
-r, --reports=F|T
F(alse) : don't backup Csv, Sql, Error, Week, Debug reports
T(true) : remove backup Csv, Sql, Error, Week, Debug reports (default)
-d, --database=F|T
F(alse) : don't archive the '$SERVERTABLEVENTS' and '$SERVERTABLCOMMENTS' tables (default)
T(true) : archive the '$SERVERTABLEVENTS' and '$SERVERTABLCOMMENTS' tables
-y, --yearsago=<years ago>
YEARS AGO: c => current year or 1..9 => the number of years ago that the '$SERVERTABLEVENTS'
and '$SERVERTABLCOMMENTS' tables need to be created
-f, --force=F|T
F(alse) : don't force CSV import (default)
T(true) : force CSV import
-D, --debug=F|T|L
applications/htmlroot/overlib.js view on Meta::CPAN
// What the next argument is expected to be.
var v, i, mode=-1, par = (pf != 'ol_');
var fnMark = (par && !ar.length ? 1 : 0);
for (i = 0; i < ar.length; i++) {
if (mode < 0) {
// Arg is maintext,unless its a number between pmStart and pmUpper
// then its a command.
if (typeof ar[i] == 'number' && ar[i] > pmStart && ar[i] < pmUpper) {
fnMark = (par ? 1 : 0);
i--; // backup one so that the next block can parse it
} else {
switch(pf) {
case 'ol_':
ol_text = ar[i].toString();
break;
default:
o3_text=ar[i].toString();
}
}
mode = 0;
applications/htmlroot/snmptraps/include/js/overlib.js view on Meta::CPAN
// What the next argument is expected to be.
var v, mode=-1, par = (pf != 'ol_');
var fnMark = (par && !ar.length ? 1 : 0);
for (i = 0; i < ar.length; i++) {
if (mode < 0) {
// Arg is maintext,unless its a number between pmStart and pmUpper
// then its a command.
if (typeof ar[i] == 'number' && ar[i] > pmStart && ar[i] < pmUpper) {
fnMark = (par ? 1 : 0);
i--; // backup one so that the next block can parse it
} else {
switch(pf) {
case 'ol_':
ol_text = ar[i].toString();
break;
default:
o3_text=ar[i].toString();
}
}
mode = 0;
applications/tools/mysql/MySQLBackup.sh view on Meta::CPAN
#!/bin/bash
#####################################
### MySQL Configuration Variables ### #####################################
# MySQL Hostname
DBHOST='localhost'
# MySQL Username
DBUSER='backup'
# MySQL Password
DBPASSWD='backup'
# Local Directory for Dump Files
LOCALDIR=/opt/backup/
# Prefix for offsite .tar file backup
TARPREFIX=mysql
#####################################
### Edit Below If Necessary ######### #####################################
cd $LOCALDIR
SUFFIX=`eval date +%y%m%d`
DBS=`/usr/local/mysql/bin/mysql -u$DBUSER -p$DBPASSWD -h$DBHOST -e"show databases"`
lib/ASNMTAP/Asnmtap/Applications.pod view on Meta::CPAN
=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
lib/ASNMTAP/Asnmtap/Applications.pod view on Meta::CPAN
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
lib/ASNMTAP/Asnmtap/Applications.pod view on Meta::CPAN
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
lib/ASNMTAP/Asnmtap/Applications.pod view on Meta::CPAN
=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
( run in 1.831 second using v1.01-cache-2.11-cpan-49f99fa48dc )