Ad Widget

Collapse

Extract data from a log and populate to multiple Items

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prasad_SL
    Member
    • May 2018
    • 35

    #1

    Extract data from a log and populate to multiple Items

    Hi,

    I am testing a SSH host with Zabbix 3.4
    Host is old and setting up Zabbix agents/any other client application or enabling SNMP not possible.
    Only possibility is extract command output.
    I written expect script and fire by an Item link to external script.
    So I have the periodic update/overwritten file as follows.

    hardDiskUsage WELSBC01P / {
    totalDiskSpace "10190136 KBytes";
    freeDiskSpace "4959176 KBytes";
    usedDiskSpace 51%;
    role primary;
    syncStatus unprotected;
    syncCompletion n/a;
    }
    hardDiskUsage WELSBC01P /home {
    totalDiskSpace "126371648 KBytes";
    freeDiskSpace "111644352 KBytes";
    usedDiskSpace 12%;
    role primary;
    syncStatus unprotected;
    syncCompletion n/a;
    }
    hardDiskUsage WELSBC01S / {
    totalDiskSpace "10190136 KBytes";
    freeDiskSpace "4706960 KBytes";
    usedDiskSpace 54%;
    role primary;
    syncStatus unprotected;
    syncCompletion n/a;
    [7m--More--[27m[8D[K}
    hardDiskUsage WELSBC01S /home {
    totalDiskSpace "126371648 KBytes";
    freeDiskSpace "110165712 KBytes";
    usedDiskSpace 13%;
    role primary;
    syncStatus unprotected;
    syncCompletion n/a;
    }
    hardDiskUsage WELSBC01S /var/log/sonus/sbx/evlog {
    totalDiskSpace "95986496 KBytes";
    freeDiskSpace "76196704 KBytes";
    usedDiskSpace 21%;
    role primary;
    syncStatus synchronized;
    syncCompletion 100%;
    }

    I need to populate values to separate Items so I can draw graphs and trigger alerts.
    Ex: totalDiskSpace, usedDiskSpace

    Any Idea ?
    Please comment.


  • DmitryL
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • May 2016
    • 278

    #2
    Dependent items + regexp pre processing

    Comment

    • prasad_SL
      Member
      • May 2018
      • 35

      #3
      Thanks. I will try. Had some issues with multi line REGEX ...Lets try..

      Comment

      • DmitryL
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • May 2016
        • 278

        #4
        This should help.
        Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET, Rust.

        Comment

        • prasad_SL
          Member
          • May 2018
          • 35

          #5
          Thank you D,
          I am also using http://rubular.com/
          regex101 flags sometimes not supported in Zabbix.
          Ex: global flag
          I think I can do this with your guide.


          Anyway, If I want large log data manipulations, what would be the best option withZabbix ?
          python, C or shell

          Comment

          • DmitryL
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • May 2016
            • 278

            #6
            Actually doesn't matter which programming language you choose for custom checks. Pick the one which in result work's faster so you won't have to increase Timeout dramatically
            If you are gathering and processing data with the script and then just parse the final result to Zabbix trapper, then it doesn't matter at all.

            Comment

            Working...