0d0e0911376c4398f00219f4b66ed00f9c2bf8a2
[clearscm.git] / clients / GD / FSMon / FsmonDB.sql
1 --------------------------------------------------------------------------------
2 --
3 -- File:        FsmonDB.sql
4 -- Revision:    0.1
5 -- Description: Database definition for fsmon
6 -- Author:      Andrew@ClearSCM.com
7 -- Created:     Thu Dec 11 13:43:06 MST 2008
8 -- Modified:    
9 -- Language:    SQL
10 --
11 -- Copyright (c) 2008, General Dynamics, all rights reserved
12 --
13 --------------------------------------------------------------------------------
14 -- Warning: The following line will delete the old database!
15 drop database if exists fsmon;
16
17 -- Create a new database
18 create database fsmon;
19
20 -- Now let's focus on this new database
21 use fsmon;
22
23 -- system: Contains information about the various machines that we are
24 -- monitoring file systems on
25
26 create table system (
27   name          varchar(255)    not null,
28   owner         tinytext,
29   description   text,
30   ostype        enum (
31                   "Linux",
32                   "Unix",
33                   "Windows"
34                 )               not null,
35   osversion     tinytext,
36   username      tinytext,
37   password      tinytext,
38   prompt        tinytext,
39   shellstyle    enum (
40                   "sh",
41                   "csh"
42                 )               not null,
43
44   primary key (name)
45 ) engine = InnoDB;
46   
47 -- filesystems: Describes the filesystems for a system
48 create table filesystems (
49   sysname       varchar(255)    not null,
50   mount         varchar(255)    not null,
51   fs            tinytext        not null,
52
53   primary key   (sysname, mount)
54 ) engine = InnoDB;
55
56 -- fs: Contains a snapshot reading of a filesystem at a given date and time
57 create table fs (
58   sysname       varchar(255)    not null,
59   mount         varchar(255)    not null,
60   timestamp     datetime        not null,
61   size          bigint,
62   used          bigint,  
63   free          bigint,
64   reserve       bigint,
65
66   primary key   (sysname, mount, timestamp),
67   foreign key   (sysname, mount)
68     references filesystems (sysname, mount)
69       on delete cascade
70       on update cascade
71 ) engine = InnoDB;
72
73 grant all privileges
74   on fsmon.*
75   to fsmonadm@"%"
76   identified by "fsmonadm" with grant option;
77
78 grant select
79   on fsmon.*
80   to fsmon@"%"
81   identified by "fsmon";