Nagios script to monitor hard disk failures

Source: Internet
Author: User

#!/usr/bin/perluse strict;use warnings; use lib  "/usr/lib64/nagios/plugins";  use  UTILS QW (%errors);my  $usage  =  "usage: $0 host_addr ipmi_user  ipmi_passconnects to a dell bmc and parses the drive token  For raid statusand disk slot errors. ";  if  (my  $result  =  '/usr/bin/ipmitool  chassis status 2>/dev/ null  ')  {         my  $err _lvl = 0;         my  $status = "";         my  $key = ";          foreach my  $line   ( split /\n/s,  $result) {                 if  (my  @fields  = split (/:/,$line)) {                #        print  $fields [1];                 #       print $ fields[0];                         chomp ($status  =  $fields [1]);                          chomp ($key  =  $fields [0]);                         if ($key  =~ m/ Drive (\s+) fault/g ) {                                 if  (  $status  =~  m/true/g) {                                           $err _lvl++;                                  }                                                                      }                 }         }        if  ($err _lvl > 0)  {                 print  "CRITICAL:  hard disk is fault  \n ";                 exit  $ERRORS {' CRITICAL '}         } else {                 print  "ok: hard disks is ok   \n";                 exit  $ERRORS {' OK '}         }} else {

can be used. Can find the hard disk Fault in time

Then you can use

Ipmitool SEL List

Check logs

Nagios script to monitor hard disk failures

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.