Page 1 of 2
NSClient++ and monitor hdd SMART
Posted: Mon Sep 14, 2015 10:44 am
by ThinkFast86
Ηι all,
I'd like to ask you if there is any way to monitor over Nagios core on Linux server the HDD health?
I know that i can monitor the usage of hdd but is there any other way to monitor health or i have to do my own script?
I am already using NSClient++ on some hosts for monitoring the usage of hdd so i prefer to use this or you can tell me another way.
Thank you in advance.
Re: NSClient++ and monitor hdd SMART
Posted: Mon Sep 14, 2015 10:49 am
by jolson
There is a default plugin called 'check_ide_smart' that should be installed on your Nagios box. Though I'm not 100% sure how to set NSClient++ up to work with that script, it's the one that you need.
Check for the plugin:
Code: Select all
/usr/local/nagios/libexec/check_ide_smart --help
Re: NSClient++ and monitor hdd SMART
Posted: Mon Sep 14, 2015 11:17 am
by ThinkFast86
How can i make a service with this plugin? Is it working with snmp?
Do i must make a new service with this command?
Re: NSClient++ and monitor hdd SMART
Posted: Mon Sep 14, 2015 3:39 pm
by tgriep
What is the version of Nagios Core are you running?
Do you want to monitor the SMART settings for the Nagios Core system or a remote system?
If you do want to monitor a remote system, what types of systems are they and the OS version they are running?
The check_ide_smart plugin will only work if it is installed on the local system, it cannot monitor a remote system's HDD.
Re: NSClient++ and monitor hdd SMART
Posted: Tue Sep 15, 2015 1:17 am
by ThinkFast86
The version of Nagios is 4.0.8.
Yes i want to monitor remote systems and that systems have Windows 8 as OS.
No i don't want to monitor the SMART from Nagios.
Is that possible?
Re: NSClient++ and monitor hdd SMART
Posted: Tue Sep 15, 2015 1:56 am
by Box293
Using NSClient++ and check_nrpe I think you could do a WMI check.
First, I found some information about SMART and WMI here:
http://www.gregorystrike.com/2012/08/03 ... -remotely/
Then, in NSClient++ you need the modules enabled:
Code: Select all
[/modules]
CheckWMI = enabled
NRPEServer = enabled
Then I think this command would be a good starting point:
Code: Select all
Command:
./check_nrpe -H win2008r2-01 -c CheckWMI -a 'Query=Select DeviceID,Status from win32_DiskDrive'
Output:
DeviceID=\\.\PHYSICALDRIVE0Status=OKDeviceID=\\.\PHYSICALDRIVE1Status=OKDeviceID=\\.\PHYSICALDRIVE2Status=OKDeviceID=\\.\PHYSICALDRIVE3Status=OK|'wmi query'=4
NOTE: I tested this with NSClient++ 0.3.9.330 and 0.4.1.105. From memory I think the newer versions of NSClient++ have issues with the CheckWMI module.
Re: NSClient++ and monitor hdd SMART
Posted: Tue Sep 15, 2015 9:17 am
by ThinkFast86
At the command line it works great and returns the same results as your.
When i creat the service for the host i receive the error message
"WMIQuery failed: ExecQuery of '' failed: unknown error: 1: Incorrect function. "
And if i use CheckWMIvalue instead of CheckWMI i receive the error :
Unknown argument: -a "Query
Do you know why the syntax of the service is like this:
Code: Select all
[icode]define service{
use generic-service
host_name windows 8
service_description SMART
check_command check_nrpe!CheckWMI!-a "Query=Select DeviceID,Status from win32_DiskDrive"
contacts nagiosadmin
notification_interval 60
notification_period 24x7
}
Re: NSClient++ and monitor hdd SMART
Posted: Tue Sep 15, 2015 10:17 am
by tgriep
One thing you could try is to use single quotes in your command.
Change this from
Code: Select all
check_command check_nrpe!CheckWMI!-a "Query=Select DeviceID,Status from win32_DiskDrive"
to
Code: Select all
check_command check_nrpe!CheckWMI!-a 'Query=Select DeviceID,Status from win32_DiskDrive'
in your service chack to see if the resolves it for you.
Could you post how your check_nrpe command is defined in your commands.cfg file?
Make sure you don't have the -a argument defined twice in the command.
Re: NSClient++ and monitor hdd SMART
Posted: Tue Sep 15, 2015 10:22 am
by ThinkFast86
Like this:
Code: Select all
define command{
command_name check_nrpe
command_line /usr/lib/nagios/plugins/check_nrpe -H '$HOSTADDRESS$' -c '$ARG1$' -a '$ARG2$'
}
Re: NSClient++ and monitor hdd SMART
Posted: Tue Sep 15, 2015 10:35 am
by ThinkFast86
I receive again the same error message:
WMIQuery failed: ExecQuery of '' failed: unknown error: 1: Incorrect function