Subscribe:

Ads 468x60px

Pages

Showing posts with label Monitoring. Show all posts
Showing posts with label Monitoring. Show all posts

Wednesday, August 24, 2011

MySQL Checksum

This is another tool in the same toolkit as archiver. I just saw a great blog post on it athttp://blog.arabx.com.au/?p=883. Documentation can be found athttp://mysqltoolkit.sourceforge.net/doc/mysql-checksum-filter.html. This is an invaluable tool for ensuring your replicated tables are staying in sync, something that MySQL replication does not do. Tables will drift and if you are dealing with critical data for read support, reports or backups, this will prove invaluable.

This is referenced from the following site
Read more...

Nagios Plugins for Monitoring MySQL

You can come to know how to setup Nagios pluging for monitoring the mysql server by seeing this video and as well as pdf file
I am about to present the very first public appearance of PalominoDB's nagios plugin for MySQL.  This has been running on several clients in production for about 6 months, so we know it's stable.  The PDF's of the presentation slides and white papercan be downloaded, and are also available from our Community section (presentationsand white papers) in the menu bar at the top of each page.  Also you can download the code to use in your Nagios infrastructure.



The link of the pdf file. Please click here

Read more...


Login as root
# su -
# <Enter password>

open nagios configuration file
# vi /usr/local/nagios/etc/nagios.cfg

open your windows configuration file for editing
# vi /usr/local/nagios/etc/ojects/windows.cfg

###Enter insert mode and provide the monitored computer's IP address here###
###Host Definations###
define host {
use windows-server
host_name winserver
alias My Windows Server
address 192.168.91.2
}

Now exit and save this file
:wq

I have already downloaded "send_sms.sh" script into my desktop

I will copy "sms_send" script to the "libexec" folder
# cp /root/Desktop/sms_send.sh /usr/local/nagios/libexec

open your "commands config file for editing
# vi /usr/local/nagios/etc/objects/commands.cfg

Enter insert mode and type your command definations here
## ozeki's NG's 'notify-service-by-sms' command defination ##
define command{
command_name   notify-service-by-sms
command_line   /usr/local/nagios/libexec/sms_send.sh "--Nagios Service Notification --Host: $HOSTNAME$, State: $HOSTSTATE$, Service:$SERVICEDESC$, Description: $SERVICESTATE$, TIME:$LONGDATETIMES$"
}


## ozeki's NG's 'notify-host-by-sms' command defination ##
define command{
command_name   notify-host-by-sms
command_line   /usr/local/nagios/libexec/sms_send.sh "--Nagios Host Notification --Host: $HOSTNAME$, State: $HOSTSTATE$, TIME:$LONGDATETIMES$"
}

once it is done,exit and save your file
:wq

Open your "contacts" config file for editing
# vi /usr/local/nagios/etc/objects/contacts.cfg
## below the CONTACTS section edit the following ##
##Enter the notification command values for the contact##
define contact{
contact_name nagiosadmin;
use generic-contact;
alias Nagios Admin;
service_notification_commands   notify-service-by-sms
host_notification_commands   notify-host-by-sms
email nagios@localhost;
}


Onece it is done, exit and save your file.
:wq


To make changes come into force, restart Nagios service
# service nagios restart

Now you can start Nagios
# firefox http://localhost/nagios

Enter user name and password

click Host Group
click services
click criticals
As you can see there are already some problems with the monitored computer.

If you take a look at Ozeki NG - SMS Gateway you can see the sent message.
# firefox http://127.0.0.1:9501

Enter user name and password of SMS Gateway application

click admin
click sent
view the message have been sent.

For more information please visit Ozekisms site
Read more...

Thursday, August 11, 2011

To mount cdrom in Linux


Create a mount point
# mkdir /media/data


Temporarliy mounting cdrom to mount point
# mount -t iso9660 /dev/sdc0 /media/data


Permanently mounting cdrom to mount point
# vim /etc/fstab
/dev/sdc0 /media/data iso9660 ro,user,noauto 0 0 
:wq


umounting cdrom
# umount /dev/sdc0


If unable to unmount the cdrom
# fuser -mk /dev/sdc0


To eject the cd from cdrom drive
# eject


