Skip to content

Author: A

Tips: Enable Lync 2013 Message Auto Archiving

If you are wondering why your Lync is not keeping IM conversation history, you can take a look at Lync Options > Personal.

In my case, these two checkboxes were grayed out. I haven’t thoroughly investigate if this restriction is imposed by Lync Administrator in my organization.

Lync

Thankfully these two settings can be overriden by modifying your Windows registry. Tested and working.

Open your registry editor (regedit.exe) and navigate to these two keys.

HKEY_CURRENT_USER / SOFTWARE / MICROSOFT / COMMUNICATOR / CallLogAutoArchivingPolicy

HKEY_CURRENT_USER / SOFTWARE / MICROSOFT / COMMUNICATOR / ImAutoArchivingPolicy

Double click those keys and change the hex value from 0 to 1. Restart your Lync and Microsoft Outlook.

***

Update: As expected, GPO reverted back the setting and disabled IM Archiving on my Lync 2013. I raised a ticket to Service Desk and asked them to enable this function and was told by the agent that it is organization policy to disable chat logging. Boo.

Leave a Comment

Linux: Find Top 10 processes utilizing swap.

Updated: Corrected grep syntax problem.

Hello.

Nothing much to do today other than completing some pending documentations for my junior analysts, so I’ve decided to write a helper script to kill some time.

This bash script will display top ten processes which utilizing swap filesystem. It could be very useful if you want to troubleshoot any swap related issue.  I have tested it on Oracle Enterprise Linux and it should be working fine on any Redhat based distribution.

#!/bin/bash
# GSS Linux: Script to find Top 20 processes utilizing swap filesystem.
# Author: Azwan_Ngali (azwan.ngali[AT]gmail.com)
# Linux blusmurf 2.6.32-042stab081.3 #1 SMP Mon Sep 9 20:07:47 MSK 2013 i686

SWAPFREE=$(cat /proc/meminfo | grep SwapFree: | awk -F " " '{print $2}')
SWAPTOTAL=$(cat /proc/meminfo | grep SwapTotal: | awk -F " " '{print $2}')
SWAPUSAGE=$(echo "$SWAPTOTAL - $SWAPFREE" | bc)
SWAPPERCENTAGE=$(echo "scale=3;($SWAPUSAGE / $SWAPTOTAL) * 100" | bc)
COUNTER=0

printf "\n"
printf "Displaying Top 20 processes which utilization swap filesystem  \n"


printf "Current swap utilization (kB): $SWAPFREE / $SWAPTOTAL ($SWAPPERCENTAGE%%)\n"
printf "\n"

printf "%-25s %-25s %-25s\n" "PID" "Swap Utilization (kB)" "Process Name"
printf "%1s\n" "------------------------------------------------------------------------------------------------------------------------"

# Send ps ax output to temporary text file.

ps ax | awk '{print $1 " " $5}' > /tmp/psax_temp.txt

for x in $(grep Swap /proc/[1-9]*/smaps | grep -v '\W0 kB' | tr -s ' ' | cut -d' ' -f-2 | sort -t' ' -k2 -n | tr -d ' ' | tail -20); do

        SWAPUSAGE=$(echo $x | cut -d: -f3)
        PID=$(echo $x | cut -d/ -f3)
        PROCNAME=$(grep -w $PID /tmp/psax_temp.txt | awk '{print $2}')
        printf "%-25s %-25s %-25s\n" $PID $SWAPUSAGE $PROCNAME
        COUNTER=$((COUNTER+1))

done

# No process found.

if [ $COUNTER -eq 0]; then

printf "No process found\n"

fi

# Remove temp file.

rm -f /tmp/psax_temp.txt

Note 1: Processes may appear multiple times if they have multiple memory regions swapped (and these are large)

Note 2: If the above script produces no output, then it could be that none of the currently running processes in /proc/*/smaps are using swap.

You can test that by simply running:

 grep Swap /proc/[1-9]*/smaps | grep -v '\W0 kB'

Important thing to keep in mind is that the aforementioned script will only show the active processes that have memory swapped at that point in time, meaning at the time when the script was run. It might be quite possible that the system has already swapped a chunk of memory and that is visible on free output but the script shows no output. Point being, this script shows the current swapping activity and cannot be used for historical data gathering. For that purpose, sar can be used.

Output example

[root@oracle healthcheck]# ./swap.sh

Displaying Top 20 processes which utilization swap filesystem
Current swap utilization (kB): 7247736 / 16778232 (56.800%)

