Beschreibung:Mit dem folgenden Add-in Skript können Sie SNMP (SNMPv1, SNMPv2 oder SNMPv3) auf Access Points mit LCOS LX konfigurieren. Liste der verwendeten Variablen:Add-In in Code:
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", ""); } }; |
---|
{
config.setScalarByOid("13.2.9.37", "6");
var createSnmpCommunity = function (Name, SecurityName, Status) {
var SNMPCommunity = config.getTableByOid("13.2.9.27");
var SNMPCommunityEntry = SNMPCommunity.createNewRow();
SNMPCommunityEntry.setByOid("1", Name);
SNMPCommunityEntry.setByOid("3", SecurityName);
SNMPCommunityEntry.setByOid("8", Status);
SNMPCommunity.addOrMerge(SNMPCommunityEntry);
}
var createSnmpGroup = function (SecurityModel, SecurityName, GroupName, Status) {
var SNMPGroup = config.getTableByOid("13.2.9.28");
var SNMPGroupEntry = SNMPGroup.createNewRow();
SNMPGroupEntry.setByOid("1", SecurityModel);
SNMPGroupEntry.setByOid("2", SecurityName);
SNMPGroupEntry.setByOid("3", GroupName);
SNMPGroupEntry.setByOid("5", Status);
SNMPGroup.addOrMerge(SNMPGroupEntry);
}
var createSnmpViews = function (ViewsName, OidSubtree, Type, Status) {
var SNMPViews = config.getTableByOid("13.2.9.30");
var SNMPViewsEntry = SNMPViews.createNewRow();
SNMPViewsEntry.setByOid("1", ViewsName);
SNMPViewsEntry.setByOid("3", OidSubtree);
SNMPViewsEntry.setByOid("4", Type);
SNMPViewsEntry.setByOid("6", Status);
SNMPViews.addOrMerge(SNMPViewsEntry);
}
var createSnmpAccesses = function (GroupName, SecurityModel, MinSecurityLevel, ReadViewName, WriteViewName, NotifyViewName, Status) {
var SNMPAccesses = config.getTableByOid("13.2.9.29");
var SNMPAccessesEntry = SNMPAccesses.createNewRow();
SNMPAccessesEntry.setByOid("1", GroupName);
SNMPAccessesEntry.setByOid("3", SecurityModel);
SNMPAccessesEntry.setByOid("10", MinSecurityLevel);
SNMPAccessesEntry.setByOid("5", ReadViewName);
SNMPAccessesEntry.setByOid("6", WriteViewName);
SNMPAccessesEntry.setByOid("7", NotifyViewName);
SNMPAccessesEntry.setByOid("8", Status);
SNMPAccesses.addOrMerge(SNMPAccessesEntry);
}
var createSnmpUser = function (UserName, AuthenticationProtocol, AuthenticationPasswordType, AuthenticationPassword, PrivacyProtocol, PrivacyPasswordType, PrivacyPassword, Status) {
var SNMPUseres = config.getTableByOid("13.2.9.32");
var SNMPUserEntry = SNMPUser.createNewRow();
SNMPUserEntry.setByOid("2", UserName);
SNMPUserEntry.setByOid("5", AuthenticationProtocol);
SNMPUserEntry.setByOid("14", AuthenticationPasswordType);
SNMPUserEntry.setByOid("6", AuthenticationPassword);
SNMPUserEntry.setByOid("8", PrivacyProtocol);
SNMPUserEntry.setByOid("15", PrivacyPasswordType);
SNMPUserEntry.setByOid("9", PrivacyPassword);
SNMPUserEntry.setByOid("13", Status);
SNMPUser.addOrMerge(SNMPUserEntry);
}
var createSnmpTargetAdresses = function (Name, TransportAddress, ParameterName, Status) {
var SNMPTargetAdresses = config.getTableByOid("13.2.9.34");
var SNMPTargetAdressesEntry = SNMPTargetAdresses.createNewRow();
SNMPTargetAdressesEntry.setByOid("1", Name);
SNMPTargetAdressesEntry.setByOid("3", TransportAddress);
SNMPTargetAdressesEntry.setByOid("7", ParameterName);
SNMPTargetAdressesEntry.setByOid("9", Status);
SNMPTargetAdresses.addOrMerge(SNMPTargetAdressesEntry);
}
var createSnmpTargetParams = function (Name, MessageProcessingModel, SecurityModel, SecurityName, SecurityLevel, Status) {
var SNMPTargetParams = config.getTableByOid("13.2.9.35");
var SNMPTargetParamsEntry = SNMPTargetParams.createNewRow();
SNMPTargetParamsEntry.setByOid("1", Name);
SNMPTargetParamsEntry.setByOid("2", MessageProcessingModel);
SNMPTargetParamsEntry.setByOid("3", SecurityModel);
SNMPTargetParamsEntry.setByOid("4", SecurityName);
SNMPTargetParamsEntry.setByOid("5", SecurityLevel);
SNMPTargetParamsEntry.setByOid("7", Status);
SNMPTargetParams.addOrMerge(SNMPTargetParamsEntry);
}
createSnmpCommunity("Name", "SecurityName", "Status");
createSnmpGroup("SecurityModel", "SecurityName", "GroupName", "Status");
createSnmpViews("ViewsName", "OidSubtree", "Type", "Status");
createSnmpAccesses("GroupName", "SecurityModel", "MinSecurityLevel", "ReadViewName", "WriteViewName", "NotifyViewName", "Status");
createSnmpUser("UserName", "AuthenticationProtocol", "AuthenticationPasswordType", "AuthenticationPassword", "PrivacyProtocol", "PrivacyPasswordType", "PrivacyPassword", "Status");
createSnmpTargetAdresses("Name", "TransportAddress", "ParameterName", "Status");
createSnmpTargetParams("Name", "MessageProcessingModel", "SecurityModel", "SecurityName", "SecurityLevel", "Status");
};
|
---|
Add-in als JSON-Datei: View file |
---|
name | LX_SNMP.json |
---|
height | 150 |
---|
|
|