177 |
|
self.configRecheck = True # enabled by default |
178 |
|
self.performBgMonitoring = True # by default, perform background monitoring |
179 |
|
self.monitoredJobs = {} # Monitored jobs; key = pid; value = hash with |
180 |
< |
self.maxMsgRate = 10 # Maximum number of messages allowed to be sent per second |
180 |
> |
self.maxMsgRate = 100 # Maximum number of messages allowed to be sent per second |
181 |
|
self.__defaultSenderRef = {'INSTANCE_ID': random.randint(0,0x7FFFFFFE), 'SEQ_NR': 0}; |
182 |
|
self.__defaultUserCluster = "ApMon_UserSend"; |
183 |
|
self.__defaultUserNode = socket.getfqdn(); |
199 |
|
self.__prvDrop = 0; |
200 |
|
self.__crtSent = 0; |
201 |
|
self.__crtDrop = 0; |
202 |
< |
self.__hWeight = 0.92; |
202 |
> |
self.__hWeight = 0.95; # in (0,1) increase to wait more time before maxMsgRate kicks-in |
203 |
|
self.logger = Logger.Logger(defaultLogLevel) |
204 |
|
self.setDestinations(initValue) |
205 |
|
self.__udpSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
206 |
< |
# if len(self.configAddresses) > 0: |
207 |
< |
# if there are addresses that need to be monitored, |
208 |
< |
# start config checking and reloading thread |
209 |
< |
# th = threading.Thread(target=self.__configLoader) |
210 |
< |
# th.setDaemon(True) # this is a daemon thread |
211 |
< |
# th.start() |
206 |
> |
#if len(self.configAddresses) > 0: |
207 |
> |
# # if there are addresses that need to be monitored, |
208 |
> |
# # start config checking and reloading thread |
209 |
> |
# th = threading.Thread(target=self.__configLoader) |
210 |
> |
# th.setDaemon(True) # this is a daemon thread |
211 |
> |
# th.start() |
212 |
|
# create the ProcInfo instance |
213 |
|
self.procInfo = ProcInfo.ProcInfo(self.logger); |
214 |
|
# self.procInfo.update(); |
215 |
|
# start the background monitoring thread |
216 |
< |
# th = threading.Thread(target=self.__bgMonitor); |
217 |
< |
# th.setDaemon(True); |
218 |
< |
# th.start(); |
216 |
> |
#th = threading.Thread(target=self.__bgMonitor); |
217 |
> |
#th.setDaemon(True); |
218 |
> |
#th.start(); |
219 |
|
|
220 |
|
def sendParams (self, params): |
221 |
|
""" |
430 |
|
Stop background threands, close opened sockets. You have to use this function if you want to |
431 |
|
free all the resources that ApMon takes, and allow it to be garbage-collected. |
432 |
|
""" |
433 |
< |
# if len(self.configAddresses) > 0: |
434 |
< |
# self.__configUpdateEvent.set() |
435 |
< |
# self.__configUpdateFinished.wait() |
436 |
< |
# self.__bgMonitorEvent.set() |
437 |
< |
# self.__bgMonitorFinished.wait() |
433 |
> |
#if len(self.configAddresses) > 0: |
434 |
> |
# self.__configUpdateEvent.set() |
435 |
> |
# self.__configUpdateFinished.wait() |
436 |
> |
#self.__bgMonitorEvent.set() |
437 |
> |
#self.__bgMonitorFinished.wait() |
438 |
|
|
439 |
|
if self.__udpSocket != None: |
440 |
|
self.logger.log(Logger.DEBUG, "Closing UDP socket on ApMon object destroy."); |
693 |
|
def __directSendParams (self, destination, clusterName, nodeName, timeStamp, params): |
694 |
|
|
695 |
|
if self.__shouldSend() == False: |
696 |
< |
self.logger.log(Logger.DEBUG, "Dropping packet since rate is too fast!"); |
697 |
< |
return; |
696 |
> |
# self.logger.log(Logger.ERROR, "Dropping packet since rate is too fast!"); |
697 |
> |
self.logger.log(Logger.INFO, "Pausing 1sec since rate is too fast!"); |
698 |
> |
time.sleep(1.0) |
699 |
> |
# return; |
700 |
|
|
701 |
|
if destination == None: |
702 |
|
self.logger.log(Logger.WARNING, "Destination is None"); |