Ad Widget

Collapse

Trigger show PROBLEN after test runs successfully

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dunnsland
    Member
    • Dec 2021
    • 81

    #1

    Trigger show PROBLEN after test runs successfully

    I have added an OS Update check on multiple linux servers.
    The issue that I have is a few of them are showing as PROBLEM, I cannot find out why this is the case.
    The OS of the VM is below.
    Distributor ID: Ubuntu
    Description: Ubuntu 22.04.5 LTS
    Release: 22.04
    Codename: jammy

    I have added the following UserParamer to the zabbix_agentd.conf file

    UserParameter=system.updates,apt list --upgradable 2>/dev/null | wc -l

    After adding the line I restarted the agent.
    I then ran the following test

    zabbix_agentd -t system.updates
    the result is below.

    system.updates [t|1]

    The test runs without any issues.
    After the test I then added the item and trigger to the zabbix dashboard for the relevant host.
    item below
    Click image for larger version  Name:	image.png Views:	0 Size:	13.9 KB ID:	499098

    Click image for larger version  Name:	image.png Views:	0 Size:	116.4 KB ID:	499096

    Trigger below
    Click image for larger version  Name:	image.png Views:	0 Size:	8.4 KB ID:	499097

    Click image for larger version  Name:	image.png Views:	0 Size:	116.4 KB ID:	499099

    I have done the same on all of my VM servers and a few of them are showing the trigger as a PROBLEM.

    I have checked in the logs and I see nothing related to the issue.

    Does anyone have any ideas why this is happening and how I can resolve it.
    Last edited by dunnsland; 14-02-2025, 11:27. Reason: made a typo in the subject line.
  • dunnsland
    Member
    • Dec 2021
    • 81

    #2
    Made a typo in the subject line. Should be PROBLEM

    Comment

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

      #3
      If it shows "PROBLEM" then it is triggered. I guess if your expression is as shown last()>1, then there should be a value received, which is more than 1....
      Your config page just shows, that this trigger is currently "triggered"..

      Comment

      • dunnsland
        Member
        • Dec 2021
        • 81

        #4
        cyber Thanks for responding .... when I was doing the set up. The reference said that I should use >0, but every time I run the test it always said 1 even when there are no updates available ...
        So I assumed that if I changed it to > 1 then if the resulting test out put was 1, then it should not alert and only show if the resulting output is above 1 and not equal to 1.

        then why is the trigger showing as PROBLEM, then it has run successfully. Is this something that I can ignore?

        Sorry also thinking about it ... if it is triggered, the query is run and either sent to the dashboard or not, why would it should PROBLEM after being triggered.
        Looking at many of my others VM configs, they all show OK in green and not PROBLEM.
        Thanks
        Lawrence
        Last edited by dunnsland; 14-02-2025, 12:35.

        Comment

        • kyus
          Senior Member
          • Feb 2024
          • 171

          #5
          It always shows 1 because wc -l counts the amount of lines, and when you run apt list --upgradable the first line you get is "Listing... Done"

          Now to the actual question, it is displaying "problem" because that's what you configured it for.
          Code:
          last(/Icanmon/system.updates)>1
          This basically makes so if there's any packages to be upgraded, it'll create a problem.
          You can see the latest data for your item, since there's a problem, it means the value is indeed greater than 1

          Comment

          • dunnsland
            Member
            • Dec 2021
            • 81

            #6
            kyus I am very sorry but I do not understand the logic. (feeling a little blond here)
            If what you are saying is the case, why is it that some of the items for some VMs are NOT showing PROBLEM in red. I have exactly the same query with multiple VMs and 3 of 8 are showing PROBLEM and the balance are showing OK. This is what is causing my confusion.
            I interpret the query as follows.
            Firstly, I assumed that when you see OK it means that your query is correct and delivers back data. either false or true.
            In my case I want the query to be run, if the count is less than or equal to 1 then do nothing, if the count is greater than 1 then show the alert that there are updates to be carried out.

            As it stands, there are no updates, and as such the return number is 1 as you pointed out (I understand that that is because there is always one line returned.), but if the output is 1 then do nothing because the query is checking the result of being greater than 1.

            just a side note, when I was investigating how to achieve the update alert, the original query is

            last(/Icanmon/system.updates)>0

            with the fact that there is always at least 1 line returned, having teh query show > 0 did not seem correct.

            If I try to figure your logic, can you tell me what to do to remove the PROBLEM indication and have it showing as OK.

            Thanks
            Lawrence
            Last edited by dunnsland; 14-02-2025, 23:40.

            Comment

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

              #7
              PROBLEM/OK is not syntax check.. it does syntax check when you save your trigger and if there is an error, you get notifiied.
              Check your latest data, is there only 1-s for all your hosts or maybe some of them have some other number returned?

              Comment

              • dunnsland
                Member
                • Dec 2021
                • 81

                #8
                cyber this is really confusing because I have used exactly the same syntax for all my virtual machine configs. why is it the only one shows as PROBLEM and others not.
                I have checked all the servers and they all show 1s, but I think that this syntax check is local to the config and not the check on the server.
                below is a screenshow of a few servers including the PROBLEM. As you can see the syntax of the query is all teh same.

                Click image for larger version  Name:	image.png Views:	1 Size:	52.8 KB ID:	499181
                Also I do not see any reference to the PROBLEM in the zabbix_agent.log file.
                Below you can see the successful test on the commandline on the server.

                Click image for larger version

Name:	image.png
Views:	55
Size:	16.9 KB
ID:	499185

                Thanks
                Lawrence
                Last edited by dunnsland; 17-02-2025, 10:45.

                Comment

                • Brambo
                  Senior Member
                  • Jul 2023
                  • 245

                  #9
                  dunnsland my advice on building own templates is use template macro on the values of triggers. Default template value is then set on the expected result. However when something changes you can easily override on host level. This will make future updated template release for yourself easier to manage.

                  Comment

                  • dunnsland
                    Member
                    • Dec 2021
                    • 81

                    #10
                    cyber Thanks aagin for taking the time to respond. No clue what happened but I deleted the PROBLEM trigger and recreated it. This time it created correctly. I followed the exact same procedure I did the first time.
                    Must have been something wrong when trying to save the config the first time. No clue but now it seems to be correct and showing OK.

                    All good.

                    Thanks again for repsponding
                    Lawrence

                    Comment

                    Working...