def measureAndPost(processName): serviceID = getServiceID() instanceID = getInstanceID() monitoringEndpoint = getMonitoringEndpoint() kpiName = getKPIName() value = countRunningProcesses(processName) print "sending value: ", value return sendPost(serviceID, instanceID, monitoringEndpoint, kpiName, value)
def main(args): if len(args) < 6: print >> sys.stderr, "Usage: ./fakeprobe.py <monitoringEndpoint> <serviceID> <instanceID> <kpiName> <value>" print >> sys.stderr, "For example: ./fakeprobe.py http://localhost:8087 myService instance-1 ThreadCount 30" return -1 else: monitoringEndpoint = args[1] serviceID = args[2] instanceID = args[3] kpiName = args[4] value = args[5] try: return sendPost(serviceID, instanceID, monitoringEndpoint, kpiName, value) except Exception, e: print e