Run commands via ssh remotely

To run a command after ssh to a server.

Run the below.

ssh 'df -h'

Copy files from multiple servers to one server

Below is a script which should allow you to copy multiple files that exist on different servers to one location.

You will need SSH keys setting up if you dont want to enter in the password for each time the request is sent to the server.

Further info here

servers.txt contents

#!/bin/bash -
#          FILE:
#         USAGE:  ./
#   DESCRIPTION:  Copies files on multiple servers to one server from text list of servers hostnames
#       OPTIONS:  The right to remain silent
#          BUGS:  
#         NOTES:  Above^
#        AUTHOR: 
#       COMPANY:
#       CREATED: 18/01/12 13:43:03 BST
#      REVISION: 
servers=$(less servers.txt)
for IP in $servers
scp usernamehere@$IP:/var/log/monitor/file.txt

Esxi – Add historical stats to go over the 1 hour limit

The free version of esxi only allows you to view 1 hour of data through the vsphere tool.

To enable further historical stats simply amend the configuration file located within /etc/vmware/hostd directory. Amend the historical stats figure from false to true.

vi /etc/vmware/hostd/config.xml
<!-- Enable historical stats collection -->
<historicalStatsEnabled> true </historicalStatsEnabled>

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

<targets>YOURSERVERIPHERE@161 public</targets>
</snmpSettings> restart

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