Thursday, December 15, 2016

How to check Word Wide Node (WWN) for Fiber Channel HBA card?

To find the Fibre Channel addresses of the HBAs on the machine, run the following:

# systool -c fc_host -v
    (output trimmed for clarity)
      Class Device path = "/sys/class/fc_host/host8"  (kernel assigned host name/number)
        node_name           = "0x20000024ff2254bf"    (hba wwnn       )
        port_name           = "0x21000024ff2254bf"    (hba wwpn       )
        port_id             = "0x030b00"              (fabric port id assigned by the san to this HBA)

      Class Device path = "/sys/class/fc_host/host9"
        node_name           = "0x20000024ff2254be"
        port_name           = "0x21000024ff2254be"
        port_id             = "0x010c00"

or alternatively

# ls -1c /sys/class/fc_host/host*/*_name 2> /dev/null | xargs -I {} grep -H -v "ZzZz" {} | sort
    /sys/class/fc_host/host8/symbolic_name:QLE2562 FW:v5.06.02 DVR:v8.
    /sys/class/fc_host/host9/symbolic_name:QLE2562 FW:v5.06.02 DVR:v8.

    # ls -1c /sys/class/fc_host/host*/port_id 2> /dev/null | xargs -I {} grep -H -v "ZzZz" {} | sort

Force a process to coredump

Ensure “gdb” is installed.

Example to force running "crond" process to coredump.

[root@centos ~]# gcore $(pidof crond)
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/".
0x00007f8c0f444ee0 in __nanosleep_nocancel () from /lib64/
warning: target file /proc/7011/cmdline contained unexpected null characters
Saved corefile core.7011
[root@centos ~]# ls
[root@centos ~]# file core.7011 
core.7011: ELF 64-bit LSB core file x86-64, version 1 (SYSV), SVR4-style, from '/usr/sbin/crond'

Wednesday, November 9, 2016

installing salt-stack: salt-master and salt-minion


salt master

$ curl -L -o
$ sudo sh -P -M

Salt master can manage itself, so a Salt minion is installed along with the Salt master.
If you do not want to install the minion, also pass the -N option.
$ sudo sh -P -M -N

salt minion

-       Default minions will use "salt" as the salt master hostname. you can edit this in the minion's /etc/salt/minions "master: x.x.x.x"
-       when minion first startup, it will look for "salt" and try to put its key to master
$ curl -L -o
$ sudo sh -P

accepting keys

You may manually accept the minion key from salt master or you may preseed minion with a key generated from salt master
The key name should always match the minion ID which later on you can find from the minion's /etc/salt/minion_id

From salt master:
$ salt-key --gen-keys=minion1

2 files will be generated:
copy and rename the .pub file into /etc/salt/pki/minions/ folder with the minion ID
$ cp /etc/salt/pki/minions/minion1

copy these 2 files to minion before starting the salt-minion service
$ scp minion1.pem root@minion1:/etc/salt/pki/minion/

Start | Stop

$ systemctl start salt-minion
$ systemctl start salt-master

There was an error in this gadget