Troubleshooting:
Testing for iso9660 filesystem is support or not in your linux system.


To search for loaded kernel modules with lsmod command or by reading a content of /proc/filesystem file
# cat /proc/filesystems | grep iso9660
or
# lsmod | grep iso9660

Read more...

Monday, August 8, 2011

Database Connection Error

Symptoms :-
Getting "Database Connection Error" while accessing Atmail webmail by webmail.domain.com


Error :-
Quote:
Database Connection Error
DB Error: connect failed


* Verify the SQL database is running
* Check the SQL server is listening to the specified socket, IP address
* Check the global configuration file (/var/www/atmail/libs/Atmail/Config.php) for the correct database details
* Verify the database server is running correctly
* Verify the MySQL /etc/my.cnf file has the correct settings for the number of database connections
Cause :- Password for the mysql user atmail is not correct as per mentioned in Atmail password file.


[root@support007 ~]# cat "/etc/psa-webmail/atmail/.atmail.shadow"
d62kgaczkOmrqP [This is the password of mysql user admin]


[root@support007 ~]# mysql -uatmail -p
Enter password: [Here I have used d62kgaczkOmrqP password for login as user atmail it fails as password of the user is not correct]
ERROR 1045 (28000): Access denied for user 'atmail'@'localhost' (using password: YES)


Solution :-
Just reset the password for mysql user atmail as per mentioned in atmail password file "/etc/psa-webmail/atmail/.atmail.shadow"
Read more...

check and monitor the plesk email logs.


You can check the email logs on linux plesk with
# tail -f /usr/local/psa/var/log/maillog


On linux plesk server the email get stored at following path:
/var/qmail/mailnames/domain.com/email_account/Maildir/ 
Read more...

Receiving the error while sending email from a web form

If you are receiving the error while sending email from a web form as follows.


Error::
The error in /usr/local/psa/var/log/maillog somewhat as follows:


Quote:
Jul 16 18:02:15 vpsxxx qmail: 1184605335.388076 status: local 2/100 remote 1/100
Jul 16 18:02:15 vpsxxx qmail-remote-handlers[xxxx]: Handlers Filter before-remote for qmail started ...
Jul 16 18:02:15 vpsxxx qmail-remote-handlers[xxxx]: from=YY@YY.YY
Jul 16 18:02:15 vpsxxx qmail-remote-handlers[xxxx]: to=XX@XX.XX
Jul 16 18:02:15 vpsxxx qmail-remote-handlers[xxxx]: cannot reinject message to mail system
Jul 16 18:02:15 vpsxxx qmail: 1184605335.457055 delivery 85: failure:
Jul 16 18:02:15 vpsxxx qmail: 1184605335.457508 status: local 2/100 remote 0/100
Jul 16 18:02:15 vpsxxx qmail-queue-handlers[xxxx]: Handlers Filter before-queue for qmail started ...


Solution:
I got it fixed with very simple trick. :P


1. Login to plesk control of the server as a admin user.
2. Select the domain from "Domains" and click on its "Services>> Mail" option.
3. Then, disable the mail service for that domain by clicking on "Switch Off" and then re-enable the mail service.
Read more...

network unreachable resolving


