Atomia Agents

Atomia Quota Agent

8 views 0

This manual covers the installation and configuration of the Atomia Quota Agent to enable your customers to set and view storage quota.

Overview

The Quota agent is used to:

  • request quota setup for customer account packages and mailboxes on storage servers
  • parse quota report files generated by storage servers (for packages and mailboxes)
  • expose Rest API interface to query current quota usage from storage servers

Before you begin

The Atomia Quota Agent is part of the Atomia agents package. You should start by reading the general package overview and instructions here.

Pre-installation actions

The precondition is that the machine has a MySQL database installed.

Set up MySQL

First, you need to install and do a basic MySQL setup on the server. There a lot of guides for that on the Internet.

Now create Quota DB and a new Atomia MySQL User Account. It’s recommended to create a new MySQL user with all privileges. This can be done by executing the following SQL:

CREATE DATABASE IF NOT EXISTS quota-agent;
CREATE USER 'newdbuser'@'localhost' IDENTIFIED BY 'newdbuserpassword';
GRANT ALL PRIVILEGES ON quota-agent.* TO 'newdbuser'@'localhost';

Replace the placeholder value newdbuser with your intended new user name and placeholder value newdbuserpassword with the user password. These values will be used for a config file later in the Post-installation actions section.

Post-installation actions

In order to properly function, the agent must use root Linux user. So, the first thing to change is the default agent user in the /etc/atomia/config. Open the file and replace atomia-agent with root.

Keep in mind

The default agent user change will force usage of the root Linux user for all agents installed on the server.

One more thing to do is to create and set up the agent’s configuration file. Start by copying the example config file:

sudo cp /etc/atomia/quota-agent.json.example /etc/atomia/quota-agent.json

Edit new copy and change some default properties if needed.

Example file and what each option means:

{
    "auth": {
        "username": "someauthusername",
        "password": "someauthpassword"
    },
    "db": {
        "host": "localhost",
        "port": 3306,
        "user": "newdbuser",
        "password": "newdbuserpassword",
        "name": "quota_agent"
    },
    "servers":[
        {
            "usage_folder_path": "/storage/quota_reports/reports",
            "ip": "0.0.0.0",
            "ssh_user": "some_user",
            "ssh_key": "path to public rsa",
        }
    ],
    "port": 7047,
    "host": "0.0.0.0",
    "batch_insert_size": 500,
    "usage_parsing_folder_path": "/storage/quota_reports/parsing",
    "usage_processed_folder_path": "/storage/quota_reports/processed",
    "log_path": "/var/log/atomia/quota-agent.log",
    "interval": 5,
    "parser_script": "/usr/lib/atomia/quota/quota_parser_du.py"
}
Option Meaning
auth Basic access authentication (username and password) for the atomia Quota agent
port Port of the Quota Agent REST API.
host The IP address of the machine which gonna be used for listening by the Quota agent
db Access to the MySQL database.
servers storage servers array with
servers.{i}.usage_folder_path path to a folder where quota report files will be stored before they are processed
servers.{i}.{other_option} optional parameters related to Storage API
log_path The file where should Quota agent log info and error messages.
batch_insert_size is the number of rows that will be inserted in the database with one insert command
usage_parsing_folder_path path to a folder where each file is moved before it is started with the processing of data in that file
usage_processed_folder_path path to a folder where files are moved after they are processed. File names are changed to contain timestamps at the end of the file name.
interval The interval for parsing reports (in seconds)
parser_script (optional) path to custom parser script

Changes in the Automation Server

In order to connect the Quota agent with the Atomia provisioning module, the Resource file should be updated on the server where Atomia Automation Server is installed.

Resource description

Make sure you have the following resource in the resource file (C:\Program Files (x86)\Atomia\AutomationServer\Common\Resources.xml):

<?xml version="1.0"?>
<resourceDescription xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
    <bindings>
        <moduleList>
            <module name="Atomia.Provisioning.Modules.Quota.Quota" resourceAsignmentPolicy="RoundRobin" />
        </moduleList>
        <resourceList>
            <resource name="QuotaResource">
                <property name="Username">someauthusername</property>
                <property name="Password">someauthpassword</property>
                <property name="ApiEndpoint">http://127.0.0.1:5000</property>
            </resource>
        </resourceList>
    </bindings>
</resourceDescription>

In the transformation file example above, the ApiEndpoint property should match exactly the host and port properties in the quota-agent.json file (as defined in the example at the beginning of this section). Also, the Username and Password properties should be equivalent to the corresponding fields in the auth section of the same config file.

Running the service

systemctl start atomia-quota-agent

To parse the reports you need to run

systemctl start atomia-quota-daemon

Was this helpful?