Installation

Taehui edited this page Jun 21, 2011 · 40 revisions
Clone this wiki locally

Requirements

Cloumon has the following requirements. Please read the section below carefully and ensure that all requirements have been satisfied. It will help you from strange errors.

Java

Cloumon requires java 6 from Oracle. Usually you'll want to use the latest version available except the problematic u18 (u24 is the latest version as of this writing).

ZooKeeper

Cloumon depends on a running ZooKeeper cluster. It is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. ZooKeeper can now be found at http://zookeeper.apache.org/

MySQL

Cloumon stores collected information in MySQL database, and then it is to be extended to other databases. You have to make tables bellow.

CREATE DATABASE monitor;
GRANT ALL PRIVILEGES ON monitor.* TO monitor@localhost IDENTIFIED BY 'monitor';
GRANT ALL PRIVILEGES ON monitor.* TO monitor@"%" IDENTIFIED BY 'monitor';

CREATE TABLE Host (
  HostName              VARCHAR(100) NOT NULL,
  HostIP                VARCHAR(255) NOT NULL,
  HostType              VARCHAR( 10) NOT NULL,
  CpuCores              INT(3),
  CpuModel              VARCHAR(255),
  CpuVendor             VARCHAR(255),
  CpuMhz                INT(5),
  MachineName           VARCHAR(100),
  MachineVersion        VARCHAR(100),
  MachineArch           VARCHAR(100),
  Machine               VARCHAR(100),
  MachineDescription    VARCHAR(100),
  MachinePatchLevel     VARCHAR(100),
  MachineVendor         VARCHAR(100),
  MachineVendorVersion  VARCHAR(100),
  MachineVendorName     VARCHAR(100),
  MachineVendorCodeName VARCHAR(100),
  MachineDataModel      VARCHAR(100),
  MachineCpuEndian      VARCHAR(100),
  MachineJvmVersion     VARCHAR(100),
  MachineJvmVendor      VARCHAR(100),
  MachineJvmHome        VARCHAR(100),
  MemotyTotal           BIGINT,
  SwapTotal             BIGINT,
  FileSystem            VARCHAR(255),
  NetworkInterfaces     VARCHAR(255),
  LiveStatus            VARCHAR(  1),   /* Y or N */
  AlarmOn               VARCHAR(  1),   /* Y or N */
  HostAlarm             VARCHAR(255),
  PRIMARY KEY (HostName)
 ) DEFAULT CHARSET='utf8' ;
  
CREATE TABLE MonitorItem (
  ItemID        VARCHAR( 20) NOT NULL,
  ItemName      VARCHAR( 50) NOT NULL,
  GroupName     VARCHAR( 50) ,
  AdaptorClass  VARCHAR(255) NOT NULL,
  defaultItem   VARCHAR(  1) ,
  Period        INT    (  6) DEFAULT 60,
  Params        TEXT,
  Description   TEXT,
  ALARM         TEXT         ,
  PRIMARY KEY(ItemID)
 ) DEFAULT CHARSET='utf8' ;

CREATE TABLE HostMonitorItem (
  ItemID        VARCHAR( 20) NOT NULL,
  HostName      VARCHAR(100) NOT NULL,
  ALARM         TEXT         ,
  PRIMARY KEY(ItemID, HostName)
 ) DEFAULT CHARSET='utf8' ;


CREATE TABLE MetricRecord (
  MetricRecordID  BIGINT       NOT NULL,
  ItemID          VARCHAR( 20),
  ItemName        VARCHAR( 50) NOT NULL,
  GroupName       VARCHAR( 50) ,
  HostName        VARCHAR(255) NOT NULL,
  HostIp          VARCHAR(255) NOT NULL,
  ResourceName    VARCHAR(255) , 
  MetricData      TEXT,
  CollectTime     DATETIME NOT NULL,
  PRIMARY KEY(MetricRecordID)
) DEFAULT CHARSET='utf8' ;


CREATE INDEX MetricRecord_IX01
    ON MetricRecord (ItemID);
    
CREATE INDEX MetricRecord_IX02
    ON MetricRecord (ItemName);

CREATE INDEX MetricRecord_IX03
    ON MetricRecord (GroupName);    
    
CREATE INDEX MetricRecord_IX04
    ON MetricRecord (HostName);
    
CREATE INDEX MetricRecord_IX05
    ON MetricRecord (CollectTime);    
        
CREATE TABLE CurrentMetricRecord (
  MetricRecordID  BIGINT       NOT NULL,
  HostName        VARCHAR(100) NOT NULL,
  ItemID          VARCHAR( 20),
  ItemName        VARCHAR( 50) NOT NULL,
  GroupName       VARCHAR( 50) ,
  HostIp          VARCHAR(255) NOT NULL,
  ResourceName    VARCHAR(255) , 
  MetricData      TEXT,
  CollectTime     DATETIME NOT NULL,
  PRIMARY KEY(MetricRecordID)
) DEFAULT CHARSET='utf8' ;

