Created
June 7, 2012 20:28
-
-
Save halit/2891358 to your computer and use it in GitHub Desktop.
Python Sms Server Status Sender
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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