Ad Widget

Collapse

How to create a trigger for numeric float date in a file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vershooter
    Junior Member
    • Nov 2021
    • 5

    #1

    How to create a trigger for numeric float date in a file

    Hi,

    I am a newbie in zabbix,

    I created a script in linux and it will create a file that has a value on it. The data in a file has only one value / number .


    For example.

    /home/testuser/textfile.txt

    If you cat the textfle.txt the output is 50

    the data in textfile.txt is 50.

    Then I want to create a zabbix alert if the data in that text file will be greater than 100 , zabbix will give me alert.

    Is this possible?
  • tikkami
    Member
    • May 2018
    • 71

    #2
    Create Zabbix agent item.
    Use fs.file.contents[/home/testuser/textfile.txt,] as key.
    Type could be Numeric float or unsigned.


    Then create trigger with this expression ("Test" is hostname in my case):
    {Test:vfs.file.contents[/home/testuser/textfile.txt,].last()}>100

    Comment

    • vershooter
      Junior Member
      • Nov 2021
      • 5

      #3
      Hi Tikkami,

      i tried that one configure item and the trigger.

      trigger test is okay but agent item I am having error

      Click image for larger version

Name:	zabbix alert.png
Views:	764
Size:	21.2 KB
ID:	435177



      Error is test item

      -unable to get teh value, its says NOT supported by ZABBIX agent

      Comment

      • tikkami
        Member
        • May 2018
        • 71

        #4
        Which user has been used to run zabbix agent?
        Does that user has permission to read the file?

        Comment

        • vershooter
          Junior Member
          • Nov 2021
          • 5

          #5
          zabbix iser, as checked on ps -ef | grep zabbix

          Yes I change the the owner to zabbix and I also change the permission to rwx in user, group others


          Comment

          • vershooter
            Junior Member
            • Nov 2021
            • 5

            #6
            Hi All,

            Can anyone help me. Thanks

            Comment

            • tikkami
              Member
              • May 2018
              • 71

              #7
              Must be still some issue with file/folder permissions. Try e.g. /tmp.

              Comment

              • vershooter
                Junior Member
                • Nov 2021
                • 5

                #8
                tikkami

                Still same,

                I tried to put the file in /tmp


                -rwxrwxrwx this is the permission of the file.

                Attached Files

                Comment

                • tim.mooney
                  Senior Member
                  • Dec 2012
                  • 1427

                  #9
                  Are you using SELinux, AppArmor, or some other security mechanism on the client where the agent is running?

                  Comment

                  • Atsushi
                    Senior Member
                    • Aug 2013
                    • 2028

                    #10
                    What version of Zabbix agent are you using? Are you using a version of the agent that supports vfs.file.contents[]?

                    Comment

                    Working...