wiki:Obsolete/Doc/Monitoring/Lemon

Version 15 (modified by /C=BE/O=BEGRID/OU=VUB/OU=IIHE/CN=Stijn De Weirdt, 16 years ago) (diff)

--

Lemon description

short lemon description + links here

Agent configuration

A basic agent are configured by enabling them in the machine-types/base. Additional monitoring is added in the specific base-types.

To enable the agents, set

variable LEMON_CONFIGURE_AGENT = true;

There are also a number of site specific variables that need to set:

## Name of the lemon server
variable LEMON_SERVER_HOSTNAME = undef;

## Set the email address for receiving the exception notifications
variable LEMON_ALARM_MAIL = undef;

Additional variables (with the default options) can be

## The port to contact the lemon server
variable LEMON_CLIENT_PORT ?= 12409;

## The transport protocol used (UDP or TCP)
variable LEMON_TRANSPORT_PROTOCOL ?= 'UDP';

Extra

More than one lemon server

The default setup assumes a single lemon server (variable LEMON_SERVER_HOSTNAME). In case you want to add multiple servers, you need to add a new one to /system/monitoring/transport (see monitoring/lemon/client/base/config for the example).

Server configuration

The lemon server consits of an information collector and the webinterface (called LRF). Lemon supports 2 main types of information storing (using flatfiles or using Oracle). Currently only Oracle support is provided (but for the people with no access to an Oracle installation, the setup using OracleXE is provided).

Setup the lemon server config:

include monitoring/lemon/server/service;

Backend configuration

The backend is set using

## use OraMon or flatfile
variable LEMON_BACKEND ?= 'OraMon';

Oracle / OraMon

When using orcale as a backend, some oracle specific parameters need to be set:

## name of database to use
variable ORAMON_ORACLE_DATABASE_NAME ?= 'XE';
## 
variable ORACLE_HOME ?= '/usr/lib/oracle/xe/app/oracle/product/10.2.0/server';

## Local installation using XE or not
## (If true, don't forget the manual post-install steps!)
variable ORACLE_XE_LOCAL_INSTALL ?= true;

## Oracle user (must be created in oracle manually!)
## (this is not necessarily the same unix username that runs lemon services)
variable ORAMON_ORACLE_USER ?= 'lemon';
## Oracle password for this user
variable ORAMON_ORACLE_PASSWD ?= undef;

If you don't use/want a local XE installation, set ORACLE_XE_LOCAL_INSTALL to false and configure the oracle TNS (example for GRIF):

variable CONTENTS_ORACLE_TNS ?= <<EOF;
# tnsnames.ora Network Configuration File:
oracle_service_name.in2p3.fr =
    (DESCRIPTION = 
(ADDRESS=(PROTOCOL=TCP)(HOST=real_oracle_server_1.in2p3.fr)(PORT=1521))
 
(ADDRESS=(PROTOCOL=TCP)(HOST=real_oracle_server_2.in2p3.fr)(PORT=1521))
      (LOAD_BALANCE=yes)
      (CONNECT_DATA=
           (SERVER=DEDICATED)(SERVICE_NAME=oracle_service_name.in2p3.fr)
           (FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)
           (RETRIES=180)(DELAY=5))
     )
   )
EOF

flatfile

Nothing yet

LRF

The webinterface to lemon uses php and access to the backend. It also needs to know what machines to expect and based on their properties, how to group them. This is (for now) done with a nlist called NODES_PROPS. A basic example is

variable NODES_PROPS  = nlist(
	escape("mon.example.com"),nlist('type','MON','monitoring','yes'),
);

The name of the template that sets this variable is controlled through

variable LEMON_NODES_PROPERTIES_TEMPLATE ?= 'pro_nodes_properties';