If you are receiving the error in /var/log/messages for named service as follows.
Error::
Quote:
Feb 23 15:44:49 named[28471]: network unreachable resolving 'L.ROOT-SERVERS.NET/AAAA/IN': 2001:503:ba3e::2:30#53
Feb 23 15:44:49 named[28471]: network unreachable resolving 'G.ROOT-SERVERS.NET/AAAA/IN': 2001:dc3::35#53
Feb 23 15:44:49 named[28471]: network unreachable resolving 'L.ROOT-SERVERS.NET/AAAA/IN': 2001:503:c27::2:30#53
Feb 23 15:44:49 named[28471]: network unreachable resolving 'G.ROOT-SERVERS.NET/AAAA/IN': 2001:7fd::1#53
Feb 23 15:44:49 named[28471]: network unreachable resolving 'I.ROOT-SERVERS.NET/AAAA/IN': 2001:dc3::35#53
Feb 23 15:44:49 named[28471]: network unreachable resolving 'D.ROOT-SERVERS.NET/AAAA/IN': 2001:dc3::35#53
Feb 23 15:44:49 named[28471]: network unreachable resolving 'I.ROOT-SERVERS.NET/AAAA/IN': 2001:7fd::1#53
Feb 23 15:44:49 named[28471]: network unreachable resolving 'E.ROOT-SERVERS.NET/AAAA/IN': 2001:dc3::35#53
Feb 23 15:44:49 named[28471]: network unreachable resolving 'L.ROOT-SERVERS.NET/AAAA/IN': 2001:dc3::35#53
Feb 23 15:44:49 named[28471]: network unreachable resolving 'B.ROOT-SERVERS.NET/AAAA/IN': 2001:503:c27::2:30#53
Feb 23 15:44:49 named[28471]: network unreachable resolving 'L.ROOT-SERVERS.NET/AAAA/IN': 2001:7fd::1#53
Feb 23 15:44:49 named[28471]: network unreachable resolving 'C.ROOT-SERVERS.NET/AAAA/IN': 2001:503:c27::2:30#53
Feb 23 15:44:49 named[28471]: network unreachable resolving 'B.ROOT-SERVERS.NET/AAAA/IN': 2001:dc3::35#53

Cause:
As per the change log of BIND for CentOS 5.4 updates (bind-chroot-9.3.6-4.P1.el5_4.1) , the latest BIND DNS server is enabled by default for IPV6 DNS resolving. Any DNS query made to the DNS server will caused the program to also resolved IPV6 IP regardless that the host server or client is not IPV6 enable or capable.

Solution:
Disable the IPV6 in BIND by editing the file /etc/sysconfig/named file and adding the following options into the BIND startup

# vim /etc/sysconfig/named
OPTIONS="-4"
:wq

This will cause the BIND server to only resolve or use IPV4 and disable IPV6 support. Save the file and restart BIND server.
# /etc/init.d/named restart
Read more...

Tuesday, August 2, 2011

Logrotate


Logs are important and usefull in security and administration. If a log grows too much, you compress it , back it up for some months or years and create a new log file. All this is done in a much better way by Logrotate. Logrotate enables you to compress the old logfile, and store it for as long as you want, to run every day, montly, or when you want, and if a file expires, it can send it to you by email or delete it, after for example, 2 years. Old logs can be stored in an alternative directory.

