How to check I/O throughput and latency in Linux servers

How to check I/O throughput and latency in Linux servers

Hello,

Recently our servers started behaving really strange. Suddenly they became very slow. Even I try with small commands such as ls,top I have got the output after a while but not with regular response.

After analyzing running process and CPU utilization I went looking for I/O speed and that is where we found the issue.

So checking I/O both troughput and latency is one of the important item while evaluating a Linux Server performance and you can use below commands to find.

Throughput (I/O Streaming speed)

dd if=/dev/zero of=/root/testfile bs=1G count=1 oflag=direct

Latency

dd if=/dev/zero of=/root/testfile bs=512 count=1000 oflag=direct

Hope it will help you.

Thank you.

How to check telnet for multiple IP at a time using Bash

How to check telnet for multiple IP at a time using Bash

Hello,

If you have multiple number of server and you would like check whether a particlur port open or not, generally you use telnet as below

[root@localhost ~]# telnet 192.168.56.102 22
Trying 192.168.56.102...
Connected to 192.168.56.102.
Escape character is '^]'.
SSH-2.0-OpenSSH_7.5
^]

telnet> q
Connection closed.
[root@localhost ~]#

Once connectivity got established, you have to give CTRL+] and q to exit from telnet session.

For single IP this is fine but if you have multiple IPs then doing this for each IP is very annoying. But we can execute a perl command with inside a bash for loop with multiple IPs and after the threshold at alarm passed, it will exit automatically.

for ip in "192.168.56.102" "localhost"
do
perl -e "alarm 10; exec @ARGV" "telnet "${ip}" 22"
done

Here we dont have to pass any parameter to exit from telnet client and it will exit automatically after 10 sec.

[root@localhost ~]# for ip in "192.168.56.102" "localhost"; do perl -e "alarm 10; exec @ARGV" "telnet "${ip}" 22"; done
Trying 192.168.56.102...
Connected to 192.168.56.102.
Escape character is '^]'.
SSH-2.0-OpenSSH_7.5
Alarm clock
Trying ::1...
Connected to localhost.
Escape character is '^]'.
SSH-2.0-OpenSSH_7.5
Alarm clock
[root@localhost ~]#

Hope it will help you.

How to check what SSL Ciphers are supported by your JVM

How to check what SSL Ciphers are supported by your JVM

Hello Team,

If you ever wondered what are the SSL Ciphers supported by your appliaction which running on particular JVM, then you can find it with below program.

Note: Make sure you are switched into user who is allowed to start your application.

Go to /tmp directory and createa file named as Ciphers.java

import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import javax.net.ssl.SSLServerSocketFactory;

public class Ciphers
{
    public static void main(String[] args)
        throws Exception
    {
        SSLServerSocketFactory ssf = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();

        String[] defaultCiphers = ssf.getDefaultCipherSuites();
        String[] availableCiphers = ssf.getSupportedCipherSuites();

        TreeMap ciphers = new TreeMap();

        for(int i=0; i<availableCiphers.length; ++i )
            ciphers.put(availableCiphers[i], Boolean.FALSE);

        for(int i=0; i<defaultCiphers.length; ++i )
            ciphers.put(defaultCiphers[i], Boolean.TRUE);

        System.out.println("Default\tCipher");
        for(Iterator i = ciphers.entrySet().iterator(); i.hasNext(); ) {
            Map.Entry cipher=(Map.Entry)i.next();

            if(Boolean.TRUE.equals(cipher.getValue()))
                System.out.print('*');
            else
                System.out.print(' ');

            System.out.print('\t');
            System.out.println(cipher.getKey());
        }
    }
}

save the file and execute it with below commands

javac -Xlint:deprecation Ciphers.java
java Ciphers

And you will see all Ciphers supported by your JVM.

Thank you.

Reference: https://confluence.atlassian.com/stashkb/list-ciphers-used-by-jvm-679609085.html

How to: Oracle Sqlplus important flags for spool a table into CSV

How to: Oracle Sqlplus important flags for spool a table into CSV

Hello,

If you are trying to export a large table from a database via SQL Developer, it will take a lot of time. So to reduce the time and effort and you can log into or connect to remote Oracle DB via SQLPlus.

And while importing the data, to get proper structuring to your data below flags will help you.

set colsep ,
set headsep off
set pagesize 0
set trimout on
set feedback off
set trimspool on
set linesize 32767
set echo off
SET TERMOUT

For explanation of those flags, please read : https://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12040.htm

So if you are planning to export a table then whole .sql file should look like below

set colsep ,
set headsep off
set pagesize 0
set trimout on
set feedback off
set trimspool on
set linesize 32767
set echo off
spool 4802.csv
SELECT player||','||name||','||value FROM player WHERE value IN ('Industry', 'Title');
spool off

Hope it will help you.

How to check TLS version support for a remote SSL URL by using openssl ?

How to check TLS version support for a remote SSL URL by using openssl ?

As recently many service providers are disabling the weak ciphers, TLSv1.2 becoming most trusted cipher at this moment compaing with TLSv1, TLSv1.1.

If you want to know more about these protocols, please refer
https://www.wolfssl.com/differences-between-ssl-and-tls-protocol-versions/

So if you are using services from any 3rd party/external service provider, then you want to verify the version of SSL protocol being used, then you can verify it with " openssl "

# openssl s_client -connect URL:PORT -tls1_2

URL: Is the URL for which you want to check SSL supported protocol.
Port: SSL port being used for that service.

If your service providing supporting that protocol then you will get certificate chain in the output else you will get handshake errors in the output.

Similarly you can verify support for other TLS protocols as well.

TLSv1

# openssl s_client -connect URL:PORT -tls1

TLSv1.1

# openssl s_client -connect URL:PORT -tls1_1

Hope this will help you.

Thanks
Raja

How to get agent or nodes list from Puppet master

If you are trying to list all the nodes connected to your puppet server, then you can use below command.

# puppet cert list --all

For example,

[root@puppetserver production]# puppet cert list --all
+ "debian.mylabserver.com"       (SHA256) 63:17:8A:7D:E1:94:D4:BA:F8:7E:E5:09:4A:D4:A4:67:0A:62:8C:EF:AE:F3:4B:35:33:48:8C:46:55:90:0C:F6
+ "puppetserver.mylabserver.com" (SHA256) D5:9F:9C:10:22:92:53:7C:29:F4:A6:E6:84:A2:53:FE:74:B6:9F:87:B0:55:65:A4:D4:5F:B9:CD:09:71:0E:FA (alt names: "DNS:puppet", "DNS:puppetserver.mylabserver.com")

Hope it helps.

Thank you.