Ad Widget

Collapse

Piping HAProxy log parser and Zabbix_sender

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sevmax
    Junior Member
    • Jun 2012
    • 6

    #1

    Piping HAProxy log parser and Zabbix_sender

    Hello everyone!
    It seems like I need an advice on how to parse HAProxy logs and send them into Zabbix.
    Below are two scripts which work fine, and I need them to work all together as one-line script.

    1. Command to get query processing time from haproxy logs in real time:
    tail -f haproxy.log | awk '{print $10}' | cut -d/ -f4

    2. Command to send one value into zabbix.
    echo "- haproxy.app.processing.time 1234"|zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file - -vv

    I suppose it should be some trick with pipes there to link them together, and that is where I need help. Please advice.

    Thank you in advance!
  • sevmax
    Junior Member
    • Jun 2012
    • 6

    #2
    Found a solution:
    tail -f haproxy.log | awk '{print $10}' | cut -d/ -f4 | while read VALUE ; do echo "- haproxy.app.processing.time $VALUE"|zabbix_sender --config /etc/zabbix/zabbix_agentd.conf --input-file - -vv ; done
    It works as required.

    Comment

    Working...