Skip to content

Commit

Permalink
Installation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Rusev committed Jun 21, 2014
1 parent dda9345 commit 7130bcd
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 21 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
1.2
==============

* Fix installation - install both setuptools and pip
* Don't break the agent if the plugin directories doesn't exist (/etc/amoagent/plugins)

1.1
==============

Expand Down
3 changes: 1 addition & 2 deletions amon-agent
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@ class AmonAgentDaemon(Daemon):
while True:
stats = {
'system': runner.system(),
'processes': runner.processes(),
'processes': runner.processes(),
'plugins': runner.plugins()
}
remote = Remote()
remote.save_system_stats(stats)

# Checks the system every 60 seconds
time.sleep(settings.SYSTEM_CHECK_PERIOD)

if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion amonagent/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.1'
__version__ = '1.2'
32 changes: 16 additions & 16 deletions amonagent/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,21 @@ def discover_plugins(plugin_paths=[]):
future extension which will permit searching for plugins in
user defined directories
"""

# Find all enabled plugins
for filename in os.listdir(ENABLED_PLUGINS_PATH):
plugin_name, ext = os.path.splitext(filename)
if ext == ".conf":
# Configuration file OK, load the plugin
full_plugin_path = "{0}/{1}".format(AVAILABLE_PLUGINS_PATH, plugin_name)

for filename in os.listdir(full_plugin_path):
modname, extension = os.path.splitext(filename)
if extension == '.py':
_file, path, descr = imp.find_module(modname, [full_plugin_path])
if _file:
# Loading the module registers the plugin in
if modname not in ['base', '__init__']:
mod = imp.load_module(modname, _file, path, descr)
if os.path.exists(ENABLED_PLUGINS_PATH):
# Find all enabled plugins
for filename in os.listdir(ENABLED_PLUGINS_PATH):
plugin_name, ext = os.path.splitext(filename)
if ext == ".conf":
# Configuration file OK, load the plugin
full_plugin_path = "{0}/{1}".format(AVAILABLE_PLUGINS_PATH, plugin_name)

for filename in os.listdir(full_plugin_path):
modname, extension = os.path.splitext(filename)
if extension == '.py':
_file, path, descr = imp.find_module(modname, [full_plugin_path])
if _file:
# Loading the module registers the plugin in
if modname not in ['base', '__init__']:
mod = imp.load_module(modname, _file, path, descr)

return AmonPlugin.plugins
2 changes: 1 addition & 1 deletion amonagent/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _post(self, url, data, headers=None):
headers = headers if headers else self.headers

try:
r = requests.post(url, data, headers=headers, timeout=5, stream=False)
r = requests.post(url, data, headers=headers, timeout=10, stream=False)
except Exception:
log.error("Can't connect to the Amon API")

Expand Down
3 changes: 2 additions & 1 deletion amonagent/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ def system(self):
'cpu': get_cpu_utilization(),
'disk': get_disk_usage(),
'network': get_network_traffic(),
'loadavg': get_load_average()
'loadavg': get_load_average(),
}


return system_data_dict


def processes(self):
return processes_data_collector.collect()

Expand Down
1 change: 1 addition & 0 deletions packaging/debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -e

case "$1" in
configure)
curl --silent --show-error --retry 5 -L https://bootstrap.pypa.io/ez_setup.py -o - | python
curl --silent --show-error --retry 5 -L https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python
pip install --upgrade 'amonagent>=1.0'
update-rc.d amon-agent defaults
Expand Down
1 change: 1 addition & 0 deletions packaging/rpm/postinst
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# start
curl --silent --show-error --retry 5 -L https://bootstrap.pypa.io/ez_setup.py -o - | python
curl --silent --show-error --retry 5 -L https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python
pip install --upgrade 'amonagent>=1.0'
sh -c "echo '{\"server_key\": \"test\"}' > /etc/amon-agent.conf"
Expand Down

0 comments on commit 7130bcd

Please sign in to comment.