Skip to content

Log Insight 2.x: Automated Upgrade

If you are running multiple Log Insight instances or manage a Log Insight cluster you may be looking for a way to automate upgrades. Read on to learn a couple ways to achieve this today.
green-up-arrow

WARNING

Below I list a couple ways to automate upgrades. Please note neither approach is supported by VMware and one is really unsupported. In addition, the scripts are examples of how to go about performing the upgrades, but proper checks should be put in place to ensure the automation works properly. You know the drill, proceed at your risk!

“Supported”

The only supported way to upgrade Log Insight today is through the UI. Through a series of cURL commands this can be achieved today. While the script below is not technically supported, since it mimics the supported directions it should work without issue. Note that the script below works on a node-by-node basis and does not support entering maintenance mode (which technically means it is unsupported for clusters). CREDIT: My colleague Chris Todd outlined the script below.

# variables
LI_FQDN=loginsight.example.com
LI_ADMIN_USERNAME=admin
LI_ADMIN_PASSWD=password
LI_PAK=VMware-vRealize-Log-Insight-2.4.0-2271145.pak
# get a session id
curl --insecure -c cookies https://$LI_FQDN/
# authenticate
curl --insecure -b cookies --data 'username=$LI_ADMIN_USERNAME&password=$LI_ADMIN_PASSWD&login=Login' https://$LIFQDN/login
# upload upgrade file
curl -v --insecure -b cookies -include \
   -F '_eventName=upgrade' \
   -F '[email protected]$LI_PAK;type=application/octet-stream' \
   -H 'Expect:' \
   https://$LI_FQDN/upgrade
# accept eula and start upgrade
curl --insecure -b cookies --data 'pakFileName=$LI_PAK&_eventName=startPakUpgrade' https://$LI_FQDN/upgrade

Unsupported

Another approach is to upgrade via the CLI. The advantage to this approach is that you can easily determine all the nodes that need to be upgraded and perform a cluster upgrade from one command (you could with cURL, but need to parse the cluster page). Note this script assumes you have SSH keys configured on your nodes, you could also use something like sshpass or expect to authenticate.

# variables
LI_FQDN=loginsight.example.com
LI_USERNAME=root
LI_PAK=VMware-vRealize-Log-Insight-2.4.0-2271145.pak
# get nodes
NODES=$(ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected]$1 "grep \"daemon host\" \$(ls /storage/core/loginsight/config/loginsight-config.xml* | sort -k1.55n | tail -n 1) | awk '{ split(\$0,a,\"\\\"\"); print a[2];}'")
# upgrade nodes
for NODE in $NODES; do
   ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no [email protected]$NODE "/opt/vmware/bin/loginsight-pak-upgrade $LI_PAK"
done

© 2014, Steve Flanders. All rights reserved.

Published inVMware

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *