Ad Widget

Collapse

Should the Zabbix Server and Zabbix Proxy Configuration File match?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cb0n3y
    Member
    • Feb 2021
    • 32

    #1

    Should the Zabbix Server and Zabbix Proxy Configuration File match?

    Good morning everyone,

    I have a question that has been keeping me busy for some time. Do the configurations of both the server and the proxy
    have to be the same? By equal I mean the value of the options, for example a, Timeout. I have this configuration on my
    Zabbix server:

    Code:
    StartPollers=20
    StartIPMIPollers=2
    StartPollersUnreachable=20
    Timeout=5
    and this configuration in the Zabbix proxy:

    Code:
    StartPollers=80
    StartIPMIPollers=5
    StartPollerUnreachable=20
    Timeout=30
    I'm asking because I already have a headache looking for solutions for the "Timeout while executing a shell script"
    problem. I already increased the execution time in the Zabbix agent configuration to 30, but the problem still persists.
    I don't know what else I can do. The problem is not in the script because I just execute two commands:

    Code:
    UserParameter=yum.security,/usr/bin/yum list updates --security 2> /dev/null | awk '{print $1;}' | grep "`uname -p`\|noarch" | grep -v "forced skip_if_unavailable=True" | wc -l
    UserParameter=yum.updates,/usr/bin/yum list updates 2> /dev/null | awk '{print $1;}' | grep "`uname -p`\|noarch"| grep -v "forced skip_if_unavailable=True" | wc -l
    I measured the run time directly on the node in question and these are the results:

    Code:
    [root]# time zabbix_agentd -t yum.updates
    yum.updates [t|257]
    
    real 0m2.982s
    user 0m2.554s
    sys 0m0.338s
    
    [root]# time yum list updates
    ....
    
    real 0m2.950s
    user 0m2.605s
    sys 0m0.292s
    When i tried to get the values over the proxy i get this:

    Code:
    [zbx] $ zabbix_get -s <FQDN> -k "yum.updates"
    ZBX_NOTSUPPORTED: Timeout while executing a shell script.
    Does anyone have any idea what might be missing here? Thank you.
  • cb0n3y
    Member
    • Feb 2021
    • 32

    #2
    Hi cyber,

    thank you for your answer. Some advices about "Timeout while executing a shell script"?

    Comment

    • cb0n3y
      Member
      • Feb 2021
      • 32

      #3
      Hi cyber,

      thank you anyway. I will try to fix that. In case i do it, i'll back and post what i did.

      Comment

      • Markku
        Senior Member
        Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
        • Sep 2018
        • 1781

        #4
        One usual way to deal with long-running checks is to make them asynchronous, idea like this:
        1. Run your long-running yum script in crontab every day/hour/whatever and forward its output to /tmp/yumoutput.temp, them do mv /tmp/yumoutput.temp /tmp/yumoutput in the same script (this is important as we want the final output to be available whenever we happen to be reading the file in the item check)
        2. In your item use /tmp/yumoutput to do the awk/grep/whatever magic
        This way your item check is fast in every case.

        Change the filenames/paths as needed of course.

        Markku

        Comment

        • cb0n3y
          Member
          • Feb 2021
          • 32

          #5
          Good morning Markku,

          i'll give a try on that. Thank you for your answer, time and idea.

          Comment

          • cb0n3y
            Member
            • Feb 2021
            • 32

            #6
            Hello Markku,

            i wrote the script and i made a cronjob for the purpose of testing. I have to say that your solution works very well. Here the output:

            Code:
            -bash-4.2$ time zabbix_agentd -t yum.updates
            yum.updates [t|200]
            
            real 0m0.016s
            user 0m0.003s
            sys 0m0.013s
            Thank you once again. Have a nice day.

            Comment

            • cyber
              Senior Member
              Zabbix Certified SpecialistZabbix Certified Professional
              • Dec 2006
              • 4807

              #7
              No they don't have to match. Timeout is applied to the actual polling, ie if your proxy does it, then for proxy, server conf does not matter. Server does not know anything about polling at this point. It only communicates with proxy and acquires gathered data.

              Comment

              • cyber
                Senior Member
                Zabbix Certified SpecialistZabbix Certified Professional
                • Dec 2006
                • 4807

                #8
                Unfortunately no.... Those are quite longrunning commands.. In my environment they also don't return anything useful. Maybe some linux version differences... But that's not a point here...
                Running yum list updates already takes forewer, when I have not run this command before on that particular host... later retries are usually fast, 3-4 sec... I do not know what goes on behind the scenes there... Maybe it is normal behaviour for first run? Building some kind of cachesomewhere? Maybe agent runs into same situation, but maybe it is not able to keep that cache? ... These are pure speculations here... I am not a linux admin..
                Logged in to random host and ran this, almost a minute...
                Code:

                Code:
                :~$ time /usr/bin/yum list updates 2> /dev/null | awk '{print $1;}'
                Loaded
                :
                Uploading
                Loaded
                
                real 0m56.620s
                user 0m45.899s
                sys 0m10.733s
                Last edited by cyber; 24-12-2021, 19:56.

                Comment

                Working...