place more default values in /etc/planetlab/*.xml
authorStephen Soltesz <soltesz@cs.princeton.edu>
Thu, 2 Jul 2009 01:20:16 +0000 (01:20 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Thu, 2 Jul 2009 01:20:16 +0000 (01:20 +0000)
Monitor.spec
monitor-server.init

index 056f587..8e237e7 100644 (file)
@@ -235,17 +235,36 @@ chmod 700 %{_datadir}/%{name}/.ssh
 if grep 'pam_loginuid.so' /etc/pam.d/crond ; then
     sed -i -e 's/^session    required   pam_loginuid.so/#session    required   pam_loginuid.so/g' /etc/pam.d/crond
 fi
-# NOTE: add the default xml stuff if it's not already in the default xml config.
-if ! grep '<category id="plc_monitor">' /etc/planetlab/default_config.xml ; then 
-    sed -i 's|<category id="plc_net">| <category id="plc_monitor">\n <name>Monitor Service Configuration</name>\n <description>Monitor</description>\n <variablelist>\n <variable id="enabled" type="boolean">\n <name>Enabled</name>\n <value>true</value>\n <description>Enable on this machine.</description>\n </variable>\n <variable id="email">\n <value></value>\n </variable>\n <variable id="dbpassword">\n <value></value>\n </variable>\n <variable id="host" type="hostname">\n <name>Hostname</name>\n <value>pl-virtual-06.cs.princeton.edu</value>\n <description>The fully qualified hostname.</description>\n </variable>\n <variable id="ip" type="ip">\n <name>IP Address</name>\n <value/>\n <description>The IP address of the monitor server.</description>\n </variable>\n </variablelist>\n </category>\n <category id="plc_net">|' /etc/planetlab/default_config.xml
-fi
-if ! grep '<category id="plc_zabbix">' /etc/planetlab/default_config.xml ; then 
-    sed -i 's|<category id="plc_net">| <category id="plc_zabbix">\n <name>Zabbix Configuration</name>\n <description>Zabbix</description>\n <variablelist>\n <variable id="enabled" type="boolean">\n <name>Enabled</name>\n <value>false</value>\n <description>Enable on this machine.</description>\n </variable>\n <variable id="host" type="hostname">\n <name>Hostname</name>\n <value>localhost.localdomain</value>\n <description>The fully qualified hostname.</description>\n </variable>\n <variable id="ip" type="ip">\n <name>IP Address</name>\n <value/>\n <description>The IP address of the Zabbix server.</description>\n </variable>\n </variablelist>\n </category>\n <category id="plc_net">|' /etc/planetlab/default_config.xml
-fi
 
 # NOTE: enable monitor by default, since we're installing it.
 plc-config --save /etc/planetlab/configs/site.xml \
                        --category plc_monitor --variable enabled --value true
+plc-config --save /etc/planetlab/configs/site.xml \
+                       --category plc_monitor --variable from_email --value monitor@localhost.localdomain
+plc-config --save /etc/planetlab/configs/site.xml \
+                       --category plc_monitor --variable cc_email --value monitor@localhost.localdomain
+plc-config --save /etc/planetlab/configs/site.xml \
+                       --category plc_monitor --variable rt_queue --value support
+
+# NOTE: setup default values until myplc includes them by default.
+plc-config --save /etc/planetlab/configs/site.xml \
+                       --category plc_rt --variable enabled --value false
+plc-config --save /etc/planetlab/configs/site.xml \
+                       --category plc_rt --variable host --value localhost.localdomain
+plc-config --save /etc/planetlab/configs/site.xml \
+                       --category plc_rt --variable ip --value ""
+plc-config --save /etc/planetlab/configs/site.xml \
+                       --category plc_rt --variable web_user --value root
+plc-config --save /etc/planetlab/configs/site.xml \
+                       --category plc_rt --variable web_password --value password
+
+# zabbix:
+plc-config --save /etc/planetlab/configs/site.xml \
+                       --category plc_zabbix --variable enabled --value false
+plc-config --save /etc/planetlab/configs/site.xml \
+                       --category plc_zabbix --variable host --value localhost.localdomain
+plc-config --save /etc/planetlab/configs/site.xml \
+                       --category plc_zabbix --variable ip --value ""
 
 %post server
 # TODO: this will be nice when we have a web-based service running., such as
index ee7c469..6a43fda 100644 (file)
@@ -61,21 +61,16 @@ EOF
        if [ ! -f ${MONITOR_CONFIG} ] ; then
                cat <<EOF > ${MONITOR_CONFIG}
 [monitorconfig]
-RT_DB_HOST=rt.planet-lab.org
-RT_DB_USER=
-RT_DB_PASSWORD=
-RT_DB_NAME=
-
 # RT Web user account
-RT_WEB_SERVER=https://rt.planet-lab.org/
-RT_WEB_TOOLS_PATH=
-RT_WEB_USER=
-RT_WEB_PASSWORD=
+RT_WEB_SERVER=http://${PLC_RT_HOST}/
+RT_WEB_TOOLS_PATH=/usr/bin/
+RT_WEB_USER=${PLC_RT_WEB_USER}
+RT_WEB_PASSWORD=${PLC_RT_WEB_PASSWORD}
 RT_WEB_DEBUG=0
-RT_QUEUE=
+RT_QUEUE=${PLC_MONITOR_RT_QUEUE}
 
 # PLC admin account
-API_SERVER=https://${PLC_BOOT_HOST}/PLCAPI/
+API_SERVER=https://${PLC_API_HOST}:${PLC_API_PORT}/PLCAPI/
 API_AUTH_USER=${PLC_MONITOR_EMAIL}
 API_AUTH_PASSWORD=${PLC_MONITOR_DBPASSWORD}
 
@@ -92,16 +87,19 @@ PLC_WWW_HOSTNAME=${PLC_WWW_HOST}
 PLC_NAME=${PLC_NAME}
 
 # used for debug mode
-email=
-
+email=${PLC_MONITOR_CC_EMAIL}
 # all messages will appear to be from this address
 from_email=${PLC_MONITOR_EMAIL}
-
 # a separate address for support messages
 support_email=${PLC_MAIL_SUPPORT_ADDRESS}
-
 # mailing list copied on all out-going messages
-cc_email=
+cc_email=${PLC_MONITOR_CC_EMAIL}
+
+# these are reserved values
+RT_DB_HOST=${PLC_RT_HOST}
+RT_DB_USER=
+RT_DB_PASSWORD=
+RT_DB_NAME=
 
 [monitordatabase]
 monitor_dburi=postgres://${MONITOR_DB_USER}:${PLC_MONITOR_DBPASSWORD}@localhost:5432/${MONITOR_DB_NAME}