You set up logs configuring /etc/logrotate.conf or adding a new file in /etc/logrotate.d/
For example, a logrotate file for apache looks like this:
File: /etc/logrotate.d/httpd
-------8<-------
/usr/local/apache/logs/*log {
missingok
notifempty
sharedscripts
postrotate
/bin/kill -USR1 `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
endscript
}

-------8<-------

logrotate: show a simple but usefull command that forces the logrotation, independent of the normal execution.
# logrotate -f /etc/logrotate.conf

Read more...

Monday, June 20, 2011

Process Management


Process:
Any application that runs on a Linux system is assigned a process ID or PID. This is a numerical representation of the instance of the application on the system. In most situations this information is only relevant to the system administrator who may have to debug or terminate processes by referencing the PID. Process Management is the series of tasks a System Administrator completes to monitor, manage, and maintain instances of running applications.

Type of Process: 
1. Interactive Process  
2. System Process (daemon)

Interactive Process:
    The processes that are invoked by a user and can interact with the user is called Interactive processes. Interactive processes can be classified into foreground and background processes. Foreground process is the process that you are currently interacting with, and is using the terminal as its stdin (standard input) and stdout (standard output). Background process is not interacting with the user and can be in one of two states – paused or running.

Example of  Interactive process: 
The following example will show how foreground and background processes are running.
1. Logon as root.
# su -

2. Run [cd \]
# cd \

3. Run [vi]
# vi data.txt

4. Press [ctrl + z]. This will pause vi
Ctrl + z

5. Type [jobs]
# job
Notice:  vi is running in the background

7. Type [fg %1]. This will bring the first background process to the foreground.
# fg %1

8. Close vi 
:q

System Process:
The process that runs on Linux is a system process or Daemon (day-mon). Daemon is the term used to refer to process’ that are running on the computer and provide services but do not interact with the console. Most server software is implemented as a daemon. Apache, Samba, and inn are all examples of daemons.

Any process can become a daemon as long as it is run in the background, and does not interact with the user. A simple example using the [gedit] command. This will list all text editor window separately on the computer. This command can be set to run in the background by typing [gedit&], and although technically you have control over the shell prompt, you will be able to do little work as the screen displays the output of the process that you have running in the background. 

Notice: The standard pause (ctrl+z) and kill (ctrl+c) commands.

1. View linux process
Show process launched for the current linux user
$ ps
Show process launched for a linux user
$ ps -u username
View all the running linux process
$ ps aux
To see a process tree
$ pstree
To see the processes in real time

2. Stop temporarily processes
$ bigjob
^Z (CRTL+Z)

To see the stopped linux processes 
$ jobs
   [1]+ Stopped bigjob

Kill an stopped process
$ kill %1
   [1]+ Killed bigjob
Resume the linux process
$ fg 1

3. Foreground and background linux processes
To start a process in  background mode
$ bigjob &

See process
$jobs
  [1]+  Running bigjob

Put it in foreground mode
$fg 1

ps command:
The ps command is the used to manage running processes and can be used for many things including viewing the status of your computer and knowing how well the computer is performing.

Some common ps commands: 
View display currently running process on this terminal.
ps

All current processes on this terminal, by all users.
# ps –a

All processes not assigned to a terminal (daemons).
ps –x 

To get information about all running process
# ps –ag

To kill all process except your shell
# kill 0

Start a process in background
# linux-command &

To get all the details regarding the running process.
# ps aux

To check a particular process.
# ps ax | grep process-name

To see currently running processes and there memory usage.
# top

To see currently running processes in a tree structure.
# pstree 

4 killing linux  processes
·          kill -1 pid.    Restart  the process 
·          kill -9  pid .  kill the process
·          kill -15  pid  End  the process 

System calls used for Process management:
  • Fork () :- Used to create a new process
  • Exec() :- Execute a new program
  • Wait():- wait until the process finishes execution
  • Exit():- Exit from the process
  • Getpid():- get the unique process id of the process
  • Getppid():- get the parent process unique id
  • Nice():- to bias the existing property of process  
Signals:
 Various Signals are:
Signal Name
Number
Description
SIGHUP
1
Hangup (POSIX)
SIGINT
2
Terminal interrupt (ANSI)
SIGQUIT
3
Terminal quit (POSIX)
SIGILL
4
Illegal instruction (ANSI)
SIGTRAP
5
Trace trap (POSIX)
SIGIOT
6
IOT Trap (4.2 BSD)
SIGBUS
7
BUS error (4.2 BSD)
SIGFPE
8
Floating point exception (ANSI)
SIGKILL
9
Kill(can't be caught or ignored) (POSIX)
SIGUSR1
10
User defined signal 1 (POSIX)
SIGSEGV
11
Invalid memory segment access (ANSI)
SIGUSR2
12
User defined signal 2 (POSIX)
SIGPIPE
13
Write on a pipe with no reader, Broken pipe (POSIX)
SIGALRM
14
Alarm clock (POSIX)
SIGTERM
15
Termination (ANSI)
SIGSTKFLT
16
Stack fault
SIGCHLD
17
Child process has stopped or exited, changed (POSIX)
SIGCONT
18
Continue executing, if stopped (POSIX)
SIGSTOP
19
Stop executing(can't be caught or ignored) (POSIX)
SIGTSTP
20
Terminal stop signal (POSIX)
SIGTTIN
21
Background process trying to read, from TTY (POSIX)
SIGTTOU
22
Background process trying to write, to TTY (POSIX)
SIGURG
23
Urgent condition on socket (4.2 BSD)
SIGXCPU
24
CPU limit exceeded (4.2 BSD)
SIGXFSZ
25
File size limit exceeded (4.2 BSD)
SIGVTALRM
26
Virtual alarm clock (4.2 BSD)
SIGPROF
27
Profiling alarm clock (4.2 BSD)
SIGWINCH
28
Window size change (4.3 BSD, Sun)
SIGIO
29
I/O now possible (4.2 BSD)
SIGPWR
30
Power failure restart (System V)

Read more...