Skip to content

Instantly share code, notes, and snippets.

View Slach's full-sized avatar
💭
deep diving into kuberntes

Eugene Klimov Slach

💭
deep diving into kuberntes
View GitHub Profile
@Slach
Slach / .gitignore
Last active October 29, 2017 16:43
Why Clickhouse can't load TSV file
.vagrant/
*.log
@Slach
Slach / metrika_visits.1.tsv
Created October 28, 2017 08:22
Metrica Logs API wrong escaping Array(String) fields
ym:s:productsPurchaseID ym:s:productsCategory ym:s:productsCurrency ym:s:visitID ym:s:UTMContent ym:s:openstatCampaign ym:s:impressionsProductCoupon ym:s:dateTime ym:s:lastDirectConditionType ym:s:browserEngineVersion3 ym:s:browserEngineVersion1 ym:s:browserEngineVersion2 ym:s:UTMMedium ym:s:hasGCLID ym:s:productsCategory1 ym:s:impressionsProductCategory4 ym:s:productsID ym:s:productsVariant ym:s:screenColors ym:s:windowClientHeight ym:s:impressionsProductID ym:s:impressionsProductName ym:s:lastReferalSource ym:s:browserEngine ym:s:physicalScreenHeight ym:s:watchIDs ym:s:screenHeight ym:s:purchaseRevenue ym:s:purchaseShipping ym:s:productsCategory3 ym:s:networkType ym:s:deviceCategory ym:s:screenWidth ym:s:lastSearchEngine ym:s:UTMSource ym:s:operatingSystem ym:s:flashMajor ym:s:windowClientWidth ym:s:productsPrice ym:s:isNewUser ym:s:goalsID ym:s:impressionsProductCategory1 ym:s:impressionsProductCurrency ym:s:ipAddress ym:s:productsBrand ym:s:impressionsURL ym:s:lastSocialNetworkProfile ym:s:browserLanguage
@Slach
Slach / _etc_cron.d_mamonsu_master_fix
Created July 24, 2017 13:09
Fix Mamonsu too big replication lag over update mamonsu table every second
SHELL=/bin/bash
* * * * * postgres /usr/bin/flock -x -w 60 /tmp/mamonsu_fix.lock -c "for i in {0..59}; do psql -q -A -t -c \"SELECT 1 FROM public.mamonsu_timestamp_master_update()\" > /dev/null; sleep 1; done;"
@Slach
Slach / install-pgbouncer-ubuntu-zabbix-agent.sh
Last active July 17, 2017 15:50
Install pgbouncer templates for monitoring under Ubuntu 16.04
#!/bin/bash
set -x pipefail
# run it under root
cd /opt/
rm -rf zabbix-extensions
git clone https://github.com/lesovsky/zabbix-extensions.git
cp -fv /opt/zabbix-extensions/files/pgbouncer/pgbouncer.conf /etc/zabbix/zabbix_agentd.conf.d/pgbouncer.conf
sed -i 's/\/usr\/libexec\/zabbix-extensions\/scripts/\/opt\/zabbix-extensions\/files\/pgbouncer\/scripts/g' /etc/zabbix/zabbix_agentd.conf.d/pgbouncer.conf
echo localhost:6432:pgbouncer:stats:stats > /opt/zabbix-extensions/files/pgbouncer/.pgpass
@Slach
Slach / Dockerfile-etcd
Created May 8, 2017 14:35
yandex clickhouse run over CoreOS ZETCD as Zookeeper server
FROM golang:alpine
MAINTAINER Eugene Klimov <[email protected]>
RUN apk --no-cache add git && \
mkdir -p /zetcd && \
GOPATH=/zetcd go get github.com/coreos/zetcd/cmd/zetcd && \
apk del git && \
cp -v /zetcd/bin/zetcd /bin/zetcd && \
rm -rf /zetcd
@Slach
Slach / Vagrantfile
Created April 19, 2017 14:43
run docker under vagrant with minimal provision
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.box_check_update = false
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
[program:moira-api]
stopwaitsecs = 1
user = moira
group = moira
numprocs=1
command = /usr/local/bin/moira-api -c /etc/moira/config.yml -l /var/log/moira
process_name = %(program_name)s_%(process_num)d
autostart = true
autorestart = true
redirect_stderr = true
#!/bin/bash
### BEGIN INIT INFO
# Provides: graph-explorer
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Graph-Explorer server
# Description: Stateless graph explorer server
### END INIT INFO
@Slach
Slach / flask_pynba_monitoring.py
Last active January 20, 2017 06:14
Flask + Pynba monitoring example
import pynba
import pynba.util
import flask
import logging
import datetime
# see https://gist.github.com/Slach/00c86b1341f738bc9dd5
from monitor import CoffeePynbaMonitor
logger = logging.getLogger('pynba')
@Slach
Slach / cyclone_pynba_monitor.py
Last active January 20, 2017 06:14
cyclone + pynba monitoring
# -*- coding: utf-8 -*-
from coffee_server.common.service_singletone import service
import pynba.util.script as pynba
import cyclone.web
import platform
if platform.system() != 'Windows':
import resource