This is a simple service which reads JSON monitoring data exposed by Tinode server using expvar and re-publishes it in other formats. Currently the supported formats are:
- InfluxDB exporter pushes data to its target backend. This is the default mode.
- Prometheus exporter which exports data in prometheus format. The Prometheus monitoring service is expected to pull/scrape data from the exporter.
Exporters are intended to run next to (pair with) Tinode servers: one Exporter per one Tinode server, i.e. a single Exporter provides metrics from a single Tinode server.
The exporters are configured by command-line flags:
serve_forspecifies which monitoring service the Exporter will gather metrics for; accepted values:influxdb,prometheus; default:influxdb.tinode_addris the address where the Tinode instance publishesexpvardata to scrape; default:http://localhost:6060/stats/expvar.listen_atis the hostname to bind to for serving the metrics; default::6222.instanceis the Exporter instance name (it may be exported to the upstream backend); default:exporter.metric_listis a comma-separated list of metrics to export; default:Version,LiveTopics,TotalTopics,LiveSessions,ClusterLeader,TotalClusterNodes,LiveClusterNodes,memstats.Alloc.
influx_push_addris the address of InfluxDB target server where the data gets sent; default:http://localhost:9999/write.influx_db_versionis the version of InfluxDB (only 1.7 and 2.0 are supported); default:1.7.influx_organizationspecifies InfluxDB organization to push metrics as; default:test;influx_bucketis the name of InfluxDB storage bucket to store data in (used only in InfluxDB 2.0); default:test.influx_auth_token- InfluxDB authentication token; no default value.influx_push_interval- InfluxDB push interval in seconds; default:30.
Run InfluxDB Exporter as
./exporter \
--serve_for=influxdb \
--tinode_addr=http://localhost:6060/stats/expvar \
--listen_at=:6222 \
--instance=exp-0 \
--influx_push_addr=http://my-influxdb-backend.net/write \
--influx_db_version=1.7 \
--influx_organization=myOrg \
--influx_auth_token=myAuthToken123 \
--influx_push_interval=30
This exporter will push the collected metrics to the specified backend once every 30 seconds.
prom_namespaceis a prefix to use for metrics names. If you are monitoring multiple tinode instances you may want to use different namespaces; default:tinode.prom_metrics_pathis the path under which to expose the metrics for scraping; default:/metrics.prom_timeoutis the Tinode connection timeout in seconds in response to Prometheus scrapes; default:15.
Run Prometheus Exporter as
./exporter \
--serve_for=prometheus \
--tinode_addr=http://localhost:6060/stats/expvar \
--listen_at=:6222 \
--instance=exp-0 \
--prom_namespace=tinode \
--prom_metrics_path=/metrics \
--prom_timeout=15
This exporter will serve data at path /metrics, on port 6222. Once running, configure your Prometheus monitoring installation to collect data from this exporter.