Atomia Agents

Atomia Cron Job Agent (legacy)

241 views 1

This manual covers the installation and configuration of the Atomia Cron Job Agent to enable your customers to schedule regular tasks.

Overview

 

Important!

This guide is about an obsolete Atomia Cron agent (latest version 18.10.2) which will no longer get any updates. We strongly recommend that you switch to the latest atomia agents package.

The Cron Agent allows your customers to schedule regular tasks. The agent regularly accesses websites and exposes a RESTful management interface.

Before you begin

The Atomia Cron Agent must be installed on a Linux machine. The preconditions are that the machine has MongoDB installed.

Installing mongodb

First, a new source file will need to be created for apt and the needed public key added:

echo "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" > /etc/apt/sources.list.d/10gen.list
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
apt-get update

After that we can install mongodb

apt-get -y install mongodb-10gen

Installing the agent

The actual installation is done like this:

apt-get -y install atomia-cronagent

After that you need to change the config file etc/default/cronagent and configure access to the cronagent.

MONGO_HOST=localhost
MONGO_PORT=27017
MONGO_DBNAME=cronagent
CRON_LISTEN_PORT=10101
CRON_GLOBAL_AUTH_TOKEN=Chonc2908jTHoge
MIN_PART=0
MAX_PART=1000
INTERVAL=60
MAIL_HOST=172.17.12.4
MAIL_PORT=25
MAIL_USER=
MAIL_PASS=
MAIL_SSL=false
[email protected]

We will explain the individual configuration options here:

OPTION MEANING
MONGO_* Access to the mongodb. The default values are fine if mongo is installed locally.
CRON_LISTEN_PORT Port for the management interface to listen on. Default is 10101.
CRON_GLOBAL_AUTH_TOKEN Token to authenticate to the management interface. The same token needs to be inserted on the Automation Server side.
MIN_PART, MAX_PART These values are used to balance the load between the different machines. Every taks is assigned a random number between 0 and 1000 (inclusive) and is only executed on the agent in which part range it falls. So for example if you wanted to balance the load between two machines you could set the part to 0-499 on machine 1 and 500-1000 on machine 2.
INTERVAL How often the cron agent should check if cron tasks are due (in seconds). Note that this does not affect how often the actual tasks are running.
MAIL_* Access to the SMTP server. User and password are optional.
MAIL_FROM The sender address of mails sent to customers from the cron agent.

Finally we can start the service

/etc/init.d/atomia-cronagent restart

Changes in the Automation Server

The cronagent module is part of the CloudHostingModules. The GUI is part of HCP.

Add resource

A new resource needs to be added:

  <bindings>
    <moduleList>
      <module name="Atomia.Provisioning.Modules.CronAgent.CronAgent" resourceAsignmentPolicy="RoundRobin" />
    </moduleList>
    <resourceList>
      <resource name="CronAgent01">
        <property name="CronBaseUrl">http://{IP}:10101</property>
        <property name="AuthToken">Chonc2908jTHoge</property>
      </resource>
    </resourceList>
  </bindings>

Provisioning Description

Then you need to copy the CronTasks simple service description from the Default Provisioning description to the provisioning description. Finally, the cron task can be added to the premium package:

<package name="PremiumPackage">
        <serviceList>
          ...
          <service name="CronTasks" />
        </serviceList>

Was this helpful?