使用REST API发送数据至newrelic做监控

需求:

        在k8s平台中的pod,内网监控并将数据发送到newrelic做alert。

实现:

        1. 参考https://docs.newrelic.com/docs/insights/insights-data-sources/custom-data/send-custom-data-insights#transaction-defaults

                    https://docs.newrelic.com/docs/insights/insights-data-sources/custom-data/send-custom-events-event-api

           选择使用event-api将pod内获取到的数据发送到newrelic

        2. 在newrelic里新建alert

           

            点击”Alerts“ 打开alert界面-> 选择”Alert Policies“

            在界面右上角点击”New alert policy“

            

            输入 name, preference选择by condition.

         3. 在insight中查看data是否成功上传

             在newrelic主页菜单栏选择”insights“,打开如下界面:

             

             在该界面输入查询语句来检索结果。

             如 上传如下json数据,NRQL语句可以写作 select * from Purchase when account >=3

             参考https://docs.newrelic.com/docs/insights/nrql-new-relic-query-language/using-nrql/query-page-create-edit-nrql-queries

[
  {
    "eventType":"Purchase",
    "account":3,
    "amount":259.54
  },
  {
    "eventType":"Purchase",
    "account":5,
    "amount":12309,
    "product":"Item"
  }
]

         4. 如果数据成功上传,那么接下来需要新建codition

 

             打开alert policy界面:

            

           选择”create a codition“

          

           选择”NRQL“,

          

            输入NRQL的query语句。thresholds中设置针对query结果的策略。输入condition name后,点击”create codition“。

至此,使用api发送数据,并使用newrelic创建alert做监控的基本工作完成。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值