Depending on what preprocessor conditionals are taken in the <sys/utsname.h> OS header, the struct utsname member strings are different lengths. If using the compiler provided by HP, the system.uname item functions normally. If using gcc, the uname function that fills these character arrays runs into some kind of memory issue where only the sysname member gets populated and doesn't seem to get properly terminated with a null character. The agent was reporting HP-UX 11.31 followed by some random values to the server. I read through utsname.h and found a fix that works in my environment. I changed the following line in src/libs/zbxsysinfo/hpux/system.c from:
struct utsname name;
to:
struct utsname_hpux_v1 name;
This seems to function correctly with the HP C compiler and gcc. I attached my modified source file. Using the utsname_hpux_v1 declaration forces 9 byte member strings rather than the 257 byte strings.
- is duplicated by
-
ZBXNEXT-2489 "system.uname" returns incorrect data on HP-UX 11.23
- Closed
-
ZBX-9539 Incorrect uname information for HP-UX
- Closed