设为首页 收藏本站
查看: 2677|回复: 0

安装文件在icinga上安装check_mk

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2014-11-18 16:13:19 | 显示全部楼层 |阅读模式
本帖最后由 4tfr 于 2014-11-18 16:15 编辑

在本文中,我们主要介绍安装文件的内容,自我感觉有个不错的建议和大家分享下

    安装前的预备:

    1. 我当初已经安装了icinga,并且使用了mysql. check_mk要求事前安装了全功能的nagios, 似乎我的已经算是全功能了。当初运行icinga也正常。

    2. 检查external command是否正常。打开网页,登录后勾选localhost的ping服务, 然后点击右上的下拉框:
20130516143308052.png
    安装和文件
20130516143738623.png
    点击Submit按钮后,接着做一些后续操纵。然后回到页面发现Ping服务被制止了。

    安装和文件

   

   

    所以external command任务正常。

    3. 检查python, UBuntu server已经安装好了,刚好是2.x版本。

python --version
Python 2.7.3

    4. xinetd 在之前安装NSCA的时候就装过了。

   

    开始安装:

    1. 下载

root@icinga:/opt# wget http://mathias-kettner.com/download/check_mk-1.2.2p1.tar.gz

    2. 解压:

tar zxvf check_mk-1.2.2p1.tar.gz

    3. 运行./setup.sh 程序,进入交互式安装过程,一般都用默许值。上面是我的默许选择:

You have chosen the following directories:

Executable programs             /usr/bin                                
Check_MK configuration          /etc/check_mk                           
Check_MK software               /usr/share/check_mk                     
documentation                   /usr/share/doc/check_mk                 
check manuals                   /usr/share/doc/check_mk/checks         
working directory of check_mk   /var/lib/check_mk                       
extensions for agents           /usr/lib/check_mk_agent                 
configuration dir for agents    /etc/check_mk                           
Name of Nagios user             icinga                                 
User of Apache process          www-data                                
Common group of Nagios+Apache   icinga-cmd                              
Nagios binary                   /usr/local/icinga/bin/icinga            
Nagios main configuration file  /usr/local/icinga/etc/icinga.cfg        
Nagios object directory         /usr/local/icinga/etc/conf.d            
Nagios startskript              /etc/init.d/icinga                     
Nagios command pipe             /usr/local/icinga/var/rw/icinga.cmd     
Check results directory         /usr/local/icinga/var/spool/checkresults
Nagios status file              /usr/local/icinga/var/status.dat        
Path to check_icmp              /usr/lib/nagios/plugins/check_icmp      
URL Prefix for Web addons       /                                       
Apache config dir               /etc/apache2/conf.d                     
HTTP authentication file        /usr/local/icinga/etc/htpasswd.users   
HTTP AuthName                   Icinga Access                           
PNP4Nagios templates            /usr/share/check_mk/pnp-templates      
compile livestatus module       yes                                    
check_mk's binary modules       /usr/lib/check_mk                       
Unix socket for Livestatus      /usr/local/icinga/var/rw/live           
Backends for other systems      /usr/share/check_mk/livestatus         
Install Event Console           no

    这些信息都存在了~/.check_mk_setup.conf文件里面。下次如果想重新安装,可以先删除这个文件。

    4. 重新启动apache2和icinga服务后,打开网页:http://10.112.18.111/check_mk

    看到错误信息:

Check_mk: Incomplete Apache2 Installation

You need mod_python in order to run the web interface of check_mk.
Please install mod_python and restart Apache.

    当初来安装Apache2的模块mod_python.

apt-get install libapache2-mod-python

    重新启动apache2.

    当初看到页面了,但是有两个错误:

    20130516151443599.png
20130516151329615.png
安装和文件

   

    安装和文件

   

    5. 先不管上面的错误,安装一下本机监控用的agent。

wget http://mathias-kettner.com/downl ... t_1.2.2p1-2_all.deb

dpkg -i check-mk-agent_1.2.2p1-2_all.deb
Selecting previously unselected package check-mk-agent.
(Reading database ... 65470 files and directories currently installed.)
Unpacking check-mk-agent (from check-mk-agent_1.2.2p1-2_all.deb) ...
Setting up check-mk-agent (1.2.2p1-2) ...
Reloading xinetd...

    6. 修改监控的host列表, 编辑/etc/check_mk/main.mk文件,内容如下:
    每日一道理
