This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Custom parser for nginx log suitable for use by Datadog 'dogstreams'. | |
To use, add to datadog.conf as follows: | |
dogstreams: [path to ngnix log (e.g: "/var/log/nginx/access.log"]:[path to this python script (e.g "/usr/share/datadog/agent/dogstream/nginx.py")]:[name of parsing method of this file ("parse")] | |
so, an example line would be: | |
dogstreams: /var/log/nginx/access.log:/usr/share/datadog/agent/dogstream/nginx.py:parse | |
Log of nginx should be defined like that: | |
log_format time_log '$time_local "$request" S=$status $bytes_sent T=$request_time R=$http_x_forwarded_for'; | |
when starting dd-agent, you can find the collector.log and check if the dogstream initialized successfully | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Find out which process is accessing Memcached on localhost. | |
// It uses SystemTap : https://sourceware.org/systemtap | |
// You will need the kernel-debuginfo-common, kernel-headers and kernel-debuginfo | |
// Packages installed. | |
// | |
probe begin { | |
printf("%5s (%s) %15s %5s %15s %5s %s %s %s %s %s %s\n", | |
"PID", "CMD", "saddr", "SPORT", "daddr", "DPORT", "urg","ack","psh","rst","syn","fin") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from inspect import getargspec; | |
import sys | |
class Consumer(object): | |
def __init__(self, path, callback): | |
print("Creating class..") | |
self._path = path | |
self._callback = callback |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import getpass | |
from cryptography.fernet import Fernet | |
import sys | |
def get_credentials(): | |
# SoftLayer Username/ Api Key encrypted | |
encrypted_credentials = b'' | |
secret_key = getpass.getpass("Please enter your secret key: ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datadog import initialize, api | |
import sys | |
def dd_init(): | |
dd_options = { | |
'api_key': '', | |
'app_key': '' | |
} | |
initialize(**dd_options) | |
return api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Cancel the server with SoftLayer, turn it off and mute the Datadog alerts for it. | |
The host will be available until the next 16th day of the month. | |
""" | |
import SoftLayer | |
import sys | |
from CC_SoftLayer import get_credentials as sl_get_cred | |
from CC_Datadog import dd_init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Generate Server list for mRemote3G (former mRemoteNG) from Datadog Infrastructure List | |
mRemote3G : https://github.com/kmscode/mRemote3G | |
Datadog: app.datadoghq.com | |
Author: Alexandre Andrade | |
""" | |
import json | |
from urllib.request import Request, urlopen | |
from urllib.error import URLError, HTTPError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "The Mick " | |
puts "Gap Year " | |
puts "Stan Lees Lucky Man " | |
puts "The Worst Witch " | |
puts "The Middle " | |
puts "Master of None " | |
puts "Sense8 " | |
puts "Da Vincis Demons " | |
puts "Scorpion " | |
puts "Citizen Khan " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from sys import argv | |
import multiprocessing as mp | |
import time | |
# Ajust for number of cpus/memory | |
# Each process will sort an array of size : ratio_per_process * size_array_largest | |
ratio_per_process = 30000 | |
# Lets consolidate the Sort after some number of interations | |
num_interations = 50 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from sys import argv, exit | |
import random | |
big_file_name = "big_file.txt" | |
max_size_of_number = 1000000 | |
random.seed(123) | |
if len(argv) != 2: | |
print "Usage: %s Num_Lines" % __file__ |
OlderNewer