NSClient++ and monitor hdd SMART

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
ThinkFast86
Posts: 26
Joined: Fri Jul 24, 2015 5:30 am

NSClient++ and monitor hdd SMART

Post 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.
jolson
Attack Rabbit
Posts: 2560
Joined: Thu Feb 12, 2015 12:40 pm

Re: NSClient++ and monitor hdd SMART

Post 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
Twits Blog
Show me a man who lives alone and has a perpetually clean kitchen, and 8 times out of 9 I'll show you a man with detestable spiritual qualities.
ThinkFast86
Posts: 26
Joined: Fri Jul 24, 2015 5:30 am

Re: NSClient++ and monitor hdd SMART

Post 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?
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: NSClient++ and monitor hdd SMART

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
ThinkFast86
Posts: 26
Joined: Fri Jul 24, 2015 5:30 am

Re: NSClient++ and monitor hdd SMART

Post 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?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: NSClient++ and monitor hdd SMART

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
ThinkFast86
Posts: 26
Joined: Fri Jul 24, 2015 5:30 am

Re: NSClient++ and monitor hdd SMART

Post 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
	    }
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: NSClient++ and monitor hdd SMART

Post 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.
Be sure to check out our Knowledgebase for helpful articles and solutions!
ThinkFast86
Posts: 26
Joined: Fri Jul 24, 2015 5:30 am

Re: NSClient++ and monitor hdd SMART

Post 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$'
}
ThinkFast86
Posts: 26
Joined: Fri Jul 24, 2015 5:30 am

Re: NSClient++ and monitor hdd SMART

Post by ThinkFast86 »

I receive again the same error message:
WMIQuery failed: ExecQuery of '' failed: unknown error: 1: Incorrect function
Locked