For ubuntu:
sudo add-apt-repository ppa:muffinresearch/graphite
sudo apt-get update
sudo apt-get install python-graphite
| #!/usr/bin/python | |
| """Copyright 2008 Orbitz WorldWide | |
| Licensed under the Apache License, Version 2.0 (the "License"); | |
| you may not use this file except in compliance with the License. | |
| You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, software |
| diff --git a/ddagent.py b/ddagent.py | |
| index fb3f50d..79ac59d 100755 | |
| --- a/ddagent.py | |
| +++ b/ddagent.py | |
| @@ -182,7 +182,7 @@ class ApiInputHandler(tornado.web.RequestHandler): | |
| class Application(tornado.web.Application): | |
| def __init__(self, port, agentConfig): | |
| - self._port = port | |
| + self._port = int(port) |
| # easy_install dogstatsd-python | |
| import time | |
| from statsd import statsd | |
| while True: | |
| statsd.increment("ping.pong") | |
| time.sleep(0.5) |
| from statsd import statsd | |
| import sys | |
| device = sys.argv[1] | |
| while True: | |
| a = sys.stdin.readline().strip() | |
| data = a.split() | |
| if len(data) == 3: | |
| try: |
| easy_install fabric | |
| python -c "import fabric; print fabric" | |
| # <module 'fabric' from '.../python2.7/site-packages/Fabric-1.4.3-py2.7.egg/fabric/__init__.pyc'> | |
| cd dogapi | |
| fab -f examples/fabfile.py sweet_task:"yay!" | |
| # My sweet task always runs properly. | |
| # | |
| # Done. |
| # standard imports for this example | |
| import os | |
| import time | |
| from datetime import datetime as dt | |
| from datetime import timedelta as delta | |
| import math | |
| # import the simple dog client | |
| from dogapi import dog_http_api as dog |
| # on one triplet, e.g. s11.ams, s11.aus, s11.chi | |
| # python hostname.py | |
| import socket | |
| import os | |
| import pprint | |
| print("socket, hostname") | |
| print(socket.gethostname(), os.popen("hostname").read().strip(), [r for r in open("/etc/dd-agent/datadog.conf").readlines() if r.find("hostname:") > -1]) | |
| pprint.pprint(open("/etc/hosts").readlines()) |
| Changes in HEAD | |
| Modified checks/common.py | |
| diff --git a/checks/common.py b/checks/common.py | |
| index 1b84928..b014f63 100644 | |
| --- a/checks/common.py | |
| +++ b/checks/common.py | |
| @@ -126,11 +126,12 @@ class checks(object): | |
| if self.agentConfig.get('hostname'): | |
| metadata['agent-hostname'] = self.agentConfig.get('hostname') |
| location = /nginx_status { | |
| listen 9999; | |
| stub_status on; | |
| access_log off; | |
| allow 127.0.0.1; | |
| deny all; | |
| } |