MacOS : Prometheus : Failed to create directory for logging active queries

J’ai pu voir que cela ne se lançait pas dans /usr/local/var/log/prometheus.err.log, sans arrêt j’ai l’erreur :

component=activeQueryTracker msg="Failed to create directory for logging active queries"

J’ai donc modifié le fichier /usr/local/Cellar/prometheus/2.13.1/homebrew.mxcl.prometheus.plist et pas le fichier  /Users/XXXXXX/Library/LaunchAgents/homebrew.mxcl.prometheus.plist (inutile)

<?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  <plist version="1.0">
  <dict>
    <key>Label</key>
    <string>homebrew.mxcl.prometheus</string>
    <key>ProgramArguments</key>
    <array>
      <string>sh</string>
      <string>-c</string>
      <string>/usr/local/opt/prometheus/bin/prometheus $(&lt; /usr/local/etc/prometheus.args)</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <false/>
    <key>WorkingDirectory</key>
    <string>/usr/local/opt/prometheus</string>
    <key>StandardErrorPath</key>
    <string>/usr/local/var/log/prometheus.err.log</string>
    <key>StandardOutPath</key>
    <string>/usr/local/var/log/prometheus.log</string>
  </dict>
</plist>

Je relance :

$ brew services restart prometheus
Stopping `prometheus`... (might take a while)
==> Successfully stopped `prometheus` (label: homebrew.mxcl.prometheus)
==> Successfully started `prometheus` (label: homebrew.mxcl.prometheus)

Attention pour l’écoute c’est 0.0.0.0 et pas 127.0.0.1 : http://0.0.0.0:9090 .

Installation de Prometheus sur MacOS

Ma version de MacOS :

$ uname -a
Darwin MacBook.local 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64

Mise à jours de brew ( en mode verbose afin d’avoir plus d’information ) :

$ brew update -v 
...
$ brew -v
Homebrew 2.1.16
Homebrew/homebrew-core (git revision 00c2c; last commit 2019-11-18)
Homebrew/homebrew-cask (git revision 9e283; last commit 2019-11-18)

Début de l’installation :

$ brew install prometheus
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
mysql-client@5.7
==> Updated Formulae
awsume                       innotop                      manticoresearch              mysql-client                 mytop                        percona-xtrabackup
hydra                        kitchen-sync                 mydumper                     mysql-connector-c++          ntopng                       sysbench
imagemagick                  libzdb                       mysql++                      mysql-connector-c++@1.1      percona-toolkit              vala
==> Deleted Formulae
mysql-connector-c

==> Downloading https://homebrew.bintray.com/bottles/prometheus-2.13.1.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/85/....
############################################################# 100.0%
==> Pouring prometheus-2.13.1.catalina.bottle.tar.gz
==> Caveats
When used with `brew services`, prometheus' configuration is stored as command line flags in
  /usr/local/etc/prometheus.args

Example configuration:
  echo "--config.file ~/.config/prometheus.yml" > /usr/local/etc/prometheus.args


To have launchd start prometheus now and restart at login:
  brew services start prometheus
Or, if you don't want/need a background service you can just run:
  prometheus
==> Summary
?  /usr/local/Cellar/prometheus/2.13.1: 18 files, 119.3MB

Lancement du service :

$ echo "--config.file /usr/local/opt/prometheus/prometheus.yml" > /usr/local/etc/prometheus.args
$ vi /usr/local/opt/prometheus/prometheus.yml
$ brew services start prometheus
==> Successfully started `prometheus` (label: homebrew.mxcl.prometheus)

Installation de node_exporter :

$ brew install node_exporter
==> Downloading https://homebrew.bintray.com/bottles/node_exporter-0.18.1_1.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/17/174b28c6400abf9a2c566ea67d0928ad3e49b5a1cf3c1a1b9a813dc19f103094....
######################################################################## 100.0%
==> Pouring node_exporter-0.18.1_1.catalina.bottle.tar.gz
==> Caveats
When used with `brew services`, node_exporter's configuration is stored as command line flags in
  /usr/local/etc/node_exporter.args

Example configuration:
  echo --web.listen-address :9101 > /usr/local/etc/node_exporter.args

For the full list of options, execute
  node_exporter -h

To have launchd start node_exporter now and restart at login:
  brew services start node_exporter
Or, if you don't want/need a background service you can just run:
  node_exporter
==> Summary
?  /usr/local/Cellar/node_exporter/0.18.1_1: 8 files, 16MB

$ echo --web.listen-address :9101 > /usr/local/etc/node_exporter.args

$ brew services start node_exporter
==> Successfully started `node_exporter` (label: homebrew.mxcl.node_exporter)

Pour ce connecter : http://0.0.0.0:9090