User Tools
onboarding:snmpmanager:trap_rule_template
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| onboarding:snmpmanager:trap_rule_template [2025/04/17 14:55] – 10.91.120.100 | onboarding:snmpmanager:trap_rule_template [2026/01/07 11:10] (current) – 10.91.120.100 | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| <code groovy> | <code groovy> | ||
| com.errigal.snmpmanager.Trap trap -> | com.errigal.snmpmanager.Trap trap -> | ||
| + | |||
| /* Logging Rule: Output information for Technology and Trap rule name */ | /* Logging Rule: Output information for Technology and Trap rule name */ | ||
| - | log.info " | + | |
| + | | ||
| + | |||
| com.errigal.snmpmanager.wrapper.TrapWrapper trapWrapper = new com.errigal.snmpmanager.wrapper.TrapWrapper(trap) | com.errigal.snmpmanager.wrapper.TrapWrapper trapWrapper = new com.errigal.snmpmanager.wrapper.TrapWrapper(trap) | ||
| - | | + | |
| /* Extract and Define trap varbind details */ | /* Extract and Define trap varbind details */ | ||
| - | String trapType = trapWrapper.get(" | + | String trapType = trapWrapper.getVarbind(" |
| - | String alarmName = trapWrapper.get(" | + | String alarmName = trapWrapper.getVarbind(" |
| - | String alarmText = trapWrapper.get(" | + | String alarmText = trapWrapper.getVarbind(" |
| - | String alarmIdentifier = trapWrapper.get(" | + | String alarmIdentifier = trapWrapper.getVarbind(" |
| boolean isClear = //Determine if clear trap | boolean isClear = //Determine if clear trap | ||
| - | | + | |
| /* Logging Rule: Log Varbinds Of your technology specific Trap */ | /* Logging Rule: Log Varbinds Of your technology specific Trap */ | ||
| log.info "Trap ID-${trap.id}: | log.info "Trap ID-${trap.id}: | ||
| Line 24: | Line 25: | ||
| log.info "Trap ID-${trap.id}: | log.info "Trap ID-${trap.id}: | ||
| log.info "Trap ID-${trap.id}: | log.info "Trap ID-${trap.id}: | ||
| + | |||
| com.errigal.snmpmanager.knowledge.DasHub hub | com.errigal.snmpmanager.knowledge.DasHub hub | ||
| com.errigal.snmpmanager.knowledge.DasHub.withTransaction { | com.errigal.snmpmanager.knowledge.DasHub.withTransaction { | ||
| Line 32: | Line 33: | ||
| log.warn " | log.warn " | ||
| com.errigal.snmpmanager.NetworkElement orphans = com.errigal.snmpmanager.NetworkElement.findByName(" | com.errigal.snmpmanager.NetworkElement orphans = com.errigal.snmpmanager.NetworkElement.findByName(" | ||
| - | com.errigal.snmpmanager.Technology technology = com.errigal.snmpmanager.Technology.findByName(" | + | com.errigal.snmpmanager.Technology technology = com.errigal.snmpmanager.Technology.findByName(" |
| hub = new com.errigal.snmpmanager.knowledge.DasHub( | hub = new com.errigal.snmpmanager.knowledge.DasHub( | ||
| - | name: " | + | name: "${techName} ${trap.ipAddress}", |
| neType: " | neType: " | ||
| ipAddress: trap.ipAddress, | ipAddress: trap.ipAddress, | ||
| onAir: true, | onAir: true, | ||
| showInMonitor: | showInMonitor: | ||
| - | technology: " | + | technology: "${techName}", |
| assignedTechnology: | assignedTechnology: | ||
| clusterName: | clusterName: | ||
| Line 49: | Line 50: | ||
| } | } | ||
| } | } | ||
| - | | + | |
| + | |||
| String neName = // Determine or parse Node Name If applicable | String neName = // Determine or parse Node Name If applicable | ||
| boolean isHub = false //Assuming it a child element, we are checking soon | boolean isHub = false //Assuming it a child element, we are checking soon | ||
| + | |||
| if(/* Tech specific determination if Trap Is Hub Trap */) { | if(/* Tech specific determination if Trap Is Hub Trap */) { | ||
| log.info "Trap ID-${trap.id}: | log.info "Trap ID-${trap.id}: | ||
| Line 63: | Line 64: | ||
| alarmingNe = com.errigal.snmpmanager.wrapper.NetworkElementWrapper.findNetworkElement(hub.name, | alarmingNe = com.errigal.snmpmanager.wrapper.NetworkElementWrapper.findNetworkElement(hub.name, | ||
| } | } | ||
| - | + | ||
| - | + | ||
| /* If alarming NE is null here, we could not find a child when we expected to find one */ | /* If alarming NE is null here, we could not find a child when we expected to find one */ | ||
| if (!alarmingNe) { | if (!alarmingNe) { | ||
| Line 77: | Line 78: | ||
| log.warn "Trap ID-${trap.id}: | log.warn "Trap ID-${trap.id}: | ||
| } | } | ||
| + | |||
| /* Time to process trap to gts at this stage */ | /* Time to process trap to gts at this stage */ | ||
| com.errigal.snmpmanager.GeneralTrapSummary gts | com.errigal.snmpmanager.GeneralTrapSummary gts | ||
| Line 100: | Line 101: | ||
| log.info "Trap ID-${trap.id}: | log.info "Trap ID-${trap.id}: | ||
| } | } | ||
| + | |||
| /* We need to create new alarm or access an existing alarm if already created previously */ | /* We need to create new alarm or access an existing alarm if already created previously */ | ||
| com.errigal.snmpmanager.wrapper.GeneralTrapSummaryWrapper gtsw = new com.errigal.snmpmanager.wrapper.GeneralTrapSummaryWrapper(gts) | com.errigal.snmpmanager.wrapper.GeneralTrapSummaryWrapper gtsw = new com.errigal.snmpmanager.wrapper.GeneralTrapSummaryWrapper(gts) | ||
| com.errigal.snmpmanager.ActiveAlarm alarm = gtsw.getActiveAlarmWrapper()? | com.errigal.snmpmanager.ActiveAlarm alarm = gtsw.getActiveAlarmWrapper()? | ||
| + | |||
| /* If we have a clear, we need to find the alarm corresponsing to the clear */ | /* If we have a clear, we need to find the alarm corresponsing to the clear */ | ||
| if(isClear) { | if(isClear) { | ||
| Line 146: | Line 147: | ||
| String summaryString = formNeName + ":" | String summaryString = formNeName + ":" | ||
| int ticketCreationDelay = 60 | int ticketCreationDelay = 60 | ||
| + | |||
| /* Logging Rule: Output information ticket scheduling is in progress for Hub/Child name with given alarm */ | /* Logging Rule: Output information ticket scheduling is in progress for Hub/Child name with given alarm */ | ||
| log.info "Trap ID-${trap.id}: | log.info "Trap ID-${trap.id}: | ||
| + | |||
| /* In order create a ticket certain values are needed */ | /* In order create a ticket certain values are needed */ | ||
| String workflowName = ne.workflow ? ne.workflow : "SNMP Trap" | String workflowName = ne.workflow ? ne.workflow : "SNMP Trap" | ||
| HashMap < String, String > ticketValues = new HashMap < String, String > () | HashMap < String, String > ticketValues = new HashMap < String, String > () | ||
| ticketValues.put(" | ticketValues.put(" | ||
| - | ticketValues.put(" | + | ticketValues.put(" |
| ticketValues.put(" | ticketValues.put(" | ||
| ticketValues.put(" | ticketValues.put(" | ||
| ticketValues.put(" | ticketValues.put(" | ||
| - | ticketValues.put(" | + | ticketValues.put(" |
| ticketValues.put(" | ticketValues.put(" | ||
| + | |||
| /* Value which are needed to add SNMP Trap form to ticket */ | /* Value which are needed to add SNMP Trap form to ticket */ | ||
| HashMap < String, String > formValues = new HashMap < String, String > () | HashMap < String, String > formValues = new HashMap < String, String > () | ||
| Line 173: | Line 174: | ||
| formValues.put(" | formValues.put(" | ||
| formValues.put(" | formValues.put(" | ||
| + | |||
| HashMap < String, String > [] formsArray = new HashMap < String, String > [1] | HashMap < String, String > [] formsArray = new HashMap < String, String > [1] | ||
| formsArray[0] = formValues | formsArray[0] = formValues | ||
| final int TO_SEC = 60 | final int TO_SEC = 60 | ||
| + | |||
| if (gtsw.getDomain().alarmStatus.equalsIgnoreCase(" | if (gtsw.getDomain().alarmStatus.equalsIgnoreCase(" | ||
| ticketValues.put(" | ticketValues.put(" | ||
| Line 188: | Line 189: | ||
| ticketCreationDelay = 60 | ticketCreationDelay = 60 | ||
| } | } | ||
| + | |||
| gtsw.scheduleAlarmAndTicketForLaterWithForms(0, | gtsw.scheduleAlarmAndTicketForLaterWithForms(0, | ||
| /* Logging Rule: Output information ticket scheduling is complete */ | /* Logging Rule: Output information ticket scheduling is complete */ | ||
onboarding/snmpmanager/trap_rule_template.1744898112.txt.gz · Last modified: 2025/04/17 14:55 by 10.91.120.100