The default value (ie the behaviour in case it's not defined) for the 'monitoring' is controlled through

variable LEMON_NODES_PROPERTIES_DEFAULT_MONITORING ?= 'yes';

NODES_PROPS example

An example used at IIHE to generate the monitoring part of NODES_PROPS

template site/lemon_nodes;

## in case of missing monitoring field 
variable LEMON_NODES_PROPERTIES_DEFAULT_MONITORING = 'yes';

## manual list, is respected when autocompleting
variable NODES_PROPS  = nlist(
	escape("egon.iihe.ac.be"),nlist('type','MON'),
);	

## list for order (first match is ok)
variable LEMON_PROPS_REGEXP_TYPE = list('WN','SE_DISK','CE','NFS');
variable LEMON_PROPS_REGEXP_MAP = nlist(
	'MON','XXXXX',
	'WN','node',
	'SE_DISK','behar',
	'CE','gridce',
	'NFS','fileserv',
);


### autocomplete this list based on DB_MACHINE and regexp
variable NODES_PROPS = {
	tmp = NODES_PROPS;
	dbm = DB_MACHINE;
	
	ok = first(dbm, k, v);
	while (ok) {
		if (exists(NODES_PROPS[k])) {
			ok = next(dbm, k, v);
		} else {
			mach = unescape(k);
			mach_to_use = mach;
			if (LEMON_SHORTHOSTNAME) {
				m = matches(mach,'([^\\.]+)(\..*)?');
				mach_to_use = m[1];
			};
			regs_order = LEMON_PROPS_REGEXP_TYPE;
			ok2 = first(regs_order, k2,v2);
			while (ok2) {
				if (exists(LEMON_PROPS_REGEXP_MAP[v2])) {
					reg = LEMON_PROPS_REGEXP_MAP[v2];
					if (match(mach,reg)) {
						tmp = merge(tmp,nlist(escape(mach_to_use),nlist('type',v2)));
						ok2 = false;
					} else {
						ok2 = next(regs_order, k2,v2);
					};
				};
			};
		
			ok = next(dbm, k, v);
		};
	};
	
	return(tmp);
};

Server post-install

LRF/php

  • Edit /etc/php.ini
    register_globals = On
    memory_limit = 32M
    register_long_array = on
    
  • Restart Apache
    /etc/init.d/httpd restart
    

Configure Oracle-XE

  • Run the configure command. Just put the same values that you have already set in your QWG templates.
    $ /etc/init.d/oracle-xe configure
    
    Oracle Database 10g Express Edition Configuration
    -------------------------------------------------
    This will configure on-boot properties of Oracle Database 10g Express
    Edition.  The following questions will determine whether the database should
    be starting upon system boot, the ports it will use, and the passwords that
    will be used for database accounts.  Press <Enter> to accept the defaults.
    Ctrl-C will abort.
    
    Specify the HTTP port that will be used for Oracle Application Express [8080]:
    
    Specify a port that will be used for the database listener [1521]:
    
    Specify a password to be used for database accounts.  Note that the same
    password will be used for SYS and SYSTEM.  Oracle recommends the use of
    different passwords for each database account.  This can be done after
    initial configuration:
    Confirm the password:
    
    Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:
    
    Starting Oracle Net Listener...Done
    Configuring Database...Done
    Starting Oracle Database 10g Express Edition Instance...Done
    Installation Completed Successfully.
    To access the Database Home Page go to "http://127.0.0.1:8080/apex"
    
    From now you have access the Database Home Page by either directly running a webbroswer on the lemon box or from another machine using tunneling

    Example (from your laptop):

Create the Oracle lemon user

  • On the Database Home Page, login as system user.
  • Go to Home>Administration>Manage Database Users>Create Database User.
  • Create a lemon user (use same password as the one you have set in the your QWG template).
  • Give it all the privileges.

Initiate Databases

  • Set the Oracle environment:
    source /etc/lemon/lemon-ora.admin_env.sh
    
  • Create databases:
    $ sqlplus system@XE
    
    SQL*Plus: Release 10.2.0.1.0 - Production on Mon Nov 19 15:05:58 2007
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Enter password:
    
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    
    SQL>create tablespace LEMON_INDX  logging datafile '/var/oracle/lemon_indx.dbf' size 500m autoextend on next 32m maxsize 2048m extent management local;
    SQL>create tablespace LEMON_DATA logging datafile '/var/oracle/lemon_data.dbf' size 1000m autoextend on next 32m maxsize 2048m extent management local;
    SQL>exit;
    
  • You can now initialize databases
    lemon-ora.admin --file=/etc/oramon-server.conf --create-schema
    lemon-ora.admin --file=/etc/oramon-server.conf --all
    

Make sure that the version of the cx_oracle package you get is compiled against the same version of Oracle you've installed. For Oracle 10g you can use cx_Oracle-4.3-10g-py24-1.i386.rpm available via rpmfind. If you install the wrong version of cx_oracle you may get errors like this:

unable to import Oracle API:  libclntsh.so.9.0: cannot open shared object file: No such file or directory
  • Add this line in /etc/init.d/lemonmrd:
    . /etc/sysconfig/httpd
    
    after
    export PYTHONPATH
    
  • Start services:
    /etc/init.d/OraMon start
    /etc/init.d/lemonmrd start
    

OracleXE + LRF only

  • Remove following functions from /var/www/html/lrf/oracle.inc :
    batchUpdate
    batchUpdateNC
    batchQuery