add python module scripts

This commit is contained in:
Dave Pedu 2015-12-06 22:41:51 -08:00
parent c60d00bfec
commit a2f9f12c62
4 changed files with 29 additions and 4 deletions

5
.gitignore vendored
View File

@ -1,3 +1,6 @@
*.pyc
__pycache__
examples/config.test.json
examples/config.test.json
build
dist
pymonitor.egg-info

6
bin/pymonitor Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/env python3
from pymonitor import daemon
if __name__ == "__main__":
daemon.run_cli()

View File

@ -66,7 +66,7 @@ class Backend:
self.sysinfo = {}
self.update_sys_info()
logger.info("running on %(hostname)s (%(ipaddr)s)" % self.sysinfo)
self.logger.info("running on %(hostname)s (%(ipaddr)s)" % self.sysinfo)
def connect(self):
self.logger.info("final mapping %s" % self.mapping)
@ -194,7 +194,7 @@ class MonitorThread(Thread):
self.logger.info("cancelling scheduler")
self.alive=False
if __name__ == '__main__':
def run_cli():
from optparse import OptionParser
logging.basicConfig(level=logging.DEBUG, format="%(asctime)-15s %(levelname)-8s %(name)s@%(filename)s:%(lineno)d %(message)s")
logger = logging.getLogger("init")
@ -221,4 +221,6 @@ if __name__ == '__main__':
except KeyboardInterrupt:
print("")
daemon.shutdown()
if __name__ == '__main__':
run_cli()

14
setup.py Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env python3
from setuptools import setup
__version__ = "0.0.1"
setup(name='pymonitor',
version=__version__,
description='python daemon for logging system metrics to elasticsearch db',
url='http://gitlab.xmopx.net/dave/python-esmonitor',
author='dpedu',
author_email='dave@davepedu.com',
packages=['pymonitor', 'pymonitor.builtins', 'pymonitor.monitors'],
scripts=['bin/pymonitor'],
zip_safe=False)