Merge "Enable the process plugin in Docker environment"

This commit is contained in:
Zuul 2018-07-09 11:16:07 +00:00 committed by Gerrit Code Review
commit 17332007e3
4 changed files with 34 additions and 2 deletions

View File

@ -22,7 +22,8 @@ The Monasca Agent is a modern Python monitoring agent for gathering metrics and
* Nagios plugins. The Monasca Agent can run Nagios plugins and send the status code returned by the plugin as a metric to the Monasca API.
* Statsd. The Monasca Agent supports an integrated Statsd daemon which can be used by applications via a statsd client library.
* Host alive. The Monasca Agent can perform active checks on a host to determine if it is alive using ping (ICMP) or SSH.
* Process checks. The Monasca Agent can check a process and return several metrics on the process such as number of instances, memory, io and threads.
* Process checks. The Monasca Agent can check a process and return several
metrics on the process such as number of instances, memory, io and threads.
* Http Endpoint checks. The Monasca Agent can perform active checks on http endpoints by sending an HTTP request to an API.
* Service checks. The Agent can check service such as MySQL, RabbitMQ, and many more.
* OpenStack metrics. The agent can perform checks on OpenStack processes.

View File

@ -1,6 +1,11 @@
# (C) Copyright 2015 Hewlett Packard Enterprise Development Company LP
init_config:
# process_fs_path: (optional) STRING. It will set up the path of the process
# filesystem. By default it's set for: /proc directory.
# Example:
#
process_fs_path: /rootfs/proc
instances:
# - name: (required) STRING. It will be used to uniquely identify your metrics as they will be tagged with this name
@ -39,4 +44,3 @@ instances:
# process: ['python']
# - name: node
# process: ['node']

View File

@ -2313,6 +2313,26 @@ instances:
name: vertica
username: dbadmin
```
Docker environment:
For Docker environment you can enable the process plugin by adding
`proccess.yaml` to the `monasca-agent-collector` container (mount plugin file
to `/plugins.d/process.yaml`). Additionally you have to specify the path of the
host process filesystem. In this case mount host root directory `/` to
`/rootfs` in the container. Sample configuration:
```
init_config:
process_fs_path: /rootfs/proc
instances:
- name: monasca-collector
detailed: true
dimensions:
service: monasca-collector
exact_match: false
search_string:
- monasca-collector
```
The process checks return the following metrics ( if detailed is set to true, otherwise process.pid_count is only returned ):
| Metric Name | Dimensions | Semantics |

View File

@ -36,6 +36,13 @@ class ProcessCheck(checks.AgentCheck):
def __init__(self, name, init_config, agent_config, instances=None):
super(ProcessCheck, self).__init__(name, init_config, agent_config,
instances)
process_fs_path_config = init_config.get('process_fs_path', None)
if process_fs_path_config:
psutil.PROCFS_PATH = process_fs_path_config
self.log.debug('The path of the process filesystem set to %s', process_fs_path_config)
else:
self.log.debug('The process_fs_path not set. Use default path: /proc')
self._cached_processes = defaultdict(dict)
self._current_process_list = None