Ad Widget

Collapse

Different trigger thresholds for discovered filesystems?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • allenb_1121
    Junior Member
    • Apr 2012
    • 3

    #1

    Different trigger thresholds for discovered filesystems?

    I'm really enjoying the new filesystem autodiscovery with Zabbix 2.x, however I have an issue with it.
    When the autodiscovery finds the filesystems and populates them on the host, it puts in a trigger with a 20% threshold. I know that I can go to the template and modify that value to whatever percentage I feel appropriate, but I want different percentages for each filesystem. For example:
    I may want on host1:
    / 10%
    /var 5%
    /boot 20%
    and on host 2:
    / 20%
    /var 18%
    /boot 50%

    I thought that I would just be able to go to each host an edit the trigger manually, but since it is inherited from a template, I don't seem to be able to do this.
    How can I go about making use of the autodiscover feature and still retain customized trigger thresholds for each filesystem on each host?
    Is this possible?
    Any advice would be greatly appreciated!
    Thanks.
    Allen B.
  • sbockelman
    Junior Member
    • Oct 2008
    • 16

    #2
    Take a look here:

    Comment

    • allenb_1121
      Junior Member
      • Apr 2012
      • 3

      #3
      Originally posted by sbockelman
      Ahhh...so it really is not possible/has not been fixed. It seems to be a pretty much useless feature that it puts in that trigger, then.

      I suppose it is back to manually creating filesystem items/triggers...yuck.
      Allen B.

      Comment

      • sbockelman
        Junior Member
        • Oct 2008
        • 16

        #4
        Here is the method we have used. Add the lld for the disks as normal, but do not add any triggers. In a separate check on the host (not lld) we added a perl script that runs every minute and finds any disks over a default threshold of 90. Then on each server, we can tweak the threshold for each fs.

        We added an UserParameter to call the script:
        Code:
        UserParameter=diskscan[*],/home/zabbix/bin/diskscan.pl $1
        In zabbix, the item is "diskscan[90]" with type of character. Trigger is:
        Code:
        (({Template_OS_Linux:diskscan[90].regexp(:)})#0)
        Here is the script:
        Code:
        #!/usr/bin/perl -wl
        
        # runs a df and determines if a disk is over a % threshold
        # values can be overwritten in the customFile for specific thresholds
        
        # INPUT: the threshold, ie 90 and custom fstype if needed
        # OUTPUT: a list of disks that are full or "ok"
        # TRIGGER: trigger on "not ok" or ":"
        
        use strict;
        
        # threshold is required
        my $threshold = shift || exit print "usage: $0 THRESHOLD <FSTYPE>";
        my $fstype = shift || 'ext|reiserfs';
        my $customFile = '/home/zabbix/local/diskscan.custom';
        
        # custom disk thresholds from $customFile
        system ("touch $customFile");
        my @customData = `cat $customFile`;
        my %customDisks;
        
        # build %customDisks
        foreach (@customData)
        {
                chomp $_;
                if (m/^#/) { next; } # ignore comments
                my ($disk,$pct) = split(':',$_);
                $customDisks{$disk} = $pct;
        }
        
        # get df output
        my @disks = `df -lmT | egrep '$fstype' | awk {'print \$(NF-2)":"\$(NF-4)":"\$(NF-1)":"\$NF'}`;
        
        # used to store output
        my @problemDisks;
        
        # parse thru each disk and compare to threshold
        foreach (@disks)
        {
                chomp $_;
                my $tempThreshold = $threshold;
                my ($freeSpace,$diskSize,$pctUsed,$disk) = split(':',$_);
                my $tempFreeSpace = $freeSpace;
        
                if ($freeSpace > 1024) {
                        #$freeSpace = int($freeSpace / 1024) . 'G';
                        $freeSpace = sprintf("%.1f", int($freeSpace / 1024)) . 'G';
                }
                else {
                        $freeSpace .= 'M';
                }
                if ($diskSize > 1024) {
                        $diskSize = int($diskSize / 1024) . 'G';
                }
                else {
                        $diskSize .= 'M';
                }
        
                $pctUsed =~ s/\%//;
                if ($customDisks{$disk}) # check for custom threshold
                {
                        $tempThreshold = $customDisks{$disk};
                }
        
                # if over threshold and under 5G free. 5G free will allow for larger disks to scale correctly
                if ($pctUsed > $tempThreshold and $tempFreeSpace < 5000)
                {
                        push(@problemDisks, "$disk>$tempThreshold:$pctUsed% $freeSpace/$diskSize");
                }
        }
        
        if (@problemDisks) # any disks are over threshold
        {
                foreach (@problemDisks)
                {
                        chomp $_;
                        print $_;
                }
        }
        else # no disks are over threshold. must return something
        {
                print 'ok';
        }
        The /home/zabbix/local/diskscan.custom file can contain custom thresholds:
        /var:30
        That will override the 90% threshold for /var to 30%
        Last edited by tchjts1; 07-05-2013, 22:34. Reason: Added code tags to keep formatting

        Comment

        • trikke
          Senior Member
          • Aug 2007
          • 140

          #5
          Hi There,

          can't you do something like:
          {Template_Windows:vfs.fs.size[c:,pused].last(0)}>{$DISC_HIGH}

          And then you can have the Macro {$DISC_HIGH} set with different values according to the "Level" (Default: value 10%, on Template Level 15% or even on each and every Host to say 5%)
          Working with macros means you only change the Macro, no need to change the Trigger!

          Does this helps u in anyway?

          Greets
          Patrick

          Comment

          • mvrk
            Member
            • Oct 2008
            • 71

            #6
            Can you provide a more specific example on how to configure this macros?

            For example:

            On host1 i want that / filesystem limit would be 5%
            and /home filesystem limit would be 10%

            On host2 i want that / filesystem limit would be 2%
            and /home filesystem limit would be 5%

            Comment

            • sbockelman
              Junior Member
              • Oct 2008
              • 16

              #7
              The LLD has been updated to allow for this. See my example here:


              For my perl script, do this to host1 and host2's /home/zabbix/local/diskscan.custom
              host1
              /:5
              /home:10

              host2
              /:2
              /home:5
              Last edited by sbockelman; 18-06-2013, 13:22.

              Comment

              • BrentN
                Member
                • Mar 2012
                • 37

                #8
                I'm hitting this roadblock as well and it's a show stopper for me.

                I read through the changes coming in 2.2 that sort of allow this to work, but it still doesn't let us set at different threshold for each discovered file system, only a global one for the host via a macro. I'm fine with creating a host macro for these, even if I had to do this:

                {$C_CritThreshold}=70
                {$E_CritThreshold}=90
                {$F_CritThreshold}=90
                {$G_CritThreshold}=95

                The problem still remains that I can't attach these to triggers discovered through LLD because we don't supply a specific volume in the trigger definition, only #FSNAME. Therefore, I can't match up each of those macros to a volume. This is a serious problem when you have 300 hosts each with maybe 3 or 4 volumes and global thresholds just aren't an option.

                It think it still comes back to one of the following
                1. Allowing one level of nesting in macros so {{#FSNAME}_CritThreshold}} turns into, for example, {$C_CritThreshold}.
                2. Allowing some sort of concatenation to produce the same effect.
                3. Coming up with an entirely different way to achieve this.


                LLD was a huge improvement! It just needs to go a little bit further to realize the fact that many systems require unique thresholds and within each of those hosts we might need specific thresholds on a per discovered item basis. Also, grabbing these values from a text file on the host in question sort of breaks the entire notion of a fully centralized (yet distributed) monitoring system. I don't want to have to touch 300 hosts to change something like the threshold for C:.

                Comment

                • mvrk
                  Member
                  • Oct 2008
                  • 71

                  #9
                  Any news about this issue?

                  Comment

                  • Fotis
                    Junior Member
                    • Sep 2014
                    • 24

                    #10
                    Guys any update on this?

                    I have a FS LLD and I would like to have a trigger only for Drive C:

                    here is my trigger.. {LLD:vfs.fs.size[{#FSNAME},pused].last()}>95

                    What should I do in the above expression in order to have it only for C?

                    {LLD:vfs.fs.size[C:,pused].last()}>95 isn't working

                    Comment

                    • Fotis
                      Junior Member
                      • Sep 2014
                      • 24

                      #11
                      Ok

                      I made a small research and I saw that it's not possible to do it.
                      I created a separate item only for C drive and I added the trigger there.
                      Cheers

                      Comment

                      Working...