chukwa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ey...@apache.org
Subject svn commit: r768021 - in /hadoop/chukwa/trunk: build.xml conf/nagios.properties.template default.properties
Date Thu, 23 Apr 2009 19:25:48 GMT
Author: eyang
Date: Thu Apr 23 19:25:48 2009
New Revision: 768021

URL: http://svn.apache.org/viewvc?rev=768021&view=rev
Log:
CHUKWA-182. Added nagios appender configuration. (Eric Yang)

Added:
    hadoop/chukwa/trunk/conf/nagios.properties.template
Modified:
    hadoop/chukwa/trunk/build.xml
    hadoop/chukwa/trunk/default.properties

Modified: hadoop/chukwa/trunk/build.xml
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/build.xml?rev=768021&r1=768020&r2=768021&view=diff
==============================================================================
--- hadoop/chukwa/trunk/build.xml (original)
+++ hadoop/chukwa/trunk/build.xml Thu Apr 23 19:25:48 2009
@@ -452,13 +452,13 @@
 		</copy>
 		<delete dir="${test.build.dir}/conf" />
 		<mkdir dir="${test.build.dir}/conf" />
-		<copy file="${conf.dir}/jdbc.conf.template" tofile="${test.build.dir}/conf/jdbc.conf"/>
-		<copy file="${conf.dir}/mdl.xml" tofile="${test.build.dir}/conf/mdl.xml"/>
-		<copy file="${conf.dir}/aggregator.sql" tofile="${test.build.dir}/conf/aggregator.sql"/>
-		<copy file="${conf.dir}/database_create_tables.sql" tofile="${test.build.dir}/conf/database_create_tables.sql"/>
+		<copy file="${conf.dir}/jdbc.conf.template" tofile="${test.build.dir}/conf/jdbc.conf"
/>
+		<copy file="${conf.dir}/mdl.xml" tofile="${test.build.dir}/conf/mdl.xml" />
+		<copy file="${conf.dir}/aggregator.sql" tofile="${test.build.dir}/conf/aggregator.sql"
/>
+		<copy file="${conf.dir}/database_create_tables.sql" tofile="${test.build.dir}/conf/database_create_tables.sql"
/>
 		<copy todir="${test.build.dir}/var">
-                        <fileset dir="${basedir}/test/samples" />
-                </copy>
+			<fileset dir="${basedir}/test/samples" />
+		</copy>
 	</target>
 
 	<!--printsummary="${test.junit.printsummary}" -->
@@ -712,7 +712,24 @@
 	<!-- Documentation                                                      -->
 	<!-- ================================================================== -->
 
-	<target name="docs" depends="init,javadoc">
+	<target name="forrest.check" depends="java5.check" if="forrest.home">
+		<fail unless="forrest.home" message="'forrest.home' is not defined. Please pass -Dforrest.home=&lt;base
of Apache Forrest installation&gt; to Ant on the command-line." />
+	</target>
+
+	<target name="java5.check" if="forrest.home">
+		<fail unless="java5.home" message="'java5.home' is not defined.  Forrest requires Java
5.  Please pass -Djava5.home=&lt;base of Java 5 distribution&gt; to Ant on the command-line."
/>
+	</target>
+
+	<target name="forrest-docs" depends="forrest.check" description="Generate forrest-based
documentation. To use, specify -Dforrest.home=&lt;base of Apache Forrest installation&gt;
on the command line." if="forrest.home">
+		<exec dir="${docs.src}" executable="${forrest.home}/bin/forrest" failonerror="true">
+			<env key="JAVA_HOME" value="${java5.home}" />
+		</exec>
+		<copy todir="${build.docs}">
+			<fileset dir="${docs.src}/build/site/" />
+		</copy>
+	</target>
+
+	<target name="docs" depends="init,javadoc,forrest-docs" description="Generate javadoc,
and release notes." if="forrest.home">
 		<copy file="${docs.src}/releasenotes.html" todir="${build.docs}" />
 		<copy file="${docs.src}/src/documentation/resources/images/chukwa_logo_small.jpg" todir="${build.docs}/images"
/>
 		<antcall target="changes-to-html" />
@@ -867,83 +884,90 @@
 		</copy>
 	</target>
 
-	<target name="chukwa-config" description="create real files based on templates" depends="init"
>
-	
+	<target name="chukwa-config" description="create real files based on templates" depends="init">
+
 		<copy todir="${build.dir}/conf">
