VMware Cloud Community
exploreeverythi
Contributor
Contributor

How to make changes to rhttpproxy config file on multiple servers?

I need to change the log level from 'verbose' to 'warning' in  "/etc/vmware/rhttpproxy/config.xml" on 100s of ESXi hosts and restart rhttpproxy . Is there any way to automate this? LucD

Reply
0 Kudos
7 Replies
LucD
Leadership
Leadership

Can you SSH into your ESXi nodes?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
exploreeverythi
Contributor
Contributor

Yes, I can SSH into the ESXi hosts, but looking for an easier way than SSH into each of the servers.

Reply
0 Kudos
LucD
Leadership
Leadership

Besides doing this through an SSH session, I'm not aware of doing in any other automated way I'm afraid.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
TechMassey
Hot Shot
Hot Shot

Now this is a very interesting task. This should be doable based on the supported features of vSphere PowerCLI, Powershell, and WinSCP. However, I basically verified the feasibility and have not tested any executed scripts. Here is a breakdown of how the script would work and relevant links.

This is very high level framework of the script. Basically the Powershell script would use a list of hostnames and initiate SSH sessions via WinSCP commandlet. It would then copy a new xml file or you could instruct Powershell to edit the existing xml file. The script would then restart the rhttpproxy service via PowerCLI and repeat for each host. This would be a really cool script to create given all the connected components.

Also, last item is test, test, test. Then test, test, test again.

Links


Please help out! If you find this post helpful and/or the correct answer. Mark it! It helps recgonize contributions to the VMTN community and well me too :slightly_smiling_face:
Reply
0 Kudos
LucD
Leadership
Leadership

Afaik, the Restart-VMHostService doesn't cover the reverse proxy service.

The only way I know of is to SSH into the ESXi node, and then do a '/etc/init.d/rhttpproxy restart'

Also, I don't quite get why you would use WinSCP in this scenario.

When you are using SSH in any case, which the requestor doesn't want to use, you could just as well SSH into the ESXi node, update the /etc/vmware-rhttpproxy/config.xml and restart the reverse proxy service.

Why bother with WinSCP at all?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

TechMassey
Hot Shot
Hot Shot

Hey LucD,

I took from him that he didn't want to manually login to the 100s of ESXi hosts he needs to update. Based on that, I knew Powershell had SSH capability and WinSCP is the most mature option I identified.

Thanks for tip on the limitations of Restart-VMHostService, I'll keep that in mind. The script could be modified to execute '/etc/init.d/rhttpproxy restart' once it establishes the SSH session and modifies/replaces the XML file.


Please help out! If you find this post helpful and/or the correct answer. Mark it! It helps recgonize contributions to the VMTN community and well me too :slightly_smiling_face:
Reply
0 Kudos
AB_sysadmins
Contributor
Contributor

Hi,

just found this old thread, so maybe could be useful to someone:

We made it using a simple bash script.

All you need is:

1. server linux from (any centos with bash)

2. text file with all esxi hostnames, one under another

3. direct ssh connectivity from this llinux server to the esxi hosts

First you can try with one server (the first one from list):

for esxi in $(head -1 file_with_esxi_hostnames); do echo -n "$esxi:" ; ssh -tq -o "StrictHostKeyChecking no" $esxi "sed -i 's/verbose/error/g' /etc/vmware/rhttpproxy/config.xml ; /etc/init.d/rhttpproxy restart" ; echo ""; done

and check the result.

Then you can go with:

for esxi in $(cat file_with_esxi_hostnames); do echo -n "$esxi:" ; ssh -tq -o "StrictHostKeyChecking no" $esxi "sed -i 's/verbose/error/g' /etc/vmware/rhttpproxy/config.xml ; /etc/init.d/rhttpproxy restart" ; echo ""; done

That's it,