Friday, September 16, 2011

Change Default User Registry


REG LOAD HKU\ZZZ "C:\Documents and Settings\Default User\NTUSER.DAT"
REG ADD HKU\ZZZ\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v newUserProfile /t REG_EXPAND_SZ /d "D:\setup.cmd" /f
REG UNLOAD HKU\ZZZ

Wednesday, August 10, 2011

Steps for Upgrading Zabbix Minor Version


  1. Download latest source from www.zabbix.com
  2. Installation Manual for 1.8 http://www.zabbix.com/documentation/1.8/manual/installation/installation_from_source
  3. service zabbix-server stop
  4. service zabbix-agentd stop
  5. tar xvf zabbix-1.8.6.tar.gz
  6. cd zabbix-1.8.6
  7. ./configure --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl
  8. make install
  9. cp /usr/local/sbin/zabbix* /sbin
  10. cd frontends
  11. cp php /var/www/html/php -R
  12. cd /var/www/html
  13. mv zabbix zabbix185
  14. mv php zabbix
  15. chown apache.apache zabbix -R
  16. http://<servername>/zabbix to run the setup and finish

Monday, July 25, 2011

Vmware HotAdd Memory

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1012764


Download this for auto enable.
http://communities.vmware.com/servlet/JiveServlet/download/10492-7-26611/online_hotplug_memory.sh

Run "sysctl -p" to re-scan large memory

Monday, June 20, 2011

Cisco and Nortel Switch Storm Control

int F0/1
storm-control broadcast level 10.00 05.00
storm-control unicast level 89.00 67.00
int G0/1
storm-control broadcast level 10.00 05.00



/cfg/port 1/brate 26000
/cfg/port 2/brate 26000
/cfg/port 3/brate 26000
/cfg/port 4/brate 26000
/cfg/port 5/brate 26000
/cfg/port 6/brate 26000
/cfg/port 7/brate 26000
/cfg/port 8/brate 26000
/cfg/port 9/brate 26000
/cfg/port 10/brate 26000
/cfg/port 11/brate 26000
/cfg/port 12/brate 26000
/cfg/port 13/brate 26000
/cfg/port 14/brate 26000
/cfg/port 15/brate 26000
/cfg/port 16/brate 26000

Friday, June 3, 2011

Install Lotus Notes on Citrix or Roaming Profile Environment

The help document of IBM syntax is wrong, it is the correct syntax that I have tried many times for it

setup.exe /v"SETMULTIUSER=1 MULTIUSERBASEDIR=!APPDATA! MULTIUSERCOMMONDIR=C:\\ProgramData  CITRIX=1 "

Thursday, June 2, 2011

Copy Admin Profile to Default Profile by Sysprep in Windows 7

Unattend.xml

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="specialize">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<CopyProfile>true</CopyProfile>
</component>
</settings>
<cpi:offlineImage cpi:source="wim://<computerName>/g$sources/install.wim#Windows 7 Professional" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>


sysprep /generalize /oobe /unattend:unattend.xml

Windows 7 Delete User Profile

Computer Properties-> Advanced system settings (on the left side) -> Settings for User Profiles (in the middle) -> Select the profile you want to delete and click the delete button.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

Monday, May 30, 2011

Enable HTTP Compression

IIS


cscript adsutil.vbs set W3Svc/Filters/Compression/Parameters/HcDoDynamicCompression true
cscript adsutil.vbs set W3Svc/Filters/Compression/Parameters/HcDoStaticCompression true
cscript adsutil.vbs set W3Svc/Filters/Compression/GZip/HcDynamicCompressionLevel 7
cscript adsutil.vbs set W3Svc/Filters/Compression/GZip/HcScriptFileExtensions "asp" "dll" "exe" "aspx"
cscript adsutil.vbs set W3Svc/Filters/Compression/GZip/HcOnDemandCompLevel 7
cscript adsutil.vbs set W3Svc/Filters/Compression/GZip/HcFileExtensions "txt" "htm" "html" "js" "htc"
cscript adsutil.vbs set W3Svc/Filters/Compression/Deflate/HcDynamicCompressionLevel 7
cscript adsutil.vbs set W3Svc/Filters/Compression/Deflate/HcFileExtensions "txt" "htm" "html" "js" "htc"
cscript adsutil.vbs set W3Svc/Filters/Compression/Deflate/HcOnDemandCompLevel 7
cscript adsutil.vbs set W3Svc/Filters/Compression/Deflate/HcScriptFileExtensions "asp" "dll" "exe" "aspx"
cscript adsutil.vbs set W3Svc/Filters/Compression/Parameters/HcNoCompressionForHttp10 true
cscript adsutil.vbs set W3Svc/Filters/Compression/Parameters/HcNoCompressionForProxies true



Apache



# Insert filter
SetOutputFilter DEFLATE


# Netscape 4.x has some problems...
        BrowserMatch ^Mozilla/4 gzip-only-text/html


# Netscape 4.06-4.08 have some more problems
        BrowserMatch ^Mozilla/4\.0[678] no-gzip


# MSIE masquerades as Netscape, but it is fine
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# Don't compress images
        SetEnvIfNoCase Request_URI \
        \.(?:gif|jpe?g|png)$ no-gzip dont-vary


# Make sure proxies don't deliver the wrong content
        Header append Vary User-Agent env=!dont-vary

Friday, May 20, 2011

iptables as WOL packet proxy

sudo iptables -t nat -A PREROUTING -p udp --dport 7 -j DNAT --to-destination <UNUSED_IP>
sudo ip neigh add <UNUSED_IP> lladdr ff:ff:ff:ff:ff:ff nud permanent dev eth0

Download
http://www.depicus.com/wake-on-lan/wake-on-lan-cmd.aspx

wolcmd <mac> <proxy_ip> 255.255.255.255 7

DogTag Certificate System on CentOS 5.5 x64

https://fedoraproject.org/wiki/QA:Testcase_Dogtag_Certificate_System_Configure

yum install pki-ca pki-ra pki-kra pki-ocsp pki-tks pki-tps.x86_64 pki-console pki-common pki-native-tools centos-ds

pkicreate -pki_instance_root=/var/lib        \
          -pki_instance_name=pki-ca          \
          -subsystem_type=ca                 \
          -agent_secure_port=9443            \
          -ee_secure_port=9444               \
          -ee_secure_client_auth_port=9446   \
          -admin_secure_port=9445            \
          -unsecure_port=9180                \
          -tomcat_server_port=9701           \
          -user=pkiuser                      \
          -group=pkiuser                     \
          -redirect conf=/etc/pki-ca         \
          -redirect logs=/var/log/pki-ca     \
          -verbose

setup-ds.pl

User Firefox or IE
Open the link shown after running the above script.
If it failed, change to use http with port 9180


Saturday, May 7, 2011

Making Ubuntu 11.04 as Kiosk using Google Chrome

