vi /etc/postfix/main.cf

smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
relayhost =[smtpapi.yourdomain.com]:587

vi /etc/postfix/sender_relay
support@yourdomain.com [email-smtp.us-west-2.amazonaws.com]:587
user@yourdomain.com [email-smtp.us-east-1.amazonaws.com]:587


vi /etc/postfix/sasl_passwd
[smtpapi.sengridyourdomain.com]:587 usernameXXXXXXXX:passwordXXXXXXXXXXXXXXXXXXXXXXXXXXXX

[email-smtp.us-east-1.amazonaws.com]:587 usernameXXXXXXXX:passwordXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[email-smtp.us-west-2.amazonaws.com]:587 usernameXXXXXXXX:passwordXXXXXXXXXXXXXXXXXXXXXXXXXXXX


postmap /etc/postfix/sender_relay

postmap /etc/postfix/sasl_passwd

/etc/init.d/postfix restart



As per above setup support email sent through SES west2 and specific user email id sent through SES east-1 rest all email sent through sendgrid API

email test via console & after deliver check show original of email

echo "body of email" | mail -s "subject of the email" -r sender@yourdomain.com recipeient@anotherdomain.com

echo "body of email" | mail -s "subject of the email" -r support@yourdomain.com recipeient@personalemailid

 echo "body of email" | mail -s "subject of the email" -r user@yourdomain.com recipeient@personalemailid

echo "body of email" | mail -s "subject of the email" -r anyoheremail@yourdomain.com recipeient@personalemailid
Run 4 below steps to verify

echo -n "SESUsername" | openssl enc -base64

echo -n "SESPassword" | openssl enc -base64

openssl s_client -crlf -quiet -connect email-smtp.us-east-1.amazonaws.com:465

Input txt contain
EHLO yourdomain.com
AUTH LOGIN
SESUsername output
SESpassword output
MAIL FROM: sender email id
RCPT TO: recipt email id
DATA
From: Sender Name
To: recipt email id
Subject: Amazon SES SMTP Test

This message was sent using the Amazon SES SMTP interface.
.
QUIT


openssl s_client -crlf -quiet -connect email-smtp.us-east-1.amazonaws.com:465 < input.txt
Thursday, August 23, 2018

how to setup specific network conditions for software testing

https://www.testdevlab.com/blog/2017/07/how-to-set-up-specific-network-conditions-for-software-testing/

Google Chrome

Google Chrome desktop browser has a built-in tool for testing under specific network profiles. The network throttling allows manipulating with upstream/downstream network bandwidth and latency. The tool can be found in Chrome Developer Tools under the Networking tab. You can choose from predefined profiles, tweak them or create your own network conditions.

Mozilla Firefox

To access this tool, make sure you’re running an updated version of Nightly, then open the Responsive Design Mode tool via Tools – Web Developer – Responsive Design Mode. You can then select the desired simulated speed with the drop-down menu to the right of “Responsive Design Mode”, and reload the page to see the effect of the changes.

Apple (iOS)


You can throttle network on an iOS device with Developer tools. To enable Developer tools connect iOS device to Xcode.
A quick setting of network conditions for other mobile device on iOS:
  1. Use iOS device with mobile data;
  2. Create hotspot on that device and connect a test device to hotspot;
  3. Go to iOS device Settings – Developer – Network link conditioner and enable desired condition.
Additional_Tools_for_Xcode_9.3.dmg you can search this setup and install under hardware you will find  Network Link conditioner  setup which need to install
for check server header information

curl --head http://domain name/
curl -v http://domain name/

wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz

./config --prefix=/usr --openssldir=/usr/local/openssl shared
make
make test
sudo make install

After manually install OpenSSL will not be integrated with Apache for that we have to run below.

This show all shared library information with mod_ssl.so

ldd /usr/lib64/httpd/modules/mod_ssl.so | egrep 'lib(ssl|crypto)'

ls -lh /lib64/libcrypto.so.10
cd /lib64/
rm -rf libcrypto.so.10
ln -s ../usr/lib64/libcrypto.so.1.0.0 libcrypto.so.10

rm -rf libssl.so.10
ln -s libssl.so.10 ../usr/lib64/libssl.so.1.0.0

/etc/init.d/httpd reload

check server header again which show latest OpenSSL configured with Apache.


Hide Apache version and Server Header

vi /etc/httpd/conf/httpd.conf  at end of file add below

