Skip to content

Instantly share code, notes, and snippets.

View adionditsak's full-sized avatar

Anders Aarvik adionditsak

View GitHub Profile
@adionditsak
adionditsak / SRX cheatsheet
Created February 17, 2015 15:38
Juniper SRX cheatsheet
# Juniper SRX cheatsheet
#Help
help
<command> ?
#Show
show configuration
@adionditsak
adionditsak / RELK.sh
Last active February 21, 2021 04:25
Install the ELK stack (with Redis) with one script for the central log server (CentOS 6.5).
#/bin/bash
##########################################################
### INTRODUCTION
##########################################################
: '
Install and configure R (Redis) + ELK server from scratch on CentOS 6.5.
* Logstash version 1.4.2
* Elasticsearch version 1.3.2
@adionditsak
adionditsak / elasticsearch_lastlog.py
Last active February 2, 2017 13:48
Check_mk plugin to check for last log from Elasticsearch compared to current time
#!/usr/bin/env python
import requests
import datetime
import json
import os
"""
Check_mk plugin to check for last log from Elasticsearch compared to current time
"""
@adionditsak
adionditsak / consul
Created January 30, 2017 10:26
consul startup/service script (ubuntu 14)
#
# Daemon for consul
#
# chkconfig: 345 98 20
# description: Daemon for consul
# processname: consul
### BEGIN INIT INFO
# Provides: consul
# Required-Start: $network
@adionditsak
adionditsak / vault
Created January 30, 2017 09:49
vault startup/service script (ubuntu 14)
#
# Daemon for vault
#
# chkconfig: 345 99 20
# description: Daemon for vault
# processname: vault
### BEGIN INIT INFO
# Provides: vault
# Required-Start: $network
@adionditsak
adionditsak / generatehostsfile.sh
Created February 12, 2016 12:28
Generate hosts file with AWS ec2 private IP's
#!/bin/bash
# Generate hosts-file with private IP's in AWS ec2
# Vars
hosts_file="/etc/hosts"
region="eu-west-1"
# AWS call
described_instances=`aws ec2 describe-instances --region ${region}`
#!/usr/bin/env python
"""
FileCli
"""
import sys, os
class FileOperation():
@adionditsak
adionditsak / apache.pp
Created December 25, 2013 00:04
Maintain Apache2
class apache {
notify {'Apache2':
before => Service['apache2']
}
exec {'apt-get update':
command => '/usr/bin/apt-get update'
}
#!/usr/bin/env bash
# vars #
disk="/dev/disk0s2" # disk to monitor
current_usage=$(df -h | grep ${disk} | awk {'print $5'}) # get disk usage from monitored disk
max_usage="20%" # max 90% disk usage
mail="aarvik92@gmail.com" # mail to sent alert to
# functions #
function max_exceeded() {
<?php
/*
*
* Get your Facebook-statuses and Twitter-tweets on your website with ease.
* Go to http://feedburner.com and burn your feed.
* Use your feedburner-url with this class to set feed.
*
* Author: Anders Aarvik
*
*/