Skip to content

Instantly share code, notes, and snippets.

@eedgar
Last active August 29, 2015 14:27
Show Gist options
  • Save eedgar/bbc8b109d1dc25186508 to your computer and use it in GitHub Desktop.
Save eedgar/bbc8b109d1dc25186508 to your computer and use it in GitHub Desktop.
#!/bin/bash
config_file='/agentportal/instance/setup.txt'
if [ ! -e ${config_file} ];
then
echo "Running fresh install"
NOTSET=0
portalpath={{getContext . "portalpath_host"}}
portalpass={{getContext . "portalpass"}}
zenosshost={{getContext . "zenoss_host"}}
zenoss_user={{getContext . "zenoss_user"}}
zenoss_password={{getContext . "zenoss_password"}}
if [ -z "$portalpath" ]
then
echo "portalpath_host is not set."
NOTSET=1
fi
if [ -z "$zenosshost" ]
then
echo "zenoss_host is not set exiting....."
NOTSET=1
fi
if [ -z "$portalpass" ]
then
portalpass='admin'
fi
if [ -z "$zenoss_user" ]
then
zenoss_user='admin'
fi
if [ -z "$zenoss_password" ]
then
zenoss_password='admin'
fi
if [[ $NOTSET -eq 1 ]]
then
echo "Script exiting due to missing setup values"
sleep 60
# Sleep long enough for a user to see the logs before restarting the container
exit 1
fi
echo "export portalpass='${portalpass}'" > /agentportal/configs/agentportal_env
echo "export beaconpath='${portalpath}'" >> /agentportal/configs/agentportal_env
echo "modify.text.1=realusermonitor.send.fe.events.to=https://\$AGENT_PORTAL_HOST\$:10100/operations?event_==_realusermonitor.send.fe.events.t
o=https://${zenosshost}:10100/operations?event" > ${config_file}
echo "modify.text.2=realusermonitor.metrics.genericvendor.config.url=\$AGENT_PORTAL\$/operations?echojson_==_realusermonitor.metrics.genericve
ndor.config.url=http://${zenosshost}:10000/operations?echojson" >> ${config_file}
echo "modify.text.3=realusermonitor.notification.genericvendor.generic.config.url=\$AGENT_PORTAL\$/operations?event_==_realusermonitor.notific
ation.genericvendor.generic.config.url=http://${zenosshost}:10000/operations?event" >> ${config_file}
echo "modify.text.4=common.agent.portal=https://localhost:10000_==_common.agent.portal=http://${zenosshost}:10000" >> ${config_file}
echo "modify.text.5=realusermonitor.notification.genericvendor.generic.config.user=admin_==_realusermonitor.notification.genericvendor.generic.config.user=${zenoss_user}" >> ${config_file}
echo "modify.text.6=realusermonitor.metrics.genericvendor.generic.config.user=admin_==_realusermonitor.metrics.genericvendor.generic.config.user=${zenoss_user}" >> ${config_file}
echo "modify.text.7=realusermonitor.notification.genericvendor.config.password=m+I6oKw8xas=_==_realusermonitor.notification.genericvendor.config.password=${zenoss_password}" >> ${config_file}
echo "modify.text.8=realusermonitor.metrics.genericvendor.config.password=m+I6oKw8xas=_==_realusermonitor.metrics.genericvendor.config.password=${zenoss_password}" >> ${config_file}
fi
java -jar /tmp/RUMPortal.linux.x64.deploy -console -location /agentportal -portal http://localhost:10000 -portalpath https://${portalpath}:10000 -portalpass ${portalpass} -owner agentportal -group agentportal -dbport 0 -acceptlicense -installservice no -keepportalinstance 1 -portalinstancelocation /agentportal/instance -setupfile ${config_file}
su - agentportal -c "cd /agentportal/RUMPortal.linux.x64.deploy && ./startPortal.sh -stdout"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment