If you do, it will force prometheus to re-read all its Write-Ahead Logs (WAL) which in a large running installation can take many minutes. REMEMBER: don’t restart prometheus after changing its configuration. You may get a more helpful description of the error by running: /opt/prometheus/promtool check config /etc/prometheus/prometheus.yml In the mean time, prometheus will continue running with your old configuration. If you don’t, then find your error and correct it. You should see: msg="Completed loading of configuration file" filename=/etc/prometheus/prometheus.yml Now tell prometheus that you have changed its configuration: killall -HUP prometheusĬHECK THE LOGS YOU SEE. In particular, the hyphens before each job_name: must be in exactly the same column, so they line up vertically. # The job name is added as a label `job=` to any timeseries scraped from this config.īe careful with spacing. Under the scrape_configs section add a new job called “node”, so it looks like this: scrape_configs: As we want to be able to scrape many hosts, we’ll put the list of targets to scrape in a separate file to make it easier to manage.Ĭreate a new directory: mkdir /etc/prometheus/targets.dĬreate a new file /etc/prometheus/targets.d/node.yml with the following contents: - targets:Įdit /etc/prometheus/prometheus.yml. Now we will configure prometheus to scrape this host. ( -s = “silent”, stops curl showing the progress information) 4 Configure prometheus scraping You can filter the output to look at just a subset of metrics, like this: # curl -s localhost:9100/metrics | grep filesystem Test it by doing a manual scrape: # curl localhost:9100/metrics The exporter is now running and listening on port 9100. In the future you can type: # systemctl status node_exporter # check for "Active: active (running)" text 3.1 Manual scrape If there are any errors, then go back and fix them. Use cursor keys to move around the journalctl log output, and “q” to quit. # journalctl -eu node_exporter # check for "Listening on :9100" # systemctl restart node_exporter # restart now (works for upgrade and new) Let’s start node_exporter: # systemctl enable node_exporter # start on future boots Tell systemd to read this new file: # systemctl daemon-reloadĪlso create an options file /etc/default/node_exporter with the following contents: OPTIONS='' 3 Start node_exporter Use a text editor to create a systemd unit file /etc/systemd/system/node_rvice with the following contents: ĮnvironmentFile=/etc/default/node_exporterĮxecStart=/opt/node_exporter/node_exporter $OPTIONS Stop here if you are upgrading and go to the Start node_exporter section The logical link allows us to create systemd unit file without needing to update it each time we upgrade node_exporter. If node exporter was already installed, then remove the logical link first: # cd /optĪnd, now create the logical link to the current node_exporter version: # ln -s node_exporter-X.Y.Z.linux-amd64 /opt/node_exporter We are assuming you are doing these exercises as the root user or using the sudo command as needed.įetch and unpack the latest release from the releases page and create a symlink so that /opt/node_exporter refers to the current version. You should go here first and then replace the “X”, Y" and “Z” below in the link with the current Prometheus version number that is listed on the releases page (scroll down a bit to find the link). (If node_exporter is pre-installed and you are not upgrading, skip to the next section “Start node exporter”) This is much easier to configure and manage than SNMP.ĭo this on your campus server instance (.) 2 Install (or upgrade) node_exporter To collect metrics from Linux services, such as memory/CPU/disk utilisation, you install the node_exporter on each server. 1 Configuring Prometheus Node Exporter Locally and Remoteġ Configuring Prometheus Node Exporter Locally and Remote 1.1 Introduction.Prometheus Node Exporter Install Prometheus Node Exporter Install
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |