def buildOptions(self): """ Build a list of command-line options """ SnmpDaemon.buildOptions(self) self.parser.add_option('--showprocs', dest='showprocs', action="store_true", default=False, help="Show the list of processes found." \ "For debugging purposes only.") self.parser.add_option('--showrawtables', dest='showrawtables', action="store_true", default=False, help="Show the raw SNMP processes data returned " \ "from the device. For debugging purposes only.")
def heartbeat(self): """ Twisted keep-alive mechanism to ensure that we're still connected to zenhub. """ self.scanning = None devices = self.devices() pids = sum(map(lambda x: len(x.pids), devices.values())) log.info("Pulled process status for %d devices and %d processes", len(devices), pids) SnmpDaemon.heartbeat(self) cycle = self.processCycleInterval self.sendEvents( self.rrdStats.counter('dataPoints', cycle, self.rrd.dataPoints) + self.rrdStats.gauge('cyclePoints', cycle, self.rrd.endCycle()) + self.rrdStats.gauge('pids', cycle, pids) + self.rrdStats.gauge('devices', cycle, len(devices)) + self.rrdStats.gauge('missing', cycle, self.missing) + self.rrdStats.gauge('restarted', cycle, self.restarted) + self.rrdStats.gauge('cycleTime', cycle, self.cycleTime))
def heartbeat(self): """ Twisted keep-alive mechanism to ensure that we're still connected to zenhub. """ self.scanning = None devices = self.devices() pids = sum(map(lambda x: len(x.pids), devices.values())) log.info("Pulled process status for %d devices and %d processes", len(devices), pids) SnmpDaemon.heartbeat(self) cycle = self.processCycleInterval self.sendEvents( self.rrdStats.counter('dataPoints', cycle, self.rrd.dataPoints) + self.rrdStats.gauge('cyclePoints', cycle, self.rrd.endCycle()) + self.rrdStats.gauge('pids', cycle, pids) + self.rrdStats.gauge('devices', cycle, len(devices)) + self.rrdStats.gauge('missing', cycle, self.missing) + self.rrdStats.gauge('restarted', cycle, self.restarted) + self.rrdStats.gauge('cycleTime', cycle, self.cycleTime) )
def __init__(self, noopts=False): SnmpDaemon.__init__(self, 'zensunprocess', noopts) self._devices = {} self.scanning = None self.downDevices = Set()