Page 1 of 1

Windows mpio multipathing check

Posted: Fri Aug 28, 2020 9:07 am
by jdk
I am looking to put in place a check for multipathing in a windows environment. I found a link to https://exchange.nagios.org/directory/P ... th/details and the code string, however I am having trouble getting this executed in powershell in a windows environment. Any assistance would be great or alternative solutions.

##Written by Calvin Bui 11-30-2015
cmd = `powershell.exe (gwmi -Namespace root\\wmi -Class mpio_disk_info).driveinfo`

error=0
storage= Hash.new

cmd.each_line do |line|
if line =~ /Name\s+:\s+MPIO\s+(\S+)/
$volume=$1
elsif line =~ /NumberPaths\s+:\s+(\d+)/
npath= $1
#puts $volume
#puts npath
storage[:"#{$volume}"] = npath
end
end

#keys= storage.keys
#puts "#{keys}"

storage.each do |name,p|
path = Integer(p)
if path == 8
print "OK:#{name}=#{path},"
else
print "CRITICAL:#{name}=#{path},"
error+=1
end
# puts "#{name} #{p}"
end

print "Number of Volumes with path down: #{error}"

if error > 0
exit(2)
else
exit(0)
end

Re: Windows mpio multipathing check

Posted: Fri Aug 28, 2020 5:38 pm
by ssax
You would need to install ruby on the system in order to run ruby files, did you do that?

Open a powershell prompt as admin on the system and run this command:

Code: Select all

powershell.exe (gwmi -Namespace root\\wmi -Class mpio_disk_info).driveinfo
Send us the full output.

Re: Windows mpio multipathing check

Posted: Thu Sep 03, 2020 10:39 am
by jdk
Thanks - so I got this working after installing Ruby, however the Security Team do not want Ruby installed on the servers.

Any Ruby to Powershell converters or whizzes out there?

Re: Windows mpio multipathing check

Posted: Fri Sep 04, 2020 1:51 pm
by ssax
We do not have any official MPIO plugins at this time and I was unable to find any other plugins for this other than the one you found.

Nagios support does not have the time to convert the plugin for you nor do all of us in support know how to program. You'll either need to convert it yourself, write a different one, or pay someone else to do it.

We do offer paid custom development, if that is something you are interested in you can contact [email protected] to get more information/a quote.

Let us know if you have any questions.

Thank you!

Re: Windows mpio multipathing check

Posted: Tue Sep 08, 2020 8:28 am
by jdk
Thanks - I will contact sales.