Ad Widget

Collapse

Zabbix wrong value in latest data but zabbix_get returns correct value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • registration_is_lame
    Senior Member
    • Nov 2007
    • 148

    #1

    Zabbix wrong value in latest data but zabbix_get returns correct value

    Hi,

    Zabbix is reporting false value under latest data but correct value when I use zabbix_get. Debug shows that it is sending back correct value.

    Code:
      6269:20170805:033615.908 Requested [mysql.slave_running]
      6269:20170805:033615.908 In zbx_popen() command:'(mysql -uroot  -e  "show slave status\G" | grep -E 'Slave_SQL_Running:|Slave_IO_Running:' | cut -f2 -d':' | sed "s/No/0/; s/Yes/1/" | awk '{ SUM += $1} END { print SUM }')'
      6274:20170805:033615.910 zbx_popen(): executing script
      6269:20170805:033615.910 End of zbx_popen():6
      6269:20170805:033615.941 In zbx_waitpid()
      6269:20170805:033615.941 zbx_waitpid() exited, status:0
      6269:20170805:033615.941 End of zbx_waitpid():6274
      6269:20170805:033615.941 EXECUTE_STR() command:'(mysql -uroot  -e  "show slave status\G" | grep -E 'Slave_SQL_Running:|Slave_IO_Running:' | cut -f2 -d':' | sed "s/No/0/; s/Yes/1/" | awk '{ SUM += $1} END { print SUM }')' len:1 cmd_result:'2'
      6269:20170805:033615.941 Sending back [2]
      6269:20170805:033615.941 __zbx_zbx_setproctitle() title:'listener #8 [waiting for connection]'
      6262:20170805:033616.531 __zbx_zbx_setproctitle() title:'listener #1 [processing request]'
      6262:20170805:033616.531 Requested [system.cpu.load[percpu,avg5]]
      6262:20170805:033616.532 Sending back [0.010000]
    I checked the history_uint table and it is storing value as 1.

    Note: The change I made was that I changed grep to search for 2 pattern and then added "awk to sum the values" to the agent config and then restarted agents. Before making that change, grep searched for only one pattern and the values were either 0 or 1. Since the change it is either 0, 1 or 2.

    I've tried restarting zabbix_server, clearing the template and apply again. Also tried exporting then deleting template and uploaded it again. Still false data.

    Code:
    UserParameter=mysql.slave_running,(mysql -uroot   -e  "show slave status\G" | grep -E 'Slave_SQL_Running:|Slave_IO_Running:' | cut -f2 -d':' | sed "s/No/0/; s/Yes/1/" | awk '{ SUM += $1} END { print SUM }')

    Code:
    /usr/bin/zabbix_get -s 10.10.10.10 -k mysql.slave_running
    
    2
    But latest data shows the value is 1.

    Server Version - 3.2
    Agent Version - 3.2.7
    Last edited by registration_is_lame; 10-08-2017, 11:34.
  • registration_is_lame
    Senior Member
    • Nov 2007
    • 148

    #2
    My Mistake. The item type was Boolean. That is why it wasn't accepting value 2. I changed it to Decimal and it displays correctly now.
    Last edited by registration_is_lame; 10-08-2017, 11:48.

    Comment

    Working...