ServerSignature Off
ServerTokens Prod

/etc/init.d/httpd reload
 
Wednesday, March 28, 2018

Dynamic-EC2-Instnace-Add

 Make shell script Dynamic-EC2-Instnace-Add.sh

#!/bin/bash
#
# Author : Arun
# Version : 1.0
# Date : 1-Dec-2017
# Description : Check EC2 instances dynamically via nagios of the Project and create non available nagios host


### Set AWS KEY of IAM user which can fetch the ELB information.
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=

### Give the AWS region name where the ELB exist
_AWS_REGION_NAME=us-east-1

### Absolute path of nagios config directory set for Autoscaling Group
_CURRENT_DIR=/usr/local/nagios/etc/autoscale

####  Absolute path of nagios Junk directory set for Autoscaling Group
_JUNK_DIR=/usr/local/nagios/libexec/autoscale

## Read all AWS account instance (name, public ip and state) ###
aws ec2 describe-instances --query 'Reservations[*].Instances[*].[Tags[?Key==`Name`].Value|[0],State.Name,PublicIpAddress]' --output text | column -t > $_JUNK_DIR/as8.txt

### Function Assigned
nagiosconfigfile () {
    echo "define host{"                                                 >> $_CURRENT_DIR/host.cfg
    echo "  host_name                 $_MY_SERVER_NAME"                 >> $_CURRENT_DIR/host.cfg
    echo "  use                       Servers-Linux"                    >> $_CURRENT_DIR/host.cfg
    echo "  alias                     $_MY_SERVER_NAME"                 >> $_CURRENT_DIR/host.cfg
    echo "  address                   $_MY_IP"                          >> $_CURRENT_DIR/host.cfg
    echo "  _HOST_ID                  101$_COUNT"                       >> $_CURRENT_DIR/host.cfg
    echo "  hostgroups                Linux-Servers,Services"   >> $_CURRENT_DIR/host.cfg
    echo "  check_command             check_host_alive_10022"           >> $_CURRENT_DIR/host.cfg
    echo "  max_check_attempts        3"                                >> $_CURRENT_DIR/host.cfg
    echo "  check_interval            1"                                >> $_CURRENT_DIR/host.cfg
    echo "  retry_interval            2"                                >> $_CURRENT_DIR/host.cfg
    echo "  check_period              24x7"                             >> $_CURRENT_DIR/host.cfg
    echo "  contact_groups           ,slackadmins"              >> $_CURRENT_DIR/host.cfg
    echo "  notification_interval     5"                                >> $_CURRENT_DIR/host.cfg
    echo "  first_notification_delay  1"                                >> $_CURRENT_DIR/host.cfg
    echo "  notification_period       24x7"                             >> $_CURRENT_DIR/host.cfg
    echo "  notification_options      d,u,r"                            >> $_CURRENT_DIR/host.cfg
    echo "  notifications_enabled     1"                                >> $_CURRENT_DIR/host.cfg
    echo "}"                                                            >> $_CURRENT_DIR/host.cfg
    echo ""                                                             >> $_CURRENT_DIR/host.cfg
}


RWR="no"

#### MK is variable ###

while read q; do
    arr=($q)
    MK1=${arr[0]}        #This will be my Server Name
    MK2=${arr[1]}        #This will show running/stoped State
    MK3=${arr[2]}        #This is Server IP Address   
   
    if grep -r "$MK3" $_CURRENT_DIR/host.cfg
    then
        # code if found
        ABC="aws"
               if [[ $MK2 != "running" ]]; then
                RWR="yes"
                fi
    else   
        if [[ $MK2 == "running" ]]; then         
        RWR="yes"
        fi
    fi
done <$_JUNK_DIR/as8.txt

F1=$(sed -n '$=' $_JUNK_DIR/as10.txt)
F2=$(sed -n '$=' $_JUNK_DIR/as8.txt)

echo $F1
echo $F2

if [[ $F1 != $F2 ]]
then
    RWR="yes"
fi



if [[ $RWR == "yes" ]]; then
    cat /dev/null > $_CURRENT_DIR/host.cfg
    cat /dev/null > $_JUNK_DIR/as10.txt
    counter=0
