Fix collectd plugin
This commit is contained in:
		
							parent
							
								
									ed53d71709
								
							
						
					
					
						commit
						aacbf55f34
					
				
					 1 changed files with 6 additions and 6 deletions
				
			
		| 
						 | 
					@ -5,7 +5,7 @@ import re
 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HOSTNAME = os.getenv('COLLECTD_HOSTNAME', "localhost")
 | 
					HOSTNAME = os.getenv('COLLECTD_HOSTNAME', "localhost")
 | 
				
			||||||
INTERVAL = os.getenv('COLLECTD_INTERVAL', 60)
 | 
					INTERVAL = int(os.getenv('COLLECTD_INTERVAL', '60'))
 | 
				
			||||||
FILENAME = "/tmp/spitfire_smbspy_status.txt"
 | 
					FILENAME = "/tmp/spitfire_smbspy_status.txt"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SMB_STATUS_REGEX = re.compile(r'<b>Spitfire SMB</b> has <b>(?P<files>[0-9]+)</b> file\(s\) opened by <b>(?P<users>[0-9]+)</b> user\(s\) \(<b>(?P<active>[0-@9]+)</b> active users\)\.')
 | 
					SMB_STATUS_REGEX = re.compile(r'<b>Spitfire SMB</b> has <b>(?P<files>[0-9]+)</b> file\(s\) opened by <b>(?P<users>[0-9]+)</b> user\(s\) \(<b>(?P<active>[0-@9]+)</b> active users\)\.')
 | 
				
			||||||
| 
						 | 
					@ -48,10 +48,10 @@ while True:
 | 
				
			||||||
        if http_noopen_match:
 | 
					        if http_noopen_match:
 | 
				
			||||||
            http_current_transfers, http_current_users = 0, 0
 | 
					            http_current_transfers, http_current_users = 0, 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    print("PUTVAL \"{}/shares/smb_open_connections\" interval={} N:{}".format(HOSTNAME, INTERVAL, smb_current_users))
 | 
					    print("PUTVAL \"{}/shares/gague-smb_open_connections\" interval={} N:{}".format(HOSTNAME, INTERVAL, smb_current_users))
 | 
				
			||||||
    print("PUTVAL \"{}/shares/smb_active_users\" interval={} N:{}".format(HOSTNAME, INTERVAL, smb_active_users))
 | 
					    print("PUTVAL \"{}/shares/gague-smb_active_users\" interval={} N:{}".format(HOSTNAME, INTERVAL, smb_active_users))
 | 
				
			||||||
    print("PUTVAL \"{}/shares/smb_open_files\" interval={} N:{}".format(HOSTNAME, INTERVAL, smb_current_files))
 | 
					    print("PUTVAL \"{}/shares/gague-smb_open_files\" interval={} N:{}".format(HOSTNAME, INTERVAL, smb_current_files))
 | 
				
			||||||
    print("PUTVAL \"{}/shares/http_active_users\" interval={} N:{}".format(HOSTNAME, INTERVAL, http_current_users))
 | 
					    print("PUTVAL \"{}/shares/gague-http_active_users\" interval={} N:{}".format(HOSTNAME, INTERVAL, http_current_users))
 | 
				
			||||||
    print("PUTVAL \"{}/shares/http_open_transfers\" interval={} N:{}".format(HOSTNAME, INTERVAL, http_current_transfers))
 | 
					    print("PUTVAL \"{}/shares/gague-http_open_transfers\" interval={} N:{}".format(HOSTNAME, INTERVAL, http_current_transfers))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    time.sleep(INTERVAL)
 | 
					    time.sleep(INTERVAL)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue