« Prometheus » : différence entre les versions
Aller à la navigation
Aller à la recherche
| Ligne 76 : | Ligne 76 : | ||
# service nginx status | # service nginx status | ||
On configure prometheus en rajoutant ces <font color=green> | On configure prometheus en rajoutant ces <font color=green>trois lignes</font> : | ||
{{Méta bandeau | {{Méta bandeau | ||
| niveau = modéré | | niveau = modéré | ||
| Ligne 87 : | Ligne 87 : | ||
... | ... | ||
command_args="--config.file=$prometheus_config_file \ | command_args="--config.file=$prometheus_config_file \ | ||
<font color=green>--web.external-url=<nowiki>https://127.0.0.1:</nowiki>'''9191''' \ | <font color=green>--web.listen-address="127.0.0.1:9090" \ | ||
--web.external-url=<nowiki>https://127.0.0.1:</nowiki>'''9191''' \ | |||
--web.route-prefix="/" \</font> | --web.route-prefix="/" \</font> | ||
--storage.tsdb.path=$prometheus_storage_path \ | --storage.tsdb.path=$prometheus_storage_path \ | ||
| Ligne 96 : | Ligne 97 : | ||
* Caching service dependencies ... [ ok ] | * Caching service dependencies ... [ ok ] | ||
* Starting prometheus ... [ ok ] | * Starting prometheus ... [ ok ] | ||
{{Méta bandeau | |||
| niveau = information | |||
| icône = loupe | |||
| texte = Le serveur <u>ne doit plus</u> être accessible via '''<nowiki>http://ip_prometheus:9090</nowiki>''' mais le sera via '''<nowiki>https://ip_prometheus:9191</nowiki>''' avec l'utilisateur "admin". | |||
}} | |||
= Export = | = Export = | ||
Version du 10 avril 2021 à 15:48
Serveur
20 % en cours..
LXC Alpine 3.12 Prometheus
Installation serveur de base
# apk update && apk upgrade # apk add prometheus # rc-update add prometheus default # service prometheus start
On test en se rendant sur l'adresse http://IP_PROMETHEUS:9090 :
Facile!
(Optionnel) Securisation serveur
On installe un proxy local pour capturer et sécuriser le flux :
# apk add nginx # rc-update add nginx default # service nginx start
On crée un .htpasswd pour l'utilsateur "admin" et son mot de passe :
# apk add apache2-utils # htpasswd -c /etc/nginx/.htpasswd admin
New password:
On prépare le cryptage :
# apk add openssl # mkdir -p /root/certs/prometheus/ && cd /root/certs/prometheus
# openssl req \
-x509 \
-newkey rsa:4096 \
-nodes \
-keyout prometheus.key \
-out prometheus.crt
On configure le vhost :
# vi /etc/nginx/conf.d/prometheus.conf
server {
listen 9191 ssl;
ssl_certificate /root/certs/prometheus/prometheus.crt;
ssl_certificate_key /root/certs/prometheus/prometheus.key;
location / {
auth_basic "Prometheus";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://localhost:9090/;
}
}
# service nginx status
On configure prometheus en rajoutant ces trois lignes :
# vi /etc/init.d/prometheus
...
command_args="--config.file=$prometheus_config_file \
--web.listen-address="127.0.0.1:9090" \
--web.external-url=https://127.0.0.1:9191 \
--web.route-prefix="/" \
--storage.tsdb.path=$prometheus_storage_path \
...
# service prometheus restart
* Caching service dependencies ... [ ok ] * Starting prometheus ... [ ok ]
Export
Export Nvidia
docker run --name NVexport -p IP_EXPOSE:9445:9445 -d --restart=always -e LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 --volume /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1:/usr/lib/x86_64-linux-gnu/libnvidia-ml.so.1 --privileged mindprince/nvidia_gpu_prometheus_exporter:0.1