Eko and Friends

Subscribe to RSS feed

Creating Drupal Development Environment

The development environment for Drupal is installed on Windows XP. Requirements:
  • VertrigoServ 2.21 - Software stack, include: Apache, MySQL, PhpMyAdmin, SQLite, SQLiteManager, and Zend Optimizer.
  • Wget 1.11.4 - Used for maintaining Drupal cron task.
  • Drupal 6.8
VertrigoServ Installation
  • Run the installer and follow the intruction.
  • Run the VertrigoServ.
  • Change the default password for MySQL and SQLiteManager for security purpose. Click VertrigoServ tray icon, Tools > PhpMyAdmin and Tools > SQLiteManager. Change the configuration.
  • Change PHP memory limit VertrigoServ sets PHP memory limit to 8M. To help prevent errors in the installation process of Drupal, change it to 16M or larger. Click VertrigoServ tray icon, Settings > Component Settings. Change the PHP memory_limit value to 16M.
VertrigoServ Tools: figure 1 PHP Memory Limit: figure 2 Wget Installation
  • Run the installer.
  • Add Wget path to path variable in windows environment variable settings.
Drupal Installation This is multi site configuration for Drupal. Multi site is designed as a way to share the same code base for multiple different Drupal based sites. These sites are separate and do not share content or administration. Multi-site just helps with managing the code base, shared themes and modules. Creating databases I created two database: sandbox and playground for www.sandbox.local and www.playground.local sites respectively. Drupal 6.8 supports MySQL and PostgreSQL. Adding hosts to Windows host file. I added two hosts: www.sandbox.local and www.playground.local to Windows host file in C:\WINDOWS\System32\Drivers\etc\
## Hosts
#
127.0.0.1    localhost
127.0.0.1    www.sandbox.local
127.0.0.1    www.playground.local
Apache Virtual Hosts To enable multi site for Drupal we need to edit Apache configuration file. Click VertrigoServ tray icon, Config Files > httpd.conf. VertrigoServ Config Files: figure 3 Add code below in Section 3: Virtual Host in the httpd.conf.
NameVirtualHost *:80    #uncomment this line

<VirtualHost *:80>
  DocumentRoot "c:/program files/vertrigoserv/www/drupal"
  ServerName www.sandbox.local
</VirtualHost>

<VirtualHost *:80>
  DocumentRoot "c:/program files/vertrigoserv/www/drupal"
  ServerName www.playground.local
</VirtualHost>

<VirtualHost *:80>
  DocumentRoot "c:/program files/vertrigoserv/www/"
  ServerName localhost
</VirtualHost>
Remember to restart the server. Click VertrigoServ tray icon, Server > Restart. VertrigoServ Restart: figure 4 Drupal Setting File
  • Extract Drupal to C:\Program Files\VertrigoServ\www\drupal.
  • Copy the default site folder in C:\Program Files\VertrigoServ\www\drupal\sites and rename it to www.sandbox.local and www.playground.local.
  • Copy default.settings.php and rename it to settings.php in both www.sandbox.local and www.playground.local folder.
  • Find $db_url and $base_url in both settings.php and change the value.
    ## www.sandbox.local settings.php file
    ## change only variables below and leave the rest
    #
    $db_url = 'mysqli:db_username:db_password@localhost/sandbox';
    
    $base_url = 'http://www.sandbox.local';
    ## www.playground.local settings.php file
    ## change only variables below and leave the rest
    #
    $db_url = 'mysqli:db_username:db_password@localhost/playground';
    
    $base_url = 'http://www.playground.local';
Run the Drupal installation script http://www.sandbox.local/install.php http://www.playground.local/install.php when it's done. Drupal will display Installation Complete page. Drupal Installation Complete: figure 5, click to enlarge Configuring Automated Mail Drupal uses site mail address as an automated-mail sent during user registration and notifications. In the figure 5, There is a warning that Drupal is unable to send mail. To enable automated-mail, SMTP mail server has to exist. But for this development environment, I use free Gmail SMTP server as an automated-mail. Use Gmail For Automated Mail requirements: Extract the smtp module to C:\Program Files\VertrigoServ\www\drupal\sites\all\modules\ folder. This module is shared because I put it to all\modules\ folder. Create phpmailer folder within smtp module folder and extract the PHPMailer to it. Enable the module by go to Navigation Menu, Administer > Site Building > Modules and select check box for the SMTP Authentication Support module. Go to Navigation Menu, Administer > Site Configuration > SMTP Authentication Support to configure it. Turn on the module. In the SMTP Server section, use smtp.gmail.com as an SMTP erver, SMTP ort 465, Use encrypted protocol SSL. In SMTP Authentication section, I use my Gmail user name and password. Do the same with www.playground.local site. SMTP Authentication Support: figure 6, click to enlarge Maintaining Multisite Cron Task Create cronall.php (or any name) file in C:\Program Files\VertrigoServ\www\drupal\ folder. Add code below to the file.
<?php
/**
* This script scans the sites directory, and uses a regular expression to extract the sitenames.
* It then uses this sitename to execute the cronjob for these sites.
* You then only have to create a cronjob for this script.
* In this way, you can create and delete sites on the fly, but all their cronjobs will be executed.
*/

