Skip to content

Instantly share code, notes, and snippets.

Menüpunkte vor Kunden verbergen (global)
[ ] E-Mail
[ ] Domains
[ ] FTP
[ ] Extras
[ ] Verzeichnisschutz
[ ] Pfadoptionen
[ ] System-Log
[ ] Traffic
@micw
micw / check_http_json
Created June 1, 2016 18:52
Simple nagios check that reads a json via http and converts it's output to a nagios check result
#!/usr/bin/python
#
'''
This script reads a JSON from an URL and converts it to nagios-plugin output.
The JSON must be in the following format (See https://nagios-plugins.org/doc/guidelines.html#AEN78
for Details about min/max/warn/crit values and units:
{
status: 'OK'|'WARNING'|'CRITICAL',
message: 'any text not containing single quote',
metrics: [ // optional
/* https://www.youtube.com/watch?v=s8a6txkGqOI */
#include <Servo.h>
Servo servoDreh;
Servo servoHochRunter;
int DREH_UBER_BECHER=170;
int HOCHRUNTER_IN_BECHER=140;
int HOCHRUNTER_UBER_BECHER1=100;
import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.Matchers.*;
import org.junit.Test;
public class TestTheAnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything
{
final int LEET = 1337;
final double PI = Math.PI;
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <PacketSerial.h>
boolean initialized;
PacketSerial serial;
WiFiUDP Udp;
#!/usr/bin/ruby
hash=eval(ARGV[0])
hash.each do |key, value|
puts "["+key+"]"
value.collect do |host|
puts host+" ansible_connection=local"
end
puts
end
@micw
micw / gist:a8b20720db900762a29d
Created September 17, 2015 10:20
WebMvcRequestDispatcherForwardFix
package testutils.mvc;
import static org.mockito.Matchers.anyString;
import javax.servlet.Filter;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequestWrapper;
@micw
micw / nagios-json-check-ok
Created February 3, 2015 11:00
nagios-json-check: Response that indicates 'OK' with some metrics
{
status: 'OK'
message: 'everything is fine'
metrics: [
{ name: 'value1', unit: '%', value: 65.7, warn: 70, crit: 90, min: 0, max:100 }
{ name: 'value2', value: 10, min: 5, max:15 }
]
}
@micw
micw / gist:37d55a21a2253d3cce1d
Last active August 29, 2015 14:11
Rsync push backup client (python)
#!/usr/bin/python
import fcntl
import time
import sys
import os
import yaml
import subprocess
basedir=os.path.dirname(os.path.realpath(__file__))
@micw
micw / gist:b323a67a8dc522218bb8
Created December 10, 2014 10:50
Ansible: shinken-setup
- hosts: default
vars:
- NSCA_PASSWORD: topsecret
handlers:
- name: Restart shinken
service: name=shinken state=restarted
tasks:
- apt_repository: repo='deb http://http.debian.net/debian wheezy-backports main contrib' state=present update_cache=yes
- apt: name=python-pip
- apt: name=python-pycurl