-		 <fileset dir="${basedir}/conf">
-		 	<exclude name="*.template" />
-		 </fileset>
-		</copy>
-	
-	    <copy file="${basedir}/conf/alert.template" tofile="${build.dir}/conf/alert">
-	            <filterchain>
-	                    <replacetokens>
-	                            <token key="TODO-ALERT-EMAIL" value="${TODO-ALERT-EMAIL}"
/>
-	                    </replacetokens>
-	            </filterchain>
-	    </copy>
-	
+			<fileset dir="${basedir}/conf">
+				<exclude name="*.template" />
+			</fileset>
+		</copy>
+
+		<copy file="${basedir}/conf/alert.template" tofile="${build.dir}/conf/alert">
+			<filterchain>
+				<replacetokens>
+					<token key="TODO-ALERT-EMAIL" value="${TODO-ALERT-EMAIL}" />
+				</replacetokens>
+			</filterchain>
+		</copy>
+
 		<copy file="${basedir}/conf/hadoop-metrics.properties.template" tofile="${build.dir}/conf/hadoop-metrics.properties">
-		        <filterchain>
-		                <replacetokens>
-		                        <token key="TODO-CHUKWA_LOG_DIR" value="${TODO-CHUKWA_LOG_DIR}"
/>
-		                </replacetokens>
-		        </filterchain>
+			<filterchain>
+				<replacetokens>
+					<token key="TODO-CHUKWA_LOG_DIR" value="${TODO-CHUKWA_LOG_DIR}" />
+				</replacetokens>
+			</filterchain>
 		</copy>
 		<copy file="${basedir}/conf/chukwa-agent-conf.xml.template" tofile="${build.dir}/conf/chukwa-agent-conf.xml">
-		        <filterchain>
-		                <replacetokens>
-		                        <token key="TODO-CLUSTER-NAME" value="${TODO-CLUSTER-NAME}"
/>
-		                </replacetokens>
-		        </filterchain>
+			<filterchain>
+				<replacetokens>
+					<token key="TODO-CLUSTER-NAME" value="${TODO-CLUSTER-NAME}" />
+				</replacetokens>
+			</filterchain>
+		</copy>
+		<copy file="${basedir}/conf/nagios.properties.template" tofile="${build.dir}/conf/nagios.properties">
+			<filterchain>
+				<replacetokens>
+					<token key="TODO-NAGIOS-SERVER" value="${TODO-NAGIOS-SERVER}" />
+				</replacetokens>
+			</filterchain>
 		</copy>
-		
+
 		<copy file="${basedir}/conf/chukwa-collector-conf.xml.template" tofile="${build.dir}/conf/chukwa-collector-conf.xml">
-		        <filterchain>
-		                <replacetokens>
-		                        <token key="TODO-COLLECTORS-NAMENODE" value="${TODO-COLLECTORS-NAMENODE}"
/>
-		                </replacetokens>
-		                <replacetokens>
-		                        <token key="TODO-COLLECTORS-ROTATEINTERVAL" value="${TODO-COLLECTORS-ROTATEINTERVAL}"
/>
-		                </replacetokens>
-		                <replacetokens>
-		                        <token key="TODO-COLLECTORS-PORT" value="${TODO-COLLECTORS-PORT}"
/>
-		                </replacetokens>
-		
-		        </filterchain>
+			<filterchain>
+				<replacetokens>
+					<token key="TODO-COLLECTORS-NAMENODE" value="${TODO-COLLECTORS-NAMENODE}" />
+				</replacetokens>
+				<replacetokens>
+					<token key="TODO-COLLECTORS-ROTATEINTERVAL" value="${TODO-COLLECTORS-ROTATEINTERVAL}"
/>
+				</replacetokens>
+				<replacetokens>
+					<token key="TODO-COLLECTORS-PORT" value="${TODO-COLLECTORS-PORT}" />
+				</replacetokens>
+
+			</filterchain>
 		</copy>
-		
+
 		<copy file="${basedir}/conf/chukwa-env.sh.template" tofile="${build.dir}/conf/chukwa-env.sh">
