{ "info": { "author": "Eric Lapouyade", "author_email": "elapouya@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Programming Language :: Python :: 3" ], "description": "\n=====================\npython-nagios-helpers\n=====================\n\npython-nagios-helpers A.K.A **naghelp** is a collections of classes for building nagios *Active* plugins.\nIt is higly recommended to use `python-textops `_ \nto manipulate collected data. \n\nHere is an exemple of an active python plugin, create a file linux_fsfull.py::\n\n from naghelp import *\n from textops import *\n\n class LinuxFsFull(ActivePlugin):\n \"\"\" Basic plugin to monitor full filesystems on Linux systems\"\"\"\n cmd_params = 'user,passwd'\n tcp_ports = '22'\n\n def collect_data(self,data):\n data.df = Ssh(self.host.ip,self.host.user,self.host.passwd).run('df -h')\n\n def parse_data(self,data):\n df = data.df.skip(1)\n data.fs_critical = df.greaterequal(98,key=cuts(r'(\\d+)%')).cut(col='5,4').renderitems()\n data.fs_warning = df.inrange(95,98,key=cuts(r'(\\d+)%')).cut(col='5,4').renderitems()\n data.fs_ok = df.lessthan(95,key=cuts(r'(\\d+)%')).cut(col='5,4').renderitems()\n\n def build_response(self,data):\n self.response.add_list(CRITICAL,data.fs_critical)\n self.response.add_list(WARNING,data.fs_warning)\n self.response.add_list(OK,data.fs_ok)\n\n if __name__ == '__main__':\n LinuxFsFull().run()\n\nTo excute manually::\n\n python linux_fsfull.py --ip=127.0.0.1 --user=naghelp --passwd=lgpl\n\nOn error, it may return something liek this::\n\n STATUS : CRITICAL:2, WARNING:1, OK:3\n ==================================[ STATUS ]==================================\n\n ----( CRITICAL )----------------------------------------------------------------\n / : 98%\n /home : 99%\n\n ----( WARNING )-----------------------------------------------------------------\n /run/shm : 95%\n\n ----( OK )----------------------------------------------------------------------\n /dev : 1%\n /run : 1%\n /run/lock : 0%\n\n\n ============================[ Plugin Informations ]=============================\n Plugin name : __main__.LinuxFsFull\n Description : Basic plugin to monitor full filesystems on Linux systems\n Ports used : tcp = 22, udp = none\n Execution time : 0:00:00.673851\n Exit code : 2 (CRITICAL), __sublevel__=0\n\nOr if no error::\n\n OK\n\n ============================[ Plugin Informations ]=============================\n Plugin name : __main__.LinuxFsFull\n Description : Basic plugin to monitor full filesystems on Linux systems\n Ports used : tcp = 22, udp = none\n Execution time : 0:00:00.845603\n Exit code : 0 (OK), __sublevel__=0\n\nNaghelp will automatically manage some options::\n\n $ python linux_fsfull.py -h\n Usage:\n linux_fsfull.py [options]\n\n Options:\n -h, --help show this help message and exit\n -v Verbose : display informational messages\n -d Debug : display debug messages\n -l FILE Redirect logs into a file\n -i Display plugin description\n -n Must be used when the plugin is started by nagios\n -s Save collected data in a temporary file\n -r Use saved collected data (option -s)\n -a Collect data only and print them\n -b Collect and parse data only and print them\n\n Host attributes:\n To be used to force host attributes values\n\n --passwd=PASSWD Passwd\n --ip=IP Host IP address\n --user=USER User\n --name=NAME Hostname\n\n\nFor more information, `Read The Fabulous Manual `_ !\n\n\nNews\n====\n0.3.0 (2018-8-28)\n-----------------\n\n* Port of python-nagios-helpers from python2 to python 3\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/elapouya/python-nagios-helpers", "keywords": "naghelp", "license": "LGPL 2.1", "maintainer": "", "maintainer_email": "", "name": "python-nagios-helpers3", "package_url": "https://pypi.org/project/python-nagios-helpers3/", "platform": "", "project_url": "https://pypi.org/project/python-nagios-helpers3/", "project_urls": { "Homepage": "https://github.com/elapouya/python-nagios-helpers" }, "release_url": "https://pypi.org/project/python-nagios-helpers3/0.2.2/", "requires_dist": null, "requires_python": "", "summary": "Python3 helper Classes for plugin development and nagios management.", "version": "0.2.2" }, "last_serial": 4213900, "releases": { "0.2.2": [ { "comment_text": "", "digests": { "md5": "4f5b264d1c5559843fd6314de5786787", "sha256": "6b47604fe573e53a77293b8bd50307f1d48c90e8dcc5a2e1858164775949cdce" }, "downloads": -1, "filename": "python-nagios-helpers3-0.2.2.tar.gz", "has_sig": false, "md5_digest": "4f5b264d1c5559843fd6314de5786787", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 68421, "upload_time": "2018-08-28T07:19:15", "url": "https://files.pythonhosted.org/packages/35/5c/c25f1a9809efb691b8cb02333638ed8de97276b881e2452ae8f985ab0e06/python-nagios-helpers3-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4f5b264d1c5559843fd6314de5786787", "sha256": "6b47604fe573e53a77293b8bd50307f1d48c90e8dcc5a2e1858164775949cdce" }, "downloads": -1, "filename": "python-nagios-helpers3-0.2.2.tar.gz", "has_sig": false, "md5_digest": "4f5b264d1c5559843fd6314de5786787", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 68421, "upload_time": "2018-08-28T07:19:15", "url": "https://files.pythonhosted.org/packages/35/5c/c25f1a9809efb691b8cb02333638ed8de97276b881e2452ae8f985ab0e06/python-nagios-helpers3-0.2.2.tar.gz" } ] }