[ZBX-6564] AIX system.uptime is wrong with 32bit agent Created: 2013 May 04  Updated: 2019 Apr 26  Resolved: 2016 Jul 22

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G), Documentation (D)
Affects Version/s: 2.0.6
Fix Version/s: None

Type: Incident report Priority: Blocker
Reporter: Carlos Rodrigues Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: aix, overflow, uptime
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

AIX 5.3 and 6.1 with 32bit zabbix_agentd (downloaded from "www.zabbix.com/download.php").


Issue Links:
Duplicate
is duplicated by ZBX-10242 Uptime counter overflow on AIX machines Closed

 Description   

I have a few AIX servers, and zabbix is reporting wrong uptime for the ones which have been up for a long time:

One of the machines (AIX 6.1) has 685+ days of uptime, but zabbix reports a little more than 188 days.
Another one (AIX 5.3) has 248+ days of uptime, but zabbix always reports 0.

This seems like a 32bit bug. I've recompiled the agent as a 64bit binary, and this made the problem go away.

For completeness, these where the steps I took to rebuild zabbix_agentd for 64bit:

CFLAGS='-maix64' ./configure --enable-agent

  1. On AIX 6.1 edit include/config.h and add, to the top:
  2. #include <sys/protosw.h>
  3. Ref: https://www-304.ibm.com/support/docview.wss?uid=isg1IV01736

make ARFLAGS="-cru -X64"

strip -X64 src/zabbix_agent/zabbix_agentd



 Comments   
Comment by richlv [ 2013 May 04 ]

in general, 32bit agents will work on 64bit systems but may fail in some cases. for a quite different os, but similar, problem, see ZBX-6412

we should probably :

(1) document this

martins-v Added as a general note to:

https://www.zabbix.com/documentation/2.0/manual/concepts/agent
https://www.zabbix.com/documentation/2.2/manual/concepts/agent

Comment by richlv [ 2013 May 04 ]

(2) be explicit about aix agent platform on the download page

Comment by Carlos Rodrigues [ 2013 May 04 ]

But does it make sense to only have 32bit binaries for AIX on the download page? I don't think many people are running 32bit AIX 5.3 kernels, much less AIX 6.1...

Comment by richlv [ 2013 May 04 ]

that's more of a feature request that a bug, though

Comment by Neiro [ 2013 Jul 03 ]

Can you attach your compiled binary zabbix_agentd to this thread or send to my email (neiromc[AT]gmail.com)
I can't build this from sources. More Thanks!

Comment by Carlos Rodrigues [ 2013 Jul 05 ]

Here you go: http://cloud.carlos-rodrigues.com/bugs/zabbix_agentd.2.0.6.aix61.64bit.gz

Comment by Kim Jongkwon [ 2016 Jul 07 ]

AIX 7.1 has same problem with system.uptime.
It seems like uptime counter overflowed after 497 days.

2016-07-05 10:57:48 1467683868 507737
2016-07-05 10:47:48 1467683268 507137

$ uptime
10:58AM up 502 days, 23:31, 1 user, load average: 0.13, 0.13, 0.14
2016-06-29 14:07:48 1467176868 737
2016-06-29 13:57:48 1467176268 137
2016-06-29 13:47:48 1467175668 4294966834
2016-06-29 13:37:48 1467175068 4294966235
2016-06-29 13:27:48 1467174468 4294965634
2016-06-29 13:17:48 1467173868 4294965034

Also, after 248+ days of system.uptime has completely changed values from 248 to 49461 (Days).

Comment by Andris Mednis [ 2016 Jul 14 ]

There was a similar issue ZBX-6637 on Solaris platform where a 32-bit Zabbix agent could not provide correct info about 64-bit processes and the solution was always using a 64-bit Zabbix agent on Solaris.

Seems like a natural solution is to use only 64-bit Zabbix agent on AIX, too. We could change build scripts to make 64-bit agent by default.
Does anybody need a 32-bit agent on AIX ?

Comment by Andris Mednis [ 2016 Jul 20 ]

Proposed solution

Do not use 32-bit Zabbix agent on AIX, just compile the agent in 64-bit mode. No Zabbix source code modification is required.