-		        <filterchain>
-		                <replacetokens>
-		                        <token key="TODO-JAVA-HOME" value="${TODO-JAVA-HOME}" />
-		                </replacetokens>
-		                <replacetokens>
-		                        <token key="TODO-HADOOP-HOME" value="${TODO-HADOOP-HOME}" />
-		                </replacetokens>
-		                <replacetokens>
-		                        <token key="TODO-HADOOP-CONF-DIR" value="${TODO-HADOOP-CONF-DIR}"
/>
-		                </replacetokens>
-		                <replacetokens>
-		                        <token key="TODO-CHUKWA_PID_DIR" value="${TODO-CHUKWA_PID_DIR}"
/>
-		                </replacetokens>
-		                <replacetokens>
-		                        <token key="TODO-CHUKWA_LOG_DIR" value="${TODO-CHUKWA_LOG_DIR}"
/>
-		                </replacetokens>
-		                <replacetokens>
-		                        <token key="TODO-AGENTS-INSTANCE-NAME" value="${TODO-AGENTS-INSTANCE-NAME}"
/>
-		                </replacetokens>
-		                <replacetokens>
-		                        <token key="TODO_CHUKWA_JDBC_DRIVER" value="${TODO_CHUKWA_JDBC_DRIVER}"
/>
-		                </replacetokens>
-		              <replacetokens>
-		                        <token key="TODO_CHUKWA_JDBC_URL_PREFIX" value="${TODO_CHUKWA_JDBC_URL_PREFIX}"
/>
-		                </replacetokens>
-		
-		        </filterchain>
+			<filterchain>
+				<replacetokens>
+					<token key="TODO-JAVA-HOME" value="${TODO-JAVA-HOME}" />
+				</replacetokens>
+				<replacetokens>
+					<token key="TODO-HADOOP-HOME" value="${TODO-HADOOP-HOME}" />
+				</replacetokens>
+				<replacetokens>
+					<token key="TODO-HADOOP-CONF-DIR" value="${TODO-HADOOP-CONF-DIR}" />
+				</replacetokens>
+				<replacetokens>
+					<token key="TODO-CHUKWA_PID_DIR" value="${TODO-CHUKWA_PID_DIR}" />
+				</replacetokens>
+				<replacetokens>
+					<token key="TODO-CHUKWA_LOG_DIR" value="${TODO-CHUKWA_LOG_DIR}" />
+				</replacetokens>
+				<replacetokens>
+					<token key="TODO-AGENTS-INSTANCE-NAME" value="${TODO-AGENTS-INSTANCE-NAME}" />
+				</replacetokens>
+				<replacetokens>
+					<token key="TODO_CHUKWA_JDBC_DRIVER" value="${TODO_CHUKWA_JDBC_DRIVER}" />
+				</replacetokens>
+				<replacetokens>
+					<token key="TODO_CHUKWA_JDBC_URL_PREFIX" value="${TODO_CHUKWA_JDBC_URL_PREFIX}" />
+				</replacetokens>
+
+			</filterchain>
 		</copy>
 
-</target>
+	</target>
 
 	<target name="package" depends="compress,docs,chukwa-config,package-hadoop,package-standalone"
description="Build distribution">
 		<mkdir dir="${build.dir}/${final.name}" />
@@ -958,8 +982,8 @@
 
 		<copy todir="${build.dir}/${final.name}" includeEmptyDirs="false">
 			<fileset dir="${build.dir}">
-				<include name="**/*.jar" />
-				<include name="**/*.war" />
+				<include name="*.jar" />
+				<include name="*.war" />
 			</fileset>
 		</copy>
 

