New Poller daemon worker can discover and refresh devices. New Scheduler daemon worker replaces the cron jobs with config. New netdisco-do script allows running a job one-off from CLI. Squashed commit of the following: commitfa25f36e14Author: Oliver Gorwits <oliver@cpan.org> Date: Wed Apr 10 22:43:47 2013 +0100 fix HTTP port at 5000 commit202ea4a84cAuthor: Oliver Gorwits <oliver@cpan.org> Date: Wed Apr 10 22:33:03 2013 +0100 bug fixes in discover commit925d9e4d6bAuthor: Oliver Gorwits <oliver@cpan.org> Date: Wed Apr 10 21:51:44 2013 +0100 add mini app for one-time jobs commitd3a6c08a9dAuthor: Oliver Gorwits <oliver@cpan.org> Date: Wed Apr 10 21:46:55 2013 +0100 better name for subaction commit4adf473b20Author: Oliver Gorwits <oliver@cpan.org> Date: Wed Apr 10 20:15:18 2013 +0100 add logging of db add/del commit8aacafedaaAuthor: Oliver Gorwits <oliver@cpan.org> Date: Wed Apr 10 19:49:00 2013 +0100 copy all remaining messages from netdisco 1 commit3e1156df1fAuthor: Oliver Gorwits <oliver@cpan.org> Date: Mon Apr 8 22:09:40 2013 +0100 alter some log levels and messages commite7ea92920fAuthor: Oliver Gorwits <oliver@cpan.org> Date: Mon Apr 8 20:32:33 2013 +0100 store wireless ssid and port info to DB commitd1d16938a1Author: Oliver Gorwits <oliver@cpan.org> Date: Fri Apr 5 08:52:59 2013 +0100 update packaging for new files and deps commit965990786fAuthor: Oliver Gorwits <oliver@cpan.org> Date: Thu Apr 4 22:22:50 2013 +0100 implementation of find_neighbors commit03c4d8ef09Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Apr 4 20:42:11 2013 +0100 add discoverall and discover_neighbors poller jobs commitdf68ff0890Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Apr 4 19:52:37 2013 +0100 implementation of store_modules commitc2ac19e647Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Apr 4 19:32:14 2013 +0100 implementation of store_power commitb7fb8c64a0Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Apr 4 18:48:09 2013 +0100 implementation of store_vlans commitb8ddbd1ecaAuthor: Oliver Gorwits <oliver@cpan.org> Date: Thu Apr 4 17:08:06 2013 +0100 implementation of store_wireless (without storing, yet) commit2a14057481Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Apr 4 16:47:21 2013 +0100 implementation of store_interfaces (without wireless) commitd5b2b71d34Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Apr 4 15:12:19 2013 +0100 only start Manager if there are pollers or interactives commitf4a3dac760Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Apr 4 15:03:10 2013 +0100 change sub names so as not to collide with Dancer commita8f0894986Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Apr 4 14:47:28 2013 +0100 implementation of refresh, discover, and store_device commit4c2e3cf82dAuthor: Oliver Gorwits <oliver@cpan.org> Date: Thu Apr 4 11:38:15 2013 +0100 make get_device return a new result object commite6ac131658Author: Oliver Gorwits <oliver@cpan.org> Date: Thu Apr 4 10:38:22 2013 +0100 better POD section name commit6c5b6bbbeeAuthor: Oliver Gorwits <oliver@cpan.org> Date: Thu Apr 4 10:37:46 2013 +0100 implement separate snmp_connect and snmp_connect_rw methods commit62c8e19063Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Apr 1 20:06:29 2013 +0100 fix for unique constraint on job queue for locally queued jobs commitebb65996e6Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Apr 1 20:00:36 2013 +0100 add refresh poller job commit05928e8cf6Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Apr 1 19:31:39 2013 +0100 Refactor Util namespace Squashed commit of the following: commit789c528fcfAuthor: Oliver Gorwits <oliver@cpan.org> Date: Mon Apr 1 19:31:07 2013 +0100 update manifest and fix typo commitb95d0951f2Author: Oliver Gorwits <oliver@cpan.org> Date: Mon Apr 1 19:22:41 2013 +0100 refactor ::Util namespace commita8dde50343Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 31 13:45:27 2013 +0100 no need to search for device - IP should already be exact commitb42daee4c1Merge:6e5276295bb8fcAuthor: Oliver Gorwits <oliver@cpan.org> Date: Wed Mar 27 21:00:09 2013 +0000 Merge branch 'master' into og-poller commit6e527629a2Author: Oliver Gorwits <oliver@cpan.org> Date: Tue Mar 26 23:39:23 2013 +0000 fixes and log messages commitcfcb7a956fAuthor: Oliver Gorwits <oliver@cpan.org> Date: Tue Mar 26 22:57:06 2013 +0000 bug fixes commit48f779a8d0Author: Oliver Gorwits <oliver@cpan.org> Date: Tue Mar 26 22:42:16 2013 +0000 add config for scheduled tasks commit2f6efcb312Author: Oliver Gorwits <oliver@cpan.org> Date: Tue Mar 26 22:15:04 2013 +0000 create poller worker and add poller type stubs commit52b28b0ab8Author: Oliver Gorwits <oliver@cpan.org> Date: Tue Mar 26 22:04:00 2013 +0000 code tidy commit96db66739fAuthor: Oliver Gorwits <oliver@cpan.org> Date: Mon Mar 25 22:35:11 2013 +0000 more insane but more working version of the job queue constraint commitcb25216f40Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 24 20:22:11 2013 +0000 make scheduler start automatic based on housekeeping setting existing commit0acbe8abd3Author: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 24 19:45:24 2013 +0000 add scheduler based on Algorithm::Cron commit49d136b57aAuthor: Oliver Gorwits <oliver@cpan.org> Date: Sun Mar 24 18:48:10 2013 +0000 add unique constraint on admin/job queue
437 lines
9.1 KiB
SQL
437 lines
9.1 KiB
SQL
--
|
|
-- Created by SQL::Translator::Producer::PostgreSQL
|
|
-- Created on Sun Mar 24 18:45:08 2013
|
|
--
|
|
--
|
|
-- Table: admin.
|
|
--
|
|
DROP TABLE "admin" CASCADE;
|
|
CREATE TABLE "admin" (
|
|
"job" serial NOT NULL,
|
|
"entered" timestamp DEFAULT current_timestamp,
|
|
"started" timestamp,
|
|
"finished" timestamp,
|
|
"device" inet,
|
|
"port" text,
|
|
"action" text,
|
|
"subaction" text,
|
|
"status" text,
|
|
"username" text,
|
|
"userip" inet,
|
|
"log" text,
|
|
"debug" boolean,
|
|
PRIMARY KEY ("job"),
|
|
);
|
|
|
|
CREATE UNIQUE INDEX jobs_queued ON admin (
|
|
action,
|
|
coalesce(subaction, '_x_'),
|
|
coalesce(device, '255.255.255.255'),
|
|
coalesce(port, '_x_')
|
|
) WHERE status LIKE 'queued%';
|
|
|
|
--
|
|
-- Table: device.
|
|
--
|
|
DROP TABLE "device" CASCADE;
|
|
CREATE TABLE "device" (
|
|
"ip" inet NOT NULL,
|
|
"creation" timestamp DEFAULT current_timestamp,
|
|
"dns" text,
|
|
"description" text,
|
|
"uptime" bigint,
|
|
"contact" text,
|
|
"name" text,
|
|
"location" text,
|
|
"layers" character varying(8),
|
|
"ports" integer,
|
|
"mac" macaddr,
|
|
"serial" text,
|
|
"model" text,
|
|
"ps1_type" text,
|
|
"ps2_type" text,
|
|
"ps1_status" text,
|
|
"ps2_status" text,
|
|
"fan" text,
|
|
"slots" integer,
|
|
"vendor" text,
|
|
"os" text,
|
|
"os_ver" text,
|
|
"log" text,
|
|
"snmp_ver" integer,
|
|
"snmp_comm" text,
|
|
"snmp_class" text,
|
|
"vtp_domain" text,
|
|
"last_discover" timestamp,
|
|
"last_macsuck" timestamp,
|
|
"last_arpnip" timestamp,
|
|
PRIMARY KEY ("ip")
|
|
);
|
|
|
|
--
|
|
-- Table: device_module.
|
|
--
|
|
DROP TABLE "device_module" CASCADE;
|
|
CREATE TABLE "device_module" (
|
|
"ip" inet NOT NULL,
|
|
"index" integer NOT NULL,
|
|
"description" text,
|
|
"type" text,
|
|
"parent" integer,
|
|
"name" text,
|
|
"class" text,
|
|
"pos" integer,
|
|
"hw_ver" text,
|
|
"fw_ver" text,
|
|
"sw_ver" text,
|
|
"serial" text,
|
|
"model" text,
|
|
"fru" boolean,
|
|
"creation" timestamp DEFAULT current_timestamp,
|
|
"last_discover" timestamp,
|
|
PRIMARY KEY ("ip", "index")
|
|
);
|
|
|
|
--
|
|
-- Table: device_port_log.
|
|
--
|
|
DROP TABLE "device_port_log" CASCADE;
|
|
CREATE TABLE "device_port_log" (
|
|
"id" serial NOT NULL,
|
|
"ip" inet,
|
|
"port" text,
|
|
"reason" text,
|
|
"log" text,
|
|
"username" text,
|
|
"userip" inet,
|
|
"action" text,
|
|
"creation" timestamp DEFAULT current_timestamp
|
|
);
|
|
|
|
--
|
|
-- Table: device_port_ssid.
|
|
--
|
|
DROP TABLE "device_port_ssid" CASCADE;
|
|
CREATE TABLE "device_port_ssid" (
|
|
"ip" inet,
|
|
"port" text,
|
|
"ssid" text,
|
|
"broadcast" boolean,
|
|
"bssid" macaddr
|
|
);
|
|
|
|
--
|
|
-- Table: device_port_wireless.
|
|
--
|
|
DROP TABLE "device_port_wireless" CASCADE;
|
|
CREATE TABLE "device_port_wireless" (
|
|
"ip" inet,
|
|
"port" text,
|
|
"channel" integer,
|
|
"power" integer
|
|
);
|
|
|
|
--
|
|
-- Table: device_power.
|
|
--
|
|
DROP TABLE "device_power" CASCADE;
|
|
CREATE TABLE "device_power" (
|
|
"ip" inet NOT NULL,
|
|
"module" integer NOT NULL,
|
|
"power" integer,
|
|
"status" text,
|
|
PRIMARY KEY ("ip", "module")
|
|
);
|
|
|
|
--
|
|
-- Table: device_route.
|
|
--
|
|
DROP TABLE "device_route" CASCADE;
|
|
CREATE TABLE "device_route" (
|
|
"ip" inet NOT NULL,
|
|
"network" cidr NOT NULL,
|
|
"creation" timestamp DEFAULT current_timestamp,
|
|
"dest" inet NOT NULL,
|
|
"last_discover" timestamp DEFAULT current_timestamp,
|
|
PRIMARY KEY ("ip", "network", "dest")
|
|
);
|
|
|
|
--
|
|
-- Table: log.
|
|
--
|
|
DROP TABLE "log" CASCADE;
|
|
CREATE TABLE "log" (
|
|
"id" serial NOT NULL,
|
|
"creation" timestamp DEFAULT current_timestamp,
|
|
"class" text,
|
|
"entry" text,
|
|
"logfile" text
|
|
);
|
|
|
|
--
|
|
-- Table: node_ip.
|
|
--
|
|
DROP TABLE "node_ip" CASCADE;
|
|
CREATE TABLE "node_ip" (
|
|
"mac" macaddr NOT NULL,
|
|
"ip" inet NOT NULL,
|
|
"dns" text,
|
|
"active" boolean,
|
|
"time_first" timestamp DEFAULT current_timestamp,
|
|
"time_last" timestamp DEFAULT current_timestamp,
|
|
PRIMARY KEY ("mac", "ip")
|
|
);
|
|
|
|
--
|
|
-- Table: node_monitor.
|
|
--
|
|
DROP TABLE "node_monitor" CASCADE;
|
|
CREATE TABLE "node_monitor" (
|
|
"mac" macaddr NOT NULL,
|
|
"active" boolean,
|
|
"why" text,
|
|
"cc" text,
|
|
"date" timestamp DEFAULT current_timestamp,
|
|
PRIMARY KEY ("mac")
|
|
);
|
|
|
|
--
|
|
-- Table: node_nbt.
|
|
--
|
|
DROP TABLE "node_nbt" CASCADE;
|
|
CREATE TABLE "node_nbt" (
|
|
"mac" macaddr NOT NULL,
|
|
"ip" inet,
|
|
"nbname" text,
|
|
"domain" text,
|
|
"server" boolean,
|
|
"nbuser" text,
|
|
"active" boolean,
|
|
"time_first" timestamp DEFAULT current_timestamp,
|
|
"time_last" timestamp DEFAULT current_timestamp,
|
|
PRIMARY KEY ("mac")
|
|
);
|
|
|
|
--
|
|
-- Table: node_wireless.
|
|
--
|
|
DROP TABLE "node_wireless" CASCADE;
|
|
CREATE TABLE "node_wireless" (
|
|
"mac" macaddr NOT NULL,
|
|
"uptime" integer,
|
|
"maxrate" integer,
|
|
"txrate" integer,
|
|
"sigstrength" integer,
|
|
"sigqual" integer,
|
|
"rxpkt" integer,
|
|
"txpkt" integer,
|
|
"rxbyte" bigint,
|
|
"txbyte" bigint,
|
|
"time_last" timestamp DEFAULT current_timestamp,
|
|
"ssid" text DEFAULT '' NOT NULL,
|
|
PRIMARY KEY ("mac", "ssid")
|
|
);
|
|
|
|
--
|
|
-- Table: oui.
|
|
--
|
|
DROP TABLE "oui" CASCADE;
|
|
CREATE TABLE "oui" (
|
|
"oui" character varying(8) NOT NULL,
|
|
"company" text,
|
|
PRIMARY KEY ("oui")
|
|
);
|
|
|
|
--
|
|
-- Table: process.
|
|
--
|
|
DROP TABLE "process" CASCADE;
|
|
CREATE TABLE "process" (
|
|
"controller" integer NOT NULL,
|
|
"device" inet NOT NULL,
|
|
"action" text NOT NULL,
|
|
"status" text,
|
|
"count" integer,
|
|
"creation" timestamp DEFAULT current_timestamp
|
|
);
|
|
|
|
--
|
|
-- Table: sessions.
|
|
--
|
|
DROP TABLE "sessions" CASCADE;
|
|
CREATE TABLE "sessions" (
|
|
"id" character(32) NOT NULL,
|
|
"creation" timestamp DEFAULT current_timestamp,
|
|
"a_session" text,
|
|
PRIMARY KEY ("id")
|
|
);
|
|
|
|
--
|
|
-- Table: subnets.
|
|
--
|
|
DROP TABLE "subnets" CASCADE;
|
|
CREATE TABLE "subnets" (
|
|
"net" cidr NOT NULL,
|
|
"creation" timestamp DEFAULT current_timestamp,
|
|
"last_discover" timestamp DEFAULT current_timestamp,
|
|
PRIMARY KEY ("net")
|
|
);
|
|
|
|
--
|
|
-- Table: topology.
|
|
--
|
|
DROP TABLE "topology" CASCADE;
|
|
CREATE TABLE "topology" (
|
|
"dev1" inet NOT NULL,
|
|
"port1" text NOT NULL,
|
|
"dev2" inet NOT NULL,
|
|
"port2" text NOT NULL
|
|
);
|
|
|
|
--
|
|
-- Table: user_log.
|
|
--
|
|
DROP TABLE "user_log" CASCADE;
|
|
CREATE TABLE "user_log" (
|
|
"entry" serial NOT NULL,
|
|
"username" character varying(50),
|
|
"userip" inet,
|
|
"event" text,
|
|
"details" text,
|
|
"creation" timestamp DEFAULT current_timestamp
|
|
);
|
|
|
|
--
|
|
-- Table: users.
|
|
--
|
|
DROP TABLE "users" CASCADE;
|
|
CREATE TABLE "users" (
|
|
"username" character varying(50) NOT NULL,
|
|
"password" text,
|
|
"creation" timestamp DEFAULT current_timestamp,
|
|
"last_on" timestamp,
|
|
"port_control" boolean DEFAULT false,
|
|
"ldap" boolean DEFAULT false,
|
|
"admin" boolean DEFAULT false,
|
|
"fullname" text,
|
|
"note" text,
|
|
PRIMARY KEY ("username")
|
|
);
|
|
|
|
--
|
|
-- Table: device_vlan.
|
|
--
|
|
DROP TABLE "device_vlan" CASCADE;
|
|
CREATE TABLE "device_vlan" (
|
|
"ip" inet NOT NULL,
|
|
"vlan" integer NOT NULL,
|
|
"description" text,
|
|
"creation" timestamp DEFAULT current_timestamp,
|
|
"last_discover" timestamp DEFAULT current_timestamp,
|
|
PRIMARY KEY ("ip", "vlan")
|
|
);
|
|
CREATE INDEX "device_vlan_idx_ip" on "device_vlan" ("ip");
|
|
|
|
--
|
|
-- Table: device_ip.
|
|
--
|
|
DROP TABLE "device_ip" CASCADE;
|
|
CREATE TABLE "device_ip" (
|
|
"ip" inet NOT NULL,
|
|
"alias" inet NOT NULL,
|
|
"subnet" cidr,
|
|
"port" text,
|
|
"dns" text,
|
|
"creation" timestamp DEFAULT current_timestamp,
|
|
PRIMARY KEY ("ip", "alias"),
|
|
CONSTRAINT "device_ip_alias" UNIQUE ("alias")
|
|
);
|
|
CREATE INDEX "device_ip_idx_ip" on "device_ip" ("ip");
|
|
CREATE INDEX "device_ip_idx_ip_port" on "device_ip" ("ip", "port");
|
|
|
|
--
|
|
-- Table: device_port.
|
|
--
|
|
DROP TABLE "device_port" CASCADE;
|
|
CREATE TABLE "device_port" (
|
|
"ip" inet NOT NULL,
|
|
"port" text NOT NULL,
|
|
"creation" timestamp DEFAULT current_timestamp,
|
|
"descr" text,
|
|
"up" text,
|
|
"up_admin" text,
|
|
"type" text,
|
|
"duplex" text,
|
|
"duplex_admin" text,
|
|
"speed" text,
|
|
"name" text,
|
|
"mac" macaddr,
|
|
"mtu" integer,
|
|
"stp" text,
|
|
"remote_ip" inet,
|
|
"remote_port" text,
|
|
"remote_type" text,
|
|
"remote_id" text,
|
|
"vlan" text,
|
|
"pvid" integer,
|
|
"lastchange" bigint,
|
|
PRIMARY KEY ("port", "ip")
|
|
);
|
|
CREATE INDEX "device_port_idx_ip" on "device_port" ("ip");
|
|
CREATE INDEX "device_port_idx_remote_ip" on "device_port" ("remote_ip");
|
|
|
|
--
|
|
-- Table: device_port_power.
|
|
--
|
|
DROP TABLE "device_port_power" CASCADE;
|
|
CREATE TABLE "device_port_power" (
|
|
"ip" inet NOT NULL,
|
|
"port" text NOT NULL,
|
|
"module" integer,
|
|
"admin" text,
|
|
"status" text,
|
|
"class" text,
|
|
"power" integer,
|
|
PRIMARY KEY ("port", "ip")
|
|
);
|
|
CREATE INDEX "device_port_power_idx_ip_port" on "device_port_power" ("ip", "port");
|
|
|
|
--
|
|
-- Table: device_port_vlan.
|
|
--
|
|
DROP TABLE "device_port_vlan" CASCADE;
|
|
CREATE TABLE "device_port_vlan" (
|
|
"ip" inet NOT NULL,
|
|
"port" text NOT NULL,
|
|
"vlan" integer NOT NULL,
|
|
"native" boolean DEFAULT false NOT NULL,
|
|
"creation" timestamp DEFAULT current_timestamp,
|
|
"last_discover" timestamp DEFAULT current_timestamp,
|
|
"vlantype" text,
|
|
PRIMARY KEY ("ip", "port", "vlan")
|
|
);
|
|
CREATE INDEX "device_port_vlan_idx_ip" on "device_port_vlan" ("ip");
|
|
CREATE INDEX "device_port_vlan_idx_ip_port" on "device_port_vlan" ("ip", "port");
|
|
CREATE INDEX "device_port_vlan_idx_ip_vlan" on "device_port_vlan" ("ip", "vlan");
|
|
|
|
--
|
|
-- Table: node.
|
|
--
|
|
DROP TABLE "node" CASCADE;
|
|
CREATE TABLE "node" (
|
|
"mac" macaddr NOT NULL,
|
|
"switch" inet NOT NULL,
|
|
"port" text NOT NULL,
|
|
"active" boolean,
|
|
"oui" character varying(8),
|
|
"time_first" timestamp DEFAULT current_timestamp,
|
|
"time_recent" timestamp DEFAULT current_timestamp,
|
|
"time_last" timestamp DEFAULT current_timestamp,
|
|
"vlan" text DEFAULT '0' NOT NULL,
|
|
PRIMARY KEY ("mac", "switch", "port", "vlan")
|
|
);
|
|
CREATE INDEX "node_idx_switch" on "node" ("switch");
|
|
CREATE INDEX "node_idx_switch_port" on "node" ("switch", "port");
|
|
CREATE INDEX "node_idx_oui" on "node" ("oui");
|
|
|