1. Create Kiosk Users (with password)
2. Switch to Login Kiosk Users, Open Chrome to create default setting, Set Screensaver Setting (E.g. 5 minutes with no password lock)
3. Logout Kiosk Users, Switch back to your normal users
4. sudo vi /usr/share/xsessions/kiosk.desktop
[Desktop Entry]
Encoding=UTF-8
Name=Kiosk Mode
Comment=Chromium Kiosk Mode
Exec=/usr/share/xsessions/chromeKiosk.sh
Type=Application
5. sudo vi /usr/share/xsessions/chromeKiosk.sh
#!/bin/bash
while true; do google-chrome %u --incognito; sleep 5s; done
6. sudo chmod 755 /usr/share/xsessions/chromeKiosk.sh
7. sudo vi /home/kiosk/.dmrc
[Desktop]
Session=kiosk
Language=en_US
8. sudo chown root.root .dmrc
9. sudo chmod 644 .dmrc
10. sudo vi /home/kiosk/.config/google-chrome/Default/Preferences

  "browser": {
      "window_placement": {
         "maximized": true,
        }

      "exited_cleanly": true,

11. Change Kiosk Users to Auto Login without asking Password
12. Login Kiosk and Test

PS: Chrome will automatically reopen after 5 second, somehow if you want to logout that session, just kill chomeKiosk.sh in console will do.

Reference: http://www.instructables.com/id/Setting-Up-Ubuntu-as-a-Kiosk-Web-Appliance/step6/Set-up-Kiosk-Desktop-Mode-in-Xsessions/?images#images

Tuesday, April 26, 2011

Thursday, April 21, 2011

Daily Linux Commands

find . -type d -exec chmod 755 {} \;

find . -type f -exec chmod 644 {} \;

mysqldump nuke | gzip > nuke.gz

gunzip -c survey.gz | mysql survey

#echo "1" > /sys/class/scsi_device/<device>/device/rescan

find -type d -maxdepth 1 -mindepth 1 -exec du -sh {} \;

grep "No such user (in reply to RCPT TO command);" /var/log/maillog | awk -F"[<>]" '/from/ || /to/ {print $4 "," $6 "\r\n"}' | awk '!($0 in a) {a[$0];print}'


Fix Lotus Notes 8.5.2, FP1, FP2 in Ubuntu 11.04

Download 2 files of Ubuntu 10.10
http://packages.ubuntu.com/maverick/i386/libgdk-pixbuf2.0-0/download
libgdk-pixbuf2.0-0_2.22.0-0ubuntu1_i386.deb
http://packages.ubuntu.com/maverick/i386/libgtk2.0-0/download
libgtk2.0-0_2.22.0-0ubuntu1_i386.deb

Extract the following files and save into /opt/ibm/lotus/notes

/opt/ibm/lotus/notes/libgdk_pixbuf-2.0.so.0
/opt/ibm/lotus/notes/libgdk_pixbuf-2.0.so.0.2200.0
/opt/ibm/lotus/notes/libgdk_pixbuf_xlib-2.0.so.0
/opt/ibm/lotus/notes/libgdk_pixbuf_xlib-2.0.so.0.2200.0
/opt/ibm/lotus/notes/libgdk-x11-2.0.so.0
/opt/ibm/lotus/notes/libgdk-x11-2.0.so.0.2200.0
/opt/ibm/lotus/notes/libgtk-x11-2.0.so.0
/opt/ibm/lotus/notes/libgtk-x11-2.0.so.0.2200.0

Wednesday, April 20, 2011

Enable tray icon and get back menu in App in Ubuntu 11.04

Run the following in Command:
gsettings set com.canonical.Unity.Panel systray-whitelist "['all']"

Append the following before the command in the launcher:
env UBUNTU_MENUPROXY=

E.g. env UBUNTU_MENUPROXY= /opt/ibm/lotus/notes/framework/../notes %F

Tuesday, March 29, 2011

Install IE7 on Ubuntu using Wine


Selected Test Results (selected in 'Test Results' table below)
What works
  • Browsing secure sites (https)

  • Sun Java VM

  • Flash 10

  • most java script

  • file downloads

  • page printing setup, preview and zoom


  • What does not
  • ierunonce

  • unable to pick search providers

  • fishing filter

  • pages requiring ActiveX


  • What was not tested
    Pop up blocker

    Additional Comments
    Installed using WineTricks VERSION=20091125 (IE7).
    Downgraded to wine version to 1.1.31 to install jre-6u17-windows-i586.exe.
    This is due to a regression in wine 1.1.32 - 1.1.34.
    After install upgrade back to 1.1.34.
    Added real XP Dll's to system32:
    msctf.dll,msimtf.dll,oelpro32.dll,uxtheme.dll,xmllite.dll
    
    Used winetricks to install:
    comctl32,comctl32,corefonts,fontfix, gdiplus,msls31,msxml3-4 & 6,riched20 & 30,tahoma,allfonts
    
    Used winecfg to set DLL Overrides:
    "browseui"="native,builtin"
    "comctl32"="builtin"
    "crypt32"="native,builtin"
    "dispex"="native,builtin"
    "gdiplus"="native"
    "hhctrl.ocx"="native,builtin"
    "hlink"="native,builtin"
    "iernonce"="native,builtin"
    "iexplore.exe"="native,builtin"
    "itircl"="native,builtin"
    "itss"="native,builtin"
    "jscript"="native,builtin"
    "mlang"="native,builtin"
    "mshtml"="native,builtin"
    "mshtml3"="native,builtin"
    "msimtf"="native,builtin"
    "msxml3"="native,builtin"
    "olepro32"="native,builtin"
    "riched20"="native,builtin"
    "riched32"="native,builtin"
    "scrobj"="native,builtin"
    "shdoclc"="native,builtin"
    "shdocvw"="native,builtin"
    "shlwapi"="native,builtin"
    "updspapi"="builtin"
    "url"="native,builtin"
    "urlmon"="native,builtin"
    "usp10"="native,builtin"
    "uxtheme"="native,builtin"
    "wininet"="builtin"
    "wintrust"="native,builtin"
    "xmllite"="native,builtin"
    
    This made IE7 much more functional.

    Friday, March 11, 2011

    Expanded Linux Logical Volume online

    pvcreate /dev/sdb2
    vgextend VolGroup01 /dev/sdb2
    lvm vgchange -a y
    lvextend -l+100%FREE /dev/VolGroup01/LogVol00
    resize2fs -f /dev/VolGroup01/LogVol00

    Tuesday, March 8, 2011

    Disable Default Service on CentOS

    chkconfig --level 3456 avahi-daemon off
    chkconfig --level 3456 avahi-dnsconfd off
    chkconfig --level 3456 bluetooth off
    chkconfig --level 3456 cups off
    chkconfig --level 3456 firstboot off
    chkconfig --level 3456 hidd off
    chkconfig --level 3456 isdn off
    chkconfig --level 3456 nfs off
    chkconfig --level 3456 nfslock off
    chkconfig --level 3456 pcscd off
    chkconfig --level 3456 rpcidmapd off
    chkconfig --level 3456 rpcgssd off
    chkconfig --level 3456 smartd off
    chkconfig --level 3456 sendmail off
    chkconfig --level 3456 ip6tables off

    chkconfig --level 3456 iscsid off

    Notes on Installing Windows 3.11 on Vmware

    DOSIDLE - idle CPU on DOS
    WQGHLT - idle CPU on Windows 3.11
    SVGAPATCH - patch SVGA 1024x768 in Windows 3.11 to use in VMWARE
    Network Card Driver
    Y2K Patch

    Download all related Drivers here - http://www.mediafire.com/?3eq8gxri1s5wswt


    http://www.japheth.de/
    http://forums.virtualbox.org/viewtopic.php?t=1033

    Wednesday, March 2, 2011

    Changing Date Format on Ubuntu for Lotus Notes

    1. cd //usr/share/i18n/locales
    2. backup en_US
    3. edit en_US
    4.

    % Appropriate date representation (%x)
    %       "%Y/%d/%m"
    d_fmt   "<U0025><U0059><U002F><U0025><U0064><U002F><U0025><U006D>"

    5. sudo localedef -f UTF-8 -i en_US en_US.UTF-8

    Tuesday, March 1, 2011

    Setup Syslog-ng Server for Cisco Device

    1. Install EPEL on CentOS
    http://download.fedora.redhat.com/pub/epel/5/i386/repoview/epel-release.html
    2. Yum install syslog-ng
    3. vi /etc/syslog-ng/syslog-ng.conf
    4. Remark default log settings (keep using syslog for system, syslog-ng for cisco device only)
    5.  Add
    source s_sys {
            udp(ip(0.0.0.0) port(514));
    };
    filter f_router  { facility(local3); };
     ###ROUTER IP###
    filter f_A { host("1.1.1.1"); };
    filter f_B { host("2.2.2.2"); };
    filter f_C { host("3.3.3.3"); };
    ###UNKNOWN ROUTER###
    filter f_unknown { not ( filter(f_A)
                            or filter(f_B)
                            or filter(f_C) ); };
    ###LOG FILE LOCATIOM###
    destination A { file("/var/www/netlog/A.log"  perm(0644) sync(10) ); };
    destination B { file("/var/www/netlog/B.log" perm(0644) sync(20) ); };
    destination C { file("/var/www/netlog/C.log" perm(0644) sync(20) ); };
    destination unknown { file("/var/www/netlog/unknown.log" perm(0644) sync(10) ); };
    ###LOG SETTING###
    log { source(s_sys); filter(f_router); filter(f_A); destination(A); };
    log { source(s_sys); filter(f_router); filter(f_B); destination(B); };
    log { source(s_sys); filter(f_router); filter(f_C); destination(C); };
    log { source(s_sys); filter(f_router); filter(f_unknown); destination(unknown); };

    6. Edit /etc/sysconfig/iptables and Add
    -A RH-Firewall-1-INPUT -p udp -m udp --dport 514 -j ACCEPT
    7. Edit /etc/httpd/conf.d/netlog.conf
    Alias /netlog /var/www/netlog
    <Location /netlog>
        Options Indexes Includes FollowSymLinks SymLinksifOwnerMatch MultiViews
        Order deny,allow
        Deny from all
        Allow from 163.50
        Allow from 172
        Allow from 192
    </Location>

    8. mkdir /var/www/netlog
    9. service iptables restart & service syslog-ng restart & service httpd restart
    10. chkconfig --level 3456 syslog-ng on
    11. Edit /etc/logrotate.d/syslog-ng

    /var/www/netlog/*.log {
        daily
        notifempty
        missingok
        copytruncate
        postrotate
            /sbin/service syslog-ng reload > /dev/null 2>/dev/null || true
        endscript
        compress
    }
    12. Configure your Cisco Router

    logging facility local3
    logging <server ip>

    Wednesday, February 23, 2011

    Monitoring Disk Usage on AS400 V6R1 using SNMPv1

    #!/bin/sh

    IP=$1
    COMMUNITY="public"
    SNMP_VERSION="1"

    DISK_SIZE=`snmpwalk -v $SNMP_VERSION -c $COMMUNITY $IP .1.3.6.1.2.1.25.2.3.1.5.1 | awk '{ print $NF }' | tail -n 1`

    DISK_USED=`snmpwalk -v $SNMP_VERSION -c $COMMUNITY $IP .1.3.6.1.2.1.25.2.3.1.6.1 | awk '{ print $NF }' | tail -n 1`

    if [ $DISK_SIZE -lt 0 ]
    then
            DISK_SIZE=$((DISK_SIZE+2**32))
    fi

    echo `expr $DISK_USED \* 10000 / $DISK_SIZE`

    Monitoring No of Voice Call on Cisco Router

    snmpwalk -v 2c -m DIAL-CONTROL-MIB -c public $1 1.3.6.1.2.1.10.21.1.3.1.1.9 | grep -c "INTEGER:"

    Monitoring Postfix Mail Queue on Zabbix

    /etc/zabbix/zabbix-agentd.conf
    UserParameter=postfix.deferred, sudo /usr/sbin/qshape deferred | grep TOTAL | awk '{print $ 2}'
    UserParameter=postfix.queue, sudo /usr/sbin/qshape | grep TOTAL | awk '{print $ 2}'

    LogFile=/var/log/zabbix-agent/zabbix_agentd.log

    visudo
    zabbix ALL = NOPASSWD:/usr/sbin/qshape

    Monday, February 21, 2011

    Surprising about Chrome Web Store !!

    Free Web based full function AutoCAD WS!
    Facebook App
    eBuddy App

    It just make my Google Chrome Browser works like my iphone!

    Reclaim Disk Space using SVMotion

    1. Zero out disk space using sdelete or dd
    2. Change Disk Format to Thick Provision by SVmotion
    3. Power off PC, SVmotion the datastore with a different VMFS block size and change to Thin Provision.

    Sunday, February 20, 2011

    Aligning VM Disk Partition

    Windows:
    Very easy, boot Windows using Gparted, resize the partition with 1 MB free space before will be done.

    Linux:
    If you are not using LVM, simply do it using Gparted.
    If you are using LVM (You can do it online, by move VolGroup from disk to disk!),
    1. add a disk same size as the disk you want to align (E.g. the original disk /dev/sdb1 is 40G and belongs to VolGroup01)
    2. using fdisk, create a new partition on /dev/sdc, moving beginning data to 128 (http://www.tcpdump.com/kb/virtualization/vmware-esx-server/vmware-disk-alignment/vmfs-liux.html)
    3. pvcreate /dev/sdc1
    4. vgextend VolGroup01 /dev/sdc1
    5. pvmove /dev/sdb1 /dev/sdc1
    6. vgreduce VolGroup01/dev/sdb1
    7. pvremove ./dev/sdb1
    8. shutdown your machine and remove your disk /dev/sdb1

    REMARK: if you are using thin disk, this method will allocate whole disk size, you might want to shrink it be Storage Vmotion.

    MySQL Innodb Performance

    Recently, having trouble on and solving my zabbix server VM which having slow IO resposnse

    Tuning Innodb


    Align VM Partition
    http://www.tcpdump.com/kb/virtualization/vmware-esx-server/vmware-disk-alignment/intro.html


    http://dev.mysql.com/doc/refman/5.0/en/innodb-data-log-reconfiguration.html

    I LOVE Ubuntu

    Love using ubuntu desktop 10.10, found good download manager in firefox, "DownThemAll"


    recordMyDesktop - Another good tools in linux for desktop capture and recording


    tsclient is suck, I like Remmina Remote Desktop Client!