コード例 #1
0
def home():
    """Display api data on home page.

    Args:
        None

    Returns:
        None

    """
    # Initialize key variables
    agent_name = 'linux_passive'

    # Get configuration
    config = jm_configuration.ConfigAgent(agent_name)

    # Get hostname
    hostname = socket.getfqdn()

    # Initialize key variables
    agent = Agent.Agent(config, hostname)

    # Update agent with linux data
    data_linux.getall(agent)

    # Return
    data_dict = agent.polled_data()
    data = json.dumps(data_dict)
    return data
コード例 #2
0
ファイル: _infoset.py プロジェクト: UWICompSociety/infoset
    def upload(self):
        """Post system data to the central server.

        Args:
            None

        Returns:
            None

        """
        # Get hostname
        hostname = socket.getfqdn()

        # Initialize key variables
        agent = Agent.Agent(self.config, hostname)

        # Update agent with linux data
        data_linux.getall(agent)

        # Post data
        success = agent.post()

        # Purge cache if success is True
        if success is True:
            agent.purge()