Jump to content

Recommended Posts

Posted (edited)

You might want to store statistics about your system status or some events. I.e. the CPU usage in 30 seconds intervals, or how long some task took at some moment. And you might want to visualize it with nice graphs that you can zoom, combine, filter,... Take a look to for a better introduction:

http://codeascraft.etsy.com/2011/02/15/measure-anything-measure-everything/

Unfortunately, the server that listens for stats in an UDP port (StatsD) and the one that stores and serves them in nice Web GUI (Graphite), can only be installed in Linux operating systems (at the time of this post).

If you want to collect stats in Windows systems using AutoIt, the easiest way is to create and start a headless VM running a Linux server with StatsD and Graphite. It consumes as little as 0.5% of the CPU, even less in periods when no stats are being sent and recorded. Just follow the following steps:

1) install free Oracle VirtualBox (https://www.virtualbox.org/)

2) install Vagrant (http://vagrantup.com/)

3) download, install and start a pre-configured StatsD+Graphite VM, following this post: http://warwickp.com/2012/03/vagrant-box-with-graphite-statsd-gdash-nginx

That's it! Now just use the script in this post to send stats like this:

Local $conn = StatsdOpen("33.33.33.34", 8125)
If @error Or (IsArray($conn) And $conn[0] = 0) Then
ConsoleWrite("StatsdOpen - UDPOpen returned error: " & @error & @LF)
Exit
EndIf
$result = StatsdGauge($conn, "autoit.gauge", 50)
$result = StatsdCount($conn, "autoit.count", 10)
$result = StatsdInc($conn, "autoit.count")
$result = StatsdDec($conn, "autoit.count")
$result = StatsdTiming($conn, "autoit.timing", 100)

You can view the results opening a web browser and directing it to http://33.33.33.34.

Enjoy!

================================================

Edited on 24-july-2012:

- new version of Statsd.au3, with new function StatsdClose()

- also, if you want to use Gauge stats, you'll need to update the StatsD server that comes with the Virtual Machine of the link. In order to do that:

1) use Putty to perform SSH to address 33.33.33.34, port 22, with username = password = "vagrant".

2) # su (password is "vagrant"),

3) # /etc/init.d/statsd stop

4) # cd /opt/statsd

5) # git pull

6) # /etc/init.d/statsd start

statsd.au3

Edited by kasty
  • 2 weeks later...
Posted (edited)

This is amazing and extremely useful!

Thank you very much for it

BTW

You wrote

"Unfortunately,

the server that listens for stats in an UDP port (StatsD),

and the one that stores and serves them in nice Web GUI (Graphite),

can only be installed in Linux operating systems (at the time of this post)."

It's not that unfortunate:

Every Hosting package runs on Linux.

So it's natural that If someone has a program, he mostlikely has a website,

so he can install StatsD there..

Edited by Zohar

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...