Search


Tuesday, November 22, 2011

NRPE Installation


The NRPE addon is designed to allow you to execute Nagios plugins on remote Linux/Unix machines. This allow Nagios to monitor "local" resources (like CPU load, memory usage, etc.) on remote machines


Nagios NRPE Installation and Configuration

NRPE Installation

 

 Install nagios-nrpe & nagios-plugins using yum.
 Change the "allowed_hosts" value to the IP of nagios server in /etc/nagios/nrpe.cfg


yum install nagios-nrpe nagios-plugin-nrpe
chkconfig nrpe on
/sbin/chkconfig --list
ls /usr/lib/nagios/plugins
nano /etc/nagios/nrpe.cfg
allowed_hosts= local host  -- as the connection need to be established with the server itself
/etc/init.d/nrpe restart 
 
 
Port 5666 need to be opened for nagios

/sbin/iptables -I INPUT -p tcp -m tcp --dport 5666 -j ACCEPT

 

I am briefing the  NRPE  motoring with the help of an example.   Assume we are trying to implement a distributed monitoring.   

Master Server :-  Monitoring server          :   A
Remote server :- Server  to be monitored :   Z

Master server is having   Nagios ,  Nagios-nrpe,  nagios-plugin-nrpe, hostgroups,  servers 

Host Group:  A host group definition is used to group one or more hosts together for simplifying configuration   

