ESXi – How to configure and enable SNMP

Just a quick PowerShell script that sets up SNMP on ESXI hosts

 

#Script to enable and configure SNMP on ESXI host
Get-VMHost | Select Name
$host_name = Read-Host "Host name:"
$location="London HQ"
$esxcli = get-esxcli -vmhost $host_name
$esxcli.system.snmp.set($null,"public","true",$null,$null,$null,$null,$null,$null,$null,$null,$null,$location)
$esxcli.system.snmp.get()
Write-host "Now go to the host and start the service"

Once that is done you still need to go the ESXi host and enable/start the SNMP service.

Postfix – sending emails via SMTP relay server (GMX.net)

This is an update to my previous post RE: sending via google SMTP relay but this time let’s use something bit more secure and private.

1. Go to http://gmx.net and set yourself up with an email account.

2.  Login to your Raspberry PI as root and run:

 sudo postconf -e 'relayhost = [mail.gmx.net]:587'
 sudo postconf -e 'smtp_sasl_auth_enable = yes'
 sudo postconf -e 'smtp_sasl_security_options = noanonymous'
 sudo postconf -e 'sender_canonical_maps = hash:/etc/postfix/sender_canonical'
 sudo postconf -e 'smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd'
 sudo su -c 'echo "login your_email@gmx.de" > /etc/postfix/sender_canonical'
 sudo su -c 'echo "login@domain.net your_email@gmx.de" > /etc/postfix/sender_canonical'
 sudo chown root:root /etc/postfix/sender_canonical
 sudo chmod 0600 /etc/postfix/sender_canonical
 sudo postmap /etc/postfix/sender_canonical
 sudo su -c 'echo "[mail.gmx.net]:587 your_email@gmx.de:password" > /etc/postfix/sasl_passwd'
 sudo chown root:root /etc/postfix/sasl_passwd
 sudo chmod 0600 /etc/postfix/sasl_passwd
 sudo postmap /etc/postfix/sasl_passwd

now just restart postfix:

service postfix restart

and test it, run:

tail -f /var/log/mail.log

and send test mail