{ "info": { "author": "Jean-Philippe Camguilhem", "author_email": "jp.camguilhem+eggs@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Programming Language :: Python :: 2.7" ], "description": ".. contents::\n\nIntroduction\n============\n\n\ncheck_planet.diff is a 'Nagios like' (Nagios|Icinga|Centreon|Shinken) probe checking the delay of your OSM Planet with offical, based on minute-diff state files.\n\nMore infos here http://wiki.openstreetmap.org/wiki/Minutely_Mapnik\n\n- Code repository: https://github.com/paulla/paulla.checkplanetdiff\n\n\nInstall\n-------\n\neasy_install | pip witthin or not a virtualenv::\n \n pip install | easy_install paulla.check_planetdiff\n\nzc.buildout users just add paulla.check_planetdiff to your eggs list as usual.\n\nYou could simply run install or tests with::\n \n bin/python setup.py install\n bin/python setup.py test\n\nMayba add a symbolic link from bin/check_planetdiff to your nagios/plugins/ directory\n\n\n\nNagios like configuration\n---------------------------\n\ncheck_planetdiff could be called localy or remotely via check_by_ssh or NRPE.\n\nhere a sample definition to check remotely by ssh \n\nCommand definition ::\n \n # 'check_ssh_planetdiff' command definition\n define command {\n command_name check_ssh_planetdiff\n command_line $USER1$/check_by_ssh -H $HOSTADDRESS$ -C \"/usr/lib/nagios/plugins/check_planetdiff -w $ARG1$ -c $ARG2$ --state-file $ARG3$ -p\" \n }\n\nNotice the last -p arg for performance data is optionnal, remove it if don't needed.\n\nthe service itself::\n \n # planet diff delay\n define service {\n use paulla-service\n service_description delay planet diff\n check_command check_ssh_planetdiff!0.0:3600.0!0.0:21600.0!/home/mapnik/.osmosis/state.txt\n host_name biscaou\n }\n\n\n\n\nNagios like' synchronise delay OSM Planet check\n=================================================\n\n\nUse case\n\n\nThe check is simple and robust, no database query.\n\nDelay is just datetime.datetime.utcnow() - OSM timestamp in state.txt (usaualy /home/mapnik.osmosis/state.txt)\n\nMore infos here http://wiki.openstreetmap.org/wiki/Minutely_Mapnik\n\nWe fake 3 state files with three different timestamp (see tests/ directory). \n\nWe have to fake now according to tests files states.\n\nnow = datetime(2012, 10, 23, 20, 4, 30) # see test function\n\nReal check is datetime.datetime.utcnow()\n\nWarning and critical thresholds are respectively 3600 and 21600 seconds (1 and 6 hours)\n\nTime to work\n\nnecessary stuff::\n \n >>> import glob\n >>> import subprocess\n >>> from datetime import datetime\n >>> from pprint import pprint\n\na funtion to get lines from fake state files::\n \n >>> def get_lines_from_file(filename):\n ... with open(filename) as state_file:\n ... return state_file.read().splitlines()\n ...\n \n\nUsage\n------\n\n-h option ::\n \n >>> cmd_h = \"bin/test_check_planetdiff -h\"\n >>> p_help = subprocess.Popen(cmd_h.split(), stdout=subprocess.PIPE)\n >>> pprint(p_help.stdout.readlines())\n ['Usage: test_check_planetdiff [options]\\n',\n '\\n',\n 'Options:\\n',\n ' --state-file=STATEFILE\\n',\n ' -p return performance data\\n',\n ' -v, --verbose \\n',\n ' -H HOSTNAME, --hostname=HOSTNAME\\n',\n ' -w WARNING, --warning=WARNING\\n',\n ' -c CRITICAL, --critical=CRITICAL\\n',\n ' -t TIMEOUT, --timeout=TIMEOUT\\n',\n ' -h, --help show this help message and exit\\n']\n\n\nChecks\n--------\n\nLess than 1 hour returns OK::\n \n >>> state_file_ok = \"src/paulla/checkplanetdiff/tests/state_ok.txt\"\n >>> pprint(get_lines_from_file(state_file_ok))\n ['#Tue Oct 23 22:05:12 CEST 2012',\n 'sequenceNumber=59592',\n 'timestamp=2012-10-23T20\\\\:04\\\\:02Z']\n\n >>> cmd_ok = \"bin/test_check_planetdiff -w 0.0:3600.0 -c 0.0:21600.0 --state-file %s\" % state_file_ok\n >>> p_ok = subprocess.Popen(cmd_ok.split(), stdout=subprocess.PIPE)\n\nStatus code is 0 -> OK::\n \n >>> p_ok.wait()\n 0\n\nString output::\n \n >>> p_ok.stdout.read()\n 'OK: delay : 28, sequence number : 59592\\n'\n\nwith perfdata option::\n \n >>> cmd_ok = \"bin/test_check_planetdiff -w 0.0:3600.0 -c 0.0:21600.0 --state-file %s -p\" % state_file_ok \n >>> p_ok = subprocess.Popen(cmd_ok.split(), stdout=subprocess.PIPE)\n >>> p_ok.stdout.read()\n 'OK: delay : 28, sequence number : 59592|delayed=28s;3600;21600;;\\n'\n\nDelay between 1 hour and 6 returns WARNING::\n \n >>> state_file_warn = \"src/paulla/checkplanetdiff/tests/state_warning.txt\"\n >>> pprint(get_lines_from_file(state_file_warn))\n ['#Tue Oct 23 18:25:07 CEST 2012',\n 'sequenceNumber=59372',\n 'timestamp=2012-10-23T16\\\\:24\\\\:03Z']\n\n >>> cmd_warn = \"bin/test_check_planetdiff -w 0.0:3600.0 -c 0.0:21600.0 --state-file %s\" % state_file_warn\n >>> p_warn = subprocess.Popen(cmd_warn.split(), stdout=subprocess.PIPE)\n\nStatus code is 1 -> WARNING::\n \n >>> p_warn.wait()\n 1\n\nString output::\n \n >>> p_warn.stdout.read()\n 'WARN: delay : 13227, sequence number : 59372\\n'\n\nwith perfdata option::\n \n >>> cmd_warn = \"bin/test_check_planetdiff -w 0.0:3600.0 -c 0.0:21600.0 --state-file %s -p\" % state_file_warn\n >>> p_warn = subprocess.Popen(cmd_warn.split(), stdout=subprocess.PIPE)\n >>> p_warn.stdout.read()\n 'WARN: delay : 13227, sequence number : 59372|delayed=13227s;3600;21600;;\\n'\n\nMore than 6 hours returns CRITICAL::\n \n >>> state_file_crit = \"src/paulla/checkplanetdiff/tests/state_critical.txt\"\n >>> pprint(get_lines_from_file(state_file_crit))\n ['#Tue Oct 23 12:25:07 CEST 2012',\n 'sequenceNumber=59012',\n 'timestamp=2012-10-23T10\\\\:24\\\\:03Z']\n \n >>> cmd_crit = \"bin/test_check_planetdiff -w 0.0:3600.0 -c 0.0:21600.0 --state-file %s\" % state_file_crit\n >>> p_crit = subprocess.Popen(cmd_crit.split(), stdout=subprocess.PIPE)\n\nStatus code is 2 -> CRITICAL::\n \n >>> p_crit.wait()\n 2\n\nString output::\n \n >>> p_crit.stdout.read()\n 'CRIT: delay : 34827, sequence number : 59012\\n'\n\nwith perfdata option::\n \n >>> cmd_crit = \"bin/test_check_planetdiff -w 0.0:3600.0 -c 0.0:21600.0 --state-file %s -p\" % state_file_crit\n >>> p_crit = subprocess.Popen(cmd_crit.split(), stdout=subprocess.PIPE)\n >>> p_crit.stdout.read()\n 'CRIT: delay : 34827, sequence number : 59012|delayed=34827s;3600;21600;;\\n'\n\nNon existant state file returns CRITICAL::\n \n >>> cmd_crit_non_exist_file = \"bin/test_check_planetdiff -w 0.0:3600.0 -c 0.0:21600.0 --state-file src/non_existant.txt\"\n >>> p_crit_nonexist = subprocess.Popen(cmd_crit_non_exist_file.split(), stdout=subprocess.PIPE)\n\nStatus code is 2 -> CRITICAL::\n \n >>> p_crit_nonexist.wait()\n 2\n\nString output::\n \n >>> p_crit_nonexist.stdout.read()\n 'CRIT: delay : 21601, sequence number : 0\\n'\n\nwith perfdata option::\n \n >>> cmd_crit_non_exist_file = \"bin/test_check_planetdiff -w 0.0:3600.0 -c 0.0:21600.0 --state-file src/non_existant.txt -p\"\n >>> p_crit_nonexist = subprocess.Popen(cmd_crit_non_exist_file.split(), stdout=subprocess.PIPE)\n >>> p_crit_nonexist.stdout.read()\n 'CRIT: delay : 21601, sequence number : 0|delayed=21601s;3600;21600;;\\n'\n\n\n\nChangelog\n=========\n\n\n0.4 (2012-10-27)\n----------------\n\n- fix README error\n\n\n0.3 (2012-10-27)\n----------------\n\n- Nothing changed yet.\n\n\n0.2 (2012-10-27)\n----------------\n\n- improve help usage and corresponding tests\n\n\n0.1 (2012-10-26)\n----------------\n\n- Firts version used in production at http://www.paulla.asso.org\n [Jean-Philippe Camguilhem]\n\n\n\nCredits\n========\n|paulla|_\n\n * `PauLLA `_\n * `Contact us `_\n\n.. |paulla| image:: http://www.paulla.asso.fr/logo.png\n.. _paulla: http://www.paulla.asso.fr\n\n\nContributors\n=============\nJean-Philippe Camguilhem, Author", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.paulla.asso.fr", "keywords": "Nagios Icinga OSM", "license": "bsd", "maintainer": null, "maintainer_email": null, "name": "paulla.checkplanetdiff", "package_url": "https://pypi.org/project/paulla.checkplanetdiff/", "platform": "any", "project_url": "https://pypi.org/project/paulla.checkplanetdiff/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://www.paulla.asso.fr" }, "release_url": "https://pypi.org/project/paulla.checkplanetdiff/0.4/", "requires_dist": null, "requires_python": null, "summary": "A nagios|icinga plugin to check diff delay with the official OpenStreetMap Planet.", "version": "0.4" }, "last_serial": 796068, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "9759654b5fac0cf09f2eb534ab0647fe", "sha256": "775f6d8ed53e5fda0ec6f34fb917202b944b3a383d099ed1b8e9c1491fcfd556" }, "downloads": -1, "filename": "paulla.checkplanetdiff-0.1.zip", "has_sig": false, "md5_digest": "9759654b5fac0cf09f2eb534ab0647fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15427, "upload_time": "2012-10-26T16:23:05", "url": "https://files.pythonhosted.org/packages/3e/d5/dd7bfd9e0cd91cf2f12eb6eacb2fe3c363bf74c322cbaf26ec7c8f30d05a/paulla.checkplanetdiff-0.1.zip" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "5e3aced4b76f720f521d90038a2790dc", "sha256": "4bcc3b10b24bb40069345be7fa04a7862595d420b9c15a611f84a7470843d2aa" }, "downloads": -1, "filename": "paulla.checkplanetdiff-0.4.zip", "has_sig": false, "md5_digest": "5e3aced4b76f720f521d90038a2790dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16481, "upload_time": "2012-10-27T09:54:04", "url": "https://files.pythonhosted.org/packages/a3/36/ea2df336a715c38f739b89242309dc653ca5278eb742f5269e241f8b6e8e/paulla.checkplanetdiff-0.4.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5e3aced4b76f720f521d90038a2790dc", "sha256": "4bcc3b10b24bb40069345be7fa04a7862595d420b9c15a611f84a7470843d2aa" }, "downloads": -1, "filename": "paulla.checkplanetdiff-0.4.zip", "has_sig": false, "md5_digest": "5e3aced4b76f720f521d90038a2790dc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16481, "upload_time": "2012-10-27T09:54:04", "url": "https://files.pythonhosted.org/packages/a3/36/ea2df336a715c38f739b89242309dc653ca5278eb742f5269e241f8b6e8e/paulla.checkplanetdiff-0.4.zip" } ] }