define hostgroup {

hostgroup_namehostgroup_name

aliasalias

membershosts

hostgroup_membershostgroups

notesnote_string

notes_urlurl

action_urlurl

Example of   "/etc/nagios/hostgroups/hostgroup.cfg"
 
define hostgroup  {
hostgroup_name    Google Linux
alias             Google
members           host1, host2 
} 
 
 
Servers:  The servers and the services that are being monitored using the Monitoring server A (main nagios server). 
example:   /etc/nagios/servers/"host1.cfg"
The "host1" file is used to specify which services need to be monitored in the  remote server "host1"
This file contains the definition of the services that need to be checked.
example: /etc/nagios/servers/google.cfg
define service{
        use                             local-service         
        host_name                       google.cfg
service_description             HTTP
        check_command                   check_http
        notifications_enabled           1
        }
check_command: This directive is used to specify the short name of the command that Nagios will run in order to check the status of the service.
The maximum amount of time that the service check command can also mentioned after check_command 
 
notifications_enabled:  This directive is used to determine whether or not notifications for this host are enabled. Values: 
0 = disable host notifications, 
1 = enable host notifications.
 
We have to define all the services that need to be checked/ monitored separately ie each  check_command will have separate  definition 
 
example of check command:  check_mysql -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$ -d $ARG3$
 
check_command   check-host-alive
 
check_mysql!powerdns_services!NmLY6DeM2Zvt2fUW!powerdns
 
check_mysql is defined in the remote host, ie the service need to monitored
 $ARG1$ is powerdns_services, 
$ARG2$ is NmLY6DeM2Zvt2fUW,
$ARG3$ is powerdns
 
You can refer the page for more definitions  http://nagioswiki.com/wiki/index.php/Checking_NT_Services_with_Nagios
 
 
 
 

Monitoring Load

nano /etc/nagios/nrpe.cfgcommand[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,10 -c 30,25,20


/etc/init.d/nrpe restart



 

Nagios Wiki

Nagios:  is a popular open source computer system and network monitoring software application. It watches hosts and services, alerting.

 Monitoring of network services (SMTP, POP3, HTTP, NNTP, PING, etc.)

 Monitoring of host resources (processor load, disk and memory usage, running processes, log files, etc.)







All the hard work is done by plugins, the nagios daemon «only» schedules them to be executed at the right time with the right parameters and collect results.


The cgi interface is entirely optional, but highly useful.



Nagios Operation

The nagios daemon


• schedules and executes active host and service checks
• accepts asyncronous passive checks
• sends out notifications on host or service state change
• executes event handlers on host or service state change
• writes and rotates log and state files



Nagios Operation Local Plugin Execution


 All active checks involve the local execution of some plugin. Locally executed plugins can just check for some local service or then can go to the network and check some remote host or service. NRPE allows execution of plugins on remote hosts. Remote plugin results are reported to nagios by the locally executed check_nrpe plugin.

Distributed Monitoring

Nagios can be configured to support distributed monitoring of network services and resources. The goal in the distributed monitoring environment that I will describe is to offload the overhead (CPU usage, etc.) of performing service checks from a "central" server onto one or more "distributed" servers. When you want to start monitoring hundreds or even thousands of hosts (and several times that many services) using Nagios, this becomes quite important. A distributed solution is often called a master/slave solution. On the master you have a copy of every service that you want to check on the slaves, but the copy on the master has the active check disabled and notification enabled, while on the slaves both active and passive checks are enabled and notification is disabled.

nagios.cfg – contains options for daemon behaviour
cgi.cfg – controls the web interface
resource.cfg – tells nagios where to look for plugins

Check configuration with nagios -v nagios.cfg


# File locations
log_file=/var/log/nagios.log
cfg_file=/etc/opt/nagios/checkcommands.cfg
cfg_file=/etc/opt/nagios/misccommands.cfg
cfg_file=/etc/opt/nagios/host.cfg
resource_/etc/opt/nagios/resource.cfg
lock_file=/var/run/nagios.lock
 
The NRPE addon is designed to allow you to execute Nagios plugins on 
remote Linux/Unix machines. This allow Nagios to monitor "local" 
resources (like CPU load, memory usage, etc.) on remote machines

The NRPE addon consists of two pieces:

The check_nrpe plugin, which resides on the local monitoring machine
The NRPE daemon, which runs on the remote Linux/Unix machine
When Nagios needs to monitor a resource of service from a remote Linux/Unix machine:

Nagios will execute the check_nrpe plugin and tell it what service needs to be checked
The check_nrpe plugin contacts the NRPE daemon on the remote host over an (optionally) SSL-protected
connection

The NRPE daemon runs the appropriate Nagios plugin to check the service or resource
The results from the service check are passed from the NRPE daemon back to the check_nrpe plugin, which
then returns the check results to the Nagios process.
Note: The NRPE daemon requires that Nagios plugins be installed on the remote Linux/Unix host. Without these,
the daemon wouldn't be able to monitor anything.
http://www.softpanorama.org/Admin/Monitoring/nagios.shtml

Monday, November 14, 2011

Railo Adminstration


                                     Railo and Flex2gateway


Railo autoinstaller download link:-

http://railo.viviotech.net/


The package install railo/tomcat. You can connect Railo with apache during the railo installation, then mod_jk will be enabled by default. Once the setup has finished successfully, please verify the mod_jk configurations are added to apache configurations. The following configurations are necessary.

 <IfModule !mod_jk.c>
    LoadModule jk_module [modules directory]/mod_jk.so
 </IfModule>

 <IfModule mod_jk.c>
    JkMount /*.cfm ajp13
    JkMount /*.cfc ajp13
    JkMount /*.do ajp13
    JkMount /*.jsp ajp13
    JkMount /*.cfchart ajp13
    JkMount /*.cfm/* ajp13
    JkMount /*.cfml/* ajp13
    Flex Gateway Mappings
    # JkMount /flex2gateway/* ajp13
    JkMount /flashservices/gateway/* ajp13
    JkMount /messagebroker/* ajp13
    JkMountCopy all
    JkLogFile [log directory]/mod_jk.log
 </IfModule>


Starting and Stopping Railo

#/etc/init.d/railo_ctl  start
#/etc/init.d/railo_ctl  stop



Railo administrator

There are two kinds of adminitrations. The Railo Server Administrator and the Railo Web Administrator. The Web Administrator defines local Settings for a web and the Server Administrator the global default values. In addition the Server Administrator allows you to set authorizations for the Web Administrator of all single webs.
In here global services like mappings, customtags, datasources etc. can be defined globally so that all webs have access to them. Each account gets its own web  administrator interface which he can access to turn on debugging / manage datasources / mapping. The following are the URLs for accessing the railo administor page:-

Server Administrator: http://<hostname or IP>/railo-context/admin/server.cfm
Web administrator: http://<hostname or IP>/railo-context/admin/web.cfm


Enabling railo services to new sites


Railo do not allow automatic support for the domain created by control panels kile cpanel and kloxo, You need to edit Tomcat's server.xml file for this. The default location of the file is  /opt/railo/tomcat/conf/server.xml
Add following code in to server.xml file

    <Host name="[ENTER DOMAIN NAME]" appBase="webapps"
             unpackWARs="true" autoDeploy="true"
             xmlValidation="false" xmlNamespaceAware="false">
             <Context path="" docBase="[ENTER SYSTEM PATH]" />
             <Alias>[ALTERNATE DOMAIN NAME]</Alias>
        </Host>

where docBase is the full system path to the webroot of the domain. Once you've updated your server.xml file, restart Tomcat/Railo.


BlazeDS


Railo 3.x comes with BlazeDS 3.2, the Adobe opensource amf engine to communicate from a Flex application to a Java backend. However we may need to modify some tomcat configurations files to get it work.


#1. Updating the web.xml file

/opt/railo/tomcat/conf/web.xml

Uncomment the following the web.xml if present or add the details to web.xml file.

        <!-- Load the MessageBrokerServlet  -->
    <servlet>
        <servlet-name>MessageBrokerServlet</servlet-name>
        <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
        <init-param>
            <param-name>services.configuration.file</param-name>
            <param-value>/WEB-INF/flex/services-config.xml</param-value>
        </init-param>
        <init-param>
            <param-name>messageBrokerId</param-name>
            <param-value>MessageBroker</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

          <!-- The mappings for the Flex servlet -->
    <servlet-mapping>
        <servlet-name>MessageBrokerServlet</servlet-name>
        <url-pattern>/flex2gateway/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>MessageBrokerServlet</servlet-name>
        <url-pattern>/flashservices/gateway/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>MessageBrokerServlet</servlet-name>
        <url-pattern>/messagebroker/*</url-pattern>
    </servlet-mapping>


#2. Updating the uriworkermap.properties file

/opt/railo/tomcat/conf/uriworkermap.properties

Uncomment the following the web.xml if present or add the details to web.xml file.

/*.cfm=ajp13
/*.cfc=ajp13
/*.cfml=ajp13
/*.cfres=ajp13
/*.cfchart=ajp13
/*.cfm/*=ajp13
/*.cfml/*=ajp13
/*.cfc/*=ajp13
/*.jsp=ajp13
/*.do=ajp13
/=ajp13
/flex2gateway/*=ajp13
/flashservices/gateway/*=ajp13
/messagebroker/*=ajp13
/=ajp13


Once you've updated Tomcat configuration files, restart Tomcat/Railo.


Verify the flex connection is working

Browse to  http://<IP ot domain name>/flex2gateway/  you should get a white page, if you get an error message, this would mean that either you server is not running, the MessageBroker Servlet is not running or there are some configuration mistakes.


Troubleshooting 404 error

1. Apache 404 error

Please understand that if the URL you're using is this: http://mydomain/flex2gateway , then all your mappings should look like
/flex2gateway*=ajp13
There must no trailing slash on either of them.

Also verify the server.xml is updated correctly to point the webroot of the domain.

2. Tomcat 404 error

The reason mostly is Tomcat servlet "MessageBrokerServlet" is unavailbale or not loaded. In that case please verify the tomcat configuration files are updated correctly as mentioned above. Also verify tomcat log files to find out why "MessageBrokerServlet" is not loaded. Sometimes you may need to comment "MessageBrokerServlet" in other web.xml.

Tomcat log file location:- /opt/railo/tomcat/logs/

ps: You need to restart railo/tomcat if you made any changes to tomcat configuration files.

 Railo memory configuration file /opt/railo/tomcat/bin/setenv.sh. This file defines the virtual memory limit for railo service. Commenting out the lines will fix the memory issue

http://www.tomcatexpert.com/blog/2011/11/16/setting-measurement-garbage-collection-apache-tomcat

http://www.tomcatexpert.com/blog/2011/11/22/performance-tuning-jvm-running-tomcat




Configuring SES URL's for Railo For Mura / Mango Blog

Railo http://www.viviotech.net/forum/viewtopic.php?f=5&t=588