# Alarm Functions

Alarm functions allow you to manage alarms on the inSCADA platform with script/expression. With these functions you can start, stop and check the status of alarms.

## Get Alarm Status

#### ins.getAlarmStatus(String alarmName) <a href="#ins-getalarmstatus-string-alarmname" id="ins-getalarmstatus-string-alarmname"></a>

Provides information about the status of an alarm.

alarmName: The alarm name.

Return Value: Returns a string message about the status of the alarm.

#### Syntax

```javascript
var status=ins.getAlarmStatus("ALM_01");
if (status==="Active") {
    ins.notify("info","ALM_01","ALM_01 is Active");
}
```

## Activate Alarm <a href="#activate-alarm" id="activate-alarm"></a>

#### ins.activateAlarm(String alarmName) <a href="#ins-activatealarm-string-alarmname" id="ins-activatealarm-string-alarmname"></a>

Activates the alarm.

alarmName: The alarm name.

Return Value: Does not return any value.

#### Syntax

```javascript
ins.activateAlarm("ALM_01");
```

## Deactivate Alarm <a href="#deactivate-alarm" id="deactivate-alarm"></a>

#### ins.deactivateAlarm(String alarmName) <a href="#ins-deactivatealarm-string-alarmname" id="ins-deactivatealarm-string-alarmname"></a>

Deactivates the alarm.

alarmName: The alarm name.

Return Value: Does not return any value.

#### Syntax <a href="#syntax-2" id="syntax-2"></a>

```
ins.deactivateAlarm("ALM_01");
```

## Get a Alarm <a href="#get-a-alarm" id="get-a-alarm"></a>

#### ins.getLastFiredAlarm(Integer index) <a href="#ins-getlastfiredalarm-integer-index" id="ins-getlastfiredalarm-integer-index"></a>

Returns an alarm according to the index number of alarms that have turned ON.

index: Indicates the order in which the ON alarm arrives.

Return Value: Returns a JSON Alarm object.

#### Syntax <a href="#syntax-3" id="syntax-3"></a>

```javascript
var alm_01=ins.getLastFiredAlarm(0);
if (alm_01!==null) {
    return alm.name+" "+alm.status;
}
return -1;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://inscada.gitbook.io/ins/en-1/programing/apis/alarm-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
