Starting Prometheus
Start Prometheus with your newly created configuration file:
./prometheus
It should log a number of startup messages and then start serving on port 9090
:
ts=2024-07-09T14:46:14.737Z caller=main.go:589 level=info msg="No time or size retention was set so using the default time retention" duration=15d
ts=2024-07-09T14:46:14.737Z caller=main.go:633 level=info msg="Starting Prometheus Server" mode=server version="(version=2.53.0, branch=HEAD, revision=4c35b9250afefede41c5f5acd76191f90f625898)"
ts=2024-07-09T14:46:14.737Z caller=main.go:638 level=info build_context="(go=go1.22.4, platform=linux/amd64, user=root@7f8d89cbbd64, date=20240619-07:39:12, tags=netgo,builtinassets,stringlabels)"
ts=2024-07-09T14:46:14.737Z caller=main.go:639 level=info host_details="(Linux 6.9.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 21 Jun 2024 19:49:19 +0000 x86_64 workstation (none))"
ts=2024-07-09T14:46:14.737Z caller=main.go:640 level=info fd_limits="(soft=524288, hard=524288)"
ts=2024-07-09T14:46:14.737Z caller=main.go:641 level=info vm_limits="(soft=unlimited, hard=unlimited)"
ts=2024-07-09T14:46:14.738Z caller=web.go:568 level=info component=web msg="Start listening for connections" address=0.0.0.0:9090
ts=2024-07-09T14:46:14.739Z caller=main.go:1148 level=info msg="Starting TSDB ..."
ts=2024-07-09T14:46:14.740Z caller=tls_config.go:313 level=info component=web msg="Listening on" address=[::]:9090
ts=2024-07-09T14:46:14.740Z caller=tls_config.go:316 level=info component=web msg="TLS is disabled." http2=false address=[::]:9090
ts=2024-07-09T14:46:14.744Z caller=head.go:626 level=info component=tsdb msg="Replaying on-disk memory mappable chunks if any"
ts=2024-07-09T14:46:14.744Z caller=head.go:713 level=info component=tsdb msg="On-disk memory mappable chunks replay completed" duration=3.828µs
ts=2024-07-09T14:46:14.744Z caller=head.go:721 level=info component=tsdb msg="Replaying WAL, this may take a while"
ts=2024-07-09T14:46:14.747Z caller=head.go:793 level=info component=tsdb msg="WAL segment loaded" segment=0 maxSegment=0
ts=2024-07-09T14:46:14.747Z caller=head.go:830 level=info component=tsdb msg="WAL replay completed" checkpoint_replay_duration=122.215µs wal_replay_duration=2.519067ms wbl_replay_duration=316ns chunk_snapshot_load_duration=0s mmap_chunk_replay_duration=3.828µs total_replay_duration=2.747299ms
ts=2024-07-09T14:46:14.749Z caller=main.go:1169 level=info fs_type=TMPFS_MAGIC
ts=2024-07-09T14:46:14.749Z caller=main.go:1172 level=info msg="TSDB started"
ts=2024-07-09T14:46:14.749Z caller=main.go:1354 level=info msg="Loading configuration file" filename=prometheus.yml
ts=2024-07-09T14:46:14.750Z caller=main.go:1391 level=info msg="updated GOGC" old=100 new=75
ts=2024-07-09T14:46:14.750Z caller=main.go:1402 level=info msg="Completed loading of configuration file" filename=prometheus.yml totalDuration=601.755µs db_storage=1.875µs remote_storage=2.082µs web_handler=541ns query_engine=1.294µs scrape=263.181µs scrape_sd=30.002µs notify=1.521µs notify_sd=1.186µs rules=2.163µs tracing=7.453µs
ts=2024-07-09T14:46:14.750Z caller=main.go:1133 level=info msg="Server is ready to receive web requests."
ts=2024-07-09T14:46:14.750Z caller=manager.go:164 level=info component="rule manager" msg="Starting rule manager..."
By default, Prometheus stores its database in the ./data
directory (this can be configured using the flag --storage.tsdb.path
) and reads its configuration from the file prometheus.yml
(flag --config.file
).
NOTE: Any settings provided via the configuration file are reloadable during runtime (by sending a
HUP
signal or by triggering a reload via the HTTP API), while any changes to flag-based settings require a full server restart to take effect.
You should now be able to reach the Prometheus server's status page at http://<machine-ip>:9090/
:
Give the server a couple of seconds to collect data about itself from its own HTTP metrics endpoint.
You can also verify that Prometheus is serving metrics about itself by navigating to its metrics endpoint: http://<machine-ip>:9090/metrics
This should show a long list of metrics looking something like this:
# HELP go_gc_cycles_automatic_gc_cycles_total Count of completed GC cycles generated by the Go runtime.
# TYPE go_gc_cycles_automatic_gc_cycles_total counter
go_gc_cycles_automatic_gc_cycles_total 14
# HELP go_gc_cycles_forced_gc_cycles_total Count of completed GC cycles forced by the application.
# TYPE go_gc_cycles_forced_gc_cycles_total counter
go_gc_cycles_forced_gc_cycles_total 0
# HELP go_gc_cycles_total_gc_cycles_total Count of all completed GC cycles.
# TYPE go_gc_cycles_total_gc_cycles_total counter
go_gc_cycles_total_gc_cycles_total 14
# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 3.0831e-05
go_gc_duration_seconds{quantile="0.25"} 8.0444e-05
go_gc_duration_seconds{quantile="0.5"} 0.000176452
go_gc_duration_seconds{quantile="0.75"} 0.00024054
go_gc_duration_seconds{quantile="1"} 0.000409422
go_gc_duration_seconds_sum 0.002412221
go_gc_duration_seconds_count 14
# HELP go_gc_gogc_percent Heap size target percentage configured by the user, otherwise 100. This value is set by the GOGC environment variable, and the runtime/debug.SetGCPercent function.
# TYPE go_gc_gogc_percent gauge
go_gc_gogc_percent 75
# HELP go_gc_gomemlimit_bytes Go runtime memory limit configured by the user, otherwise math.MaxInt64. This value is set by the GOMEMLIMIT environment variable, and the runtime/debug.SetMemoryLimit function.
# TYPE go_gc_gomemlimit_bytes gauge
go_gc_gomemlimit_bytes 9.223372036854776e+18
# [...]