openfalcon 新增自定義報警

2021-10-07 22:22:48 字數 1341 閱讀 7610

1、falcon 新增自定義報警 雖然和zabbix 相似 但是還是有區別

2、目標是ping 三個ip 哪個不通 自動報出是哪個ip

falcon

plush 機制要求上報的資料格式如下:

root@host01:/path/to/plugins/plugin/sys/ntp]#./600_ntp.py

並且檔名是 時間_***.py

上述endpoint 是主機名

tags 變數不同的ip

imestamp 時間戳

metric 監控項

value 如果是變化值 或者是0 是好 1是不好

countertype 是固定的

step 時間

import socket, time, json

import requests

import os,subprocess,socket

from optparse import optionparser

defgo

(tag=

false):

req = requests.session(

) ceshi =

output =

for key, value in ceshi.items():

t =t[

'endpoint'

]= socket.gethostname(

) t[

'timestamp']=

int(time.time())

t['step']=

60 t[

'countertype']=

'gauge'

t['metric']=

'ping'

t['tags']=

'ip={},name={}'

.format

(value,key)

cmd =

"ping -w 2 -c1 %s &>/dev/null"

% value

res = subprocess.call(cmd, shell=

true

)if res ==0:

t['value']=

0else

: t[

'value']=

1print json.dumps(output)

return json.dumps(output)

if __name__ ==

'__main__'

: go(

)

輸出格式為:

[, , ]

android自定義控制項新增自定義屬性

1 如果是自定義控制項,請在style.xml中或attrs.xml中宣告屬性 attr declare styleable 2 在theme中使用自定義的屬性,可以再多個主題中定義不同的屬性值 customize your theme here.color colorprimaryitem col...

新增自定義模板

模板 當增加一些,固定,特有組伺服器的時候,增加一些特定的監控專案,這些專案就可以加到自定義的模板裡,再將機器加到這個模板裡。每次增加類似的機器,就可以加到這個模板裡。思路 建立模板 名字自定義 模板要歸屬到模板組裡。也可以鏈結其他的模板。建立出的模板,所有的都為空。可以增加一些監控專案。可以在其他...

為C 自定義控制項新增自定義事件

大氣象 原文 為c 自定義控制項新增自定義事件 這裡的自定義控制項是由普通控制項組合而成的。希望事件響應 推遲到使用自定義控制項的窗體裡寫。步驟一 新建乙個使用者控制項,放兩個按鈕,tag分別是btn1,btn2.這兩個按鈕的共用單擊事件處理 如下 using system using system...