Skip to content

Instantly share code, notes, and snippets.

@wakwanza
wakwanza / optiexif.py
Created November 17, 2016 09:54
Optimize pngs and remove the EXIF data embedded in them
#!/usr/bin/python
import os
import subprocess
for root, dirs, files in os.walk("."):
for file in files:
if file.endswith(".png"):
fpath = os.join.path(root,file)
subprocess.call(["exiv2","delete",fpath]); subprocess.call(["optipng","-o7",fpath])
@wakwanza
wakwanza / redirectport
Created October 28, 2016 14:09
Xinetd port service redirect
service SERVICENAME
{
type = UNLISTED
disable = no
flags = REUSE
user = root
socket_type = stream
protocol = tcp
wait = no
log_on_failure += USERID
@wakwanza
wakwanza / proxysql.cnf
Created October 27, 2016 13:15
Proxysql initial config file
datadir="/var/lib/proxysql"
admin_variables=
{
admin_credentials="PSQLUSER:PSQLPASS"
mysql_ifaces="0.0.0.0:6032;/var/tmp/proxysql_admin.sock"
}
@wakwanza
wakwanza / config.json
Created October 26, 2016 22:21
Sensu client default config file
{
"client": {
"name": "HOSTNAME",
"address": "HOSTIPADDRESS",
"subscriptions": [ "SUBSCRIPTIONS" ]
}
}
@wakwanza
wakwanza / consul_template.ini
Last active December 7, 2016 14:02
Supervisord config for consul-template
[program:consul_template]
command=/usr/local/bin/consul-template -config=/etc/consul.d/consult
stopsignal=INT
user=consul
stdout_logfile=/var/log/consult.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=10
autostart=false
autorestart=true
@wakwanza
wakwanza / globals.sql
Last active December 13, 2022 05:43
Global variables update for proxysql
update global_variables set
-- UserDataMonitor
variable_value="DBMONUSER"
where variable_name='mysql-monitor_username';
update global_variables set
-- PasswordDataMonitor
variable_value="DBMONPASS"
where variable_name='mysql-monitor_password';
@wakwanza
wakwanza / dbupdate.ctmpl
Last active May 24, 2019 03:29
consul template to update db server in proxysql
INSERT OR REPLACE INTO mysql_servers
(hostgroup_id,hostname,port,comment)
VALUES {{ range $i, $s := service "mydb"}}{{if $i }},{{end}}
(1,'{{.Address}}',{{.Port}},'{{.Node}}'){{end}};
SAVE MYSQL SERVERS TO DISK;
@wakwanza
wakwanza / client.json
Last active October 26, 2016 22:05
Sensu client config file
{
"rabbitmq": {
"ssl": {
"private_key_file": "SSLKEY",
"cert_chain_file": "SSLCERT"
},
"port": 5671,
"host": "SENSUHOST",
"user": "SENSUUSER",
"password": "SENSUPASSWORD",
@wakwanza
wakwanza / client.json
Last active November 30, 2016 09:44
consul client config file
{
"server": false,
"datacenter": "LOCATION",
"data_dir": "/var/consul",
"encrypt": "CONSULKEY",
"log_level": "INFO",
"client_addr": "0.0.0.0",
"enable_syslog": true,
"start_join": ["CLUSTERIP"]
}
@wakwanza
wakwanza / checks.json
Created October 25, 2016 18:56
consul system checks
{
"checks": [
{
"id": "memory-check",
"name": "mem",
"script": "/usr/lib64/nagios/plugins/check_used_mem",
"interval": "30s"
},
{
"id": "cpu-check",