使用及相關如下:
使用指令碼如下配套之前的函數:
addservices () { echo "you can add services for web-server or mysql-server " echo "1,web-server" echo "2,mysql-server" echo "3,exit" read abc case $abc in 1) webservices ;; 2) echo "you can change the mysql type" echo "1,master server" echo "2,slave server" read abcd if [ $abcd == 1 ] then #installclientmysql addmysqlservicemaster else #installclientmysql addmysqlserviceslave fi echo " " ;; 3) exit ;; esac } actionserver () { echo "this is at nagios server:you can change install environment or add services" echo "1,Install environment for nagios;" echo "2,add the client services!!!!!!!!!" read aaa case $aaa in 1) installserver addnagios ;; 2) addservices ;; *) echo "this is error,please change again." actionserver ;; esac } actionclient () { echo "this is at nagios client:you can install the different environment" echo "1,install the environment for web-server!!" echo "2,install the environment for mysql-server" read bbb case $bbb in 1) installweb ;; 2) installmysql ;; 3) echo "this is error,please change again" actionclient ;; esac } echo "######################################" echo "######**this is nagios scripts**######" echo "you can change this action:" echo "1,if you at the nagios server,please check it out!!" echo "2,if you at the nagios client,please check it out!!" read asd case $asd in 1) actionserver ;; 2) actionclient ;; *) exit ;; esac