/***********
* SETTINGS
**********/
//the location of the 'sites' directory relative to this script.
$sitesDir = '..\drupal\sites';
/**
* A regular expression that matches the name of the directories in
* the 'sites' dir that you want to execute cronjobs for, with a 
* backreference around the actual site name. (so we can exclude the
* domain part)
* 
* If you don't know regular expressions you might want to brush up
* on them: [html:a href="http://www.regular-expressions.info/tutorial.html
" title="http://www.regular-expressions.info/tutorial.html
" rel="nofollow"]http://www.regular-expressions.info/tutorial.html
</a> * 
* Alternatively, you can just copy the name of one of the directories
* in the site dir, put a backslash \ in front of all dots . and replace
* the actual name of the site with ([a-zA-Z0-9_-])
*/
$siteNameRegExp = 'www\.sandbox\.local\.([a-zA-Z0-9_-])';
//the url of the cron script, you should insert %s where the sitename should be inserted later.
$cronUrl = 'http://%s/cron.php';
//any other sites that you want to execute cronjobs for. Just comment this if you haven't got any.
$addedSites = array();
$addedSites[] = 'www.sandbox.local';
$addedSites[] = 'www.playground.local';
/***********
* END SETTINGS
**********/

error_reporting(E_ALL);
$sites = array();

$handle = opendir($sitesDir);
while ($file = readdir($handle)) {
    if(ereg($siteNameRegExp, $file)){
        $sites[] = ereg_replace($siteNameRegExp, '\\1', $file);
    }
}
//default site
if(isset($addedSites) && is_array($addedSites)){
    $sites = array_merge($sites, $addedSites);
}
foreach($sites as $site){
    $cmd = 'wget --spider '.sprintf($cronUrl, $site);
    echo 'Executing command: '.$cmd.'<br>';
    exec($cmd);
}

?>
Create a new scheduled task in windows to run Opera (or any browser) with address either www.sandbox.local/cronall.php or www.playground.local/cronall.php. Verify the cron task in Navigation Menu, Administer > Reports > Status Reports. Status Reports: figure 7

New to Hyperic HQ: Part 4 (end)

Alerts
Alerts in HQ is a way for spotting resource problems. To Enable an alert we need to set it up first. As an example we're going to create an alert that monitor the availability of HQ agent.
1. Open browse page, select servers.
2. Select HQ Agent, indicators page for HQ agent appears.
3. Click alerts tab, alerts page appears.
4. Click New button, new alert definition page appears.

New Alert Definition Page: figure 1


5. Enter alert's name in Alert Properties section. In Condition Set section, select metric in a drop-down menu. Choose Availability from the menu. Leave Enable Action option set to "Each time condition are met". Check "Generate one alert the disable alert until fixed" box. Click Ok. Alert definition page appears.

Alert Definition Page: figure 2


6. In the alert definition page, click Notify HQ users. Click add to list button, select a user from the list. Click Ok.

Notify HQ Users Tab: figure 3


List of Users: figure 4



Alert in Action
We're going to test our newly created alert by stopping the HQ agent. Now just shut the agent down. Open HQ Dashboard. In the Recent Alert portlet, click the alert. We can see the alert in alert center by clicking Analize Tab in the masthead too.

New to Hyperic HQ: Part 3

In The blog post New to Hyperic HQ: Part 2, we've discussed how to monitor resources which HQ discover out-of-the-box. In this part 3 blog post we're going to discuss how to add platforms that HQ doesn't discover automatically.


Add a New Platform
HQ can monitor a variety of network devices using SNMP, including firewalls, switches, routers, and hosts that can be queried via SNMP. To monitor a network device using SNMP, we use an existing HQ Agent as a proxy for collecting the SNMP data from the network device.

