Dustin's Blog

3/27/08 12:38 PM

RESTful api usage - Continued

As Trendrr usage continues to rise, I have been monitoring the memory usage of JBoss (the app server that Trendrr is run on) closely.  I typically just ssh to the server and use top or ps to check the memory and cpu usage.  I realized that this would be a perfect way to use the Trendrr api.  It only took a slight modification of my original cpu usage script and we are good to go.


#do a sample every ten minutes
sampleSeconds=600
#your api key would go here
apiKey={removed}

echo $memUsage

while [ 1 ]
do
    memUsage=`ps aux | grep -m 1 program.name=run.sh | nawk '{print $4}'`
    apiUrl="http://www.trendrr.com/api/simple?key=$apiKey&value=$memUsage"
    wget $apiUrl
    # Need to delete the file that wget saved.
    rm simple?*
    # Sleep until we take the next sample
    sleep $sampleSeconds
done


Add Comment:

You must be logged in to comment

TrendrrScratchpad

1/3

TrendrrSearch

What is: Trendrr?

Track, compare and share data, free. Identify trends across social graphs and networks, realize the potential of p2p, track engagement metrics, look at what is really happening, real time.

RecentBlog Entries

Featured Contributor

matt

This is a graph that I have been running for awhile now. I blogged it a few weeks back so it prob looks familiar (if any of you that have been payin ...

Read More

Trendrr: Featured Users

forgot password