Installation and basic configuration of Nagios

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/weixin_39329758/article/details/90746620

Nagios

        Nagios is an open source computer system and network monitoring tools to effectively monitor windows, linux, host status Uninx, the switch routers and other network settings, printers, etc. sent e-mail or text message when an abnormal state of alarm system or service in the first time to notify your carrier maintenance personnel, sent normal mail or SMS alarm notification when the state is restored.

        Nagiosq function is to monitor the service and the host, but also his own part does not include this feature, all monitoring, detection is accomplished through a variety of plug-ins.

        After starting his Nagios will periodically automatically calls the plug-in to check server status, while Nagios will maintain a queue, all the plug-ins back to the state information into the queue, every time Nagios first starts to read information from the team, and processed, the status results displayed web results

        Nagios provides a number of plug-ins, use these plug-ins can easily monitor many service status, after the installation is complete, in the / libexec under Nagios main directory placed all plugins nagios self can be used, such as check_disk is a plug-in to check disk space, check_load is to check the CPU load, and so on. Each plug-in can be viewed using the methods and functions by running ./check_xxx -h;

        Nagios may return information identifying four states, namely:

            0 (OK) under normal conditions / green,

            1 (WARNING) represents the warning / yellow,

            2 (CRITTCAL) indicating the occurrence of a very serious mistake / red,

            3 (UNKNOWN) indicating an unknown error, deep yellow.

        According to the Nagios plug-in returns a value to determine the state of the monitored object, and displayed through the web to provide an administrator to detect faults.

 

Experimental objective:

Knowledge objectives: to master Nagios monitoring

Skills objectives: to master to build and configure Nagios monitoring services

 

lab environment:

        Server install nagios software to do data monitoring process, and provides a web interface to view and manage can also be monitored Native own information. Client installed NRPE other client performs monitoring in accordance with the request monitor unit, then the results back to the monitoring machine.

        Firewall off / iptables: Firewall is not running.SELINUX = disabled

        Centos version: CentOS Linux release 7.x (Core) 64 Wei

        Apache version: Apache / 2.4.6nagios version: nagios-4.3.1

        nagios-plugins version: nagios-plugins-2.2.1

Nagios-server installation side configuration

Yum configuration environment

yum configuration environment mount mirror.

 

Local open source.

Clean the cache, the cache and create a new verification.

Check the installation depend on the environment.

Installation configuration nagios.

Nagios create users and groups.

Create a user group.

The added nagcmd nagios and apache user group.

Upload to nagios-server virtual machine and install Nagios.

Unzip and install nagios-4.3.1.

View unpacked.

Next to compile and install related components.

Display complete.

By default the next step.

 

Show details.

Installation mail service.

Start the service.

Send e-mail test.

View received messages.

Modify email parameters.

Parameters are as follows.

Modify the web interface login authentication information.

Nagios modify user permissions.

Detecting whether the main configuration file syntax error.

Check the results are as follows.

Install nagios plugin.

Details are as follows.

Compile and install.

Boot authentication service.

Install a firewall.

Reboot the firewall.

Adding a firewall rule open http port.

Http restart the service.

Login authentication.

The following pages.

Installation nrpe.

Next.

Check whether the installation check_nrpe plug.

Nagios-client end mounting configuration

关闭防火墙和selinux。

配置环境

上传nagios-plugin

添加用户&&解压安装nagios-plugin

安装。

安装nrpe

启动nrpe

验证连通性

重启nrpe

在server端验证

在client端做同样的验证

注释掉nrpe.cfg中的以下几行

创建监控脚本(在nrpe.cfg文件末尾添加下面几行)

创建一个监控内存的脚本check_mem.pl

重启nrpe服务后在本机验证结果。

在server端进行验证

修改nagios.cfg配置文件

修改检查语法脚本nagios.cfg

修改commands.cfg文件在末尾添加以下内容

修改配置主机模板

将监控的主机添加到主机组中

修改配置服务模板脚services.cfg

重启nagios服务

在web端调试验证

 

Nagios小总结:

        Nagios安装,是指基本平台,也就是Nagios软件包的安装,它是监控体系的框架,也是所有监控基础。

Nagios通过NRPE来远端管理服务

        1.Nagios执行安装在它里面的check_nrpe插件,并告诉check_nrpe去检测哪些服务。

        2.通过SSL,check_nrpe连接远端 机子上的NRPE daemon

        3.NRPE运行本地的各种插件去检测本地的服务和状态

        4.最后,NRPE把检测的结果传给主机端check_nrpe,check_nrpe在把结果 送到Nagios状态队列中,

        5.Nagios依次读取队列中信息,再把结果显示出来

        Server安装了nagios软件,对监控的数据做处理,并且提供web界面查看和管理,当然也可以对本机自身的信息 进行监控

        Client安装了NRPE等客户端,根据监控机的请求执行监控,然后将结果回传给监控机。

        Nagios是一款开源电脑系统和网络监视工具,能够有效监控windows,linux,Uninx的主机状态,交换机路由器等网络设置,打印机等.在系统或服务状态异常时发出邮件或短信报警第一时间通知运维人员,在状态恢复后发出正常的邮件或短信报警通知

主要功能:                                       

        1.网络服务监控(STMP简单电子邮件服务;POP3邮件服务器;HTTP;              NNTP;ICMP;SNMP;FTP;SSH)

        2.主机 资源监控(CPU locd,disk usage,system logs),也包括windows主机        (使用NSCLIENT++ Plugin)

        3.可以指定自己编写的Plugin通过网络收集数据来监控任何情况(温度,警            告。。。)

        4.可以监控支持SSH或SSK加通道方式进行监

        5.可以通过配置Nagio远程 执行插件远程执行脚本

        6.简单的plugin设计允许用户很容易的开发自己 需要的检查服务,支持很多            开发语言(shel scripts,c++,perl,ruby,python,php,c)

        7.包含很多图形化数据plugins(Nagiosgraph,Nagiosgrapher,PNP4Nagios等)

        8.可并行服务检查

        9.能够定义网络主机的层,允许逐级调查,就是从父主机开始向下检查,

        10.当服务或主机 出现 问题是发出通告 ,可通过emall,pager,sms或任意用            户   

        11.自定义的plugin进行通知

        12自动日志 循环

        13.支持冗余监控

        14.包web界面可以查看当前网络状态,通知,问题历史,日志文件等

Guess you like

Origin blog.csdn.net/weixin_39329758/article/details/90746620