Added: hadoop/chukwa/trunk/conf/nagios.properties.template
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/conf/nagios.properties.template?rev=768021&view=auto
==============================================================================
--- hadoop/chukwa/trunk/conf/nagios.properties.template (added)
+++ hadoop/chukwa/trunk/conf/nagios.properties.template Thu Apr 23 19:25:48 2009
@@ -0,0 +1,183 @@
+log4j.rootLogger=debug,CONSOLE,NAGIOS
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d [%t] %-5p (%F:%L) - %m%n
+log4j.logger.org.apache.hadoop.chukwa.MySQLWriter=ERROR, CONSOLE
+
+# our custom handler for nagios
+log4j.appender.NAGIOS=org.apache.log4j.nagios.NagiosAppender
+log4j.appender.NAGIOS.Host=@TODO-NAGIOS-SERVER@
+log4j.appender.NAGIOS.Port=5667
+
+# -------------------------------------------------------------------------------------------
+# Nagios Message Structure
+#
+#   This appender will send a structured message via the Nagios native protocol to the 
+#   nagios server.  A nagios message is made up of the following components.
+#
+#   HOST
+#   SERVICE NAME
+#   RETURN CODE
+#   MESSAGE
+#
+#   The majority of what you need to think about when using this appender is  ...
+# 
+#      1. How to assign the value for HOST (options allow hardcoding or programmatic lookup)
+#      2. How to assign the value for SERVICE (options similar to 1.)
+#      3. The mapping between log4j levels and Nagios levels that matches your needs.
+#      4. The layout for the raw MESSAGE
+#
+# -------------------------------------------------------------------------------------------
+
+# -------------------------------------------------------------------------------------------
+#
+# Nagios Enryption
+#
+# The config file tells us how to encrypt the data.  As of version 0.0.3, the 
+# NagiosAppender supports XOR encryption (thanks to Bob Ingraham!!)  If you 
+# are sending messages in the clear, simply leave the following setting commented
+# out, and the appender will assume the default (no encryption).
+#
+# Future versions are expected to support more of the available choices 
+# (anyone with encryption experience willing to help out here?)
+#
+# NOTE: the config file will be read only once ... if you need to change the encryption
+# method, you will need to restart your application for the change to take affect.
+#
+# -------------------------------------------------------------------------------------------
+# If send_nsca was installed on this system, maybe we just want to point to it ....
+#log4j.appender.NAGIOS.ConfigFile=/usr/local/nagios/nsca-2.4/send_nsca.cfg
+# or, we can just include our own version with our application
+log4j.appender.NAGIOS.ConfigFile=/grid/0/gs/conf/chukwa-current/nsca_send_clear.cfg
+
+# -------------------------------------------------------------------------------------------
+# Nagios SERVICE_NAME
+# -------------------------------------------------------------------------------------------
+
+# You can either hardcode the nagios service name in this file ....
+log4j.appender.NAGIOS.ServiceNameDefault=MDL
+
+# ... or you can override the above and set it programatically, using something like the
following ...
+#  org.apache.log4j.MDC.put("instance", "APPLICATION_FOOBAR");
+#  ... or ....
+#  org.apache.log4j.MDC.put("instance", System.getProperty("APP_NAME","UNKNOWN"));
+# ... in which case, all you need to do in this file is specify the key you used
+#log4j.appender.NAGIOS.useMDCServiceName=true
+#log4j.appender.NAGIOS.MDCServiceNameKey=instance
+
+# -------------------------------------------------------------------------------------------
+# Nagios HOST
+# -------------------------------------------------------------------------------------------
+
+# Dynamic Assignment
+# 
+# You can control whether your hostname shows up as a fully qualified domain name, 
+# or just the first portion of the fqdn:
+
+# For example .... if the fully qualified domain name is 'www1.amazon.com' .....
+
+# www1
+#log4j.appender.NAGIOS.useShortHostName=true
+# www1.amazon.com
+log4j.appender.NAGIOS.useShortHostName=false
+
+# Static Assignment
+# 
+# You can take all the guess work out of the interface name
+# that will be sent upstream vi nsca, and just tell us what key in MDC has the appropriate
+# name
+#log4j.appender.NAGIOS.useMDCHostName=true
+#log4j.appender.NAGIOS.MDCHostNameKey=nagios_host_name
+#log4j.appender.NAGIOS.InitializeMDCHostNameValue=www1
+
+# -------------------------------------------------------------------------------------------
+# Nagios RETURN CODES
+# -------------------------------------------------------------------------------------------
+#
+# This section is where you control the mappings between the log4j logging levels, 
+# versus the Nagios alert levels.  To make things clear, I've designed the appender to 
+# NOT assume any default mappings.  This way, you have total control over which messages
+# get passed on up to nagios.  For example, most users will want to avoid sending
+# debug and info messages to nagios, but they probably will want to send on warnings,
+# errors, and fatals.  The following mappings reflect this convention.
+#
+# NOTE: if you don't declare the mapping, the appender WILL NOT SEND THE MESSAGE TO NAGIOS
+
+#log4j.appender.NAGIOS.Log4j_Level_DEBUG=NAGIOS_UNKNOWN
+log4j.appender.NAGIOS.Log4j_Level_INFO=NAGIOS_OK
+log4j.appender.NAGIOS.Log4j_Level_WARN=NAGIOS_WARN
+log4j.appender.NAGIOS.Log4j_Level_ERROR=NAGIOS_CRITICAL
+log4j.appender.NAGIOS.Log4j_Level_FATAL=NAGIOS_CRITICAL
+
+# -------------------------------------------------------------------------------------------
+# Option: Filtering
+#
+# Filters are very useful when introducing Nagios into a backroom with legacy applications.
+#
+# Rather than sending on ALL error messages to your nagios server, you might want to consider