PID                       Swap Utilization (kB)     Process Name
------------------------------------------------------------------------------------------------------------------------
22640                     15420                     /stornext/snfs1/eradmin/ggs/misc_oc10.2_11gV4/replicat
22440                     15528                     /stornext/snfs1/eradmin/ggs/misc_oc11.1_11gV4/extract
31065                     16208                     /stornext/snfs1/eradmin/ggs/siebeldwngrd_oc11.2_11gV4/replicat
3004                      17372                     /stornext/snfs1/eradmin/ggs/misc_oc10.2_11gV4/extract
17756                     17560                     /stornext/snfs1/eradmin/ggs/misc_tc14.0_11gV1_2/replicat
4453                      18148                     /stornext/snfs1/eradmin/ggs/misc_tc14.0_11gV1_1/replicat
668                       19436                     /stornext/snfs1/eradmin/ggs/misc_oc10.2_11gV4/extract
4454                      22516                     /stornext/snfs1/eradmin/ggs/misc_tc14.0_11gV1_1/replicat
9052                      23292                     /opt/dell/srvadmin/sbin/dsm_sa_datamgrd
4450                      28996                     /stornext/snfs1/eradmin/ggs/misc_tc14.0_11gV1_1/replicat
4460                      33824                     /stornext/snfs1/eradmin/ggs/misc_tc14.0_11gV1_1/replicat
17754                     38468                     /stornext/snfs1/eradmin/ggs/misc_tc14.0_11gV1_2/replicat
30233                     42912                     /stornext/snfs1/eradmin/ggs/misc_tc14.0_11gV1_2/replicat
4449                      43308                     /stornext/snfs1/eradmin/ggs/misc_tc14.0_11gV1_1/replicat
9052                      63488                     /opt/dell/srvadmin/sbin/dsm_sa_datamgrd
9052                      63488                     /opt/dell/srvadmin/sbin/dsm_sa_datamgrd
9052                      65536                     /opt/dell/srvadmin/sbin/dsm_sa_datamgrd
9052                      65536                     /opt/dell/srvadmin/sbin/dsm_sa_datamgrd
9052                      65536                     /opt/dell/srvadmin/sbin/dsm_sa_datamgrd
4467                      4717844                   /stornext/snfs1/eradmin/ggs/misc_tc14.0_11gV1_1/replicat
[root@oracle healthcheck]#

Toodles.

Leave a Comment

Linux : pam_unix(su -l:auth): authentication failure

Symptom

User is not able to “su” to another account (be it local, or LDAP based)

[admazwan_ngali@oracle~]$ su - servicesoasit
Password:
Password:
su: incorrect password

/var/log/secure will display this error log.

Jul 21 23:53:37 oracle su[22863]: pam_vas: Authentication <succeeded> for <Active Directory> 
user: <servicesoasit> account: <ServiceSOASIT@AMER.DELL.COM> service: <su-l> reason: <N/A> Access Control Identifier(NT Name):<AMERICAS\ServiceSOASIT>
Jul 21 23:53:38 oracle su[22863]: pam_unix(su-l:auth): authentication failure; 
logname=admazwan_ngali uid=2184379 euid=2184379 tty=pts/6 ruser= rhost=  user=servicesoasit

As you can see pam_vas already verified authentication is a success, but “su” still refused you to switch user.

Troubleshooting

Ensure setuid is set on /bin/su file. Not sure why it’s changed, probably it happened during OEL upgrade recently.

[root@oracle pam.d]# ll /bin/su
-rwxr-xr-x 1 root root 28336 Oct 16  2012 /bin/su

Try to “su” to another account again. Issue should be fixed.

[root@oracle pam.d]# chmod +s /bin/su
[root@oracle pam.d]# ll /bin/su
-rwsr-xr-x 1 root root 28336 Oct 16  2012 /bin/su
[admazwan_ngali@oracle ~]$ su - servicesoasit
Password:
[servicesoasit@oracle~]$
2 Comments

Linux : Get average CPU and Memory utilization from SAR data

Working on some performance related issue today and user requested average CPU/Memory utilization history on previous days, so I came out with quick script to pull the data.

Tested on Oracle Enterprise Linux. Should be working fine on any RHEL based distribution. Sysstat package is required to enable sar report on your server.

#!/bin/bash

# Get Average CPU/Memory Utilization History from sysstat file in /var/log/sa/*
# Author: azwan.ngali[AT]gmail.com


