--- /dev/null
+pid_file=/var/run/nrpe.pid
+server_port=5666
+#server_address=192.168.1.1
+nrpe_user=nrpe
+nrpe_group=nrpe
+#allowed_hosts=18.187.1.128,18.181.0.65
+dont_blame_nrpe=1
+debug=0
+command_timeout=60
+connection_timeout=300
+#command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10
+#command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20
+#command[check_disk1]=/usr/lib64/nagios/plugins/check_disk -w 20 -c 10 -p /dev/hda1
+#command[check_disk2]=/usr/lib64/nagios/plugins/check_disk -w 20 -c 10 -p /dev/hdb1
+#command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z
+#command[check_total_procs]=/usr/lib64/nagios/plugins/check_procs -w 150 -c 200
+command[check_users]=/usr/lib64/nagios/plugins/check_users -w $ARG1$ -c $ARG2$
+command[check_load]=/usr/lib64/nagios/plugins/check_load -w $ARG1$ -c $ARG2$
+command[check_disk]=/usr/lib64/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -x /usr/vice/cache
+command[check_disk_p]=/usr/lib64/nagios/plugins/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$
+command[check_procs]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$
+command[check_procs_C]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -C $ARG3$
+command[check_procs_P]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -P $ARG3$
+command[check_procs_m]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -m $ARG3$
+command[check_procs_s]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$
+command[check_procs_u]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -u $ARG3$
+command[check_procs_z]=/usr/lib64/nagios/plugins/check_procs -w $ARG1$ -c $ARG2$ -z $ARG3$
+command[check_mysql]=/usr/lib64/nagios/plugins/check_mysql -u $ARG1$ -p $ARG2$
+command[check_mysql_S]=/usr/lib64/nagios/plugins/check_mysql -S -u $ARG1$ -p $ARG2$
--- /dev/null
+#!/bin/sh
+#
+# This script will be executed *after* all the other init scripts.
+# You can put your own initialization stuff in here if you don't
+# want to do the full Sys V style init stuff.
+
+touch /var/lock/subsys/local
+
+if [[ -s /srv/mysql/master.info ]]; then
+ /sbin/ifdown eth0:0
+ /sbin/ifdown eth1:0
+fi
log-bin=sql-bin
log-bin-index=sql-bin.index
-relay-log=kitchen-sink-relay-bin
-relay-log-index=kitchen-sink-relay-bin.index
+relay-log=sliced-bread-relay-bin
+relay-log-index=sliced-bread-relay-bin.index
query_cache_limit=1M
query_cache_size=128M
innodb_buffer_pool_size=512M
innodb_additional_mem_pool_size=20M
-innodb_log_file_size=256M
+innodb_log_file_size=128M
innodb_log_buffer_size=8M
innodb_lock_wait_timeout=50
innodb_thread_concurrency=4
-innodb_log_group_home_dir=/srv/zebra/
innodb_file_per_table
old_passwords=1
-server-id=1
+server-id=2
ssl_ca=/etc/pki/tls/certs/ca.pem
ssl_cert=/etc/pki/tls/certs/sql.pem
--- /dev/null
+from elixir import Entity, Field, String, Integer, DateTime, options, metadata, setup_all, session
+from sqlalchemy import create_engine, func
+options.options_defaults['shortnames'] = True
+
+metadata.bind = create_engine('mysql://sql.mit.edu/mitsql?read_default_group=mysql', pool_recycle=True)
+
+if __name__ == '__main__':
+ setup_all(True)
+else:
+ setup_all()
+session.flush()
--- /dev/null
+#!/usr/bin/python
+
+def get_backup_exceptions(path='/mit/sql/etc/db_no-daily-backup'):
+ return filter(len, map(str.strip, file(path).read().split('\n')))
+
+import MySQLdb, MySQLdb.cursors
+
+def use_db(cursor, db):
+ cursor.execute('USE `%s`' % db)
+
+def get_dbs(cursor):
+ cursor.execute('SHOW DATABASES')
+ return [x.values()[0] for x in cursor.fetchall() if x.values()[0] != 'information_schema']
+
+def get_db_tables(cursor, db):
+ cursor.execute('SHOW TABLES FROM `%s`' % db)
+ return [(db, x.values()[0]) for x in cursor.fetchall()]
+
+def get_db_tables_ft(cursor, db):
+ r = []
+ for table in get_db_tables(cursor, db):
+ cursor.execute('SHOW INDEXES FROM `%s`.`%s`' % table)
+ r.extend(set([(db, x['Table']) for x in cursor.fetchall() if x['Index_type'] == 'FULLTEXT']))
+ return r
+
+def get_db_tables_status(cursor, db):
+ cursor.execute('SHOW TABLE STATUS FROM `%s`' % db)
+ return dict([((db, x['Name']), x) for x in cursor.fetchall()])
+
+def get_db_tables_engines(cursor, db):
+ return [(table, status['Engine']) for table, status in get_db_tables_status(cursor, db).items()]
+
+def repair_table_quick(cursor, table):
+ # REPAIR TABLE tbl QUICK
+ # works when changing ft_min_word_len
+ cursor.execute('REPAIR TABLE `%s`.`%s` QUICK' % table)
+
+if __name__ == '__main__':
+ import sys
+
+ cursor = MySQLdb.connect('localhost', read_default_group='client', cursorclass=MySQLdb.cursors.DictCursor).cursor()
+ #for db in get_dbs(cursor):
+ # for table in get_db_tables_ft(cursor, db):
+ # print table
+
+ #db = 'freeculture+youtomb'
+ #print get_db_tables_status(cursor, db)
+ #sys.exit(0)
+
+ while True:
+ data = sys.stdin.readline()
+ if not data:
+ break
+ data = data.strip()
+ table = eval(data)
+ print table
+ repair_table_quick(cursor, table)
`fs sa $dump_path/$owner/ system:sql-backup none`;
}
$exec = sprintf($dump_exec, $name, $owner.'/'.$name);
-/*
- if ($owner != 'root' && file_exists("$dump_path/$owner/$name.sql.gz")) {
- if (!BACKUP_CRON)
- printf("Saving old dump file: %s\n",
- "$dump_path/$owner/$name.sql.gz");
- rename("$dump_path/$owner/$name.sql.gz", "$dump_path/OLD/$name.sql.gz");
- }
-*/
if (!BACKUP_CRON)
printf("Dumping %d of %d / %d%% (%s):\n",
$i_database,
$stat['nDatabases'],
$i_database/$stat['nDatabases']*100,
$name);
- //printf("Executing $exec\n");
$time[$name][0] = microtime(true);
$dump_proc = popen($exec, 'r');
--- /dev/null
+#!/usr/bin/python
+
+import os, re, sys
+from time import strptime
+from glob import glob
+
+PATH = os.path.abspath(sys.argv[1])
+backups = glob('%s/weekly/*.gz' % PATH)
+backups.sort()
+backups.reverse()
+backups = [[x, re.match('.*(\d\d\d\d-\d\d-\d\d).*', x)] for x in backups]
+backups = [[x[0], strptime(x[1].groups()[0], '%Y-%m-%d')] for x in backups]
+
+keep = backups[:4]
+backups = backups[4:]
+monthlys = {}
+for x in backups:
+ month = (x[1].tm_year, x[1].tm_mon)
+ if month not in monthlys:
+ monthlys[month] = x
+ if len(monthlys) > 5:
+ break
+keep.extend(monthlys.values())
+
+for x in backups:
+ if not x in keep:
+ print 'rm %s' % x[0]
+ else:
+ print '# keeping %s' % x[0]
--- /dev/null
+#!/usr/bin/python
+
+import os, re, sys
+from glob import glob
+
+PATH = os.path.abspath(sys.argv[1])
+for x in glob('%s/weekly/*.gz' % PATH):
+ m = re.match('(.+)(\d\d-\d\d)-(\d\d\d\d)(.+)', x)
+ if m:
+ g = m.groups()
+ os.rename(x, '%s%s-%s%s' % (g[0], g[2], g[1], g[3]))