Check defrag probe not working on Nagios
Checking Defrag Probe not working on Nagios
We have a problem with WG-DC1 -Defragmentation.
Lets look on nagios machine
/usr/local/etc/nagios/objects $ vi service.cfg
/defrag
Command is : check_defrag ! “C1”
Lets go to command
$ vi command.cfg
Defrag command
$USER1$|Check_nrpe3 -H $HOSTADDRESS$ -n -t 7200 -c check-defrag -a $ARG1$
(its not always easy to get the metrics from a windows machine and lets execute the command on nagios machine
$ /usr/local/libexec/nagios/check-nrpe3 -H dc1.wise.apoyar -n -t 7200 -c check_defrag -a c:
It is easy with NRPE.
Go to DC1 Server.
Start
Services
Stop the NSClient++ Monitoring agent
Now we try running it manually
Start
CMD(Admin)
We find the NSClient++ in the local disk this is the windows server which takes all the commands and requests from nrpe, browses them and keeps all the information about.
Local Disk --- Program Files – NSClient++--NSCP.
In Command Prompt
C:”\program Files”\NSClient++”
Nscp
Go to command prompt admin
C:\program files\NSClient++ > cd Scripts
C: \program files\NSClient++\scripts > check_defrag( this command is missing )
We need to get the contents from other any other server
Go to folders
Search : \\dc\\
Network>dc>c$>programfiles>NSClient++>Scripts
(this script folder contains pre installed scripts and custom scripts , Copy them)
Go back to previous folder
Local disk>program files> NSClieent++>scripts folder
Paste it
(skip files which are same now we can see check defrag script in the folder)
Now we try running the command
C:\ program files\NSClient++\scripts > check_defrag.exe C:
a dialogue box displays with some message(the following feature couldn’t be installed .NET Framework 3.5(includes >NET 2.0 and 3.0)
We need to install .NET Framework
Start> server manager(need to wait until it finish the loading)>manage>add roles and features>server selection(next)>server roles>features (.NET Framework3.5)>confirmation.
Note : if you try to install .NET Framework 3.5 it would throw an error for windows) Specify an alternate source path
Go to folder
This PC > DVD Drivers> sources>sxs
Copy the path and paste as alternate path
Click Install
Close after completes the installation
Now if we try to run the command
C:\ program files\NSClient++\scripts > check_defrag.exe C:
It will run without any error –
We need to restart the services of NSClient++ after defrag completes without fail.
Let go back to Nagios machine and run the command.
$ /usr/local/libexec/nagios/check-nrpe3 -H dc1.wise.apoyar -n -t 7200 -c check_defrag -a c:
(Now we can see the services run for defragmentation)
Now we go to nagios
WG DC2 > Defragmentation > Reschedule the next check (Manually) > it will take some time and the issue get resolved.