Jul 10 2007

Awstats on Tomcat

Catégorie : Tomcat, Web server, LinuxCharles Collier @ 11:35 pm

I’ve found this little tutorial two years ago and it helps me a lot with awstats on tomcat, i hope it can be useful for you….

AwStats
Author: John Smith (first website found) it seems to have a mirror here

Tomcat statistics

Requirements

  • Perl 5.2 or above
  • Tomcat 5 (I can’t see any reason for Tomcat 4 not to work, I haven’t tried it, though)
  • awstats.war file (see downloads)

Changing Tomcat access logs format

Tomcat access logs format isn’t exactly what we need. We could also have modified AWStats configuration files, but with the loss of important information. Thus, let’s make Tomcat logs compatible with AWStats. Logs are configured in [Tomcat_install]/conf/server.xml. They might look something like:

<Valve className=“org.apache.catalina.valves.AccessLogValve” directory=“logs” prefix=“localhost_access_log.” suffix=“.txt” pattern=“common” resolveHosts=“false”/>

Normally this lines are commented. Just take in mind they should appear, uncommented, within your Host definition.

We will replace the valve definition with this one:

<Valve className=“org.apache.catalina.valves.AccessLogValve” directory=“logs” prefix=“www_mydomain_com_access_log.” suffix=“.log” pattern=“combined” fileDateFormat=“dd-MM-yy” resolveHosts=“false”/>

Enable Perl scripts

Tomcat has disabled by default CGI executions. This is because CGIs do not conform Tomcat security box. But we know exactly what we are going to do, aren’t we ….. ?

The only thing you need to do is renaming [Tomcat_install]/server/lib/servlets-cgi.renametojar to [Tomcat_install]/server/lib/servlets-cgi.jar. This will enable AWStats Perl scripts to execute on Tomcat server. When it’s done, restart Tomcat.

There is something more done through awstats.war file’s web.xml. You might want to look at this file once downloaded.

Install AWStats

AWStats is included in awstats.war file, therefore you will not need to install AWStats by hand.

Deploy awstats.war file. Will suffice copying this file into [Tomca_install]/webapps folder, but in case your Tomcat is configured not to auto-deploy war files, unzip it yourself. By default would create an [Tomca_install]/webapps/awstats folder.

Although you could change default context, isn’t a good idea. At least not to start with. Better make it work and then think about changing things.

Configure AWStats

This is the hardest part, did you already take a coffe?

First we will make some assumptions, are these ones:

  • awstats.war was deployed into /awstats default context. See Install AWStats.
  • Our domain is www.mydomain.com.

Now, go to [Tomca_install]/webapps/awstats/WEB-INF/cgi-bin folder. Next instructions make the assumption this is your current working folder.

  1. Copy awstats.model.conf into awstats.www.mydomain.com.conf.
  2. Edit awstats.www.mydomain.com.conf.

You can use any text editor of your preference. Now, we will change some file default values. You must look for the attributes and change their values as shown below:

