/*
	This file contains policy-statements for Extreme Networks gear. These policies
   do not cover all traps available for these devices.

	Note to VIM users: this file should have syntax highlighting; enable with (:syntax on).
*/

#include "@resolved_sysconfdir@/format-statements.conf"
#include "@resolved_sysconfdir@/map-statements.conf"

policy-options {
	policy-statement IGNORE_GENERIC_EXTREME_SYSLOG {
		apply-format SYSLOG_FORMAT;
	}

	policy-statement EXTREME_HARDWARE_TRAP {
		term CPU_UTIL_RISING {
			from {
				protocol snmptrap;
				event		snmp:extremeCpuUtilizationRisingTrap;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"CPU utilization reached @snmp:extremeCpuAggregateUtilization@ (threshold @snmp:extremeCpuUtilRisingThreshold@)";
						detail	"";
						channel	hardware;
					}
					syslog {
						detail	"@snmp:sysName.0@: CPU utilization reached @snmp:extremeCpuAggregateUtilization@ (threshold @snmp:extremeCpuUtilRisingThreshold@)";
						channel	hardware;
					}
				}
				accept;
			}
		}
		term CPU_UTIL_FALLING {
			from {
				protocol snmptrap;
				event		snmp:extremeCpuUtilizationFallingTrap;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"CPU utilization dropped to @snmp:extremeCpuAggregateUtilization@ (threshold @snmp:extremeCpuUtilRisingThreshold@)";
						detail	"";
						channel	hardware;
					}
					syslog {
						detail	"@snmp:sysName.0@: CPU utilization dropped to @snmp:extremeCpuAggregateUtilization@ (threshold @snmp:extremeCpuUtilRisingThreshold@)";
						channel	hardware;
					}
				}
				accept;
			}
		}
		term CPU_FAIL {
			from {
				protocol snmptrap;
				event		snmp:extremeProcessorStateChangeTrap;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"CPU @snmp:extremeSlotNumber@ state changed to @snmp:extremeNPModuleProcessorState@.";
						detail	"";
						channel	hardware;
					}
					syslog {
						detail	"@snmp:sysName.0@: CPU @snmp:extremeSlotNumber@ state changed to @snmp:extremeNPModuleProcessorState@.";
						channel	hardware;
					}
				}
				accept;
			}
		}
		term MSM_FAILOVER {
			from {
				protocol snmptrap;
				event		snmp:extremeMsmFailoverTrap;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"MSM @snmp:extremeMasterMSMSlot@ failed over due to @snmp:extremeMsmFailoverCause@.";
						detail	"";
						channel	hardware;
					}
					syslog {
						detail	"@snmp:sysName.0@: MSM @snmp:extremeMasterMSMSlot@ failed over due to @snmp:extremeMsmFailoverCause@.";
						channel	hardware;
					}
				}
				accept;
			}
		}
		term ESRP_TIMOUT_OVER_MASTER {
			from {
				protocol snmptrap;
				event		snmp:extremeEsrpTimedOutFailedOverMaster;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"Master node failed hitless MSM failover.";
						detail	"";
						channel	hardware;
					}
					syslog {
						detail	"@snmp:sysName.0@: Master node failed hitless MSM failover.";
						channel	hardware;
					}
				}
				accept;
			}
		}
		term OVERHEAT {
			from {
				protocol snmptrap;
				event		snmp:extremeOverheat;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"Overheat condition triggered at @snmp:extremeCurrentTemperature@C. Shutting down system.";
						detail	"This element will be shutdown until the temperature has returned to normal.";
						channel	hardware;
					}
					syslog {
						detail	"@snmp:sysName.0@: Overheat condition triggered at @snmp:extremeCurrentTemperature@C. Shutting down system.";
						channel	hardware;
					}
				}
				accept;
			}
		}
		term FAN_FAIL {
			from {
				protocol snmptrap;
				event		snmp:extremeFanfailed;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"Fan @snmp:extremeFanNumber@ has failed.";
						detail	"Fan @snmp:extremeFanNumber@ should be inspected and replaced if not functioning normally.";
						channel	hardware;
					}
					syslog {
						detail	"@snmp:sysName.0@: Fan @snmp:extremeFanNumber@ has failed.";
						channel	hardware;
					}
				}
				accept;
			}
		}
		term FAN_OK {
			from {
				protocol snmptrap;
				event		snmp:extremeFanOK;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"Fan @snmp:extremeFanNumber@ has recovered.";
						detail	"Fan @snmp:extremeFanNumber@ should be inspected and replaced if not functioning normally.";
						channel	hardware;
					}
					syslog {
						detail	"@snmp:sysName.0@: Fan @snmp:extremeFanNumber@ has recovered.";
						channel	hardware;
					}
				}
				accept;
			}
		}
		term PSU_FAIL {
			from {
				protocol snmptrap;
				event		snmp:extremePowerSupplyFail;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"Power supply @snmp:extremeFanNumber@ has failed.";
						detail	"Power supply @snmp:extremeFanNumber@ should be inspected and replaced if not functioning normally.";
						channel	hardware;
					}
					syslog {
						detail	"@snmp:sysName.0@: Power supply @snmp:extremeFanNumber@ has failed.";
						channel	hardware;
					}
				}
				accept;
			}
		}
		term PSU_OK {
			from {
				protocol snmptrap;
				event		snmp:extremePowerSupplyGood;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"Power supply @snmp:extremeFanNumber@ has recovered.";
						detail	"Power supply @snmp:extremeFanNumber@ should be inspected and replaced if not functioning normally.";
						channel	hardware;
					}
					syslog {
						detail	"@snmp:sysName.0@: Power supply @snmp:extremeFanNumber@ has recovered.";
						channel	hardware;
					}
				}
				accept;
			}
		}
		term RPS_FAIL {
			from {
				protocol snmptrap;
				event		snmp:extremeRpsAlarm;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"Attached redundant power supply has failed.";
						detail	"The attached redundant power supply should be inspected and replaced if not functioning normally.";
						channel	hardware;
					}
					syslog {
						detail	"@snmp:sysName.0@: Attached redundant power supply has failed.";
						channel	hardware;
					}
				}
				accept;
			}
		}
		term RPS_OK {
			from {
				protocol snmptrap;
				event		snmp:extremeRpsNoAlarm;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"Attached redundant power supply has recovered.";
						detail	"The attached redundant power supply should be inspected and replaced if not functioning normally.";
						channel	hardware;
					}
					syslog {
						detail	"@snmp:sysName.0@: Attached redundant power supply has recovered.";
						channel	hardware;
					}
				}
				accept;
			}
		}
		term MODULE_STATE_CHANGE {
			from {
				protocol snmptrap;
				event		snmp:extremeModuleStateChanged;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"Slot @snmp:extremeSlotNumber@ (@snmp:extremeSlotModuleInsertedType@) state changed to @snmp:extremeSlotModuleState@.";
						detail	"The module in slot @snmp:extremeSlotNumber@ (inserted: @snmp:extremeSlotModuleInsertedType@, configured: @snmp:extremeSlotModuleConfiguredType@) has changed state to @snmp:extremeSlotModuleState@.";
						channel	hardware;
					}
					syslog {
						detail	"@snmp:sysName.0@: Slot @snmp:extremeSlotNumber@ (@snmp:extremeSlotModuleInsertedType@) state changed to @snmp:extremeSlotModuleState@.";
						channel	hardware;
					}
				}
				accept;
			}
		}
		apply-format SNMPTRAP_FORMAT;
	}

	policy-statement EXTREME_SOFTWARE_TRAP {
		term AUTH_FAIL {
			from {
				protocol snmptrap;
				event		snmp:extremeInvalidLoginAttempt;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"Login failure.";
						detail	"A user attempted to login via SSH, telnet or console but was refused due to an invalid username or password.";
						channel	security;
					}
					syslog {
						detail	"@snmp:sysName.0@: Login failure";
						channel	security;
					}
				}
				accept;
			}
		}
		term MAC_LIMIT_EXCEEDED {
			from {
				protocol snmptrap;
				event		snmp:extremeMacLimitExceeded;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"MAC limit exceeded on @snmp:extremeMacSecurityVlanDescr@.";
						detail	"";
						channel	software;
					}
					syslog {
						detail	"@snmp:sysName.0@: MAC limit exceeded on @snmp:extremeMacSecurityVlanDescr@.";
						channel	software;
					}
				}
				accept;
			}
		}
		term BGP_MAX_PREFIX_WARNING {
			from {
				protocol snmptrap;
				event		snmp:extremeBgpPrefixReachedThreshold;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"BGP neighbor @snmp:bgpPeerRemoteAddr@ prefix count reached threshold.";
						detail	"";
						channel	protocol-bgp;
					}
					syslog {
						detail	"@snmp:sysName.0@: BGP neighbor @snmp:bgpPeerRemoteAddr@ prefix count reached threshold.";
						channel	protocol-bgp;
					}
				}
				accept;
			}
		}
		term BGP_MAX_PREFIX_EXCEEDED {
			from {
				protocol snmptrap;
				event		snmp:extremeBgpPrefixMaxExceeded;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"BGP neighbor @snmp:bgpPeerRemoteAddr@ exceeded max prefix limit.";
						detail	"";
						channel	protocol-bgp;
					}
					syslog {
						detail	"@snmp:sysName.0@: BGP neighbor @snmp:bgpPeerRemoteAddr@ exceeded max prefix limit.";
						channel	protocol-bgp;
					}
				}
				accept;
			}
		}
		term ESRP_STATE_CHANGE {
			from {
				protocol snmptrap;
				event		snmp:extremeEsrpStateChange;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"ESRP changed state to @snmp:extremeEsrpState@ on @snmp:extremeVlanIfDescr@ (@snmp:extremeEsrpTrackedIpRoutes@).";
						detail	"";
						channel	protocol-esrp;
					}
					syslog {
						detail	"@snmp:sysName.0@: ESRP changed state to @snmp:extremeEsrpState@ on @snmp:extremeVlanIfDescr@ (@snmp:extremeEsrpTrackedIpRoutes@).";
						channel	protocol-esrp;
					}
				}
				accept;
			}
		}
		term EDP_NEIGHBOR_ADD {
			from {
				protocol snmptrap;
				event		snmp:extremeEdpNeighborAdded;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"EDP neighbor @snmp:extremeEdpNeighborId@ on @snmp:ifDescr@ added.";
						detail	"";
						channel	protocol-edp;
					}
					syslog {
						detail	"@snmp:sysName.0@: EDP neighbor @snmp:extremeEdpNeighborId@ on @snmp:ifDescr@ added.";
						channel	protocol-edp;
					}
				}
				accept;
			}
		}
		term EDP_NEIGHBOR_REMOVE {
			from {
				protocol snmptrap;
				event		snmp:extremeEdpNeighborRemoved;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"EDP neighbor @snmp:extremeEdpNeighborId@ on @snmp:ifDescr@ removed.";
						detail	"";
						channel	protocol-edp;
					}
					syslog {
						detail	"@snmp:sysName.0@: EDP neighbor @snmp:extremeEdpNeighborId@ on @snmp:ifDescr@ removed.";
						channel	protocol-edp;
					}
				}
				accept;
			}
		}
		term SERVER_LOAD_BALANCER_ADD {
			from {
				protocol snmptrap;
				event		snmp:extremeSlbUnitAdded;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"Server load balancer has activated a group of servers.";
						detail	"This alarm may indicate the failure of another load balancer.";
						channel	protocol-slb;
					}
					syslog {
						detail	"@snmp:sysName.0@: Server load balancer has activated a group of servers.";
						channel	protocol-slb;
					}
				}
				accept;
			}
		}
		term SERVER_LOAD_BALANCER_REMOVED {
			from {
				protocol snmptrap;
				event		snmp:extremeSlbUnitAdded;
			}
			then {
				apply-map SOURCE_TO_ELEMENT_DATA_MAP;
				set {
					state information;
				}
				output {
					gui {
						brief		"Server load balancer has deactivated a group of servers.";
						detail	"This alarm indicates that something is wrong within the server load balancer.";
						channel	protocol-slb;
					}
					syslog {
						detail	"@snmp:sysName.0@: Server load balancer has deactivated a group of servers.";
						channel	protocol-slb;
					}
				}
				accept;
			}
		}
		apply-format SNMPTRAP_FORMAT;
	}
}

/*
** Local Variables:
** c-basic-offset: 3
** tab-width: 3
** End:
** vim600: fdm=marker
** vim: noet ts=3 sw=3
** vim: syntax=sella_nms
*/
