karppo
karppo

Reputation: 43

Jelastic API environment create trigger data

The jelastic api environment.Trigger.AddTrigger takes "data" as parameter, but i cannot find what are all the different possible variables that i can use. Jelastic API docs just says "data : string , information about trigger". Is this "data" documented on somewhere else?

There are some JPS javascript/java examples that i have found, that are pointing me to the right direction, but more information would be nice to have.

https://github.com/jelastic-jps/magento-cluster/blob/master/scripts/addTriggers.js

https://docs.cloudscripting.com/0.99/examples/horizontal-scaling/

https://github.com/jelastic-jps/basic-examples/blob/master/automatic-horizontal-scaling/scripts/enableAutoScaling.js

Upvotes: 1

Views: 138

Answers (1)

Virtuozzo
Virtuozzo

Reputation: 1993

The environment.Trigger.AddTrigger method requires a set of the parameters:

  • name - name of a notification trigger
  • nodeGroup - target node group (you can apply trigger to any node group within the chosen environment)
  • period - load period for nodes
  • condition - rules for monitoring resources
    • type - comparison sign, the available values are GREATER and LESS
    • value - percentage of a resource that is monitored
    • resourceType - types of resources that are monitored by a trigger, namely CPU, Memory (RAM), Network, Disk I/O, and Disk IOPS
    • valueType - measurement value. Here, PERCENTAGES is the only possible measurement value. The available range is from 0 up to 100.
  • actions - object to describe a trigger action
    • type - trigger action, the available values are NOTIFY, ADD_NODE, and REMOVE_NODE
    • customData:
      • notify - alert notification sent to a user via email

The following code shows how a new trigger can be created:

{
  "type": "update",
  "name": "AddTrigger",
  "onInstall": {
    "environment.trigger.AddTrigger": {
      "data": {
        "name": "new alert",
        "nodeGroup": "sqldb",
        "period": "10",
        "condition": {
          "type": "GREATER",
          "value": "55",
          "resourceType": "MEM",
          "valueType": "PERCENTAGES"
        },
        "actions": [
          {
            "type": "NOTIFY",
            "customData": {
              "notify": false
            }
          }
        ]
      }
    }
  }
}

More information about events and other CloudScripting language features you can find here.

Upvotes: 0

Related Questions