How to Check Top Running Processes by Highest Memory and CPU Usage in Linux

Assalamualiakum..

The following command will show the list of top processes ordered by RAM and CPU use in descendant form (remove the pipeline and head if you want to see the full list):

ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head

Brief explanation of above options used in above command.

The -o (or –format) option of ps allows you to specify the output format. A favourite of mine is to show the processes’ PIDs (pid), PPIDs (pid), the name of the executable file associated with the process (cmd), and the RAM and CPU utilization (%mem and %cpu, respectively).

Additionally, I use --sort to sort by either %mem or %cpu. By default, the output will be sorted in ascendant form, but personally I prefer to reverse that order by adding a minus sign in front of the sort criteria.

To add other fields to the output, or change the sort criteria, refer to the OUTPUT FORMAT CONTROL section in the man page of ps command.

wassalam.

Advertisements
Posted in Linux, UNIX | Tagged , , , ,

How to Backup oVirt Engine

Assalamualaikum..

Backup is straightforward. See --help for details.

Below is the steps on how to backup ovirt engine.

Example:
engine-backup --mode=backup --file=backup1 --log=backup1.log

Full backup
engine-backup --mode=backup --scope=all --file="/var/lib/ovirt-engine/backups/fullbackup-$(date +%Y%m%d%H%M%S).tar.bz2" --log=/var/log/ovirt-engine/fullbackup-$(date +%Y%m%d%H%M%S).log

DB backup
engine-backup --mode=backup --scope=files --scope=db --file="/var/lib/ovirt-engine/backups/DBbackup-$(date +%Y%m%d%H%M%S).tar.bz2" --log=/var/log/ovirt-engine/DBbackup-$(date +%Y%m%d%H%M%S).log

thanks

Wassalam..

Posted in Linux, oVirt, RedHat, RHEV, RHV | Tagged , ,

Iperf3: How to Specify the Amount of Data to be Transmitted

Assalamulaikum.
I need to test my server to server connection with 1gb data transfer. Below is the command

Server IP: 10.200.200.5
Client IP: 10.200.200.4

On Server, run
iperf -s

On client, run
iperf3 -c 10.200.200.5 -n 1G
or
iperf3 -c 10.200.200.5 -n 1024M

Example on client:

With the default buffer size of 8KB:

iperf3 -c 10.200.200.5 -n 1024M
------------------------------------------------------------
Client connecting to 10.200.200.5, TCP port 5201
TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[  3] local 10.200.200.4 port 56565 connected with 10.200.200.5 port 5201
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.5 sec  1.00 GBytes  8.20 Gbits/sec 

Wit the the same value for the -n option but with -l 32K

iperf3 -c 10.200.200.5 -n 1024M -l 32K
------------------------------------------------------------
Client connecting to 10.200.200.5, TCP port 5201
TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[  3] local 10.200.200.4 port 56568 connected with 10.200.200.5 port 5201
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.5 sec  1.00 GBytes  8.17 Gbits/sec

wassalam..

Posted in Linux | Tagged ,

Configure Multipathing in Linux (RHEL7/CentOS7

Assalamualaikum,

After you have assigned LUN (usually configured in storage) to the specific client, below is the steps on how to configure mutltipath on client machine (RHEL7/CentOS7.

Install device-mapper-multipath

root@www ~]# yum -y install device-mapper-multipath

Install iSCSI Initiator.

[root@www ~]# yum -y install iscsi-initiator-utils

Configure multipath.conf. comment line “find_multipaths yes”

[root@www ~]# vim /etc/multipath.conf
# find_multipaths yes

Configure iSCSI Initiator

[root@www ~]# vi /etc/iscsi/initiatorname.iscsi
# change to the same IQN you set on the iSCSI target server
# InitiatorName=iqn.2005-10.org.freenas.ctl:
InitiatorName=iqn.1994-05.com.redhat:freenas-iskazi

Discover target (server is 192.168.0.121)

[root@www ~]#iscsiadm -m discovery -t st -p 192.168.0.121
192.168.0.121:3260,-1 iqn.2005-10.org.freenas.ctl:freenas-iskazi

Confirm status after discovery

[root@www ~]# iscsiadm -m node -o show

Login to the target

root@www ~]# iscsiadm -m node --login
# BEGIN RECORD 6.2.0.874-7
node.name = iqn.2005-10.org.freenas.ctl:freenas-iskazi
node.tpgt = -1
node.startup = automatic
node.leading_login = No
...
...
...
node.conn[0].iscsi.HeaderDigest = None
node.conn[0].iscsi.IFMarker = No
node.conn[0].iscsi.OFMarker = No
# END RECORD

Confirm the established session

root@www ~]# iscsiadm -m session -o show
tcp: [1] 192.168.0.121:3260,1 iqn.2005-10.org.freenas.ctl:freenas-iskazi (non-flash)
tcp: [2] 192.168.0.121:3260,1 iqn.2005-10.org.freenas.ctl:freenas-iskazi0 (non-flash)

Restart iscsid and mulptipathd

[root@www ~]# systemctl restart multipathd
[root@www ~]# systemctl status iscsid

Check attached disk

