Skip to content

Instantly share code, notes, and snippets.

@urbans
urbans / app.yaml
Created April 12, 2012 20:55
Server supervisor on GAE
application: ****your app name****
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
script: main.py
@urbans
urbans / heartbeat_solaris.py
Created April 12, 2012 20:49
Send Solaris machine heartbeat to a supervisor on GAE
#!/usr/bin/python
import commands
import httplib
from urllib import urlencode
import time
servername = 'MrSolaris'
data = commands.getoutput('zpool list') + "\r\n\r\n" + "Uptime: " + commands.getoutput('uptime') + "\r\nDate: " + commands.getoutput('date') + "\r\n\r\n" + "Uptime: " + commands.getoutput('zpool status -v')
@urbans
urbans / heartbeat_linux.py
Created April 12, 2012 20:47
Send Linux machine heartbeat to a supervisor on GAE
#!/usr/bin/python
import commands
import httplib
from urllib import urlencode
import time
servername = 'MrPenguin'
data = commands.getoutput('df -h') + "\r\n\r\n" + "Uptime: " + commands.getoutput('uptime') + "\r\nDate: " + commands.getoutput("date -R") + "\r\n\r\n"
@urbans
urbans / send_mail.py
Created April 12, 2012 20:23
Server status via email (python)
import smtplib
import commands
# Email details
from_address = 'Status reporter<my.status.reporter@gmail.com>'
to_address = 'recipient@gmail.com'
message_subject = "My server daily report"
# Credentials
username = 'my.status.reporter@gmail.com'