我正在尝试设置一个bash脚本来安装nagios3及其所有依赖项。我了解到:
apt-get install -y nagios3处理好这一切。
现在我担心的是绕过nagios3-cgi的设置屏幕到目前为止:
#!/bin/bash
PASS="0"
REPASS="1"
while [ $PASS != $REPASS ]; do
read -s -p "Password: " PASS; echo
read -s -p "Retype: " REPASS; echo
done
debconf-set-selections <<< "postfix postfix/mailname string your.hostname.com"
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
apt-get install -y postfix
apt-get install -y nagios3我能够绕过后缀conf屏幕:
debconf-set-selections <<< "postfix postfix/mailname string your.hostname.com"
debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"我怎么能用nagios3-cgi做同样的事情呢?
我试过了,但没有用:
mkdir /etc/nagios3
htpasswd -cb /etc/nagios3/htpasswd.users nagiosadmin $PASS发布于 2014-08-01 21:42:02
我自己解决了问题。
首先,我在vm上正常安装了nagios3,然后我使用
debconf-get-selections > file.txt
debconf-get-selections >> file.txt这会将所有安装细节写入file.txt。
然后在文件中搜索nagios3-cgi配置。
我发现我需要的配置文件的名称是
nagios3-cgi nagios3-cgi/adminpassword和
nagios3-cgi nagios3-cgi/adminpassword-retype然后,我对posfix安装做了同样的事情。这是我的最后剧本。真的很简单。
PASS="0"
REPASS="1"
#Password loop
while [ $PASS != $REPASS ]; do
read -s -p "Nagios Password: " PASS; echo
read -s -p "Retype Nagios Password: " REPASS; echo
done
sudo debconf-set-selections <<< "postfix postfix/mailname string diggalabs.com"
sudo debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
sudo debconf-set-selections <<< "nagios3-cgi nagios3/adminpassword string $PASS"
sudo debconf-set-selections <<< "nagios3-cgi nagios3/adminpassword-repeat string $PASS"
sudo apt-get install -y nagios3https://stackoverflow.com/questions/24989606
复制相似问题