Skip to content

Instantly share code, notes, and snippets.

@halit
Created June 7, 2012 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halit/2891358 to your computer and use it in GitHub Desktop.
Save halit/2891358 to your computer and use it in GitHub Desktop.
Python Sms Server Status Sender
#!/usr/bin/env python
import tweepy
import os
import commands
consumer_anahtari = 'consumer_key yaziniz'
consumer_gizli = 'consumer_secret yaziniz'
giris_anahtari = 'access_key yaziniz'
giris_gizli = 'access_secret yaziniz'
baglanti = commands.getoutput('echo `netstat -an|wc -l`')
load = commands.getoutput("""uptime | awk -F "load average: " '{ print $2 }' | cut -d, -f1 | cut -d. -f1""")
syn = commands.getoutput('netstat -n | grep SYN | wc -l')
memory = commands.getoutput("""free -t -m | grep "Total" | awk '{ print "Kullanilan : "$3" MB Bosta : "$4" MB";}'""")
auth = tweepy.OAuthHandler(consumer_anahtari, consumer_gizli)
auth.set_access_token(giris_anahtari, giris_gizli)
api = tweepy.API(auth)
api.update_status("Toplam " + baglanti + " baglanti var.Sistem load su anda " + load + " .Toplam " + syn + " syn paketi bulundu. " + memory + " ." )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment