This project is read-only.
At the moment this document assumes that you understand how to install SQL Server 2008 R2 and how to configure an instance of IIS6 or 7. Once the code matures a bit more in the future I will have a nicer install doc written and most of this process will be automated.

Step 1
Using Microsoft SQL Server Management create a database called mrinventory

Step 2
Now run the following against mrinventory as a new query

/*Create inv_servers*/
USE mrinventory
GO

CREATE TABLE inv_servers
(
	id		int	IDENTITY NOT NULL    PRIMARY KEY,
	name	varchar(255)	NOT NULL CONSTRAINT  UniqueName UNIQUE,
	os		varchar(255)	NOT NULL DEFAULT 'N/A',
	software	varchar(255)	NOT NULL DEFAULT 'N/A',
	vm		varchar(255)	NOT NULL DEFAULT 'N/A',
	ip		varchar(255)	NOT NULL DEFAULT 'N/A',
	model	varchar(255)	NOT NULL DEFAULT 'N/A',
	serial	varchar(255)	NOT NULL DEFAULT 'N/A',
	cpu		varchar(255)	NOT NULL DEFAULT 'N/A',
	mem		varchar(255)	NOT NULL DEFAULT 'N/A',
	hd		varchar(255)	NOT NULL DEFAULT 'N/A',
	location	varchar(255)	NOT NULL DEFAULT 'N/A',
	notes	varchar(MAX)	NOT NULL DEFAULT 'N/A'
);

/*Create stored procedure for inserting a new server*/

GO

CREATE PROC spInsertServ
    @name	varchar(255),
    @os		varchar(255) = 'N\A',
    @software   varchar(255) = 'N\A',
    @vm		varchar(2) = 'N\A',
    @ip		varchar(255) = 'N\A',
    @model	varchar(255) = 'N\A',
    @serial	varchar(255) = 'N\A',
    @cpu	varchar(255) = 'N\A',
    @mem	varchar(255) = 'N\A',
    @hd		varchar(255) = 'N\A',
    @location	varchar(255) = 'N\A',
    @notes	varchar(1024) = 'No notes given'

AS 
    INSERT INTO inv_servers
    VALUES
       (
          @name,
          @os,
          @software,
          @vm,
          @ip,
          @model,
          @serial,
          @cpu,
          @mem,
          @hd,
          @location,
          @notes
        );
        
/*Delete server from inventory*/

GO

CREATE PROC spDelServ
   @name varchar(255)

AS
   DELETE FROM inv_servers
   WHERE (name = @name);
   

/*Find server by name and return all info*/


GO

CREATE PROC spFindServName
    @name	varchar(255)     
    
AS
   SELECT * FROM inv_servers
   WHERE name LIKE '%' + @name + '%';

/*Get by exact name*/


GO

CREATE PROC spGetByName
    @name	varchar(255)     
    
AS
   SELECT * FROM inv_servers
   WHERE name = @name; 

/*Find server by id and return all info*/


GO

CREATE PROC spFindServId
		@id	varchar(255)     
    
AS
   SELECT * FROM inv_servers
   WHERE id = @id;

/*Update server info*/

GO

CREATE PROC spUpdateServ
    @id		int,
    @name	varchar(255),
    @os		varchar(255),
    @software   varchar(255),
    @vm		varchar(2),
    @ip		varchar(255),
    @model	varchar(255),
    @serial	varchar(255),
    @cpu	varchar(255),
    @mem	varchar(255),
    @hd		varchar(255),
    @location	varchar(255),
    @notes	varchar(1024) 

AS 
    UPDATE inv_servers SET 
		   name = @name,
		   os   = @os,
		   software = @software,
		   vm = @vm,
		   ip = @ip,
		   model = @model,
		   serial = @serial,
		   cpu = @cpu,
		   mem = @mem,
		   hd = @hd,
		   location = @location,
		   notes = @notes
	WHERE id = @id;

/*Return ALL servers*/
Go

CREATE PROC spGetAllServ
AS
    SELECT * FROM inv_servers;	   

/*Return column names*/

Go

CREATE PROC spGetColNames
AS
SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS
	           WHERE TABLE_SCHEMA = 'dbo'
	           AND table_name = 'inv_servers';
	           
/* Get Column names*/

GO

CREATE PROC spGetColNames
AS
SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS
	           WHERE TABLE_SCHEMA = 'dbo'
	           AND table_name = 'inv_servers';
	           
	           
/*Create example servers */	

GO 
        
INSERT INTO inv_servers
	VALUES ('Server1', 'Server 2003', 
		    'Exchange 2007', 'no', 
		    '10.10.10.5/32', 'IBM HS20', 
		    '12FG33541Z', '2.8Ghz(2x)', 
		    '4096MB', '1.5TB', 'Site1', 
		    'Example notes');   
		    
		    INSERT INTO inv_servers
	VALUES ('Server2', 'Server 2008 R2', 
		    'Exchange 2010', 'yes', 
		    '10.10.10.6/32', 'IBM HS22', 
		    '45SG32541Z', '3.8Ghz(4x)', 
		    '4096MB', '1.5TB', 'Site1', 
		    'Example notes');
		    
		    
		   INSERT INTO inv_servers
	VALUES ('Server3', 'RHEL 5.5', 
		    'Sympa List Serv', 'no', 
		    '10.10.10.25/32', 'IBM HS21', 
		    '14FP33541O', '2.8Ghz(2x)', 
		    '2048MB', '120GB', 'Site3', 
		    'Example notes');
		    
		    INSERT INTO inv_servers
	VALUES ('Server4', 'AIX 5.3', 
		    'Oracle 10g', 'lpar', 
		    '10.20.20.2/32', 'p570', 
		    '02FG33841K', '2.8Ghz(2x)', 
		    '4096MB', '2TB', 'Site6', 
		    'Example notes');
		    
INSERT INTO inv_servers
	VALUES ('Server5', 'RHEL 5.5', 
		    'Apache 2.3', 'no', 
		    '10.10.10.4/32', 'IBM HS20', 
		    '15HG33541L', '2.8Ghz(2x)', 
		    '4096MB', '1.5TB', 'Site1', 
		    'Example notes');







Step 3
Once the script is run you will need to create a new SQL account named ck and grant it ownership of mrinventory.
You will also need to make note of what password you have set for this account as you will have to add it in later to the web.config.

Step 4
Now that your SQL DB is ready to roll you need to install the Mr Inventory web front end.
To do this create a new site in IIS and give it an alias of Mr Inventory.
Make sure you also have an entry in your hosts file for mrinventory pointed to your ip addr.

Step 5
After you have completed step four copy the contents of mr.inventory.rar to your new site's
directory. Once the copy is completed you should be able to access the site via your web browser.

File/Dir inventory
  • addserv.aspx 1
  • background.jpg 2
  • createmrinvdb.txt 3
  • default.aspx 4
  • delserv.aspx 5
  • findserv.aspx 6
  • gencsv.aspx 7
  • main_menu.ascx 8
  • PrecompiledApp.config 9
  • stykemain.css 10
  • update.aspx 11
  • web.config 12
  • bin

Last edited Oct 3, 2010 at 11:08 PM by commanderkang, version 2

Comments

No comments yet.