Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This app enables you to execute commands when The Abiquo Events Catcher (eventscatcher) lets you run commands when Abiquo generates a new event of a concrete specific type is generated by Abiquo. This allows. So, for example, you can send an email when an user performs a login.a user logs in.

Info

To obtain the Abiquo Events Catcher app, please contact Abiquo Customer Service

You can use the API to know find out the current event types https://wiki.abiquo.com/api/latest/with this method: EventsResource.html#list-events-types. And the Abiquo wiki lists Events in the Events table.

Usage

Code Block
languagebash
 --api-endpoint (-ae) VAL     : Abiquo API URL to connect
 --api-password (-ap) VAL     : Abiquo API password
 --api-username (-au) VAL     : Abiquo API username
 --api-version (-av) VAL      : Override Abiquo version on API requests (default: current version)
 --database-file (-df) VAL    : Event-catcher Database file (default: ./catcherdb)
 --fetch-interval (-fi) N     : Fetch interval in minutes (default: 10)
 --first-fetch-delay (-ffd) N : Delay of first event fetch in minutes (default: 0)
 --first-fetch-range (-ffr) N : First fetch range in minutes (default: 60)
 --receivers-file (-rf) VAL   : Receivers INI file (default: ./receivers.ini)

How to configure catchers

It looks by default for By default, eventscatcher will try to read the receivers.ini file in the current working directory (CWD. An example:). The following is a sample file.

Code Block
[example-catch-1]
actions=TAGS_SYNC, LOGIN
command=echo.sh

[example-cath-2]
actions=LOGIN
command=sendemail.sh

Note that you can add as many catchers as you like.

Each command defined will executed by events-catcher be run by eventscatcher with the following arguments:

...

Code Block
languagebash
> sh echo.sh "event_json" "entity_json"

Deployment

Create the working folder at /opt/abiquo/eventscatcher that contains :the following.

  • The app: eventscatcher.jar

  • The receivers config file: receivers.ini

  • The bash scripts for the commands (like : such as echo.sh, sendemail.sh, or your own scripts)

Add a new service to systemd to run eventscatcher.

Let's To create a new file called /etc/systemd/system/eventscatcher.service:

Code Block
    [Unit]
    Description=Abiquo eventscatcher systemd service
    After=network.target

    [Service]
    Type=simple
    User=tomcat
    WorkingDirectory=/opt/abiquo/eventscatcher
    ExecStart=/bin/java -jar /opt/abiquo/eventscatcher/eventscatcher.jar --api-endpoint {api.endpoint} --api-username {api.username} --api-password {api.password}

    [Install]
    WantedBy=multi-user.target

You will need to:

  • Set the actual username after User= (make sure that the user has permissions on to work in the /opt/abiquo/eventscatcher folder)

  • Set the proper app args after --api-endpoint, --api-username and --api-password

  • Set the correct java binary after ExecStart

Just execute:Then run the following commands.

  • systemctl start eventscatcher.service to start the service

  • systemctl status eventscatcher.service to check the status

  • systemctl enable eventscatcher.service to start service on boot

Logging

There are two logs the current working directory:

  • The app app’s general log in CWD and , which is named eventscatcher.log

  • The command executions log in CWD and name running log, which is named eventscatcher-executions.log