AWK is an interpreted programming language. It is very powerful and specially designed for text processing. AWK – Basic Examples This chapter describes several useful AWK commands and their appropriate examples. Consider a text file marks.txt to be processed with the following content − 1) Amit Physics 80 2) Rahul Maths 90 3) Shyam Biology […]
Howto install sar & ksar system activity info in Centos / Redhat
The sar command collect, report, or save UNIX / Linux system activity information. It will save selected counters in the operating system to the /var/log/sa/sadd file. Fromlinux-logo the collected data, you get lots of information about your server: CPU utilization Memory paging and its utilization Network I/O, and transfer statistics Process creation activity All block […]
Send SNMP Traps from Nagios to Remote Management Host
1. Add ‘send snmp trap’ command to nagios vim /usr/local/nagios/etc/objects/commands.cfg define command{ command_name send_snmptrap command_line /usr/bin/snmptrap -v 2c -c public 10.50.24.34 ” NAGIOS-NOTIFY-MIB::nSvcEvent nSvcHostname s “$HOSTNAME$” nSvcDesc s “$SERVICEDESC$” nSvcStateID i $SERVICESTATEID$ nSvcOutput s “$SERVICEOUTPUT$” } 2. Add this event and enable the event to services which needed to send traps vim /usr/local/nagios/etc/objects/localhost.cfg define service{ […]
How To Install and Configure SNMP on RHEL 7 or CentOS 7
SNMP stands for “Simple Network Management Protocol”, it can be utilized to monitor any devices that support snmp, few of the devices are server, router, network printers, firewalls. SNMP can monitor a variety of parameters for these devices such as server performance, network usage, disk utilization. Check Package Check if the package is already installed, […]
Useful MySQL Commands
Database with size SELECT table_schema “DB Name”, Round(Sum(data_length + index_length) / 1024 / 1024, 1) “DB Size in MB” FROM information_schema.tables GROUP BY table_schema; Create a database. mysql> create database [databasename]; List all databases on the server. mysql> show databases; Switch to a database. mysql> use [db name]; To see all the tables in the […]
Send E-Mail On Redhat / CentOS with SMTP (SMTP Relay)
In this tutorial we will send email with mailx and using external SMTP server for email sending from CentOS/Redhat Install mailx yum -y update yum install -y mailx We can now start sending e-mails using create a symbolic link ln -s /bin/mailx /bin/email Set an External SMTP Server to Relay E-Mails vi /etc/mail.rc edit set […]
Password Validation Plugin in MySQL
The validate_password plugin serves to test passwords and improve security. The plugin exposes a set of system variables that enable you to define password policy. First check the plugin directory of MySQL. mysql> show variables like “plugin%”; +—————+————————–+ | Variable_name | Value | +—————+————————–+ | plugin_dir | /usr/lib64/mysql/plugin/ | +—————+————————–+ 1 row in set (0.00 […]
Set Up and Use Yum Repositories on Redhat / CentOS
We can install new software on Red Hat/CentOS Linux with “yum install packagename” command from console. Running this command first checks for existing YUM Repository configuration files in /etc/yum.repos.d/ directory. It reads each YUM Repository configuration file to get the information required to download and install new software, resolves software dependencies and installs the required […]
Purge binary logs in MySQL
Please do not just delete them in the OS. You need to let mysqld do that for you. Here is how mysqld manages it: The file mysql-bin.[index] keeps a list of all binary logs mysqld has generated and auto-rotated. The mechanisms for cleaning out the binlogs in conjunction with mysql-bin.[index] are: PURGE BINARY LOGS TO […]
MySQL Master-Master Replication Bug – ERROR 1872
Description: When i tried to configurate a crash safe slave with MTS and GTID based replication, but after a OS crash replication failed to be start. error log: ——————————— 2016-10-26 21:00:23 2699 [Warning] Neither –relay-log nor –relay-log-index were used; so replication may break when this MySQL server acts as a slave and has his hostname […]