Zabbix agent on UNIX uses iconv() function which may be part of libc or supplied by a dedicated libiconv library.
On an AIX 6.1 test system we had access to only a 32-bit GNU libiconv was installed, which could not be used for building 64-bit agent. Thus the first step is to build 64-bit GNU libiconv from source.

Compiling 64-bit GNU libiconv on AIX

Download source http://ftp.gnu.org/gnu/libiconv/, then:

$ gunzip -c libiconv-1.14.tar.gz | tar xf -
$ cd libiconv-1.14
$ unset OBJECT_MODE
$ CFLAGS="-maix64 -g -O2" ./configure --disable-shared --prefix=`pwd`
$ export OBJECT_MODE=64
$ make install

The newly built liibrary contains 64-bit objects:

$ ar -tv -X64 lib/libiconv.a
rw-r--r--   210/210   1473346 Jul 20 20:27 2016 iconv.o
rw-r--r--   210/210    44232 Jul 20 20:27 2016 localcharset.o
rw-r--r--   210/210    35078 Jul 20 20:27 2016 relocatable.o

and no 32-bit objects:

$ ar -tv -X32 lib/libiconv.a
(nothing is shown)

iconv is 64-bit executable:

$ file bin/iconv 
bin/iconv: 64-bit XCOFF executable or object module not stripped

Location of libiconv (will be used in the next step):

$ pwd
/admin/tmp/andris/libiconv-1.14

Compiling 64-bit Zabbix agent and utilities on AIX

$ gunzip -c zabbix-3.0.4rc1.tar.gz | tar xf -
$ cd zabbix-3.0.4rc1
$ export OBJECT_MODE=64
$ CFLAGS="-maix64 -g -O2" ./configure --enable-agent --with-iconv=/admin/tmp/andris/libiconv-1.14 --prefix=`pwd`
....
Configuration:

  Detected OS:           aix6.1.1.0
  Install path:          /admin/tmp/andris/zabbix-3.0.4rc1
  Compilation arch:      aix

  Compiler:              /admin/tmp/andris/zabbix-3.0.4rc1/compile gcc
  Compiler flags:         -maix64 -g -O2

  Library-specific flags:
    iconv:                 -I//admin/tmp/andris/libiconv-1.14/include

  Enable server:         no

  Enable proxy:          no

  Enable agent:          yes
  Agent details:
    TLS:                   no
    Linker flags:               -L//admin/tmp/andris/libiconv-1.14/lib
    Libraries:                 -lm -lperfstat   -liconv
...

$ make install

Executable files are 64-bit:

$ file bin/z* sbin/z*
bin/zabbix_get: 64-bit XCOFF executable or object module not stripped
bin/zabbix_sender: 64-bit XCOFF executable or object module not stripped
sbin/zabbix_agentd: 64-bit XCOFF executable or object module not stripped

Library dependencies:

$ ldd sbin/zabbix_agentd          
sbin/zabbix_agentd needs:
         /usr/lib/libc.a(shr_64.o)
         /usr/lib/libperfstat.a(shr_64.o)
         /unix
         /usr/lib/libcrypt.a(shr_64.o)
         /usr/lib/libpthreads.a(shr_xpg5_64.o)
         /usr/lib/libcfg.a(shr_64.o)
         /usr/lib/libodm.a(shr_64.o)
         /usr/lib/libcorcfg.a(shr_64.o)
         /usr/lib/liblvm.a(shr_64.o)
         /usr/lib/libsrc.a(shr_64.o)

This procedure was tested with Zabbix agent versions 2.0, 3.0 and trunk.
After the Zabbix agent is successfully compiled, the GNU libiconv directory (e.g. /admin/tmp/andris/libiconv-1.14/) can be deleted.

Comment by Andris Mednis [ 2016 Jul 20 ]

Can somebody test the proposed solution ? I have neither access to AIX machine with uptime > 497 days nor a clean, standard AIX installation

Comment by Andris Mednis [ 2016 Jul 21 ]

Got a feedback that 64-bit agent solves the issue.

Generated at Sat Apr 27 07:02:42 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.