Upload
vocong
View
221
Download
1
Embed Size (px)
Citation preview
Table of Contents
About Ineat Conseil.............................................................................................................................3 About the author..................................................................................................................................3 Introduction.........................................................................................................................................3 Principle...............................................................................................................................................3
Installation......................................................................................................................................4 Jolokia on the DAS....................................................................................................................4
Prerequisite............................................................................................................................4 Deployment...........................................................................................................................4 Validation...............................................................................................................................4
On the monitoring server...........................................................................................................4 Prerequisite libraries (with internet access)...........................................................................5 Prerequisite libraries (without internet access).....................................................................5 Jmx4perl................................................................................................................................6
OS libraries with internet access.......................................................................................6 OS libraries without internet access.................................................................................7 Perl libraries with internet access.....................................................................................7
Bundle::CPAN.............................................................................................................7 Digest::SHA1...............................................................................................................7 JSON............................................................................................................................7 Term::ProgressBar.......................................................................................................7 Term::Size....................................................................................................................8 XML::LibXML............................................................................................................8 Nagios::Plugin..............................................................................................................8 JMX:Jmx4Perm...........................................................................................................8
Perl libraries without internet access................................................................................8 Validation........................................................................................................................10
Opsview...............................................................................................................................10 Prerequisite.....................................................................................................................10 Installation with internet access......................................................................................10 Installation without internet access.................................................................................11 Configuration..................................................................................................................11
PostFix (Optional)...............................................................................................................12 Installation with internet access......................................................................................13 Installation without internet access.................................................................................13 Configuration..................................................................................................................13
Opsview monitoring configuration.....................................................................................13 Main Page.......................................................................................................................13 Host.................................................................................................................................14 Host template .................................................................................................................14 Service Groups................................................................................................................15 Service Checks................................................................................................................16 Contact............................................................................................................................17 Notifications...................................................................................................................17
About Ineat ConseilINEAT CONSEIL is a consulting and service provider company specialized in Enterprise Information Management/EIM. Its Job is to improve your way to use and manage information into your company through support, Business and IT in order to fit your real needs. Dematerialization, EDM, archiving, collaborating tools, portals, workflow and search engines projects are the essence of our skills. Through 75 collaborators, Ineat is impressively expanding, today we are already settle in Ile de France and Nord Pas de Calais
About the authorSimon Steinmetz is a IT engineer, specialized in software architecture. He studied during five years at the Institute of Informatics and Industrial Genius (IG2I), which is an Lille Central School department, where he specialized himself in Industrial computing. After that, he works two years in research and development at Atos Worldline where he learns and develop his knowledge in different subjects.Then, he chooses to integrate Ineat Conseil where he still works and, during 4 years, Simon works for different customer.Fisrt, he works for an Insurance company as designer and developer before working on IT architecture and SOA problems. This is the first experience he had with OpenESB. Next, after 4 years, he decided to move for another customer, Leroy Merlin where he works for an important project which consist to rebuilt the website. In this project, OpenESB was chosen to deal with all the components and expose services only for the front office.
More informations : [email protected]
Introduction
This document explain a way to monitor Glassfish and OpenESB over http. To realise that, we need to install some tools : Opsview (nagios), jmx4perl, jolokia and mysql (it is possible to use another database).
Principle
Page 3/17
As you can see, there is two parts in this schema. One part is on the server you want to monitor (in your case, glassfish AS where the DAS is installed) and this other part is the server that will realize the monitoring.
Installation
Jolokia on the DAS
On the DAS, the only component to install (to deploy) is jolokia (http://www.jolokia.org/ )Jolokia is a JMX-HTTP bridge giving an alternative to JSR-160 connectors. It is an agent based approach with support for many platforms. In addition to basic JMX operations it enhances JMX remoting with unique features like bulk requests and fine grained security policies The purpose of this component is to translate HTTP request (JSON) in JMX request and JMX response into HTTP response (JSON).
Prerequisite
First of all, you have to download a web archive jolokia-war-1.0.1.war or a newer version. You can find this archive here :
http://labs.consol.de/maven/repository/org/jolokia/jolokia-war/1.0.1/jolokia-war-1.0.1.war
Next, you have to ensure that the DAS (glassfish) is started
Deployment
The only thing you have to do is to deploy the war on glassfish. You can do it using the GUI or the asadmin commands:
asadmin deploy –user=$user –passwordfile=$path_to_pwd_file –contextroot=jolokia jolokia-war-1.0.1.war
Validation
To validate the deployment, you just have to acces this url:
http:// <nom_machine>:<http_port>/jolokia
And you should be able to see something like this:
{"timestamp":1323797791,"status":200,"request":{"type":"version"},"value":{"protocol":"6.0","agent":"1.0.1","info":.....
On the monitoring server
On this server, you have several thing to install: mysql, nagios, opsview and jmx4perl.
As jolokia on glassfish side, jmx4perl will tranform JMX request from opsview/nagios to http request for jolokia. Jmx4perl is used by opsview as a plugin.
Page 4/17
The database is used by nagios to store informations about check point, host, profile and so on
The opsview installation with internet acces should install mysql and nagios but it is recommended to first install mysql alone and then install opsview.
Prerequisite libraries (with internet access)
First, perl 5.8.8-15.el5_2.1 or newer version has to be install => yum install perl
As we said before, it is better to install mysql alone (except if it is already installed....)=> yum install mysql-server
Prerequisite libraries (without internet access)
This part concern only the installation without internet access because if your server can access its OS repository, all the necessary libraries should be installed during tools installation.Here is the rpm list you have to download (http://apt.sw.be/ for example):
- alsa-lib-1.0.17-1.el5.${ARCH}- apr-1.2.7-11.el5_3.1.${ARCH}- apr-util-1.2.7-11.el5.${ARCH}- audit-libs-1.7.17-3.el5.${ARCH}- audiofile-0.2.6-5.${ARCH}- bash-3.2-24.el5.${ARCH}- binutils-2.17.50.0.6-14.el5.${ARCH}- chkconfig-1.3.30.2-2.el5.${ARCH}- chkfontpath-1.10.1-1.1.${ARCH}- coreutils-5.97-23.el5_4.2.${ARCH}- cpio-2.6-23.el5_4.1.${ARCH}- cracklib-2.8.9-3.3.${ARCH}- cracklib-dicts-2.8.9-3.3.${ARCH}- esound-0.2.36-3.${ARCH}- findutils-4.2.27-6.el5.${ARCH}- fontconfig-2.4.1-7.el5.${ARCH}- freetype-2.2.1-21.el5_3.${ARCH}- gawk-3.1.5-14.el5.${ARCH}- gd-2.0.33-9.4.el5_4.2.${ARCH}- giflib-4.1.3-7.1.el5_3.1.${ARCH}- glibc-2.5-49.${ARCH}- grep-2.5.1-55.el5.${ARCH}- gzip-1.3.5-11.el5_4.1.${ARCH}- httpd-2.2.3-43.el5.${ARCH}- hwdata-0.213.18-1.el5.1.noarch- initscripts-8.45.30-2.el5.${ARCH}- java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5.${ARCH}- jpackage-utils-1.7.3-1jpp.2.el5.noarch- kernel-2.6.18-194.3.1.el5.${ARCH}- libcap-1.10-26.${ARCH}- libdbi-0.8.1-2.1.${ARCH}- libfontenc-1.0.2-2.2.el5.${ARCH}- libFS-1.0.0-3.1.${ARCH}- libmcrypt-2.5.7-1.2.el5.rf.${ARCH}
Page 5/17
- libselinux-1.33.4-5.5.el5.${ARCH}- libtool-ltdl-1.5.22-7.el5_4.${ARCH}- libXfont-1.2.2-1.0.3.el5_1.${ARCH}- libXpm-3.5.5-3.${ARCH}- libXtst-1.0.1-3.1.${ARCH}- lm_sensors-2.10.7-9.el5.${ARCH}- lua-5.1.4-2.el5.rf.${ARCH}- mingetty-1.07-5.2.2.${ARCH}- module-init-tools-3.3-0.pre3.1.60.el5.${ARCH}- mrtg-2.14.5-2.${ARCH}- mysql-5.0.77-4.el5_4.2.${ARCH}- mysql-server-5.0.77-4.el5_4.2.${ARCH}- ncurses-5.5-24.20060715.${ARCH}- net-snmp-5.3.2.2-9.el5.${ARCH}- net-snmp-libs-5.3.2.2-9.el5.i386- net-snmp-perl-5.3.2.2-9.el5.${ARCH}- net-snmp-utils-5.3.2.2-9.el5.${ARCH}- net-tools-1.60-81.el5.${ARCH}- pam-0.99.6.2-6.el5_4.1.${ARCH}- perl-5.8.8-27.el5.${ARCH}- perl-DBD-MySQL-3.0007-2.el5.${ARCH}- perl-DBI-1.52-2.el5.${ARCH}- perl-IO-Socket-INET6-2.51-2.fc6.noarch- perl-Socket6-0.19-3.fc6.${ARCH}- pkgconfig-0.21-2.el5.${ARCH}- postgresql-libs-8.1.18-2.el5_4.1.${ARCH}- rpmforge-release-0.3.6-1.el5.rf.${ARCH}- ruby-1.8.5-5.el5_4.8.${ARCH}- ruby-libs-1.8.5-5.el5_4.8.${ARCH}- sed-4.1.5-5.fc6.${ARCH}- SDL-1.2.10-8.el5.${ARCH}- swig-1.3.29-2.el5.${ARCH}- ttmkfdir-3.0.9-23.el5.${ARCH}- udev-095-14.21.el5.${ARCH}- util-linux-2.13-0.52.el5_4.1.${ARCH}- xorg-x11-font-utils-7.1-2.${ARCH}- xorg-x11-fonts-Type1-7.1-2.1.el5.noarch- xorg-x11-xfs-1.0.2-4.${ARCH}- zlib-devel-1.2.3-3.${ARCH}
Next you need to install these rpm :
rpm -ivh ${RPM_NAME}
Jmx4perl
To install Jmx4Perl, you need to install several OS and perl libraries. As usual, two ways exist to install, with and without internet access.
Page 6/17
OS libraries with internet access
Here what you need to install, the library dependencies should be installed too with these command:
Perl 5.8.8-15.el5_2.1 or newer version has to be install => yum install perl
Gcc has to be installed => yum install gcc
libxml2 has to be installed => yum install libxml2 and yum install libxml2-devel
OS libraries without internet access
Here is the rpm list that you have to download depending on OS:
- cpp-4.1.2-48.el5.${ARCH}- gcc-4.1.2-48.el5.${ARCH}- glibc-devel-2.5-49.${ARCH}- glibc-headers-2.5-49.${ARCH}- kernel-headers-2.6.18-194.el5.${ARCH}- libgcc-4.1.2-48.el5.${ARCH}- libgomp-4.4.0-6.el5.${ARCH}- libxml2-2.6.26-2.1.2.8.${ARCH}- libxml2-devel-2.6.26-2.1.2.8.${ARCH}
${ARCH} can be x_86_64 for example.
Next, you have to install these rpm:
rpm -ivh ${RPM_NAME}
Perl libraries with internet access
Next you have to install some perl module. Get an interactive CPAN shell:
=> perl -MCPAN -e shell
Bundle::CPAN
Used to optimise the CPAN.pm behaviour
cpan[x]> install Bundle::CPAN
Digest::SHA1
cpan[x]> install Digest::SHA1
JSON
cpan[x]> install JSON
Term::ProgressBar
cpan[x]> install Term::ProgressBar
Page 7/17
Term::Size
cpan[x]> install Term::Size
XML::LibXML
cpan[x]> install XML::LibXML
Nagios::Plugin
cpan[x]> install Nagios::Plugin*
JMX:Jmx4Perm
cpan[x]> install JMX::Jmx4Perl
Perl libraries without internet access
To install perl libraries without internet access, you have to download the following perl module (http://www.cpan.org/) :
- Bundle::CPAN
- CPAN::Meta
- ExtUtils::MakeMaker
- File::Spec
- Locale::Maketext::Simple
- Module::CoreList
- Module::Load
- Module::Load::Conditional
- Params::Check
- IPC::Cmd
- ExtUtils::CBuilder
- ExtUtils::ParseXS
- Parse::CPAN::Meta
- Test::Harness
- ExtUtils::Manifest
- Compress::Raw::Bzip2
- Compress::Raw::Zlib
- Compress::Zlib
- IO::Zlib
- Package::Constants
- Archive::Tar
- Pod::Escapes
- Pod::Simple
Page 8/17
- Pod::Text
- Regexp::Common
- Pod::Readme
- ExtUtils::Install
- Perl::OSType
- version
- Module::Metadata
- Module::Build
- File::SearchPath
- Term::Clui
- Term::ShellUI
- Capture::Tiny
- Class::MethodMaker
- Digest::SHA1
- JSON
- Class::Accessor
- Config::Tiny
- Math::Calc::Units
- Params::Validate
- Nagios::Plugin
- Term::ReadKey
- Term::ProgressBar
- Term::Size
- Config::General
- Module::Find
- JMX::Jmx4Perl
You should have several tar.gz files. You have to extract them:
tar xvzf ${TAR_FILE}
Next you need to install these modules. Depending on the presence of a MakeFile.PL or Build.PL file in the extracted directory, the command will be little different:
- If MakeFile.PL:
sudo perl Makefile.PL;
sudo make;
sudo make install;
- If Build.PL :
sudo perl Build.PL;
Page 9/17
sudo perl Build;
sudo perl Build install;
Validation
To validate a module installation, you can use this command:
perl -M${MODULE_NAME} -e 1
Ex: perl -MJMX::Jmx4Perl -e 1
This command will return nothing if the module is correctly installed (“echo $?” should return 0 if execute just after the first command).
After the installation, you should be able to find these file: check_jmx4perl on the server.
This file should exist:
/root/<user_root>/.cpan/build/jmx4perl-1.04-XXXXXX/scripts/check_jmx4perl
if you don't find it, try this: find / -name check_jmx4perl*And you should find the file.
Well, JMX4PERL is correctly installed !!
Opsview
Prerequisite
Fisrt of all, you have to disable Security-Enhanced Linux extensions because opsview is not compatible with it:
Here is an example of what the file /etc/selinux/config has to look like
# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
# SELINUXTYPE=targeted
If you need to change this file, you also have to restart the server
Installation with internet access
Fisrt, you need to add the opsview repository to the server repository list. You can do that by creating this file: /etc/yum.repos.d/opsview.repo which has to contain this:
Page 10/17
[opsview]name = Opsview
baseurl = http://downloads.opsera.com/opsview-
community/latest/yum/rhel/5/$basearch
enabled = 1
protect = 0
gpgcheck = 0
You can then install opsview => yum install opsview
if your rrdtool version is more than 1.3, you also need to install dejavu-lgc-fonts :
yum install dejavu-lgc-fonts
Installation without internet access
Before installing opsview, you need rrdtools. Here is the rpm list you need to download (OS Repository) and install:
- directfb-0.9.25.1-1.el5.rf.${ARCH}- perl-rrdtool-1.4.4-1.el5.rf.${ARCH}- rrdtool-1.4.4-1.el5.rf.${ARCH}- tslib-1.0-1.el5.rf.${ARCH}
Installation: rpm -ivh ${RPM_FILE}
Next the rpm for opsview (http://downloads.opsera.com/opsview/yum/community/) :
- opsview-base-3.13.2.7041-1.el5.${ARCH}- opsview-core-3.13.2.7041-1.el5.noarch- opsview-perl-3.13.1.489-1.el5.${ARCH}- opsview-web-3.13.2.7041-1.el5.noarch
Installation: rpm -ivh ${RPM_FILE}
Configuration
You have several things to do in this part, the first one is to modify the .baschrc or .bash_profile of the nagios user (who was created during the installation) in order to add this line :test -f /usr/local/nagios/bin/profile && . /usr/local/nagios/bin/profile
Next, ensure that mysql server is started, if not start it.=> sudo /etc/init.d/mysqld status=> sudo /etc/init.d/mysqld start
Eventually, you can add mysql starting to the server starting:
chkconfig -add mysqldchkconfig mysqld on
You can eventually change the nagios password (by default: changeme):
Page 11/17
this is configure in the file /usr/local/nagios/etc/opsview.conf or use sudo passwd nagios
Then use nagios user:su - nagios
Now you have several sql script to play. The first one is used to create database:
– /usr/local/nagios/bin/db_mysql -u root -p${MYSQL_ROOT_PASSWORD}
The three following are for tools installation:
– /usr/local/nagios/bin/db_opsview db_install
– /usr/local/nagios/bin/db_runtime db_install
– /usr/local/nagios/bin/db_odw db_install
The last one is to generate configuration file :
– /usr/local/nagios/bin/rc.opsview gen_config
THE FOLLOWING INSTRUCTIONS SHOULD BE DONE AFTER JMX4PERL INSTALLATION
You now need to add the jmx4perl plugin to opsview. To do that, just copy the check_jmx4perl file to /usr/local/nagios/libexec
sudo cp check_jmx4perl /usr/local/nagios/libexec
and populate the plugin using this command:
/usr/local/nagios/bin/populate_db.pl plugins
Well, Opsview is installed and you can now start opsview and connect to the GUI.Starting opsview:
/etc/init.d/opsview-web start
Accessing the GUI:
Access here : http://<nom_machine>:3000/username: adminpassword: initial
You can find several interesting configuration (database, backup,user,...) in this file: /usr/local/nagios/etc/opsview.default
PostFix (Optional)
You also need to have mail service installed and configured. (It is useful if you want to send notifications by email but if you don't use this feature, you don't need to have postfix)
Page 12/17
Installation with internet access
To install postfix => yum install postfix
Installation without internet access
Here is the rpm you have to download (OS repository):
postfix-2.3.3-2.1.el5_2.x86_64
To install : rpm -ivh postfix-2.3.3-2.1.el5_2.x86_64.rpm
Configuration
For the postfix configuration, it depends of your infrastructure. Here is an example :
In the file /etc/postfix/main.cf, you have to add these lines:
relayhost = <your_smtp_host>
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_use_tls = yes
smtp_sasl_security_options = noanonymous
#if using certificatesmtp_tls_CAfile = xxx.crt
smtp_use_tls = yes
You also have to create the sasl_passwd file containing :
<your_smtp_host> <email_adress>:<password>
And, of course, if you use certificate, you need to have the certificate on the server.
After configuring postfix, you need to reload and relaunch:/etc/init.d/postfix reload
/etc/init.d/postfix restart
Opsview monitoring configuration
Main Page
When connected, you will arrive on the Opsview main page. Some parts have been enlightened, they are the main characteristics of Opsview Web console.
Page 13/17
1 – Tabs menu: Gives you rapid access to all Opsview functionalities. We'll focus on the followings:
a – Status: access to all servers statusb – Alerts: direct access to all kind of alertc – History : access to events history, availability diagrams...d- Advanced: create host groups
2 – Server and configuration status3 – Breadcrumb trail to locate your current position4 – Contextual action menu5 – Body
Host
Next you need to create a host. The host is the target Open ESB machine (or VM) we want to monitor. To do so, in the tab menu go to “Configuration” and simply choose “Host”.You should see all the hosts configured in Opsview. By default, the only host is the Opsview host itself.
In the top right of the screen there is an ACTION button. This actions button is contextual a give access to the specifics functionalities of the screen. Click on this button and choose “Create new Host”.
Just fill the “Primart Hostname/IP” with the Open ESB IP or hostname and give it a name in “Host Title” (OpenESB for example). Now click the “Next” button and “Submit changes”. Your host is created.
Host template
In the host detail, you may have seen the possibility to select a “Host template” among an existing list of templates. Those templates are logical regrouping of pre configured checks.
By default, there is no configured template for Glassfish or OpenESB in the Opsview package.
To create a host template, go to the “Configuration” tab menu and choose “Host templates”
Page 14/17
In the “Actions” contextual menu, in the top right, choose “Create new Host Template” option. Name your template, give it a description and save it.
Your template is created but just remains an empty shell. Like your host, it is not active. If you click on the “Monitors” tab, you can see groups of checks. You can select every check you need but there is still nothing about Glassfish or OpenESB.
Service Groups
The service groups are the thinnest grouping of Opsview checks. Host template defines the behavior of a Host. Service groups should be seen just as technical regrouping.
To create “Service Groups”, go to the “Advanced” tab menu and choose “Service Groups” option. Then choose “Create new Service Group” in the top right “Actions” menu.
Just give a name to your group and submit your work. Repeat this step for all groups you want to create.
The groups are created, and you need to put in it some checks. In the following screenshot you can see that you just have to drag and drop a check to move it from a group to another. However you still not have any OpenESB or Glassfish check. So you finally are going to create our own check and assign it to one of our service groups.
Page 15/17
Service Checks
The service check is the heart of Opsview. Based on Nagios and Jmx4Perl you can check the status of OpenESB JMX components.
To create our first check based on check_jmx4perl plugin, in the “Configuration” tab, select “Service checks”. Then in the contextual “Actions” choose “Create new Service Check”. Fill the form with the following parameters:
Name: Write a nameDescription: Write a descriptionService Group: Choose a service GroupPlug-in: check_jmx4perlArguments:
-u http://$HOSTADDRESS$:8080/jolokia -m MBEAN_NAME -(a/o) -c 'critique_return' -w 'warning_return'
The plugin check_jmx4perl takes several parameters. Here is a description of the main options:-u: url to the j4p or jolokia web application. $HOSTADDRESS$ is an Opsview variable containing the name or IP of the monitored server.-m: the mbean name.-a/-o: the mbean attribute you want to read (-a) or the operation on mbean you want to execute (-o)-c: the stream that indicates a critical status.-w: the stream that indicates a warning status.
Example:
-u http://$HOSTADDRESS$:8080/jolokia -m com.sun.jbi:ComponentName=sun-http-binding,ComponentType=Installed,ControlType=Custom,CustomControlName=Administration,InstalledType=Binding,JbiName=instance_name -o isEndpointActive AppliCA,AppliCAService,operationPort,Consumer -c 'false' -w '!true'
Page 16/17
-u http://$HOSTADDRESS$:8080/jolokia -m com.sun.jbi:ComponentName=sun-bpel-engine,ServiceType=ComponentLifeCycle,Target=cluster-client -a CurrentState -c 'Shutdown' -w '!Started'
Then validate the changes with “Submit Changes”.
You have created four objects, a host, a template host, a service group and a service checks but they are not all related, Only the service check is part of the service group. To make active our host we need to associate service group to host template. Then associate the host template to the host.
In the “Configuration” tab menu select “Host Templates”. In the host Templates list choose your host template and go to the “Monitor” tab. You can see our groups you just created. If you expand a service group you will find your first service check. Select it and save your host template.
In the “Configuration” tab menu select “Hosts” then your host and in the Host Template combo add our host template. Save your host.
Contact
For notifications purpose, you need to create contact. To create contact go to the “Configuration” tab menu select “Contacts”. Then choose “Create new Contact” in the top right “Actions” menu.Enter a name, user name and password. Choose the role. Next, go to the “Notification” tab where you have to enter an email.
Click on “Send and modify notification profils”
Notifications
Here you have to create a notification profile. Choose “Create new notification profile” in the top right “Actions” menu. Enter a name.Choose host groups for which you want to be notify.Choose the service groups for which you want to be notify.Choose for which state you want to be notify.Then submit.
In order Opsview take in account all the modifications, you have to reload configuration.Click on “Configuration status” then “Reload Configuration”.
Page 17/17