Linux 7.2 + LAMP + Nagios-4.2.4 + 简单部署监控项
Nagios详细文档
监控端
一、安装依赖包并设置Apache服务。
yum -y install httpd php gcc gd perl unzip openssl-devel
vi /etc/httpd/conf/httpd.conf
User nagios
Group nagios
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
systemctl enable httpd
二、安装Nagios-Core包。
tar -xf nagios-4.2.4.tar.gz
useradd -s /sbin/nologin nagios
usermod -G nagios apache
cd nagios-4.2.4
./configure --with-command-group=nagios
make all
make install
make install-init
make install-commandmode
make install-config
make install-webconf
chkconfig --add nagios
chkconfig nagios on
三、安装Nagios扩展包。
tar -xf nagios-plugins-2.1.4.tar.gz
cd nagios-plugins-2.1.4
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make && make install
四、安装nrpe插件。
tar -xf nrpe-3.0.1.tar.gz
cd nrpe-3.0.1
./configure
make all
make install-plugin
五、设置Nagios登陆用户与密码,并启动服务。
cat /etc/httpd/conf.d/nagios.conf
AuthUserFile /usr/local/nagios/etc/htpasswd.users
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
六、配置监控端
vim /usr/local/nagios/etc/objects/client-1.cfg
define host{
use linux-server
host_name client-1
address 192.168.20.20
}
define service{
use local-service
host_name client-1
service_description PING
check_command check-host-alive
}
define service{
use local-service
host_name client-1
service_description HTTP
check_command check_http
}
define service{
use local-service
host_name client-1
service_description BOOT-Usage
check_command check_nrpe!check_sda1
}
define service{
use local-service
host_name client-1
service_description ROOT-Usage
check_command check_nrpe!check_sda3
}
define service{
use local-service
host_name client-1
service_description USERS
check_command check_nrpe!check_users
}
vim /usr/local/nagios/etc/objects/commands.cfg
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
vim /usr/local/nagios/etc/nagios.cfg
cfg_file=/usr/local/nagios/etc/objects/client-1.cfg
cfg_file=/usr/local/nagios/etc/objects/client-2.cfg
systemctl start httpd
systemctl start nagios
被监控端
一、安装依赖包。
yum -y install perl openssl-devel xinetd gcc
二、安装Nagios扩展包。
tar -xf nagios-plugins-2.1.4.tar.gz
useradd -s /sbin/nologin nagios
cd nagios-plugins-2.1.4
./configure
make && make install
三、安装nrpe插件
tar -xf nrpe-3.0.1.tar.gz
cd nrpe-3.0.1
./configure
make all
make install
make install-plugin
make install-daemon
make install-config
make install-inetd
make install-init
四、配置被监控端
vim /usr/local/nagios/etc/nrpe.cfg
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
//定义监控登录用户数量的警告及严重错误的阈值分别为5和10
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
//定义监控本机CPU负载的警告及严重错误阈值,负载按最近1分钟,5分钟,15分钟分别计算
command[check_sda1]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda1
//定义监控本机磁盘/dev/sda1的使用情况
command[check_sda3]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/sda3
//定义监控本机磁盘/dev/sda3的使用情况
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
//定义监控本机僵死进程的警告及严重错误阈值分别为5和10
command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
//定义监控进程数量的警告及严重错误阈值分别为150和200
#allowed_hosts=127.0.0.1
vim /etc/xinetd.d/nrpe
only_from = 127.0.0.1 192.168.20.10
systemctl start xinetd
systemctl enable xinetd
systemctl start nrpe
systemctl enable nrpe
在被监控端测试nrpe:
/usr/local/nagios/libexec/check_nrpe -H 127.0.0.1
在监控端测试nrpe:
/usr/local/nagios/libexec/check_nrpe -H 192.168.20.20
Linux 7.2 + LAMP + Nagios-4.2.4 + 简单部署监控项的更多相关文章
- Linux下配置Lamp
linux下配置lamp步骤: 一.快速安装Apache+PHP5+MySql 先更新: # yum update 然后安装LAMP环境:(163的yum源上只有php5.1.6 mysql 5.0. ...
- linux下搭建lamp环境以及安装swoole扩展
linux下搭建lamp环境以及安装swoole扩展 一.CentOS 6.5使用yum快速搭建LAMP环境 准备工作:先更新一下yum源 我安装的环境是:apache2.2.15+mysql5 ...
- 参照跟老男孩学linux运维搭建nagios实验小结
nagios效果示例 http://192.168.0.236/nagios 用户名:hong 密码:123 一. 服务端安装准备 1. 更新源 cd /etc/y ...
- linux上安装LAMP笔记
B哥最近在参加比赛,需要把一个php项目部署到服务器上,故此在linux上安装LAMP环境,用于部署项目,第一次安装,做点儿笔记记录一下. 安装条件: Redhat或者CentOS linux环境已装 ...
- Zabbix,Nagios,OneAPM Servers 安装部署大比拼
怎样高速实现对 Linux server的监控? 做过server监控的开发人员差点儿都知道 Zabbix 和 Nagios ,他们都是提供系统监控以及网络监控功能的开源解决方式.资历比較老.在不久前 ...
- Linux平台oracle 11g单实例 + ASM存储 安装部署 快速参考
操作环境:Citrix虚拟化环境中申请一个Linux6.4主机(模板)目标:创建单机11g + ASM存储 数据库 1. 主机准备 2. 创建ORACLE 用户和组成员 3. 创建以下目录并赋予对应权 ...
- Linux内核设计第三周——构造一个简单的Linux系统
Linux内核设计第三周 ——构造一个简单的Linux系统 一.知识点总结 计算机三个法宝: 存储程序计算机 函数调用堆栈 中断 操作系统两把宝剑: 中断上下文的切换 进程上下文的切换 linux内核 ...
- Linux内核分析(二)----内核模块简介|简单内核模块实现
原文:Linux内核分析(二)----内核模块简介|简单内核模块实现 Linux内核分析(二) 昨天我们开始了内核的分析,网上有很多人是用用源码直接分析,这样造成的问题是,大家觉得很枯燥很难理解,从某 ...
- 10分钟学会在windows/Linux下设置ASP.Net Core开发环境并部署应用
创建和开发ASP.NET Core应用可以有二种方式:最简单的方式是通过Visual Studio 2017 来创建,其优点是简单方便,但需要安装最新版本Visual Studio 2017 prev ...
随机推荐
- FB面经 Prepare: All Palindromic Substrings
Given a string, calculate how many substring is palindrome. Ignore non-char characters. Ignore case; ...
- Linux文件编辑之sed命令
文件编辑之sed命令 sed是一种流编辑器,它是文本处理中非常重要的工具,能够完美配合正则表达式使用,功能不同凡响.处理时,把当前处理的行存储在临时缓冲区中,称为模式空间 (pattern space ...
- UVa 10718 - Bit Mask
题目大意:给一数N,在区间[L, U]上找到一个数M使得M| N的值最大,如果有M有多个可能值,取最小的那个值. 从最高位开始逐位判断,如果N的该位为0,为使M | N的值最大,M的该位应考虑置为1, ...
- HTML5学习笔记四:html5结构
一.大纲:大纲即文档中各内容区块的结构编排 1. 显示编排内容区块:使用section等元素创建文档结构,每个内容区块使用标题(h1~h6,hgroup); 2. 隐式编排内容区块:根据页面所书写的各 ...
- 最多两次股票交易-Best Time to Buy and Sell Stock III
Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...
- Unity3D 相关技术
slua相关shader编程相关animation相关attack check攻击检测相关
- 在ASP.NET MVC中使用JQ插件datatable
1. Models public class Citys { public int Id { get; set; } public string CityName { get; set; } publ ...
- Weblogic常见故障常:JDBC Connection Pools
http://blog.csdn.net/woshixuye/article/details/24122579 有些时候是数据库连接池出现了问题,测试的时候显示没有连接池了,重启WebLogic都不行 ...
- MYBATIS 无效的列类型: 1111
查询的时候竟然也会报错,如果参数是数字,需要加上jdbcType 在xml中加上 t.chart_id = #{chartId,jdbcType=DECIMAL}
- 排查问题所用到的一些Linux命令实践(不定期更新。。)
一.前言 线上问题排查可能是每个程序员都会经历的.在排查的过程中,往往会用到很多Linux命令,也会产生一些很实用的技巧.本博文通过分析一次线上问题排查的过程,把所有用到的命令串起来.每个Linux命 ...