chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ey...@apache.org
Subject svn commit: r1659957 - in /chukwa/trunk: CHANGES.txt conf/log4j.properties lib/NagiosAppender-1.5.0.jar pom.xml src/main/java/org/apache/hadoop/chukwa/extraction/demux/DemuxManager.java src/main/java/org/apache/hadoop/chukwa/util/NagiosHelper.java
Date Sun, 15 Feb 2015 17:53:02 GMT
Author: eyang
Date: Sun Feb 15 17:53:01 2015
New Revision: 1659957

URL: http://svn.apache.org/r1659957
Log:
CHUKWA-735. Updated Nagios support to support basic encryption.  (Eric Yang)

Removed:
    chukwa/trunk/lib/NagiosAppender-1.5.0.jar
Modified:
    chukwa/trunk/CHANGES.txt
    chukwa/trunk/conf/log4j.properties
    chukwa/trunk/pom.xml
    chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/extraction/demux/DemuxManager.java
    chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/util/NagiosHelper.java

Modified: chukwa/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/chukwa/trunk/CHANGES.txt?rev=1659957&r1=1659956&r2=1659957&view=diff
==============================================================================
--- chukwa/trunk/CHANGES.txt (original)
+++ chukwa/trunk/CHANGES.txt Sun Feb 15 17:53:01 2015
@@ -10,6 +10,8 @@ Trunk (unreleased changes)
 
   BUGS
 
+  CHUKWA-735. Updated Nagios support to support basic encryption.  (Eric Yang)
+
 Release 0.6 - 09/28/2014
 
   NEW FEATURES

Modified: chukwa/trunk/conf/log4j.properties
URL: http://svn.apache.org/viewvc/chukwa/trunk/conf/log4j.properties?rev=1659957&r1=1659956&r2=1659957&view=diff
==============================================================================
--- chukwa/trunk/conf/log4j.properties (original)
+++ chukwa/trunk/conf/log4j.properties Sun Feb 15 17:53:01 2015
@@ -26,3 +26,16 @@ log4j.appender.stdout.follow=true
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
 log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %p %t %c{1} - %m%n
 
+# Uncomment this section, if you want to send nagios alert.
+#log4j.logger.org.apache.hadoop.chukwa.util.NagiosHelper
+#log4j.appender.nagios=de.viaboxx.nagios.NagiosAppender
+#log4j.appender.nagios.monitoredServiceName=chukwa
+#log4j.appender.nagios.nagiosHost=[PUT_YOUR_NAGIOS_SERVER_NAME_HERE]
+#log4j.appender.nagios.nagiosPassword=[PUT_YOUR_NAGIOS_PASSWORD_HERE]
+#log4j.appender.nagios.nagiosEncryption=TRIPLE_DES
+#log4j.appender.nagios.monitorWarnAs=WARNING
+#log4j.appender.nagios.monitorErrorAs=WARNING
+#log4j.appender.nagios.monitorFatalAs=CRITICAL
+#log4j.appender.nagios.resetStateAfterCritical=true
+#log4j.appender.nagios.resetStateAfterWarning=true
+

Modified: chukwa/trunk/pom.xml
URL: http://svn.apache.org/viewvc/chukwa/trunk/pom.xml?rev=1659957&r1=1659956&r2=1659957&view=diff
==============================================================================
--- chukwa/trunk/pom.xml (original)
+++ chukwa/trunk/pom.xml Sun Feb 15 17:53:01 2015
@@ -118,11 +118,14 @@
             <version>0.2.6</version>
           </dependency>
           <dependency>
-            <groupId>org.apache.log4j</groupId>
-            <artifactId>NagiosAppender</artifactId>
-            <version>1.5.0</version>
-            <scope>system</scope>
-            <systemPath>${basedir}/lib/NagiosAppender-1.5.0.jar</systemPath>
+            <groupId>com.googlecode.jsendnsca</groupId>
+            <artifactId>jsendnsca</artifactId>
+            <version>2.0.1</version>
+          </dependency>
+          <dependency>
+	    <groupId>de.viaboxx</groupId>
+	    <artifactId>log4j-nagios-appender</artifactId>
+	    <version>1.1</version>
           </dependency>
           <dependency>
             <groupId>org.fusesource</groupId>
@@ -1277,6 +1280,10 @@
             <id>opencast</id>
             <url>http://repository.opencastproject.org/nexus/content/repositories/public/</url>
         </repository>
