From e4a8e284c0c1fb1bcdec070167c8a2e76363c52e Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Thu, 16 Feb 2012 12:19:40 +0000 Subject: [PATCH] new system for sql updates -- PLEASE BACK UP YOUR DATABASE BEFORE UPGRADING (yes, it's upgrade-tested on different systems, but better safe than sorry) git-svn-id: http://www.observium.org/svn/observer/trunk@2867 61d68cd4-352d-0410-923a-c4978735b2b8 --- database-update.sql | 1 + discovery.php | 65 +- includes/sql-schema/update.php | 106 +++ sql-schema/001.sql | 1229 ++++++++++++++++++++++++++++++++ sql-schema/002.sql | 121 ++++ sql-schema/003.sql | 42 ++ sql-schema/004.sql | 50 ++ sql-schema/005.sql | 13 + sql-schema/006.sql | 6 + sql-schema/007.sql | 1 + 10 files changed, 1570 insertions(+), 64 deletions(-) create mode 100644 includes/sql-schema/update.php create mode 100644 sql-schema/001.sql create mode 100644 sql-schema/002.sql create mode 100644 sql-schema/003.sql create mode 100644 sql-schema/004.sql create mode 100644 sql-schema/005.sql create mode 100644 sql-schema/006.sql create mode 100644 sql-schema/007.sql diff --git a/database-update.sql b/database-update.sql index bf0f01283..ac1e9b194 100644 --- a/database-update.sql +++ b/database-update.sql @@ -4,3 +4,4 @@ CREATE TABLE IF NOT EXISTS `loadbalancer_vservers` ( `classmap_id` int(11) NOT ALTER TABLE `sensors` CHANGE `sensor_index` `sensor_index` VARCHAR( 64 ); CREATE TABLE IF NOT EXISTS `netscaler_vservers` ( `vsvr_id` int(11) NOT NULL AUTO_INCREMENT, `device_id` int(11) NOT NULL, `vsvr_name` varchar(128) COLLATE utf8_unicode_ci NOT NULL, `vsvr_ip` varchar(128) COLLATE utf8_unicode_ci NOT NULL, `vsvr_port` int(8) NOT NULL, `vsvr_type` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `vsvr_state` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `vsvr_clients` int(11) NOT NULL, `vsvr_server` int(11) NOT NULL, `vsvr_req_rate` int(11) NOT NULL, `vsvr_bps_in` int(11) NOT NULL, `vsvr_bps_out` int(11) NOT NULL, PRIMARY KEY (`vsvr_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ; ALTER TABLE `dbSchema` ADD `version` INT DEFAULT 6; + diff --git a/discovery.php b/discovery.php index 04cc95acb..6013b0964 100755 --- a/discovery.php +++ b/discovery.php @@ -90,70 +90,7 @@ if (!$where) exit; } -if (file_exists('.svn')) -{ - list(,$dbu_rev) = preg_split('/: /',@shell_exec('svn info database-update.sql|grep ^Revision')); - - if ($db_rev = @dbFetchCell("SELECT revision FROM `dbSchema`")) {} else - { - $db_rev = 0; - } - - if ($db_rev+0 < 1223) - { - include('upgrade-scripts/fix-events.php'); ## Fix events table (needs to copy some data around, so needs script) - } - - if ($db_rev+0 < 1656) - { - include('upgrade-scripts/fix-port-rrd.php'); ## Rewrites all port RRDs. Nothing will work without this after 1656 - } - - if ($db_rev+0 < 1757) - { - include('upgrade-scripts/fix-sensor-rrd.php'); ## Rewrites all sensor RRDs. Nothing will work without this after 1757 - } - - if ($db_rev+0 < 2758) - { - include('upgrade-scripts/fix-billing-2758.inc.php'); ## Rewrites all sensor RRDs. Nothing will work without this after 1757 - } - - if ($dbu_rev+0 > $db_rev) - { - echo("SVN revision changed.\n"); - if ($db_rev+0 < "1000") - { - echo("Running pre-revision 1000 SQL update script...\n"); - shell_exec("scripts/update-sql.php database-update-pre1000.sql"); - } - if ($db_rev+0 < "1435") - { - echo("Running pre-revision 1435 SQL update script...\n"); - shell_exec("scripts/update-sql.php database-update-pre1435.sql"); - } - if ($db_rev+0 < "2245") - { - echo("Running pre-revision 2245 (0.11.5) SQL update script...\n"); - shell_exec("scripts/update-sql.php database-update-pre2245.sql"); - } - if ($db_rev+0 < "2804") - { - echo("Running pre-revision 2804 (0.11.12) SQL update script...\n"); - shell_exec("scripts/update-sql.php database-update-pre2804.sql"); - } - echo("Running development SQL update script to update from r$db_rev to r" . trim($dbu_rev) . "...\n"); - shell_exec("scripts/update-sql.php database-update.sql"); - if ($db_rev == 0) - { - dbInsert(array('revision' => $dbu_rev), 'dbSchema'); - } - else - { - dbUpdate(array('revision' => $dbu_rev), 'dbSchema'); - } - } -} +include("includes/sql-schema/update.php"); $discovered_devices = 0; diff --git a/includes/sql-schema/update.php b/includes/sql-schema/update.php new file mode 100644 index 000000000..1ad419f17 --- /dev/null +++ b/includes/sql-schema/update.php @@ -0,0 +1,106 @@ + $db_rev), 'dbSchema'); +} + +$updating = 0; + +$include_dir_regexp = "/\.sql$/"; + +if ($handle = opendir($config['install_dir'] . '/sql-schema')) +{ + while (false !== ($file = readdir($handle))) + { + if (filetype($config['install_dir'] . '/sql-schema/' . $file) == 'file' && preg_match($include_dir_regexp, $file)) + { + $filelist[] = $file; + } + } + closedir($handle); +} + +asort($filelist); + +foreach ($filelist as $file) +{ + list($filename,$extension) = explode('.',$file,2); + if ($filename > $db_rev) + { + if (!$updating) + { + echo "-- Updating database schema\n"; + } + + echo sprintf("%03d",$db_rev) . " -> " . sprintf("%03d",$filename) . " ..."; + + $err = 0; + + if ($fd = @fopen($config['install_dir'] . '/sql-schema/' . $file,'r')) + { + $data = fread($fd,4096); + while (!feof($fd)) + { + $data .= fread($fd,4096); + } + + foreach (explode("\n", $data) as $line) + { + if (trim($line)) + { + if ($debug) { echo("$line \n"); } + $update = mysql_query($line); + if (!$update) + { + $err++; + if ($debug) { echo(mysql_error() . "\n"); } + } + } + } + + echo " done ($err errors).\n"; + } + else + { + echo " Could not open file!\n"; + } + + $updating++; + $db_rev = $filename; + } +} + +if ($updating) +{ + dbUpdate(array('revision' => $dbu_rev), 'dbSchema'); + echo "-- Done\n"; +} + +?> \ No newline at end of file diff --git a/sql-schema/001.sql b/sql-schema/001.sql new file mode 100644 index 000000000..3dfb979b9 --- /dev/null +++ b/sql-schema/001.sql @@ -0,0 +1,1229 @@ +-- +-- Table structure for table `alerts` +-- + +DROP TABLE IF EXISTS `alerts`; +CREATE TABLE IF NOT EXISTS `alerts` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `importance` int(11) NOT NULL DEFAULT '0', + `device_id` int(11) NOT NULL, + `message` text NOT NULL, + `time_logged` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `alerted` smallint(6) NOT NULL DEFAULT '0', + KEY `id` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `applications` +-- + +DROP TABLE IF EXISTS `applications`; +CREATE TABLE IF NOT EXISTS `applications` ( + `app_id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) NOT NULL, + `app_type` varchar(64) NOT NULL, + PRIMARY KEY (`app_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `authlog` +-- + +DROP TABLE IF EXISTS `authlog`; +CREATE TABLE IF NOT EXISTS `authlog` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `user` text NOT NULL, + `address` text NOT NULL, + `result` text NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bgpPeers` +-- + +DROP TABLE IF EXISTS `bgpPeers`; +CREATE TABLE IF NOT EXISTS `bgpPeers` ( + `bgpPeer_id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) NOT NULL, + `astext` varchar(64) NOT NULL, + `bgpPeerIdentifier` text NOT NULL, + `bgpPeerRemoteAs` int(11) NOT NULL, + `bgpPeerState` text NOT NULL, + `bgpPeerAdminStatus` text NOT NULL, + `bgpLocalAddr` text NOT NULL, + `bgpPeerRemoteAddr` text NOT NULL, + `bgpPeerInUpdates` int(11) NOT NULL, + `bgpPeerOutUpdates` int(11) NOT NULL, + `bgpPeerInTotalMessages` int(11) NOT NULL, + `bgpPeerOutTotalMessages` int(11) NOT NULL, + `bgpPeerFsmEstablishedTime` int(11) NOT NULL, + `bgpPeerInUpdateElapsedTime` int(11) NOT NULL, + PRIMARY KEY (`bgpPeer_id`), + KEY `device_id` (`device_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bgpPeers_cbgp` +-- + +DROP TABLE IF EXISTS `bgpPeers_cbgp`; +CREATE TABLE IF NOT EXISTS `bgpPeers_cbgp` ( + `device_id` int(11) NOT NULL, + `bgpPeerIdentifier` varchar(64) NOT NULL, + `afi` varchar(16) NOT NULL, + `safi` varchar(16) NOT NULL, + KEY `device_id` (`device_id`,`bgpPeerIdentifier`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bills` +-- + +DROP TABLE IF EXISTS `bills`; +CREATE TABLE IF NOT EXISTS `bills` ( + `bill_id` int(11) NOT NULL AUTO_INCREMENT, + `bill_name` text NOT NULL, + `bill_type` text NOT NULL, + `bill_cdr` int(11) DEFAULT NULL, + `bill_day` int(11) NOT NULL DEFAULT '1', + `bill_gb` int(11) DEFAULT NULL, + `rate_95th_in` int(11) NOT NULL, + `rate_95th_out` int(11) NOT NULL, + `rate_95th` int(11) NOT NULL, + `dir_95th` varchar(3) NOT NULL, + `total_data` int(11) NOT NULL, + `total_data_in` int(11) NOT NULL, + `total_data_out` int(11) NOT NULL, + `rate_average_in` int(11) NOT NULL, + `rate_average_out` int(11) NOT NULL, + `rate_average` int(11) NOT NULL, + `bill_last_calc` datetime NOT NULL, + `bill_custid` varchar(64) NOT NULL, + `bill_ref` varchar(64) NOT NULL, + `bill_notes` varchar(256) NOT NULL, + `bill_autoadded` tinyint(1) NOT NULL, + UNIQUE KEY `bill_id` (`bill_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; +-- -------------------------------------------------------- + +-- +-- Table structure for table `bill_data` +-- + +DROP TABLE IF EXISTS `bill_data`; +CREATE TABLE IF NOT EXISTS `bill_data` ( + `bill_id` int(11) NOT NULL, + `timestamp` datetime NOT NULL, + `period` int(11) NOT NULL, + `delta` bigint(11) NOT NULL, + `in_delta` bigint(11) NOT NULL, + `out_delta` bigint(11) NOT NULL, + KEY `bill_id` (`bill_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bill_perms` +-- + +DROP TABLE IF EXISTS `bill_perms`; +CREATE TABLE IF NOT EXISTS `bill_perms` ( + `user_id` int(11) NOT NULL, + `bill_id` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `bill_ports` +-- + +DROP TABLE IF EXISTS `bill_ports`; +CREATE TABLE IF NOT EXISTS `bill_ports` ( + `bill_id` int(11) NOT NULL, + `port_id` int(11) NOT NULL, + `bill_port_autoadded` tinyint(1) NOT NULL DEFAULT '0' +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `cef_switching` +-- + +DROP TABLE IF EXISTS `cef_switching`; +CREATE TABLE IF NOT EXISTS `cef_switching` ( + `cef_switching_id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) NOT NULL, + `entPhysicalIndex` int(11) NOT NULL, + `afi` varchar(4) COLLATE utf8_unicode_ci NOT NULL, + `cef_index` int(11) NOT NULL, + `cef_path` varchar(16) COLLATE utf8_unicode_ci NOT NULL, + `drop` int(11) NOT NULL, + `punt` int(11) NOT NULL, + `punt2host` int(11) NOT NULL, + `drop_prev` int(11) NOT NULL, + `punt_prev` int(11) NOT NULL, + `punt2host_prev` int(11) NOT NULL, + `updated` int(11) NOT NULL, + `updated_prev` int(11) NOT NULL, + PRIMARY KEY (`cef_switching_id`), + UNIQUE KEY `device_id` (`device_id`,`entPhysicalIndex`,`afi`,`cef_index`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `customers` +-- + +DROP TABLE IF EXISTS `customers`; +CREATE TABLE IF NOT EXISTS `customers` ( + `customer_id` int(11) NOT NULL AUTO_INCREMENT, + `username` char(64) NOT NULL, + `password` char(32) NOT NULL, + `string` char(64) NOT NULL, + `level` tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`customer_id`), + UNIQUE KEY `username` (`username`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `dbSchema` +-- + +DROP TABLE IF EXISTS `dbSchema`; +CREATE TABLE IF NOT EXISTS `dbSchema` ( + `revision` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`revision`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `devices` +-- + +DROP TABLE IF EXISTS `devices`; +CREATE TABLE IF NOT EXISTS `devices` ( + `device_id` int(11) NOT NULL AUTO_INCREMENT, + `hostname` varchar(128) CHARACTER SET latin1 NOT NULL, + `sysName` varchar(128) CHARACTER SET latin1 DEFAULT NULL, + `community` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `snmpver` varchar(4) CHARACTER SET latin1 NOT NULL DEFAULT 'v2c', + `port` smallint(5) unsigned NOT NULL DEFAULT '161', + `transport` varchar(16) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'udp', + `timeout` int(11) DEFAULT NULL, + `retries` int(11) DEFAULT NULL, + `bgpLocalAs` varchar(16) CHARACTER SET latin1 DEFAULT NULL, + `sysDescr` text CHARACTER SET latin1, + `sysContact` text CHARACTER SET latin1, + `version` text CHARACTER SET latin1, + `hardware` text CHARACTER SET latin1, + `features` text CHARACTER SET latin1, + `location` text COLLATE utf8_unicode_ci, + `os` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, + `status` tinyint(4) NOT NULL DEFAULT '0', + `ignore` tinyint(4) NOT NULL DEFAULT '0', + `disabled` tinyint(1) NOT NULL DEFAULT '0', + `uptime` bigint(20) DEFAULT NULL, + `agent_uptime` int(11) NOT NULL, + `last_polled` timestamp NULL DEFAULT NULL, + `last_polled_timetaken` double(5,2) DEFAULT NULL, + `last_discovered_timetaken` double(5,2) DEFAULT NULL, + `last_discovered` timestamp NULL DEFAULT NULL, + `purpose` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL, + `type` varchar(20) COLLATE utf8_unicode_ci NOT NULL, + `serial` text COLLATE utf8_unicode_ci, + PRIMARY KEY (`device_id`), + KEY `status` (`status`), + KEY `hostname` (`hostname`), + KEY `sysName` (`sysName`), + KEY `os` (`os`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `devices_attribs` +-- + +DROP TABLE IF EXISTS `devices_attribs`; +CREATE TABLE IF NOT EXISTS `devices_attribs` ( + `attrib_id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) NOT NULL, + `attrib_type` varchar(32) NOT NULL, + `attrib_value` text NOT NULL, + `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`attrib_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `devices_perms` +-- + +DROP TABLE IF EXISTS `devices_perms`; +CREATE TABLE IF NOT EXISTS `devices_perms` ( + `user_id` int(11) NOT NULL, + `device_id` int(11) NOT NULL, + `access_level` int(4) NOT NULL DEFAULT '0', + KEY `user_id` (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `device_graphs` +-- + +DROP TABLE IF EXISTS `device_graphs`; +CREATE TABLE IF NOT EXISTS `device_graphs` ( + `device_id` int(11) NOT NULL, + `graph` varchar(32) COLLATE utf8_unicode_ci NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `entPhysical` +-- + +DROP TABLE IF EXISTS `entPhysical`; +CREATE TABLE IF NOT EXISTS `entPhysical` ( + `entPhysical_id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) NOT NULL, + `entPhysicalIndex` int(11) NOT NULL, + `entPhysicalDescr` text NOT NULL, + `entPhysicalClass` text NOT NULL, + `entPhysicalName` text NOT NULL, + `entPhysicalHardwareRev` varchar(64) DEFAULT NULL, + `entPhysicalFirmwareRev` varchar(64) DEFAULT NULL, + `entPhysicalSoftwareRev` varchar(64) DEFAULT NULL, + `entPhysicalAlias` varchar(32) DEFAULT NULL, + `entPhysicalAssetID` varchar(32) DEFAULT NULL, + `entPhysicalIsFRU` varchar(8) DEFAULT NULL, + `entPhysicalModelName` text NOT NULL, + `entPhysicalVendorType` text, + `entPhysicalSerialNum` text NOT NULL, + `entPhysicalContainedIn` int(11) NOT NULL, + `entPhysicalParentRelPos` int(11) NOT NULL, + `entPhysicalMfgName` text NOT NULL, + `ifIndex` int(11) DEFAULT NULL, + PRIMARY KEY (`entPhysical_id`), + KEY `device_id` (`device_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `eventlog` +-- + +DROP TABLE IF EXISTS `eventlog`; +CREATE TABLE IF NOT EXISTS `eventlog` ( + `event_id` int(11) NOT NULL AUTO_INCREMENT, + `host` int(11) NOT NULL DEFAULT '0', + `datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `message` text CHARACTER SET latin1, + `type` varchar(64) CHARACTER SET latin1 DEFAULT NULL, + `reference` varchar(64) CHARACTER SET latin1 NOT NULL, + PRIMARY KEY (`event_id`), + KEY `host` (`host`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `graph_types` +-- + +DROP TABLE IF EXISTS `graph_types`; +CREATE TABLE IF NOT EXISTS `graph_types` ( + `graph_type` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `graph_subtype` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `graph_section` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `graph_descr` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + `graph_order` int(11) NOT NULL, + KEY `graph_type` (`graph_type`), + KEY `graph_subtype` (`graph_subtype`), + KEY `graph_section` (`graph_section`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `graph_types_dead` +-- + +DROP TABLE IF EXISTS `graph_types_dead`; +CREATE TABLE IF NOT EXISTS `graph_types_dead` ( + `graph_type` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `graph_subtype` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `graph_section` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `graph_descr` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + `graph_order` int(11) NOT NULL, + KEY `graph_type` (`graph_type`), + KEY `graph_subtype` (`graph_subtype`), + KEY `graph_section` (`graph_section`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `hrDevice` +-- + +DROP TABLE IF EXISTS `hrDevice`; +CREATE TABLE IF NOT EXISTS `hrDevice` ( + `hrDevice_id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) NOT NULL, + `hrDeviceIndex` int(11) NOT NULL, + `hrDeviceDescr` text CHARACTER SET latin1 NOT NULL, + `hrDeviceType` text CHARACTER SET latin1 NOT NULL, + `hrDeviceErrors` int(11) NOT NULL, + `hrDeviceStatus` text CHARACTER SET latin1 NOT NULL, + `hrProcessorLoad` tinyint(4) DEFAULT NULL, + PRIMARY KEY (`hrDevice_id`), + KEY `device_id` (`device_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ipv4_addresses` +-- + +DROP TABLE IF EXISTS `ipv4_addresses`; +CREATE TABLE IF NOT EXISTS `ipv4_addresses` ( + `ipv4_address_id` int(11) NOT NULL AUTO_INCREMENT, + `ipv4_address` varchar(32) CHARACTER SET latin1 NOT NULL, + `ipv4_prefixlen` int(11) NOT NULL, + `ipv4_network_id` varchar(32) CHARACTER SET latin1 NOT NULL, + `interface_id` int(11) NOT NULL, + PRIMARY KEY (`ipv4_address_id`), + KEY `interface_id` (`interface_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ipv4_mac` +-- + +DROP TABLE IF EXISTS `ipv4_mac`; +CREATE TABLE IF NOT EXISTS `ipv4_mac` ( + `interface_id` int(11) NOT NULL, + `mac_address` varchar(32) CHARACTER SET latin1 NOT NULL, + `ipv4_address` varchar(32) CHARACTER SET latin1 NOT NULL, + KEY `interface_id` (`interface_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ipv4_networks` +-- + +DROP TABLE IF EXISTS `ipv4_networks`; +CREATE TABLE IF NOT EXISTS `ipv4_networks` ( + `ipv4_network_id` int(11) NOT NULL AUTO_INCREMENT, + `ipv4_network` varchar(64) CHARACTER SET latin1 NOT NULL, + PRIMARY KEY (`ipv4_network_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ipv6_addresses` +-- + +DROP TABLE IF EXISTS `ipv6_addresses`; +CREATE TABLE IF NOT EXISTS `ipv6_addresses` ( + `ipv6_address_id` int(11) NOT NULL AUTO_INCREMENT, + `ipv6_address` varchar(128) CHARACTER SET latin1 NOT NULL, + `ipv6_compressed` varchar(128) CHARACTER SET latin1 NOT NULL, + `ipv6_prefixlen` int(11) NOT NULL, + `ipv6_origin` varchar(16) CHARACTER SET latin1 NOT NULL, + `ipv6_network_id` varchar(128) CHARACTER SET latin1 NOT NULL, + `interface_id` int(11) NOT NULL, + PRIMARY KEY (`ipv6_address_id`), + KEY `interface_id` (`interface_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ipv6_networks` +-- + +DROP TABLE IF EXISTS `ipv6_networks`; +CREATE TABLE IF NOT EXISTS `ipv6_networks` ( + `ipv6_network_id` int(11) NOT NULL AUTO_INCREMENT, + `ipv6_network` varchar(64) CHARACTER SET latin1 NOT NULL, + PRIMARY KEY (`ipv6_network_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `juniAtmVp` +-- + +DROP TABLE IF EXISTS `juniAtmVp`; +CREATE TABLE IF NOT EXISTS `juniAtmVp` ( + `juniAtmVp_id` int(11) NOT NULL, + `interface_id` int(11) NOT NULL, + `vp_id` int(11) NOT NULL, + `vp_descr` varchar(32) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `links` +-- + +DROP TABLE IF EXISTS `links`; +CREATE TABLE IF NOT EXISTS `links` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `local_interface_id` int(11) DEFAULT NULL, + `remote_interface_id` int(11) DEFAULT NULL, + `active` tinyint(4) NOT NULL DEFAULT '1', + `protocol` varchar(11) DEFAULT NULL, + `remote_hostname` varchar(128) NOT NULL, + `remote_port` varchar(128) NOT NULL, + `remote_platform` varchar(128) NOT NULL, + `remote_version` varchar(256) NOT NULL, + PRIMARY KEY (`id`), + KEY `src_if` (`local_interface_id`), + KEY `dst_if` (`remote_interface_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mac_accounting` +-- + +DROP TABLE IF EXISTS `mac_accounting`; +CREATE TABLE IF NOT EXISTS `mac_accounting` ( + `ma_id` int(11) NOT NULL AUTO_INCREMENT, + `interface_id` int(11) NOT NULL, + `mac` varchar(32) NOT NULL, + `in_oid` varchar(128) NOT NULL, + `out_oid` varchar(128) NOT NULL, + `bps_out` int(11) NOT NULL, + `bps_in` int(11) NOT NULL, + `cipMacHCSwitchedBytes_input` bigint(20) DEFAULT NULL, + `cipMacHCSwitchedBytes_input_prev` bigint(20) DEFAULT NULL, + `cipMacHCSwitchedBytes_input_delta` bigint(20) DEFAULT NULL, + `cipMacHCSwitchedBytes_input_rate` int(11) DEFAULT NULL, + `cipMacHCSwitchedBytes_output` bigint(20) DEFAULT NULL, + `cipMacHCSwitchedBytes_output_prev` bigint(20) DEFAULT NULL, + `cipMacHCSwitchedBytes_output_delta` bigint(20) DEFAULT NULL, + `cipMacHCSwitchedBytes_output_rate` int(11) DEFAULT NULL, + `cipMacHCSwitchedPkts_input` bigint(20) DEFAULT NULL, + `cipMacHCSwitchedPkts_input_prev` bigint(20) DEFAULT NULL, + `cipMacHCSwitchedPkts_input_delta` bigint(20) DEFAULT NULL, + `cipMacHCSwitchedPkts_input_rate` int(11) DEFAULT NULL, + `cipMacHCSwitchedPkts_output` bigint(20) DEFAULT NULL, + `cipMacHCSwitchedPkts_output_prev` bigint(20) DEFAULT NULL, + `cipMacHCSwitchedPkts_output_delta` bigint(20) DEFAULT NULL, + `cipMacHCSwitchedPkts_output_rate` int(11) DEFAULT NULL, + `poll_time` int(11) DEFAULT NULL, + `poll_prev` int(11) DEFAULT NULL, + `poll_period` int(11) DEFAULT NULL, + PRIMARY KEY (`ma_id`), + KEY `interface_id` (`interface_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `mempools` +-- + +DROP TABLE IF EXISTS `mempools`; +CREATE TABLE IF NOT EXISTS `mempools` ( + `mempool_id` int(11) NOT NULL AUTO_INCREMENT, + `mempool_index` varchar(16) CHARACTER SET latin1 NOT NULL, + `entPhysicalIndex` int(11) DEFAULT NULL, + `hrDeviceIndex` int(11) DEFAULT NULL, + `mempool_type` varchar(32) CHARACTER SET latin1 NOT NULL, + `mempool_precision` int(11) NOT NULL DEFAULT '1', + `mempool_descr` varchar(64) CHARACTER SET latin1 NOT NULL, + `device_id` int(11) NOT NULL, + `mempool_perc` int(11) NOT NULL, + `mempool_used` bigint(16) NOT NULL, + `mempool_free` bigint(16) NOT NULL, + `mempool_total` bigint(16) NOT NULL, + `mempool_largestfree` bigint(16) DEFAULT NULL, + `mempool_lowestfree` bigint(16) DEFAULT NULL, + PRIMARY KEY (`mempool_id`), + KEY `device_id` (`device_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ospf_areas` +-- + +DROP TABLE IF EXISTS `ospf_areas`; +CREATE TABLE IF NOT EXISTS `ospf_areas` ( + `device_id` int(11) NOT NULL, + `ospfAreaId` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfAuthType` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + `ospfImportAsExtern` varchar(128) COLLATE utf8_unicode_ci NOT NULL, + `ospfSpfRuns` int(11) NOT NULL, + `ospfAreaBdrRtrCount` int(11) NOT NULL, + `ospfAsBdrRtrCount` int(11) NOT NULL, + `ospfAreaLsaCount` int(11) NOT NULL, + `ospfAreaLsaCksumSum` int(11) NOT NULL, + `ospfAreaSummary` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + `ospfAreaStatus` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + UNIQUE KEY `device_area` (`device_id`,`ospfAreaId`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ospf_instances` +-- + +DROP TABLE IF EXISTS `ospf_instances`; +CREATE TABLE IF NOT EXISTS `ospf_instances` ( + `device_id` int(11) NOT NULL, + `ospf_instance_id` int(11) NOT NULL, + `ospfRouterId` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfAdminStat` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfVersionNumber` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfAreaBdrRtrStatus` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfASBdrRtrStatus` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfExternLsaCount` int(11) NOT NULL, + `ospfExternLsaCksumSum` int(11) NOT NULL, + `ospfTOSSupport` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfOriginateNewLsas` int(11) NOT NULL, + `ospfRxNewLsas` int(11) NOT NULL, + `ospfExtLsdbLimit` int(11) DEFAULT NULL, + `ospfMulticastExtensions` int(11) DEFAULT NULL, + `ospfExitOverflowInterval` int(11) DEFAULT NULL, + `ospfDemandExtensions` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, + UNIQUE KEY `device_id` (`device_id`,`ospf_instance_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ospf_nbrs` +-- + +DROP TABLE IF EXISTS `ospf_nbrs`; +CREATE TABLE IF NOT EXISTS `ospf_nbrs` ( + `device_id` int(11) NOT NULL, + `interface_id` int(11) NOT NULL, + `ospf_nbr_id` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfNbrIpAddr` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfNbrAddressLessIndex` int(11) NOT NULL, + `ospfNbrRtrId` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfNbrOptions` int(11) NOT NULL, + `ospfNbrPriority` int(11) NOT NULL, + `ospfNbrState` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfNbrEvents` int(11) NOT NULL, + `ospfNbrLsRetransQLen` int(11) NOT NULL, + `ospfNbmaNbrStatus` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfNbmaNbrPermanence` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfNbrHelloSuppressed` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + UNIQUE KEY `device_id` (`device_id`,`ospf_nbr_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ospf_ports` +-- + +DROP TABLE IF EXISTS `ospf_ports`; +CREATE TABLE IF NOT EXISTS `ospf_ports` ( + `device_id` int(11) NOT NULL, + `interface_id` int(11) NOT NULL, + `ospf_port_id` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfIfIpAddress` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfAddressLessIf` int(11) NOT NULL, + `ospfIfAreaId` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `ospfIfType` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, + `ospfIfAdminStat` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, + `ospfIfRtrPriority` int(11) DEFAULT NULL, + `ospfIfTransitDelay` int(11) DEFAULT NULL, + `ospfIfRetransInterval` int(11) DEFAULT NULL, + `ospfIfHelloInterval` int(11) DEFAULT NULL, + `ospfIfRtrDeadInterval` int(11) DEFAULT NULL, + `ospfIfPollInterval` int(11) DEFAULT NULL, + `ospfIfState` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, + `ospfIfDesignatedRouter` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, + `ospfIfBackupDesignatedRouter` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, + `ospfIfEvents` int(11) DEFAULT NULL, + `ospfIfAuthKey` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL, + `ospfIfStatus` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, + `ospfIfMulticastForwarding` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, + `ospfIfDemand` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, + `ospfIfAuthType` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, + UNIQUE KEY `device_id` (`device_id`,`ospf_port_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `perf_times` +-- + +DROP TABLE IF EXISTS `perf_times`; +CREATE TABLE IF NOT EXISTS `perf_times` ( + `type` varchar(8) CHARACTER SET latin1 NOT NULL, + `doing` varchar(64) CHARACTER SET latin1 NOT NULL, + `start` int(11) NOT NULL, + `duration` double(8,2) NOT NULL, + `devices` int(11) NOT NULL, + KEY `type` (`type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ports` +-- + +DROP TABLE IF EXISTS `ports`; +CREATE TABLE IF NOT EXISTS `ports` ( + `interface_id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) NOT NULL DEFAULT '0', + `port_descr_type` varchar(255) DEFAULT NULL, + `port_descr_descr` varchar(255) DEFAULT NULL, + `port_descr_circuit` varchar(255) DEFAULT NULL, + `port_descr_speed` varchar(32) DEFAULT NULL, + `port_descr_notes` varchar(255) DEFAULT NULL, + `ifDescr` varchar(255) DEFAULT NULL, + `ifName` varchar(64) DEFAULT NULL, + `portName` varchar(128) DEFAULT NULL, + `ifIndex` int(11) DEFAULT '0', + `ifSpeed` bigint(20) DEFAULT NULL, + `ifConnectorPresent` varchar(12) DEFAULT NULL, + `ifPromiscuousMode` varchar(12) DEFAULT NULL, + `ifHighSpeed` int(11) DEFAULT NULL, + `ifOperStatus` varchar(16) DEFAULT NULL, + `ifAdminStatus` varchar(16) DEFAULT NULL, + `ifDuplex` varchar(12) DEFAULT NULL, + `ifMtu` int(11) DEFAULT NULL, + `ifType` text, + `ifAlias` text, + `ifPhysAddress` text, + `ifHardType` varchar(64) DEFAULT NULL, + `ifLastChange` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `ifVlan` varchar(8) NOT NULL DEFAULT '', + `ifTrunk` varchar(8) DEFAULT '', + `ifVrf` int(11) NOT NULL, + `counter_in` int(11) DEFAULT NULL, + `counter_out` int(11) DEFAULT NULL, + `ignore` tinyint(1) NOT NULL DEFAULT '0', + `disabled` tinyint(1) NOT NULL DEFAULT '0', + `detailed` tinyint(1) NOT NULL DEFAULT '0', + `deleted` tinyint(1) NOT NULL DEFAULT '0', + `pagpOperationMode` varchar(32) DEFAULT NULL, + `pagpPortState` varchar(16) DEFAULT NULL, + `pagpPartnerDeviceId` varchar(48) DEFAULT NULL, + `pagpPartnerLearnMethod` varchar(16) DEFAULT NULL, + `pagpPartnerIfIndex` int(11) DEFAULT NULL, + `pagpPartnerGroupIfIndex` int(11) DEFAULT NULL, + `pagpPartnerDeviceName` varchar(128) DEFAULT NULL, + `pagpEthcOperationMode` varchar(16) DEFAULT NULL, + `pagpDeviceId` varchar(48) DEFAULT NULL, + `pagpGroupIfIndex` int(11) DEFAULT NULL, + `ifInUcastPkts` bigint(20) DEFAULT NULL, + `ifInUcastPkts_prev` bigint(20) DEFAULT NULL, + `ifInUcastPkts_delta` bigint(20) DEFAULT NULL, + `ifInUcastPkts_rate` int(11) DEFAULT NULL, + `ifOutUcastPkts` bigint(20) DEFAULT NULL, + `ifOutUcastPkts_prev` bigint(20) DEFAULT NULL, + `ifOutUcastPkts_delta` bigint(20) DEFAULT NULL, + `ifOutUcastPkts_rate` int(11) DEFAULT NULL, + `ifInErrors` bigint(20) DEFAULT NULL, + `ifInErrors_prev` bigint(20) DEFAULT NULL, + `ifInErrors_delta` bigint(20) DEFAULT NULL, + `ifInErrors_rate` int(11) DEFAULT NULL, + `ifOutErrors` bigint(20) DEFAULT NULL, + `ifOutErrors_prev` bigint(20) DEFAULT NULL, + `ifOutErrors_delta` bigint(20) DEFAULT NULL, + `ifOutErrors_rate` int(11) DEFAULT NULL, + `ifInOctets` bigint(20) DEFAULT NULL, + `ifInOctets_prev` bigint(20) DEFAULT NULL, + `ifInOctets_delta` bigint(20) DEFAULT NULL, + `ifInOctets_rate` int(11) DEFAULT NULL, + `ifOutOctets` bigint(20) DEFAULT NULL, + `ifOutOctets_prev` bigint(20) DEFAULT NULL, + `ifOutOctets_delta` bigint(20) DEFAULT NULL, + `ifOutOctets_rate` int(11) DEFAULT NULL, + `poll_time` int(11) DEFAULT NULL, + `poll_prev` int(11) DEFAULT NULL, + `poll_period` int(11) DEFAULT NULL, + PRIMARY KEY (`interface_id`), + UNIQUE KEY `device_ifIndex` (`device_id`,`ifIndex`), + KEY `if_2` (`ifDescr`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ports_adsl` +-- + +DROP TABLE IF EXISTS `ports_adsl`; +CREATE TABLE IF NOT EXISTS `ports_adsl` ( + `interface_id` int(11) NOT NULL, + `port_adsl_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `adslLineCoding` varchar(8) COLLATE utf8_bin NOT NULL, + `adslLineType` varchar(16) COLLATE utf8_bin NOT NULL, + `adslAtucInvVendorID` varchar(8) COLLATE utf8_bin NOT NULL, + `adslAtucInvVersionNumber` varchar(8) COLLATE utf8_bin NOT NULL, + `adslAtucCurrSnrMgn` decimal(5,1) NOT NULL, + `adslAtucCurrAtn` decimal(5,1) NOT NULL, + `adslAtucCurrOutputPwr` decimal(5,1) NOT NULL, + `adslAtucCurrAttainableRate` int(11) NOT NULL, + `adslAtucChanCurrTxRate` int(11) NOT NULL, + `adslAturInvSerialNumber` varchar(8) COLLATE utf8_bin NOT NULL, + `adslAturInvVendorID` varchar(8) COLLATE utf8_bin NOT NULL, + `adslAturInvVersionNumber` varchar(8) COLLATE utf8_bin NOT NULL, + `adslAturChanCurrTxRate` int(11) NOT NULL, + `adslAturCurrSnrMgn` decimal(5,1) NOT NULL, + `adslAturCurrAtn` decimal(5,1) NOT NULL, + `adslAturCurrOutputPwr` decimal(5,1) NOT NULL, + `adslAturCurrAttainableRate` int(11) NOT NULL, + UNIQUE KEY `interface_id` (`interface_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ports_perms` +-- + +DROP TABLE IF EXISTS `ports_perms`; +CREATE TABLE IF NOT EXISTS `ports_perms` ( + `user_id` int(11) NOT NULL, + `interface_id` int(11) NOT NULL, + `access_level` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ports_stack` +-- + +DROP TABLE IF EXISTS `ports_stack`; +CREATE TABLE IF NOT EXISTS `ports_stack` ( + `device_id` int(11) NOT NULL, + `interface_id_high` int(11) NOT NULL, + `interface_id_low` int(11) NOT NULL, + `ifStackStatus` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + UNIQUE KEY `device_id` (`device_id`,`interface_id_high`,`interface_id_low`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `port_in_measurements` +-- + +DROP TABLE IF EXISTS `port_in_measurements`; +CREATE TABLE IF NOT EXISTS `port_in_measurements` ( + `port_id` int(11) NOT NULL, + `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `counter` bigint(11) NOT NULL, + `delta` bigint(11) NOT NULL, + KEY `port_id` (`port_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `port_out_measurements` +-- + +DROP TABLE IF EXISTS `port_out_measurements`; +CREATE TABLE IF NOT EXISTS `port_out_measurements` ( + `port_id` int(11) NOT NULL, + `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `counter` bigint(11) NOT NULL, + `delta` bigint(11) NOT NULL, + KEY `port_id` (`port_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `processors` +-- + +DROP TABLE IF EXISTS `processors`; +CREATE TABLE IF NOT EXISTS `processors` ( + `processor_id` int(11) NOT NULL AUTO_INCREMENT, + `entPhysicalIndex` int(11) NOT NULL, + `hrDeviceIndex` int(11) DEFAULT NULL, + `device_id` int(11) NOT NULL, + `processor_oid` varchar(128) CHARACTER SET latin1 NOT NULL, + `processor_index` varchar(32) CHARACTER SET latin1 NOT NULL, + `processor_type` varchar(16) CHARACTER SET latin1 NOT NULL, + `processor_usage` int(11) NOT NULL, + `processor_descr` varchar(64) CHARACTER SET latin1 NOT NULL, + `processor_precision` int(11) NOT NULL DEFAULT '1', + PRIMARY KEY (`processor_id`), + KEY `device_id` (`device_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `pseudowires` +-- + +DROP TABLE IF EXISTS `pseudowires`; +CREATE TABLE IF NOT EXISTS `pseudowires` ( + `pseudowire_id` int(11) NOT NULL AUTO_INCREMENT, + `interface_id` int(11) NOT NULL, + `peer_device_id` int(11) NOT NULL, + `peer_ldp_id` int(11) NOT NULL, + `cpwVcID` int(11) NOT NULL, + `cpwOid` int(11) NOT NULL, + PRIMARY KEY (`pseudowire_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `sensors` +-- + +DROP TABLE IF EXISTS `sensors`; +CREATE TABLE IF NOT EXISTS `sensors` ( + `sensor_id` int(11) NOT NULL AUTO_INCREMENT, + `sensor_class` varchar(64) CHARACTER SET latin1 NOT NULL, + `device_id` int(11) NOT NULL DEFAULT '0', + `poller_type` varchar(16) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'snmp', + `sensor_oid` varchar(64) CHARACTER SET latin1 NOT NULL, + `sensor_index` varchar(10) COLLATE utf8_unicode_ci NOT NULL, + `sensor_type` varchar(255) CHARACTER SET latin1 NOT NULL, + `sensor_descr` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `sensor_divisor` int(11) NOT NULL DEFAULT '1', + `sensor_multiplier` int(11) NOT NULL DEFAULT '1', + `sensor_current` float DEFAULT NULL, + `sensor_limit` float DEFAULT NULL, + `sensor_limit_warn` float DEFAULT NULL, + `sensor_limit_low` float DEFAULT NULL, + `sensor_limit_low_warn` float DEFAULT NULL, + `entPhysicalIndex` varchar(16) CHARACTER SET latin1 DEFAULT NULL, + `entPhysicalIndex_measured` varchar(16) CHARACTER SET latin1 DEFAULT NULL, + PRIMARY KEY (`sensor_id`), + KEY `sensor_host` (`device_id`), + KEY `sensor_class` (`sensor_class`), + KEY `sensor_type` (`sensor_type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `services` +-- + +DROP TABLE IF EXISTS `services`; +CREATE TABLE IF NOT EXISTS `services` ( + `service_id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) NOT NULL, + `service_ip` text NOT NULL, + `service_type` varchar(16) NOT NULL, + `service_desc` text NOT NULL, + `service_param` text NOT NULL, + `service_ignore` tinyint(1) NOT NULL, + `service_status` tinyint(4) NOT NULL DEFAULT '0', + `service_checked` int(11) NOT NULL DEFAULT '0', + `service_changed` int(11) NOT NULL DEFAULT '0', + `service_message` text NOT NULL, + `service_disabled` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`service_id`), + KEY `service_host` (`device_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `storage` +-- + +DROP TABLE IF EXISTS `storage`; +CREATE TABLE IF NOT EXISTS `storage` ( + `storage_id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) NOT NULL, + `storage_mib` varchar(16) NOT NULL, + `storage_index` int(11) NOT NULL, + `storage_type` varchar(32) DEFAULT NULL, + `storage_descr` text NOT NULL, + `storage_size` bigint(20) NOT NULL, + `storage_units` int(11) NOT NULL, + `storage_used` bigint(20) NOT NULL, + `storage_free` bigint(20) NOT NULL, + `storage_perc` text NOT NULL, + `storage_perc_warn` int(11) DEFAULT '60', + PRIMARY KEY (`storage_id`), + KEY `device_id` (`device_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `syslog` +-- + +DROP TABLE IF EXISTS `syslog`; +CREATE TABLE IF NOT EXISTS `syslog` ( + `device_id` int(11) DEFAULT NULL, + `facility` varchar(10) DEFAULT NULL, + `priority` varchar(10) DEFAULT NULL, + `level` varchar(10) DEFAULT NULL, + `tag` varchar(10) DEFAULT NULL, + `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `program` varchar(32) DEFAULT NULL, + `msg` text, + `seq` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`seq`), + KEY `datetime` (`timestamp`), + KEY `device_id` (`device_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `toner` +-- + +DROP TABLE IF EXISTS `toner`; +CREATE TABLE IF NOT EXISTS `toner` ( + `toner_id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) NOT NULL DEFAULT '0', + `toner_index` int(11) NOT NULL, + `toner_type` varchar(64) NOT NULL, + `toner_oid` varchar(64) NOT NULL, + `toner_descr` varchar(32) NOT NULL DEFAULT '', + `toner_capacity` int(11) NOT NULL DEFAULT '0', + `toner_current` int(11) NOT NULL DEFAULT '0', + PRIMARY KEY (`toner_id`), + KEY `device_id` (`device_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `ucd_diskio` +-- + +DROP TABLE IF EXISTS `ucd_diskio`; +CREATE TABLE IF NOT EXISTS `ucd_diskio` ( + `diskio_id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) NOT NULL, + `diskio_index` int(11) NOT NULL, + `diskio_descr` varchar(32) CHARACTER SET latin1 NOT NULL, + PRIMARY KEY (`diskio_id`), + KEY `device_id` (`device_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `users` +-- + +DROP TABLE IF EXISTS `users`; +CREATE TABLE IF NOT EXISTS `users` ( + `user_id` int(11) NOT NULL AUTO_INCREMENT, + `username` char(30) NOT NULL, + `password` varchar(34) DEFAULT NULL, + `realname` varchar(64) NOT NULL, + `email` varchar(64) NOT NULL, + `descr` char(30) NOT NULL, + `level` tinyint(4) NOT NULL DEFAULT '0', + `can_modify_passwd` tinyint(4) NOT NULL DEFAULT '1', + PRIMARY KEY (`user_id`), + UNIQUE KEY `username` (`username`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `users_prefs` +-- + +DROP TABLE IF EXISTS `users_prefs`; +CREATE TABLE IF NOT EXISTS `users_prefs` ( + `user_id` int(16) NOT NULL, + `pref` varchar(32) NOT NULL, + `value` varchar(128) NOT NULL, + PRIMARY KEY (`user_id`), + UNIQUE KEY `user_id.pref` (`user_id`,`pref`), + KEY `pref` (`pref`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `vlans` +-- + +DROP TABLE IF EXISTS `vlans`; +CREATE TABLE IF NOT EXISTS `vlans` ( + `vlan_id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) DEFAULT NULL, + `vlan_vlan` int(11) DEFAULT NULL, + `vlan_domain` text, + `vlan_descr` text, + PRIMARY KEY (`vlan_id`), + KEY `device_id` (`device_id`,`vlan_vlan`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `vminfo` +-- + +DROP TABLE IF EXISTS `vminfo`; +CREATE TABLE IF NOT EXISTS `vminfo` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) NOT NULL, + `vm_type` varchar(16) NOT NULL DEFAULT 'vmware', + `vmwVmVMID` int(11) NOT NULL, + `vmwVmDisplayName` varchar(128) NOT NULL, + `vmwVmGuestOS` varchar(128) NOT NULL, + `vmwVmMemSize` int(11) NOT NULL, + `vmwVmCpus` int(11) NOT NULL, + `vmwVmState` varchar(128) NOT NULL, + PRIMARY KEY (`id`), + KEY `device_id` (`device_id`), + KEY `vmwVmVMID` (`vmwVmVMID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `vmware_vminfo` +-- + +DROP TABLE IF EXISTS `vmware_vminfo`; +CREATE TABLE IF NOT EXISTS `vmware_vminfo` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) NOT NULL, + `vmwVmVMID` int(11) NOT NULL, + `vmwVmDisplayName` varchar(128) NOT NULL, + `vmwVmGuestOS` varchar(128) NOT NULL, + `vmwVmMemSize` int(11) NOT NULL, + `vmwVmCpus` int(11) NOT NULL, + `vmwVmState` varchar(128) NOT NULL, + PRIMARY KEY (`id`), + KEY `device_id` (`device_id`), + KEY `vmwVmVMID` (`vmwVmVMID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `vrfs` +-- + +DROP TABLE IF EXISTS `vrfs`; +CREATE TABLE IF NOT EXISTS `vrfs` ( + `vrf_id` int(11) NOT NULL AUTO_INCREMENT, + `vrf_oid` varchar(256) NOT NULL, + `vrf_name` varchar(128) DEFAULT NULL, + `mplsVpnVrfRouteDistinguisher` varchar(128) DEFAULT NULL, + `mplsVpnVrfDescription` text NOT NULL, + `device_id` int(11) NOT NULL, + PRIMARY KEY (`vrf_id`), + KEY `device_id` (`device_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE IF NOT EXISTS `bill_history` ( + `bill_hist_id` int(11) NOT NULL AUTO_INCREMENT, + `bill_id` int(11) NOT NULL, + `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `bill_datefrom` datetime NOT NULL, + `bill_dateto` datetime NOT NULL, + `bill_type` text NOT NULL, + `bill_allowed` bigint(20) NOT NULL, + `bill_used` bigint(20) NOT NULL, + `bill_overuse` bigint(20) NOT NULL, + `bill_percent` decimal(10,2) NOT NULL, + `rate_95th_in` bigint(20) NOT NULL, + `rate_95th_out` bigint(20) NOT NULL, + `rate_95th` bigint(20) NOT NULL, + `dir_95th` varchar(3) NOT NULL, + `rate_average` bigint(20) NOT NULL, + `rate_average_in` bigint(20) NOT NULL, + `rate_average_out` bigint(20) NOT NULL, + `traf_in` bigint(20) NOT NULL, + `traf_out` bigint(20) NOT NULL, + `traf_total` bigint(20) NOT NULL, + `pdf` longblob, + PRIMARY KEY (`bill_hist_id`), + UNIQUE KEY `unique_index` (`bill_id`,`bill_datefrom`,`bill_dateto`), + KEY `bill_id` (`bill_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; + +CREATE TABLE IF NOT EXISTS `entPhysical_state` ( `device_id` int(11) NOT NULL, `entPhysicalIndex` varchar(64) NOT NULL, `subindex` varchar(64) DEFAULT NULL, `group` varchar(64) NOT NULL, `key` varchar(64) NOT NULL, `value` varchar(255) NOT NULL, KEY `device_id_index` (`device_id`,`entPhysicalIndex`)) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +CREATE TABLE IF NOT EXISTS `ports_vlans` ( + `port_vlan_id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) NOT NULL, + `interface_id` int(11) NOT NULL, + `vlan` int(11) NOT NULL, + `baseport` int(11) NOT NULL, + `priority` bigint(32) NOT NULL, + `state` varchar(16) NOT NULL, + `cost` int(11) NOT NULL, + PRIMARY KEY (`port_vlan_id`), + UNIQUE KEY `unique` (`device_id`,`interface_id`,`vlan`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; + +-- +-- Table structure for table `netscaler_vservers` +-- + +CREATE TABLE IF NOT EXISTS `netscaler_vservers` ( + `vsvr_id` int(11) NOT NULL AUTO_INCREMENT, + `device_id` int(11) NOT NULL, + `vsvr_name` varchar(128) COLLATE utf8_unicode_ci NOT NULL, + `vsvr_ip` varchar(128) COLLATE utf8_unicode_ci NOT NULL, + `vsvr_port` int(8) NOT NULL, + `vsvr_type` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + `vsvr_state` varchar(32) COLLATE utf8_unicode_ci NOT NULL, + `vsvr_clients` int(11) NOT NULL, + `vsvr_server` int(11) NOT NULL, + `vsvr_req_rate` int(11) NOT NULL, + `vsvr_bps_in` int(11) NOT NULL, + `vsvr_bps_out` int(11) NOT NULL, + PRIMARY KEY (`vsvr_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/sql-schema/002.sql b/sql-schema/002.sql new file mode 100644 index 000000000..f82259611 --- /dev/null +++ b/sql-schema/002.sql @@ -0,0 +1,121 @@ +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_input` bigint(20) default NULL; +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_input_prev` bigint(20) default NULL; +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_input_delta` bigint(20) default NULL; +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_input_rate` int(11) default NULL; +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_output` bigint(20) default NULL; +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_output_prev` bigint(20) default NULL; +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_output_delta` bigint(20) default NULL; +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedBytes_output_rate` int(11) default NULL; +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_input` bigint(20) default NULL; +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_input_prev` bigint(20) default NULL; +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_input_delta` bigint(20) default NULL; +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_input_rate` int(11) default NULL; +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_output` bigint(20) default NULL; +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_output_prev` bigint(20) default NULL; +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_output_delta` bigint(20) default NULL; +ALTER TABLE `mac_accounting` ADD `cipMacHCSwitchedPkts_output_rate` int(11) default NULL; +ALTER TABLE `mac_accounting` ADD `poll_time` int(11) default NULL; +ALTER TABLE `mac_accounting` ADD `poll_prev` int(11) default NULL; +ALTER TABLE `mac_accounting` ADD `poll_period` int(11) default NULL; +ALTER TABLE `interfaces` ADD `ifInUcastPkts` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifInUcastPkts_prev` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifInUcastPkts_delta` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifInUcastPkts_rate` int(11) default NULL; +ALTER TABLE `interfaces` ADD `ifOutUcastPkts` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifOutUcastPkts_prev` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifOutUcastPkts_delta` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifOutUcastPkts_rate` int(11) default NULL; +ALTER TABLE `interfaces` ADD `ifInErrors` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifInErrors_prev` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifInErrors_delta` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifInErrors_rate` int(11) default NULL; +ALTER TABLE `interfaces` ADD `ifOutErrors` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifOutErrors_prev` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifOutErrors_delta` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifOutErrors_rate` int(11) default NULL; +ALTER TABLE `interfaces` ADD `ifInOctets` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifInOctets_prev` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifInOctets_delta` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifInOctets_rate` int(11) default NULL; +ALTER TABLE `interfaces` ADD `ifOutOctets` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifOutOctets_prev` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifOutOctets_delta` bigint(20) default NULL; +ALTER TABLE `interfaces` ADD `ifOutOctets_rate` int(11) default NULL; +ALTER TABLE `interfaces` ADD `poll_time` int(11) default NULL; +ALTER TABLE `interfaces` ADD `poll_prev` int(11) default NULL; +ALTER TABLE `interfaces` ADD `poll_period` int(11) default NULL; +ALTER TABLE `interfaces` ADD `pagpOperationMode` VARCHAR( 32 ) NULL ; +ALTER TABLE `interfaces` ADD `pagpPortState` VARCHAR( 16 ) NULL ; +ALTER TABLE `interfaces` ADD `pagpPartnerDeviceId` VARCHAR( 48 ) NULL ; +ALTER TABLE `interfaces` ADD `pagpPartnerLearnMethod` VARCHAR( 16 ) NULL ; +ALTER TABLE `interfaces` ADD `pagpPartnerIfIndex` INT NULL ; +ALTER TABLE `interfaces` ADD `pagpPartnerGroupIfIndex` INT NULL ; +ALTER TABLE `interfaces` ADD `pagpPartnerDeviceName` VARCHAR( 128 ) NULL ; +ALTER TABLE `interfaces` ADD `pagpEthcOperationMode` VARCHAR( 16 ) NULL ; +ALTER TABLE `interfaces` ADD `pagpDeviceId` VARCHAR( 48 ) NULL ; +ALTER TABLE `interfaces` ADD `pagpGroupIfIndex` INT NULL ; +ALTER TABLE `interfaces` ADD `ifPromiscuousMode` VARCHAR( 12 ) NULL DEFAULT NULL AFTER `ifSpeed`; +ALTER TABLE `interfaces` ADD `ifConnectorPresent` VARCHAR( 12 ) NULL DEFAULT NULL AFTER `ifSpeed`; +ALTER TABLE `interfaces` ADD `ifName` VARCHAR( 64 ) NULL DEFAULT NULL AFTER `ifDescr`; +ALTER TABLE `interfaces` ADD `portName` VARCHAR( 128 ) NULL DEFAULT NULL AFTER `ifName`; +ALTER TABLE `interfaces` ADD `ifHighSpeed` BIGINT ( 20 ) NULL DEFAULT NULL AFTER `ifSpeed`; +ALTER TABLE `interfaces` DROP `in_rate`; +ALTER TABLE `interfaces` DROP `out_rate`; +ALTER TABLE `interfaces` DROP `in_errors`; +ALTER TABLE `interfaces` DROP `out_errors`; +CREATE TABLE IF NOT EXISTS `cmpMemPool` ( `cmp_id` int(11) NOT NULL auto_increment, `Index` varchar(8) NOT NULL, `cmpName` varchar(32) NOT NULL, `cmpValid` varchar(8) NOT NULL, `device_id` int(11) NOT NULL, `cmpUsed` int(11) NOT NULL, `cmpFree` int(11) NOT NULL, `cmpLargestFree` int(11) NOT NULL, `cmpAlternate` tinyint(4) default NULL, PRIMARY KEY (`cmp_id`), KEY `device_id` (`device_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1; +CREATE TABLE IF NOT EXISTS `hrDevice` ( `hrDevice_id` int(11) NOT NULL auto_increment, `device_id` int(11) NOT NULL, `hrDeviceIndex` int(11) NOT NULL, `hrDeviceDescr` text NOT NULL, `hrDeviceType` text NOT NULL, `hrDeviceErrors` int(11) NOT NULL, `hrDeviceStatus` text NOT NULL, `hrProcessorLoad` tinyint(4) default NULL, PRIMARY KEY (`hrDevice_id`), KEY `device_id` (`device_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1; +ALTER TABLE `entPhysical` ADD `entPhysicalHardwareRev` VARCHAR( 16 ) NULL AFTER `entPhysicalName` ,ADD `entPhysicalFirmwareRev` VARCHAR( 16 ) NULL AFTER `entPhysicalHardwareRev` ,ADD `entPhysicalSoftwareRev` VARCHAR( 16 ) NULL AFTER `entPhysicalFirmwareRev` ,ADD `entPhysicalAlias` VARCHAR( 32 ) NULL AFTER `entPhysicalSoftwareRev` ,ADD `entPhysicalAssetID` VARCHAR( 32 ) NULL AFTER `entPhysicalAlias` ,ADD `entPhysicalIsFRU` VARCHAR( 8 ) NULL AFTER `entPhysicalAssetID`; +ALTER TABLE `devices` ADD `last_discovered` timestamp NULL DEFAULT NULL AFTER `last_polled`; +ALTER TABLE `devices` CHANGE `lastchange` `uptime` BIGINT NULL DEFAULT NULL; +ALTER TABLE `storage` ADD `hrStorageType` VARCHAR( 32 ) NULL DEFAULT NULL AFTER `hrStorageIndex`; +ALTER TABLE `devices` MODIFY `type` varchar(8) DEFAULT 'unknown'; +ALTER TABLE `devices` CHANGE `os` `os` VARCHAR( 32 ) NULL DEFAULT NULL; +ALTER TABLE `temperature` ADD `temp_precision` INT(11) NULL DEFAULT '1'; +UPDATE temperature SET temp_precision=10 WHERE temp_tenths=1; +ALTER TABLE `temperature` ADD `temp_index` INT NOT NULL AFTER `temp_host` , ADD `temp_mibtype` VARCHAR( 32 ) NOT NULL AFTER `temp_index`; +ALTER TABLE `temperature` DROP `temp_tenths`; +CREATE TABLE IF NOT EXISTS `dbSchema` ( `revision` int(11) NOT NULL default '0', PRIMARY KEY (`revision`)) ENGINE=MyISAM DEFAULT CHARSET=latin1; +ALTER TABLE `storage` ADD `storage_perc_warn` INT(11) NULL DEFAULT '60'; +CREATE TABLE IF NOT EXISTS `voltage` ( `volt_id` int(11) NOT NULL auto_increment, `volt_host` int(11) NOT NULL default '0', `volt_oid` varchar(64) NOT NULL, `volt_descr` varchar(32) NOT NULL default '', `volt_precision` int(11) NOT NULL default '1', `volt_current` int(11) NOT NULL default '0', `volt_limit` int(11) NOT NULL default '60', PRIMARY KEY (`volt_id`), KEY `volt_host` (`volt_host`)) ENGINE=InnoDB DEFAULT CHARSET=latin1; +CREATE TABLE IF NOT EXISTS `fanspeed` ( `fan_id` int(11) NOT NULL auto_increment, `fan_host` int(11) NOT NULL default '0', `fan_oid` varchar(64) NOT NULL, `fan_descr` varchar(32) NOT NULL default '', `fan_precision` int(11) NOT NULL default '1', `fan_current` int(11) NOT NULL default '0', `fan_limit` int(11) NOT NULL default '60', PRIMARY KEY (`fan_id`), KEY `fan_host` (`fan_host`)) ENGINE=InnoDB DEFAULT CHARSET=latin1; +ALTER TABLE `voltage` ADD `volt_limit_low` int(11) NULL DEFAULT NULL AFTER `volt_limit`; +ALTER TABLE `voltage` CHANGE `volt_current` `volt_current` FLOAT(3) NULL DEFAULT NULL; +ALTER TABLE `voltage` CHANGE `volt_limit` `volt_limit` FLOAT(3) NULL DEFAULT NULL; +ALTER TABLE `voltage` CHANGE `volt_limit_low` `volt_limit_low` FLOAT(3) NULL DEFAULT NULL; +ALTER TABLE `fanspeed` ADD `fan_index` INT NOT NULL AFTER `fan_host` , ADD `fan_mibtype` VARCHAR( 32 ) NOT NULL AFTER `fan_index`; +ALTER TABLE `temperature` CHANGE `temp_host` `device_id` INT( 11 ) NOT NULL DEFAULT '0'; +ALTER TABLE `fanspeed` CHANGE `fan_host` `device_id` INT( 11 ) NOT NULL DEFAULT '0'; +ALTER TABLE `voltage` CHANGE `volt_host` `device_id` INT( 11 ) NOT NULL DEFAULT '0'; +CREATE TABLE IF NOT EXISTS `processors` ( `processor_id` int(11) NOT NULL AUTO_INCREMENT, `entPhysicalIndex` int(11) NOT NULL, `device_id` int(11) NOT NULL, `processor_oid` int(11) NOT NULL, `processor_type` int(11) NOT NULL, `processor_usage` int(11) NOT NULL, `processor_description` varchar(64) NOT NULL, PRIMARY KEY (`processor_id`), KEY `cpuCPU_id` (`processor_id`,`device_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; +ALTER TABLE `processors` ADD `hrDeviceIndex` int(11) NULL AFTER `entPhysicalIndex`; +ALTER TABLE `temperature` CHANGE `temp_current` `temp_current` FLOAT( 4 ) NOT NULL DEFAULT '0'; +ALTER TABLE `processors` ADD `processor_index` varchar(32) NOT NULL AFTER `processor_oid`; +ALTER TABLE `processors` CHANGE `processor_description` `processor_descr` varchar(64) NOT NULL; +ALTER TABLE `fanspeed` CHANGE `fan_mibtype` `fan_type` varchar(64) NOT NULL ; +ALTER TABLE `voltage` ADD `volt_index` VARCHAR( 8 ) NOT NULL AFTER `volt_oid`,ADD `volt_type` VARCHAR( 32 ) NOT NULL AFTER `volt_index` ; +ALTER TABLE `processors` ADD `processor_precision` INT( 11 ) NOT NULL DEFAULT '1'; +ALTER TABLE `links` CHANGE `cdp` `vendor` VARCHAR( 11 ) NULL DEFAULT NULL; +ALTER TABLE `links` ADD `remote_hostname` VARCHAR( 128 ) NOT NULL ,ADD `remote_port` VARCHAR( 128 ) NOT NULL ,ADD `remote_platform` VARCHAR( 128 ) NOT NULL ,ADD `remote_version` VARCHAR( 256 ) NOT NULL ; +ALTER TABLE `links` CHANGE `src_if` `local_interface_id` INT( 11 ) NULL DEFAULT NULL ,CHANGE `dst_if` `remote_interface_id` INT( 11 ) NULL DEFAULT NULL ; +ALTER TABLE `links` CHANGE `vendor` `protocol` VARCHAR( 11 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL; +ALTER TABLE `processors` CHANGE `processor_type` `processor_type` varchar(16) NOT NULL; +ALTER TABLE `bgpPeers_cbgp` CHANGE `afi` `afi` VARCHAR( 16 ) NOT NULL , CHANGE `safi` `safi` VARCHAR( 16 ) NOT NULL; +ALTER TABLE `eventlog` ADD `reference` VARCHAR( 64 ) NOT NULL AFTER `type`; +ALTER TABLE `syslog` CHANGE `datetime` `timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP; +ALTER TABLE `syslog` DROP `host`, DROP `processed`; +RENAME TABLE `interfaces` TO `ports` ; +RENAME TABLE `interfaces_perms` TO `ports_perms` ; +ALTER TABLE `temperature` CHANGE `temp_index` `temp_index` VARCHAR( 32 ) NOT NULL AFTER `device_id` , ADD `temp_type` VARCHAR( 16 ) NOT NULL AFTER `temp_index`; +ALTER TABLE `processors` CHANGE `processor_oid` `processor_oid` VARCHAR( 128 ) NOT NULL; +ALTER TABLE eventlog CHANGE `type` `type` VARCHAR( 64 ) NOT NULL; +ALTER TABLE `services` CHANGE `service_host` `device_id` INT( 11 ) NOT NULL; +CREATE TABLE IF NOT EXISTS `mempools` ( `mempool_id` int(11) NOT NULL AUTO_INCREMENT, `mempool_index` varchar(8) CHARACTER SET latin1 NOT NULL, `entPhysicalIndex` int(11) DEFAULT NULL, `hrDeviceIndex` int(11) DEFAULT NULL, `mempool_type` varchar(32) CHARACTER SET latin1 NOT NULL, `mempool_precision` int(11) NOT NULL DEFAULT '1', `mempool_descr` varchar(32) CHARACTER SET latin1 NOT NULL, `device_id` int(11) NOT NULL, `mempool_used` int(11) NOT NULL, `mempool_free` int(11) NOT NULL, `mempool_total` int(11) NOT NULL, `mempool_largestfree` int(11) DEFAULT NULL, `mempool_lowestfree` int(11) DEFAULT NULL, PRIMARY KEY (`mempool_id`), KEY `device_id` (`device_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin ; +ALTER TABLE `storage` CHANGE `storage_id` `storage_id` INT( 11 ) NOT NULL AUTO_INCREMENT , CHANGE `host_id` `device_id` INT( 11 ) NOT NULL , CHANGE `hrStorageIndex` `storage_index` INT( 11 ) NOT NULL , CHANGE `hrStorageType` `storage_type` VARCHAR( 32 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL , CHANGE `hrStorageDescr` `storage_descr` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL , CHANGE `hrStorageSize` `storage_size` INT( 11 ) NOT NULL , CHANGE `hrStorageAllocationUnits` `storage_units` INT( 11 ) NOT NULL , CHANGE `hrStorageUsed` `storage_used` INT( 11 ) NOT NULL , CHANGE `storage_perc` `storage_perc` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL; +ALTER TABLE `storage` ADD `storage_mib` VARCHAR( 16 ) NOT NULL AFTER `device_id`; +ALTER TABLE `storage` ADD `storage_free` INT NOT NULL AFTER `storage_used`; +ALTER TABLE `storage` CHANGE `storage_size` `storage_size` BIGINT NOT NULL ,CHANGE `storage_used` `storage_used` BIGINT NOT NULL ,CHANGE `storage_free` `storage_free` BIGINT NOT NULL; +ALTER TABLE `mempools` CHANGE `mempool_used` `mempool_used` BIGINT( 20 ) NOT NULL , +CHANGE `mempool_free` `mempool_free` BIGINT( 20 ) NOT NULL ,CHANGE `mempool_total` `mempool_total` BIGINT( 20 ) NOT NULL ,CHANGE `mempool_largestfree` `mempool_largestfree` BIGINT( 20 ) NULL DEFAULT NULL ,CHANGE `mempool_lowestfree` `mempool_lowestfree` BIGINT( 20 ) NULL DEFAULT NULL; +CREATE TABLE IF NOT EXISTS `juniAtmVp` ( `juniAtmVp_id` int(11) NOT NULL AUTO_INCREMENT, `interface_id` int(11) NOT NULL, `vp_id` int(11) NOT NULL, `vp_descr` varchar(32) NOT NULL, PRIMARY KEY (`juniAtmVp_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + diff --git a/sql-schema/003.sql b/sql-schema/003.sql new file mode 100644 index 000000000..9c1cf2fea --- /dev/null +++ b/sql-schema/003.sql @@ -0,0 +1,42 @@ +CREATE TABLE IF NOT EXISTS `toner` ( `toner_id` int(11) NOT NULL auto_increment, `device_id` int(11) NOT NULL default '0', `toner_index` int(11) NOT NULL, `toner_type` varchar(64) NOT NULL, `toner_oid` varchar(64) NOT NULL, `toner_descr` varchar(32) NOT NULL default '', `toner_capacity` int(11) NOT NULL default '0', `toner_current` int(11) NOT NULL default '0', PRIMARY KEY (`toner_id`), KEY `device_id` (`device_id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1; +ALTER TABLE `mempools` CHANGE `mempool_descr` `mempool_descr` VARCHAR( 64 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL; +ALTER TABLE `processors` CHANGE `processor_descr` `processor_descr` VARCHAR( 64 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL; +DROP TABLE `cempMemPool`; +DROP TABLE `cpmCPU`; +DROP TABLE `cmpMemPool`; +ALTER TABLE `mempools` CHANGE `mempool_used` `mempool_used` BIGINT( 16 ) NOT NULL ,CHANGE `mempool_free` `mempool_free` BIGINT( 16 ) NOT NULL ,CHANGE `mempool_total` `mempool_total` BIGINT( 16 ) NOT NULL ,CHANGE `mempool_largestfree` `mempool_largestfree` BIGINT( 16 ) NULL DEFAULT NULL ,CHANGE `mempool_lowestfree` `mempool_lowestfree` BIGINT( 16 ) NULL DEFAULT NULL ; +ALTER TABLE `ports` ADD `port_descr_type` VARCHAR( 32 ) NULL DEFAULT NULL AFTER `device_id` ,ADD `port_descr_descr` VARCHAR( 64 ) NULL DEFAULT NULL AFTER `port_descr_type` ,ADD `port_descr_circuit` VARCHAR( 64 ) NULL DEFAULT NULL AFTER `port_descr_descr` ,ADD `port_descr_speed` VARCHAR( 32 ) NULL DEFAULT NULL AFTER `port_descr_circuit` ,ADD `port_descr_notes` VARCHAR( 128 ) NULL DEFAULT NULL AFTER `port_descr_speed`; +CREATE TABLE IF NOT EXISTS `frequency` ( `freq_id` int(11) NOT NULL auto_increment, `device_id` int(11) NOT NULL default '0', `freq_oid` varchar(64) NOT NULL, `freq_index` varchar(8) NOT NULL, `freq_type` varchar(32) NOT NULL, `freq_descr` varchar(32) NOT NULL default '', `freq_precision` int(11) NOT NULL default '1', `freq_current` float default NULL, `freq_limit` float default NULL, `freq_limit_low` float default NULL, PRIMARY KEY (`freq_id`), KEY `freq_host` (`device_id`)) ENGINE=MyISAM AUTO_INCREMENT=189 DEFAULT CHARSET=latin1; +ALTER TABLE `temperature` CHANGE `temp_index` `temp_index` int(11) NOT NULL; +CREATE TABLE IF NOT EXISTS `current` ( `current_id` int(11) NOT NULL auto_increment, `device_id` int(11) NOT NULL default '0', `current_oid` varchar(64) NOT NULL, `current_index` varchar(8) NOT NULL, `current_type` varchar(32) NOT NULL, `current_descr` varchar(32) NOT NULL default '', `current_precision` int(11) NOT NULL default '1', `current_current` float default NULL, `current_limit` float default NULL, `current_limit_warn` float default NULL, `current_limit_low` float default NULL, PRIMARY KEY (`current_id`), KEY `current_host` (`device_id`)) ENGINE=MyISAM AUTO_INCREMENT=189 DEFAULT CHARSET=latin1; +ALTER TABLE `devices` ADD `serial` text default NULL; +ALTER TABLE `temperature` CHANGE `temp_index` `temp_index` VARCHAR(32) NOT NULL; +ALTER TABLE `ports` CHANGE `ifDescr` `ifDescr` VARCHAR(255) NOT NULL; +CREATE TABLE IF NOT EXISTS `ucd_diskio` ( `diskio_id` int(11) NOT NULL AUTO_INCREMENT, `device_id` int(11) NOT NULL, `diskio_index` int(11) NOT NULL, `diskio_descr` varchar(32) NOT NULL, PRIMARY KEY (`diskio_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ; +ALTER TABLE `eventlog` CHANGE `type` `type` VARCHAR( 64 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL; +ALTER TABLE `bills` ADD `bill_custid` VARCHAR( 64 ) NOT NULL ,ADD `bill_ref` VARCHAR( 64 ) NOT NULL ,ADD `bill_notes` VARCHAR( 256 ) NOT NULL; +CREATE TABLE IF NOT EXISTS `applications` ( `app_id` int(11) NOT NULL AUTO_INCREMENT, `device_id` int(11) NOT NULL, `app_type` varchar(64) NOT NULL, PRIMARY KEY (`app_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; +## 0.10.6 +CREATE TABLE IF NOT EXISTS `sensors` ( `sensor_id` int(11) NOT NULL auto_increment, `sensor_class` varchar(64) NOT NULL, `device_id` int(11) NOT NULL default '0', `sensor_oid` varchar(64) NOT NULL, `sensor_index` varchar(8) NOT NULL, `sensor_type` varchar(32) NOT NULL, `sensor_descr` varchar(32) NOT NULL default '', `sensor_precision` int(11) NOT NULL default '1', `sensor_current` float default NULL, `sensor_limit` float default NULL, `sensor_limit_warn` float default NULL, `sensor_limit_low` float default NULL, `sensor_limit_low_warn` float default NULL, PRIMARY KEY (`sensor_id`), KEY `sensor_host` (`device_id`)) ENGINE=MyISAM AUTO_INCREMENT=189 DEFAULT CHARSET=latin1; +ALTER TABLE `devices` CHANGE `type` `type` VARCHAR(20) NOT NULL; +ALTER TABLE `voltage` CHANGE `volt_index` `volt_index` VARCHAR(10) NOT NULL; +ALTER TABLE `frequency` CHANGE `freq_index` `freq_index` VARCHAR(10) NOT NULL; +ALTER TABLE `sensors` CHANGE `sensor_index` `sensor_index` VARCHAR(10) NOT NULL; +DROP TABLE `fanspeed`; +DROP TABLE `temperature`; +DROP TABLE `voltage`; +DROP TABLE `current`; +ALTER TABLE `sensors` ADD `entPhysicalIndex` VARCHAR( 16 ) NULL; +ALTER TABLE `sensors` ADD `entPhysicalIndex_measured` VARCHAR(16) NULL; +ALTER TABLE `processors` DROP INDEX `cpuCPU_id`; +ALTER TABLE `processors` ADD INDEX ( `device_id` ); +ALTER TABLE `ucd_diskio` ADD INDEX ( `device_id` ); +ALTER TABLE `storage` ADD INDEX ( `device_id` ); +ALTER TABLE `mac_accounting` ADD INDEX ( `interface_id` ); +ALTER TABLE `ipv4_addresses` ADD INDEX ( `interface_id` ); +ALTER TABLE `ipv6_addresses` ADD INDEX ( `interface_id` ); +ALTER TABLE `ipv4_mac` ADD INDEX ( `interface_id` ); +CREATE TABLE IF NOT EXISTS `ports_adsl` ( `interface_id` int(11) NOT NULL, `port_adsl_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `adslLineCoding` varchar(8) COLLATE utf8_bin NOT NULL, `adslLineType` varchar(16) COLLATE utf8_bin NOT NULL, `adslAtucInvVendorID` varchar(8) COLLATE utf8_bin NOT NULL, `adslAtucInvVersionNumber` varchar(8) COLLATE utf8_bin NOT NULL, `adslAtucCurrSnrMgn` decimal(5,1) NOT NULL, `adslAtucCurrAtn` decimal(5,1) NOT NULL, `adslAtucCurrOutputPwr` decimal(5,1) NOT NULL, `adslAtucCurrAttainableRate` int(11) NOT NULL, `adslAtucChanCurrTxRate` int(11) NOT NULL, `adslAturInvSerialNumber` varchar(8) COLLATE utf8_bin NOT NULL, `adslAturInvVendorID` varchar(8) COLLATE utf8_bin NOT NULL, `adslAturInvVersionNumber` varchar(8) COLLATE utf8_bin NOT NULL, `adslAturChanCurrTxRate` int(11) NOT NULL, `adslAturCurrSnrMgn` decimal(5,1) NOT NULL, `adslAturCurrAtn` decimal(5,1) NOT NULL, `adslAturCurrOutputPwr` decimal(5,1) NOT NULL, `adslAturCurrAttainableRate` int(11) NOT NULL, UNIQUE KEY `interface_id` (`interface_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +## 0.10.7 +ALTER TABLE `devices` ADD `last_polled_timetaken` DOUBLE( 5, 2 ) NOT NULL AFTER `last_polled` , ADD `last_discovered_timetaken` DOUBLE( 5, 2 ) NOT NULL AFTER `last_polled_timetaken`; +CREATE TABLE IF NOT EXISTS `perf_times` ( `type` varchar(8) NOT NULL, `doing` varchar(64) NOT NULL, `start` int(11) NOT NULL, `duration` double(5,2) NOT NULL, `devices` int(11) NOT NULL, KEY `type` (`type`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/sql-schema/004.sql b/sql-schema/004.sql new file mode 100644 index 000000000..620bde194 --- /dev/null +++ b/sql-schema/004.sql @@ -0,0 +1,50 @@ +## 0.10.7.1 +ALTER TABLE `bills` ADD `bill_autoadded` BOOLEAN NOT NULL DEFAULT '0'; +ALTER TABLE `bill_ports` ADD `bill_port_autoadded` BOOLEAN NOT NULL DEFAULT '0'; +ALTER TABLE `sensors` CHANGE `sensor_precision` `sensor_divisor` INT( 11 ) NOT NULL DEFAULT '1' +ALTER TABLE `sensors` ADD `sensor_multiplier` INT( 11 ) NOT NULL AFTER `sensor_divisor`; +CREATE TABLE IF NOT EXISTS `device_graphs` ( `device_id` int(11) NOT NULL, `graph` varchar(32) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +DROP TABLE IF EXISTS `graph_types`; +CREATE TABLE IF NOT EXISTS `graph_types` ( `graph_type` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_subtype` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_section` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `graph_descr` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `graph_order` int(11) NOT NULL, KEY `graph_type` (`graph_type`), KEY `graph_subtype` (`graph_subtype`), KEY `graph_section` (`graph_section`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +INSERT INTO `graph_types` (`graph_type`, `graph_subtype`, `graph_section`, `graph_descr`, `graph_order`) VALUES('device', 'bits', 'netstats', 'Total Traffic', 0),('device', 'hr_users', 'system', 'Users Logged In', 0),('device', 'ucd_load', 'system', 'Load Averages', 0),('device', 'ucd_cpu', 'system', 'Detailed Processor Usage', 0),('device', 'ucd_memory', 'system', 'Detailed Memory Usage', 0),('device', 'netstat_tcp', 'netstats', 'TCP Statistics', 0),('device', 'netstat_icmp_info', 'netstats', 'ICMP Informational Statistics', 0),('device', 'netstat_icmp_stat', 'netstats', 'ICMP Statistics', 0),('device', 'netstat_ip', 'netstats', 'IP Statistics', 0),('device', 'netstat_ip_frag', 'netstats', 'IP Fragmentation Statistics', 0),('device', 'netstat_udp', 'netstats', 'UDP Statistics', 0),('device', 'netstat_snmp', 'netstats', 'SNMP Statistics', 0),('device', 'temperatures', 'system', 'Temperatures', 0),('device', 'mempools', 'system', 'Memory Pool Usage', 0),('device', 'processors', 'system', 'Processor Usage', 0),('device', 'storage', 'system', 'Filesystem Usage', 0),('device', 'hr_processes', 'system', 'Running Processes', 0),('device', 'uptime', 'system', 'System Uptime', ''),('device', 'ipsystemstats_ipv4', 'netstats', 'IPv4 Packet Statistics', 0),('device', 'ipsystemstats_ipv6_frag', 'netstats', 'IPv6 Fragmentation Statistics', 0),('device', 'ipsystemstats_ipv6', 'netstats', 'IPv6 Packet Statistics', 0),('device', 'ipsystemstats_ipv4_frag', 'netstats', 'IPv4 Fragmentation Statistics', 0),('device', 'fortigate_sessions', 'firewall', 'Active Sessions', ''), ('device', 'screenos_sessions', 'firewall', 'Active Sessions', ''), ('device', 'fdb_count', 'system', 'MAC Addresses Learnt', '0'),('device', 'cras_sessions', 'firewall', 'Remote Access Sessions', 0); +DROP TABLE `frequency`; +ALTER TABLE `mempools` CHANGE `mempool_index` `mempool_index` VARCHAR( 16 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL; +ALTER TABLE `vrfs` CHANGE `mplsVpnVrfRouteDistinguisher` `mplsVpnVrfRouteDistinguisher` varchar(26) default NOT NULL; +## Change port rrds +ALTER TABLE `devices` ADD `timeout` INT NULL DEFAULT NULL AFTER `port`; +ALTER TABLE `devices` ADD `retries` INT NULL DEFAULT NULL AFTER `timeout`; +ALTER TABLE `ports` ADD `disabled` tinyint(1) NOT NULL DEFAULT '0' AFTER `ignore`; +ALTER TABLE `perf_times` CHANGE `duration` `duration` DOUBLE( 8, 2 ) NOT NULL +ALTER TABLE `sensors` ADD `poller_type` VARCHAR(16) NOT NULL DEFAULT 'snmp' AFTER `device_id`; +## Add transport +ALTER TABLE `devices` ADD `transport` VARCHAR(16) NOT NULL DEFAULT 'udp' AFTER `port`; +## Extend port descriptions +ALTER TABLE ports MODIFY port_descr_circuit VARCHAR(255); +ALTER TABLE ports MODIFY port_descr_descr VARCHAR(255); +ALTER TABLE ports MODIFY port_descr_notes VARCHAR(255); +ALTER TABLE devices MODIFY community VARCHAR(255); +ALTER TABLE users MODIFY password VARCHAR(34); +ALTER TABLE sensors MODIFY sensor_descr VARCHAR(255); +ALTER TABLE `vrfs` MODIFY `mplsVpnVrfRouteDistinguisher` VARCHAR(128); +ALTER TABLE `vrfs` MODIFY `vrf_name` VARCHAR(128); +ALTER TABLE `ports` MODIFY `ifDescr` VARCHAR(255); +CREATE TABLE IF NOT EXISTS `vminfo` (`id` int(11) NOT NULL AUTO_INCREMENT, `device_id` int(11) NOT NULL, `vmwVmVMID` int(11) NOT NULL, `vmwVmDisplayName` varchar(128) NOT NULL, `vmwVmGuestOS` varchar(128) NOT NULL, `vmwVmMemSize` int(11) NOT NULL, `vmwVmCpus` int(11) NOT NULL, `vmwVmState` varchar(128) NOT NULL, PRIMARY KEY (`id`), KEY `device_id` (`device_id`), KEY `vmwVmVMID` (`vmwVmVMID`)) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `ports` MODIFY `port_descr_type` VARCHAR(255); +RENAME TABLE `vmware_vminfo` TO `vminfo` ; +ALTER TABLE `vminfo` ADD `vm_type` VARCHAR(16) NOT NULL DEFAULT 'vmware' AFTER `device_id`; +CREATE TABLE IF NOT EXISTS `cef_switching` ( `device_id` int(11) NOT NULL, `entPhysicalIndex` int(11) NOT NULL, `afi` varchar(4) COLLATE utf8_unicode_ci NOT NULL, `cef_index` int(11) NOT NULL, `cef_path` varchar(16) COLLATE utf8_unicode_ci NOT NULL, `drop` int(11) NOT NULL, `punt` int(11) NOT NULL, `punt2host` int(11) NOT NULL, `drop_prev` int(11) NOT NULL, `punt_prev` int(11) NOT NULL, `punt2host_prev` int(11) NOT NULL,`updated` INT NOT NULL , `updated_prev` INT NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +ALTER TABLE `mac_accounting` CHANGE `peer_mac` `mac` VARCHAR( 32 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL; +ALTER TABLE `mac_accounting` DROP `peer_ip`, DROP `peer_desc`, DROP `peer_asn`; +UPDATE sensors SET sensor_class='frequency' WHERE sensor_class='freq'; +ALTER TABLE `cef_switching` ADD `cef_switching_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST; +ALTER TABLE `mempools` ADD `mempool_perc` INT NOT NULL AFTER `device_id`; +ALTER TABLE `ports` ADD UNIQUE `device_ifIndex` ( `device_id` , `ifIndex` ); +ALTER TABLE `ports` DROP INDEX `host`; +ALTER TABLE `ports` DROP INDEX `snmpid`; +CREATE TABLE IF NOT EXISTS `ospf_areas` ( `device_id` int(11) NOT NULL, `ospfAreaId` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfAuthType` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `ospfImportAsExtern` varchar(128) COLLATE utf8_unicode_ci NOT NULL, `ospfSpfRuns` int(11) NOT NULL, `ospfAreaBdrRtrCount` int(11) NOT NULL, `ospfAsBdrRtrCount` int(11) NOT NULL, `ospfAreaLsaCount` int(11) NOT NULL, `ospfAreaLsaCksumSum` int(11) NOT NULL, `ospfAreaSummary` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `ospfAreaStatus` varchar(64) COLLATE utf8_unicode_ci NOT NULL, UNIQUE KEY `device_area` (`device_id`,`ospfAreaId`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TABLE IF NOT EXISTS `ospf_instances` ( `device_id` int(11) NOT NULL, `ospf_instance_id` int(11) NOT NULL, `ospfRouterId` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfAdminStat` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfVersionNumber` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfAreaBdrRtrStatus` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfASBdrRtrStatus` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfExternLsaCount` int(11) NOT NULL, `ospfExternLsaCksumSum` int(11) NOT NULL, `ospfTOSSupport` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfOriginateNewLsas` int(11) NOT NULL, `ospfRxNewLsas` int(11) NOT NULL, `ospfExtLsdbLimit` int(11) DEFAULT NULL, `ospfMulticastExtensions` int(11) DEFAULT NULL, `ospfExitOverflowInterval` int(11) DEFAULT NULL, `ospfDemandExtensions` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, UNIQUE KEY `device_id` (`device_id`,`ospf_instance_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TABLE IF NOT EXISTS `ospf_ports` ( `device_id` int(11) NOT NULL, `interface_id` int(11) NOT NULL, `ospf_port_id` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfIfIpAddress` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfAddressLessIf` int(11) NOT NULL, `ospfIfAreaId` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfIfType` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, `ospfIfAdminStat` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, `ospfIfRtrPriority` int(11) DEFAULT NULL, `ospfIfTransitDelay` int(11) DEFAULT NULL, `ospfIfRetransInterval` int(11) DEFAULT NULL, `ospfIfHelloInterval` int(11) DEFAULT NULL, `ospfIfRtrDeadInterval` int(11) DEFAULT NULL, `ospfIfPollInterval` int(11) DEFAULT NULL, `ospfIfState` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, `ospfIfDesignatedRouter` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, `ospfIfBackupDesignatedRouter` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, `ospfIfEvents` int(11) DEFAULT NULL, `ospfIfAuthKey` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL, `ospfIfStatus` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, `ospfIfMulticastForwarding` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, `ospfIfDemand` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, `ospfIfAuthType` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL, UNIQUE KEY `device_id` (`device_id`,`interface_id`,`ospf_port_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TABLE IF NOT EXISTS `ospf_nbrs` ( `device_id` int(11) NOT NULL, `interface_id` int(11) NOT NULL, `ospf_nbr_id` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfNbrIpAddr` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfNbrAddressLessIndex` int(11) NOT NULL, `ospfNbrRtrId` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfNbrOptions` int(11) NOT NULL, `ospfNbrPriority` int(11) NOT NULL, `ospfNbrState` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfNbrEvents` int(11) NOT NULL, `ospfNbrLsRetransQLen` int(11) NOT NULL, `ospfNbmaNbrStatus` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfNbmaNbrPermanence` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `ospfNbrHelloSuppressed` varchar(32) COLLATE utf8_unicode_ci NOT NULL, UNIQUE KEY `device_id` (`device_id`,`ospf_nbr_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +CREATE TABLE IF NOT EXISTS `ports_stack` (`interface_id_high` INT NOT NULL ,`interface_id_low` INT NOT NULL) ENGINE = INNODB; +ALTER TABLE `ports_stack` ADD `device_id` INT NOT NULL; +ALTER TABLE `ports_stack` ADD `ifStackStatus` VARCHAR(32); diff --git a/sql-schema/005.sql b/sql-schema/005.sql new file mode 100644 index 000000000..e569403c0 --- /dev/null +++ b/sql-schema/005.sql @@ -0,0 +1,13 @@ +ALTER TABLE users ADD can_modify_passwd TINYINT NOT NULL DEFAULT 1; +ALTER TABLE `storage` ADD UNIQUE `index_unique` ( `device_id` , `storage_mib` , `storage_index` ); +ALTER TABLE `bgpPeers_cbgp` ADD `AcceptedPrefixes` INT NOT NULL ,ADD `DeniedPrefixes` INT NOT NULL ,ADD `PrefixAdminLimit` INT NOT NULL ,ADD `PrefixThreshold` INT NOT NULL ,ADD `PrefixClearThreshold` INT NOT NULL ,ADD `AdvertisedPrefixes` INT NOT NULL ,ADD `SuppressedPrefixes` INT NOT NULL ,ADD `WithdrawnPrefixes` INT NOT NULL; +ALTER TABLE `bgpPeers_cbgp` ADD UNIQUE `unique_index` ( `device_id` , `bgpPeerIdentifier` , `afi` , `safi` ); +ALTER TABLE `ports` ADD UNIQUE `device_ifIndex` ( `device_id` , `ifIndex` ); +ALTER TABLE `devices` CHANGE `port` `port` SMALLINT( 5 ) UNSIGNED NOT NULL DEFAULT '161'; +CREATE TABLE IF NOT EXISTS `ipsec_tunnels` ( `tunnel_id` int(11) NOT NULL AUTO_INCREMENT, `device_id` int(11) NOT NULL, `peer_port` int(11) NOT NULL, `peer_addr` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `local_addr` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `local_port` int(11) NOT NULL, `tunnel_name` varchar(96) COLLATE utf8_unicode_ci NOT NULL, `tunnel_status` varchar(11) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`tunnel_id`), UNIQUE KEY `unique_index` (`device_id`,`peer_addr`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; +ALTER TABLE `syslog` ADD INDEX ( `program` ); +ALTER TABLE `devices` ADD `sysObjectID` VARCHAR( 64 ) NULL DEFAULT NULL AFTER `bgpLocalAs`; +ALTER TABLE `ports` CHANGE `ifSpeed` `ifSpeed` BIGINT NULL DEFAULT NULL; +ALTER TABLE `sensors` CHANGE `sensor_oid` `sensor_oid` VARCHAR( 255 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL; +CREATE TABLE IF NOT EXISTS `entPhysical_state` ( `device_id` int(11) NOT NULL, `entPhysicalIndex` varchar(64) NOT NULL, `subindex` varchar(64) DEFAULT NULL, `group` varchar(64) NOT NULL, `key` varchar(64) NOT NULL, `value` varchar(255) NOT NULL, KEY `device_id_index` (`device_id`,`entPhysicalIndex`)) ENGINE=MyISAM DEFAULT CHARSET=latin1; +CREATE TABLE IF NOT EXISTS `ports_vlans` ( `port_vlan_id` int(11) NOT NULL AUTO_INCREMENT, `device_id` int(11) NOT NULL, `interface_id` int(11) NOT NULL, `vlan` int(11) NOT NULL, `baseport` int(11) NOT NULL, `priority` bigint(32) NOT NULL, `state` varchar(16) NOT NULL, `cost` int(11) NOT NULL, PRIMARY KEY (`port_vlan_id`), UNIQUE KEY `unique` (`device_id`,`interface_id`,`vlan`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 ; diff --git a/sql-schema/006.sql b/sql-schema/006.sql new file mode 100644 index 000000000..9cc37039a --- /dev/null +++ b/sql-schema/006.sql @@ -0,0 +1,6 @@ +ALTER TABLE `bills` CHANGE `bill_cdr` `bill_cdr` BIGINT( 20 ) NULL DEFAULT NULL; +CREATE TABLE IF NOT EXISTS `loadbalancer_rservers` ( `rserver_id` int(11) NOT NULL AUTO_INCREMENT, `farm_id` varchar(128) CHARACTER SET utf8 NOT NULL, `device_id` int(11) NOT NULL, `StateDescr` varchar(64) CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`rserver_id`)) ENGINE=MyISAM AUTO_INCREMENT=514 DEFAULT CHARSET=utf8 +CREATE TABLE IF NOT EXISTS `loadbalancer_vservers` ( `classmap_id` int(11) NOT NULL, `classmap` varchar(128) NOT NULL, `serverstate` varchar(64) NOT NULL, `device_id` int(11) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 +ALTER TABLE `sensors` CHANGE `sensor_index` `sensor_index` VARCHAR( 64 ); +CREATE TABLE IF NOT EXISTS `netscaler_vservers` ( `vsvr_id` int(11) NOT NULL AUTO_INCREMENT, `device_id` int(11) NOT NULL, `vsvr_name` varchar(128) COLLATE utf8_unicode_ci NOT NULL, `vsvr_ip` varchar(128) COLLATE utf8_unicode_ci NOT NULL, `vsvr_port` int(8) NOT NULL, `vsvr_type` varchar(64) COLLATE utf8_unicode_ci NOT NULL, `vsvr_state` varchar(32) COLLATE utf8_unicode_ci NOT NULL, `vsvr_clients` int(11) NOT NULL, `vsvr_server` int(11) NOT NULL, `vsvr_req_rate` int(11) NOT NULL, `vsvr_bps_in` int(11) NOT NULL, `vsvr_bps_out` int(11) NOT NULL, PRIMARY KEY (`vsvr_id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ; +ALTER TABLE `dbSchema` ADD `version` INT NOT NULL; diff --git a/sql-schema/007.sql b/sql-schema/007.sql new file mode 100644 index 000000000..9b1a3b302 --- /dev/null +++ b/sql-schema/007.sql @@ -0,0 +1 @@ +ALTER TABLE `dbSchema` DROP `revision`;