Nagios监控基础配置(一)

一、搭建Nagios监控服务器
1、部署运行环境LAMP
[root@localhost ~]# yum -y install httpd
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# systemctl enable httpd

[root@localhost ~]# yum -y install mariadb-server mariadb
[root@localhost ~]# systemctl restart mariadb
[root@localhost ~]# systemctl enable mariadb
[root@localhost ~]# mysqladmin -hlocalhost -u root password "123456"
[root@localhost ~]# yum -y install php-mysql php

2、安装准备:编译工具 创建用户和组
[root@monitor21 /]# rpm -q gcc gcc-c++
[root@monitor21 /]# useradd nagios
[root@monitor21 /]# groupadd nagcmd
[root@monitor21 /]# usermod -G nagcmd nagios

3、安装源码包
1) 解包
[root@monitor21 /]# tar -zxf nagios-4.2.4.tar.gz
[root@monitor21 /]# cd nagios-4.2.4/
[root@monitor21 nagios-4.2.4]# ./configure --help | more >分页查看帮助信息
[root@monitor21 nagios-4.2.4]# ./configure

--with-nagios-user=nagios \ 所有者
--with-nagios-group=nagcmd \ 从属组
--with-command-user=nagios \ 软件执行者
--with-command-group=nagcmd 软件执行的组

2) 编译
[root@monitor21 nagios-4.2.4]# make all >编译主程序 #做完这步,最好开两个终端方便查看安装
[root@monitor21 nagios-4.2.4]# make install >安装程序
[root@monitor21 nagios-4.2.4]# ls /usr/local/nagios/ >主配置文件
[root@monitor21 nagios-4.2.4]# make install-init >安装控制脚本
/usr/bin/install -c -m 755 -d -o root -g root /etc/rc.d/init.d
/usr/bin/install -c -m 755 -o root -g root daemon-init /etc/rc.d/init.d/nagios

Init script installed

[root@monitor21 nagios-4.2.4]# cat /etc/rc.d/init.d/nagios >系统的脚本文件

3、【安装】
[root@monitor21 nagios-4.2.4]# make install-commandmode >设置文件权限
[root@monitor21 nagios-4.2.4]# make install-config >安装配置
[root@monitor21 nagios-4.2.4]# make install-webconf >部署网站配置
[root@monitor21 nagios-4.2.4]# make install-exfoliation >页面风格

4、 查看安装目录及配置文件说明
[root@monitor21 nagios-4.2.4]# ls /usr/local/nagios/
bin/ etc/ libexec/ sbin/ share/ var/

[root@monitor21 nagios-4.2.4]#ls /usr/local/nagios/bin/
nagios >验证配置信息
nagiostats >命令行显示监控信息
[root@monitor21 nagios-4.2.4]#ls /usr/local/nagios/etc/ >主配置文件目录
[root@monitor21 nagios-4.2.4]#ls /usr/local/nagios/libexec/ >监控插件目录 (默认为空)
[root@monitor21 nagios-4.2.4]#ls /usr/local/nagios/sbin/ >编译好的脚本文件(二进制)
[root@monitor21 nagios-4.2.4]#ls /usr/local/nagios/share/ >网页文件目录
[root@monitor21 nagios-4.2.4]#ls /usr/local/nagios/var/ >日志目录

5、安装监控插件
[root@monitor21 nagios-plugins-2.1.4]# tar -zxf /nagios-plugins-2.1.4.tar.gz >解包
[root@monitor21 nagios-plugins-2.1.4]# cd /nagios-4.2.4/nagios-plugins-2.1.4/ >进入目录
[root@monitor21 nagios-plugins-2.1.4]# ./configure && make && make install > 源码安装
[root@monitor21 nagios-4.2.4]# ls /usr/local/nagios/libexec/ >查看安装的插件

6、启动nagios监控服务
设置访问监控页面的用户名(nagiosadmin)和密码(自定义) >名字为默认值

[root@monitor21 nagios-4.2.4]# vim /etc/httpd/conf.d/nagios.conf
52 AuthUserFile /usr/local/nagios/etc/htpasswd.users >存储访问的用户名和密码

[root@monitor21 nagios-4.2.4]# which htpasswd >查看是否有这个命令
/usr/bin/htpasswd
[root@monitor21 nagios-4.2.4]# rpm -qf /usr/bin/htpasswd >查询那个包提供的
httpd-tools-2.4.6-40.el7.x86_64

[root@monitor21 nagios-4.2.4]# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin >建web管理用户
New password: 111111 >输入密码
Re-type new password: 111111 >验证密码
-c 选项
[root@monitor21 nagios-4.2.4]# cat /usr/local/nagios/etc/htpasswd.users >查看生成的文件
nagiosadmin:$apr1$UGaLKGiO$GNSYq.O2T6qVQab6aKTWR/

[root@monitor21 nagios-4.2.4]# systemctl restart httpd >重起网站服务
[root@monitor21 nagios-4.2.4]# /etc/rc.d/init.d/nagios start >开启nagios服务
[root@monitor21 nagios-4.2.4]# /etc/rc.d/init.d/nagios status >查看状态
nagios (pid 3883) is running...

7、访问监控网页
[root@room1pc33 桌面]# firefox http://192.168.4.21/nagios

Nagios监控基础配置(一)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
【下面是主页面】
Nagios监控基础配置(一)

三、配置nagios服务

(默认不用任何配置 就监控本机)
services 监控信息
Current Load cpu负载
Current Users 登入系统的用户数
HTTP 网站服务运行状态
Root Partition 根分区
SSH 监控ssh服务
Swap Usage 交换分区
Total Processes 总的进程数量
Nagios监控基础配置(一)

Host Status Totals 监控主机
Service Status Totals 监控资源

OK 正常
WARNING 警告
Unknown 不知道
Critical 严重错误
Pending 监控中

Nagios监控基础配置(一)

转载于:https://blog.51cto.com/13560729/2058770

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了安卓应用、小程序、Python应用和Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值