Check the timezone on server


To check the timezone on the server.

Run the below

cat /etc/sysconfig/clock
Advertisements

Increase swap size via file


If you find you need to increase the swapsize on linux, simply run the below.

Create a swap file – example below creates 2GB file (1024 x 2072 = 2097152 blocksize) to change the size simply times the swap you need by 1024 and append the number to the count option.

dd if=/dev/zero of=/swapfile1 bs=1024 count=2097152
mkswap /swapfile1 ; chmod 600 /swapfile1

Then enable the swap by running the below

swapon /swapfile1

To confirm the swap has been added use free -m to check.

total used free shared buffers cached
Mem: 5963 4371 1592 0 23 2140
-/+ buffers/cache: 2207 3755
Swap: 3071 0 3071

Mongod max processes


If you encounter a problem with MongoDB with the below error. Its worth checking that your Linux OS does not have an override for your sysctl.conf settings called etc/security/limits.d/90-nproc.conf

Error

[initandlisten] pthread_create failed: errno:11 Resource temporarily unavailable
[initandlisten] can’t create new thread, closing connection

Solution

Add a new conf file after with the updated details in the /etc/security/limits.d/ folder entitled 91.mongod.conf. Ensure that the number is after the previous conf file to ensure it gets loaded last.

Example contents


root - nofile 21000
mongod - nofile 21000
mongod soft nproc 62848
mongod hard nproc 62848

Esxi – Add SNMP


To add SNMP to free esxi 5.0 do the below.

Log onto esxi CLI

vi /etc/vmware/snmp.xml

Make the following amendments detailed below

<config>
<snmpSettings>
<communities>public</communities>
<enable>true</enable>
<port>161</port>
<targets>YOURSERVERIPHERE@161 public</targets>
</snmpSettings>
services.sh restart

The server should now be available to be polled via snmp.