mirror of
				https://github.com/viq/NewsBlur.git
				synced 2025-11-01 09:09:16 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			39 lines
		
	
	
	
		
			1,003 B
		
	
	
	
		
			Python
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			1,003 B
		
	
	
	
		
			Python
		
	
	
		
			Executable file
		
	
	
	
	
#!/usr/bin/env python
 | 
						|
 | 
						|
from munin.gearman import MuninGearmanPlugin
 | 
						|
 | 
						|
class MuninGearmanConnectionsPlugin(MuninGearmanPlugin):
 | 
						|
    title = "Gearman Connections"
 | 
						|
    args = "--base 1000"
 | 
						|
    vlabel = "Connections"
 | 
						|
    fields = (
 | 
						|
        ('total', dict(
 | 
						|
            label = "Total",
 | 
						|
            type = "GAUGE",
 | 
						|
            draw = "LINE2",
 | 
						|
            min = "0",
 | 
						|
        )),
 | 
						|
        ('workers', dict(
 | 
						|
            label = "Workers",
 | 
						|
            type = "GAUGE",
 | 
						|
            draw = "LINE2",
 | 
						|
            min = "0",
 | 
						|
        )),
 | 
						|
        ('clients', dict(
 | 
						|
            label = "Clients",
 | 
						|
            type = "GAUGE",
 | 
						|
            draw = "LINE2",
 | 
						|
            min = "0",
 | 
						|
        )),
 | 
						|
    )
 | 
						|
 | 
						|
    def execute(self):
 | 
						|
        workers = self.get_workers()
 | 
						|
        return dict(
 | 
						|
            total = len(workers),
 | 
						|
            workers = sum(1 for x in workers if x['abilities']),
 | 
						|
            clients = sum(1 for x in workers if not x['abilities']),
 | 
						|
        )
 | 
						|
 | 
						|
if __name__ == "__main__":
 | 
						|
    MuninGearmanConnectionsPlugin().run()
 |