CREATE TABLE SummaryMetricRecord (
  MetricRecordID  BIGINT       NOT NULL,
  SummaryType     INT(1) NOT NULL,   /* 1: Monthly, 2:weekly */
  Year            INT(4) NOT NULL,
  Month           INT(2) NOT NULL,
  WeekOfYear      INT(2) ,
  FromDate        VARCHAR(8),
  EndDate          VARCHAR(8),
  HostName        VARCHAR(100) NOT NULL,
  ItemID          VARCHAR( 20),
  ItemName        VARCHAR( 50) NOT NULL,
  GroupName       VARCHAR( 50) ,
  HostIp          VARCHAR(255) NOT NULL,
  ResourceName    VARCHAR(255) , 
  MetricData      TEXT,
  PRIMARY KEY(MetricRecordID)
) DEFAULT CHARSET='utf8' ;

CREATE TABLE ServiceGroup (
  ServiceGroupName  VARCHAR(100) NOT NULL,
  PRIMARY KEY(ServiceGroupName)
) DEFAULT CHARSET='utf8' ;

CREATE TABLE ServiceHosts (
  ServiceGroupName  VARCHAR(100) NOT NULL,
  HostName          VARCHAR(100) NOT NULL,
  PRIMARY KEY(ServiceGroupName, HostName)   
) DEFAULT CHARSET='utf8' ;
 
 

Hadoop

Download & Build

$ mkdir /local
$ cd /local
$ wget --no-check-certificate https://github.com/gruter/cloumon/tarball/master -O cloumon.tar.gz
$ tar xvfz gruter-cloumon-xxx.tar
$ mv gruter-cloumon /local/cloumon-1.0.0
$ ln -s cloumon-1.0.0 CLOUMON
$ cd /local/CLOUMON
$ ant
$ cp build/cloumon*.jar .

Configuration

conf/cloumon-env.sh

$ vi conf/cloumon-env.sh
#JAVA HOME dir
export JAVA_HOME=/usr/java/latest
#CLOUMON home dir
export CLOUMON_HOME=/local/CLOUMON
#CLOUMON conf dir
export CLOUMON_CONF_DIR="${CLOUMON_HOME}/conf"
# The directory where pid files are stored. /tmp by default.
export CLOUMON_PID_DIR=/local/CLOUMON/.cloumon_pids

conf/cloumon-default.xml

<configuration>
  <property>
    <name>zk.servers</name>
    <value>192.168.10.100:2181,192.168.10.101:2181,192.168.10.102:2181</value>
    <description></description>
  </property>

  <property>
    <name>zk.sesion.timeout</name>
    <value>30000</value>
    <description>ms</description>
  </property>

  <property>
    <name>zk.service.root</name>
    <value>/cloumon</value>
    <description></description>
  </property>

  <property>
    <name>zk.service.cloumon.agent.userId</name>
    <value>hadoop</value>
    <description></description>
  </property>

  <property>
    <name>zk.service.cloumon.agent.password</name>
    <value>test1234</value>
    <description></description>
  </property>

  <property>
    <name>zk.service.cloumon.collector.userId</name>
    <value>hadoop</value>
    <description></description>
  </property>

  <property>
    <name>zk.service.cloumon.collector.password</name>
    <value>test1234</value>
    <description>comma separator</description>
  </property>

...

  <property>
    <name>cloumon.db.uri</name>
    <value>jdbc:mysql://192.168.10.10:3306/cloumon?user=cloumon&amp;password=cloumon1234</value>
    <description></description>
  </property>

  <property>
    <name>collector.writer.HadoopWriter.hdfs.filesystem</name>
    <value>hdfs://192.168.10.10:9000</value>
    <description>HDFS to dump to</description>
  </property>
  
  <property>
    <name>collector.writer.HadoopWriter.archivePath</name>
    <value>/user/hadoop/monitor/datas</value>
    <description></description>
  </property>

  <property>
    <name>collector.writer.LocalFileWriter.localOutputDir</name>
    <value>/home/hadoop/temp/monitor</value>
    <description></description>
  </property>

</configuration>

conf/cloumon-site.xml

conf/spring-conf.xml


<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
  xmlns:p="http://www.springframework.org/schema/p"
  xsi:schemaLocation="
           http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-3.0.xsd">

  <context:component-scan base-package="org.cloumon">
    <context:include-filter type="annotation"
        expression="org.springframework.stereotype.Service" />
    <context:include-filter type="annotation"
        expression="org.springframework.stereotype.Repository" />
  </context:component-scan>

  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url" value="jdbc:mysql://192.168.10.10:3306/monitor?useUnicode=true&amp;characterEncoding=UTF-8"/>
    <property name="username" value="cloumon"/>
    <property name="password" value="cloumon1234"/>
    <property name="defaultAutoCommit" value="false"/>
    <property name="poolPreparedStatements" value="true"/>
  </bean>

  <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
    <property name="dataSource" ref="dataSource"/>
  </bean>

</beans>

conf/agents

Agents IP List

192.168.10.10
192.168.10.100
192.168.10.101
192.168.10.102
192.168.10.103
...

conf/collectors

Collectors IP List

192.168.10.10
...

Deploy coumon to agent servers

...

Initialization

bin/cloumon manager -init

Start cloumon

bin/start-all.sh