+# turning on IncludeFilters, and speficically identifying the handfull of problem messages
you 
+# need to keep an eye on.  Unless a message passes one of your include filters, it won't
get
+# sent.
+# 
+# The same applies if you are interested in MOST of the messages, but want to suppress the
ones
+# that duplicate information you already know.  But turning on ExcludeFilters, you can suppress

+# these annoying messages ...
+# 
+# Filters are defined by Java regex patterns (see http://java.sun.com/docs/books/tutorial/essential/regex)
+#
+# See the file NagiosIncludeExcludeFilters.properties for example entries
+#
+# -------------------------------------------------------------------------------------------
+# 
+# Filtering
+#log4j.appender.NAGIOS.IncludeFilterEnabled=true
+#log4j.appender.NAGIOS.ExcludeFilterEnabled=true
+#log4j.appender.NAGIOS.PatternFilterFile=conf/NagiosIncludeExcludeFilters.properties
+
+# -------------------------------------------------------------------------------------------
+# Option: Custom Message at Startup
+# -------------------------------------------------------------------------------------------
+# 
+# This is an optional message that will get sent as soon as the appender gets
+# instantiated.  This can be helpful in identifying problems where the application dies quietly,
and 
+# gets restarted by someone (or some automated process).
+#
+# Simply choose the level that fits your use case, and assign the appropriate message.
+#
+
+#log4j.appender.NAGIOS.SendStartupMessageOK=Application Starting
+#log4j.appender.NAGIOS.SendStartupMessageUNKNOWN=Application restarted for some reason
+#log4j.appender.NAGIOS.SendStartupMessageWARN=Application Errors Cleared
+#log4j.appender.NAGIOS.SendStartupMessageCRITICAL=Application Restarted ... Sound the Alarm!!!
+
+# -------------------------------------------------------------------------------------------
+# Option: Layout
+# -------------------------------------------------------------------------------------------
+
+# Here is the key the appender will use to populate with the value of the
+# system's canonical hostname .... look at the layout usage at the end of this file
+# to see how you might want to use it 
+log4j.appender.NAGIOS.MDCCanonicalHostNameKey=nagios_canonical_hostname
+
+# -------------------------------------------------------------------------------------------
+# Option: Layout
+# -------------------------------------------------------------------------------------------
+#
+# The Nagios appender supports standard layouts
+# 
+
+log4j.appender.NAGIOS.layout=org.apache.log4j.PatternLayout
+
+# Here is a rather typical definition ....
+log4j.appender.NAGIOS.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
+
+# Here is a layout that embeds the server name into the message delivered to Nagios ... not
really
+# necessary if we're already using the HOST parameter for this information, but if we're
using the
+# HOST parameter for a virtual name .... like 'APP_SERVER', then we can add a little context
by
+# including the physical hostname in the message.  The resulting message sent to nagios would
+# then contain the physical hostname pre-pended to the raw message.
+#log4j.appender.NAGIOS.layout.ConversionPattern=%X{nagios_canonical_hostname}: %m%n
+
+log4j.appender.NAGIOS.SendStartupMessageOK=Application Starting
+

Modified: hadoop/chukwa/trunk/default.properties
URL: http://svn.apache.org/viewvc/hadoop/chukwa/trunk/default.properties?rev=768021&r1=768020&r2=768021&view=diff
==============================================================================
--- hadoop/chukwa/trunk/default.properties (original)
+++ hadoop/chukwa/trunk/default.properties Thu Apr 23 19:25:48 2009
@@ -33,3 +33,4 @@
 TODO-AGENTS-INSTANCE-NAME=chukwa
 TODO_CHUKWA_JDBC_DRIVER=
 TODO_CHUKWA_JDBC_URL_PREFIX=
+TODO-NAGIOS-SERVER=localhost



Mime
View raw message