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-server drop unknown-user


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