Get detailed debugging info Elasticsearch node

curl -o – “http://localhost:9200/_nodes/process?pretty”

 

{
“cluster_name” : “prod-escluster”,
“nodes” : {
“NUyPv6zIQDS3wo_u_8FUaw” : {
“name” : “es01”,
“transport_address” : “inet[/192.168.1.147:9300]”,
“host” : “es-01.streamuk.com”,
“ip” : “127.0.0.1”,
“version” : “1.4.2”,
“build” : “927caff”,
“http_address” : “inet[/192.168.1.147:9200]”,
“attributes” : {
“master” : “true”
},
“process” : {
“refresh_interval_in_millis” : 1000,
“id” : 2185,
“max_file_descriptors” : 500000,
“mlockall” : false
}
}
}
}

Using document here in Bash script for sending a message to all who is loaded.

 
#!/bin/bash

wall <<zzz23EndOfMessagezzz23
E-mail your noontime orders for pizza to the system administrator.
    (Add an extra dollar for anchovy or mushroom topping.)
# Additional message text goes here.
# Note: 'wall' prints comment lines.
zzz23EndOfMessagezzz23

# Could have been done more efficiently by
#         wall <message-file
#  However, embedding the message template in a script
#+ is a quick-and-dirty one-off solution.

exit

 

nJoy 😉

Sample parameter validation script.sh

#!/bin/bash


echo "`basename $0` Tool"


[[ $# != 3 ]] && echo "Invalid number of arguments" && echo "Sample Call : create_ftp.sh <numeric_partner_id> <username_alphanum> <password_alphanum>" && exit 128

#number re
re='^[0-9]+$'

if [[ $1 =~ $re ]] ; then
		PARTNERID=$1
                echo "Partner id set to $1"
        else
        	echo "Invalid param #1 should be numeric" 
        	echo "Sample Call : create_ftp.sh <numeric_partner_id> <username_alphanum> <password_alphanum>" 
         	exit 128
         	
fi

re='^[a-zA-Z0-9][-a-zA-Z0-9]{0,61}[a-zA-Z0-9]$'
if [[ $2 =~ $re ]] ; then
		USERNAME=$2
                echo "Username set to $2"
        else
        	echo "Invalid param #2 should be alphanumeric" 
        	echo "Sample Call : create_ftp.sh <numeric_partner_id> <username_alphanum> <password_alphanum>" 
         	exit 128
         	
fi

if [[ $3 =~ $re ]] ; then
		PASSWORD=$3
                echo "Password set to $3"
        else
        	echo "Invalid param #3 should be alphanumeric" 
        	echo "Sample Call : create_ftp.sh <numeric_partner_id> <username_alphanum> <password_alphanum>" 
         	exit 128
         	
fi


 

njoy 😉

Set timezone Centos

vim /etc/sysconfig/clock

ZONE=”Europe/London”

 

ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime

done..

nJoy 😉

 

Bash Datestamps

        Format/result         |       Command              |          Output
------------------------------+----------------------------+------------------------------
YY-MM-DD_hh:mm:ss             | date +%F_%T                | $(date +%F_%T)
YYMMDD_hhmmss                 | date +%Y%m%d_%H%M%S        | $(date +%Y%m%d_%H%M%S)
YYMMDD_hhmmss (UTC version)   | date --utc +%Y%m%d_%H%M%SZ | $(date --utc +%Y%m%d_%H%M%SZ)
YYMMDD_hhmmss (with local TZ) | date +%Y%m%d_%H%M%S%Z      | $(date +%Y%m%d_%H%M%S%Z)
YYMMDDhhmmss                  | date +%Y%m%d%H%M%S         | $(date +%Y%m%d%H%M%S)
YYMMDDhhmmssnnnnnnnnn         | date +%Y%m%d%H%M%S%N       | $(date +%Y%m%d%H%M%S%N)
Seconds since UNIX epoch:     | date +%s                   | $(date +%s)
Nanoseconds only:             | date +%N                   | $(date +%N)
Nanoseconds since UNIX epoch: | date +%s%N                 | $(date +%s%N)
ISO8601 UTC timestamp         | date --utc +%FT%TZ         | $(date --utc +%FT%TZ)
ISO8601 Local TZ timestamp    | date +%FT%T%Z              | $(date +%FT%T%Z)


njoy ;-)

Mounting an LVM file system

So after recovering a box which had a controller failure we needed to mount the old fs to recover some stuff.

when trying to mount /dev/sdc2 we got:

mount: unknown filesystem type ‘LVM2_member’

fix is easy :

modprobe dm-mod

vgchange -ay

lvscan now yields:

ACTIVE '/dev/VolGroup/lv_root' [50.00 GiB] inherit
ACTIVE '/dev/VolGroup/lv_home' [178.46 GiB] inherit
ACTIVE '/dev/VolGroup/lv_swap' [3.94 GiB] inherit

mount /dev/VolGroup/lv_root /mnt/tempdisk/

et viola` !!

nJoy 😉