Nagios 安装配置
生活随笔
收集整理的這篇文章主要介紹了
Nagios 安装配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
##Debian 6 安裝server # apt-get install nagios* 一路設置好各種密碼,成功后訪問 http://ip/nagios3 既可,默認用戶*nagiosadmin* ##Centos 安裝client rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm yum -y install nagios nagios-plugins-all nrpe chkconfig nrpe on 編輯配置文件 `nano /etc/nagios/nrpe.cfg` 將其中的`allowed_hosts`改為自己的值: allowed_hosts=192.168.1.2 #server地址 重啟nrpe: service nrpe restart ##配置Server端 檢測一下是否能連接到client: /usr/lib/nagios/plugins/check_nrpe -H 192.168.2.11 進入`/etc/nagios3/conf.d`目錄,新建并編輯`my_nagios2.cfg`: define host{ use generic-host host_name mylinux alias mylinux address 192.168.1.mylinux } define service{ use generic-service host_name mylinux service_description HTTP-Server check_command check_http } # Define a service to check the disk space of the root partition # on the local machine. Warning if < 20% free, critical if # < 10% free space on partition. define service{ use generic-service ; Name of service template to use host_name mylinux service_description Disk Space check_command check_all_disks!20%!10% } # Define a service to check the number of currently logged in # users on the local machine. Warning if > 20 users, critical # if > 50 users. define service{ use generic-service ; Name of service template to use host_name mylinux service_description Current Users check_command check_users!20!50 } # Define a service to check the number of currently running procs # on the local machine. Warning if > 250 processes, critical if # > 400 processes. define service{ use generic-service ; Name of service template to use host_name mylinux service_description Total Processes check_command check_procs!250!400 } # Define a service to check the load on the local machine. define service{ use generic-service ; Name of service template to use host_name mylinux service_description Current Load check_command check_load!5.0!4.0!3.0!10.0!6.0!4.0 } 重啟服務: service nagios3 restart ##添加Mysql監控插件 在server下載插件: cd /usr/lib/nagios/plugins wget https://raw.github.com/tart/tart-monitoring/master/checkMySQLProcesslist.sh chmod a+x checkMySQLProcesslist.sh 向command配置`/etc/nagios3/commands.cfg`中添加: define command{ command_name checkMySQLProcesslist command_line /usr/lib/nagios/plugins/checkMySQLProcesslist.sh -u $ARG1$ -p $ARG2$ -s 60 -w 20 -c 50 } 向client配置`/etc/nagios3/conf.d/my_nagios2.cfg`中添加: define service{ use generic-service host_name localhost service_description Mysql Process List check_command checkMySQLProcesslist!用戶名!密碼 } 然后重啟服務: service nagios3 restart ##other > Nagios的插件編寫很簡單,同上mysql的插件,照葫蘆畫瓢就行,添加其他client節點,只要安裝好相應系統的nrpe和nagios的插件,然后在server段添加一個配置文件就行。
轉載于:https://www.cnblogs.com/hangxin1940/p/3531942.html
總結
以上是生活随笔為你收集整理的Nagios 安装配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: IDL简易计算器
- 下一篇: [转载] 30分钟泛型教程