Install Monit on CentOS/Redhat

Monit is a free open source tool to monitor and manage linux system and services.

To install Monit on Redhat or CentOS, you need to enable EPEL (Extra Packages for Enterprise Linux). You need to login as root to enable EPEL and install monit.

$ ls /etc/yum.repos.d/

You will see some repo and conf at this path. Eg: redhat-rhui-client-config.repo,  rhel-source.repo, rhui-load-balancers.conf, etc

$ vi /etc/yum.repos.d/epel.repo

Add the following lines:

 name=Extra Packages for Enterprise Linux 5 – $basearch

Save and close file

$ yum clean all

Loaded plugins: amazon-id, rhui-lb, security

Cleaning repos: epel rhui-REGION-client-config-server-6 rhui-REGION-rhel-server-releases

              : rhui-REGION-rhel-server-rh-common

Cleaning up Everything

$ yum install monit

Loaded plugins: amazon-id, rhui-lb, security
Setting up Install Process
epel                                          | 3.7 kB     00:00     
epel/primary_db                               | 3.3 MB     00:01 
  monit.x86_64 0:4.10.1-9.el5                                                                                         
Dependency Installed:
  openssl098e.x86_64 0:0.9.8e-18.el6_5.2                                                                              

Adding SLF4J Logs to Akka

You might want to consider adding SLF4J plugin to your default Akka logs. This can help you standardize the logs and would help you in the better analysis of your logs.

Akka provides help on how you can plugin SLF4J into your akka application: 

I implemented the suggested approach and am listing down the simplified steps for quick reference.

Add dependency

Add akka-slf4j plugin and logback-classic dependency to your build.

Eg: Add the following to your pom.xml


If you are using SBT, then your build.sbt would look like:

libraryDependencies += “com.typesafe.akka” % “akka-slf4j” % “2.3.9”,
libraryDependencies += “ch.qos.logback” % “logback-classic” % “1.1.2”

Enable SLF4JLogger for Akka

Update your application.conf (src/main/resources) with the following:

akka {
event-handlers = [“akka.event.slf4j.Slf4jEventHandler”]
loglevel = “INFO”

Add logback.xml

Add logback.xml to your classpath. That is, create a logback.xml at src/main/resources. The following is an example of logback.xml. You can find more info about how you can configure your logs with the various patterns at:

<?xml version=”1.0″ encoding=”UTF-8″?>
<appender name=”CONSOLE” class=”ch.qos.logback.core.ConsoleAppender”>
<pattern>%d %X{akkaTimestamp} %-4r %-5level [%thread] %logger{0} %class{0} – %-5msg%n</pattern>
<appender name=”FILE” class=”ch.qos.logback.core.FileAppender”>
<pattern>%d %X{akkaTimestamp} %-4r %-5level [%thread] %logger{0} %class{0} – %-5msg%n</pattern>
<logger name=”akka” level=”DEBUG” />
<root level=”INFO”>
<appender-ref ref=”CONSOLE”/>
<appender-ref ref=”FILE”/>

Add Logs

Now you can add logs to your code, add the following to your scala code:

import akka.event.Logging

val log = Logging(context.system, this.getClass.getName)“Info message”)

log.warning(“Warning message”)

log.debug(“Debug message”)

log.error(“Error message”)