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

[fix] bash zabbix

This commit is contained in:
Ramil Valitov 2020-07-07 00:29:01 +03:00
parent 337bb77d0a
commit a6196278aa
No known key found for this signature in database
GPG Key ID: 2AB186DABDFE1914

View File

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