Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- PREFIX='php.fpm'
- URL='http://127.0.0.1/status-php-fpm'
- CURL='/usr/bin/curl'
- SENDER='/usr/bin/zabbix_sender'
- CONFIG='/etc/zabbix/zabbix_agentd.conf'
- if [ ! -x ${CURL} ]
- then echo Seems, path to curl is incorrect or not installed. && exit 0
- else if [ ! -x ${SENDER} ]
- then echo Seems, path to zabbix_sender is incorrect or not installed. && exit 0
- else if [ ! -f ${CONFIG} ]
- then echo Seems, path to zabbix_agentd.conf is incorrect && exit 0
- fi fi fi
- OUTPUT="$(${CURL} --no-keepalive -s -m 5 ${URL} -w 'ping: %{time_total}')"
- echo "${OUTPUT}" | awk -v pr="- ${PREFIX}." '
- /^accepted c/ {print pr"accepted_conn "$3}
- /^active proc/ {print pr"active_processes "$3}
- /^idle proc/ {print pr"idle_processes "$3}
- /^listen queue:/ {print pr"listen_queue_len "$3}
- /^max children reach/ {print pr"max_children_reached "$4}
- /^max listen queue:/ {print pr"max_listen_queue_len "$4}' | ${SENDER} -c ${CONFIG} -i - > /dev/null 2>&1
- echo "${OUTPUT}" | awk '/^ping:/ {print $2}' | sed 's/,/./'
- exit 1
Add Comment
Please, Sign In to add comment