SSH Keys – Password less authentication

I was trying to setup SSH Keys between two different flavors of Linux Host by following this Howto

I did run commands exactly as per mentioned in the how to; but it didn’t work. Error message as under

vin@CLIENT:~$ ssh vsa@192.0.0.10
vin@192.0.0.10’s password:
Last login: Mon May 22 10:45:03 2017 from 192.0.0.10
-bash: id: command not found
-bash: id: command not found
-bash: id: command not found
-bash: tty: command not found
-bash: uname: command not found

After googling and trail and error method finally found a fix.

Instead of Step 3 as per the above How to, use the below commands.

  1. Ensure on the server proper permissions set on the .ssh folder if not set permissions as

$chmod -R 775 .ssh (.ssh is located in user home directory e.g: /home/vin)

  1. Run this command to copy the Key file from client to server

$cat ~/.ssh/id_rsa.pub | ssh vin@192.0.0.10 ‘umask 0077; /bin/mkdir -p .ssh; /bin/cat >> .ssh/authorized_keys && echo “Done!”‘

After running above command, server 192.0.0.10 do not ask for password when user vin try to login.

vin@CLIENT:~$ ssh vin@192.0.0.10
Last login: Mon May 22 11:54:29 2017 from 192.0.0.10
[vin@SERVER ~]$

Advertisements

Multi Apps installer for Windows

I joined the company Virtustream yesterday and got a brand new Dell Latitude E5470 laptop. It has all basic software’s preinstalled through image but still missing many tools which I use in my day to day work.

A simple way to install most of the productive tools at one go is ninite.com. Just select what you want to install from the list of software’s and download a small file and execute it. That’s it! all your software’s will be installed automatically and ready to use. There wont be any pop-ups or prompts asking for confirmation etc…

ninite

Happy New Year 2017!

Brocade SAN switch automated troubleshooting script

What does this Brocade SAN switch automated troubleshooting script do?

  1. Ping the SAN switch IPs and check the connectivity
  2. Perform basic health check by running switchstatusshow command
  3. Check for CRC and EncOut errors by running porterrshow command
  4. If there are CRC and EncOut errors it clears the port statistics and wait for 20 minutes to monitor the incremental errors on the switch ports using portstatsclear and portshow commands
  5. Check and compare Lr_in & Ols_Out and Lr_out and Ols_in values to detect faulty cable and SFP issue
  6. Generate supportsave files which is required to do further analysis or troubleshooting by switch vendor and FTP the files
  7. Capture all the above output to file and generate email alert to further engage an engineer to continue troubleshooting or log a case with switch vendor

I hope this would help us in proactively monitoring SAN switches and iron out false positives without human intervention.

To download the script please click here and select ‘Brocade Troubleshooting’ from the right pane under Topics.

***********************************************************************

I believe this could be last blog post of the year 2016…

Belated Merry Christmas and Wish you Happy and Prosperous New Year 2017 in advance to all my followers, readers and visitors!!

***********************************************************************

How to hide your important files from people without making Hidden folders
1. Go to Desktop and create a new folder
2. Name the folder Internet Explorer
3. Change the folder icon to Internet Explorer
4. Keep it in a corner of the desktop

Now, no one will open internet explorer 😀

Source: http://www.coolcoder.in/2014/02/10-awesome-programming-jokes-of-all-time.html

 

MySQL PHP Generating reports in PDF format

In continuation to my previous blog on charting epoch time series MySQL data using PHP. I started exploring generating better reports from the DB.

Inspired by the EMC SRM (M&R)  storage capacity reports in PDF format, I thought of doing similar kind of reports “in-house” which should be simple yet standard to be shared with customers. I would like to thank Sapan Kumar from EMC who thought me so many things about EMC’s SRM (M&R) custom reporting features.

We have the data in  MySQL DB and wanted to use the PDF module in PHP to generate reports. But which module is suitable and easy to use?

After rigorous testing with FPDF and DOMPDF, I decided to use FPDF (not sure why :p) and it produced nice reports indeed!

Please find sample reports screenshot produced below for reference. You could see the capacity reports of VNX and VMAX storage arrays.

2016-11-30-11_07_12-mremoteng-confcons-xml2016-11-30-11_03_57-mremoteng-confcons-xml

