存档

文章标签 ‘nagios’

nagios乱码解决

2010年10月3日 没有评论

vim /usr/local/apache/conf/httpd.conf

AddDefaultCharset utf-8

分类: √文章精选 标签: ,

nagios配置文件

2010年5月31日 没有评论

个人觉得这东西太难搞了。尽管网上教程那么多。也请教了不少人。但我还是很艰难的才搞成。。
我太笨了……
.cfg
cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_file=/usr/local/nagios/etc/objects/services.cfg
cfg_file=/usr/local/nagios/etc/objects/hosts.cfg
cfg_file=/usr/local/nagios/etc/objects/hostgroups.cfg
cfg_file=/usr/local/nagios/etc/objects/contactgroups.cfg

[root@moniter objects]# more contacts.cfg
define contact{
contact_name vi;
alias sys admin
service_notification_period 24×7
host_notification_period 24×7
service_notification_options w,u,c,r
host_notification_options d,u,r
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
email viyin@yahoo.com
pager 1391119xxxx
}

[root@moniter objects]# more contactgroups.cfg
define contactgroup{
contactgroup_name vis;
alias roots;
members vi
}

[root@moniter objects]# more hosts.cfg
define host{
# use host-pnp
host_name viyin.net
alias www
address 218.6.15.105
check_command check-host-alive
max_check_attempts 3
check_period 24×7
contact_groups vis
notification_interval 10
notification_period 24×7
notification_options d,u,r
}
[root@moniter objects]# more hostgroups.cfg
define hostgroup{
hostgroup_name linux-servers
alias linux-servers
members viyin.net
}

[root@moniter objects]# more services.cfg
define service{
# use srv-pnp
host_name viyin.net
service_description Current Users
check_command check_local_users!20!50
max_check_attempts 3
normal_check_interval 3
retry_check_interval 1
check_period 24×7
notification_interval 10
notification_period 24×7
notification_options w,u,c,r
contact_groups vis
}

分类: √linux, √web 标签: ,

nagios监控出现It appears as though you do not have permission

2010年5月15日 1 条评论

It appears as though you do not have permission to view information for any of the hosts you requested…

If you believe this is an error, check the HTTP server authentication requirements for accessing this CGI
and check the authorization options in your CGI configuration file.

修改/etc/cgi.cfg
vi /usr/local//etc/cgi.cfg

use_authentication=1 #把1修改为0,保存
root@nagios#/etc/init.d/nagios restart

分类: √nginx 标签:

nagios不能发送飞信报警一例

2010年4月1日 没有评论

转载自:http://blog.formyz.org/?p=330 感谢作者分享
虽然一直不喜欢移动,但受人之托,勉为其难帮他调试了一下。过程很简单,但其中的技巧却值得拿出来分享,于是就有了这个文章。

问题描述:

(1)以web方式查看nagios监控状态,显示故障,却收不到报警短信。

(2)系统日志出现“Warning: Attempting to execute the command “/usr/local//fetion –mobile=13660600600 –pwd=little228 –to=13909088009 –msg-utf8=”[linux1-CRITICAL] CHECK_NRPE: Socket timeout after 10 seconds. (20:51:12)”” resulted in a return code of 127. Make sure the script or binary you are trying to execute actually exists…”。

情况了解:

该系统管理员说,他用手工方式执行飞信发短信没问题,再切换成用户nagios,也没问题。

处理过程:

(1)登陆该服务器,查看系统日志和nagios日志,果然如此。

(2)查看飞信所在的目录,发现已经被系统管理员设置成777了。

(3)先修改一下他的/etc/sudoers文件,用visudo进去,新增一行“ ALL=NOPASSWD:/usr/local/feiton/feiton”保存。

(4)切换到nagios用户:su – nagios

(5)执行sudo /usr/local/feiton/feiton ,报无lib*.so文件。

(6)这些文件在/usr/local/feiton里呆着呢,先看看/usr/lib里有没有这些。

(7)切换回root,查一下/usr/lib目录,果然没有这些lib*.so。

(8)从这个目录,把这些个lib*.so统统拷贝到/usr/lib目录。

(9)再切换到nagios用户执行sudo /usr/local/feiton/feiton 哈哈,没报错了。

(10)停止一个监控机上的服务,片刻,就发短信了。

对于监控短信报警,还是建议使用短信接口,不行该死的飞信,不能发其他运营商的手机短信。

nginx平台架设nagios

2010年3月23日 3 条评论

nagios作用
1.
监控网络服务(SMTP、POP3、HTTP、NNTP、PING等);
2.
监控主机资源(处理器负荷、磁盘利用率等);
3.
简单地插件设计使得用户可以方便地扩展自己服务的检测方法;
4.
并行服务检查机制;
5.
具备定义网络分层结构的能力,用”parent”主机定义来表达网络主机间的关系,这种关系可被用来发现和明晰主机宕机或不可达状态;
6.
当服务或主机问题产生与解决时将告警发送给联系人(通过EMail、短信、用户定义方式);
7.
具备定义事件句柄功能,它可以在主机或服务的事件发生时获取更多问题定位;
8.
自动的日志回滚;
9.
可以支持并实现对主机的冗余监控;
10.
可选的WEB界面用于查看当前的网络状态、通知和故障历史、日志文件等;
Nagios所需要的运行条件是机器必须可以运行Linux(或是Unix变种)并且有C语言编译器。你必须正确地配置TCP/IP协议栈以使大多数的服务检测可以通过网络得以进行。

安装

建立nagios账号
/usr/sbin/useradd && passwd

创建一个用户组名为nagcmd用于从Web接口执行外部命令。将nagios用户和apache用户都加到这个组中。

  1. /usr/sbin/groupadd nagcmd
  2. /usr/sbin/usermod -G nagcmd nagios
  3. /usr/sbin/usermod -G nagcmd apache

安装nagios及插件
阅读全文…