Ad Widget

Collapse

Zabbix_get gets incorrect result

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dyuha85
    Member
    • Aug 2012
    • 41

    #1

    Zabbix_get gets incorrect result

    Hi all!

    I need monitor my Postgresql server. I've set up script to monitor active session in DB

    Code:
    #!/bin/bash
    pg=`psql -c "select count(*) from pg_stat_activity where state='active'" -Upostgres | sed -n '3p' | awk '{print $1}'`
    
    if [ "$pg" -ge "4" ]; then
    echo "0"
    else
    echo "1"
    fi
    Code:
    UserParameter=status[*],/home/dima/pg.sh
    If "0" it's PROBLEM
    if "1" it's OK

    So zabbix_agent gets correct result, but Zabbix_get gets incorrect result.

    Code:
    zabbix_agentd -t "status"
    status[]                                      [t|0]
    Code:
    zabbix_get -s xx.xx.xx.xx  -p 10050 -k "status"
    1
    When it's "PROBLEM" Zabbix_get is still getting "1", as if it's "OK"

    Please help me
    Dmitriy

    P.S: Sorry for my bad english.
Working...