Skip to content

Installing the PEAR package manager and Checking if PEAR works

06-Feb-10

Installing the PEAR package manager and Checking if PEAR works

When using PHP >= 4.3.0, the PEAR Package Manager is already installed unless one has used the ./configure option –without-pear.

Verifying command line tool

Both pear and pecl tools should be available everywhere on command line. For that to work, pear’s binary (bin) directory should be in your PATH variable.

# apt-cache search php-pear
php-xml-util – a XML utility for php-pear
php-pear – PEAR – PHP Extension and Application Repository

To verify it works, simply type pear. A list of commands should be shown:

root@laptop:~# pear
Commands:
build Build an Extension From C Source
bundle Unpacks a Pecl Package
channel-add Add a Channel

You should further test that PEAR is up to date:

root@laptop:~# pear version
PEAR Version: 1.7.1
PHP Version: 5.2.6-3ubuntu4.5
Zend Engine Version: 2.2.0

Options for downloading PECL extensions

06-Feb-10

Options for downloading PECL extensions

There are several options for downloading PECL extensions, such as:

The pecl install extname command downloads the extensions code automatically, so in this case there is no need for a separate download.

http://pecl.php.net/ The PECL web site contains information about the different extensions that are offered by the PHP Development Team. The information available here includes: ChangeLog, release notes, requirements and other similar details.

pecl download extname PECL extensions that have releases listed on the PECL web site are available for download and installation using the » pecl command. Specific revisions may also be specified.

SVN Most PECL extensions also reside in SVN. A web-based view may be seen at » http://svn.php.net/viewvc/pecl/. To download straight from SVN, the following sequence of commands may be used:

$ svn checkout http://svn.php.net/repository/pecl/extname/trunk extname

upload_max_filesize post_max_size

06-Feb-10

You should set post_max_size to double what you set upload_max_filesize to. This means you can upload 2 files of your maximum limit for each POST and seems like a good middle ground.

The memory_limit directive should also be set above the value of post_max_size so your server can handle the uploads.

There are 2 ways you can set this directive:

For php.ini

Edit php.ini and modify these directives:

upload_max_filesize = 128M
post_max_size = 256M

.htaccess

Edit .htaccess

php_value upload_max_filesize 128M
php_value post_max_size 256M

PECL upload progress extension

06-Feb-10

PECL upload progress extension

Download from – http://pecl.php.net/package/uploadprogress

http://pecl.php.net/get/uploadprogress-1.0.1.tgz

Extract the uploadprogress-1.0.1.tgz archive

$ phpize
$ ./configure
$ make
$ sudo make install

Add the extension to php.ini by adding this line extension=uploadprogress.so

Restart apache

/etc/init.d/httpd restart

Mounting an NTFS filesystem

13-Jan-10

Mounting an NTFS filesystem

Suppose your ntfs filesystem is /dev/sda1 and you are going to mount it on /mymnt/win, do the following.

First, create a mount point.

mkdir /mymnt/win

Next, edit /etc/fstab as follows. To mount read-only:

/dev/sda1 /mymnt/win ntfs-3g ro,umask=0222,defaults 0 0


To mount read-write:

/dev/sda1 /mymnt/win ntfs-3g rw,umask=0000,defaults 0 0

You can now mount it by running:

mount /mymnt/win

Reference : http://wiki.centos.org/TipsAndTricks/NTFS

nagios sample object config file for monitoring machines.

27-Nov-09

nagios sample object config file for monitoring machines.

First you need to have the

Host definition — > Host group definition [here we add the hosts for this group]–>and then the Service Definition

Example: for Service Definition

# Define a service to check the disk space of the root partition
# on the local machine. Warning if < 20% free, critical if # < 10% free space on partition.

define service{
use local-service ; Name of service template to use
host_name localhost
service_description Root Partition
check_command check_local_disk!20%!10%!/
}

# Define a service to check HTTP on the local machine.
# Disable notifications for this service by default, as not all users may have HTTP enabled.

