jqPlot Example for Website Graphs

This is a simple example usage of the jqPlot jQuery plugin. The example on the author website omits the “, {}” options in the .jqplot function call.

 <link rel="stylesheet" href="./scripts/jqplot/jquery.jqplot.min.css" type="text/css" media="all" />
 <!--[if IE]>http://./scripts/jqplot/excanvas.js<![endif]-->

 $(document).ready(function() {
 $.jqplot.config.enablePlugins = true;
 $.jqplot('chartdiv',  [[[1, 2],[3,5.12],[5,13.1],[7,33.6],[9,85.9],[11,219.9]]], {});

</body> </html>  

Rsyslog and Log Analyzer

These are the steps I took to create a centralised location of system logs. In this scenario multiple servers (earth, venus, mars) send their system logs to a central server (sun I’m not going to cover the configuration of Apache, MySql except were it applies to Log Analyzer. Most of the servers are running Red Hat / CentOS 5. In this setup I am using as the subnet and topsecret as the password. Change as appropriate.

Central Server (sun):

On the central server (sun) which will be running Log Analyzer, these steps only need to be taken once. If you only want to add more servers sending their syslogs to sun skip this section:

yum install httpd php mysql php-mysql mysql-server wget rsyslog rsyslog-mysql

Create the rsyslog database structure in MySQL:

mysql -u root -p < /usr/share/doc/rsyslog-mysql-3.22.1/createDB.sql

Create the MySQL user:

mysql -u root -p mysql
mysql> GRANT ALL ON Syslog.* TO rsyslog@localhost IDENTIFIED BY ‘topsecret’;
mysql> flush privileges;
mysql> exit

Edit the rsyslog config file:

vi /etc/rsyslog.conf

Add the following at the top:

$AllowedSender UDP,,
$AllowedSender TCP,,

#UDP log
$ModLoad imudp
$UDPServerRun 514
#TCP log
$ModLoad imtcp
$InputTCPServerRun 514

$ModLoad ommysql
*.info :ommysql:,Syslog,rsyslog,topsecret

Amend the rsyslog startup options:

vi /etc/sysconfig/rsyslog

Set the options as follows:

SYSLOGD_OPTIONS=”-r -t154 -m 0″

Now disable the standard syslog and enable rsyslog:

chkconfig syslog off
service syslog stop
chkconfig rsyslog on
service rsyslog start

Install Log Analyzer:

cd /tmp
wget http://download.adiscon.com/loganalyzer/loganalyzer-3.0.7.tar.gz
tar xzf loganalyzer-3.0.7.tar.gz
mv loganalyzer-3.0.7/src /var/www/html/loganalyzer
mv loganalyzer-3.0.7/contrib/* /var/www/html/loganalyzer
cd /var/www/html/loganalyzer
chmod u+x configure.sh secure.sh

Now browse the website e.g. http://sun/loganalyzer
Follow the installer adding your MySQL credentials when requested.

Amend the firewall on the central (sun) server to allow other servers:

vi /etc/sysconfig/iptables


-A RH-Firewall-1-INPUT -p udp -m udp –dport 514 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp –dport 514 -j ACCEPT

Restart iptables:

service iptables restart

Remote Servers
Configure Other Servers (mars, venus, earth) to send their syslogs to the central server (sun):
Install rsyslog:

yum install rsyslog

Edit the config:

vi /etc/rsyslog.conf


*.info  @

I add this on line number 2 below $ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
Set rsyslog as the default syslogger:

/sbin/chkconfig syslog off
/sbin/chkconfig rsyslog on
service syslog stop
service rsyslog start

Using *.info could collect a lot of messages so customise as necessary, for example changing to *.crit will collect less messages of higher importance.

WordPress Multisite Domain Mapping

We have WordPress (v3.0.5) installed to deliver blogs of the format domain.com/blog1 and domain.com/blog2, however we would also like to be able to host blogs with their own already registered domain name, so ….

  1. Get the MU Domain Mapping plugin and unzip somewhere safe
  2. Copy the domain_mapping.php file to ./wp-content/mu-plugins
  3. Copy the sunrise.php file to ./wp-content
  4. Edit the ./wp-config.php file
  5. Uncomment the line: define( ‘SUNRISE’, ‘on’ );
  6. Comment out the line:  define(‘COOKIE_DOMAIN’, ‘blogs.domain.com’);
  7. Visit the WordPress backend and click SuperAdmin -> Domain Mapping
  8. Enter the server IP address and I just ticked the options for: Permanent redirect and User domain mapping page
  9. Enable a domain name for a site by clicking Super Admin -> Sites, Choose ‘Backend’ for the site you want to amend
  10. Click Tools > Domain Mapping
  11. Enter the domain name and click ‘Add’

Note: You must ensure that your new domain DNS record is either an A record pointing to your wordpress server IP address or a CNAME record pointing to your wordpress domain name.

WordPress is the cat’s whiskers!