nagios 安装
#!/bin/sh ################################################ #this scripts is created by oldboy #site:http://www.etiantian.org #blog:http://oldboy.blog.51cto.com ################################################ NAGIOS_TOOLS_DIR=/home/oldboy/tools NAGIOS_INSTALL_DIR=/usr/local/nagios echo "------ step 1: config yum ------" cd /etc/yum.repos.d/ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo echo "------ step 2: config profile------" echo 'export LC_ALL=C'>> /etc/profile source /etc/profile echo "------ step 3: stop iptables and selinux------" /etc/init.d/iptables stop /etc/init.d/iptables stop chkconfig iptables off setenforce 0 if [ -f /etc/selinux/config ]; then sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config setenforce 0 fi echo "------ step 4: config time sync------" /usr/sbin/ntpdate pool.ntp.org echo '#time sync by oldboy at 2010-2-1'>>/var/spool/cron/root echo '*/10 * * * * /usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1'>>/var/spool/cron/root crontab -l echo "------ step 5: install gcc and lamp env etc------" yum install gcc glibc glibc-common -y yum install gd gd-devel -y yum install httpd php php-gd -y yum install mysql* -y echo "------ step 6: add nagios user and group------" /usr/sbin/useradd -m nagios #/usr/sbin/useradd apache /usr/sbin/groupadd nagcmd /usr/sbin/usermod -a -G nagcmd nagios /usr/sbin/usermod -a -G nagcmd apache echo "------ step 7: download and install nagios------" [ ! -f oldboy_training_nagios_soft.zip ] && exit 1 unzip oldboy_training_nagios_soft.zip tar xzf nagios-3.5.1.tar.gz cd nagios ./configure --with-command-group=nagcmd make all make install make install-init make install-config make install-commandmode make install-webconf cd ../ echo "------ step 8: config web auth------" htpasswd -cb /usr/local/nagios/etc/htpasswd.users oldboy 123456 echo "------ step 9: install nagios-plugins------" yum -y install perl-devel tar zxf nagios-plugins-1.4.16.tar.gz cd nagios-plugins-1.4.16 ./configure --prefix=/usr/local/nagios --with-nagios-user=nagios --with-nagios-group=nagios --enable-perl-modules make && make install cd ../ ls /usr/local/nagios/libexec/|wc -l echo "------ step 10: install nrpe------" tar zxvf nrpe-2.12.tar.gz cd nrpe-2.12 ./configure make all make install-plugin make install-daemon make install-daemon-config cd .. echo "------ step 11: startup service and check------" /etc/init.d/nagios start /etc/init.d/httpd start echo ----------- lsof -i tcp:80 echo ---------- ps -ef|grep nagios echo "NAGIOS is successfully installed." echo ok
时来天地皆同力,运去英雄不自由
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!