Skip to content

Archive for

Analyse user activity in Netezza server

This script will find all the sessions made by any specific user in current pg.log directory.
It pulls the session id as well as all the activities done in that session. Expected output will be pretty long if user have made too many connections and/or ran too many queries.

Script:

#save as analyze_user_activity.sh
USR=$1
PGLOG=/nz/kit/log/postgres/pg.log

for SESSION in `grep -i $USR $PGLOG | awk '/\[/{print $4}'`
do
echo $SESSION
S=`echo $SESSION | sed 's/\[//;s/\]//'`
grep \\[$S\\] $PGLOG
done

How to Run:
Run this script with one parameter, which will be the user id for which you want to monitor the activity.

analyze_user_activity.sh user123

How to find Netezza software support tools?

To find the current version of IBM Netezza Software support tools or support scripts (in general) run the below command:

head -n2 /nz/support/Version.txt

OUTPUT:

IBM_Netezza-7.0.2.3-130424-1831
NPS 7.0.2.3

This means we are on support tools version 7.0.2.3

NOTE:- This version is not same as NPS version. Both can be different.