diff --git a/plugins/prometheus/metrics.go b/plugins/prometheus/metrics.go index efeb6593c0c349af22b20b25dd7d27f7d27e1c78..799379c41a7b9821b69c2f897f8e12d28a0e1ea2 100644 --- a/plugins/prometheus/metrics.go +++ b/plugins/prometheus/metrics.go @@ -17,9 +17,9 @@ func init() { registry.MustRegister(messagesPerSecond) - addCollect(collectServer) + addCollect(collectMetrics) } -func collectServer() { +func collectMetrics() { messagesPerSecond.Set(float64(metrics.ReceivedMessagesPerSecond())) } diff --git a/plugins/prometheus/parameters.go b/plugins/prometheus/parameters.go index edfffadd440fbe0690b741336e7e737f7a2db866..dbc77cb0d17fd0c1e1c1544425225e4dd72d1f99 100644 --- a/plugins/prometheus/parameters.go +++ b/plugins/prometheus/parameters.go @@ -16,7 +16,7 @@ const ( ) func init() { - flag.String(CfgPrometheusBindAddress, "localhost:9311", "the bind address on which the Prometheus exporter listens on") + flag.String(CfgPrometheusBindAddress, "0.0.0.0:9311", "the bind address on which the Prometheus exporter listens on") flag.Bool(CfgPrometheusGoMetrics, false, "include go metrics") flag.Bool(CfgPrometheusProcessMetrics, false, "include process metrics") flag.Bool(CfgPrometheusPromhttpMetrics, false, "include promhttp metrics") diff --git a/tools/docker-network/docker-compose.yml b/tools/docker-network/docker-compose.yml index a81aed5b65dd055fd381ba4f07981f9321501238..76bf14c16fa2fced64379b96b039a81d66c7e8f6 100644 --- a/tools/docker-network/docker-compose.yml +++ b/tools/docker-network/docker-compose.yml @@ -40,14 +40,15 @@ services: command: > --config-dir=/tmp --database.directory=/tmp/mainnetdb - --node.enablePlugins=bootstrap --node.disablePlugins=valuetransfers + --node.enablePlugins=bootstrap,prometheus volumes: - ./config.docker.json:/tmp/config.json:ro - goshimmer-cache:/go ports: - "127.0.0.1:8080:8080/tcp" # web API - "127.0.0.1:8081:8081/tcp" # dashboard + - "127.0.0.1:9311:9311/tcp" # prometheus depends_on: - entry_node @@ -67,6 +68,18 @@ services: depends_on: - entry_node + prometheus: + image: prom/prometheus:latest + container_name: prometheus + ports: + - 9090:9090 + command: + - --config.file=/etc/prometheus/prometheus.yml + volumes: + - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro + depends_on: + - peer_master + volumes: goshimmer-cache: name: goshimmer-cache