LogFile=”[TI]/webapps/awstats/WEB-INF/tools/logresolvemerge.pl [TI]/logs/*.log |”

LogType=W

LogFormat=1

LogSeparator=” ”

SiteDomain=”www.mydomain.com”

DNSLookup=1

DirData=”.”

DirCgi=”/cgi-bin”

DirIcons=”/awstats/icon”

Remember replacing [TI] with full path to Tomcat. And www.mydomain.com with your domain name.

Update site statistics.

Here you have two choices:

  1. Set AllowToUpdateStatsFromBrowser=1 in awstats.www.mydomain.com.conf file, see above. This will allow updating from the web browser with: http://www.mydomain.com/awstats/cgi-bin/awstats.pl?config=www.mydomain.com&update=1.
  2. Using Telnet or SSH, go to [Tom ca_install]/webapps/awstats/WEB-INF/cgi-bin folder and run perl awstats.pl -config=www.mydomain.com -update.

View site statistics.

Type http://www.mydomain.com/awstats/cgi-bin/awstats.pl?config=www.mydomain.com. That was all.

Creating separated domain statistics.

From the instructions above, everything is valid for creating separated domain statistics, except for one thing:

Inside your awstats.www.mydomain.com.conf we said:

LogFile=“[TI]/webapps/awstats/WEB-INF/tools/logresolvemerge.pl [TI]/logs/*.log |”

This line was gathering the whole set of log files, and this is against having statistics appart for each domain. We should replace this line to match the log files for the corresponding domain, as we said when changing Tomcat access logs format:

LogFile=“[TI]/webapps/awstats/WEB-INF/tools/logresolvemerge.pl [TI]/logs/www_mydomain_com*.log |”

Important! Don’t omit the asterisk in pointing the log files. Take in mind that Tomcat will create an access log file for each day, and that final file’s name will include the date.


Mar 23 2007

Zenoss - presentation

Catégorie : Zenoss, Supervision, network, Zope, LinuxCharles Collier @ 12:52 pm

The new version of Red Hat Entreprise Linux was launched on March 14th. RHEL 5 includes a lot of new features such as:

  • Application Design/Construction/IDE/Analysis
  • Application Server/Integration Server
  • Back-Office Enterprise
  • Collaboration/Groupware/Messaging
  • Consumer
  • Content Management/Authoring
  • CRM
  • Enterprise Resource Planning
  • Information Access/Delivery/Mining/Portal
  • Information/Data Management/Database
  • Middleware/Message-oriented/Transaction
  • Network Management
  • Networking
  • Other Development Tools
  • Security
  • ServerWare/Clustering/Web/VM
  • Storage
  • Systems Management

Considering the Network management, i’ll do a short focus on Zenoss.

Zenoss is an open source network monitoring and systems management platform - 1 year old :-) it was launched in March 2006.
Zenoss is a full package. It is built on the Zope Application server (python technology).

You can monitor what ever you want (if it has an ip address): network devices: appliance (firewall, switch,…) or server, applications (web site,…), operating systems, environment,…

Your standard protocol tools:
SNMP, SNMP Trap, Ping/ICMP, SSH/Telnet, Syslog, WMI, Nagios Agents, XMP/RPC Interface

Zenoss provides
Availability - It test all your device and appliance with a continious scheduling
Inventory and configuration - You can manage all your appliance by device or groups
Discovery - It can describe all your IT environment
Performance monitoring - Collect data from your server, network, and application graphing them
Event management - Collect data (syslog, WMI, SNMP trap, custom events (as defined by the Zenoss web services API)) and analyse it by correlation.
Reporting - You can create your own and custom reports
Web portal - You have a web console (off course with AJAX components) to view and control with a secure access all the elements with a real-time information


Mar 20 2007

En recherche active sur Grenoble

Catégorie : Web & J2EE server, RedHat, Database, News, Oracle, LinuxCharles Collier @ 1:49 am

Je suis actuellement à la recherche d’un poste en region Rhône-alpes, à Grenoble.
Ma mission actuelle se termine le 30 Mars. Je suis disponible à partir du 2 Avril.

Je recherche parmi les types de postes ci dessous:
Architecte technique
Chef de projet technique
Administrateur Systeme Linux et/ou DBA Oracle

L’environnement technique du poste pourrait etre basé sur Linux, Oracle (base de données et serveur J2EE), le monde open-source (serveur d’application J2EE jboss, supervision avec Nagios/Cacti)
Le poste serait donc idéalement axé sur de fortes compétences techniques, pour un rôle d’expertise, de gestion de projet, ou d’administration (je ne souhaite plus m’orienter vers du développement)

N’hesitez pas à me contacter par mail ou par téléphone:

Formulaire de contact mail.

Mon CV (en français)


Mar 08 2007

The Deployment scanner - jboss

Catégorie : Web & J2EE server, Jboss, Tips and tricksCharles Collier @ 1:13 am

Start

The conf/jboss-service.xml file is full of options. One of these ones is about the deployment scanner. If you make any change in a jboss config file then you’ll have to restart the server.

Open the conf/jboss-service.xml in vi or some text editor capable of saving in plain text. Scroll near the bottom to the MBean definition for the DeploymentScanner:

Deployment Sorter

As you scroll down you should see some comments followed by this:

org.jboss.deployment.DeploymentSorter

This is the deployment sorter which enforces the default deployment order. Starting from 4.0.1, it gets the sort order from the MainDeployerss EnhancedSuffixOrder. If you prefer a UNIX System-V init style you can comment this sorter and uncomment the following line:

org.jboss.deployment.scanner.PrefixDeploymentSorter

This sorter will use a numeric prefix-based order. If you wish to use this sort, you should read further on the prefix deployment order.

Scan Period

As you scroll further you will find:

5000

The default value is 5000 milliseconds or 5 seconds. This determines how frequently the directories which the Deployment Scanner is watching (/deploy) will be polled. Of course it very usefull when you are under development. But when you a production server this option should be disable (because of waste CPU, or protect from unwanted productions changes)

URLs

As you scroll further you will find:

deploy/

It will defined where data (such as .ear or .war) for hot deployments will be used.
It could even be http://url or webdav url.
For example, if you wanted to protect the database passwords you might do this:

deploy/,datasources/

You could set the file system permissions on datasources/ such that JBoss could read them, but developers could not.

Recursive

Finally, you should see:

True

This will cause the deployment scanner to recurse into subdirectories. Read this for more informaton on the drawbacks.

Disable Hot Deployment

Add the following attribute:

false

Feb 22 2007

Apache - Directive Listen

Catégorie : Apache, Web & J2EE serverCharles Collier @ 9:17 pm

Au moment de son démarrage, Apache ecoute sur un port et à une IP definié dans http.conf
Par defaut il ecoute sur toutes les adresses IP et sur le port 80
Il est possible de créer des combinaisons IP/port. Cette possibilité peut s’averer utile dans le cadre de la definiton de Virtual hosts

Par exemple:

pour que Apache accepte les connexions sur les ports 80 et 8080:

Listen 80
Listen 8080

Pour que Apache accepte les connexions sur deux combinaisons IP/ports précises:

Listen 192.168.1.1:80
Listen 192.168.1.20:8080


Feb 17 2007

Definition d’un datasource sous jboss

Catégorie : Web & J2EE server, JbossCharles Collier @ 2:56 pm

Pour mettre en place, une datasource, il suffit de prendre un exemple ici /usr/local/jboss/docs/examples/jca/*-ds.xml

oracle-ds.xml par exemple

copier le /usr/local/jboss/server/default/deploy/ sous le nom fichier_de_datasource.xml

il faudra y faire reference dans les fichiers de config xml de l’appli qui sera deployer sous jboss:

Jboss_datasource_definition


Feb 01 2007

JBoss - open source J2EE application server

Catégorie : Jboss, Tutoriaux, LinuxCharles Collier @ 10:45 pm

* What is Jboss?
* Downloading Jboss
* Installing JBoss
-with command line
-with graphical mode
* Running JBoss
* Exploring the Directory Structure
* Configuration
* Deploying an application to JBoss
* Summary

JBoss is an open source J2EE application server. It is J2EE 1.4 spec-compliant, which means that it offers the same level of functionality as its more expensive commercial counterparts such as Oracle Application Server, Websphere (IBM) or Weblogic (BEA). The main difference is the price and to be honest the main admin interface.For example, an absolute beginner would find more comfortable to have a web interface to declare a jdbc datasource, instead of declaring it with “VI” editing an xml file. Considering the reliability of other open source products like Apache web server, Jboss should also become more popular and reliable, but it has already begun to become a serious competitor for the market leaders.

Although the term application server applies to all platforms, it has become heavily identified with the Sun Microsystems J2EE platform; we should always say Jboss is a J2EE application server

What is Jboss?

Go to the JBoss Application Server Downloads page. -> http://labs.jboss.com/portal/jbossas/download

Choose the latest production version of the JBoss Application Server package. (4.0.5 Production 2006-10-18) Since the 4.0.3 SP1 version, you can try a “Run Installer” http://jboss.sourceforge.net/jnlp/jems-installer-1.2.0.GA.jnlp or download it. You must have a X console or a graphical interface to use it.


Feb 01 2007

Oracle Application Server 10g - part I - Presentation & Introduction

Catégorie : Tutoriaux, Oracle Application Server, OracleCharles Collier @ 9:02 pm

Oracle Application Server (latest version 10g) also called OAS 10g is a very huge box. OAS is gathering various products: Oracle Portals, Oracle Reports, Oracle Forms,…. all of these running with the “kernel” of OAS: the OC4J container which belongs to the Application Server 10g instances. It is the main component of OAS. Using it, we got a Three-tier model architecture.

Three-tier is a client-server architecture in which the user interface, functional process logic (”business rules”), data storage and data access are completely independent. There are developed and maintained as independent objects. A fundamental rule in a three tier architecture is that the Client tier never communicates directly with the Data tier; in a three-tier or three-layer model all communications go through the second-tier: the Middleware tier.

The different layers in an Oracle application server 10g architecture:

> Client tier
Contains the web browsers for end users

> OAS tier
Contains the OAS (especially the OC4 container), the OHS (Oracle HTTP server)
and the webcache (optional) (and sometimes other modules)

> Database tier
Contains the Database (Oracle one or another one)

Considering different aspects: business impacts, criticism, number of users…. and depending on “how much you have for your server architecture”, the Oracle application server 10g architecture can be considered as a Four-tier model.

If you firm was big enough, the OAS tier would be divided into two parts, and you would get this kind of architecture:

> Client tier
Contains the web browsers for end users

> OHS tier
the OHS (Oracle HTTP server) and the webcache (optional)

> OAS tier (or app. server tier)
Contains the OAS (especially the OC4 container) and the other OAS modules

> Database tier
Contains the Database (Oracle one or another one)

Why doing that ?

For security, flexibility, reliability… usually you don’t have only one server for each tier. At least you would have two servers for each tier. Therefore you can easily maintain the servers, you can shutdown one OHS and the application will still be available - of course it would mean that you have got a load-balancer, in front of the OHS

You can have a very scalable architecture depending on your needs and the evolution of your activities during the year.

OAS 10g is not a simple J2EE application server, it is full of optional modules/components, such as:

Middle tier:

J2EE & web services:
Oracle HTTP Server
Oracle AS Containers for J2EE(OC4J)
Oracle AS toplink
Oracle Business Components for Java (BC4J)
Oracle AS web services
Oracle XML developer Kit
Oracle PL/SQL
Oracle AS Map/viewer

Datamining:
Oracle Reports Server

A component which helps a lot for reports or spreadsheets filled with oracle database data.

Oracle Forms Server
format, and render end-user presentation pages, based on data in an Oracle Database.

Oracle Discoverer

Oracle Personalization
personalised webspace (url history customize data content)

Portal:
Oracle Portal

A component to create content-based web site.

Oracle Portal Developer Kit

Wireless:
Oracle AS wireless

Web Cache:
Oracle AS web Cache

‘interconnection’:
Oracle AS InterConnect

Oracle As ProcessConnect

Infrastructure:

Oracle Internet Directory (OID)
It is the oracle LDAP, to store all the user information

Single Sign-On (SSO)
authentication modules for all the oracle modules and many others which can base their system on it.

Oracle Certificate Authority

Metadata repository (or Infrastructure)
It stores Application Server 10g metadata and it manages multiple oracle components through a unique interface