Skip to content

Instantly share code, notes, and snippets.

View rchakode's full-sized avatar
😋
Noises disturb when doing boring things.

Rodrigue Chakode rchakode

😋
Noises disturb when doing boring things.
View GitHub Profile
{
"name": "William K.L. Dickson",
"birth": "1860-08-03",
"films": [
{
"imdbID": 1,
"title": "Carmencita",
"year": 1894,
"director": "William K.L. Dickson",
"rating": "NOT RATED",
{
"name": "Louis Lumière",
"birth": "1864-10-05",
"films": [
{
"imdbID": 10,
"title": "Employees Leaving the Lumière Factory",
"year": 1895,
"runtime": "1 min",
"genre": "Documentary, Short",
@rchakode
rchakode / graphite_sar_monitor_system_devices_withoutpush.sh
Created October 28, 2019 21:36
Script that periodically monitor system disks counters using sar utility, samples are outputted to stdin
#!/bin/bash
SAMPLING_INTERVAL=5
GRAPHITE_SERVER="127.0.0.1"
GRAPHITE_CARBON_PAINTEXT_PORT=2003
LC_ALL=C \
sar -d $SAMPLING_INTERVAL | \
gawk -vhostname="$(hostname)" '{
if (NF == 10 && $2 != "DEV") {
timestamp = systime();
printf("%s.%s.rd_sec %s %d\n", hostname, $2, $4, timestamp);
@rchakode
rchakode / push_stdin_live_samples_to_graphite_using_in_bulk.py
Last active May 12, 2022 14:07
Script that reads Graphite plaintext metrics from stdin and pushes them to carbon-cache in bulk using pickle
#!/usr/bin/python
import os
import time
import socket
import pickle
import struct
import fileinput
import calendar
CARBON_CACHE_SERVER = '127.0.0.1'
@rchakode
rchakode / graphite_sar_monitor_system_devices_withpush.sh
Last active October 28, 2019 21:37
Script that periodically monitor system disks counters using sar utility, samples are pushed to a Graphite's carbon-cache instance.
#!/bin/bash
SAMPLING_INTERVAL=5
GRAPHITE_SERVER="127.0.0.1"
GRAPHITE_CARBON_PAINTEXT_PORT=2003
LC_ALL=C \
sar -d $SAMPLING_INTERVAL | \
gawk -vhostname="$(hostname)" '{
if (NF == 10 && $2 != "DEV") {
timestamp = systime();
printf("%s.%s.rd_sec %s %d\n", hostname, $2, $4, timestamp);
@rchakode
rchakode / prometheus_exporter_system_resource_usage.py
Last active December 15, 2022 13:11
Sample Python program providing a Prometheus exporter that exposes system CPU and memory usage every 5 minutes.
import prometheus_client
import time
import psutil
UPDATE_PERIOD = 300
SYSTEM_USAGE = prometheus_client.Gauge('system_usage',
'Hold current system resource usage',
['resource_type'])
if __name__ == '__main__':