|
39 | 39 |
|
40 | 40 | from resources.processes import Processes as ResProcesses
|
41 | 41 |
|
| 42 | +def getUuid(): |
| 43 | + # Generate a unique name that will stay constant between |
| 44 | + # invocations, such as platform.node() + uuid.getnode() |
| 45 | + # Use uuid5, which does not depend on the clock and is |
| 46 | + # recommended over uuid3. |
| 47 | + # This is important to be able to identify a server even if |
| 48 | + # its drives have been wiped clean. |
| 49 | + # Note that this is not foolproof but we can reconcile servers |
| 50 | + # on the back-end if need be, based on mac addresses. |
| 51 | + return uuid.uuid5(uuid.NAMESPACE_DNS, platform.node() + str(uuid.getnode())).hex |
| 52 | + |
42 | 53 | def recordsize(func):
|
43 | 54 | "Record the size of the response"
|
44 | 55 | def wrapper(*args, **kwargs):
|
@@ -102,7 +113,7 @@ def __init__(self, agentConfig, rawConfig, emitter):
|
102 | 113 |
|
103 | 114 | self._event_checks = [Hudson(), Nagios(socket.gethostname())]
|
104 | 115 | self._resources_checks = [ResProcesses(self.checksLogger,self.agentConfig)]
|
105 |
| - |
| 116 | + |
106 | 117 | #
|
107 | 118 | # Checks - FIXME migrating to the new Check interface is a WIP
|
108 | 119 | #
|
@@ -334,15 +345,7 @@ def _doChecks(self, firstRun, systemStats=False):
|
334 | 345 | except socket.error:
|
335 | 346 | self.checksLogger.exception('Unable to get hostname')
|
336 | 347 |
|
337 |
| - # Generate a unique name that will stay constant between |
338 |
| - # invocations, such as platform.node() + uuid.getnode() |
339 |
| - # Use uuid5, which does not depend on the clock and is |
340 |
| - # recommended over uuid3. |
341 |
| - # This is important to be able to identify a server even if |
342 |
| - # its drives have been wiped clean. |
343 |
| - # Note that this is not foolproof but we can reconcile servers |
344 |
| - # on the back-end if need be, based on mac addresses. |
345 |
| - checksData['uuid'] = uuid.uuid5(uuid.NAMESPACE_DNS, platform.node() + str(uuid.getnode())).hex |
| 348 | + checksData['uuid'] = getUuid() |
346 | 349 | self.checksLogger.debug('doChecks: added uuid %s' % checksData['uuid'])
|
347 | 350 |
|
348 | 351 | # Process the event checks.
|
|
0 commit comments