Linux administration , Unix administration , Vmware Vsphere administration , Oracle DBA ,apache, backup, dhcp, dns, kvm, xen, kernel, ldap, kvm, monitoring, ticketing, networking, Mail servers, SAN,troubleshooting
Labels
- Amanda (2)
- Ansible (2)
- Answer these Questions (2)
- antivirus (2)
- apache (3)
- Bash (16)
- Chef (3)
- Citrix (2)
- clusters (2)
- Concept (22)
- DatabaseAdminstration (11)
- DevOps (1)
- dhcp (2)
- Downloads (3)
- ELK (1)
- ELK stack (1)
- encryption (1)
- Free trainings (1)
- Frequently Used Commands (46)
- FTP (1)
- git (1)
- gpg (2)
- Hardware (1)
- httpd (2)
- Interview Questions (53)
- iptables (1)
- IT NEWS (3)
- java (1)
- kibana (2)
- knife (1)
- KVM (2)
- linux (17)
- Linux installations (22)
- Linux Jobs (4)
- Linux Links (2)
- logstash (1)
- Mac (1)
- MediaWiki (1)
- MySql (2)
- Nagios (2)
- Networking (3)
- open Nebula (5)
- Open Source tools (12)
- OpenNMS (1)
- openSSL (1)
- Oracle on Linux (5)
- Performance Monitoring (1)
- php (1)
- postfix (1)
- postgres (1)
- postgres-XL (1)
- Product Reviews (1)
- Python (2)
- rssh (1)
- Samba (2)
- Scripting (16)
- security (4)
- selinux (1)
- Server (1)
- SFTP (1)
- Social Awareness (1)
- Solaris (1)
- SSL (1)
- svn (1)
- TCP/IP (1)
- Technology (1)
- Tips and Tricks (32)
- Training and materials (8)
- Troubleshooting (6)
- Ubuntu (18)
- unix (1)
- virtualization (17)
- Vmware (25)
- Vyatta (1)
- windows7 (1)
- xml (1)
To Know Which Shell You Are Working
Installing and Configuring Monit Step by Step
install and configure monit
apt-get install monit
Monit Configuration file is /etc/monit/monitrc
for example sshd,apache,Mysql
Now for monit web interface the default port number is 2812
Now let us configure the monit
vi /etc/monit/monitrc
--------------------------------------------------------------------------------------------------------------------
set daemon 60 // time interval of the daemon set logfile syslog facility log_daemon set mailserver localhost set mail-format { from: monit@server1.example.com } set alert root@localhost // mail id to send email alerts set httpd port 2812 and // If you want to chang port number change here better leave it default SSL ENABLE // for SSL PEMFILE /var/certs/monit.pem // SSL certificate location allow admin:test // user name and password Basic Auth // monitoring sshd check process sshd with pidfile /var/run/sshd.pid start program "/etc/init.d/ssh start" stop program "/etc/init.d/ssh stop" if failed port 22 protocol ssh then restart if 5 restarts within 5 cycles then timeout
// monitoring mysql check process mysql with pidfile /var/run/mysqld/mysqld.pid group database start program = "/etc/init.d/mysql start" stop program = "/etc/init.d/mysql stop" if failed host 127.0.0.1 port 3306 then restart if 5 restarts within 5 cycles then timeout
// monitoring apache check process apache with pidfile /var/run/apache2.pid group www start program = "/etc/init.d/apache2 start" stop program = "/etc/init.d/apache2 stop"
if failed host www.example.com port 80 protocol http
and request "/monit/token" then restarthere monit tries to connect www.example.com on port 80 and tries to access a file
/monit/token the actual location of /monit/token is /var/www/www.example.com/web/monit/token as our website document root is
/var/www/www.example.com/web
if monit cannot access this file it means apache is not runnig so it willrestart apache. Creation of token is given below if cpu is greater than 60% for 2 cycles then alert
if cpu > 80% for 5 cycles then restart
if totalmem > 500 MB for 5 cycles then restart
if children > 250 then restart
if loadavg(5min) greater than 10 for 8 cycles then stop
if 3 restarts within 5 cycles then timeout
you can add your custom process for
monitoring here----------------------------------------------------------------------------------------------------------------
Creation of token
---------------------
mkdir /var/www/www.example.com/web/monit
echo "hello" > /var/www/www.example.com/web/monit/token
Creation of SSL-encrypted monit web interface
-----------------------------------------------------------------
( /var/certs/monit.pem )
openssl req -new -x509 -days 365 -nodes -config ./monit.cnf -out /var/certs/monit.pem -keyout /var/certs/monit.pem
openssl gendh 512 >> /var/certs/monit.pem
openssl x509 -subject -dates -fingerprint -noout -in /var/certs/monit.pem
chmod 700 /var/certs/monit.pem
then we need to configure OpenSSL configuration file to create our certificate
vi /var/certs/monit.cnf
example file is
-------------------------------------------------------------------------------------------
# create RSA certs - Server RANDFILE = ./openssl.rnd [ req ] default_bits = 1024 encrypt_key = yes distinguished_name = req_dn x509_extensions = cert_type [ req_dn ] countryName = Country Name (2 letter code) countryName_default = MO stateOrProvinceName = State or Province Name (full name) stateOrProvinceName_default = Monitoria localityName = Locality Name (eg, city) localityName_default = Monittown organizationName = Organization Name (eg, company) organizationName_default = Monit Inc. organizationalUnitName = Organizational Unit Name (eg, section) organizationalUnitName_default = Dept. of Monitoring Technologies commonName = Common Name (FQDN of your server) commonName_default = server.monit.mo emailAddress = Email Address emailAddress_default = root@monit.mo [ cert_type ] nsCertType = server
------------------------------------------------------------------------------
enable monit daemon now
/etc/default/monit in this file set startup =1 and interval for running the monit daemon
example file is below
--------------------------------------------------------------
# Defaults for monit initscript # sourced by /etc/init.d/monit # installed at /etc/default/monit by maintainer scripts # Fredrik Steen# You must set this variable to for monit to start startup=1 # To change the intervals which monit should run uncomment # and change this variable. CHECK_INTERVALS=60
---------------------------------------------------------------
now let us start monit
/etc/init.d/monit start
Now point your browser to https://www.example.com:2812/ (make sure port 2812 is not blocked by your firewall), log in with admin and test
as specified in /etc/monit/monitrc
How to rename temp files in temporary tablespace
SHUTDOWN
STARTUP MOUNT
ALTER DATABASE RENAME FILE 'oldpath' TO 'newfile path';
ALTER DATABASE OPEN;
delete older file
STARTUP MOUNT
ALTER DATABASE RENAME FILE 'oldpath' TO 'newfile path';
ALTER DATABASE OPEN;
delete older file
Steps to start the multiple listener in Oracle
$lsnrctl
LSNRCTL>set current DEMO
LSNRCTL> start
LSNRCTL> set current PROD
LSNRCTL> start
LSNRCTL>set current DEMO
LSNRCTL> start
LSNRCTL> set current PROD
LSNRCTL> start
Subscribe to:
Comments (Atom)