[Check_mk (english)] Check_MK alert for NFS volumes with nfsmounts

paulmonitoring paulmonitoring at gmail.com
Wed Aug 5 13:20:18 CEST 2015


    
Here it is;




#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# |             ____ _               _        __  __ _  __           |
# |            / ___| |__   ___  ___| | __   |  /  | |/ /           |
# |           | |   | '_  / _ / __| |/ /   | |/| | ' /            |
# |           | |___| | | |  __/ (__|   <    | |  | | .             |
# |            ____|_| |_|___|___|_|____|_|  |_|_|_           |
# |                                                                  |
# | Copyright Mathias Kettner 2010             
mk at mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software;  you can redistribute it and/or modify it
# under the  terms of the  GNU General Public License  as published by
# the Free Software Foundation in version 2.  check_mk is  distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;  with-
# out even the implied warranty of  MERCHANTABILITY  or  FITNESS FOR A
# PARTICULAR PURPOSE. See the  GNU General Public License for more de-
# ails.  You should have  received  a copy of the  GNU  General Public
# License along with GNU Make; see the file  COPYING.  If  not,  write
# to the Free Software Foundation, Inc., 51 Franklin St,  Fifth Floor,
# Boston, MA 02110-1301 USA.



#WARN num, CRIT num
nfsmounts_default_levels = (90, 95)



def inventory_nfsmounts(info):



    # begin with empty inventory
    inventory = []



    # loop over all output lines of the agent
    for line in info:



            inv = (line[0], "nfsmounts_default_levels" )



            if inv not in inventory:
                inventory.append(inv)



    return inventory



def check_nfsmounts(item, params, info):



    warn, crit = params



#<<<nfsmounts>>>
#/a01/hyperbridge ok 3225257 1612352 1448518 32768
#/a01/software/HyperGate ok 3225257 1612352 1448518 32768
#/sharedata ok 3225257 1612352 1448518 32768



    for line in info:
        #mountpoint = line[0]
        if line[0] == item:
            size_blocks = int(line[2])
            free_blocks = int(line[4]) 
            blocksize = int(line[5])



            if size_blocks < 0 or free_blocks < 0 or blocksize > 1024*1024:
                return (1, "Stale NFS handle")



            if line[1] == 'ok':
                gb = 1024 * 1024 * 1024.0
                size_gb = (size_blocks * blocksize) / gb
                if size_gb == 0:
                    return (0, "server is responding")
            else:
                return (2, "server not responding")
            #return (3, "UNKNOWN - not mounted")



            free_gb = (free_blocks * blocksize) / gb
            used_gb = size_gb - free_gb
            used_perc = 100.0 * used_gb / size_gb
            infotext = "Disk is %.1f%% used (%.1f of %.1f GB)" % (used_perc, used_gb, size_gb)
            perfdata = [ ("used_perc", used_perc, warn, crit) ]



            if used_perc > crit:
                return (2, "" + infotext, perfdata)    
            elif used_perc > warn:
                return (1, "" + infotext, perfdata)    
            else:
                return (0, "" + infotext, perfdata)
    return (3, "UNKNOWN - not mounted")



check_info['nfsmounts'] = (check_nfsmounts, "NFS mount %s", 1, inventory_nfsmounts)





Sent via the Samsung GALAXY S® 5, an AT&T 4G LTE smartphone

-------- Original message --------
From: Murali Babu <drop2muralibabu at gmail.com> 
Date: 08/05/2015  01:46  (GMT-05:00) 
To: paulmonitoring <paulmonitoring at gmail.com> 
Cc: Jam Mulch <spammagnet10 at gmail.com>, checkmk-en at lists.mathias-kettner.de 
Subject: Re: [Check_mk (english)] Check_MK alert for NFS volumes with nfsmounts 

Hi Paul,
Can you please direct me where i can get updated check script for nfsmounts.
Thanks.
On Tue, Aug 4, 2015 at 6:52 PM, paulmonitoring <paulmonitoring at gmail.com> wrote:

    
I recently provided an updated check script that allows thresholds and perfdata for the nfsmounts service.

-------- Original message --------
From: Jam Mulch <spammagnet10 at gmail.com> 
Date: 08/04/2015  07:47  (GMT-05:00) 
To: checkmk-en at lists.mathias-kettner.de 
Subject: Re: [Check_mk (english)] Check_MK alert for NFS volumes with nfsmounts 


    You could write a local check (or checks) to do what you want, but
    be careful

    you don't hang the check if there is a problem with an nfs mount.

    

    On 8/4/2015 5:33 AM, Murali Babu wrote:

    
    
      Hi
          Mathias,
        

        
        We are using check_mk
          for monitoring and we want to enable the alert for NFS volumes
          with 'nfsmounts' check.
        

        
        For now check_mk
          sending alert for nfs volume access and timeout.
        

        
        But we also need to
          get alert for nfsmounts by setting threshold same like df
          check.
        

        
        Please help on this.
        

        
        Thanks. 
        

        
        

          

        
      
      

      
      

      _______________________________________________
checkmk-en mailing list
checkmk-en at lists.mathias-kettner.de
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

We’ll meet in Munich for the 2nd Check_MK Conference!
Book your place now and be part of it.
October 18th-20th, 2015
http://mathias-kettner.com/conference
    
    

  
_______________________________________________

checkmk-en mailing list

checkmk-en at lists.mathias-kettner.de

http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en



We’ll meet in Munich for the 2nd Check_MK Conference!

Book your place now and be part of it.

October 18th-20th, 2015

http://mathias-kettner.com/conference



-- 
Best & Regards 


D. Murali Babu



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mathias-kettner.de/pipermail/checkmk-en/attachments/20150805/8f8ee011/attachment-0001.html>


More information about the checkmk-en mailing list