Before we start monitor an agentless SNMP device, we have to configure HQ Agent to receive SNMP traps on an unprivileged ports if we want to run the agent as non-administrative user, because by default HQ Agent use UDP port 162 for receiving traps. To configure the receiving port open agent.properties file located in: C:\Hyperic HQ 4.0.1\agent-4.0.1\conf\agent.properties. Your agent home directory may vary.

add the following line:
snmpTrapReceiver.listenAddress=udp:0.0.0.0/1620
This line will enable the agent to receive traps at UDP port 1620 from any interface in the platform. Once this line is added we have to restart the Agent. You need to configure your SNMP device to generate traps and send it to the Agent. This configuration is specific to the device. Consult your device documentation for the configuration.

There are network devices that we can added to HQ. These devices have different platform types. HQ provides Cisco IOS and PIX OS built-in plugin, we can choose the type in the platform type drop-down menu. For devices which HQ doesn't provide plugin, we can choose Network Device platform type if the device doesn't have a storage, for example routers, switches, firewalls, load balancers. For a device which has storage, we can choose Network Host platform type.

These are steps for adding a new platform to HQ as an example:
1. Open Browse page by clicking the Resources tab in the Masthead and click the Platforms link.
2. In the Tools Menu, choose New Platform. New Platform pages appears.

New Platform Page: figure 1, click to enlarge


3. Enter platform name, type, and the IP address. Click OK button. Inventory page for the new platform appears.

Inventory Page for The New Platform: figure 2, click to enlarge


4. In The Configuration Properties section, click Edit button. Configuration Properties for the new platform appears.

Configuration Properties for The New Platform: figure 3, click to enlarge


5. To identify interface services, choose the interface index to use. Most devices work with the default ifDescr
6. Enter snmpIP, snmpPort, and snmpCommunity string.
7. Check the Enable Log Tracking box. We will see the SNMP port with netstat if we enable log tracking for the network device.
8. Click OK button. The Inventory page for the platform appears.

Now you can monitor the platform in the browse page.


Add a New Server
As an example we're going to add Windows Terminal Services to HQ. But before we do that, we have to deploy Windows Terminal Services plugin for HQ. In the machine where HQ Agent resides, copy terminalservices-plugin.xml from this directory:
C:\Hyperic HQ 4.0.1\agent-4.0.1\bundles\agent-4.0.1-nnn\pdk\examples
to this directory:
C:\Hyperic HQ 4.0.1\agent-4.0.1\bundles\agent-4.0.1-nnn\pdk\plugins
Your HQ Agent installation directory may vary. Once copied, You have to restart the agent. To verify terminalservices-plugin.xml is registered to the agent, check the log for the agent in:
C:\Hyperic HQ 4.0.1\agent-4.0.1\log\agent.log

Next part is to deploy the plugin to the server. Copy terminalservices-plugin.xml to:
C:\Hyperic HQ 4.0.1\hq-plugins
This directory is not exist by default, you have to create it first. After that you have to restart the agent. We don't have to restart the agent thereafter. Because this directory is used for hot deployment of plugins for the server. To verify registered plugin, open the server log:
C:\Hyperic HQ 4.0.1\logs\server.log

These are steps for adding a new server:
1. Open the Browse page
2. Click the platform we want to use
3. In the Tools Menu, select New Server. New Server page appears.

New Server Page: figure 4, click to enlarge


4. Enter server name. For server type, select Terminal Services. For Install Path box, enter:
C:\WINDOWS\System32\svchost

5. Click OK button. Inventory page for the new server appears
6. In the Configuration Properties section click Edit button. Configuration Properties page for the new server appears.

Configuration Properties for The New Server: figure 5, click to enlarge
...

7. Check the Auto-Discover Session box, and click Ok. The Inventory page for the server appears.

Now you can monitor the server in the browse page.


Add a New Service
As an example we're going to monitor my.opera.com site.
1. Go to platform which its agent is used to monitor.
2. Click Menu Tools button and choose New Platform Service. New service page appears.

New Service Page: figure 6, click to enlarge


3. Enter service name, select service type http, and click Ok. Inventory page for the new service appears.

Inventory Page for The New Service: figure 7, click to enlarge


4. In the configuration properties section click Edit button. Configuration properties page appears.

Configuration Properties Page: figure 8, click to enlarge


5. Enter host name my.opera.com, port number 80, path /, socket timeout 10 seconds, and method HEAD. Click Ok.

