Ad Widget

Collapse

zabbix_agentd not setting HOME

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • richlv
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Oct 2005
    • 3112

    #1

    zabbix_agentd not setting HOME

    there is some functionality that requires correct environment set for zabbix_agentd - for example, ability to use .my.cnf.
    we used that previously, but it seems that it is not working with the latest versions anymore - 1.4.4 agent does not use .my.cnf in the home directory for zabbix_agentd user.

    if i start zabbix_agentd as the zabbix user, parameters requiring .my.cnf access start working, so it seems that when agentd detaches and drops root privileges, it fails to set correct environment.

    anybody else observed this ?

    i have a vague guess that before it actually worked because of a security problem that got fixed for 1.4.3 :
    - [ZBX-189, CVE-2007-6210] fixed super-user permissions of user commands (Alexei)

    so it might have used root .my.cnf before, actually. in any case, mysql user parameters with password suplied in .my.cnf do not work anymore.
    supplying password in zabbix_agentd.conf is not an option
    Zabbix 3.0 Network Monitoring book
  • Hichhiker
    Member
    • Nov 2004
    • 45

    #2
    Originally posted by richlv
    there is some functionality that requires correct environment set for zabbix_agentd - for example, ability to use .my.cnf.
    we used that previously, but it seems that it is not working with the latest versions anymore - 1.4.4 agent does not use .my.cnf in the home directory for zabbix_agentd user.

    if i start zabbix_agentd as the zabbix user, parameters requiring .my.cnf access start working, so it seems that when agentd detaches and drops root privileges, it fails to set correct environment.

    anybody else observed this ?

    i have a vague guess that before it actually worked because of a security problem that got fixed for 1.4.3 :
    - [ZBX-189, CVE-2007-6210] fixed super-user permissions of user commands (Alexei)

    so it might have used root .my.cnf before, actually. in any case, mysql user parameters with password suplied in .my.cnf do not work anymore.
    supplying password in zabbix_agentd.conf is not an option
    I've seen this, you can just supply the path to .my.cnf on start (I think its --defaults-file= or --defaults-extra-file= option, depending on what you want) . I personally trigger a shell script that defines HOME and then runs a bunch of mysql checks and returns all values via sender. More efficient that way.

    -HH

    Comment

    • Alexei
      Founder, CEO
      Zabbix Certified Trainer
      Zabbix Certified SpecialistZabbix Certified Professional
      • Sep 2004
      • 5654

      #3
      Originally posted by richlv
      if i start zabbix_agentd as the zabbix user, parameters requiring .my.cnf access start working, so it seems that when agentd detaches and drops root privileges, it fails to set correct environment.
      Does it have to set the environment variables? I do not think so.

      However I agree that agent behaviour must be the same regardless of what user started it.
      Alexei Vladishev
      Creator of Zabbix, Product manager
      New York | Tokyo | Riga
      My Twitter

      Comment

      • richlv
        Senior Member
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Oct 2005
        • 3112

        #4
        Originally posted by Alexei
        Does it have to set the environment variables? I do not think so.
        However I agree that agent behaviour must be the same regardless of what user started it.
        well, of course it should not set some hardcoded variables
        ideally, the environment would be the same as for normal user login in the current shell when zabbix_agentd - but i have no idea how complicated that is.
        there is some software that avoids setting such environment (like dcron), so maybe there are valid reasons to have it unset.

        is a generic environment setting possible at all ?
        Zabbix 3.0 Network Monitoring book

        Comment

        • richlv
          Senior Member
          Zabbix Certified Trainer
          Zabbix Certified SpecialistZabbix Certified Professional
          • Oct 2005
          • 3112

          #5
          resurrecting the thread (as the issue popped up in one of the servers ).
          while workarounds can be used for 1.4, it would be nice to see this improved in 1.6 - should i open a bugreport in the tracker ?
          Zabbix 3.0 Network Monitoring book

          Comment

          • richlv
            Senior Member
            Zabbix Certified Trainer
            Zabbix Certified SpecialistZabbix Certified Professional
            • Oct 2005
            • 3112

            #6
            a not-too-dirty workaround :
            prepend all mysql commands with "export HOME=/home/zabbix;" or similar.
            Zabbix 3.0 Network Monitoring book

            Comment

            • MikeBreton
              Junior Member
              • Nov 2009
              • 19

              #7
              zabbix agentd fails to load

              I built a new version of zabbix 1.6.6, copied the agentd out to the monitored server and tried to load. The console showed that it had a FloatingPoint error.
              I found this in /var/log/messages=
              Nov 6 12:36:27 ca9xpodb01 kernel: zabbix_agentd[13943] trap divide error rip:7ef9e9 rsp:ffffd5bc error:0

              I figured that I would just load the older version I still had. It didn't show an error, but when I checked the log I saw this.
              /tmp/zabbix_agentd.log=
              zabbix_agentd started. ZABBIX 1.4.4.
              6351:20091106:103650 Listener failed with error: Cannot bind to port 10050 for server 161.236.61.35. Error [Cannot assign requested address]. Another zabbix_agentd already running ?

              Not sure what happened in the first instance and puzzled by the second.

              Can anyone shed a little light on this?

              Comment

              • richlv
                Senior Member
                Zabbix Certified Trainer
                Zabbix Certified SpecialistZabbix Certified Professional
                • Oct 2005
                • 3112

                #8
                that's a completely different problem, for which creating a new thread would have been much more appropriate.

                as for the first problem, i'ts bad, but i suspect something with compilation against one version of libs and running against another - try to compile on the machine that agent will have to run on.

                second problem - something is already listening on that port, most likely (as indicated by the error message) - another zabbix agent. check processlist.
                Zabbix 3.0 Network Monitoring book

                Comment

                • MikeBreton
                  Junior Member
                  • Nov 2009
                  • 19

                  #9
                  Sorry, it was a moment of desperation, I thought there was enough commonality without starting another thread, this is still quite new and a learning experience for me. I thought I compiling with the --enable-static directive would enable me to load on remote servers in case there were lib issues even at the expense of executable size. I'll go back and check my work.

                  Thanks

                  Comment

                  • richlv
                    Senior Member
                    Zabbix Certified Trainer
                    Zabbix Certified SpecialistZabbix Certified Professional
                    • Oct 2005
                    • 3112

                    #10
                    Originally posted by MikeBreton
                    I thought I compiling with the --enable-static directive would enable me to load on remote servers in case there were lib issues even at the expense of executable size.
                    it should have. if it still does not, discuss the problem in a new thread
                    Zabbix 3.0 Network Monitoring book

                    Comment

                    Working...