如果说生命是一座庄严的城堡,如果说生命是一株苍茂的大树,如果说生命是一只飞翔的海鸟。那么,信念就是那穹顶的梁柱,就是那深扎的树根,就是那扇动的翅膀。没有信念,生命的动力便荡然无存;没有信念,生命的美丽便杳然西去。(划线处可以换其他词语)

# Put your host names here
all_hosts = [ 'localhost' ]

   

    7. 检测一下, check_mk会读取所有host并停止检测,上面创建了11个检测服务。

cmk -I
cpu.loads         1 new checks
cpu.threads       1 new checks
df                2 new checks
diskstat          1 new checks
kernel            3 new checks
kernel.util       1 new checks
lnx_if            1 new checks
mem.used          1 new checks
mounts            2 new checks
tcp_conn_stats    1 new checks
uptime            1 new checks

    8. 然后用check_mk -O 来自动修改icinga的配置文件:

check_mk -O
Generating Nagios configuration...OK
Validating Nagios configuration...ERROR:

Icinga 1.9.0
Copyright (c) 2009-2013 Icinga Development Team (http://www.icinga.org)
Copyright (c) 2009-2013 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 05-07-2013
License: GPL

Reading configuration data...
   Read main config file okay...
Processing object config directory '/usr/local/icinga/etc/conf.d'...
Processing object config file '/usr/local/icinga/etc/conf.d/check_mk_objects.cfg'...
Processing object config file '/usr/local/icinga/etc/conf.d/check_mk_templates.cfg'...
Processing object config file '/usr/local/icinga/etc/objects/commands.cfg'...
Processing object config file '/usr/local/icinga/etc/objects/contacts.cfg'...
Processing object config file '/usr/local/icinga/etc/objects/timeperiods.cfg'...
Processing object config file '/usr/local/icinga/etc/objects/templates.cfg'...
Processing object config file '/usr/local/icinga/etc/objects/localhost.cfg'...
Warning: Duplicate definition found for host 'localhost' (config file '/usr/local/icinga/etc/objects/localhost.cfg', starting on line 23)
Error: Could not add object property in file '/usr/local/icinga/etc/objects/localhost.cfg' on line 27.
   Error processing object config files!


***> One or more problems was encountered while processing the config files...

     Check your configuration file(s) to ensure that they contain valid
     directives and data definitions.  If you are upgrading from a previous
     version of Icinga, you should be aware that some variables/definitions
     may have been removed or modified in this version.  Make sure to read
     the HTML documentation regarding the config files, as well as the
     'Whats New' section and the Changelog CHANGES section as well to find
     out what has changed.

Nagios configuration is invalid. Rolling back.

    报错了。因为icinga默许有localhost配置。最简略的解决方法是把上面的文件里面的localhost的host定义注释失落

/usr/local/icinga/etc/objects/localhost.cfg

#define host{                                                                                                                                                                    
#        use                     linux-server            ; Name of host template to use                                                                                          
#                                                       ; This host definition will inherit all variables that are defined                                                      
#                                                       ; in (or inherited by) the linux-server host template definition.                                                        
#        host_name               localhost                                                                                                                                       
#        alias                   localhost                                                                                                                                       
#        address                 127.0.0.1                                                                                                                                       
#        }

    再次运行check_mk -O ,成功。

root@icinga:/etc/check_mk# check_mk -O
Generating Nagios configuration...OK
Validating Nagios configuration...OK
Precompiling host checks...OK
Reloading Nagios...OK

   

   

文章结束给大家分享下程序员的一些笑话语录: 3G普不普及现在已经不是看终端了,而是看应用,有好的,便宜实用的应用,花1000多买个能用的智能手机应该不是什么难事。反过来说,你200元拿一个智能手机,没有好的应用,看个电影要几十元,也是没人用3G。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-31277-1-1.html 上篇帖子: icinga 被动模式 nsca 安装 下篇帖子: icinga是nagios的升级版
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表