{ "info": { "author": "Nextdoor Engineering", "author_email": "eng@nextdoor.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Operating System :: POSIX", "Programming Language :: Python", "Topic :: Software Development" ], "description": "# Zookeeper Node Monitoring Daemon\n\n[![Build Status](https://travis-ci.org/Nextdoor/zkmonitor.svg?branch=master)](https://travis-ci.org/Nextdoor/zkmonitor)\n[![# of downloads](https://pypip.in/d/zk_monitor/badge.png)](https://pypi.python.org/pypi/zk\\_monitor)\n[![pypy version](https://badge.fury.io/py/zk_monitor.png)](https://pypi.python.org/pypi/zk\\_monitor)\n\n\nThis is a simple daemon for monitoring particular Zookeeper nodes for\ncompliance with a given set of specifications (ie, minimum number of\nregistered nodes). In the event that a path changes and becomes out of\nspec, (too few nodes, for example), an alert is fired off to let you know.\n\n## Clustered Design\n\n*zk_monitor* is designed to operate in clustered mode with multiple redundant\nagents running on multiple servers. The agents talk to eachother through\nZookeeper using a common path and a series of locks/znodes. You can run as\nmany agents as you want, but only one will ever handle sending off alerts.\n\n## Configuration\n\nMost of the connection and *zk_monitor* specific settings are managed via\nCLI arguments:\n\n $ python runserver.py --help\n Usage: runserver.py \n \n Options:\n --version show program's version number and exit\n -h, --help show this help message and exit\n -z ZOOKEEPER, --zookeeper=ZOOKEEPER\n Zookeeper Server (def: localhost:2181)\n --zookeeper_user=ZOOKEEPER_USER\n Zookeeper ACL Username\n --zookeeper_pass=ZOOKEEPER_PASS\n Zookeeper ACL Password\n -c CLUSTER_NAME, --cluster_name=CLUSTER_NAME\n Unique cluster name (ie, prod-zookeeper-monitor)\n --cluster_prefix=CLUSTER_PREFIX\n Prefix path in Zookeeper for all zk_monitor clusters\n -f FILE, --file=FILE Path to YAML file with znodes to monitor.\n -p PORT, --port=PORT Port to listen to (def: 8080)\n -l LEVEL, --level=LEVEL\n Set logging level (INFO|WARN|DEBUG|ERROR)\n -s SYSLOG, --syslog=SYSLOG\n Log to syslog. Supply facility name. (ie \"local0\")\n\nThe list of paths that you want to monitor are supplied via a YAML\nformatted configuration file. Here's an example file:\n\n /services/foo/min_1:\n alerter:\n email: you@home.com\n children: 1\n /services/foo/min_0:\n alerter:\n email: your_buddy@home.com\n children: 0\n /services/foo/min_3:\n children: 3\n\n### Alerter Configuration\n\nIn the above example, you'll see that two of the paths have an 'alerter/email'\nparameter configured. With this in place, any path spec violations will result\nin an email fired off to that address. The third path does not have any\nsettings, which means that no alert will actually be sent off in the event of\na spec violation.\n\n### Simple Execution\n\n $ python runserver.py -l INFO -z localhost:2181 -f test.yaml\n 2014-05-31 16:20:25,862 [35661] [nd_service_registry] [__init__]: (INFO) Initializing ServiceRegistry object\n 2014-05-31 16:20:25,863 [35661] [nd_service_registry] [_connect]: (INFO) Connecting to Zookeeper Service (localhost:2181)\n 2014-05-31 16:20:25,867 [35661] [nd_service_registry] [_state_listener]: (INFO) Zookeeper connection state changed: CONNECTED\n 2014-05-31 16:20:25,868 [35661] [nd_service_registry] [__init__]: (INFO) Initialization Done!\n 2014-05-31 16:20:25,868 [35661] [zk_monitor.monitor] [_stateListener]: (INFO) Service registry connection state: True\n\n## REST Interface\n\nThough not necessary for alerting purposes, you can access the a JSON-formatted\nREST interface for the intentionally inspecting the status of the app, and\nthe current compliance of your watched Zookeeper nodes.\n\n### /status\n\nThis page provides a simple live status of the app and its monitors.\n\n $ curl --silent http://localhost:8080/status\n {\n \"monitor\": {\n \"alerter\": {\n \"alerting\": true\n },\n \"compliance\": {\n \"/services/foo/min_0\": true,\n \"/services/foo/min_1\": \"Found children (0) less than minimum (1)\",\n \"/services/foo/min_3\": \"Found children (2) less than minimum (3)\"\n }\n },\n \"version\": \"0.0.1\",\n \"zookeeper\": {\n \"connected\": true\n }\n }\n\n## Development\n\n### Class/Object Architecture\n\n runserver\n |\n +-- nd_service_registry.KazooServiceRegistry\n | | Connection to Zookeeper\n |\n +-- alert.Dispatcher\n | | Handles dispatching of all alerts to Alerter objects\n | |\n | +-- alerts.email.EmailAlerter\n | | | Sends Email-Based Alerts Asynchronously\n | | |\n | | +-- tornadomail.backends.smtp.EmailBackend()\n | |\n | +-- alerts.rest.HipChatAlerter\n | | Sends Hipchat Alerts Asynchronously\n |\n +-- cluster.State\n | | Handles node-to-node communication via Zookeeper\n | |\n | +-- Registers /zk_monitor/agent/\n |\n +-- monitor.Monitor\n | | Monitors all configured paths\n | |\n | +-- Obj Ref -> alerts.Dispatcher\n | | Alerts are fired off to the Dispatcher, the Dispatcher\n | | handles determining whether or not the alert is a dup, a shift\n | | from in-compliance to out-of-compliance (or vice versa),\n | | and which Alerters to fire off (Hipchat, Email, etc).\n |\n +-- tornado.Application\n | | Handles all web requests\n | |\n | +-- web.app.getApplication()\n | |\n | +-- root.RootHandler\n | | URL: /\n | |\n | +-- state.StateHandler\n | | URL: /state\n | | Obj Ref -> nd_service_registry.KazooServiceRegistry\n | | Obj Ref -> monitor.Monitor\n\n### Setup\n\n # Create a dedicated Python virtual environment and source it\n virtualenv --no-site-packages .venv\n unset PYTHONPATH\n source .venv/bin/activate\n\n # Install the dependencies\n make build\n\n # Run the tests\n make test\n\n\n### Postfix on Mac OSX\n\nIf you want to develop on a Mac OSX host, you need to enable email the\n*postfix* daemon on your computer. Here's how!\n\nModify */Syatem/Library/LaunchDaemons/org.postfix.master.plist*:\n\n --- /System/Library/LaunchDaemons/org.postfix.master.plist.bak\t2014-06-02 11:45:24.000000000 -0700\n +++ /System/Library/LaunchDaemons/org.postfix.master.plist\t2014-06-02 11:47:07.000000000 -0700\n @@ -9,8 +9,6 @@\n ProgramArguments\n \n master\n - -e\n - 60\n \n QueueDirectories\n \n @@ -18,5 +16,8 @@\n \n AbandonProcessGroup\n \n +\n + KeepAlive\n + \n \n \n\nRestart the service:\n\n cd /System/Library/LaunchDaemons\n sudo launchctl unload org.postfix.master.plist \n sudo launchctl load org.postfix.master.plist", "description_content_type": null, "docs_url": null, "download_url": "http://pypi.python.org/pypi/zk_monitor#downloads", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Nextdoor/zkmonitor", "keywords": "zookeeper apache zk", "license": "Apache License, Version 2.0", "maintainer": null, "maintainer_email": null, "name": "zk_monitor", "package_url": "https://pypi.org/project/zk_monitor/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/zk_monitor/", "project_urls": { "Download": "http://pypi.python.org/pypi/zk_monitor#downloads", "Homepage": "https://github.com/Nextdoor/zkmonitor" }, "release_url": "https://pypi.org/project/zk_monitor/0.1.2/", "requires_dist": null, "requires_python": null, "summary": "Zookeeper Monitoring Service", "version": "0.1.2" }, "last_serial": 1463419, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "8e6c76dfb1e45c9141705237056dfda6", "sha256": "d023a90829f12a0f801e91f2c2a0d2854265953f0b17badab4a90caae870784f" }, "downloads": -1, "filename": "zk_monitor-0.1.1.tar.gz", "has_sig": false, "md5_digest": "8e6c76dfb1e45c9141705237056dfda6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17588, "upload_time": "2014-07-09T23:59:12", "url": "https://files.pythonhosted.org/packages/23/17/e86fce33313f4971c3b6c5143d9d6a4287d5ce73338390e31fca6dc8196c/zk_monitor-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "2e0ac1a6ee3cd2c751970b2e9701b7c8", "sha256": "29c3da728681f019477a8817047d7d50f1a54dda44c9b146f66ea510228325ee" }, "downloads": -1, "filename": "zk_monitor-0.1.2.tar.gz", "has_sig": false, "md5_digest": "2e0ac1a6ee3cd2c751970b2e9701b7c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18869, "upload_time": "2015-03-16T21:27:38", "url": "https://files.pythonhosted.org/packages/90/52/9d814268b7e5d17d36f8ad282c2b60e7378cd191dd461c55fc30e5423034/zk_monitor-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2e0ac1a6ee3cd2c751970b2e9701b7c8", "sha256": "29c3da728681f019477a8817047d7d50f1a54dda44c9b146f66ea510228325ee" }, "downloads": -1, "filename": "zk_monitor-0.1.2.tar.gz", "has_sig": false, "md5_digest": "2e0ac1a6ee3cd2c751970b2e9701b7c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18869, "upload_time": "2015-03-16T21:27:38", "url": "https://files.pythonhosted.org/packages/90/52/9d814268b7e5d17d36f8ad282c2b60e7378cd191dd461c55fc30e5423034/zk_monitor-0.1.2.tar.gz" } ] }