diff --git a/lib/App/Netdisco/Backend/Worker/Poller/Expiry.pm b/lib/App/Netdisco/Backend/Worker/Poller/Expiry.pm index 9a942612..0c6703c9 100644 --- a/lib/App/Netdisco/Backend/Worker/Poller/Expiry.pm +++ b/lib/App/Netdisco/Backend/Worker/Poller/Expiry.pm @@ -76,11 +76,17 @@ sub expire { $schema->resultset('DevicePort')->count_rs({up => 'up'})->as_query, ip_table_count => $schema->resultset('NodeIp')->count_rs->as_query, + ip_active_count => + $schema->resultset('NodeIp')->search({-bool => 'active'}, + {columns => 'ip', distinct => 1})->count_rs->as_query, ip_count => $schema->resultset('NodeIp')->search(undef, {columns => 'ip', distinct => 1})->count_rs->as_query, node_table_count => $schema->resultset('Node')->count_rs->as_query, + node_active_count => + $schema->resultset('Node')->search({-bool => 'active'}, + {columns => 'mac', distinct => 1})->count_rs->as_query, node_count => $schema->resultset('Node')->search(undef, {columns => 'mac', distinct => 1})->count_rs->as_query, diff --git a/lib/App/Netdisco/DB/Result/Statistics.pm b/lib/App/Netdisco/DB/Result/Statistics.pm index ac02efd2..091687ae 100644 --- a/lib/App/Netdisco/DB/Result/Statistics.pm +++ b/lib/App/Netdisco/DB/Result/Statistics.pm @@ -22,10 +22,14 @@ __PACKAGE__->add_columns( { data_type => "integer", is_nullable => 0 }, "ip_table_count", { data_type => "integer", is_nullable => 0 }, + "ip_active_count", + { data_type => "integer", is_nullable => 0 }, "ip_count", { data_type => "integer", is_nullable => 0 }, "node_table_count", { data_type => "integer", is_nullable => 0 }, + "node_active_count", + { data_type => "integer", is_nullable => 0 }, "node_count", { data_type => "integer", is_nullable => 0 }, diff --git a/share/schema_versions/App-Netdisco-DB-43-44-PostgreSQL.sql b/share/schema_versions/App-Netdisco-DB-43-44-PostgreSQL.sql index f546c318..c495df72 100644 --- a/share/schema_versions/App-Netdisco-DB-43-44-PostgreSQL.sql +++ b/share/schema_versions/App-Netdisco-DB-43-44-PostgreSQL.sql @@ -9,8 +9,10 @@ CREATE TABLE "statistics" ( "device_port_count" integer NOT NULL, "device_port_up_count" integer NOT NULL, "ip_table_count" integer NOT NULL, + "ip_active_count" integer NOT NULL, "ip_count" integer NOT NULL, "node_table_count" integer NOT NULL, + "node_active_count" integer NOT NULL, "node_count" integer NOT NULL, "netdisco_ver" text,