Skip to content

Instantly share code, notes, and snippets.

View bilalatli's full-sized avatar

Bilal ATLI bilalatli

View GitHub Profile
@bilalatli
bilalatli / prometheus-node-exporter
Created March 4, 2020 07:01
Prometheus node exporter default environment file v0.18.1
# This environment file doesn't work on new node-expoter releases...
# Default location for this file : /etc/default/prometheus-node-exporter
# ------
# Set the command-line arguments to pass to the server.
# Due to shell scaping, to pass backslashes for regexes, you need to double
# them (\\d for \d). If running under systemd, you need to double them again
# (\\\\d to mean \d), and escape newlines too.
ARGS="--collector.diskstats.ignored-devices=^(ram|loop|fd|(h|s|v|xv)d[a-z]|nvme\\d+n\\d+p)\\d+$ \
--collector.filesystem.ignored-mount-points=^/(sys|proc|dev|run)($|/) \
--collector.netdev.ignored-devices=^lo$ \
@bilalatli
bilalatli / install-prometheus.sh
Last active March 3, 2020 14:10
Prometheus basic install script
#!/bin/bash
export PROM_RELEASE="2.2.1"
cd /tmp
echo "Downloading Prometheus Release : ${PROM_RELEASE}"
wget -q https://github.com/prometheus/prometheus/releases/download/v${PROM_RELEASE}/prometheus-${PROM_RELEASE}.linux-amd64.tar.gz
tar xvf prometheus-${PROM_RELEASE}.linux-amd64.tar.gz
@bilalatli
bilalatli / prometheus.yml
Created March 3, 2020 13:30
Prometheus default configuration file
global:
scrape_interval: 5s # Global scrape interval
evaluation_interval: 5s # Evaluate rules every x second
scrape_timeout: 15s # Scrape timeout limit
scrape_configs:
- job_name:
#scrape_interval: 5s # Scrape interval for current job
#scrape_timeout: 5s # Scrape timeout for current job
static_configs:
@bilalatli
bilalatli / prometheus.service
Created March 3, 2020 13:22
Prometheus systemd service file
[Unit]
Description=Prometheus systemd service unit
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=prometheus
Group=prometheus
ExecReload=/bin/kill -HUP $MAINPID
@bilalatli
bilalatli / openvpn-install.sh
Created February 9, 2020 23:03
Openvpn Installation Script
#!/bin/bash
# Secure OpenVPN server installer for Debian, Ubuntu, CentOS, Fedora and Arch Linux
# https://github.com/angristan/openvpn-install
function isRoot () {
if [ "$EUID" -ne 0 ]; then
return 1
fi
}
@bilalatli
bilalatli / build-nginx.sh
Created December 20, 2019 06:50 — forked from risyasin/build-nginx.sh
Ubuntu 18 Nginx compile with ModSecurity + ModPageSpeed + Headers + Cache purge with Threads support
#!/usr/bin/env bash
set -e
# http://nginx.org/download/nginx-1.16.0.tar.gz
SRC_ROOT=/usr/src
NSRC_ROOT=/usr/src/nginx
NPS_VERSION=1.13.35.2
NGINX_VERSION=1.16.0
@bilalatli
bilalatli / build-php.sh
Last active February 16, 2020 20:58 — forked from risyasin/build-php.sh
Ubuntu 18 PHP compile Pear + DB4 + Argon for AWS "A" instances
#!/bin/bash
### Builds PHP from source on Ubuntu 18
set -e
echo "Prepairing build tools"
DEBIAN_FRONTEND=noninteractive apt update -y && apt install -y build-essential \
bison autoconf bison re2c pkg-config libsystemd-dev libxml2-dev \
libssl-dev libsqlite3-dev libcurl4-openssl-dev libcurl4 \
unzip libenchant-dev libffi-dev libpng-dev libgmp-dev libonig-dev \
libpq-dev libedit-dev librecode-dev libargon2-0-dev libzip-dev
@bilalatli
bilalatli / cloudmin-kvm-debian-install.sh
Created December 20, 2019 06:48
Cloudmin KVM - Debian install script
#!/bin/sh
# cloudmin-kvm-debian-install.sh
# Copyright 2005-2011 Virtualmin, Inc.
#
# Installs Cloudmin GPL for KVM and all dependencies on a Debian or Ubuntu
# system.
#
# Debug & Optimize : @risyasin
VER=1.1
@bilalatli
bilalatli / redis-simple-ratelimiter.lua
Created December 6, 2019 08:49
Redis simple rate limiter lua script
local inc = redis.call('INCR', KEYS[1])
if inc > tonumber(ARGV[1])
then
return 1
end
if inc == 1
then
redis.call('PEXPIRE', KEYS[1], ARGV[2])
end
return 0
@bilalatli
bilalatli / iptables-commands
Created December 6, 2019 08:45
IP Tables - Commands
# SNAT (POSTROUTING)
-A POSTROUTING -s 192.168.1.10/32 -j SNAT --to-source 111.111.111.111
# DNAT (PREROUTING)
-A PREROUTING -d 111.111.111.111 -j DNAT --to-destination 192.168.1.10