for file in $(ls -la /var/log/sa/* | grep sa[0-9] | awk '{print $9}')
do
        sar -f $file | head -n 1
        printf "\n"

        # Get CPU idle average, it's pretty straight forward.

        printf "CPU average: "
        sar -u -f $file | grep Average: | awk -F " " '{sum = (100 - $8) } END { print sum "%" }'

        # Get Average Memory utilization

        # Information being displayed in sar -r command is somewhat misleading.
        # As it is merely calculated by the formula kbmemused/(kbmemused+kbmemfree) * 100
        # But actually that was not the case, in order to get memory calculation, 
        # here's the revised formula to include memory cache/buffer information into account.
        # 
        # Formula:
        # (kbmemused-kbbuffers-kbcached) / (kbmemfree + kbmemused) * 100
        # The reason behind this is Linux treats unused memory as a wasted resource and so uses as 
        # much RAM as it can to cache process/kernel information
		
        printf "Memory Average: "
        sar -r -f $file | grep Average | awk -F " " '{ sum = ($3-$5-$6)/($2+$3) * 100   } END { print sum "%" }'

        printf "\n"
done

Upon execution, it will search all sa* file in /var/log/sa and perform basic calculation to display CPU/memory average. It may be handy if you’re lazy like me.

[root@ausuovmfmtap3 sa]# ./averagesar.sh
Linux 2.6.18-274.el5 (ausuovmfmtap3.xx)        07/01/2014
CPU average: 4.76%
Memory Average: 15.6925%
 
Linux 2.6.18-274.el5 (ausuovmfmtap3.xx)        07/02/2014
CPU average: 3.4%
Memory Average: 14.3805%
 
Linux 2.6.18-274.el5 (ausuovmfmtap3.xx)        07/03/2014
CPU average: 3.35%
Memory Average: 14.576%
 
Linux 2.6.18-274.el5 (ausuovmfmtap3.xx)        07/04/2014
CPU average: 3.97%
Memory Average: 17.8241%
 
Linux 2.6.18-274.el5 (ausuovmfmtap3.xx)        07/05/2014
CPU average: 4.44%
Memory Average: 20.4096%
 
Linux 2.6.18-274.el5 (ausuovmfmtap3.xx)        07/06/2014
CPU average: 4.58%
Memory Average: 20.6211%
 
Linux 2.6.18-274.el5 (ausuovmfmtap3.xx)        07/07/2014
CPU average: 4.77%
Memory Average: 18.3188%
 
Linux 2.6.18-274.el5 (ausuovmfmtap3.xx)        07/08/2014
CPU average: 3.34%
Memory Average: 14.8783%
 
Linux 2.6.18-274.el5 (ausuovmfmtap3.xx)        07/09/2014
CPU average: 3.44%
Memory Average: 15.1599%
 
[root@ausuovmfmtap3 sa]#

Toodles.

5 Comments

Ejaan pendek.

Masa berbincang dengan boss aku pasal new hire kami.

“Her onboarding date is 1st July. Usually new notebook request will take around 2-3 weeks to be fulfilled. I’m going fill up the service request form now”

“Yes, please submit the request on her B 1/2”

Kemudian dia offline pergi breakfast.

Aku mengalami kesukaran nak mentafsirkan perkataan terakhir beliau.

Seminit aku tercangak-cangak mencarik maksud sambil menggaru-garu pipi.

..

..

B 1/2 = behalf.

#hipster

 

Leave a Comment

Samba access denied error when accessing symlink paths.

Last week one of our business partner had issue mapping their Samba path to their workstation with access denied error.

C:\Users\azwan_ngali>net use * \\sambaserver\sys2\dellsftw\barcodes "password" /
user:domain\serviceaccount

System error 5 has occured.

Access is denied.

Despite user’s service account is a part of valid users group in /etc/samba/smb.conf, he’s still not able to map it.

Found out that the samba path is actually a symlink pointing to another directory which the service account has read / write access. Service account is a part of ap2_dev_cpdev_bar member.

lrwxrwxrwx 1 root root 51 Mar 17 2011 barcodes -> /stornext/snfs1/data/common/sys2/dellsftw/barcodes/

drwxrwxr-x 25510 root ap2_dev_cpdev_bar 960033 Jun 16 17:08 barcodes

To fix this problem you need to modify your SAMBA configuration.

Add / modify these three lines to enable SAMBA mapping to symlink paths.

follow symlinks = yes
wide links = yes
unix extensions = yes

Save the file and restart Samba service.

service smb restart

Try remapping the Samba path again. Access denied error will be gone.

Leave a Comment

MaGIC

MaGIC, Malaysian Global Innovation and Creative Centre (MaGIC) ditubuhkan khas untuk membantu syarikat yang berkecimpung dalam bidang media kreatif, dan juga one-stop centre untuk usahawan baru bertapak.

Sepanjang dua minggu ni kami tengok depan office tu sibuk nak menaikkan khemah, letak aircond yang gila banyak. Siap ada pentas untuk konsert waktu malam lagi.

Kami juga terpaksa apply special tag untuk keluar masuk office sebab waktu hari perasmian dan sepanjang majlis ada kawalan ketat sekuriti sana sini. Kami juga nampak penembak-penembak tepat yang berpakaian rumput rampai atas bangunan-bangunan tinggi di Cyberjaya.

2014-04-24 17.58.33

(Tak paham kenapa muka aku melebar sungguh dalam tag ni *siul*siul)

Sebabnya dengar ura-ura Presiden Obama nak datang sekali dengan PM Najib Razak.

Issue TPPA. Trans-Pacific Parnership Agreement yang tak menguntungkan.

Sekian. Balik awal petang ni. Chow.

Leave a Comment