<commit_before>import connection
import logback

class Server():
    '''
    Wrapper class for a server connection. Meant to be passed around to the info panels. There are
    a couple of default server information methods available. 
    '''
    def __init__(self,config):
        '''
        Arguments:
        The configuration.
        '''
        self.config = config

        self.hostname = config['name']
        self.address = config['address']
        self.username = config['auth']['username']
        self.password = config['auth']['password']

        self.con = connection.Connection(self.address,self.username,self.password,self.hostname)
        
    def getHostName(self):
        return self.hostname

    def getAddress(self):
        return self.con.addr

    def getIsUp(self):
        value = self.con.simple_command('ps -aux | grep "java"')
        if "uportal" in value:
            return True
        return False

    def getUpTime(self):
        value = self.con.simple_command("uptime")
        return value

    def getMemory(self):
        value = self.con.simple_command("free -m")
        return value<commit_msg>Found a new way to find out if the server is up.<commit_after>import connection
import logback

class Server():
    '''
    Wrapper class for a server connection. Meant to be passed around to the info panels. There are
    a couple of default server information methods available. 
    '''
    def __init__(self,config):
        '''
        Arguments:
        The configuration.
        '''
        self.config = config

        self.hostname = config['name']
        self.address = config['address']
        self.username = config['auth']['username']
        self.password = config['auth']['password']

        self.con = connection.Connection(self.address,self.username,self.password,self.hostname)
        
    def getHostName(self):
        return self.hostname

    def getAddress(self):
        return self.con.addr

    def getIsUp(self):
        value = self.con.simple_command(' ps -ef | grep "dynatrace" | grep -v grep |awk \'{print $2}\'')
        print(value)
        if value:
            return True
        return False

    def getUpTime(self):
        value = self.con.simple_command("uptime")
        return value

    def getMemory(self):
        value = self.con.simple_command("free -m")
        return value
{'fraction_non_alphanumeric': 0.10568421052631578, 'fraction_numerical': 0.0004210526315789474, 'mean_word_length': 2.3045897079276774, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4748229', 'n_tokens_mistral': 646, 'n_tokens_neox': 628, 'n_words': 184}