Last active
January 16, 2023 15:59
-
-
Save JanThiel/a9567e1622525376598a74e4c56b8355 to your computer and use it in GitHub Desktop.
Generates the datadog config file for php_fpm based on ISPConfig created FPM Pool configs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
read -r -d '' TEMPLATE << EOM | |
- status_url: unix:///var/lib/php-fpm/{{web}}.sock/status | |
ping_url: unix:///var/lib/php-fpm/{{web}}.sock/ping | |
use_fastcgi: true | |
ping_reply: pong | |
tags: | |
- website.domain:{{domain}} | |
EOM | |
grep -srnw /etc/opt/remi/php*/php-fpm.d/* -e 'webmaster' | while read -r SITE; do | |
WEB=$( echo $SITE | sed -r 's/.*(web[0-9]+)\.conf.*webmaster\@([^"]+)"$/\1/') | |
DOMAIN=$( echo $SITE | sed -r 's/.*(web[0-9]+)\.conf.*webmaster\@([^"]+)"$/\2/') | |
TPL=$( sed -e "s/{{web}}/$WEB/g" -e "s/{{domain}}/$DOMAIN/g" <<< "$TEMPLATE") | |
#echo "WEB: $WEB | DOMAIN: $DOMAIN"; | |
echo " $TPL" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment