Ad Widget

Collapse

Timeout while executing a shell script.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mathewkc86
    Junior Member
    • Apr 2021
    • 6

    #1

    Timeout while executing a shell script.

    Hello All,
    I hope you all are doing good.
    I am testing vcenter monitoring using powershell script,i have a script which connects to vcenter and gather some information about the services state. It uses bellow command to connect to vcenter
    " Connect-VIserver 192.168.*.* -User root -Password ******"
    Usually when i run from my zabbix server(ubuntu 20) open terminal and type "pwsh" and try above command to connect to vcenter it works fine.
    But when i try to do using zabbix "system.run" it gives me timeout error, below is the key i was using
    system.run[/usr/bin/pwsh -Command "/home/script.ps1"]
  • mwildam
    Member
    • Feb 2021
    • 72

    #2
    But keep in mind that 30 (=30 seconds) is the maximum. If you have longer running scripts, then you should consider configuring those as separate scripts e.g. triggered by crontab and using zabbix_sender to send values to the server.

    Comment

    • mathewkc86
      Junior Member
      • Apr 2021
      • 6

      #3
      Thank you very much for the reply,
      Yes after increasing the timeout value in agent conf the issue resolved.
      But what will be the impact if we increase the timeout values for e.g. above 10? currently i have kept to 12s

      Comment

      • mwildam
        Member
        • Feb 2021
        • 72

        #4
        The impact can be, that if too many scripts need too much time then your pollers (or senders - depending type of item - agent or agent active) may be full of work and you need to increase the number of them to be used. See https://www.zabbix.com/forum/zabbix-...e-than-75-busy for example (but there are several related topics in the forum).

        The appropriate Zabbix performance indicators can be monitored - see https://www.zabbix.com/documentation...types/internal

        Comment

        • mwildam
          Member
          • Feb 2021
          • 72

          #5
          In my case I have 2 or 3 long-running check scripts and I set those items to check only every 5 minutes or one even only every 60m or so because not critical and just statistics. So I would recommend to avoid long running check scripts to be run each minute. If you have one script running 30 seconds and you want current data every minute then of course there is one process 50% occupied with just that check. Not to say if you have such a check in a template which is applied to a lot of hosts. In the latter case you should make sure that you have that as active check to distribute the work at least. - I did both - active check plus increased interval.

          However, I noticed that even worse for the performance is, if your script is producing too much data. - So sending a lot of data to the zabbix server is even worse than a longer running script (and of course collecting and sending much data is also is time consuming).

          So it is also worth reviewing check scripts. I had one (from an old nagios installation) that I could optimize to consume only ~1/5 of the time it took before. And in another case I reduced text lines to be sent back to the server.

          Comment

          • mathewkc86
            Junior Member
            • Apr 2021
            • 6

            #6
            Thank you your explanation.
            And you are right about the long running script and producing too much data.
            In my scenario i have three scripts
            The zabbix agent in zabbix server runs the script using system.run and gets the data in item. Then by using content search i created trigger.
            1. Check the Health summary status of vcenter(VAMI)
            2. Check the running services if its stopped or degraded
            3. Check the snapshot if its older than 3 days

            1 and 2nd script is running every 5mins, 3rd script in running every 6hours.
            Currently i am trying to optimize this by reducing the received data,not sure how efficient is this.

            Comment

            Working...