1 |
< |
import apmon |
1 |
> |
import apmon, sys, common |
2 |
|
|
3 |
|
class ApmonIf: |
4 |
|
""" |
23 |
|
def getApmonInstance(self): |
24 |
|
if self.apm is None : |
25 |
|
try: |
26 |
< |
apmonUrl = 'http://lxgate35.cern.ch:40808/ApMonConf' |
27 |
< |
print "Creating ApMon with " + apmonUrl |
28 |
< |
apmonInstance = apmon.ApMon(apmonUrl, apmon.Logger.WARNING) |
26 |
> |
apmonUrls = ["http://lxgate35.cern.ch:40808/ApMonConf", "http://monalisa.cacr.caltech.edu:40808/ApMonConf"] |
27 |
> |
apmInstance = apmon.ApMon(apmonUrls, apmon.Logger.FATAL); |
28 |
> |
if not apmInstance.initializedOK(): |
29 |
> |
print "It seems that ApMon cannot read its configuration. Setting the default destination" |
30 |
> |
apmInstance.setDestinations({'lxgate35.cern.ch:58884': {'sys_monitoring':0, 'general_info':0, 'job_monitoring':1, 'job_interval':300}}); |
31 |
|
except: |
32 |
< |
print "PIPPO" |
33 |
< |
return apmonInstance |
32 |
> |
exctype, value = sys.exc_info()[:2] |
33 |
> |
print "ApmonIf::getApmonInstance Exception raised %s Value: %s"%(exctype, value) |
34 |
> |
common.logger.message("ApmonIf::getApmonInstance Exception raised: %s %s"%(exctype, value)) |
35 |
> |
return |
36 |
> |
return apmInstance |
37 |
|
|
38 |
|
def free(self): |
39 |
|
self.apm.free() |