+        <repository>
+            <id>pentaho</id>
+            <url>http://repository.pentaho.org/artifactory/repo/</url>
+        </repository>
     </repositories>
 
     <dependencyManagement>

Modified: chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/extraction/demux/DemuxManager.java
URL: http://svn.apache.org/viewvc/chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/extraction/demux/DemuxManager.java?rev=1659957&r1=1659956&r2=1659957&view=diff
==============================================================================
--- chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/extraction/demux/DemuxManager.java
(original)
+++ chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/extraction/demux/DemuxManager.java
Sun Feb 15 17:53:01 2015
@@ -261,16 +261,16 @@ public class DemuxManager implements CHU
      
      // send Demux status
      if (demuxStatus == true) {
-       NagiosHelper.sendNsca(nagiosHost,nagiosPort,reportingHost,"DemuxProcessing","Demux
OK",NagiosHelper.NAGIOS_OK);
+       NagiosHelper.sendNsca("Demux OK",NagiosHelper.NAGIOS_OK);
      } else {
-       NagiosHelper.sendNsca(nagiosHost,nagiosPort,reportingHost,"DemuxProcessing","Demux
failed. " + demuxException,NagiosHelper.NAGIOS_CRITICAL);
+       NagiosHelper.sendNsca("Demux failed. " + demuxException,NagiosHelper.NAGIOS_CRITICAL);
      }
      
      // send DemuxInErrorStatus
      if (demuxInErrorStatus == false) {
-       NagiosHelper.sendNsca(nagiosHost,nagiosPort,reportingHost,"DemuxInErrorDirectory","DemuxInError
OK",NagiosHelper.NAGIOS_OK);
+       NagiosHelper.sendNsca("DemuxInError OK",NagiosHelper.NAGIOS_OK);
      } else {
-       NagiosHelper.sendNsca(nagiosHost,nagiosPort,reportingHost,"DemuxInErrorDirectory","DemuxInError
not empty -" + demuxInErrorMsg,NagiosHelper.NAGIOS_CRITICAL);
+       NagiosHelper.sendNsca("DemuxInError not empty -" + demuxInErrorMsg,NagiosHelper.NAGIOS_CRITICAL);
      }
      
    }

Modified: chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/util/NagiosHelper.java
URL: http://svn.apache.org/viewvc/chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/util/NagiosHelper.java?rev=1659957&r1=1659956&r2=1659957&view=diff
==============================================================================
--- chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/util/NagiosHelper.java (original)
+++ chukwa/trunk/src/main/java/org/apache/hadoop/chukwa/util/NagiosHelper.java Sun Feb 15
17:53:01 2015
@@ -18,22 +18,23 @@
 package org.apache.hadoop.chukwa.util;
 
 import org.apache.log4j.Logger;
-import org.apache.log4j.nagios.Nsca;
 
 public class NagiosHelper {
   static Logger log = Logger.getLogger(NagiosHelper.class);
-  public static final int NAGIOS_OK       = Nsca.NAGIOS_OK;
-  public static final int NAGIOS_WARN     = Nsca.NAGIOS_WARN;
-  public static final int NAGIOS_CRITICAL = Nsca.NAGIOS_CRITICAL;
-  public static final int NAGIOS_UNKNOWN  = Nsca.NAGIOS_UNKNOWN;
+  public static final int NAGIOS_OK       = 0;
+  public static final int NAGIOS_WARN     = 1;
+  public static final int NAGIOS_CRITICAL = 2; 
+  public static final int NAGIOS_UNKNOWN  = 3;
   
-  public static void sendNsca(String nagiosHost,int nagiosPort,String reportingHost,String
reportingService,String msg,int state) {
-    Nsca nsca = new Nsca();
-    try {
-      nsca.send_nsca(nagiosHost, ""+nagiosPort, reportingHost, reportingService, msg, state,
1);
-    } catch (Throwable e) {
-     log.warn(e);
+  public static void sendNsca(String msg, int state) {
+    if(state==NAGIOS_OK) {
+      log.info(msg);
+    } else if (state==NAGIOS_WARN) {
+      log.warn(msg);
+    } else if (state==NAGIOS_CRITICAL) {
+      log.error(msg);
+    } else if (state==NAGIOS_UNKNOWN) {
+      log.warn(msg);
     }
-     
   }
 }



Mime
View raw message