If interested, please reach out to me to get the PHP code. Thanks for stopping by… Please leave your comments / suggestions.

Manage services from CLI on Linux

In Window$ OS, we can check running services and its status by going to Services console. (Start > Run > services.exe)

Similarly, to access running services info and status under Linux via BASH / Shell, we need to install ‘sysv-rc-conf’

aptitude install sysv-rc-conf

Below screenshot show the output of sysv-rc-conf command displaying status of service for all running levels (1-6) and startup (S)

2016-11-21 11_06_38-Debian1 [Running] - Oracle VM VirtualBox.png

As you can see in the screenshot to start a service use ‘+’ and to stop a service use ‘-‘. To enable or disable service to run at startup goto the respective service’s ‘S’ column and then use ‘Space Bar’.

MYSQL PHP Charting epoch Time series data

I was writing PHP code to generate EMC VMAX performance reports / charts stored in MySQL DB. As we know that Unisphere REST API output performance metrics in epoch (13 digits) format (milliseconds). As an example, to draw a line chart for Frontend Director’s Read Response Time with X axis / Abscissa as epoch time. I’ve used below query to generate the datapoints to draw the chart using pChart

SELECT TIME(FROM_UNIXTIME(timstamp/1000)) as TIME, ROUND(AVG(perfval),2) as wrt FROM vmax_perf

where DAYOFMONTH(FROM_UNIXTIME(timstamp/1000)) = DAYOFMONTH(DATE_SUB(curdate(), INTERVAL 1 DAY))

and objname =’fe’ and perfparam =’ReadResponseTime’

group by HOUR(FROM_UNIXTIME(timstamp/1000))

Let me explain the above statement

TIME(FROM_UNIXTIME(timstamp/1000)) :: Extract Time from the epoch (13 digit) format in millisecond

ROUND(AVG(perfval),2) :: Average of Read Response Time per Hour rounded output to 2 digits after decimal point

DAYOFMONTH(FROM_UNIXTIME(timstamp/1000)) = DAYOFMONTH(DATE_SUB(curdate(), INTERVAL 1 DAY)) :: Extract day (ex. ’12’ from 12th Nov 2016 where current date is 13th Nov 2016) and display the data points

group by HOUR(FROM_UNIXTIME(timstamp/1000)) :: Print the datapoints for every hour

2016-11-13-14_27_22-10-76-6-62-remote-desktop-connection

If interested, please reach out to me to get the PHP code.

Stay Tuned for more updates on MySQL queries to generate charts for Daily, Weekly, Monthly and Quarterly performance reports / charts. Thanks for stopping by… Please leave your comments / suggestions.

Thanks for stopping by… Please leave your comments / suggestions.

GNU/Parallel – Run multiple commands simultaneously

GNU/Parallel is an open source tiny executable yet so powerful to run / start multiple commands at the same time. This is a handy tool when we are trying to run multiple scripts to maintain consistency of timestamp across the board.

gnu-parallel

Below is a simple file named as REST to execute Python RESTAPI scripts simultaneously

date > start.$today.array;python sym_perf_stats_v4.py &>> /vin/array.$today.log; date > end.$today.array
date > start.$today.fe;python fe_perf_stats_v3.py &>> /vin/fe.$today.log; date > end.$today.fe
date > start.$today.be; python be_perf_stats_v3.py &>> /vin/be.$today.log; date > end.$today.be
date > start.$today.diskgrp ; python dg_perf_stats_v3.py &>> /vin/diskgrp.$today.log; date > end.$today.diskgrp
date > start.$today.tp ; python tp_perf_stats_v3.py &>> /vin/tp.$today.log; date > end.$today.tp

to run the above scripts in parallel we need to execute the below command

#parallel -j 5 <REST

-j switch used to run ‘n’ number of commands in parallel from the same console

***UPDATE *** As per suggestion from oletange. Above file ‘REST’ can be better written as below

parallel ‘date > start.$today.{};python {}_perf_stats_v3.py &>> /vin/{}.$today.log; date > end.$today.{}’ ::: sym fe be dg tp

To install GNU/Parallel on Debian / Debian based OS

#apt-get install parallel