Hands-on task
Metric exporter
Prometheus scrapes metrics over HTTP — from the server's /metrics page. Write /usr/local/bin/export-metric that prints a metric in Prometheus format: the line app_up 1. Run it and save the output to /var/www/html/metrics — nginx is already running and serves that file as http://localhost/metrics.
The script is handy to write in the Editor tab (the /usr/local/bin directory shows up in the file tree), and you can see the result in the Site tab: the home page has a /metrics link — after writing the file, click "Refresh".
- prometheus
- metrics
- shell
- chmod
- redirect