New you can monitor the service in the browse page.

New to Hyperic HQ: Part 2



Automatic Resource Discovery
At first login, portlets in the dashboard is empty. There are three columns in auto-discovery portlet: Resource name, Status, and Changes. HQ agent will scan host at start up and every 15 minutes after that. When HQ agent discover new resources, it will displayed in Auto-Discovery portlet in the dashboard. New resources is marked in status column as "new".

Auto-Discovery Portlet: figure 1, click to enlarge


These new resources is not monitored by HQ yet, until we add them into the Inventory. In the auto-discovery portlet, check all resources we want to add and click Add to Inventory button. The Resources that we've just added will be displayed in Recently Added portlet in the dashboard. This portlet lists resources that have been added to HQ inventory within the last 48 hours.

Recently Added Portlet: figure 2, click to enlarge



Modified Resources
If resource properties has been changed, this changes will be auto-discovered and displayed at auto-discovery portlet with status as "modified". We have to add them again to the inventory if we want to monitor them or we can choose to add it if we aren't sure about the changes.


Browsing Platforms
To see all resources we've been added to the inventory, Click Resources tab in the Masthead. When we first open resources tab, it lists all platform in the inventory. This platforms list has four column: Platform, Platform Type, Description, and Availability. The Platform column lists each host name.

Browsing Platforms: figure 3, click to enlarge



Metrics as a Chart in The Browse Page
The default layout view in the browse page is List View. We can see metric as a chart using Chart View button. Click it to see metrics in chart form. Metrics in chart form is called Indicators or Indicator Metrics.

Chart View: figure 4, click to enlarge



Browsing Platform or Group of Platforms in Real Time
Indicators page refreshed once when it's loaded. While Metric Data view refreshed every 2 min by befault. You can view refreshed metric data every 1 min, 2 min, or 5 min. Both indicators page and metric data page display latest metric in the last 8 hours by default. But these metrics are not viewed in Real Time.

We can view metrics for platform or group of platforms in real time by clicking Views tab in the indicators page. We can choose several views from Live Exec:
  • cpuinfo - cpu information
  • cpuperc - cpu processes in percentage
  • ifconfig - network status
  • netstat - active sockets
  • df - file system information
  • top - agent processes
  • who - active users information


List View: figure 5



Browsing Metrics in Tabular Form
We can view metrics of a resource in tabular form. For example open our Tomcat Webapp group in compatible groups / clusters section. Click Metric Data tab on the right of Inventory tab.

Browsing Metrics in Tabular Form: figure 6, click to enlarge



Browsing Servers
Click Servers link in the page to list all servers on all platforms in the inventory. This servers list has four column: Server, Server Type, Description, and Availability. Server column list each server name. HQ give each server a unique name that reflects the platform and the server type of a resource.

Browsing Servers: figure 7, click to enlarge



Browsing Services
Click Services link in the page to list all services on all platforms in the inventory. As with the servers list, each service name reflects the parent resource where it resides. In this case the platform name and the server name.

Browsing Services: figure 8, click to enlarge



Browsing Selected Resources
In a production environment, Browse page can display long lists of resources. If we just want to see certain resources, we can filter the list. The list can be filtered by type, by keyword, by availability, and by owner. We also can filter the list that match any or all criteria.

Filtering Resources: figure 9, click to enlarge



Creating Groups
Before we can browse a group, we have to create it first. A group in HQ is a set of resources. This can be group of resources of the same type or different types. Groups of resources of the same type is called Compatible Groups / Clusters while groups of resources with different types is called Mixed Groups.

* First we're going to create a compatible group. The group we're going to create is a group of services. Click the services link in the browse page. This action lists all services on all platforms in the inventory. Filter the list by type. This action list all services with the same type. Check all resource that we want to add to a group and click Group button. New Group page shows up. Fill the group's name, description, and location, then click OK. The browse page of compatible groups / or clusters appears in the inventory.

Create a Compatible Group: figure 10, click to enlarge


New Group Page of The Compatible Group: figure 11, click to enlarge


Inventory Page of The New Compatible Group: figure 12, click to enlarge


* Next we're going to create a mixed group. This group is a group of servers of the same type but with different service types. Click servers link in the browse page. check all resources you want to add to the group and click Group button. The rest of the process is the same with compatible group except after we fill group information in New Group page, the browse page of mixed group which will show up.

Create a Mixed Group: figure 13, click to enlarge


New Group Page of The Mixed Group: figure 14, click to enlarge


