Event System

The Event System is a way to execute arbitary actions based on events. They exist to give administrators the ability to extend the system beyond the normal feature scope with things they want to implement which do not find the way into the core product since they are either to implementation-dependend/deployment-specific or are just not needed by other customers.

Events are defined in a Graph and follow a typical flow that is as follows: Event -> Modify -> Action where β€œEvent” can be from the list of Events, β€œModify” is a series of none to any so called Enrichers and β€œAction” is from the list of implemented Actions.

Event Flows can be exported to JSON and imported from JSON, enabling easier debugging and sharing along the community.

Create a new Flow

When you create a new flow you can just start adding nodes after opening the page. You want to start with a trigger, which is a event, then add your filters and enrichers (which are both enrichers) and then conclude with your desired action. Note, there can only be one trigger, but from there on any connection will be executed on order. All nodes have only one input on the left side. They can also be only connected to a single output, so adding two outputs to a single input will cause the flow to fail.

Screenshot_20240223_180025.png

Templating

Whenever you can enter a text freely, you have the option to use templating. Templating replaces a predetermined string inside a string with something else, most likely coming from the data of you events. String templates are started with {{ and end with }}.

For example, imagine you have the following fields available: id, email, name. You can use {{name}} to get the name, for example for sending emails. If you have nested fields, like response.vlan.id from an API fetched with the REST Enricher, you can use {{response.vlan.id}}.

Events

Currently the following events are implemented:

Server:

  • created
  • start
  • stop
  • restart

Note: server start won’t be fired when a new server is ordered

Account:

  • updated user information
  • registration
  • login
  • balance added (except if from admin)
  • balance removed (except if from admin)

Event Log:

  • entry created

Each event has different output fields, which can be take from the reference table at the bottom here.

Enrichers

The following enrichers are currently available:

  • Filter
  • Add Field
  • Default Enricher
  • REST Resource
  • Load Tags
  • IPAM

Filter

Filter component

The filter components purpose is to filter out things if you want to execute an action depending on a condition. This can be anything, from congratulating the 100th user or only do something when the user’s email is someone explicit.

Inputs:
  • Field: the field you want to do an operation on.
  • Operation: the operation you want to execute, like you want to do a comparision, use =.
  • Value: the value you want to check against.
Outputs:
  • The top output is the true-case of the comparision. It’ll output the input fields.
  • The bottom output if for the false-case, but also outputs all the input fields - in case you want to do something with it.
When the input-fied is part of an array only the first matched array-element will be returned.

Default Enricher

The default enricher allows you to add additional data that lifes in the database, like joining a user to a server or joining charges to a server. Default Enricher

Inputs:
  • From: the database table you want to query.
  • Input Field: the field from the previous stage you want to use for the join.
  • Join Field: the field in the database where you want to join with.
  • As Field: the field where the result will be saved in
Outputs:

The input fields but an additional field with the name from the as-field where the result of the query is saved.

REST

The REST module allows you to load data from an external resource. This might be controlled by you to get information about something that’s not included in the current dataset. REST Enricher

Inputs:
  • URL: the URL where you want to send a request to
  • Request Method: the HTTP Method you want to use for the request
  • Example Response: copy & paste an example JSON response here. This is required to populate the fields for the next stage
  • As field: the field where the response will be saved in.
Outputs:

All input fields but with the added as-field and the fields from the response json.

Load Tags

The Load Tags enricher allows you to load tags to a resource

Inputs:
  • For: which resource type do you want to load the tags for
  • Input Field: the id field used for the loading
  • As field: the field where the response will be saved in.
Outputs:

An array of tags.

IPAM

Allows you to allocate an IPAM IP

Inputs:
  • From: IPv4 or IPv6
  • Node: the node (optional)
  • User ID: the userid (optional)
  • As field: the field where the new IP will be saved in
Outputs:

a free IPAM IP that can be used in the modify-server Assign IP.

Actions

Actions are supposed to do something, which can be any arbitary action.

The following actions are currently implemented:

  • Send Mail
  • Webhook
  • Create Ticket
  • Modify Server

Send Mail

Inputs
  • To: whom to send the E-Mail to.
  • Subject: the subject of the message.
  • Content: the content of the message.

Webhook

Inputs
  • URL: the URL to request.
  • Method: the HTTP method to use for the request
  • Content-Type: content-type of the request
  • Content: content of the request.

Use Content-Type text/plain if you don’t want to json-encode your payload.

Create Ticket

Inputs
  • Title: the title.
  • Priority: the assigned priority.
  • Creator ID: the ID of the user who will be the ticket author.
  • Content: the content of the first message in the ticket.

Modify Server

