????ganlia ?? nagios ????????????????澯???????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????
???????????????н??????????n??????????????????????????????????????????澯???????????????Nagios?????????????
????GEngin.py??????????棬????conf??????????????????????????????gmetric?????
????conf?????б???metrix????????????ò??????
????flag?????н????????flag????????????????????????????????????????????????????
????log?? ???м??GEngin??log????????????????log
????pid?? GEngin??pid ??澯??????
????script?? ??????????????
????cat conf/metrix.cfg:
YARN|ResourceManager|cpu|ResourceManager_cpu.py|ResourceManager_cpu.txt|int16|Percent|
YARN|ResourceManager|mem|ResourceManager_mem.py|ResourceManager_mem.txt|int16|Percent|
YARN|ResourceManager|lsof|ResourceManager_lsof.py|ResourceManager_lsof.txt|int16|Number|
????ls flag/:
????yarntestD001.flag
????ll log/:
-rw-r--r-- 1 yarn users     168 Mar 19 20:02 yarntestD001_YARNResourceManagercputdw-10-16-19-91.txt
-rw-r--r-- 1 yarn users     168 Mar 19 20:02 yarntestD001_YARNResourceManagerlsoftdw-10-16-19-91.txt
-rw-r--r-- 1 yarn users     168 Mar 19 20:02 yarntestD001_YARNResourceManagermemtdw-10-16-19-91.txt
????ll script/:
-rw-r--r-- 1 yarn users  882 Feb 28 17:20 ResourceManager_cpu.py
-rw-r--r-- 1 yarn users 1093 Feb 28 17:45 ResourceManager_lsof.py
-rw-r--r-- 1 yarn users  882 Feb 28 17:18 ResourceManager_mem.py
????cat script/SAMPLE.py:
#!/usr/bin/env python
# coding=gbk
import sys
import os
import datetime
import time
def CheckInput():
"Check Input parameters ?? they should be a pysql file."
if len(sys.argv) < 2 :
print "Usage: " + sys.argv[0] + " FileNamePrefix "
sys.exit()
if __name__== '__main__':
CheckInput() # check parameter and asign PyFileName
## result file log to directory of LOG
LogFile = open("log/"+sys.argv[1]??'a')
res = "29"
## Interface to Gmetrix ??must be value:Value
print "value:"+res
ntime = str(time.strftime("%Y-%m-%d %X"??time.localtime()))
LogFile.write(ntime+" "+res+" ")
LogFile.close()