安装和设置Nagios Core的步骤如下:
1、系统要求
操作系统:Linux(推荐使用CentOS、Ubuntu等)
数据库:MySQL或PostgreSQL
Web服务器:Apache或Nginx
2、安装依赖库和软件包
更新系统软件包列表
“`
sudo yum update y
“`
安装必要的依赖库和软件包
“`
sudo yum install y gcc gccc++ make ncursesdevel openssldevel perl wget netsnmpdevel libcurldevel postgresqldevel mysqldevel
“`
3、下载Nagios Core源码
“`
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios4.4.6.tar.gz
“`
4、解压源码包并进入目录
“`
tar zxvf nagios4.4.6.tar.gz
cd nagios4.4.6
“`
5、编译和安装Nagios Core
“`
./configure withcommandgroup=admin withcommandname=status withconfig=/etc/nagios withlogfile=/var/log/nagios3/nagios.log withstatedir=/var/lib/nagios3 withlockfile=/var/run/nagios3/nagios.pid withplugins=1 withopenssl=1 witheventhandlers=1 withperlmodules=1 withmysql=1 withpgsql=1 withnetsnmp=1 withmailer=sendmail withmta=postfix
make all
sudo make install
“`
6、创建Nagios用户和组
“`
sudo groupadd nagcmd
sudo useradd g nagcmd d /usr/local/nagios3 s /bin/bash nagios3
sudo passwd nagios3
“`
7、配置Nagios Core
创建配置文件目录并复制默认配置文件
“`
sudo mkdir /etc/nagios3
sudo cp p conf/* /etc/nagios3/
“`
编辑配置文件/etc/nagios3/nagios.cfg
,设置以下参数:
“`
…
define host{…} # 定义主机和服务监控规则
define service{…} # 定义服务监控规则
define command{…} # 定义命令执行脚本
…
“`
初始化数据库表结构
“`
sudo nagios3 v /etc/nagios3/nagios.cfg d /usr/local/nagios3/var/db/nagios3 c /usr/local/nagios3/etc/objects/commands.cfg c /usr/local/nagios3/etc/objects/contacts.cfg c /usr/local/nagios3/etc/objects/hosts.cfg c /usr/local/nagios3/etc/objects/services.cfg c /usr/local/nagios3/etc/objects/timeperiods.cfg c /usr/local/nagios3/etc/objects/templates.cfg c /usr/local/nagios3/etc/objects/events.cfg c /usr/local/nagios3/etc/objects/eventhandlers.cfg c /usr/local/nagios3/etc/objects/logfiles.cfg c /usr/local/nagios3/etc/objects/hostdependencies.cfg c /usr/local/nagios3/etc/objects/servicedependencies.cfg c /usr/local/nagios3/etc/objects/hostextinfo.cfg c /usr/local//nagios3//etc//objects//serviceextinfo.cfg c /usr//local//nagios3//etc//objects//hostgroupmemberships.cfg c /usr//local//nagios3//etc//objects//servicegroupmemberships.cfg c /usr//local//nagios3//etc//objects//hostgroups.cfg c /usr//local//nagios3//etc//objects//servicegroups.cfg c /usr//local//nagios3//etc//objects//hostaliases.cfg c /usr//local//nagios3//etc//objects//servicealiases.cfg c /usr//local//nagios3//etc//objects//generichoststatusobjectdefinitions.cfg c /usr//local//nagios3//etc//objects//genericservicestatusobjectdefinitions.cfg c /usr//local//nagios3//etc//objects//genericservicedependencyobjectdefinitions.cfg c /usr//local//nagios3//etc//objects//generichostdependencyobjectdefinitions.cfg c /usr//local//nagios3//etc//objects//genericcontactgroupmembershipobjectdefinitions.cfg c /usr//local//nagios3//etc//objects//genericcontactgroupobjectdefinitions.cfg c /usr//local//nagios3 //etc //objects //genericcontactobjectdefinitions.cfg c /usr //local //nagio
原创文章,作者:未希,如若转载,请注明出处:https://www.kdun.com/ask/581396.html
本网站发布或转载的文章及图片均来自网络,其原创性以及文中表达的观点和判断不代表本网站。如有问题,请联系客服处理。
发表回复