Inputs
  • Server ID: the ID of the server to modify
  • Component:
    • General
    • Network
    • High Availability
  • Actions:
    • General:
      • Set note (update the note on the server)
      • Set hostname (set the hostname of the server)
    • Network:
      • Change VLAN-Tag: update the VLAN Tag of the network interface with the lowest number (e.g. net1 before net2).
      • Change Rate-Limit: change the speed of the network interface
      • Assign IPv4:
        • IPv4 ID: IPAM ID of an IP
      • Assign IPv6;
        • IPv6 ID: IPAM ID of an IP
    • High Availability:
      • HA Status:
        • Group (HA Fencing group)
        • Max Relocates
        • Max Restarts

Event Outputs

Server Events:

variable description
id database id
vmid vmid from Proxmox
userid the id of the user who owns the server
hostname hostname of the server
cpu amount of cpu cores
ram amount of memory
disk disksize in GB
os the text-name of the operating system
ip ipv4
ip6 ipv6
node Proxmox node the server is deployed on
createdAt timestamp when the server was created
deletedAt if deleted, holds the timestamp when the server was deleted
nextPayment when the next payment is due
paymentReminderSent timestamp of the last payment reminder
packageId if created from a package, this holds the packages id
status current status of the server online, offline, starting, stopping, restarting, suspended
cancelledAt if the server is cancelled, this holds the timestamp
charges.id the id of the charge
charges.serverId database id of the server
charges.amount amount of the charge
charges.description text-description of the charge
charges.serverType s or c - s for qemu server, c for containers

User Events:

variable description
id database id
name display name
email users email
password password hash
register the account creation date
permission permission level 1 = customer, 2 = supporter, 3 = admin
confirmationToken when confirmations are enabled, this holds the token

Balance Events:

variable description
id database id of the balance entry
userid the userid
balance the balance the user currently has

Event Log Events:

variable description
level 1 = info, 2 = warning, 3 = error
message the translated message
rawMessage the raw message

Database Enricher Outputs

Server:

variable description
id database id
vmid vmid from Proxmox
userid the id of the user who owns the server
hostname hostname of the server
cpu amount of cpu cores
ram amount of memory
disk disksize in GB
os the text-name of the operating system
ip id of the IPv4 Adresses table
ip6 id of the IPv6 Adresses table
node Proxmox node the server is deployed on
createdAt timestamp when the server was created
deletedAt if deleted, holds the timestamp when the server was deleted
nextPayment when the next payment is due
paymentReminderSent timestamp of the last payment reminder
packageId if created from a package, this holds the packages id
status current status of the server online, offline, starting, stopping, restarting, suspended
cancelledAt if the server is cancelled, this holds the timestamp

User:

variable description
id database id
username display name
email users email
password password hash
register the account creation date
permission permission level 1 = customer, 2 = supporter, 3 = admin
confirmationToken when confirmations are enabled, this holds the token

Balance:

variable description
id database id of the balance entry
userid the userid
balance the balance the user currently has

Charges:

variable description
id the id of the charge
price the price
type
calcType 1 = fixed, 2 = percentage
calcOnly if 1 is only applied during the calculation but not displayed to the user
osid the vmid of the proxmox template when type = 2
recurring if the charge is only applied once
description text description set by admin
active if the charge is currently active or not

Packages:

variable description
id the id of the charge
name name of the package
price price
cpu number of cores
ram amount of memory in MB
disk disk size in GB
meta key-value list of attributes
type 1 = free os-choice, 2 = fixed os
templateId linked Proxmox template if type = 2

Templates:

variable description
id database id
vmid linked Proxmox VMID
displayName overwritte display name
defaultUser default user for cloud-init
defaultDrive the default drive used for cloud-init
minDisk minimal disk size
minCpu minimal amount of CPU cores
minRAM minimal amount of memory
disabled 1 if the template is currently disabled

IPv4 Addresses:

variable description
id database id
ip the IP
fk_ipam id of the IPv4 IPAM Range
mac optionally set mac-address
in_use 1 = in use, 0 = not in use

IPv4 IPAM Ranges:

variable description
id database id
start first address of the range
end last address of the range
subnet the subnet e.g: 24
gateway gateway IP of the subnet
scope scope of the range: global, node or user
nodes list of nodes ,-seperated if scope = node
createdAt when the range was created
userId id of the user if scope = user

IPv6 Addresses:

variable description
id database id
ip the IP
fk_ipam id of the IPv4 IPAM Range
mac optionally set mac-address
in_use 1 = in use, 0 = not in use

IPv6 IPAM Ranges:

variable description
id database id
network the network (e.g. 2a01:4f9:3a:1014::)
prefix size of the subne (e.g. 56)
target target size of subnet-splitting (e.g. 64)
gateway gateway IP of the subnet (e.g. 2a01:4f9:3a:1014::1)
scope scope of the range: global, node or user
nodes list of nodes ,-seperated if scope = node
createdAt when the range was created
userId id of the user if scope = user
support

Do you require help?

Wether you have encountered a Bug, ran into a problem setting something up or require generall assistance using some of the features, we want to help you with that.

On our Discord-Server you can ask for help of any kind, suggest new ideas for our products or just hangout and chat!

Open Discord