Nagios: Check iSCSI Initiator
In the last few weeks I reworked our internal Nagios configuration and added a few checks to some of our internal servers. Since we do not have a dedicated SAN for our environment, we are using iSCSI as a low-cost storage solution. However, the Microsoft iSCSI Initiator implementation sometimes has trouble connecting to the iSCSI target. As a result, we had to monitor the iSCSI Initiator.
So here is our implementation of check_iscsi for the Microsoft iSCSI Initiator. It uses the iscsicli utility provided together with the iSCSI Initiator and runs on the remote server. To use it, place the following batch file in the scripts/
folder of your NSClient++ installation.
@echo off
iscsicli SessionList > iscsicli.log
find "Total of 1 sessions" iscsicli.log > iscsi_dump.log
if errorlevel 1 goto :not-found
iscsicli SessionList | find " Target Name" > iscsicli_target.log
SET /p TARGET= iscsi_dump.log
if errorlevel 1 goto :unknown
echo No Targets are connected!
exit 2
:unknown
echo Cannot parse "iscsicli SessionList" output...
exit 3
Then, add the following NRPE check to your Nagios configuration and you are ready to go! Make sure you enabled external scripts in your NSClient++ configuration (documentation).
define service {
use generic-service
service_description iSCSI Initiator
check_command check_nrpe!check_iscsi!null
}