rename davolink table and collect queued and ok
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 5 Jul 2011 18:53:23 +0000 (20:53 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 5 Jul 2011 18:55:10 +0000 (20:55 +0200)
lib/APKPM/CPE.pm
lib/APKPM/Davolink.pm
lib/APKPM/EasyGateway.pm
sql/adsl.sql [deleted file]
sql/davolink.sql [new file with mode: 0644]

index 96848c2..06e2d44 100644 (file)
@@ -104,10 +104,10 @@ sub ping : Job : Decode(d_array) : Encode(e_json) {
        });
 
        if ( $vendor =~ m/SAMSUNG/ ) {
-               $redis->sadd( 'CPE.Davolink' => $username );
+               $redis->sadd( 'CPE.Davolink.queued' => $username );
                $self->do_background( 'Davolink_info', "$ip $username adsl" );
        } elsif ( $vendor =~ m/zte/ ) {
-               $redis->sadd( 'CPE.EasyGateway' => $username );
+               $redis->sadd( 'CPE.EasyGateway.queued' => $username );
                $self->do_background( 'EasyGateway_info', $ip );
        } else {
                $redis->sadd( 'CPE.skipped' => $username );
index 1ac2f1a..c802021 100644 (file)
@@ -35,14 +35,14 @@ sub info : Job : Decode(d_array) : Encode(e_json) {
                } elsif ( $param =~ m/adsl/i ) {
                        $ret->{ADSL} = { $cpeconnect->adsl_info };
                        $self->do_background_json( 'Store_insert', {
-                               _table => 'adsl',
+                               _table => 'davolink',
                                ip => $cpeip,
                                username => $username,
                                timestamp => $self->datetime_now,
                                %{$ret->{ADSL}}
                        });
                        my $redis = Redis->new;
-                       $redis->sadd( 'poll.adsl.ok' => $cpeip );
+                       $redis->sadd( 'CPE.Davolink.ok' => $cpeip );
                } elsif ( $param =~ m/wan/i ) {
                        $ret->{WAN} = [ $cpeconnect->wan_info ];
                } elsif ( $param =~ m/route/i ) {
index 6aec408..d77614b 100644 (file)
@@ -47,7 +47,7 @@ sub info : Job : Decode(d_array) : Encode(e_json) {
        });
 
        my $redis = Redis->new;
-       $redis->sadd( 'poll.EasyGateway.ok' => $ip );
+       $redis->sadd( 'CPE.EasyGateway.ok' => $ip );
 
        return $ret;
 }
diff --git a/sql/adsl.sql b/sql/adsl.sql
deleted file mode 100644 (file)
index e8053a1..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-create table adsl (
-ip inet not null,
-username text not null,
-timestamp timestamp default now(),
-SNRTX float,
-ATTNTX float,
-MAXTX integer,
-PWRTX float,
-PWRRX float,
-TX integer,
-RX integer,
-MAXRX integer,
-ATTNRX float,
-SNRRX float
-);
-
--- columns used in where for gnuplot
-create index adsl_username on adsl(username);
-create index adsl_timestamp on adsl(timestamp) ;
-
diff --git a/sql/davolink.sql b/sql/davolink.sql
new file mode 100644 (file)
index 0000000..8d619b5
--- /dev/null
@@ -0,0 +1,20 @@
+create table davolink (
+ip inet not null,
+username text not null,
+timestamp timestamp default now(),
+SNRTX float,
+ATTNTX float,
+MAXTX integer,
+PWRTX float,
+PWRRX float,
+TX integer,
+RX integer,
+MAXRX integer,
+ATTNRX float,
+SNRRX float
+);
+
+-- columns used in where for gnuplot
+create index davolink_username on davolink(username);
+create index davolink_timestamp on davolink(timestamp) ;
+