3
0
mirror of https://github.com/rvalitov/zabbix-php-fpm.git synced 2023-11-05 03:30:27 +01:00

[add] run scripts as zabbix user

This commit is contained in:
Ramil Valitov 2020-07-07 00:14:40 +03:00
parent 450279b984
commit a8d99dc7f3
No known key found for this signature in database
GPG Key ID: 2AB186DABDFE1914

View File

@ -158,7 +158,7 @@ testStatusScriptSocket() {
PHP_POOL=$(getAnySocket)
#Make the test:
DATA=$(sudo bash "/etc/zabbix/zabbix_php_fpm_status.sh" "$PHP_POOL" "/php-fpm-status")
DATA=$(sudo -u zabbix sudo bash "/etc/zabbix/zabbix_php_fpm_status.sh" "$PHP_POOL" "/php-fpm-status")
IS_OK=$(echo "$DATA" | grep -F '{"pool":"')
assertNotNull "Failed to get status from pool $PHP_POOL: $DATA" "$IS_OK"
echo "Success test of $PHP_POOL"
@ -169,7 +169,7 @@ testStatusScriptPort() {
PHP_POOL="127.0.0.1:$PHP_PORT"
#Make the test:
DATA=$(sudo bash "/etc/zabbix/zabbix_php_fpm_status.sh" "$PHP_POOL" "/php-fpm-status")
DATA=$(sudo -u zabbix sudo bash "/etc/zabbix/zabbix_php_fpm_status.sh" "$PHP_POOL" "/php-fpm-status")
IS_OK=$(echo "$DATA" | grep -F '{"pool":"')
assertNotNull "Failed to get status from pool $PHP_POOL: $DATA" "$IS_OK"
echo "Success test of $PHP_POOL"
@ -195,13 +195,13 @@ testZabbixStatusPort() {
}
testDiscoverScriptReturnsData() {
DATA=$(sudo bash "/etc/zabbix/zabbix_php_fpm_discovery.sh" "/php-fpm-status")
DATA=$(sudo -u zabbix sudo bash "/etc/zabbix/zabbix_php_fpm_discovery.sh" "/php-fpm-status")
IS_OK=$(echo "$DATA" | grep -F '{"data":[{"{#POOLNAME}"')
assertNotNull "Discover script failed: $DATA" "$IS_OK"
}
testDiscoverScriptDebug() {
DATA=$(sudo bash "/etc/zabbix/zabbix_php_fpm_discovery.sh" "debug" "/php-fpm-status")
DATA=$(sudo -u zabbix sudo bash "/etc/zabbix/zabbix_php_fpm_discovery.sh" "debug" "/php-fpm-status")
ERRORS_LIST=$(echo "$DATA" | grep -F 'Error:')
assertNull "Discover script errors: $DATA" "$ERRORS_LIST"
}