需求yum状态监控

需求yum状态监控

添加客户端角度的监控

  1. 脚本编写
#!/bin/bash
sudo yum clean all &>/dev/null
sudo rm -rf /var/cache/yum  &>/dev/null
sudo yum makecache &>/dev/null
echo "plugin_sys.yum.status $?"
  1. telegraf配置文件编写
[root@salt-master2.sys.ops.beta.bj1.wormpex.com /etc/telegraf/telegraf.d]$ cat yum_monitor.conf
[[inputs.exec]]
  commands = ["bash /data/w/telegraf-plugin/yum_moniter.sh"]
  timeout = "15s"
  interval = "60s"
  data_format = "graphite"
  templates = [
    "measurement.measurement.field"
  ]
  1. 检查日志文件查看监控数据上传是否存在问题
[root@salt-master2.sys.ops.beta.bj1.wormpex.com /var/log/telegraf]$ tail -f telegraf.log
2019-12-02T07:48:18Z I! Hang on, flushing any cached metrics before shutdown
2019-12-02T07:48:18Z I! Starting Telegraf
2019-12-02T07:48:18Z I! Loaded inputs: inputs.disk inputs.diskio inputs.kernel inputs.mem inputs.internal inputs.net inputs.netstat inputs.ping inputs.cpu inputs.processes inputs.swap inputs.system inputs.nstat inputs.exec inputs.exec
2019-12-02T07:48:18Z I! Loaded aggregators:
2019-12-02T07:48:18Z I! Loaded processors:
2019-12-02T07:48:18Z I! Loaded outputs: graphite
2019-12-02T07:48:18Z I! Tags enabled: host=salt-master2.sys.ops.beta.bj1
2019-12-02T07:48:18Z I! Agent Config: Interval:30s, Quiet:false, Hostname:"salt-master2.sys.ops.beta.bj1", Flush Interval:30s
  1. 查看监控系统上是否已经存在数据并配置报警 done
  2. 验证报警是否能报出来
    脚本所在地的yum源的配置
    1、确实存在报警信息 done
    2、确实有工单出现 done

添加服务器角度的监控

添加端口监控28080

posted @ 2020-02-14 17:43  I'm杨呵呵  阅读(298)  评论(0编辑  收藏  举报