Adquio Cloud Integration.
When
Scripts generated in Adquio Cloud
The scripts added in Adquio Cloud it´s are downloaded in a single file. Each existing Adquio Cloud script is "encapsulated" within a block like this:
events.addListener({ eventName: "NewVariablesHistoric" }, async (event) => {
// The Adquio Cloud script is inserted here.
});
In this way, in Adquio Cloud, the Event object that contains information about the aggregation that the event has triggered is accessible.
The object equs
The Alert () Method generates an alert with the specific parameters, of Equus alert type and adds the Equs label automatically. If an alert with the same parameters exists and has not expired, instead of creating a new one updated the date of the existing one.
This method is equivalent to alerts.Touchorcreate () and allows to establish conditions and time of delay. The syntax is as follows:
equs.alert(name: string, value: any, expireAfterSecs: number, extra: object);
In Extra you can include the following properties equivalent to the parameters you receive alerts TouchorCreate():
- condition, delay, onConditionError y onOutOfService
- priority: if it is not set, it is
0. - tags: The
equstag is always added, it is not necessary to specify it.
The rest of extra fields will be ignored.
For example, the following code will generate an alert with text the variable has an incorrect value and valueexample#variable whenever the variable has a negative value for 2 seconds. The alert expires if it is not repeated in 500 seconds.
equs.alert('The variable has an incorrect value', 'Example#Variable', 500, {
delay: 2000,
condition: '$Example#Variable$ < 0'
})
The EqusAlert Type alerts are automatically uploaded to Equs. This allows you to automate actions such as notification by email or integration with other facilities.