### AS is veriable ##

    while read s; do
        arr=($s)
        AS1=${arr[0]}
        AS2=${arr[1]}
        AS3=${arr[2]}
   
        if [[ $AS2 == "running" ]]; then     
            let counter++
            _MY_IP=$AS3
            _MY_SERVER_NAME=$AS1
            _COUNT=$counter

            ## echo "My IP $q">>host.cfg
            echo $_MY_IP >> $_JUNK_DIR/as10.txt
            nagiosconfigfile;
        fi       

    done <$_JUNK_DIR/as8.txt

    #systemctl reload nagios
    #service nagios restart
#then
fi

### Unset the variable value AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY

## End Of Line ##

Download pflogsumm
  •  wget http://jimsun.linxnet.com/downloads/pflogsumm-1.1.1.tar.gz
  •  tar -zxf pflogsumm-1.1.1.tar.gz
  • cd pflogsumm-1.1.1

Generate the statistics  :-
#  cat /var/log/maillog | ./pflogsumm.pl

 Grand Totals
------------
messages

   8596   received
   8606   delivered
      0   forwarded
      0   deferred
      0   bounced
      0   rejected (0%)
      0   reject warnings
      0   held
      0   discarded (0%)

  77044k  bytes received
  77324k  bytes delivered
      7   senders
      2   sending hosts/domains
     13   recipients
      4   recipient hosts/domains


Per-Day Traffic Summary
    date          received  delivered   deferred    bounced     rejected
    --------------------------------------------------------------------
    Mar 24 2018         3          3
    Mar 25 2018       215        208
    Mar 26 2018       302        298
    Mar 27 2018       289        307
    Mar 28 2018      7787       7790
For server configuration
 
wget https://www.stunnel.org/downloads/stunnel-5.44.tar.gz
tar -zxvf stunnel-5.44.tar.gz
cd stunnel-5.44
yum install gcc
yum install openssl openssl-devel gcc
./configure
make
make install
cd /usr/bin/
ln -s /usr/local/bin/stunnel stunnel
cd /etc/
ln -s /usr/local/etc/stunnel stunnel

cd stunnel-5.44/tools
./makecert.sh

cd /usr/local/etc/stunnel
cp stunnel-5.44/tools/stunnel.pem .

vi /etc/hosts
server ip  localhost localhost.localdomain localhost4 localhost4.localdomain4

start at server
vi /usr/local/etc/stunnel/stunnel.conf
debug = 7
output = stunnel.log
cert = stunnel.pem
[mysql]
accept = localhost:10001
connect = 127.0.0.1:3306

[apache]
accept = localhost:8080
connect = 127.0.0.1:80

/usr/bin/stunnel /usr/local/etc/stunnel/stunnel.conf

Open port 10001 & 8080 in firewall


For client configuration

wget https://www.stunnel.org/downloads/stunnel-5.44.tar.gz
tar -zxvf stunnel-5.44.tar.gz
cd stunnel-5.44
yum install gcc
yum install openssl openssl-devel gcc
./configure
make
make install
cd /usr/bin/
ln -s /usr/local/bin/stunnel stunnel
cd /etc/
ln -s /usr/local/etc/stunnel stunnel
copy paste stunnel.pem file from server
start at client end
vi /usr/local/etc/stunnel/client.conf

debug = 7
output = stunnel-server.log
cert = stunnel.pem
client = yes
[mysql]
accept = 127.0.0.1:6004
connect = EIP server ip :10001

[apache]
accept = 127.0.0.1:80
connect = EIP server ip:8080

/usr/bin/stunnel  /usr/local/etc/stunnel/client.conf

For testing
mysql -u root -p -h 127.0.0.1 -P 6004

elinks : http://127.0.0.1

Monday, February 26, 2018

redirect-http-https-on AWS ELB

Apache

The rewrite rule for an Apache backend is similar to the following in .htaccess:




RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule .* https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]

 
 
Nginx

The rewrite rule for an Nginx backend in the ngnix.conf file is similar to the following:
Note: Applies to versions nginx/1.10.3 (Ubuntu) and nginx/1.12.1 (Amazon Linux).


server {
      listen         80;
      server_name    www.example.org;
      if ($http_x_forwarded_proto = 'http') {            
  return 301 https://$server_name$request_uri$http_x_forwarded_proto;
        }
}
Ec2-instance-AutoEIP-Assign-for-whitelistip

#!/bin/sh
# Region in Which instance is running
EC2_REGION='us-east-1'
AWS_ACCESS_KEY='XXXXXXXXXXX'
AWS_SECRET_ACCESS_KEY='XXXXXXXXXXXXXXXXXXX'

