ubuntu16.04安装配置nagios
参考博文:https://www.howtoing.com/ubuntu-nagios/
该博文真实有效可供参考,按照步骤,基本可以成功
一.安装的先决条件
sudo apt-get install wget build-essential apache2 php apache2-mod-php7.0 php-gd libgd-dev sendmail unzip
二.用户和组配置
useradd nagios
groupadd nagcmd
usermod -a -G nagcmd nagios
usermod -a -G nagios,nagcmd www-data
三.安装nagios
1.下载提取Nagios核心
cd ~
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.2.0.tar.gz
tar -xzf nagios*.tar.gz
cd nagios-4.2.0
2.编译nagios
./configure --with-nagios-group=nagios --with-command-group=nagcmd
make all
sudo make install
sudo make install-commandmode
sudo make install-init
sudo make install-config
/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-available/nagios.conf
并将evenhandler目录复制到nagios目录中:
cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/
chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers
3.安装Nagios插件
下载提取nagios插件:
cd ~
wget https://nagios-plugins.org/download/nagios-plugins-2.1.2.tar.gz
tar -xzf nagios-plugins*.tar.gz
cd nagios-plugin-2.1.2/
以下命令安装nagios插件:
./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl
make
make install
4.配置nagios
安装阶段完成后,您可以在/ usr / local / nagios /中找到Nagios的默认配置。
我们将配置Nagios和Nagios联系人。
使用vim编辑默认的nagios配置:
vim /usr/local/nagios/etc/nagios.cfg
取消注释线路51为主机监视器配置。
cfg_dir=/usr/local/nagios/etc/servers
保存并退出。
添加名为servers的新文件夹:
mkdir -p /usr/local/nagios/etc/servers
可以在contact.cfg文件中配置Nagios联系人。 打开它使用:
vim /usr/local/nagios/etc/objects/contacts.cfg
然后用您自己的电子邮件替换默认电子邮件。
四、配置Apache
1. 启用Apache模块
sudo a2enmod rewrite
sudo a2enmod cgi
您可以使用htpasswd命令为nagios Web界面配置用户nagiosadmin:
sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
并输入密码
2. 启用Nagios虚拟主机
sudo ln -s /etc/apache2/sites-available/nagios.conf /etc/apache2/sites-enabled/
3.启动Apache和Nagios
service apache2 restart
service nagios start
当Nagios启动时,您可能会看到以下错误:
Starting nagios (via systemctl): nagios.serviceFailed cd /etc/init.d/
cp /etc/init.d/skeleton /etc/init.d/nagios vim /etc/init.d/nagios 并添加以下代码:
DESC="Nagios"
NAME=nagios
DAEMON=/usr/local/nagios/bin/$NAME
DAEMON_ARGS="-d /usr/local/nagios/etc/nagios.cfg"
PIDFILE=/usr/local/nagios/var/$NAME.lock 使其可执行并启动Nagios: chmod +x /etc/init.d/nagios
service apache2 restart
servuce nagios start 五、测试Nagios服务器
在我的情况下,请打开浏览器并访问Nagios服务器ip: http : //192.168.126.130/nagios 。
Nagios用apache htpasswd登录
用户名默认为nagiosadmin
密码就是你之前通过执行该 sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin 命令输入的密码 六、添加主机监控
在我的另外IP:192.168.126.128
连接我的另外主机 1. 连接到ubuntu主机
ssh root@192.168.126.128
2.安装NRPE服务
sudo apt-get install nagios-nrpe-server nagios-plugins
3.配置NRPE
vim /etc/nagios/nrpe.cfg
并将nagios server IP 192.168.126.130添加到server_aaddress server_address = 192.168.126.130
4.重新启动NRPE
service nagios-nrpe-server restart
5.将Ubuntu主机添加到Nagios服务器
请连接到Nagios服务器:
ssh root@192.168.126.130 然后为/ usr / local / nagios / etc / servers /中的主机配置创建一个新文件。
vim /usr/local/nagios/etc/servers/ubuntu_host.cfg
添加如下内容:
# Ubuntu Host configuration file define host {
use linux-server
host_name ubuntu_host
alias Ubuntu Host
address 192.168.1.10
register 1
} define service {
host_name ubuntu_host
service_description PING
check_command check_ping!100.0,20%!500.0,60%
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
} define service {
host_name ubuntu_host
service_description Check Users
check_command check_local_users!20!50
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
} define service {
host_name ubuntu_host
service_description Local Disk
check_command check_local_disk!20%!10%!/
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
} define service {
host_name ubuntu_host
service_description Check SSH
check_command check_ssh
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
} define service {
host_name ubuntu_host
service_description Total Process
check_command check_local_procs!250!400!RSZDT
max_check_attempts 2
check_interval 2
retry_interval 2
check_period 24x7
check_freshness 1
contact_groups admins
notification_interval 2
notification_period 24x7
notifications_enabled 1
register 1
}
您可以在/usr/local/nagios/etc/objects/commands.cfg文件中找到许多check_command 。 如果您想添加更多的服务,如DHCP,POP等,请参阅
现在检查配置:
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
6.重新启动所有服务
在Ubuntu主机上启动NRPE服务:
service nagios-nrpe-server restart
...在Nagios服务器上,启动Apache和Nagios:
service apache2 restart
service nagios restart
7.测试Ubuntu主机
从浏览器打开Nagios服务器,并查看受监控的ubuntu_host。
Ubuntu主机在受监控的主机上可用。
ubuntu16.04安装配置nagios的更多相关文章
- Ubuntu16.04安装配置和使用ctags
Ubuntu16.04安装配置和使用ctags by ChrisZZ ctags可以用于在vim中的函数定义跳转.在ubuntu16.04下默认提供的ctags是很老很旧的ctags,快要发霉的版本( ...
- Ubuntu16.04安装配置Caffe教程(GPU版)
推荐博客:https://www.linuxidc.com/Linux/2017-11/148629.htmhttps://blog.csdn.net/yggaoeecs/article/detail ...
- Ubuntu16.04 安装配置Caffe
Caffe已经是第三次安装配置了,为什么是第三次呢?因为我实在是低估了深度学习对于硬件的要求.第一次我在自己笔记本上配置的单核,CPU only ... 结果是,样例数据跑了4小时,这还怎么玩?第二 ...
- Ubuntu16.04安装配置sublime text3
1.安装Sublime Text 3 首先添加sublime text 3的仓库: sudo add-apt-repository ppa:webupd8team/sublime-text-3 根据提 ...
- ubuntu16.04 安装配置matlab+python +cuda8.0+cudnn+opencv3.1的caffe环境
网络上有很多ubuntu上caffe配置环境的帖子,本人照着其中的许多进行了参考,都出现了或多或少的错误,很多地方也有差异. 于是自己整理了下自己的安装过程,成功进行了测试,跑通了faster-rcn ...
- Ubuntu16.04安装配置Eclipse 以及opencv的使用
安装配置http://www.oracle.com下载与自己电脑系统对应的JDK.我下载的是jdk-8u101-linux64.tar.gz 解压:sudo tar -zxvf jdk-8u101-l ...
- ubuntu16.04安装配置mysql数据库,分割视频为帧图像
参考http://wiki.ubuntu.org.cn/MySQL%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97 版本为5.7 一.安装 安装命令sudo apt-get i ...
- Ubuntu16.04安装Redis并配置
Ubuntu16.04安装Redis并配置 2018年05月22日 10:40:35 Hello_刘 阅读数:29146 Ubuntu16.04安装Redis并配置 1):安装: 1:终端命令下载 ...
- Ubuntu16.04安装后开发环境配置和常用软件安装
Ubuntu16.04安装后1.安装常用软件搜狗输入法+编辑器Atom+浏览器Chome+视频播放器vlc+图像编辑器GIMP Image Editor安装+视频录制软件RcordMyDesktop安 ...
随机推荐
- Modbus通信协议 【 初识 Modbus】
Modbus协议 Modbus 协议是应用于电子控制器上的一种通用语言.通过此协议,控制器相互之间.控制器经由网络(例如以太网)和其它设备之间可以通信.它已经成为一通用工业标准.有了它,不同厂 ...
- jQuery的DOM操作之设置和获取HTML、文本和值 html()text()val()
1. html()方法: 此方法类似于JavaScript中的innerHTML属性,可以用来读取或者设置某个元素中的html内容. <html> <head> <met ...
- jQuery动画切换引擎插件Velocity.js
Velocity.js 官网 Velocity.js实现弹出式相框 慕课网 极棒的jquery动画切换引擎插件Velocity.js jQ库 (function($){ // 普通调用 /*$('#d ...
- 禁用 Gnome Shell 默认的 Ubuntu Dock 和 Ubuntu AppIndicators 扩展
以前折腾的时候禁用过,现在已经忘记目录了,结果今天手贱把系统从 18.04 升级到了 18.10 ,很多东西都要重新搞过,而且用惯了 mac 已经不熟悉 linux 上瞎折腾的那一套了,简直坑爹.. ...
- Python 获取被调用函数名称,所处模块,被调用代码行
获取被调用函数名称,所处模块,被调用代码行 by:授客 QQ:1033553122 module2.py: #!/usr/bin/env python # -*- coding:utf-8 -*- _ ...
- 【Tomcat】Unrecognized Windows Sockets error: 10106: Socket creation failed
tomcat8启动过程中报如下错误 -Nov- ::]: java.net.SocketException: Unrecognized Windows Sockets error: : create ...
- The stacking context
文档中的层叠上下文由满足以下任意一个条件的元素形成: 1. z-index 值不为 "auto"的 绝对/相对定位. 2. position位fixed. 3. opacity 属 ...
- JS列表
promise 引用类型/值类型 ----- 对比python可变对象/不可变对象 原型继承
- 【redis专题(4)】命令语法介绍之sorted_set
有序集合可以模拟优先级队列的实现 增 zadd key score1 value1 score2 value2 .. redis 127.0.0.1:6379> zadd stu 18 lily ...
- 选择is或者as操作符而不是做强制类型转换
无论何时,正确选择使用as运算符进行类型转换.比盲目的强制类型转换更安全,而且在运行时效率更高. 用as和is进行转换时,并不是对所有用户定义的类型都能完成,只是在运行时类型和目标类型匹配时,转换才能 ...