Thursday 31 May 2012

Exchange cached mode and ost files

Turning cached mode on is intended for laptop users so they have access to read emails when offline. Usually we turn off cached mode when we have constant connectivity to the exchange server like on a desktop on the LAN.

Often users will find OST files taking up GB's worth of space for no good reason.
Disable cached mode in outlook, close outlook and delete the ost file.

Also OST files cannot be migrated you need to delete them and let outlook create a new one. If you are running a migration from office2007 to 2010 make sure to exclude ost files.

Monday 21 May 2012

How to run a manual check from nagios slave

You may need to su to the nagios user to run some checks
sudo su - nagios

/usr/local/nagios/libexec/check_http -H servername.domain.ie -S -w 5 -c 10
/usr/local/nagios/libexec/check_http -I 192.168.1.50 -S -w 5 -c 10
/usr/local/nagios/libexec/check_http -H 192.168.1.50 -S -w 5 -c 10

more info here http://nagiosplugins.org/man/check_http

How to check if a service is set to start on boot in linux

man chkconfig for more details
Below shows me checking the start up status of the smb service, setting it to start on boot and then checking again to confirm the change.

$ chkconfig --list | grep smb
smb             0:off   1:off   2:off   3:off   4:off   5:off   6:off
$ chkconfig smb on
$ chkconfig --list | grep smb
smb             0:off   1:off   2:on    3:on    4:on    5:on    6:off

Friday 18 May 2012

importing data from a csv file with powershell


This is the contents of my data.csv file:

Col1,Col2,Col3
jack,jack@test.com,1234567
john,john@test.com,7654321

Here is the powershell code of my ImportFromCSV.ps1:

$dataSource=import-csv "data.csv"
foreach($dataRecord in $datasource)
{
    $name=$dataRecord.Col1
    $email=$dataRecord.Col2
    $phone=$dataRecord.Col3
    write-host $name $email $phone
}

Running the code gives the following output:

jack jack@test.com 1234567
john john@test.com 7654321

For this to work data.csv and ImportFromCSV.ps1 should be in the same directory

Thursday 17 May 2012

time synchronisation issues on VMware VM's

Some VM's had the time drifting. VMware tools on the VM was set to sync the time with the host. You should not check this. Instead use an NTP server or time.windows.com on your VM.

SNMP

Simple network management protocol (SNMP)
Used to monitor and manage network devices.

Ports
SNMP polling UDP port 161 (normal checks)
SNMP traps UDP port 162

Basic's
Polling runs a check every X number of minutes that you define from your monitor server to your network device. Monitor Server -> Device
Traps are triggered when some event happens like an interface is disconnected. Your network device will send an unsolicited message from the network device to the monitor server. Device -> Monitor Server.


MIB's are management information base

OID Object Identifier
Community name is used in v1 and 2c for authentication. Like a password

Versions 
version 1 isn't really used any more
version 2c is most common in the wild (not very secure, but people don't care if someone is snooping on their alerts, also you always set your community to read only)
version 3 is the latest (most secure, but hasn't been deployed in the wild so much because it adds complexity)

Popular commercial tools
Opsview enterprise
Solar winds engineers tool kit
Pace layer’s MRTG
There are loads of free tools out there (nagios,opsview etc)

Setting up snmp (the old way)
conf t
snmp-server community ROCOMMUNITY ro
snmp-server is the keyword use ? at each step.
ROCOMMUNITY is the community name you can call this anything you want
ro says that it will be read only
snmp-server community (will enable v1 and 2c for backward compatibility)

Making it secure
snmp-server community ROCOMMUNITY ro snmp-acl
access-list snmp-acl permit host xxx.xxx.xxx.xxx


Setting up snmp (the new way)
When version 3 came out cisco changed the syntax of the command we use to enable snmp. Again the ? is helpful.
snmp-server group ROGROUP v3 read ROVIEW
snmp-server user ROUSER group ROGROUP v3
snmp-server view ROVIEW mib-2 included (if you don't include anything snmp won't work)
snmp-server view ROVIEW cisco included

Making it secure
access-list snmp-acl permit host xxx.xxx.xxx.xxx
snmp-server group ROGROUP v3 read ROVIEW access snmp-acl
snmp-server user ROUSER group ROGROUP v3 (can add another acl here but there’s no need this user/group will automatically be added to snmp-acl)
snmp-server view ROVIEW mib-2 included
snmp-server view ROVIEW cisco included

SNMP descriptors
snmp-server chassis-id (serial)
snmp-server location Jacks House, Sever room 1
snmp-server contact itadmins@address.com


Where is the SNMP community name on a windows server
Start -> run -> services.msc
Right click on SNMP Service -> properties
Go to the security tab

Tuesday 15 May 2012

Cisco cheat sheet


Add a user(privilege 15=enable) to a switch
conf t
username jackface privilege 15 secret P@55w0rd

Display IOS version
show version | i IOS

Display bootloader version
show version | i Boot

Display software version on Cisco ASA firewall
show version | i Software Version

Wednesday 9 May 2012

vim cheat sheet



To delete all lines containing "word" run the following
:g/word/d

To delete all lines that are empty or that contain only whitespace
:g/^\s*$/d

To delete all lines that do not contain a pattern, use g!. This command will delete all lines that are not comment lines.
:g!/^\s*"/d

Find the word "DOMAIN\" and replace with blank
:%s/DOMAIN\\//gc

Find ", " and replace with a cariage return \r
:%s/, /\r/gc

Delete the first 4 characters at the start of each line
:%s/^.\{4}//gic

Delete all trailing whitespace (at the end of each line) with:
:%s/\s\+$//

Delete all white space at the start of the line
:%le
 or
:%s/^\s\+

Convert all UPPERCASE letters to lowercase
:%s/[A-Z]/\L&/g

Convert all lowercase letters to UPPERCASE
:%s/[a-z]/\U&/g

To sort alphabetically
:sort

Tuesday 8 May 2012

issue with SCCM 2012 build and capture

The capture media in 2012 is silly; it relies on Autorun! Autorun won’t run due to security restrictions. You have to run the exe from CMD when in the root of the removable drive. Then it captures.

http://social.technet.microsoft.com/Forums/en-US/configmanagerosd/thread/bef8a10b-7ac0-4b61-88a0-c8d41697c44a

MS word page settings for kindle

Page width: 3.5 inches
Page height: 5 inches
Margins: .25 inches all around
Font: 10-point Trebuchet MS.

Save as .rtf, use calibre to convert to mobi and send to kindle.

User http://calibre-ebook.com/ to convert other formats to mobi

Tuesday 1 May 2012

saving show tech-support to a file on cisco devices

"show tech-support file techsupport" - Saves the output of show tech-support to a file called techsupport
"show flash" - shows you the files on the flash memory
"copy techsupport tftp" - Saves the file to your TFTP server
You can install tftpd32 on your own computer if you need to