define service{
use local-service ; Name of service template to use
host_name serversignature.com
service_description HTTP
check_command check_http
}

nagios configuraiton files

27-Nov-09

nagios configuration files

root@jyothis:/usr/local/nagios/etc# ls -l
total 68
-rw-rw-r-- 1 nagios nagios 10699 Mar 22 2009 cgi.cfg
-rw-r--r-- 1 root root 26 Mar 22 2009 htpasswd.users
-rw-rw-r-- 1 nagios nagios 42730 Mar 22 2009 nagios.cfg
drwxrwxr-x 2 nagios nagios 4096 Nov 27 13:19 objects
-rw-rw---- 1 nagios nagios 1340 Mar 22 2009 resource.cfg
:/usr/local/nagios/etc# cd objects/

:/usr/local/nagios/etc/objects# ls -l
total 48
-rw-rw-r-- 1 nagios nagios 7722 Mar 22 2009 commands.cfg
-rw-rw-r-- 1 nagios nagios 2166 Mar 22 2009 contacts.cfg
-rw-rw-r-- 1 nagios nagios 6264 Mar 22 2009 localhost.cfg
-rw-rw-r-- 1 nagios nagios 3124 Mar 22 2009 printer.cfg
-rw-rw-r-- 1 nagios nagios 3293 Mar 22 2009 switch.cfg
-rw-rw-r-- 1 nagios nagios 10812 Mar 22 2009 templates.cfg
-rw-rw-r-- 1 nagios nagios 3209 Mar 22 2009 timeperiods.cfg
-rw-rw-r-- 1 nagios nagios 4007 Mar 22 2009 windows.cfg

root@jyothis:/usr/local/nagios/etc/objects#

Verify the sample Nagios configuration files.

27-Nov-09

Verify the sample Nagios configuration files.

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

/usr/local/nagios/bin#

./nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios 3.0.6
Copyright (c) 1999-2008 Ethan Galstad (http://www.nagios.org)
Last Modified: 12-01-2008
License: GPL

Reading configuration data...

Running pre-flight check on configuration data...

Checking services...
Checked 9 services.
Checking hosts...
Checked 2 hosts.
Checking host groups...
Checked 1 host groups.
Checking service groups...
Checked 0 service groups.
Checking contacts...
Checked 1 contacts.
Checking contact groups...
Checked 1 contact groups.
Checking service escalations...
Checked 0 service escalations.
Checking service dependencies...
Checked 0 service dependencies.
Checking host escalations...
Checked 0 host escalations.
Checking host dependencies...
Checked 0 host dependencies.
Checking commands...
Checked 24 commands.
Checking time periods...
Checked 5 time periods.
Checking for circular paths between hosts...
Checking for circular host and service dependencies...
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check

Quickstart Installation Guides install Nagios from source (code) on Ubuntu

27-Nov-09

Quickstart Installation Guides install Nagios from source (code) on Ubuntu

* Nagios and the plugins will be installed underneath /usr/local/nagios
* Nagios will be configured to monitor a few aspects of your local system (CPU load, disk usage, etc.)
* The Nagios web interface will be accessible at http://localhost/nagios/
Required Packages

Make sure you’ve installed the following packages on your Ubuntu installation before continuing.

* Apache 2
* PHP
* GCC compiler and development libraries
* GD development libraries

You can use apt-get to install these packages by running the following commands:

sudo apt-get install apache2

sudo apt-get install libapache2-mod-php5

sudo apt-get install build-essential


With Ubuntu 6.10, install the gd2 library with this command:

sudo apt-get install libgd2-dev

With Ubuntu 7.10, the gd2 library name has changed, so you’ll need to use the following:

sudo apt-get install libgd2-xpm-dev

1) Create Account Information

Become the root user.

sudo -s

Create a new nagios user account and give it a password.

/usr/sbin/useradd -m -s /bin/bash nagios

passwd nagios

On older Ubuntu server editions (6.01 and earlier), you will need to also add a nagios group (it’s not created by default). You should be able to skip this step on desktop, or newer server editions of Ubuntu.