#Instance ID captured through Instance meta data
InstanceID=$(/usr/bin/curl -s http://169.254.169.254/latest/meta-data/instance-id)

#Query free Elastic IP and write all allocated ID  aws ec2 describe-addresses --query 'Addresses[?AssociationId==null]' --output text | perl -lne 'print if /(\w+\-){1}\w+/'

aws ec2 describe-addresses --query 'Addresses[?AssociationId==null]' --output text | perl -lne 'print $& if /(\w+\-){1}\w+/' > /opt/EIP/output.txt
Allocate_ID=$(head -n 1 /opt/EIP/output.txt)

#Assigning Elastic IP to Instance
aws ec2 associate-address --instance-id $InstanceID --allocation-id $Allocate_ID
Wednesday, December 20, 2017

AWS Cli IMP commands

Describe Load Balancer

aws elb describe-load-balancers --load-balancer-names lbname --output text|grep INSTANCES|awk '{print $2}' > filename.txt

Describe intance  with particular instnace type

aws ec2 describe-instances --filters "Name=instance-type,Values=m5.large"

aws ec2 describe-instances

Describe aws account all volume  and there information

aws ec2 describe-volumes --query 'Volumes[*].{ID:VolumeId,Tag:Tags}'

Get Instance ID information
wget -q -O - http://169.254.169.254/latest/meta-data/instance-id

Get instance public ip

aws ec2 describe-instances --instance-id $p | grep PublicIpAddress | grep -o -P "\d+\.\d+\.\d+\.\d+" | grep -v '^10\.' >> filename.txt










Configure httpd server status enable and configure on 800 port.

Then while use aws cli configure shell script and set in cron which send data to cloudwatch after every few min.

#!/bin/bash

logger "Apache Status Started"

export AWS_CREDENTIAL_FILE=/opt/aws/credential-file-path.template
export AWS_CLOUDWATCH_HOME=/opt/aws/apitools/mon
export AWS_PATH=/opt/aws
export AWS_AUTO_SCALING_HOME=/opt/aws/apitools/as
export AWS_ELB_HOME=/opt/aws/apitools/elb
export AWS_RDS_HOME=/opt/aws/apitools/rds
export EC2_AMITOOL_HOME=/opt/aws/amitools/ec2
export EC2_HOME=/opt/aws/apitools/ec2
export JAVA_HOME=/usr/lib/jvm/jre
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin:/root/bin

SERVER=`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id`
#echo SERVER=$SERVER
BUSYWORKERS=`wget -q -O - http://localhost:800/server-status?auto | grep BusyWorkers | awk '{ print $2 }'`
#echo BUSYWORKERS=$BUSYWORKERS
IDLEWORKERS=`wget -q -O - http://localhost:800/server-status?auto | grep IdleWorkers | awk '{ print $2 }'`
#echo IDLEWORKERS=$IDLEWORKERS

/opt/aws/bin/mon-put-data --metric-name httpd-busyworkers --namespace "EC2: HTTPD" --dimensions "InstanceId=$SERVER" --unit Count --value $BUSYWORKERS

/opt/aws/bin/mon-put-data --metric-name httpd-idleworkers --namespace "EC2: HTTPD" --dimensions "InstanceId=$SERVER" --unit Count --value $IDLEWORKERS

logger "Apache Status Ended with $SERVER $BUSYWORKERS $IDLEWORKERS"


we can setup Alaram for scale server once Busyworks reach at MinSpareServers or above more than 5 min.  as well as scale down once Busyworks less down MinSpareServers more than 5 min.

Detail and brief information we can found on

http://blog.domenech.org/2012/11/aws-cloudwatch-custom-metric-for-apache.html
While try to convert  C4,M4,T2,R3 instance in C5 instance basically we get below error.

Error starting instances
Enhanced networking with the Elastic Network Adapter (ENA) is required for the 'c5.xlarge' instance type. Ensure that your instance 'i-0de56fe4bb5f3ba27' is enabled for ENA.

So we have to follow below steps.

modinfo ena   this will show ena support is on or not if not then do yum update and reboot instance

ethtool -i eth0        check ena module is loaded

configure aws cli on another instance from that instance your can query your instance status

aws ec2 describe-instances --instance-ids i-040b1236aXXXXX --query 'Reservations[].Instances[].EnaSupport'

configure aws cli on another instance from that instance your can query your AMI status 

aws ec2 describe-images --image-id ami-2XXXXX --query 'Images[].EnaSupport'

command to enable ena support

aws ec2 modify-instance-attribute --instance-id i-040bXXXX--ena-support

Backup your instance and create AMI for safer side.

First run yum update on your instance which help to install ena support driver then shutdown instance and query for ena support if value come null means need to modify instance and enable ena support.  if value come true means you can upgrade instance as C5.

For ena support AMI first create instance and make ena support and then take new AMI.
When we got /bin/bash^M: bad interpreter: error means script created on windows system via editor

(Windows made script run in linux /bin/bash^M: bad interpreter: No such file or directory [duplicate])

in that case we have to run below and replace

Run following command in terminal
sed -i -e 's/\r$//' scriptname.sh
Then try
./scriptname.sh
It should work.
Wednesday, September 27, 2017

Schedule Automated Amazon EBS Snapshots Using CloudWatch Events

https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/TakeScheduledSnapshot.html

Step 1: Create a Rule

Create a rule that takes snapshots on a schedule. You can use a rate expression or a cron expression to specify the schedule. For more information, see Schedule Expressions for Rules.
To create a rule
  1. Open the CloudWatch console at https://console.aws.amazon.com/cloudwatch/.
  2. In the navigation pane, choose Events, Create rule.
  3. For Event Source, do the following:
    1. Choose Schedule.
    2. Choose Fixed rate of and specify the schedule interval (for example, 5 minutes). Alternatively, choose Cron expression and specify a cron expression (for example, every 15 minutes Monday through Friday, starting at the current time).
  4. For Targets, choose Add target and then select EC2 Create Snapshot API call.
  5. For Volume ID, choose an EBS volume.
  6. Choose Configure details.
  7. For Rule definition, type a name and description for the rule.
  8. For AWS permissions, choose the option to create a new role. This opens the IAM console in a new tab. The new role grants the built-in target permissions to access resources on your behalf. Choose Allow. The tab with the IAM window closes.
  9. Choose Create rule.     
Friday, August 18, 2017

AWS S3 Bucket access policy

AWS ELB Access log S3 bucket policy

{
    "Version": "2012-10-17",
    "Id": "AWSConsole-AccessLogs-Policy-1503036723495",
    "Statement": [
        {
            "Sid": "AWSConsoleStmt-1503036723495",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::127311923021 (127 is AWS Loadbalancer Account ID):root"
            },
            "Action": "s3:PutObject",
         "Resource": ["arn:aws:s3:::S3 Bucket Name/foldername/AWSLogs/AWS Your Account ID/*",
                         "arn:aws:s3:::S3 Bucket Name/foldername/AWSLogs/AWS Your Account ID/*",
                         "arn:aws:s3:::S3 Bucket Name/foldername/AWSLogs/AWS Your Account ID/*",
                         "arn:aws:s3:::S3 Bucket Name/foldername/AWSLogs/AWS Your Account ID/*",
                         "arn:aws:s3:::S3 Bucket Name/foldername/AWSLogs/AWS Your Account ID/*",
                         "arn:aws:s3:::S3 Bucket Name/foldername/AWSLogs/AWS Your Account ID/*",
                         "arn:aws:s3:::S3 Bucket Name/foldername/AWSLogs/AWS Your Account ID/*",
                         "arn:aws:s3:::S3 Bucket Name/foldername/AWSLogs/AWS Your Account ID/*",
                         "arn:aws:s3:::S3 Bucket Name/foldername/AWSLogs/AWS Your Account ID/*",
                         "arn:aws:s3:::S3 Bucket Name/foldername/AWSLogs/AWS Your Account ID/*"
          ]       
        }
    ]
}

