nagios https proxy monitoring plugin or Bash website monitoring script

#!/bin/bash

if [ $# -eq 0 ]
  then
    echo "No arguments supplied"
fi

if [ $# -eq 1  ]
then

output=`curl  -x 10.11.10.10:3128 -L $1 -m 10 -o /dev/null || echo "Website_down"`

if [ "$output" == "Website_down" ] ; then

echo "Website is down CRITICAL  "
exit 2

else

echo "Website_up $1  OK"
exit 0
fi

fi

Adding client certificate file using chef data bags

Below is just an example 

logstash_cert_secret = Chef::EncryptedDataBagItem.load_secret("/etc/chef/secrets/logstash_client_key")
logstash_certs = Chef::EncryptedDataBagItem.load("certs", "logstash_client", logstash_cert_secret)


directory "/etc/pki/tls/certs/" do
  action :create
  mode "0755"
  owner "root"
  group "root"
end

file "/etc/pki/tls/certs/logstash_client.crt" do
  action :create
  mode "0644"
  owner "root"
  group "root"
  content logstash_certs["crt"].join("")

  end

Search and replace in all files in a current directory

grep -rl 'pc961' ./|xargs sed -i 's/pc961/pc/g'

Ansible define a basic windows hosts



[windows]
10.10.10.120

[windows:vars]
ansible_connection=winrm
ansible_ssh_user=Administrator

ansible_ssh_pass=AdminPa$$

Three basic Git commands




1) git add -A

git add -A is equivalent to  git add .; git add -u.

git add .  ( This will add all files but does not remove files )
git add -u ( This will add only changes but will not add any new files created )

So we use

git add -A ( this will take care of both the commands )

2) git commit -m “Commit changes text ex: I have added new function xyz to the file

3) git push origin  


example of branch name : develop


Another 3 frequently used commands include :

git pull
git status 
git merge origin/Branchname