<s> """<STR_LIT>""" <EOL> import json <EOL> import sys <EOL> import subprocess <EOL> import platform <EOL> import logging <EOL> import time <EOL> from decimal import * <EOL> try : <EOL> """<STR_LIT>""" <EOL> c = subprocess . check_output ( <EOL> "<STR_LIT>" , shell = True ) . strip ( ) <EOL> if float ( c ) < <NUM_LIT:2> : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> except Exception : <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> class Proftpd ( object ) : <EOL> def __init__ ( self , agentConfig , checksLogger , rawConfig ) : <EOL> self . agentConfig = agentConfig <EOL> self . checksLogger = checksLogger <EOL> self . rawConfig = rawConfig <EOL> self . version = platform . python_version_tuple ( ) <EOL> def run ( self ) : <EOL> data = { } <EOL> if platform . system ( ) == '<STR_LIT>' : <EOL> users = [ ] <EOL> connections = [ ] <EOL> try : <EOL> e = subprocess . check_output ( <EOL> "<STR_LIT>" , shell = True ) . strip ( ) <EOL> connections = e . split ( '<STR_LIT:\n>' ) <EOL> for connection in connections : <EOL> tmpuser = connection . split ( '<STR_LIT:U+0020>' ) <EOL> if users . count ( tmpuser [ <NUM_LIT:1> ] ) == <NUM_LIT:0> : <EOL> users . append ( tmpuser [ <NUM_LIT:1> ] ) <EOL> except subprocess . CalledProcessError : <EOL> pass <EOL> data = { '<STR_LIT>' : len ( connections ) , <EOL> '<STR_LIT>' : len ( users ) } <EOL> else : <EOL> self . checks_logger . error ( <EOL> '<STR_LIT>' ) <EOL> return data <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> """<STR_LIT>""" <EOL> raw_agent_config = { <EOL> '<STR_LIT>' : { <EOL> } <EOL> } <EOL> main_checks_logger = logging . getLogger ( '<STR_LIT>' ) <EOL> main_checks_logger . setLevel ( logging . DEBUG ) <EOL> main_checks_logger . addHandler ( logging . StreamHandler ( sys . stdout ) ) <EOL> proftpd_check = Proftpd ( { } , main_checks_logger , raw_agent_config ) <EOL> while True : <EOL> try : <EOL> print json . dumps ( proftpd_check . run ( ) , indent = <NUM_LIT:4> , sort_keys = True ) <EOL> except : <EOL> main_checks_logger . exception ( "<STR_LIT>" ) <EOL> finally : <EOL> time . sleep ( <NUM_LIT> ) </s>
