Pythonと DataDogを 使って簡単な システムモニターリング (Pycon apac 2013)

62
PyCon APAC 2013 Pythonと DataDogを 使って簡単な システムモニターリング 13915日日曜日

description

Sessinon in Pycon apac 2013

Transcript of Pythonと DataDogを 使って簡単な システムモニターリング (Pycon apac 2013)

  • 1. PyCon APAC 2013 Python DataDog 13915

2. Engineering Advice You are only as smart as the average of the top 5 people you hang out with. by Gene Kim 13915 3. Engineering Advice You are only as smart as the average of the top 5 people you hang out with. by Gene Kim 13915 4. http://www.ickr.com/photos/sk8geek/4959759309/ 13915 5. Visualize & Display 13915 6. Collection Correlation Collaboration Keywords 13915 7. : / 13915 8. page-14: 9-11 CMS(@terapyon) (@jhotta) 13915 9. page-14: 9-11 CMS(@terapyon) (@jhotta) 13915 10. 13915 11. DevOps The (Short) History of DevOps: http://www.youtube.com/watch?v=o7-IuYS0iSE 13915 12. DevOps is an enterprise capability for continuous (software) service delivery that enables clients to seize market opportunities and reduce time to customer feedback. by IBM 13915 13. CI & CD Puppet, Chef Log Analysis Monitoring Metrics Management Corporate culture Communication 13915 14. 13915 15. DB 13915 16. 13915 17. 13915 18. 13915 19. 13915 20. 13915 21. Python / Python Tools&! http://www.publickey1.jp/blog/12/devops_3.html 13915 22. http://www.youtube.com/embed/7RhKDTxybEE? IT 13915 23. : gengo 13915 24. 5 13915 25. 5 13915 26. 5 13915 27. http://www.datadoghq.com/product/ 13915 28. Integrations 13915 29. dogstatsd-python 13915 30. 13915 31. 13915 32. 13915 33. Docs(http://docs.datadoghq.com/) 13915 34. Datadog agent install(https://app.datadoghq.com/account/settings#agent) 13915 35. Datadog agent install(https://app.datadoghq.com/account/settings#agent) $ DD_API_KEY=c81dc7fbacbfca8c9e4f1c02d439f112 bash - c "$(wget -qO- http://dtdg.co/agent-install-ubuntu)" $ sudo sh -c "echo 'deb http://apt.datadoghq.com/ unstable main' > /etc/apt/sources.list.d/datadog.list" $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv- keys C7A7DA52 $ sudo apt-get update $ sudo apt-get install datadog-agent $ sudo sh -c "sed 's/api_key:.*/api_key: c81dc7fbacbfca8c9e4f1c02d439f112/' /etc/dd-agent/ datadog.conf.example > /etc/dd-agent/datadog.conf" $ sudo /etc/init.d/datadog-agent start 13915 36. : gengo 13915 37. : gengo 13915 38. Send Apps Metrics 1(http://docs.datadoghq.com/guides/metrics/) $ easy_install dogstatsd-python 13915 39. Send Apps Metrics 2(http://docs.datadoghq.com/guides/metrics/) Counters(function) Gauges(function) Histograms(function) Sets(function) Tags(variable) Sample Rates(variable) 13915 40. Send Apps Metrics 3(http://docs.datadoghq.com/guides/metrics/) # Counter from statsd import statsd def render_page(): """ Render a web page. """ statsd.increment('web.page_views') return 'Hello World!' 13915 41. Send Apps Metrics 4(http://docs.datadoghq.com/guides/metrics/) # Gauges from statsd import statsd def get_free_memory() ... return free_memory while True: statsd.gauge('system.mem.free', get_free_memory()) time.sleep(10) 13915 42. Send Apps Metrics 5(http://docs.datadoghq.com/guides/metrics/) # Histograms from statsd import statsd @statsd.timed('database.query.time') def get_data(): return db.query() 13915 43. Send Apps Metrics 6(http://docs.datadoghq.com/guides/metrics/) # Sets from statsd import statsd def login(self, user_id): # Log the user in ... statsd.set('users.uniques', user_id) 13915 44. Send Events 1(http://docs.datadoghq.com/api/) $ easy_install dogapi 13915 45. Send Events 2(http://docs.datadoghq.com/api/) title [required]The event title. text [required]The body of the event. date_happened [optional, default=now]POSIX timestamp of the event. priority [optional, default='normal']The priority of the event ('normal' or 'low'). tags [optional, default=None]A list of tags to apply to the event. alert_type [optional, default='info']"error", "warning", "info" or "success" aggregation_key [optional, default=None]An arbitrary string to use for aggregation. source_type_name [optional, default=None]The type of event being posted. (Options: nagios, hudson, jenkins, user, my apps, feed, chef, puppet, git, bitbucket, fabric, capistrano) 13915 46. Send Events 3(http://docs.datadoghq.com/api/) from dogapi import dog_http_api as api api.api_key = 'your datadog api key' api.application_key = 'your datadog api application key' title = 'PythonDatadog text = 'PyCon !' tags = ['version:1', 'application:web'] api.event_with_response(title, text, tags=tags) 13915 47. API 13915 48. 13915 49. 13915 50. TimeBorad: URLlogin ScreenBorad: login 13915 51. http://player.vimeo.com/video/68172585?autoplay=1 13915 52. TV de Raspberry pi (TVbrowserOK) http://www.triggeredmessaging.com/blog/server-monitoring-with-a-raspberry-pi-and-graphite http://raspberrypi.stackexchange.com/questions/2059/disable-screen-blanking-in-x-windows-on-raspbian 13915 53. 3500 http://www.raspberrypi.org/ Raspberry pi 13915 54. x100 PostgressSQL cpu 13915 55. )H/WEC2 cpu 13915 56. KPI DevOps () 1. 2. 3. 4. 5. 13915 57. KPI Lean Start Up () (AARRR) data collection correlation ( ) graphing () 13915 58. Datadogpython 13915 59. DevOps Day Tokyo 2013 9/28 13915 60. gengo API Sgin up now! 13915 61. gengo API Sgin up now! 13915 62. 13915