Chinaunix首页 | 论坛 | 博客
  • 博客访问: 627540
  • 博文数量: 95
  • 博客积分: 2091
  • 博客等级: 大尉
  • 技术积分: 982
  • 用 户 组: 普通用户
  • 注册时间: 2007-09-05 19:34
文章分类

全部博文(95)

文章存档

2017年(1)

2016年(20)

2015年(10)

2014年(6)

2013年(4)

2012年(1)

2011年(9)

2010年(6)

2009年(20)

2008年(17)

2007年(1)

我的朋友

分类: 系统运维

2017-11-21 18:07:02


一  短信接口
   这个短信接口是封装过的,内部使用,格式 内容 就可以了, 如果使用短信平台提供的还需要在URL上加上账号密码等

二  发送短信的脚本

点击(此处)折叠或打开

  1. #!/bin/sh
  2. #created by waynewu 2017/11/21
  3. #14778424@qq.com
  4. PHONE=$1
  5. CONTENT=$2
  6. curl -X GET -G --header "Accept: */*" --data-urlencode content="$CONTENT"
说明: 这里使用的是get请求  其中 -G 参数和后面的-data-urlencode, 是为了发送内容中的空格

三  定义command.cfg

点击(此处)折叠或打开

  1. define command {
  2. command_name notify-service-by-sms
  3. command_line /usr/local/icinga/bin/sms_send.sh $CONTACTPAGER$ "时间: $LONGDATETIME$ 通知类型: $NOTIFICATIONTYPE$ 服务: $SERVICEDESC$ 主机: $HOSTALIAS$ 地址: $HOSTADDRESS$ 状态: $SERV
  4. ICESTATE$"
  5. }
$CONTACTPAGER$  电话号码

templates.cfg增加短信报警
service_notification_commands   notify-service-by-email,notify-service-by-sms

五 定义联系人contacts.cfg

点击(此处)折叠或打开

define contact{
              contact_name xxxxx
              use generic-contact
              email xxxxxx@xxxx.com
              pager 1734455354
}

define contactgroup{
        contactgroup_name       xxxxx
        alias                   xxxxx Administrators
        members                 xxxxx
        }
六  服务上把上面建立的group加上去,重启icinga服务就可以正常发送短信了

点击(此处)折叠或打开

  1. define service{
  2. use suanhua-service
  3. host_name 127.0.0.1
  4. service_description Disk Partition
  5. check_command check_nrpe!check_disk
  6. contact_groups xxxxx
  7. }



     

阅读(712) | 评论(0) | 转发(0) |
0

上一篇:阿里maven服务器

下一篇:没有了

给主人留下些什么吧!~~