Versionen im Vergleich

Schlüssel

  • Diese Zeile wurde hinzugefügt.
  • Diese Zeile wurde entfernt.
  • Formatierung wurde geändert.
Seiteneigenschaften


Deutsch

Beschreibung:

Um LCOS-basierte E-Mail-Benachrichtigungen einzurichten, müssen Sie einen SMTP-Mailserver sowie die Aktionen konfigurieren, die das entsprechende Verhalten auslösen.

Sie müssen die folgenden Variablen einrichten:

Obligatorische Variablen:

  • SMTP_SERVER
  • SMTP_USER
  • SMTP_PASSWORT
  • MAIL_SENDER
  • MAIL_TO

Optionale Variablen:

  • projektName
  • locationName

Liste der verwendeten Variablen:

VariableBeschreibung




Add-

In

in Code:

/**
 * @param {Config} config
 * @param {Context} context
 * Do not edit this comment or parameter types. Required for code suggestions
*/
exports.main = function (config, context) {
    // Function to create VRRP Entry
    var addVRRPEntry = function (routerID, routerIP, mainPrio, backupPrio, remoteSite, comment) {
        var table1_2_8_21_2 = config.getTableByOid("1.2.8.21.2");
        var table_1_2_8_21_2_row_1 = table1_2_8_21_2.createNewRow();
        table_1_2_8_21_2_row_1.setByOid(1, routerID);
        table_1_2_8_21_2_row_1.setByOid(2, routerIP);
        table_1_2_8_21_2_row_1.setByOid(3, mainPrio);
        table_1_2_8_21_2_row_1.setByOid(4, backupPrio);
        table_1_2_8_21_2_row_1.setByOid(5, remoteSite);
        table_1_2_8_21_2_row_1.setByOid(6, comment);
        table1_2_8_21_2.addOrMerge(table_1_2_8_21_2_row_1);
    };
    // If Statement to only create VRRP Entry, if device has the variable VRRP_Prio
    if (context.vars.VRRP_PRIO != "") {
        config.setScalarByOid("1.2.8.21.1", "1");
        // Function Call to create a new Entry
        addVRRPEntry("1", "10.10.10.254", context.vars.VRRP_PRIO, "0", "INTERNET", "");
    }
};
Addin

Add-in als JSON-Datei:

View file
namealerting.json
height150


Englisch

Description:

To setup LCOS based e-mail alerts you need to configure an SMTP mail server, as well as actions that trigger the respective behavior.

You will need to setup the following variables:

Mandatory variables:

  • SMTP_SERVER
  • SMTP_USER
  • SMTP_PASSWORT
  • MAIL_SENDER
  • MAIL_TO

Optional variables:

...

  • projektName
  • locationName

...

List of used variables:

VariableBeschreibung




Add-in code:

Englisch
Email Setup

/**

 *
@param
{Config}
config

 *
@param
{Context}
context

 *
Do
not
edit
this
comment
or
parameter
types.
Required
for
code
suggestions

*/

