Announcement

Collapse
No announcement yet.

plugin to check mount point

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • kchaoueed
    started a topic plugin to check mount point

    plugin to check mount point

    hello,

    I am looking for a plugin that allows me to check if a mount point is mounted on a server or not
    NB : server requires authentication

    thx

  • centurion
    replied
    Hi I'm using a script to monitor that :
    "
    HTML Code:
    #!/bin/bash
    
    STATE_OK=0
    STATE_WARNING=1
    STATE_CRITICAL=2
    STATE_UNKNOWN=3
    STATE_DEPENDENT=4
    
    TEMPLATE=/app/plugins/template_mounted.tpl
    MOUNTED=/app/plugins/mounted.txt
    if [ ! -f  $TEMPLATE ]
    then
        mount | grep -E '^\/|nfs|sshfs' | awk '{print $1}' |  sort -o $TEMPLATE
            echo "Template not found - Creation of template $TEMPLATE ..."
            exit $STATE_UNKNOWN
    fi
    
    if [ `find $TEMPLATE -ctime +7` ]
    then
        mount | grep -E '^\/|nfs|sshfs' | awk '{print $1}' |  sort -o $TEMPLATE
            echo "Template file is older than 30 days - Creation of a new template $TEMPLATE ..."
            exit $STATE_UNKNOWN
    fi
    
    mount | grep -E '^\/|nfs|sshfs' | awk '{print $1}' |  sort -o $MOUNTED
    
    result=`comm -23 $TEMPLATE $MOUNTED | awk '{if (!message) {message=$0} else {message=message " @@ " $0}} END {print message}'`
    
    
    if [[ -z "$result" ]]
    then
            echo "OK - All FS are up"
            exit $STATE_OK
    else
            echo "CRITICAL - Some FS are down !!! - $result"
            exit $STATE_CRITICAL
    fi

    Leave a comment:

Working...
X