Logging & monitoring
Logs¶
We strongly recommend storing logs in one centralized place when working in a clustered environment. MongooseIM uses the standard OTP logging framework: Logger. Its handlers can be replaced and customised, according to Logger's documentation.
Syslog integration¶
MongooseIM uses syslogger
as a Logger handler for syslog.
To activate it you have to add syslogger
to the applications section in src/mongooseim/app.src
:
1 |
|
You also need to edit rel/files/app.config
and uncomment the lines:
1 2 3 4 5 6 7 8 |
|
You can provide different parameters to change the handler's behaviour as described
in the syslogger's
GitHub page:
ident
- a string to tag all the syslog messages with. The default ismongooseim
.facility
- the facility to log to (see the syslog documentation).log_opts
- see the syslog documentation for the description.
Depending on the system you use, remember to also add the appropriate line in the syslog config file.
For example, if the facility local0
is set:
1 |
|
All the logs of level info
should be passed to the /var/log/mongooseim.log
file.
Example log (e.g tail -f /var/log/mongooseim.log
):
1 |
|
Further / multiserver integration¶
For more advanced processing and analysis of logs, including gathering logs from multiple machines, you can use one of the many available systems (e.g. logstash/elasticsearch/kibana, graylog, splunk), by redirecting mongoose logs to such service with an appropriate Logger's handler.
Check Logging for more information.
Monitoring¶
WombatOAM¶
WombatOAM is an operations and maintenance framework for Erlang based systems. Its Web Dashboard displays this data in an aggregated manner. Additionally, WombatOAM provides interfaces to feed the data to other OAM tools such as Graphite, Nagios or Zabbix.
For more information see: WombatOAM.
OS level metrics: graphite-collectd¶
To monitor MongooseIM node during load testing, we recommend the following open source applications:
- Grafana is used for data presentation.
- Prometheus is a server used for metrics storage. Alternatively, MongooseIM also works with Graphite.
- collectd is a daemon running on the monitored nodes capturing data related to CPU and Memory usage, IO etc.
Application metrics¶
MongooseIM uses Prometheus as the default metrics solution, but also supports Exometer with Graphite exporter. Enable the chosen one in the instrumentation section.
Prometheus¶
MongooseIM exposes metrics in the Prometheus format by default. More information about configuration can be found in the HTTP listeners section.
Exometer¶
MongooseIM uses a fork of Exometer library for collecting metrics. Exometer has many plug-in reporters that can send metrics to external services. We maintain exometer_report_graphite, which can be enabled in the instrumentation section of the configuration file.
Moreover, Exometer metrics can be accessed through the GraphQL API.
GraphQL metrics endpoint¶
When using Exometer, the metrics can be accessed through a GraphQL query. With Prometheus, this query will not work, however, the metrics will be available in the Prometheus format from the configured endpoint.
Run Graphite & Grafana in Docker - quick start¶
The following commands will download the latest version of kamon/grafana_graphite
docker image that contains both Grafana and Graphite, and start them while mounting the local directory ./docker-grafana-graphite-master/data
for metric persistence:
1 2 |
|
Go to http://localhost:80 to view the Grafana dashboard that's already set up to use metrics from Graphite.
Add metrics to Grafana dashboard¶
We recommend the following metrics as a baseline for tracking your MongooseIM installation.
For time-based metrics, you can choose to display multiple calculated values for a reporting period - we recommend tracking at least max
, median
and mean
.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Note that RDBMS metrics are only relevant if MongooseIM is configured with an RDBMS backend, MAM metrics when mod_mam is enabled and MAM flush times when MAM is configured with an RDBMS backend with async_writer
option (default).
Example graph in Grafana¶
This screenshot shows a graph plotting the RDBMS simple query time metric mentioned above.
The graph is plotted for three nodes with each node having a different prefix: mongoose.node1
, mongoose.node2
and mongoose.node3
.
The queries take metrics for all nodes and all domains (**
is a wildcard for multiple parts of the metric name) and group them per-node and per-value-type (respectively 1
st and -1
st part of the metric's name).
Parts of the names are indexed from 0
.
Time-based metrics in MongooseIM are given in microseconds, so to display human-readable values in graph's legend, the Y-axis unit has to be edited on the Axes
tab.