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 […]
Create Permanent alias on CentOS/Redhat
The ‘alias’ command in CentOS allows for you to create an alias to a command. For example, if you want to use the vim text editor, but are used to typing vi file-to-edit.txt, you can create an alias to automatically start vim instead of vi when typing the command. Showing current aliases To show the […]
Delete Files Older Than X Days
Command Syntax find /path/to/files* -mtime +5 -exec rm {} \; Note that there are spaces between rm, {}, and \; This is a very simple tutorial how to find and delete files older than X days. I needed this for a project where i collected some images and after a while they took too much […]