Here's the cloudstack code for the SNMP appender: https://github.com/apache/cloudstack/blob/4.18/plugins/alert-handlers/snmp-alerts/src/main/java/org/apache/cloudstack/alert/snmp/SnmpTrapAppender.java
Here's the appender as configured in my log4j-cloud.xml file: <appender name="SNMP" class= "org.apache.cloudstack.alert.snmp.SnmpTrapAppender"> <param name="Threshold" value="WARN"/> <param name="SnmpManagerIpAddresses" value="<redacted>"/> <param name="SnmpManagerPorts" value="162"/> <param name="SnmpManagerCommunities" value="public"/> <layout class= "org.apache.cloudstack.alert.snmp.SnmpEnhancedPatternLayout"> <param name="PairDelimiter" value="//"/> <param name="KeyValueDelimiter" value="::"/> </layout> </appender> On Thu, Aug 17, 2023 at 4:36 PM João Jandre Paraquetti <j...@scclouds.com.br> wrote: > Hello, Willard > > Could you share your whole log4j config file? > > I'm asking because the default one will have the following configuration: > > <logger name="org.apache.cloudstack.alerts" additivity="false"> > <level value="WARN"/> > <appender-ref ref="SYSLOG"/> > <appender-ref ref="CONSOLE"/> > <appender-ref ref="FILE"/> > <appender-ref ref="SNMP"/> > <appender-ref ref="ALERTSYSLOG"/> > </logger> > > This is the only "logger" configuration that is using the SNMP appender > by default. And the package that it is using > (`org.apache.cloudstack.alerts`) does not exist. Therefore, it will > never log anything in the SNMP appender. > > After looking at the code, I think that the packages that are meant to > be appended with the SNMP appender are `com.cloud.alert` and > `com.cloud.usage`. The interface of these implementations is in > "org.apache.cloudstack.alert", but still, the configuration there would > be invalid anyways as "org.apache.cloudstack.alerts" (ending with an > "s") does not exist. The implementations of that interface are all in > `com.cloud.alert` and `com.cloud.usage`. Therefore, you could use those > packages instead. Here is an example of how to configure that: > > <logger name="com.cloud.alert" additivity="false"> > <level value="WARN"/> > <appender-ref ref="SNMP"/> > </logger> > > <logger name="com.cloud.usage" additivity="false"> > <level value="WARN"/> > <appender-ref ref="SNMP"/> > </logger> > > On 08/08/2023 08:37, Will Conrad wrote: > > I followed the cloudstack documentation here: > > > > > https://docs.cloudstack.apache.org/en/4.18.0.0/adminguide/management.html?highlight=snmp#configuring-snmp-and-syslog-managers > > > > to get SNMP traps working, however, no traps are being sent. I don't see > > any related errors logged. I see no instances of failed library loads, > but > > I do not see. Do I need to manually install the libsnmp4j library myself? > > > > I know it's reading the log4j config as I get this notification in the > > management server log: > > > > 2023-08-07 18:20:42,842 INFO [c.c.u.LogUtils] (main:null) (logid:) log4j > > configuration found at /etc/cloudstack/management/log4j-cloud.xml > > > > Here is the log4j config for the SNMP appender (note that I have > configured > > syslog as well, and that is working). > > > > <appender name="SNMP" > > class="org.apache.cloudstack.alert.snmp.SnmpTrapAppender"> > > > > <param name="Threshold" value="WARN"/> > > > > <param name="SnmpManagerIpAddresses" value="<redacted>"/> > > > > <param name="SnmpManagerPorts" value="162"/> > > > > <param name="SnmpManagerCommunities" value="public"/> > > > > <layout > > class="org.apache.cloudstack.alert.snmp.SnmpEnhancedPatternLayout"> > > > > <param name="PairDelimiter" value="//"/> > > > > <param name="KeyValueDelimiter" value="::"/> > > > > </layout> > > > > </appender> > > > > Any insight will be greatly appreciated. > > > > Regards, > > > > Willard > > >