Page 1 of 1
run script via VMA and monitor ESXI paths on nagios
Posted: Sat Jul 28, 2018 1:48 am
by baber
Dear all
Hi
i write a script that can detect number of path now want to know how can run this script via VMA because want monitor that via nagios core
script is in below
when i run this script on esxi that work correctly but how can run it via vma and monitor that on nagios ?
BR
Babak
Code: Select all
link=`esxcli storage nmp path list | grep fc.20000000 | wc -l`
if [ $link="28" ]
then
echo -e "Storage Links is OK"
exit 0
else
echo -e "Storage Links has problem"
exit 2
fi
Re: run script via VMA and monitor ESXI paths on nagios
Posted: Mon Jul 30, 2018 1:55 pm
by scottwilkerson
You would have to either install some sort of agent on that machine like NRPE that could execute the command, or setup shared ssh keys and execute the command with something like check_by_ssh
Page 1-5 of this doc can show how to setup ssh
https://assets.nagios.com/downloads/nag ... ng_SSH.pdf
Re: run script via VMA and monitor ESXI paths on nagios
Posted: Mon Jul 30, 2018 10:22 pm
by baber
thanks but i want run script on VMA for esxi servers as i know check_by_ssh not use for esxi servers that script have to connect to each esxi server and run on esxi servers and i'm sure this topic have to put on nagios demo on vm
and also i did trust between VMA server and nagios server thus can connect to VMA server via nagios server without authentication
BR
Re: run script via VMA and monitor ESXI paths on nagios
Posted: Tue Jul 31, 2018 8:11 am
by scottwilkerson
So you want this script to run on the VMA server or the ESXi Server?
Re: run script via VMA and monitor ESXI paths on nagios
Posted: Tue Jul 31, 2018 1:19 pm
by baber
i know this script had to run on esxi server via vma server
now i create a trust key between nagios and vma server and when use ssh command from nagios server
ssh vi-admin@vma
also i add my esxi server to vma server while type ssh root@esxi1 on vma server it connect without authentication
it connect to vma server without authentication now my problem is how run above script on vma server through nagios server ?
BR
Re: run script via VMA and monitor ESXI paths on nagios
Posted: Tue Jul 31, 2018 2:12 pm
by scottwilkerson
That's what I was mentioning, you could connect from the nagios server to the vma via ssh (check_by_ssh) and kick that script off.
Another option would be to install an agent on the vma such as NRPE
Re: run script via VMA and monitor ESXI paths on nagios
Posted: Tue Jul 31, 2018 11:01 pm
by baber
so thanks
my script now is ok i run it with follow command through nagios server
/usr/local/nagios/libexec/check_by_ssh -E 1 -t 90 -l vi-admin -H vmaSERVER -C /home/vi-admin/nagios/storage_chk0.sh
that command excellent but how do i have to define service in .cfg file
i use this command but not work
check_command check_by_ssh -E 1 -t 90 -l vi-admin -H 172.20.68.205 -C /home/vi-admin/nagios/storage_chk0.sh
BR
Re: run script via VMA and monitor ESXI paths on nagios
Posted: Wed Aug 01, 2018 10:11 am
by scottwilkerson
first you need to define a command for check_by_ssh if you don't have one
Code: Select all
define command {
command_name check_xi_by_ssh
command_line $USER1$/check_by_ssh -H $HOSTADDRESS$ $ARG1$ $ARG2$
}
Then you can add the line like this
Code: Select all
check_command check_by_ssh!-E 1 -t 90 -l vi-admin -C /home/vi-admin/nagios/storage_chk0.sh|