← Back to team overview

graphite-dev team mailing list archive

[Question #97754]: perl script not working

 

New question #97754 on Graphite:
https://answers.launchpad.net/graphite/+question/97754

This script is not updating in graphite.  Any ideas?

output:

weather.temperature 35 1263766247
weather.humidity 64 1263766247
weather.wind_speed 6 1263766247


#!/usr/bin/perl -w

use IO::Socket;
use strict;
use Weather::Google;

# init host and port
my $host = '127.0.0.1';
my $port = 2003;

my $gw;

my $date = `date +%s`;

## Initialize the module
$gw = new Weather::Google(60657); # Zip code

my $temp = $gw->current_conditions('temp_f');

my $humidity = $gw->current_conditions('humidity');
$humidity =~ m#Humidity:(.*)%#;
$humidity = $1;

my $wind = $gw->current_conditions('wind_condition');
$wind =~ m#at (.*) mph#;
$wind = $1;

my $line1 = "weather.temperature $temp $date";
my $line2 = "weather.humidity$humidity $date";
my $line3 = "weather.wind_speed $wind $date";

my $line = "$line1$line2$line3";


my $sock = new IO::Socket::INET( PeerAddr => $host, PeerPort => $port, Proto => 'tcp');
$sock or die "no socket: $!";

$sock->send($line);
print $line;
close($sock); 


-- 
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.