def main(): sys.exit(muninMain(MuninPHPfpmPlugin))
net_info = NetstatInfo() if self.hasGraph('netstat_conn_status'): stats = net_info.getTCPportConnStatus(include_listen=True) for fname in ( 'listen', 'established', 'syn_sent', 'syn_recv', 'fin_wait1', 'fin_wait2', 'time_wait', 'close', 'close_wait', 'last_ack', 'closing', 'unknown', ): self.setGraphVal('netstat_conn_status', fname, stats.get(fname, 0)) if self.hasGraph('netstat_conn_server'): stats = net_info.getTCPportConnCount(localport=self._port_list) for srv in self._srv_list: numconn = 0 for port in self._srv_dict[srv]: numconn += stats.get(port, 0) self.setGraphVal('netstat_conn_server', srv, numconn) if __name__ == "__main__": sys.exit(muninMain(MuninNetstatsPlugin))
def main(): sys.exit(muninMain(MuninNetstatsPlugin))
def main(): sys.exit(muninMain(MuninDiskIOplugin))
def main(): sys.exit(muninMain(MuninApachePlugin))
abandon = (stats.get('calls_abandoned', 0) - prev_stats.get('calls_abandoned', 0)) answer = (stats.get('calls_completed', 0) - prev_stats.get('calls_completed', 0)) if answer >= 0 and abandon >= 0: total = abandon + answer if total > 0: val = 100.0 * float(abandon) / float(total) self.setGraphVal('asterisk_queue_abandon_pcent', queue, val) if self.hasGraph('asterisk_queue_calls'): self.setGraphVal('asterisk_queue_calls', 'abandon', total_abandon) self.setGraphVal('asterisk_queue_calls', 'answer', total_answer) if self._fax_stats is not None: if self.hasGraph('asterisk_fax_attempts'): stats = self._fax_stats.get('general') if stats is not None: self.setGraphVal('asterisk_fax_attempts', 'send', stats.get('transmit attempts')) self.setGraphVal('asterisk_fax_attempts', 'recv', stats.get('receive attempts')) self.setGraphVal('asterisk_fax_attempts', 'fail', stats.get('failed faxes')) if __name__ == "__main__": sys.exit(muninMain(MuninAsteriskPlugin))
info='NTP Delays of Multiple Hosts relative to current node.', args='--base 1000 --lower-limit 0', vlabel='seconds') for host in self._remoteHosts: hostkey = re.sub('\.', '_', host) graph.addField(hostkey, host, type='GAUGE', draw='LINE2') self.appendGraph('ntp_host_delays', graph) def retrieveVals(self): """Retrieve values for graphs.""" ntpinfo = NTPinfo() ntpstats = ntpinfo.getHostOffsets(self._remoteHosts) if ntpstats: for host in self._remoteHosts: hostkey = re.sub('\.', '_', host) hoststats = ntpstats.get(host) if hoststats: if self.hasGraph('ntp_host_stratums'): self.setGraphVal('ntp_host_stratums', hostkey, hoststats.get('stratum')) if self.hasGraph('ntp_host_offsets'): self.setGraphVal('ntp_host_offsets', hostkey, hoststats.get('offset')) if self.hasGraph('ntp_host_delays'): self.setGraphVal('ntp_host_delays', hostkey, hoststats.get('delay')) if __name__ == "__main__": sys.exit(muninMain(MuninNTPhostOffsetsPlugin))
if (self.graphEnabled('wanpipe_pri_errors') or self.graphEnabled('wanpipe_rxlevel')): try: stats = self._wanpipeInfo.getPRIstats(iface) except: stats = None if stats: graph_name = 'wanpipe_pri_errors_%s' % iface if self.hasGraph(graph_name): for field in ('linecodeviolation', 'farendblockerrors', 'crc4errors', 'faserrors'): self.setGraphVal(graph_name, field, stats.get(field)) if self.hasGraph('wanpipe_rxlevel'): self.setGraphVal('wanpipe_pri_rxlevel', iface, stats.get('rxlevel')) def ifaceIncluded(self, iface): """Utility method to check if interface is included in monitoring. @param iface: Interface name. @return: Returns True if included in graphs, False otherwise. """ return self.envCheckFilter('ifaces', iface) if __name__ == "__main__": sys.exit(muninMain(MuninWanpipePlugin))
'PHP Fast Process Manager (FPM) - Active / Idle Processes.', args='--base 1000 --lower-limit 0') graph.addField('active', 'active', draw='AREASTACK', type='GAUGE') graph.addField('idle', 'idle', draw='AREASTACK', type='GAUGE') graph.addField('total', 'total', draw='LINE2', type='GAUGE', colour='000000') self.appendGraph('php_fpm_processes', graph) def retrieveVals(self): """Retrieve values for graphs.""" fpminfo = PHPfpmInfo(self._host, self._port, self._user, self._password, self._monpath, self._ssl) stats = fpminfo.getStats() if self.hasGraph('php_fpm_connections') and stats: self.setGraphVal('php_fpm_connections', 'conn', stats['accepted conn']) if self.hasGraph('php_fpm_processes') and stats: self.setGraphVal('php_fpm_processes', 'active', stats['active processes']) self.setGraphVal('php_fpm_processes', 'idle', stats['idle processes']) self.setGraphVal('php_fpm_processes', 'total', stats['total processes']) if __name__ == "__main__": sys.exit(muninMain(MuninPHPfpmPlugin))
def main(): sys.exit(muninMain(MuninCgminerPlugin))
def main(): sys.exit(muninMain(MuninActiveMQPlugin))
def main(): sys.exit(muninMain(MuninDiskUsagePlugin))
def main(): sys.exit(muninMain(MuninPHPZopPlugin))
def main(): sys.exit(muninMain(MuninTomcatPlugin))
def main(): sys.exit(muninMain(RedisPlugin))
def main(): sys.exit(muninMain(MuninLighttpdPlugin))
def main(): sys.exit(muninMain(MuninMemcachedPlugin))
negative='rxfifo', info='Rx(-)/Tx(+) FIFO Errors per second.') self.appendGraph('netiface_errors_%s' % iface, graph) def retrieveVals(self): """Retrieve values for graphs.""" for iface in self._ifaceList: stats = self._ifaceStats.get(iface) graph_name = 'netiface_traffic_%s' % iface if self.hasGraph(graph_name): self.setGraphVal(graph_name, 'rx', stats.get('rxbytes') * 8) self.setGraphVal(graph_name, 'tx', stats.get('txbytes') * 8) graph_name = 'netiface_errors_%s' % iface if self.hasGraph(graph_name): for field in ('rxerrs', 'txerrs', 'rxframe', 'txcarrier', 'rxdrop', 'txdrop', 'rxfifo', 'txfifo'): self.setGraphVal(graph_name, field, stats.get(field)) def ifaceIncluded(self, iface): """Utility method to check if interface is included in monitoring. @param iface: Interface name. @return: Returns True if included in graphs, False otherwise. """ return self.envCheckFilter('ifaces', iface) if __name__ == "__main__": sys.exit(muninMain(MuninNetIfacePlugin))
def main(): sys.exit(muninMain(MuninAsteriskPlugin))
def main(): sys.exit(muninMain(MuninPHPOPCPlugin))
def main(): sys.exit(muninMain(MuninVoyagerPlugin))
def main(): sys.exit(muninMain(MuninBoincCreditPlugin))
def main(): sys.exit(muninMain(MuninPgPlugin))
def main(): sys.exit(muninMain(MuninMySQLplugin))
def main(): sys.exit(muninMain(MuninSupervisordProcessStatsPlugin))
def main(): sys.exit(muninMain(MuninPiHolePlugin))
def main(): sys.exit(muninMain(MuninNTPstatsPlugin))
def main(): sys.exit(muninMain(MuninPHPapcPlugin))
def main(): sys.exit(muninMain(MuninProcStatsPlugin))
'idle', draw='AREASTACK', type='GAUGE', info="Number of idle workers.") graph.addField('max', 'max', draw='LINE2', type='GAUGE', info="Maximum number of workers permitted.", colour='FF0000') self.appendGraph('apache_workers', graph) def retrieveVals(self): """Retrieve values for graphs.""" apacheInfo = ApacheInfo(self._host, self._port, self._user, self._password, self._statuspath, self._ssl) stats = apacheInfo.getServerStats() if self.hasGraph('apache_access'): self.setGraphVal('apache_access', 'reqs', stats['Total Accesses']) if self.hasGraph('apache_bytes'): self.setGraphVal('apache_bytes', 'bytes', stats['Total kBytes'] * 1000) if self.hasGraph('apache_workers'): self.setGraphVal('apache_workers', 'busy', stats['BusyWorkers']) self.setGraphVal('apache_workers', 'idle', stats['IdleWorkers']) self.setGraphVal('apache_workers', 'max', stats['MaxWorkers']) if __name__ == "__main__": sys.exit(muninMain(MuninApachePlugin))
def main(): sys.exit(muninMain(MuninFritzPlugin, debug=True))
def main(): sys.exit(muninMain(MuninNetIfacePlugin))
def main(): sys.exit(muninMain(MuninSysStatsPlugin))
def main(): sys.exit(muninMain(MuninRackspacePlugin))
stats['connections']) if self.hasGraph('nginx_connections'): self.setGraphVal('nginx_connections', 'handled', stats['handled']) self.setGraphVal('nginx_connections', 'nothandled', stats['accepts'] - stats['handled']) if self.hasGraph('nginx_requests'): self.setGraphVal('nginx_requests', 'requests', stats['requests']) if self.hasGraph('nginx_requestsperconn'): curr_stats = (stats['handled'], stats['requests']) hist_stats = self.restoreState() if hist_stats: prev_stats = hist_stats[0] else: hist_stats = [] prev_stats = (0, 0) conns = max(curr_stats[0] - prev_stats[0], 0) reqs = max(curr_stats[1] - prev_stats[1], 0) if conns > 0: self.setGraphVal('nginx_requestsperconn', 'requests', float(reqs) / float(conns)) else: self.setGraphVal('nginx_requestsperconn', 'requests', 0) hist_stats.append(curr_stats) self.saveState(hist_stats[-self._numSamples:]) if __name__ == "__main__": sys.exit(muninMain(MuninNginxPlugin))
info='FreeSWITCH - Number of Active Calls.', args='--base 1000 --lower-limit 0') graph.addField('calls', 'calls', type='GAUGE', draw='LINE2', info='Active Calls') self.appendGraph('fs_calls', graph) if self.graphEnabled('fs_channels'): graph = MuninGraph('FreeSWITCH - Active Channels', 'FreeSWITCH', info='FreeSWITCH - Number of Active Channels.', args='--base 1000 --lower-limit 0') graph.addField('channels', 'channels', type='GAUGE', draw='LINE2') self.appendGraph('fs_channels', graph) def retrieveVals(self): """Retrieve values for graphs.""" fs = FSinfo(self._fshost, self._fsport, self._fspass) if self.hasGraph('fs_calls'): count = fs.getCallCount() self.setGraphVal('fs_calls', 'calls', count) if self.hasGraph('fs_channels'): count = fs.getChannelCount() self.setGraphVal('fs_channels', 'channels', count) if __name__ == "__main__": sys.exit(muninMain(MuninFreeswitchPlugin))
def main(): sys.exit(muninMain(MuninVarnishPlugin))
stats = self._dbconn.getBgWriterStats() self.setGraphVal('pg_checkpoints', 'req', stats.get('checkpoints_req')) self.setGraphVal('pg_checkpoints', 'timed', stats.get('checkpoints_timed')) if self.hasGraph('pg_bgwriter'): if stats is None: stats = self._dbconn.getBgWriterStats() self.setGraphVal('pg_bgwriter', 'backend', stats.get('buffers_backend')) self.setGraphVal('pg_bgwriter', 'clean', stats.get('buffers_clean')) self.setGraphVal('pg_bgwriter', 'chkpoint', stats.get('buffers_checkpoint')) def dbIncluded(self, name): """Utility method to check if database is included in graphs. @param name: Name of database. @return: Returns True if included in graphs, False otherwise. """ return self.envCheckFilter('db', name) if __name__ == "__main__": sys.exit(muninMain(MuninPgPlugin))
def main(): sys.exit(muninMain(MuninNTPhostOffsetPlugin))
args='--base 1000 --lower-limit 0', vlabel='seconds' ) for host in self._remoteHosts: hostkey = re.sub('\.', '_', host) graph.addField(hostkey, host, type='GAUGE', draw='LINE2') self.appendGraph('ntp_host_delays', graph) def retrieveVals(self): """Retrive values for graphs.""" ntpinfo = NTPinfo() ntpstats = ntpinfo.getHostOffsets(self._remoteHosts) if ntpstats: for host in self._remoteHosts: hostkey = re.sub('\.', '_', host) hoststats = ntpstats.get(host) if hoststats: if self.hasGraph('ntp_host_stratums'): self.setGraphVal('ntp_host_stratums', hostkey, hoststats.get('stratum')) if self.hasGraph('ntp_host_offsets'): self.setGraphVal('ntp_host_offsets', hostkey, hoststats.get('offset')) if self.hasGraph('ntp_host_delays'): self.setGraphVal('ntp_host_delays', hostkey, hoststats.get('delay')) if __name__ == "__main__": sys.exit(muninMain(MuninNTPhostOffsetsPlugin))
if self.dbIncluded(db): if self.hasGraph('pg_blockread_detail'): self.setGraphVal('pg_blockread_detail', db, dbstats['blks_hit'] + dbstats['blks_read']) for (graph_name, attr_name) in ( ('pg_xact_commit_detail', 'xact_commit'), ('pg_xact_rollback_detail', 'xact_rollback'), ('pg_tup_return_detail', 'tup_returned'), ('pg_tup_fetch_detail', 'tup_fetched'), ('pg_tup_delete_detail', 'tup_deleted'), ('pg_tup_update_detail', 'tup_updated'), ('pg_tup_insert_detail', 'tup_inserted'), ): if self.hasGraph(graph_name): self.setGraphVal(graph_name, db, dbstats[attr_name]) def dbIncluded(self, name): """Utility method to check if database is included in graphs. @param name: Name of database. @return: Returns True if included in graphs, False otherwise. """ return self.envCheckFilter('db', name) if __name__ == "__main__": sys.exit(muninMain(MuninPgPlugin))
def main(): sys.exit(muninMain(MuninNginxPlugin))
self.setGraphVal(name, 'max', thrstats['maxThreads']) name = "tomcat_access_%d" % port if self.hasGraph(name): self.setGraphVal(name, 'reqs', reqstats['requestCount']) name = "tomcat_error_%d" % port if self.hasGraph(name): self.setGraphVal(name, 'errors', reqstats['errorCount']) name = "tomcat_traffic_%d" % port if self.hasGraph(name): self.setGraphVal(name, 'rx', reqstats['bytesReceived']) self.setGraphVal(name, 'tx', reqstats['bytesSent']) # name = "tomcat_cputime_%d" % port # if self.hasGraph(name): # self.setGraphVal(name, 'cpu', # int(reqstats['processingTime'] * 1000)) def portIncluded(self, port): """Utility method to check if connector port is included in monitoring. @param port: Port number. @return: Returns True if included in graphs, False otherwise. """ return self.envCheckFilter('ports', str(port)) if __name__ == "__main__": sys.exit(muninMain(MuninTomcatPlugin))
"txdrop", "rxfifo", "txfifo", ): self.setGraphVal(graph_name, field, stats.get(field)) if self.graphEnabled("wanpipe_pri_errors") or self.graphEnabled("wanpipe_rxlevel"): try: stats = self._wanpipeInfo.getPRIstats(iface) except: stats = None if stats: graph_name = "wanpipe_pri_errors_%s" % iface if self.hasGraph(graph_name): for field in ("linecodeviolation", "farendblockerrors", "crc4errors", "faserrors"): self.setGraphVal(graph_name, field, stats.get(field)) if self.hasGraph("wanpipe_rxlevel"): self.setGraphVal("wanpipe_pri_rxlevel", iface, stats.get("rxlevel")) def ifaceIncluded(self, iface): """Utility method to check if interface is included in monitoring. @param iface: Interface name. @return: Returns True if included in graphs, False otherwise. """ return self.envCheckFilter("ifaces", iface) if __name__ == "__main__": sys.exit(muninMain(MuninWanpipePlugin))
if self.graphEnabled('ntp_peer_stats'): graph = MuninGraph('NTP Timing Stats for System Peer', 'Time', info='Timing Stats for the NTP Server the system is in sync with.', args='--base 1000 --lower-limit 0', vlabel='seconds' ) graph.addField('offset', 'offset', type='GAUGE', draw='LINE2') graph.addField('delay', 'delay', type='GAUGE', draw='LINE2') graph.addField('jitter', 'jitter', type='GAUGE', draw='LINE2') self.appendGraph('ntp_peer_stats', graph) def retrieveVals(self): """Retrieve values for graphs.""" ntpinfo = NTPinfo() stats = ntpinfo.getPeerStats() if stats: if self.hasGraph('ntp_peer_stratum'): self.setGraphVal('ntp_peer_stratum', 'stratum', stats.get('stratum')) if self.hasGraph('ntp_peer_stats'): self.setGraphVal('ntp_peer_stats', 'offset', stats.get('offset')) self.setGraphVal('ntp_peer_stats', 'delay', stats.get('delay')) self.setGraphVal('ntp_peer_stats', 'jitter', stats.get('jitter')) if __name__ == "__main__": sys.exit(muninMain(MuninNTPstatsPlugin))
"FreeSwitch", info="FreeSWITCH - Number of Active Calls.", args="--base 1000 --lower-limit 0", ) graph.addField("calls", "calls", type="GAUGE", draw="LINE2", info="Active Calls") self.appendGraph("fs_calls", graph) if self.graphEnabled("fs_channels"): graph = MuninGraph( "FreeSWITCH - Active Channels", "FreeSWITCH", info="FreeSWITCH - Number of Active Channels.", args="--base 1000 --lower-limit 0", ) graph.addField("channels", "channels", type="GAUGE", draw="LINE2") self.appendGraph("fs_channels", graph) def retrieveVals(self): """Retrieve values for graphs.""" fs = FSinfo(self._fshost, self._fsport, self._fspass) if self.hasGraph("fs_calls"): count = fs.getCallCount() self.setGraphVal("fs_calls", "calls", count) if self.hasGraph("fs_channels"): count = fs.getChannelCount() self.setGraphVal("fs_channels", "channels", count) if __name__ == "__main__": sys.exit(muninMain(MuninFreeswitchPlugin))
self.setGraphVal('mysql_tablelocks', 'immediate', self._genStats.get('Table_locks_immediate')) if self.hasGraph('mysql_threads'): if self._genStats is None: self._genStats = self._dbconn.getStats() self.setGraphVal('mysql_threads', 'running', self._genStats.get('Threads_running')) self.setGraphVal( 'mysql_threads', 'idle', self._genStats.get('Threads_connected') - self._genStats.get('Threads_running')) self.setGraphVal('mysql_threads', 'cached', self._genStats.get('Threads_cached')) self.setGraphVal( 'mysql_threads', 'total', self._genStats.get('Threads_connected') + self._genStats.get('Threads_cached')) def engineIncluded(self, name): """Utility method to check if a storage engine is included in graphs. @param name: Name of storage engine. @return: Returns True if included in graphs, False otherwise. """ return self.envCheckFilter('engine', name) if __name__ == "__main__": sys.exit(muninMain(MuninMySQLplugin))