-function check_zab_server ()
-{
- ZABBIXCFG=/etc/zabbix
- TMP_FILE=`mktemp /tmp/zbxtmpXXXXXX`
-
- if [ -f ${ZABBIXCFG}/zabbix_server.conf ] ; then
- sed -e "s/#DBHost=.*/DBHost=$PLC_MONITOR_HOST/g" \
- -e "s#DBName=.*#DBName=$ZABBIX_DB_NAME#g" \
- -e "s#DBUser=.*#DBUser=$ZABBIX_DB_USER#g" \
- -e "s#DBPassword=.*#DBPassword=$PLC_MONITOR_DBPASSWORD#g" \
- -e "s#.*ExternalScripts=.*#ExternalScripts=${MONITORPATH}/zabbix#g" \
- ${ZABBIXCFG}/zabbix_server.conf > $TMP_FILE
- cat $TMP_FILE > ${ZABBIXCFG}/zabbix_server.conf
- fi
- service zabbix_server start
- rm -f $TMP_FILE
-
-}
-function check_zab_agentd ()
-{
- ZABBIXCFG=/etc/zabbix
- TMP_FILE=`mktemp /tmp/zbxtmpXXXXXX`
- if [ -f ${ZABBIXCFG}/zabbix_agentd.conf ] ; then
- HOST=`hostname`
- sed -e "s#Server=.*#Server=$PLC_MONITOR_HOST#g" \
- -e "s#Hostname=.*#Hostname=$HOST#g" \
- ${ZABBIXCFG}/zabbix_agentd.conf > $TMP_FILE
- cat $TMP_FILE > ${ZABBIXCFG}/zabbix_agentd.conf
- fi
- service zabbix_agentd start
- rm -f $TMP_FILE
-}
-function check_zab_webconfig()
-{
- # SETUP zabbix gui configuration
- ZABBIX_WEB_CFG=/var/www/html/zabbix/conf/zabbix.conf.php
- if [ ! -f $ZABBIX_WEB_CFG ] ; then
- touch $ZABBIX_WEB_CFG
- cat <<EOF > $ZABBIX_WEB_CFG
-<?php
-global \$DB;
-
-\$DB["TYPE"] = "POSTGRESQL";
-\$DB["SERVER"] = "localhost";
-\$DB["PORT"] = "0";
-\$DB["DATABASE"] = "$ZABBIX_DB_NAME";
-\$DB["USER"] = "$ZABBIX_DB_USER";
-\$DB["PASSWORD"] = "$PLC_MONITOR_DBPASSWORD";
-\$ZBX_SERVER = "$PLC_MONITOR_HOST";
-\$ZBX_SERVER_PORT = "10051";
-\$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
-?>
-EOF
- chmod 644 $ZABBIX_WEB_CFG
- fi
-}
-