Inventory Page of The New Mixed Group: figure 15, click to enlarge



Browsing Groups
Open Compatible Groups / Clusters and select group created in the previous section. There are four tab available when Compatible Groups / Clusters link is clicked: Monitor, Inventory, Control, and Views. When a compatible group is selected, the Monitor tab is available, just as it would be for an individual resource. However, when you work with a mixed group, the Monitor tab does not appear. Member resources have different metrics, so aggregating metric values across the group is not possible.

Browsing Compatible Group: figure 16, click to enlarge


Browsing Mixed Group: figure 17, click to enlarge


We can view a chart that graphs the response time for each of the web application in the group. For an example go to our Tomcat Webapp group in compatible groups / clusters section. Click metric's name Average Response Time. Every metric's name is a link. We can click it to drill down the detail. To include only a subset of the resources in the group we can redraw the chart by deselecting resources in the Participating Resources section of the page.

Average Response Time Chart: figure 18

New to Hyperic HQ: Part 1



Introduction
Hyperic HQ is a Network Monitoring System (NMS) used to monitor computer resources over a network.


Installation
Hyperic HQ has two editions: Hyperic HQ and Hyperic HQ Enterprise. For this blog post we've downloaded Hyperic HQ Agent and Server installer and installed in Windows XP environment.
1. Download HQ from download section in their site.
2. Run the installer and follow the instruction.


Dashboard
After installing HQ, we can login to HQ user interface now. Open your browser and type http:\\localhost:7080. We're going to use default user name: hqadmin and default password: hqadmin since this is the first time we login to HQ. We can add user from Admininstration tab in the Masthead. After we provide login information, browser will display Dashboard page. The Masthead has several tabs: Dashboard, Resources, Analize, and Administration. Below the Masthead there are several bars with title. These bars and their contents are called portlets.

Sign In Box: figure 1, click to enlarge


HQ Dashboard: figure 2, click to enlarge



Customizing Dashboard
Our dashboard can be customized to a desired result. Things that we can do to customize dashboard:
  • Add a portlet
  • Remove a portlet
  • Drag a portlet
  • Configure a portlet


Customizing Dashboard: figure 3, click to enlarge



HQ Architecture
HQ Architecture provide us with a big picture about how HQ works. HQ Architecture consists of several components:
  • HQ Agent
    Agent is used for collecting metrics, logging, event tracking, and performing control actions.
  • HQ Server
    Server receives metrics from Agent.
  • HQ Database
    Storing metrics
  • UI Application
    Web-based UI
  • Plugins
    Resource and Extension plugins


HQ Architecture: figure 4



HQ Inventory and Access Model
HQ Inventory and Access Model shows how resources in HQ relate to each other. HQ refers all resources it manages as Inventory. There are different types of Inventory:
  • Platform
    Hosting machine
  • Server
    Software that runs on a platform
  • Service
    Server component
  • Application
    A set of services
  • Group
    A set of resources


HQ Inventory and Access Model: figure 5

Opera 10 and Acid3 Test

Opera 10 alpha pass 100 score out of 100 Acid3 test. The Web Standards Project created the Acid tests to check how well a web browser follows certain web standards.

Personalized Laptop


Personalized laptop? hmm.. it sounds good. Actually I'm talking about Dell's Design Studio. There are over 100 design that you can choose to personalize your laptop. Each design is permanently painted on a laptop display's back. So there will be less possibility that you carry the same black colored laptop on an occassion.

The design came from new and upcoming artist. Several design are available in a group based on color scheme or what they call series. The options are varied and colorful.

Songbird


Here's another music player, The Songbird. My first impression to Songbird is: it looks very similar to iTunes. But unlike iTunes, Songbird doesn't lock people from purchasing only from iTunes store. People can choose from multiple sources, include Amazon, Amie St., eMusic and of course the iTunes music store.

If you have an account in the music community site last.fm, it has integrated services with last.fm that allows us to scroble, love, and ban tracks. With an add-on, Songbird able to displays album and artist images from last.fm or we can use MediaFlow add-on to spin through album artworks. Using Songbird, we can know upcoming concerts near our area based on artist in the library.

Songbird support several media formats. It can play MP3, FLAC, and Vorbis files; WMA on Windows, ACC and Fairplay both on Windows and Mac using Gstreamer as main media playback system. It supports extension that allows USB media storage as a portable device where we can manage media on.

I haven't get used to Songbird, but I'll give it a try.