Browse Source

add python module scripts

master
Dave Pedu 6 years ago
parent
commit
a2f9f12c62
  1. 5
      .gitignore
  2. 6
      bin/pymonitor
  3. 8
      pymonitor/daemon.py
  4. 14
      setup.py

5
.gitignore

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

6
bin/pymonitor

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

8
pymonitor/daemon.py

@ -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

@ -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)
Loading…
Cancel
Save