excel search

This is the core function in most of my excel tools, a VBA for searching a rows

Public Function Find_First(my_string As Variant)
Dim Rng As Range
If Trim(my_string) <> “” Then
With Sheets(“Sheet1”).Range(“A:A”)
Set Rng = .Find(What:=epm_domain, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
MY_COLUMN2_VAL = Sheets(“Sheet1”).Cells(Rng.Row, 2).Value
Else
MsgBox “Nothing found”
End If
End With
End If
End Function

Advertisements

Linux memory script

Below is a simple script to check the total memory and cpu used by process

MY_USER=`id -u -n`
MY_HOST=`hostname`
> /tmp/my_mem_$MY_HOST.txt
echo `date` >> /tmp/my_mem_$MY_HOST.txt
ps -e -o rss,vsz,pcpu,user,args | grep $MY_USER > /tmp/$MY_HOST_prcs.txt
cat /tmp/$MY_HOST_prcs.txt | awk ‘{a=$1;b=$2;c=$3;x=x+a;y=y+b;z=z+c;ma=x/1024;mb=y/1024;{printf(”   Resident memory size is:   %s MB\n   CPU for Processes:        %s %%\n   Virtual memory size is:    %s MB\n”,ma,z,mb)}}’  | tail -3 >> /tmp/my_mem_$MY_HOST.txt
cat /tmp/my_mem_$MY_HOST.txt

which will report the total memory and virtual memory used together with CPU % by the particular user.

Mon Jul 25 01:45:40 EDT 2016
Resident memory size is:   12664.8 MB
CPU for Processes:        19.4 %
Virtual memory size is:    49755.9 MB

Can be modified and place inside a loop for monitoring.

 EPM tools

We are currently maintaining a number of servers for our EPM applications. When you are dealing with tons of servers, it is important to keep an inventory to keep track of the software component installed and the associated environment and servers. 

Since i’m a fan of automation, i created a tool for our inventory with Excel as my usual weapon of choice. The attached video contains the demo of the tool. Feature such as automated login and integration to Linux servers, sqlplus and nt servers are not included due to security reason