exports.main
=
function
(config,
context)
{ if (context.device.isGateway) { config.setScalarByOid("1.2.27.1", context.vars.SMTP_SERVER); config.setScalarByOid
{
    // Function to create VRRP Entry
    var addVRRPEntry = function (routerID, routerIP, mainPrio, backupPrio, remoteSite, comment) {
        var table1_2_8_21_2 = config.getTableByOid("1.2.
27
8.21.2
",
"
587"); config.setScalarByOid("1.2.27.12", "2"); config.setScalarByOid("1.2.27.13", "3"); config.setScalarByOid("1.2.27.3", ""); config.setScalarByOid("1.2.27.4", "110"); config.setScalarByOid("1.2.27.11", ""); config.setScalarByOid("1.2.27.5", context.vars.SMTP_USER); config.setScalarByOid("1.2.27.6", context.vars.SMTP_PASSWORT); config.setScalarByOid("1.2.27.7", context.vars.MAIL_SENDER); config.setScalarByOid("1.2.27.8", "30"); config.setScalarByOid("1.2.27.9", "72"); config.setScalarByOid("1.2.27.10", "100"); } }; /* [ 1] SMTP-Server : 64 chars from #ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz` [ 2] SMTP-Port : 5 chars from 1234567890 [ 12] SMTP-use-TLS : Yes (1), No (0), Preferred (2), Required (3) [ 13] SMTP-Authentication : None (0), Plain-Text-Preferred (1), Encrypted (2), Preferred-Encrypted (3) [ 3] POP3-Server : 64 chars from #ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz` [ 4] POP3-Port : 5 chars from 1234567890 [ 11] Loopback-Addr. : 16 chars from ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789 [ 5] User-Name : 63 chars from #ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz` [ 6] Password : 31 chars from #ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz` [ 7] E-Mail-Sender : 63 chars from #ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz` [ 8] Send-Again-(min.) : 3 chars from 1234567890 [ 9] Hold-Time-(hrs.) : 3 chars from 1234567890 [ 10] Buffers : 3 chars from 1234567890 */

Englisch
);
        var table_1_2_8_21_2_row_1 = table1_2_8_21_2.createNewRow();
        table_1_2_8_21_2_row_1.setByOid(1, routerID);
        table_1_2_8_21_2_row_1.setByOid(2, routerIP);
        table_1_2_8_21_2_row_1.setByOid(3, mainPrio);
        table_1_2_8_21_2_row_1.setByOid(4, backupPrio);
        table_1_2_8_21_2_row_1.setByOid(5, remoteSite);
        table_1_2_8_21_2_row_1.setByOid(6, comment);
        table1_2_8_21_2.addOrMerge(table_1_2_8_21_2_row_1);
    };
    // If Statement to only create VRRP Entry, if device has the variable VRRP_Prio
    if (context.vars.VRRP_PRIO != "") {
        config.setScalarByOid("1.2.8.21.1", "1");
        // Function Call to create a new Entry
        addVRRPEntry("1", "10.10.10.254", context.vars.VRRP_PRIO, "0", "INTERNET", "");
    }
};

Add-in as JSON file:

View file
namealerting.json
height150

Alert all connections

/**
 * @param {Config} config
 * @param {Context} context
 * Do not edit this comment or parameter types. Required for code suggestions
*/
exports.main = function (config, context) {

    if (context.device.isGateway && !context.network.isCentralGateway) {

        for (var pos in context.network.vpnconnections);

        // /Setup/WAN/Action-Table
        var actionTable = config.getTableByOid("1.2.2.25");
        var row1 = actionTable.createNewRow();
        row1.setByOid("1", "7");
        row1.setByOid("8", "0");
        row1.setByOid("2", context.network.vpnconnections[pos] + "-DOWN");
        row1.setByOid("3", context.network.vpnconnections[pos]);
        row1.setByOid("10", "4094");
        row1.setByOid("4", "0");
        row1.setByOid("5", "3");
        row1.setByOid("6", "mailto:" + context.vars.MAIL_TO
            // setup subject (translate to your desired language)
            + "?subject=VPN-Verbindung im Projekt " + context.vars.projectName
            + " am Standort " + context.vars.locationName + " abgebrochen um %t"
            // setup body (translate to your desired language)
            + "?body=Im Projekt " + context.vars.projectName
            + " wurde die VPN-Gegenstelle " + context.network.vpnconnections[pos]
            + " am Standort " + context.vars.locationName + " unerwartet abgebaut");
        row1.setByOid("7", "");
        row1.setByOid("9", "root");
        actionTable.addOrMerge(row1);
        var row2 = actionTable.createNewRow();
        row2.setByOid("1", "8");
        row2.setByOid("8", "0");
        row2.setByOid("2", context.network.vpnconnections[pos] + "-UP");
        row2.setByOid("3", context.network.vpnconnections[pos]);
        row2.setByOid("10", "4094");
        row2.setByOid("4", "0");
        row2.setByOid("5", "0");
        row2.setByOid("6", "mailto:" + context.vars.MAIL_TO
            // setup subject (translate to your desired language)
            + "?subject=VPN-Verbindung im Projekt " + context.vars.projectName
            + " am Standort " + context.vars.locationName + " aufgebaut um %t"
            // setup body (translate to your desired language)
            + "?body=Im Projekt " + context.vars.projectName
            + " wurde die VPN-Gegenstelle " + context.network.vpnconnections[pos]
            + " am Standort " + context.vars.locationName
            + " aufgebaut");
        row2.setByOid("7", "");
        row2.setByOid("9", "root");
        actionTable.addOrMerge(row2);

        /*
           [  1] Index       : 5 chars from 1234567890
           [  8] Active      : Yes (0), No (1)
           [  2] Host-Name   : 64 chars from ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789
           [  3] Peer        : 16 chars from ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789
           [  4] Lock-Time   : 9 chars from 1234567890
           [  5] Condition   : Establish (0), Disconnect (1), End (2), Failure (3), Establish-Failure (4), Budget-Exhausted (5), Budget-Released (6)
           [  6] Action      : 250 chars from #ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!"$%&'()*+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz `
           [  7] Check-For   : 50 chars from #ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()*+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz `
           [  9] Owner       : 16 chars from ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz`
           [ 10] Routing-Tag : 5 chars from 1234567890
       */
    }
};
 
Englisch

Alert specific Connection

/** * @param {Config} config * @param {Context} context * Do not edit this comment or parameter types. Required for code suggestions */ exports.main = function (config, context) { if (context.device.isGateway) { // /Setup/WAN/Action-Table var actionTable = config.getTableByOid("1.2.2.25"); // setup disconnect alert var row1 = actionTable.createNewRow(); row1.setByOid("1", "5"); row1.setByOid("8", "0"); row1.setByOid("2", "VOIP-VPN-DOWN"); row1.setByOid("3", "VOIP-VPN"); row1.setByOid("10", "4094"); row1.setByOid("4", "0"); row1.setByOid("5", "3"); row1.setByOid("6", "mailto:" + context.vars.MAIL_TO // setup subject (translate to your desired language) + "?subject=VOIP-VPN Verbindung im Projekt " + context.vars.projectName + ", am Standort " + context.vars.locationName + " abgebrochen um %t" // setup body (translate to your desired language) + "?body=Im Projekt " + context.vars.projectName + " wurde die VPN-Verbindung VOIP-VPN am Standort " + context.vars.locationName + " unerwartet abgebaut"); row1.setByOid("7", ""); row1.setByOid("9", "root"); actionTable.addOrMerge(row1); // setup re-connect alert var row2 = actionTable.createNewRow(); row2.setByOid("1", "6"); row2.setByOid("8", "0"); row2.setByOid("2", "VOIP-VPN-UP"); row2.setByOid("3", "VOIP-VPN"); row2.setByOid("10", "4094"); row2.setByOid("4", "0"); row2.setByOid("5", "0"); row2.setByOid("6", "mailto:" + context.vars.MAIL_TO // setup subject (translate to your desired language) + "?subject=VOIP-VPN Verbindung im Projekt " + context.vars.projectName + ", am Standort " + context.vars.locationName + " aufgebaut um %t" // setup body (translate to your desired language) + "?body=Im Projekt " + context.vars.projectName + " wurde die VPN-Verbindung VOIP-VPN am Standort " + context.location.locationName + " aufgebaut"); row2.setByOid("7", ""); row2.setByOid("9", "root"); actionTable.addOrMerge(row2); // table details /* [ 1] Index : 5 chars from 1234567890 [ 8] Active : Yes (0), No (1) [ 2] Host-Name : 64 chars from ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789 [ 3] Peer : 16 chars from ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789 [ 4] Lock-Time : 9 chars from 1234567890 [ 5] Condition : Establish (0), Disconnect (1), End (2), Failure (3), Establish-Failure (4), Budget-Exhausted (5), Budget-Released (6) [ 6] Action : 250 chars from #ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!"$%&'()*+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz ` [ 7] Check-For : 50 chars from #ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()*+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz ` [ 9] Owner : 16 chars from ABCDEFGHIJKLMNOPQRSTUVWXYZ@{|}~!$%&'()+-,/:;<=>?[\]^_.0123456789abcdefghijklmnopqrstuvwxyz` [ 10] Routing-Tag : 5 chars from 1234567890 */ } };