Email Setup
{
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", 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");
}
};
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 |
---|
name | alerting.json |
---|
height | 150 |
---|
|
Alert all connections
exports.main = function (config, context) {
if (context.device.isGateway && !context.network.isCentralGateway) {
for (var pos in context.network.vpnconnections);
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
+ "?subject=VPN-Verbindung im Projekt " + context.vars.projectName
+ " am Standort " + context.vars.locationName + " abgebrochen um %t"
+ "?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
+ "?subject=VPN-Verbindung im Projekt " + context.vars.projectName
+ " am Standort " + context.vars.locationName + " aufgebaut um %t"
+ "?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);
}
};
Englisch |
---|
Alert specific Connection
exports.main = function (config, context) {
if (context.device.isGateway) {
var actionTable = config.getTableByOid("1.2.2.25");
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
+ "?subject=VOIP-VPN Verbindung im Projekt " + context.vars.projectName
+ ", am Standort " + context.vars.locationName + " abgebrochen um %t"
+ "?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);
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
+ "?subject=VOIP-VPN Verbindung im Projekt " + context.vars.projectName
+ ", am Standort " + context.vars.locationName + " aufgebaut um %t"
+ "?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);
}
}; |