GithubHelp home page GithubHelp logo

nihlaeth / nagios_check_smartmon Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 14.0 27 KB

Fork of https://exchange.nagios.org/directory/Plugins/Operating-Systems/Linux/check_smartmon/details

License: GNU General Public License v2.0

Python 98.63% C 1.37%
nagios smartmontools

nagios_check_smartmon's People

Contributors

arteq avatar dmp1ce avatar garycarneiro avatar josef-friedrich avatar nihlaeth avatar soujak avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nagios_check_smartmon's Issues

Root privileges required

Right now, root privileges are required. This is a problem, because I intend to use it with check_by_ssh. The user I assigned for this has limited privileges for obvious reasons. I thought to fix it by simply setting the setuid bit. Unfortunately (though with good reason) - this does not work on scripts, only on binaries.

cython --embed would be a possible solution, though I think it might be safer to provide a binary wrapper for smartctl. Needs further thought.

--all-disks does not work when using software raid, encryption or lfs

Psutil reports partitions in use, and from there we extract the physical devices. If you use raid, encryption or lfs, the mapped devices are reported, and we can't get the physical devices from that through psutil.

Either we need to ls/grep from the dev directory for the actual physisal devices, which is bound to be buggy, or we accept the limitations of the -a/--all-disks option.

Failing disk generates non-zero exit status -> no info for nagios

When I switched to subprocess, I assumed that a non-zero exit status would always mean some error in accessing the device or executing the command. However, when there's something wrong with the disk, smartctl indicates this in the return value as well.

Option:
We do it the easy way, we ignore the exit status and live with the fact that the parser will complain if command execution fails.

Option:
We interpret the exit status and only issue an error message & skip the parser if the command failed.

CRITICAL status if smartctl reports "SMART Health Status: OK"

Colleagues,

plugin is hardcoded to expect "PASSED" in following code snippet

# check health status
if health_status != "PASSED":
return_status = 2
device_status += "CRITICAL: device does not pass health status "

Although in some cases smartctl reports "SMART Health Status: OK"

root@server:~# smartctl -H /dev/sdd
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.13.0-74-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF READ SMART DATA SECTION ===
SMART Health Status: OK

which leads to CRITICAL status.

Reproducible: always

didnt work

root@gateway [~] # ./check_smartmon.py 
: UNKNOWN: no such device foundUNKNOWN: smartctl parsing error 

root@gateway [~] # ./check_smartmon.py /dev/sda
: UNKNOWN: no such device foundUNKNOWN: smartctl parsing error 
root@gateway [~] # lsblk 
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0 119.2G  0 disk 
├─sda1            8:1    0    30G  0 part /
├─sda2            8:2    0     4G  0 part 
├─sda4            8:4    0     1K  0 part 
└─sda5            8:5    0  85.2G  0 part 
  └─system-data 253:0    0   1.9T  0 lvm  /data
sdb               8:16   0   1.8T  0 disk 
└─system-data   253:0    0   1.9T  0 lvm  /data

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.