Ad Widget

Collapse

Trouble Installing Zabbix on Solaris 10

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rohitist
    Member
    • Apr 2014
    • 30

    #1

    Trouble Installing Zabbix on Solaris 10

    Hi,

    I get following error while using make on Oracle Solaris 10:

    Code:
    proc.c: In function `check_procstate':
    proc.c:37: error: `SRUN' undeclared (first use in this function)
    proc.c:37: error: (Each undeclared identifier is reported only once
    proc.c:37: error: for each function it appears in.)
    proc.c:37: error: `SONPROC' undeclared (first use in this function)
    proc.c:39: error: `SSLEEP' undeclared (first use in this function)
    proc.c:41: error: `SZOMB' undeclared (first use in this function)
    *** Error code 1
    make: Fatal error: Command failed for target `libspecsysinfo_a-proc.o'
    Current working directory /zabbix-2.2.4rc1/src/libs/zbxsysinfo/solaris
    Please note that I have installed zabbix in other solaris servers also with exactly same hardware and software configs. I suspect, some ENV VARIABLES are missing which is resulting in such fail.

    Please help me to sort this issue.

    Thanks,
    Rohit
    Last edited by rohitist; 02-07-2014, 12:27.
  • aib
    Senior Member
    • Jan 2014
    • 1615

    #2
    Are you installing server or agent?
    In case of agent it's more easy just copy all files from good site to new site.

    /usr/sbin/zabbix_agentd
    /etc/init.d/zabbix-agent
    /etc/zabbix/zabbix_agentd.conf
    Sincerely yours,
    Aleksey

    Comment

    • rohitist
      Member
      • Apr 2014
      • 30

      #3
      Dear Aleksey,

      I am stuck while installing agent on Oracle solaris 10. And the strange thing is that I can compile and make source on "Global zone" but I get the error as I had showed in "Sparse zone" specifically.

      If you still want to suggest me the same solution then could you please explain what "good site to new site" means ? Does it mean that I should copy and paste compiled source to this server from the working one?

      Regards,
      Rohit

      Comment

      • aib
        Senior Member
        • Jan 2014
        • 1615

        #4
        Originally posted by rohitist
        If you still want to suggest me the same solution then could you please explain what "good site to new site" means ? Does it mean that I should copy and paste compiled source to this server from the working one?
        Yes, you right.
        When you have the site/server/device where the client already working, you can copy all files to the new site/server with the same environment/OS.
        Sincerely yours,
        Aleksey

        Comment

        • rohitist
          Member
          • Apr 2014
          • 30

          #5
          Worked !!!

          Thanks Aleksey,

          I never re-considered the fact that I can execute the binary directly in the similar machine without the overhead of compilation of source.

          I did the same you suggested and now it is working.

          Regards,
          Rohit

          Comment

          • aib
            Senior Member
            • Jan 2014
            • 1615

            #6
            Good for you!
            Congratulations!!!
            Sincerely yours,
            Aleksey

            Comment

            • rohitist
              Member
              • Apr 2014
              • 30

              #7
              Tried to fix this error by changing codes.

              Hi,

              I have tried to fix this error using the link on Solaris 10.

              And, the fix worked.

              Here are the things I observed:

              in the function
              Code:
              check_procstate(psinfo_t *psinfo, int zbx_proc_stat)
              written in the file
              Code:
              src/libs/zbxsysinfo/solaris/proc.c
              , the following variable is of "char" type:

              Code:
              psinfo->pr_lwp.pr_state
              but in this function , this has been compared to a "string". Like below:

              Code:
              psinfo->pr_lwp.pr_state == SRUN
              .

              Perhaps in your development/ test environment, you have had "SRUN" as some "macro". But unfortunately, this was not found/ resolved in the Solaris 10 distribution, deployed in my company.

              So, according to the link I have posted at the top, I used the character equivalents of
              Code:
              SRUN, SSLEEP, SZOMB, SONPROC
              , like below:

              Code:
              switch (zbx_proc_stat)
              	{
              		case ZBX_PROC_STAT_RUN:
              			return (psinfo->pr_lwp.pr_state == 'R' || psinfo->pr_lwp.pr_state == 'O') ? SUCCEED : FAIL;
              		case ZBX_PROC_STAT_SLEEP:
              			return (psinfo->pr_lwp.pr_state == 'S') ? SUCCEED : FAIL;
              		case ZBX_PROC_STAT_ZOMB:
              			return (psinfo->pr_lwp.pr_state == 'Z') ? SUCCEED : FAIL;
              	}
              	return FAIL;
              And, after recompiling, this worked. I have not observed any issue so far.
              Let me know if these are correct changes.

              Comment

              • kloczek
                Senior Member
                • Jun 2006
                • 1771

                #8
                Originally posted by rohitist
                Hi,

                I get following error while using make on Oracle Solaris 10:

                Code:
                proc.c: In function `check_procstate':
                proc.c:37: error: `SRUN' undeclared (first use in this function)
                proc.c:37: error: (Each undeclared identifier is reported only once
                proc.c:37: error: for each function it appears in.)
                proc.c:37: error: `SONPROC' undeclared (first use in this function)
                proc.c:39: error: `SSLEEP' undeclared (first use in this function)
                proc.c:41: error: `SZOMB' undeclared (first use in this function)
                *** Error code 1
                make: Fatal error: Command failed for target `libspecsysinfo_a-proc.o'
                Current working directory /zabbix-2.2.4rc1/src/libs/zbxsysinfo/solaris
                Code:
                ]$ ggrep -r SSLEEP /usr/include/*
                /usr/include/sys/proc.h:#define SSLEEP  1               /* awaiting an event */
                Seems you have no installed header files.

                Code:
                $ pkg search proc.h
                INDEX      ACTION VALUE                  PACKAGE
                basename   file   usr/include/sys/proc.h pkg:/system/[email protected]
                Above is from Solaris 11.2 and I don't remember exact package name where header files are but it should be in some base devel package.
                http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
                https://kloczek.wordpress.com/
                zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
                My zabbix templates https://github.com/kloczek/zabbix-templates

                Comment

                • rohitist
                  Member
                  • Apr 2014
                  • 30

                  #9
                  proc.h found !!

                  Yes, "proc.h" is available in "/usr/include/sys/proc.h" and it has all such macros.

                  Code:
                  /* stat codes */
                  
                  #define SSLEEP  1               /* awaiting an event */
                  #define SRUN    2               /* running */
                  #define SZOMB   3               /* process terminated but not waited for */
                  #define SSTOP   4               /* process stopped by debugger */
                  #define SIDL    5               /* intermediate state in process creation */
                  #define SONPROC 6               /* process is being run on a processor */
                  #define SWAIT   7               /* process is waiting to become runnable */

                  The header was not included in the "src/libs/zbxsysinfo/solaris/proc.c". So, I included manually
                  Code:
                  #include <sys/proc.h>
                  . But after re-compilation, zabbix failed with error:

                  Code:
                  In file included from proc.c:23:
                  /usr/include/sys/proc.h:367: error: syntax error before "klgrpset_t"
                  *** Error code 1
                  make: Fatal error: Command failed for target `libspecsysinfo_a-proc.o'
                  Current working directory /tmp/zabbix-2.2.4rc1/src/libs/zbxsysinfo/solaris
                  Please note that I am using Solaris 10.

                  Any further solution?

                  Comment

                  • kloczek
                    Senior Member
                    • Jun 2006
                    • 1771

                    #10
                    Originally posted by rohitist
                    Please note that I am using Solaris 10.
                    Really doesn't matter in this case. Zabbix is using API/ABI which does not changed since Sol 10. To be honest you can compile zabbix on Sol 11.2 and it will be perfectly working on Sol 10.

                    You should not be doing any changes in zabbix code.
                    Did you (re)execute configure after add missing header files in /usr/include?
                    Something like:
                    Code:
                    ./config.status --recheck
                    in zabbix source tree should rerun autoconf with exactly the same parameters like you executed configure last time.
                    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
                    https://kloczek.wordpress.com/
                    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
                    My zabbix templates https://github.com/kloczek/zabbix-templates

                    Comment

                    • rohitist
                      Member
                      • Apr 2014
                      • 30

                      #11
                      Ok

                      Yes, I had run configure script but the same error is thrown.

                      The best I could do without making some significant changes in the code is to paste those macros from "sys/proc.h" to zabbix's "proc.c" like below:

                      Code:
                      #include "common.h"
                      #include "sysinfo.h"
                      #include "zbxregexp.h"
                      
                      #define DO_SUM 0
                      #define DO_MAX 1
                      #define DO_MIN 2
                      #define DO_AVG 3
                      
                      #define SSLEEP  1               /* awaiting an event */
                      #define SRUN    2               /* running */
                      #define SZOMB   3               /* process terminated but not waited for */
                      #define SSTOP   4               /* process stopped by debugger */
                      #define SIDL    5               /* intermediate state in process creation */
                      #define SONPROC 6               /* process is being run on a processor */
                      #define SWAIT   7               /* process is waiting to become runnable */
                      
                      static int	check_procstate(psinfo_t *psinfo, int zbx_proc_stat)
                      {
                      	if (zbx_proc_stat == ZBX_PROC_STAT_ALL)
                      		return SUCCEED;
                      
                      	switch (zbx_proc_stat)
                      	{
                      		case ZBX_PROC_STAT_RUN:
                      			return (psinfo->pr_lwp.pr_state == SRUN || psinfo->pr_lwp.pr_state == SONPROC) ? SUCCEED : FAIL;
                      		case ZBX_PROC_STAT_SLEEP:
                      			return (psinfo->pr_lwp.pr_state == SSLEEP) ? SUCCEED : FAIL;
                      		case ZBX_PROC_STAT_ZOMB:
                      			return (psinfo->pr_lwp.pr_state == SZOMB) ? SUCCEED : FAIL;
                      	}
                      	return FAIL;
                      }
                      In this way, integrity of code remains same as original, in my opinion.

                      And, compilation went just fine.

                      As of now, I don't have machine running Solaris 11. So, I will try your suggestion later.

                      Thanks

                      Comment

                      • kloczek
                        Senior Member
                        • Jun 2006
                        • 1771

                        #12
                        Originally posted by rohitist
                        Yes, I had run configure script but the same error is thrown.

                        The best I could do without making some significant changes in the code is to paste those macros from "sys/proc.h" to zabbix's "proc.c" like below:
                        So still something is wrong with your dev environment.
                        You should check config.log or output of the configure script.

                        If zabbix autoconf is unable to setup properly your zabbix source tree you will have probably similar problems with compiling many other open source projects.

                        Again: if you are thinking that you need to change something in zabbix code you are 100% right .. you are only thinking that it is right solution

                        On top of src/libs/zbxsysinfo/solaris/proc.c is:
                        Code:
                        #include "common.h"
                        #include "sysinfo.h"
                        #include "zbxregexp.h"
                        and in include/sysinc.h is:
                        Code:
                        #ifdef HAVE_SYS_PROC_H
                        #       include <sys/proc.h>
                        #endif
                        So in generated include/config.h you must have:
                        Code:
                        /* Define to 1 if you have the <sys/proc.h> header file. */
                        /* #undef HAVE_SYS_PROC_H */
                        Which means that AC_CHECK_HEADERS(sys/proc.h) from configure.ac failed and you should have traces of this why it happen in your config.log.
                        http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
                        https://kloczek.wordpress.com/
                        zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
                        My zabbix templates https://github.com/kloczek/zabbix-templates

                        Comment

                        • rohitist
                          Member
                          • Apr 2014
                          • 30

                          #13
                          You are right

                          The configure script failed to check "sys/proc.h".

                          Here is the part of the run of configure:

                          Code:
                          checking for sys/mount.h... yes
                          checking for sys/proc.h... no
                          checking for sys/sysctl.h... no
                          checking for sys/user.h... yes
                          checking for sys/swap.h... yes
                          checking for sys/ucontext.h... yes
                          checking for devstat.h... no

                          And here is the trace from "config.log".

                          Code:
                          configure:4651: checking for sys/proc.h
                          configure:4651: gcc -c -g -O2  conftest.c >&5
                          In file included from conftest.c:88:
                          /usr/include/sys/proc.h:367: error: syntax error before "klgrpset_t"
                          configure:4651: $? = 1
                          configure: failed program was:
                          | /* confdefs.h */


                          I have read somewhere that "error: syntax error before "klgrpset_t"" is an issue due to gcc available in "/usr/sfw/bin/gcc". And I have cross verified and found that gcc is in "/usr/sfw/bin/gcc" in my production server setup. Indeed, there is some issue at my end.

                          Can you guide me more please ?

                          Comment

                          • kloczek
                            Senior Member
                            • Jun 2006
                            • 1771

                            #14
                            Originally posted by rohitist
                            Can you guide me more please ?
                            Sorry I'm busy at the moment .. maybe at the end of the day.
                            http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
                            https://kloczek.wordpress.com/
                            zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
                            My zabbix templates https://github.com/kloczek/zabbix-templates

                            Comment

                            • kloczek
                              Senior Member
                              • Jun 2006
                              • 1771

                              #15
                              Originally posted by rohitist
                              And here is the trace from "config.log".

                              Code:
                              configure:4651: checking for sys/proc.h
                              configure:4651: gcc -c -g -O2  conftest.c >&5
                              In file included from conftest.c:88:
                              /usr/include/sys/proc.h:367: error: syntax error before "klgrpset_t"
                              configure:4651: $? = 1
                              configure: failed program was:
                              | /* confdefs.h */


                              I have read somewhere that "error: syntax error before "klgrpset_t"" is an issue due to gcc available in "/usr/sfw/bin/gcc". And I have cross verified and found that gcc is in "/usr/sfw/bin/gcc" in my production server setup. Indeed, there is some issue at my end.

                              Can you guide me more please ?
                              Please have look on http://sourceforge.net/p/net-snmp/bugs/2494/#bfdc
                              Seems you have not matching gcc with system header files.
                              Which one update version of Solaris 10 you have and from where is your gcc?
                              http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
                              https://kloczek.wordpress.com/
                              zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
                              My zabbix templates https://github.com/kloczek/zabbix-templates

                              Comment

                              Working...