Using emonCMS to display network speed test results

A nice example of an alternative use for emonCMS:

and a screenshot from the site:

1 Like

very nice! did you use speedtest-cli?

Only in my dreams! (wish my ISP connection ran that fast!) :disappointed:
(can’t really bellyache too much about it. 18Mbps isn’t too shabby.)
Can’t take any credit for this one.
Found it while searching for an answer to another topic.
Pretty slick, eh?

I must learn to read slower instead of skimming, I thought this was your speed test. :blush:

It is very slick. From the article, they do use speedtest-cli. I had installed and started to set this up on a RasPi, but other priorities came along. Too many fun projects in the queue!

Don’t feel like the Lone Ranger. Been there, done that, myself.

I know how that goes!

Cool, I do a similar thing with my main server :slight_smile:

1 Like

I like this more!

What do you do to monitor CPU usage?

I wrote a PERL script which monitors that and all the other infos by reading out WMI db of windows.
WMI has ALL information about a system stored. I use IIS for my other Website (Please make emonCMS IIS compatible by the way!!!) and you can even read out the connection infos per site! I love WMI :slight_smile:

#!/usr/bin/perl -w
use strict;
use warnings;
use LWP::Simple;

use Win32::OLE;

# Init WMI
my $wmi = Win32::OLE->GetObject("winmgmts://./root/cimv2")
    or die "Failed getobject\n";

# get WMI values
sub get_wmi{
	my $wmi = shift;
	my $list, my $v;
	my @properties = qw(PercentProcessorTime TimeStamp_Sys100NS);
	my $class = 'Win32_PerfRawData_PerfOS_Processor';
	my $key = 'Name';
	$list = $wmi->InstancesOf("$class")
		or die "Failed getobject\n";
	my $hash;
	foreach $v (in $list) {        
		$hash->{$v->{$key}}->{$_}  = $v->{$_} for @properties;

my $apikey="yourapikey";
my $host = "yourhostname";
my $IDDec = "CPU-Average";

# CPU  calculation
my $cpu;
my $hash_prev = get_wmi($wmi);

	sleep 5;
	my $hash = get_wmi($wmi);
	$cpu = sprintf("%.2f", 
			1 - (
					$hash->{'_Total'}->{'PercentProcessorTime'} - $hash_prev->{'_Total'}->{'PercentProcessorTime'}
				) / 
					$hash->{'_Total'}->{'TimeStamp_Sys100NS'} - $hash_prev->{'_Total'}->{'TimeStamp_Sys100NS'}
		)* 100 );	
	print "CPU=$cpu\n";	
	$hash_prev = $hash;
	my $url = "http://$host/input/post.json?node=$IDDec&json={CPU_Average:$cpu}&apikey=$apikey"; 
	my $content = get $url;
	print "Sending data to EmonCMS = $url\n";

Works on Windows 2003 Server and did work on Win7. I have to test it if is running on Win10 as the WMI store could have changed.

Hi Andreas,
Very quick test so far; but it seems like emonCMS works just fine under IIS - at least I registered a user, pointed my emonHub at it & I have inputs!
All I had to do was install PHP 7 from the Web Platform Installer, copy over the emoncms directory from WAMP\www to inetpub\wwwroot, add the emoncms application and import the .htaccess redirect rules (or at least pieces of) to create a (519 Bytes)

I guess the last piece to “Microsoftize” it SQL Server - I’ll take a quick look at that too.


Importing the .htaccess rules did not work for me and I never managed to get it running with manually creating them!
But maybe PHP7 can help here to. Thanks for the zip, I will definitely take a look at it!