http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-access-logs.html





AWS S3 bucket Public readonly access policy

{
    "Version": "2008-10-17",
    "Id": "Policy1380877762691",
    "Statement": [
        {
            "Sid": "Stmt1380877761162",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::Bucketname/*"
        }
    ]
}


S3 Bucket copy from one account to another policy

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "AWS": [
                    "arn:aws:iam::remote aws account number:root",
                    "arn:aws:iam::working aws account number :user/aws user"
                ]
            },
            "Action": "s3:*",
            "Resource": [
                "arn:aws:s3:::Bucketname",
                "arn:aws:s3:::Bucketname/*"
            ]
        }
    ]
}
Open your VPC dashboard ----  go to “Network ACLs” view  -------- choose ACL Rules

         1.    Select the subnet to of your EC2 instances
         2.    Click “Inbound Rules”
         3.    Click “Edit”
         4.    Add a rule to block the traffic

   While setup rules need to understand below which guide how it work

         1.    Rule: Use any number less than 100, 100 is the number of the default accept-all rule. This is important because rules are evaluated in order, and your rule needs to come before the default.
         2.    Type: Select “All traffic”
         3.    Protocol: Locked to “ALL”
         4.    Source: The CIDR you want to block. To match a single IP address, enter it here and append /32. For example, I blocked 49.212.52.94/32
         5.    Select “DENY”

    Now click Save and you should see the updated rules.
    
While searching for a way to block traffic, through AWS web portal you  found lots of articles saying that it wasn’t possible because the security group rules in AWS only support white listing. So this level of control may be a relatively to AWS.
At the bucket level, click on Properties, Expand Permissions, then Select Add bucket policy. Paste the above generated code into the editor and hit save.


{
    "Version": "2008-10-17",
    "Id": "Policy1380877762691",
    "Statement": [
        {
            "Sid": "AllowPublicRead",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            },
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::Bucketname/*"
        }
    ]
}
Thursday, July 20, 2017

How to upgrade Nagios 4.2.2 to Nagios 4.3.2 step by step

Backup current nagios directory

cd /usr/local
tar -zcvf nagios-backup.ar.gz nagios

cd /tmp
wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.2.tar.gz .
tar -zxvf  nagios-4.3.2.tar.gz
cd nagios-4.3.2

./configure --with-command-group=nagcmd
make all
make install

Once the above process is completed run the verification check on the upgrade to make sure there are no errors reported.

# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

 It will give below warning then resolve by executing below command

WARNING: The normal_check_interval attribute is deprecated and will be removed in future versions. Please use check_interval instead.

for resolve excute cd /usr/local/nagios/etc/
sed -i -e 's/normal_check_interval/check_interval/g' *.cfg

WARNING: The normal_retry_interval attribute is deprecated and will be removed in future versions. Please use retry_interval instead.

for resolve excute cd /usr/local/nagios/etc/
sed -i -e 's/retry_check_interval/retry_interval/g' *.cfg

Verify once again vai /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Restart nagios it will show updated version

If face any issue just remove /usr/local/nagios directory and restore tar file backup and restart nagios

In this scenario you have upgraded the plugin on the Nagios server but the client has not been upgraded (hostname in this example).

You execute this command on the nagios server:
/usr/local/nagios/libexec/check_nrpe -H hostname

This is the result from running the command:
NRPE v2.15

On the NRPE v2 Client you will see the following logged per connection attempt:
Jul  5 08:16:22 hostname nrpe[11030]: Error: Request packet type/version was invalid!
Jul  5 08:16:22 hostname nrpe[11030]: Client request was invalid, bailing out...
Jul  5 08:17:21 hostname nrpe[11613]: Error: Request packet type/version was invalid!
Jul  5 08:17:21 hostname nrpe[11613]: Client request was invalid, bailing out...
Jul  5 08:17:44 hostname nrpe[11808]: Error: Request packet type/version was invalid!
Jul  5 08:17:44 hostname nrpe[11808]: Client request was invalid, bailing out...


On the Nagios server with the Plugin v3 will see the following logged per connection attempt:
Jun 24 16:42:04 fbsd01 check_nrpe: Remote 10.25.13.30 does not support Version 3 Packets
Jun 24 16:42:06 fbsd01 check_nrpe: Remote 10.25.13.30 accepted a Version 2 Packet

When the NRPE v3 client first establishes a connection, it tries with the v3 packet. This results in the older client rejecting the request. Upon receiving the rejected request the plugin will then attempt to connect with the v2 packet. This request will succeed however errors are produced in the log on the client and the Nagios server.
The options you have to stop the errors are:
    Upgrade the client to v3
        This will stop the errors
    Force the plugin to send v2 packets
        Using the -2 argument will force the plugin to connect with v2 packets
        /usr/local/nagios/libexec/check_nrpe -2 -H hostname

You will need to update your Nagios command and service definitions to include -2 to allow the plugin and client to communicate on nagios server

/usr/local/nagios/etc/checkcommands.cfg all check_nrpe updated as check_nrpe -2
Thursday, May 25, 2017

How to revert yum update

How to revert yum update if face any issue

yum history  it will show when last yum update done and id date & time & Action it will show E,erase I, install U update

for undo changes

yum history undo id number