Metrics - how to enable using yaml config file?

Hi,

As per the topic I manage teleport using systemd and a config file but the yaml documentation doesnt show a flag for enabling the metrics output.

The metrics documentation only has a teleport start flag…

I would like to get metrics working

Thanks for any help.

You need to use the --diag-addr flag to teleport start to enable the metrics endpoint.

With systemd you can do this by modifying the ExecStart= line in your systemd unit file - systemctl edit --full teleport.service:

Add --diag-addr=127.0.0.1:3000 to the end of the ExecStart= line so it looks a bit like
ExecStart=/usr/local/bin/teleport start --diag-addr=127.0.0.1:3000

Save the file and exit, then systemctl restart teleport.

You’re correct that there’s currently no way to enable metrics via the YAML config. We have an open issue for this: https://github.com/gravitational/teleport/issues/3841

Thanks Gus,

My current service file is:

[Unit]
Description=Teleport SSH Service
After=network.target

[Service]
Type=simple
Restart=on-failure
EnvironmentFile=-/etc/default/teleport
ExecStart=/usr/local/bin/teleport start --config=/etc/teleport/teleport.yaml --pid-file=/run/teleport.pid
ExecReload=/bin/kill -HUP $MAINPID
PIDFile=/run/teleport.pid

[Install]
WantedBy=multi-user.target

Reading the docs suggest this wont work as the --config overrides other cli flags or is --diag-addr an exception to this?

--diag-addr is a flag that can be provided separately. One thing I did remember is that you’ll also need to provide the -d flag on the command line for --diag-addr to work - so something like:

ExecStart=/usr/local/bin/teleport start -d --diag-addr=127.0.0.1:3000 --config=/etc/teleport/teleport.yaml --pid-file=/run/teleport.pid