1753479 Members
4789 Online
108794 Solutions
New Discussion

Re: Script help

 
allanm77
Frequent Advisor

Script help

I have following piece of code which generates a config file.

I am in need of running nslookup or host or dig to get the IP address of the VIP. Basically once I get IP address from nslookup or host I want to use that in check_vip commad

check_vip -I IP-address -p $port -u URI -t 5 instead of "echo "command_line    \$USER1\$/check_vip -H $host -p $port -u URI  -t 5""

/usr/bin/curl http://VIP:9000/list | grep VIP |awk '{print $1,$3}'|/usr/bin/perl -lne 'm{"(.*?)".*?//(.*):(\d+)/} and print "$2 $3"'|sort -u -k3,3|while read host port
do
echo "define command{"
echo        "command_name    check_vip_env1_$port"
        echo "command_line    \$USER1\$/check_vip -H $host -p $port -u URI  -t 5"
       echo  "}"
done > $file1

 

 

Thanks,

Allan.

1 REPLY 1
Laurent_Menase
Occasional Advisor

Re: Script help

host=$(nslookup packagename | awk '/Address/{ print $2}')