[root@www ~]# multipath -ll
mpathb (36589cfc0000007b06bdc809ab3ad6dc2) dm-2 FreeNAS ,iSCSI Disk      
size=5.0G features='0' hwhandler='0' wp=rw
`-+- policy='service-time 0' prio=1 status=active
  `- 3:0:0:0 sdb 8:16 active ready running

Edit /etc/multipathd.conf. Add below line at the bottom

multipaths {
        multipath {
                wwid    36589cfc0000007b06bdc809ab3ad6dc2
                alias   DATA01
        }


Restart iscsid and mulptipathd

[root@www ~]# systemctl restart multipathd

Create new path

[root@www ~]# mkdir -p /data01

Print disk format disk

[root@www ~]# parted /dev/mapper/DATA01 print
Error: /dev/mapper/DATA01: unrecognised disk label
Model: Linux device-mapper (multipath) (dm)                               
Disk /dev/mapper/DATA01: 5369MB
Sector size (logical/physical): 512B/16384B
Partition Table: unknown
Disk Flags: 

Label disk

[root@www ~]# parted /dev/mapper/DATA01 mklabel gpt

Print again to check label

root@www ~]# parted /dev/mapper/DATA01 print
Model: Linux device-mapper (multipath) (dm)
Disk /dev/mapper/DATA01: 5369MB
Sector size (logical/physical): 512B/16384B
Partition Table: gpt
Disk Flags: 

Number  Start  End  Size  File system  Name  Flags

Configure disk to use all space

[root@www ~]# parted /dev/mapper/DATA01 mkpart DATA01 xfs 1 5369MB

Format disk (I’m using xfs as my file system)

[root@www ~]# mkfs.xfs -f /dev/mapper/DATA01p1

Check the block id (and copy the UUID as we will use it in the further step)

[root@www ~]# blkid /dev/mapper/DATA01 
/dev/mapper/DATA01: UUID="909a097e-6e01-490a-9d50-f4727c3efc04" TYPE="xfs"  

Mount disk at boot using fstab (note: use _netdev)

[root@www ~]# vim /etc/fstab
UUID=909a097e-6e01-490a-9d50-f4727c3efc04       /data01	xfs	_netdev	0 0

Mount new disk

[root@www ~]# mount -a

To test your newly mounted disk, try to create any file (using touch or vi) in /data01 partition. If success then your disk is ready to work.

Now time to reboot your server and check either your /data01 is automatically mounted or not. If everything is fine, then your are golden.

wassalam..

Posted in Linux | Tagged , , , , , ,

Engine-setup hangs on “Creating CA” During Installation

Assalamualaikum,

Issue: ovirt-engine hang during installation. Stuck at Creating CA.

Please confirm installation settings (OK, Cancel) [OK]: 
[ INFO  ] Stage: Transaction setup
[ INFO  ] Stopping engine service
[ INFO  ] Stopping ovirt-fence-kdump-listener service
[ INFO  ] Stopping dwh service
[ INFO  ] Stopping Image I/O Proxy service
[ INFO  ] Stopping vmconsole-proxy service
[ INFO  ] Stopping websocket-proxy service
[ INFO  ] Stage: Misc configuration
[ INFO  ] Stage: Package installation
[ INFO  ] Stage: Misc configuration
[ INFO  ] Upgrading CA
[ INFO  ] Creating PostgreSQL 'engine' database
[ INFO  ] Configuring PostgreSQL
[ INFO  ] Creating PostgreSQL 'ovirt_engine_history' database
[ INFO  ] Configuring PostgreSQL
[ INFO  ] Creating CA

Solution:
As a workaround, you can issue the following commands before running engine-setup:

# ovn-nbctl del-ssl
# ovn-sbctl del-ssl

this will remove ssl configuration and will allow you to complete the setup.

ref link:
https://bugzilla.redhat.com/show_bug.cgi?id=1570384

Wassalam..

Posted in Linux, oVirt, RHEV | Tagged , ,

Connect to RHEV/oVIrt Using CLI

Assalamualaikum,

To connect to your RHEV/oVirt using CLI (rhevm-shell/ovirt-shell)

# ovirt-shell -l https://skrinhitam.wordpress.com/ovirt-engine/api -u admin@internal --ca-file /etc/pki/ovirt-engine/ca.pem

Below is the location of the related certs.
To connect ‘securely’ to the rhevm-shell, the following files are required to be passed:
[key-file] – The client PEM key file to use : /etc/pki/ovirt-engine/private/ca.pem
[cert-file] – The client PEM certificate file to use : /etc/pki/ovirt-engine/certs/engine.cer
[ca-file] – The server CA certificate file to use : /etc/pki/ovirt-engine/ca.pem

Ref: https://ovirt.org/develop/release-management/features/infra/cli/

wassalam,

Posted in Linux, oVirt, RHEV, RHV | Tagged , ,

How to Add One User to Multiple Groups

Assalamualaikum,

The utility is usermod and is used like:

usermod -a -G group1,group2 username

Where username is the user you want to modify and group1 and group2 are the new groups you want that user to join. Running the command without the -a argument will remove that user from all groups except group1 and group2.

To check a users group memberships use the groups command:

groups username
Posted in Linux, UNIX | Tagged , , , , , , ,