Skip to content

Instantly share code, notes, and snippets.

View conorbranagan's full-sized avatar

Conor Branagan conorbranagan

View GitHub Profile

Edit your config file:

$ vim /usr/local/var/postgres/postgresql.conf 

Uncomment the line starting with:

timezone = ...

And change it to:

@conorbranagan
conorbranagan / gist:3835272
Created October 4, 2012 17:54
Linesman debug
In dogweb.ini:
[filter:linesman]
use = egg:linesman#profiler
...
[app:main]
filter-with = linesman
@conorbranagan
conorbranagan / gist:3902280
Created October 16, 2012 21:52
DogstatsD from Windows Batch
:: Gauge
echo myapp.my_gauge:123^^^|g | nc -w 1 -u 127.0.0.1 8125
:: Counter
echo myapp.my_counter:1^^^|c | nc -w 1 -u 127.0.0.1 8125
:: Histogram
echo myapp.my_histogram:1^^^|h | nc -w 1 -u 127.0.0.1 8125
@conorbranagan
conorbranagan / gist:4048390
Last active May 23, 2017 18:34
Windows System Metrics

Windows System Metrics

Processes

  • system.proc.queue_length: The process queue length.
  • system.proc.count: The count of running processes.

Memory

@conorbranagan
conorbranagan / gist:4155665
Created November 27, 2012 17:24
test IIS integration
import wmi
w = wmi.WMI('172.23.33.110', user=None, password=None)
wmi_cls = w.Win32_PerfFormattedData_W3SVC_WebService(name="_Total")[0]
print wmi_cls.BytesSentPerSec
@conorbranagan
conorbranagan / gist:4513828
Last active May 18, 2024 21:28
Linux System Metrics

Linux System Metrics

CPU

  • system.cpu.idle: % Idle CPU
  • system.cpu.system: % System CPU
  • system.cpu.user: % User CPU

Disk

>>> import wmi
>>> w = wmi.WMI()
>>> cpu = w.Win32_PerfFormattedData_PerfOS_Processor(name="_Total")[0]
>>> print cpu.PercentUserTime
>>> print cpu.PercentIdleTime
submit_gauge(_, {_Epoch, none}, _) -> ok.
submit_gauge(MetricName, Point, Props) -> datadog:gauge(MetricName, Point, Props).
@conorbranagan
conorbranagan / gist:7108965
Created October 22, 2013 22:01
Debugging windows agent memory leak
import unittest
import logging
logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__file__)
import checks.system.win32 as w32
WIN32_CHECKS = [
w32.Disk(log),
@conorbranagan
conorbranagan / boot_service.py
Created October 24, 2013 14:28
Support multiprocessing in py2exe services
# boot_service.py
import sys
import os
import servicemanager
import win32service
import win32serviceutil
import winerror
# Add multiprocessing support to py2exe services
import multiprocessing