Skip to content

Instantly share code, notes, and snippets.

@alq666
alq666 / gist:183130
Created September 8, 2009 18:37
nusync gone mad
usersync 1746 0.0 0.0 3524 544 pts/3 S 13:38 0:00 tail -F /home/usersync/sync-summary-from-production.log
usersync 2132 0.0 0.0 0 0 ? Zs 13:40 0:00 [tail-log-files-] <defunct>
usersync 2193 0.0 0.0 3524 544 ? S 13:40 0:00 tail -F /home/usersync/sync-summary-from-production.log
usersync 4315 0.0 0.0 0 0 ? Zs 13:45 0:00 [tail-log-files-] <defunct>
usersync 4389 0.0 0.0 3524 544 ? S 13:45 0:01 tail -F /home/usersync/sync-summary-from-production.log
usersync 4445 0.0 0.0 0 0 ? Zs 14:25 0:00 [tail-log-files-] <defunct>
usersync 4502 0.0 0.0 3524 548 ? S 14:25 0:00 tail -F /home/usersync/sync-summary-from-production.log
usersync 7051 0.0 0.0 0 0 ? Zs 13:50 0:00 [tail-log-files-] <defunct>
usersync 7117 0.0 0.0 3524 548 ? S 13:50 0:00 tail -F /home/usersync/sync-summary-from-production.log
nthomas 8645 0.1 0.0 7188 2760 pts/15
>>> RING_SIZE = 2**127
>>> def tokens(n):
... rv = []
... for x in xrange(n):
... rv.append(RING_SIZE / n * x)
... return rv
...
>>> tokens(4)
[0L, 42535295865117307932921825928971026432L, 85070591730234615865843651857942052864L, 127605887595351923798765477786913079296L]
@alq666
alq666 / mongoload.js
Created February 21, 2011 22:13
Simple test harness for mongo
db.foo.drop();
db.foo.insert( { _id : 1 } )
ops = [{ op : "findOne" , ns : "test.foo" , query : { _id : 1 } }]
for ( x = 1; x<=128; x*=2){
res = benchRun( { parallel: x, seconds: 5, ops: ops } )
print( "threads: " + x + "\t queries/sec: " + res.query )
}
@alq666
alq666 / Xulrunner gdb session
Created March 1, 2011 22:56
xulrunner-bin is stuck
$ gdb /usr/lib/xulrunner-1.9.2.13/xulrunner-bin 20626
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
@alq666
alq666 / gist:1025219
Created June 14, 2011 16:02
No swap no good.
[2662122.262113] swapper: page allocation failure. order:0, mode:0x20[2662122.262119] Pid: 0, comm: swapper Not tainted 2.6.32-314-ec2 #27-Ubuntu
[2662122.262122] Call Trace:
[2662122.262124] <IRQ> [<ffffffff810b432c>] __alloc_pages_slowpath+0x46c/0x580[2662122.262142] [<ffffffff81436cc0>] ? ip_local_deliver_finish+0x0/0x2d0[2662122.262146] [<ffffffff810b45b1>] __alloc_pages_nodemask+0x171/0x180
[2662122.262151] [<ffffffff810e3a7c>] T.618+0x11c/0x480
[2662122.262154] [<ffffffff810e401e>] cache_alloc_refill+0x23e/0x280
[2662122.262156] [<ffffffff810e4205>] __kmalloc+0x1a5/0x1d0
[2662122.262162] [<ffffffff813ff95b>] __alloc_skb+0x6b/0x170
[2662122.262169] [<ffffffff8100c98a>] ? sched_clock+0x1a/0x40
[2662122.262173] [<ffffffff81453d10>] ? tcp_delack_timer+0x0/0x280
[2662122.262175] [<ffffffff8145253e>] tcp_send_ack+0x2e/0x120
@alq666
alq666 / gist:1199208
Created September 6, 2011 22:43
La liste des sources supportées par Datadog

Mise à jour 2011-09-06. On ajoute des nouvelles sources régulièrement, en fonction de la demande.

OS

  • System stats for linux Centos/Redhat 5 & 6, Ubuntu >= 10.04 LTS

Online services

@alq666
alq666 / context.sql
Created November 13, 2011 03:05
Context query on staging
SELECT c.key,
c.org_id,
c.source_type_id,
c.host_id,
c.host_name,
c.device_name,
c.tags,
o.api_key
FROM dim_context c
join org o on c.org_id = o.id
@alq666
alq666 / test_simpleclient.py.diff
Created November 28, 2011 23:15
Testing tags
diff --git a/tests/test_simpleclient.py b/tests/test_simpleclient.py
index d30ff1f..69cb2b4 100644
--- a/tests/test_simpleclient.py
+++ b/tests/test_simpleclient.py
@@ -75,11 +75,13 @@ class TestSimpleClient(unittest.TestCase):
assert now_event['text'] == now_message
assert before_event['text'] == before_message
- event_id = dog.event('test host and device', 'test host an device', host='test.host', device_name='test.device')
+ event_id = dog.event('test host and device', 'test host an device', host='test.host', device_name='test.device', tags=["test-tag-1", "test-tag-2"])
@alq666
alq666 / gist:1494675
Created December 18, 2011 22:29
What we support
Via our open-source agent (https://github.com/datadog/dd-agent) deployed on your servers we understand performance metrics from:
* linux (cpu, io, memory, network)
* sql (mysql, postgres)
* memory-based (memcached, redis)
* nosql (cassandra, couchdb, mongodb)
* metric collection (ganglia)
* MQ (rabbitmq)
* http (apache, nginx)
* continuous integration (hudson/jenkins)
@alq666
alq666 / gist:1495301
Created December 19, 2011 03:52
Step-by-step integration between chef and datadog-agent

Now that you have successfully deployed our agent using Chef you want to monitor your applications using Datadog without extensive manual configuration.

In this article we will use PostgreSQL to demonstrate how to let Chef do all the work for us.

Step-by-step example

Step 0. Install postgresql on the server

Start by importing the community's cookbook. knife cookbook site install postgresql