/usr/sbin/groupadd nagios

/usr/sbin/usermod -G nagios nagios

Create a new nagcmd group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.

/usr/sbin/groupadd nagcmd

/usr/sbin/usermod -a -G nagcmd nagios

/usr/sbin/usermod -a -G nagcmd www-data

2) Download Nagios and the Plugins

Create a directory for storing the downloads.

mkdir ~/downloads

cd ~/downloads

Download the source code tarballs of both Nagios and the Nagios plugins (visit http://www.nagios.org/download/ for links to the latest versions). These directions were tested with Nagios 3.1.1 and Nagios Plugins 1.4.11.

wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-3.2.0.tar.gz

wget http://prdownloads.sourceforge.net/sourceforge/nagiosplug/nagios-plugins-1.4.11.tar.gz

3) Compile and Install Nagios

Extract the Nagios source code tarball.

cd ~/downloads

tar xzf nagios-3.2.0.tar.gz

cd nagios-3.2.0

Run the Nagios configure script, passing the name of the group you created earlier like so:

./configure --with-command-group=nagcmd

Compile the Nagios source code.

make all

Install binaries, init script, sample config files and set permissions on the external command directory.

make install

make install-init

make install-config

make install-commandmode

Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you’d like to use for receiving alerts.

vi /usr/local/nagios/etc/objects/contacts.cfg

5) Configure the Web Interface

Install the Nagios web config file in the Apache conf.d directory.

make install-webconf

Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account – you’ll need it later.

htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

Restart Apache to make the new settings take effect.

/etc/init.d/apache2 reload

Note Note: Consider implementing the ehanced CGI security measures described here to ensure that your web authentication credentials are not compromised.

6) Compile and Install the Nagios Plugins

Extract the Nagios plugins source code tarball.

cd ~/downloads

tar xzf nagios-plugins-1.4.11.tar.gz

cd nagios-plugins-1.4.11

Compile and install the plugins.

./configure --with-nagios-user=nagios --with-nagios-group=nagios

make

make install

7) Start Nagios

Configure Nagios to automatically start when the system boots.

ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

Verify the sample Nagios configuration files.

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

If there are no errors, start Nagios.

/etc/init.d/nagios start

8) Login to the Web Interface

You should now be able to access the Nagios web interface at the URL below. You’ll be prompted for the username (nagiosadmin) and password you specified earlier.

http://localhost/nagios/

Click on the “Service Detail” navbar link to see details of what’s being monitored on your local machine. It will take a few minutes for Nagios to check all the services associated with your machine, as the checks are spread out over time.

9) Other Modifications

If you want to receive email notifications for Nagios alerts, you need to install the mailx (Postfix) package.

sudo apt-get install mailx

sudo apt-get install postfix

You’ll have to edit the Nagios email notification commands found in /usr/local/nagios/etc/objects/commands.cfg and change any ‘/bin/mail’ references to ‘/usr/bin/mail’. Once you do that you’ll need to restart Nagios to make the configuration changes live.

sudo /etc/init.d/nagios restart

Reference : http://nagios.sourceforge.net/docs/3_0/quickstart-ubuntu.html

Understanding TCP/IP and Architectural Principles of the Internet

27-Nov-09

To fully understand the architecture of Cisco Centri Firewall, you need to understand the TCP/IP architecture on which the Internet is based. This appendix discusses the TCP/IP architecture and provides a basic reference model that can help you understand how Cisco Centri Firewall operates. It explains TCP/IP terminology and describes the fundamental concepts underlying the TCP/IP protocol suite. We begin by providing a common frame of reference to use as a basis for the rest of the discussion contained in this appendix on TCP/IP and Cisco Centri Firewall.

http://www.cisco.com/univercd/cc/td/doc/product/iaabu/centri4/user/scf4ap1.htm

Architectural Principles of the Internet


ftp://ftp.rfc-editor.org/in-notes/rfc1958.txt