Skip to content

The Only Exception Posts

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

[[email protected] 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
[[email protected] 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)

[[email protected]~]$ 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: <[email protected]> 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.

[[email protected] 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.

[[email protected] pam.d]# chmod +s /bin/su
[[email protected] pam.d]# ll /bin/su
-rwsr-xr-x 1 root root 28336 Oct 16  2012 /bin/su
[[email protected] ~]$ su - servicesoasit
Password:
[[email protected]~]$
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.

[[email protected] 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%
 
[[email protected] sa]#

Toodles.

4 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

McD Delivery Service.

Cerita zaman belajar dulu.

Pernah tak telefon 1300-13-1300? No telefon keramat ketika lapar menerjah perut. Tapi no tu sebenarnya tertakluk kat kawasan jajahan Mcdonalds masing-masing. Sila rujuk restoran Mcdonalds yang terdekat. Dekat Seksyen 7 Shah Alam ni ada 2 restoran Mcdonalds terhampir. Satu di Seksyen 3 bersebelahan roundabout Taman Tasik Shah Alam hampir dengan UiTM  dan satu lagi di Seksyen 9, bersebelahan Plaza Masalam/Shah Alam Mall. Tapi kebanyakan order yang hadir daripada Seksyen 7 ni selalunya diuruskan dek Mcdonalds Seksyen 9. Tatau kenapa walhal Seksyen 3 lagi dekat, lihat seperti lagi banyak tunggangan untuk misi penghantaran. Mungkin nombor 9 tu lebih hampir dengan 7 berbanding 3. Tapi apa kena mengena pun. Seksyen 3 lagi dekat apa berbanding dengan Seksyen 9. Ah biarlah.

Cerita ni sudah berbulan lepas. Tak tergerak nak ceghita, tapi sudah lama tak update blog, takde idea. Koreklah apa idea sisa yang tinggal lantas curah sambil kunyah limau mandarin pagi pagi dalam lab. Lecturers cancel semua kelas sebab nak meeting untuk final exam. Dah tak jauh. Tak bau bau bacang dah. Perut rasa geli semacam je. Makan lagi limau mandarin, ini bijik yang ke-3. Siapa cepat dia dapat lah.

Malam kejadian tu sebenarnya baru saja pulang daripada Melaka. Rajin la ke Melaka. Komitmen dengan client jauh nun di bumi Hang Tuah. Sampai ke Seksyen 7 terus lapar. Lapar amat. Nak keluar tapi letih sebenarnya 1 jam 1/2 drive daripada sana ke sini. Mapley Khulafa’ dengan Hakim tu bukan jauh. Sepelaung je daripada rumah. Tapi kalau sudah pemalas tu pemalas juga. Capai telefon. Terus dail no keramat. Customer service Mcdonalds sudah kenal kita kalau kita selalu telefon. Terus sebut nama Azwan. Siap alamat lagi. Bagus bagus. Tak perlu kenalkan diri lagi. Pukul 3 pagi masih gagah melayan pelanggan. Hep, ini bukan layan gitu gitu, layan order pelangganlah. Pelanggan lapo malam-malam.

Nak dijadikan cerita malam tu order Large BigMac, Crispy Fried Chicken dengan Ribena. Jumlah semua sekali RM 18.30 termasuk kos penghantaran RM 3.00. Dalam hati dah tak kisah. Tengah lapar, letih siap kaki dah tak mampu nak menapak lagi maka duduklah atas tempat pembaringan. Tak lama kemudian dapat misscall daripada nombor asing. Sudah sampai barangkali lekas berbangun tuju ke pintu buka grill capai kasut dengan duit not RM 50.00 dalam tangan. Lambat sungguh Mcdonalds delivery ni nak dekat sejam lebih baru sampai.

“Err, abang takde duit kecik ke?”

Brader delivery tu bertanya.

“Takde la pulak. Ini je yang saya ada”

Dia membelek-belek porchbag, harapnya kalau ada duit tukar. Tak cukup ke porchbag, beralih ke wallet.

“Saya pun takde duit tukar ni bang. Duit tukar semua dah pakai kat rumah sebelum ni”

“La, takkanlah bawak duit spare change cukup-cukup je kalau dah tau banyak rumah buat order?”

“Tu la bang. Tak jangka pulak.”

Ceh, apakah punya alasan. Takpelah sabar lagi. Sudah lapo lagi lama nak kena terpacak depan pintu pagar nun.

“Abang pegi la mapley kat sebelah sana tu. Tukar kat sana pun boleh”

“Err, saya tak familiar la dengan area sini. Abang boleh tunjuk jalan tak? Hehe.”

Ah sudah tak familiar jalan pulak. Macam mana boleh jadi McDonalds delivery boy kalau tak familiar jalan ni. Tapi boleh pulak jumpa rumah ni. Lantas pakai baju, seluar track terus tunjuk brader tu jalan menuju ke mapley untuk tukar duit. Baki berada di tangan. Tak lama terus pulang ke rumah, menghadap fries yang dah sejuk depan mata sambil gelak.

“Ceh, aku call buat order & fork duit RM 20 for food sebab tak larat nak keluar cari nasik. Kalau dah tadi pergi teman brader tu ke mapley sebab nak tukar duit, apa point aku buat order McD ni? Dah la lambat, kena keluar jugak. Mahal pulak tu.”

Moral: Sediakan duit cukup cukup bila buat order. Diorang tu belum tentu ada spare change.

Sekarang udah kurang makan fast-food. Misi menghilangkan perut sebelum menjelang Viper Challenge bulan November lagi.

Leave a Comment

Bebai.

Boss aku baru balik daripada meeting re-org dekat Austin TX semalam. Hari ni dia masuk office macam biasa dengan separa jet-laggednya.

Tengah duduk syok baca email, tiba2 Outlook aku keluar invitation.

“1×1, ITOC 2.30PM – 3.00PM”

Ok, ada 1×1 meeting dengan beliau. Maybe nak sembang pasal new direction lepas meeting re-org haritu. So aku keluar lunch awal dengan Faizal. Selalunya keluar pukul 12, balik mungkin dalam 1.30 gitu. Tapi sejak boss aku dah arrange 1×1 awal-awal, so baliklah cepat.

Menjelang 2.30, dia tak panggil-panggil jugak nak masuk team room. 2.45 pun senyap je. Selalunya punctual. Kemudian pukul 3.00 petang, masih takde response.

Aku panjangkan leher. Orang tua ada kat cubicle, ingatkan hilang pergi makan ke merayap ke.

So aku pun tegurlah dia, kata nak 1×1. Ni dah pukul 3.00 petang.

“Oh sir, sorry too many things going on, can I reschedule your 1×1 at 4 o’ clock?”

Aku takde hal pun sebenarnya. So aku angguk je lah.

“It’s okay boss, take your time”

Menjelang pukul 4.00 petang, pun diam. Tiba-tiba dia datang approach aku daripada belakang

“Are you in the office tomorrow? I think we’ll just have a meeting tomorrow. Are you okay?”

Ah sudah, baru ingat esok nak ambik half day nak jumpa lawyer rumah.

“Hmm, yeah sure, maybe we can schedule a little bit early, I have some errands to be done tomorrow”

Dia setuju, tak lama lepas tu new invitation keluar.

1×1, ITOC Wednesday 11.00 AM – 11.30PM

Kemudian aku keluar pergi toilet dalam 10 minit, duduk balik depan laptop tiba2 schedule kena cross-strike.

Keluar invitation baru.

1×1 ITOC Thursday 4.00 PM – 4.30 PM

Sah dia ni memang jetlagged teruk.

Kemudian tak lama lepas tu ada meeting, zaujah hantar message dekat Whatsapp, dia kata dia nak deposit RM 300 untuk bayar bil kredit kad, tapi termasukkan RM 500 masa dalam traffic jam.

Semua orang bebai hari ni.

Nota: Bebai – Bengong, perangai aneh-aneh.

Leave a Comment