Thứ Hai, 9 tháng 7, 2018

Part 1 : VMWare VCenter 6.7 : External PSC for LB Step-By-Step Installation

Having External PSC and load balancing them has become a common trend from vCenter 6.5. This post will cover the installation and configuration of 2 vCenter 6.7 PSC appliances, with one Single Sign On Domain and One site.
Contents of the Post

Pre-requisites for this post

Thứ Năm, 26 tháng 4, 2018

Note Grafana

systemctl enable grafana-server.service
systemctl daemon-reload
systemctl start grafana-server
systemctl status grafana-server

 mkdir /root/Monitor
 cd /root/Monitor

Setting up OpenVPN Server on CentOS 7 using EasyRSA 3

Basic CentOS Setup

First, you'll need a CentOS 7 server. You can use one from almost anywhere – a machine with Digital Ocean, AWS or Azure, or one in your friend's apartment. Assuming you're starting from scratch, you'll need to get the software updated and the EPEL repo installed.
# sudo yum update -y
# sudo yum install epel-release -y
# sudo yum update -y
Then you'll want to install openvpn, easyrsa, iptables and (recommended) a few network troubleshooting tools.
# sudo yum install -y openvpn easy-rsa iptables iptables-services wget yum-cron net-tools bind-utils nc mtr

Setting up OpenVPN

Now, you'll want to configure the OpenVPN server. To do this, copy the following file to /etc/openvpn/server.conf.
# Secure OpenVPN Server Config

Thứ Tư, 28 tháng 3, 2018

Tcpdump usage examples

See the list of interfaces on which tcpdump can listen:
tcpdump -D
Listen on interface eth0:
tcpdump -i eth0
Listen on any available interface (cannot be done in promiscuous mode. Requires Linux kernel 2.2 or greater):
tcpdump -i any
Be verbose while capturing packets:
tcpdump -v
Be more verbose while capturing packets:
tcpdump -vv
Be very verbose while capturing packets:

Thứ Hai, 4 tháng 12, 2017

Making simple Splunk Nginx dashboard

As a DevOps guy I often do incident analysis, post deployment monitoring and usual logs checks. If you also is using Splunk as me when let me show for you few effective Splunk commands for Nginx logs monitoring.

Extract fileds

To make commands works Nginx log fields have to be extracted into variables.
Where are 2 ways to extract fields:
  1. By default Splunk recognise “access_combined” log format which is default format for Nginx. If it is your case congratulations nothing to do for you!
  2. For custom format of logs you will need to create regular expression. Splunk has built in user interface to extract fields or you can provide regular expression manually.

Chủ Nhật, 19 tháng 11, 2017

Simple shell script to backup MySQL databases

#!/bin/bash
# Simple script to backup MySQL databases

# Parent backup directory
backup_parent_dir="/var/backups/mysql"

# MySQL settings
mysql_user="root"
mysql_password=""

# Read MySQL password from stdin if empty
if [ -z "${mysql_password}" ]; then
  echo -n "Enter MySQL ${mysql_user} password: "
  read -s mysql_password
  echo
fi

Thứ Hai, 6 tháng 11, 2017

How to Redirect Nginx traffic based on the Client’s IP Address

Sometimes developers need to redirect part of their traffic to another web area or specific URL. Depending on the IP address the visitors have, it’s ideal to geo-locate traffic or simply protect areas from unwanted specific IP addresses. So, how do you redirect traffic from IP 1.2.3.4 to http://www.thisurl.com/page2.html and the rest of the traffic to http://www.thisurl.com/? We’ll go over this today.

Redirect using Nginx HttpAccessModule

As Nginx supports conditional configurations, first let’s look at an example of how to redirect traffic using HttpAccessModule running a regex against $remote_addr variable.
server {
if ($remote_addr = 1.2.3.4) {
rewrite ^ http://www.yourwebsite.com/otherpage.htm;
}
}
In this example, 1.2.3.4 is the IP address you want to redirect.