Created
May 29, 2012 16:41
-
-
Save itsderek23/2829464 to your computer and use it in GitHub Desktop.
Scout's Javascript for handling realtime metrics via Pusher
This file contains hidden or 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
| var pusher = new Pusher(appKey,{encrypted: true}); | |
| var channel = pusher.subscribe(streamingKey); | |
| channel.bind('server_data', update); | |
| // The function that's called when we retrieve new data from the realtime_data action | |
| function update(server){ | |
| // example data | |
| // var server={"hostname": "nuevo.local","data": [{"name": "CPU Usage","fields": {"idle": 95, "system": 1,"user": 4}},{"fields":{"capacity":59.0,"avail":97.0,"size":233.0,"used":136.0},"name":"Disk Usage"}],"server_time": "02:38:11 PM"}; | |
| // append data to a smoothie chart | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment