Chapter 30 Exporting Inventory Management System Data



Similar documents
IRF2000 IWL3000 SRC1000 Application Note - Apps with OSGi - Condition Monitoring with WWH push

Database Administration with MySQL

Customer Bank Account Management System Technical Specification Document

The SkySQL Administration Console

Oracle Database 10g Express

Data Transfer Management with esync 1.5

Mul$media im Netz (Online Mul$media) Wintersemester 2014/15. Übung 03 (Nebenfach)

Integrating VoltDB with Hadoop

A Brief Introduction to MySQL

Infinitel HotSpotWeb User Manual

INSTALLATION GUIDE. Snow License Manager Version 7.0 Release date Document date

B.1 Database Design and Definition

Backing Up TestTrack Native Project Databases

USING MYWEBSQL FIGURE 1: FIRST AUTHENTICATION LAYER (ENTER YOUR REGULAR SIMMONS USERNAME AND PASSWORD)

Connect to MySQL or Microsoft SQL Server using R

Lab 2: PostgreSQL Tutorial II: Command Line

Product: DQ Order Manager Release Notes

User Migration Tool. Note. Staging Guide for Cisco Unified ICM/Contact Center Enterprise & Hosted Release 9.0(1) 1

SQL Server An Overview

Version of this tutorial: 1.06a (this tutorial will going to evolve with versions of NWNX4)

There are numerous ways to access monitors:

Evaluator s Guide. PC-Duo Enterprise HelpDesk v5.0. Copyright 2006 Vector Networks Ltd and MetaQuest Software Inc. All rights reserved.

Using the SQL TAS v4

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

Using SQL Server Management Studio

IBM Security QRadar SIEM Version MR1. Log Sources User Guide

A table is a collection of related data entries and it consists of columns and rows.

INTRODUCTION: SQL SERVER ACCESS / LOGIN ACCOUNT INFO:

Table of Contents SQL Server Option

Dynamic DNS How-To Guide

Developing Web Applications for Microsoft SQL Server Databases - What you need to know

How To Install Storegrid Server On Linux On A Microsoft Ubuntu 7.5 (Amd64) Or Ubuntu (Amd86) (Amd77) (Orchestra) (For Ubuntu) (Permanent) (Powerpoint

Database Setup. Coding, Understanding, & Executing the SQL Database Creation Script

Avatier Identity Management Suite

Monitoring MySQL database with Verax NMS

Oracle Database 10g: Introduction to SQL

User Guide. Version 3.2. Copyright Snow Software AB. All rights reserved.

SQL Injection. Blossom Hands-on exercises for computer forensics and security

USER GUIDE WEB-BASED SYSTEM CONTROL APPLICATION. August 2014 Phone: Publication: , Rev. C

PowerLogic ION Enterprise 5.6

Setting Up Specify to use a Shared Workstation as a Database Server

How to Set Up pgagent for Postgres Plus. A Postgres Evaluation Quick Tutorial From EnterpriseDB

Using Netbeans and the Derby Database for Projects Contents

Jet Data Manager 2012 User Guide

!"# $ %& '( ! %& $ ' &)* + ! * $, $ (, ( '! -,) (# *&23. mysql> select * from from clienti;

Retrieving Data Using the SQL SELECT Statement. Copyright 2006, Oracle. All rights reserved.

G563 Quantitative Paleontology. SQL databases. An introduction. Department of Geological Sciences Indiana University. (c) 2012, P.

Installing The SysAidTM Server Locally

Using ODBC with MDaemon 6.5

CSCI110 Exercise 4: Database - MySQL

Easy Data Centralization with Webster. User Guide

FileMaker 13. ODBC and JDBC Guide

ManageEngine IT360. Professional Edition Installation Guide.

DataLogger Kepware, Inc.

MIGRATING TO AVALANCHE 5.0 WITH MS SQL SERVER

Application Notes for Configuring Dorado Software Redcell Enterprise Bundle using SNMP with Avaya Communication Manager - Issue 1.

Connecting to the Firewall Services Module and Managing the Configuration

TrueSight Operations Management Monitoring Studio

Managing User Accounts

EMC DiskXtender File System Manager for UNIX/Linux Release 3.5

Designing for Dynamic Content

SPHOL207: Database Snapshots with SharePoint 2013

Enterprise Data Integration (EDI)

LABSHEET 1: creating a table, primary keys and data types

Managing User Accounts

FileMaker 12. ODBC and JDBC Guide

BlackBerry Enterprise Server Resource Kit

Upgrade Guide BES12. Version 12.1

Richmond SupportDesk Web Reports Module For Richmond SupportDesk v6.72. User Guide

National Fire Incident Reporting System (NFIRS 5.0) Configuration Tool User's Guide

FreeRADIUS server. Defining clients Access Points and RADIUS servers

The data between TC Monitor and remote devices is exchanged using HTTP protocol. Monitored devices operate either as server or client mode.

Oracle Database Development Standards For DNR Staff and Contractors. Table of Contents

MySQL for Beginners Ed 3

IRF2000 IWL3000 SRC1000 Application Note - Develop your own Apps with OSGi - getting started

Building Data-centric Websites with Dataface. Steve Hannah Faculty of Applied Sciences Simon Fraser University

Setting Up Scan to SMB on TaskALFA series MFP s.

Basics on Geodatabases

Geodatabase Programming with SQL

How To Use The Correlog With The Cpl Powerpoint Powerpoint Cpl.Org Powerpoint.Org (Powerpoint) Powerpoint (Powerplst) And Powerpoint 2 (Powerstation) (Powerpoints) (Operations

The Web Pro Miami, Inc. 615 Santander Ave, Unit C Coral Gables, FL T: info@thewebpro.com

KonyOne Server Installer - Linux Release Notes

DBA Tutorial Kai Voigt Senior MySQL Instructor Sun Microsystems Santa Clara, April 12, 2010

How To Use Sua On A Tivoli Endpoint Manager Server On A Pc Or Macbook Or Macintosh (For A Macintosh) On A Microsoft Computer (For An Ubuntu) On An Uborg Computer (Windows) On

Citrix XenMobile Mobile Device Management

Configuring an Alternative Database for SAS Web Infrastructure Platform Services

Vector HelpDesk - Administrator s Guide

VMware vcenter Discovered Machines Import Tool User's Guide Version for vcenter Configuration Manager 5.3

Extracting META information from Interbase/Firebird SQL (INFORMATION_SCHEMA)

Junos Pulse. Windows In-Box Junos Pulse Client Quick Start Guide. Published: Copyright 2013, Juniper Networks, Inc.

Application Discovery Manager User s Guide vcenter Application Discovery Manager 6.2.1

Spectrum Technology Platform. Version 9.0. Administration Guide

Magento Theme EM0006 for Computer store

FileMaker Server 10 Help

Linas Virbalas Continuent, Inc.

CA Spectrum and CA Service Desk

Transcription:

Chapter 30 Exporting Inventory Management System Data This chapter is intended for users who are familiar with Relational Database Management Systems (RDBMS) and the Structured Query Language (SQL), who want to develop their own customer applications to access information from the JUNOScope Inventory Management System. It is not meant to be a complete SQL reference. Refer to your applicable SQL guides for complete reference information. This chapter describes how an external inventory application can connect to the JUNOScope Inventory Management System database and extract Juniper Networks device inventory information by way of an SQL interface. The JUNOScope software is bundled with MySQL, an open source relational database management system (RDBMS). (See Figure 7.) The query examples used in this chapter to extract inventory data are for MySQL. Figure 7: Export Inventory Management System Data Topology Diagram Browser Client HTTP or HTTPS JUNOScope Server JUNOScript Router 0 JDBC SQL MySQL (bundled) Router 1 Router 2 External Inventory Apps localhost g002314 External inventory applications can extract inventory data, such as hardware, software, licensed features, and inventory scan events, from the JUNOScope Inventory Management System database. A unique username and password must be configured during the JUNOScope software installation to enable read-only access to the Inventory Management System database. JUNOScope versions 7.4 and higher support extracting Inventory Management System database information to an external inventory application. 339

JUNOScope 8.2 Software User Guide This chapter also describes the SQL database schema to facilitate data export, and also describes each database table. A demo Inventory Management System database is bundled with the JUNOScope installation, which consists of tables populated with sample inventory data. You can develop scripts or programs to practice extracting data from the demonstration database without having to scan real inventory data into the production Inventory Management System database. For more information about the demo tables, see Demo Inventory Management System Database Tables on page 350. This chapter includes the following topics: Inventory Management System Database Entity Relationship on page 341 Enabling Access to the Inventory Management System SQL Interface on page 342 Changing the Username and Password and Creating Additional Users for the Inventory Management System SQL Interface on page 342 Inventory Management System Database Tables on page 345 Demo Inventory Management System Database Tables on page 350 Demo Inventory Management System Reports on page 350 Connecting to the Inventory Management System SQL Interface on page 351 Querying All Hardware Inventory Items on page 352 Querying All Hardware Inventory Items of a Device on page 353 Querying JUNOS Software and Package Inventory Items on page 353 Querying All Licensed Feature Inventory Data on page 354 Querying Inventory Events Data on page 354 340

Chapter 30: Exporting Inventory Management System Data Inventory Management System Database Entity Relationship Figure 8 shows the JUNOScope Inventory Management System database entity relationship diagram. Figure 8: Inventory Management System Database Entity Relationship Diagram hardware_inventory module_interface_version PK module version PK FK1 U1 U1 U1 id device_id serial_number part_number deleted_on csis_id version name description last_scanned last_modified created_on comment module submodule subsubmodule inventory_event_types PK id event_type software_inventory PK id FK1, U1 device_id U1 routing_engine U1 deleted_on version last_scanned last_modified created_on packages_inventory PK U1 U1 devices id name deleted_on hostname model comment PK id FK1, U1 device_id U1 routing_engine U1 name U1 deleted_on comment last_scanned last_modified created_on events_inventory PK id FK1 hardware_id FK2 software_id FK3 package_id FK4 licensing_id FK5 device_id item type event_time deleted_on description annotation licensing_inventory PK: Primary Key FK: Foreign Key U: Unique index Underline: identifier Bold: required attributes PK id FK1, U1 device_id U1 feature_name U1 deleted_on feature_description licensed_count used_count given_count given_hint needed_count last_scanned last_modified created_on g002315 Exactly one Zero or one One or more Inventory Management System Database Entity Relationship 341

JUNOScope 8.2 Software User Guide Enabling Access to the Inventory Management System SQL Interface The JUNOScope software installer can enable or disable access to the Inventory Management System SQL interface during the JUNOScope installation process. After the JUNOScope software is installed, the installer can enable or disable the SQL interface to the Inventory Management System by running the reconfiguration script jtk-setup.sh. CAUTION: Once the Inventory Management System SQL interface username and password have been added during JUNOScope software installation, the JUNOScope software will not prompt again to add them for reconfiguration. Changing the Username and Password and Creating Additional Users for the Inventory Management System SQL Interface The database administrator can change the password of the database user already configured to access the Inventory Management System SQL interface. The database administrator can also create additional users to access the Inventory Management System SQL interface and grant the required privileges by using the sample SQL query below. An SQL user with grant privileges (for example, root) can execute these statements: -- grant read-only privilege to the inventory tables of @DBNAME@ for @DBUSER_IMS@, -- per the specification of the interface module 'core' and 'ims'. -- @DBNAME@ is the name of the database, e.g. 'jtk' or 'demo' -- @DBUSER_IMS@ is the name of the database user for the SQL interface to IMS -- @DBUSER_IMS_PASSWORD@ is the password of the database user for the SQL interface to IMS GRANT SELECT (id) ON @DBNAME@.devices TO @DBUSER_IMS@@localhost IDENTIFIED BY GRANT SELECT (id) ON @DBNAME@.devices TO @DBUSER_IMS@@"127.0.0.1" IDENTIFIED BY GRANT SELECT (id) ON @DBNAME@.devices TO @DBUSER_IMS@@"@HOST_NAME@" IDENTIFIED BY GRANT SELECT (id) ON @DBNAME@.devices TO @DBUSER_IMS@@"@HOST_IP@" IDENTIFIED BY GRANT SELECT (id) ON @DBNAME@.devices TO @DBUSER_IMS@@"%" IDENTIFIED BY GRANT SELECT (name) ON @DBNAME@.devices TO @DBUSER_IMS@@localhost IDENTIFIED BY GRANT SELECT (name) ON @DBNAME@.devices TO @DBUSER_IMS@@"127.0.0.1" IDENTIFIED BY GRANT SELECT (name) ON @DBNAME@.devices TO @DBUSER_IMS@@"@HOST_NAME@" IDENTIFIED BY GRANT SELECT (name) ON @DBNAME@.devices TO @DBUSER_IMS@@"@HOST_IP@" IDENTIFIED BY GRANT SELECT (name) ON @DBNAME@.devices TO @DBUSER_IMS@@"%" IDENTIFIED BY GRANT SELECT (hostname) ON @DBNAME@.devices TO @DBUSER_IMS@@localhost IDENTIFIED BY GRANT SELECT (hostname) ON @DBNAME@.devices TO @DBUSER_IMS@@"127.0.0.1" 342 Enabling Access to the Inventory Management System SQL Interface

Chapter 30: Exporting Inventory Management System Data GRANT SELECT (hostname) ON @DBNAME@.devices TO @DBUSER_IMS@@"@HOST_NAME@" GRANT SELECT (hostname) ON @DBNAME@.devices TO @DBUSER_IMS@@"@HOST_IP@" GRANT SELECT (hostname) ON @DBNAME@.devices TO @DBUSER_IMS@@"%" IDENTIFIED BY GRANT SELECT (model) ON @DBNAME@.devices TO @DBUSER_IMS@@localhost IDENTIFIED BY GRANT SELECT (model) ON @DBNAME@.devices TO @DBUSER_IMS@@"127.0.0.1" IDENTIFIED BY GRANT SELECT (model) ON @DBNAME@.devices TO @DBUSER_IMS@@"@HOST_NAME@" GRANT SELECT (model) ON @DBNAME@.devices TO @DBUSER_IMS@@"@HOST_IP@" IDENTIFIED BY GRANT SELECT (model) ON @DBNAME@.devices TO @DBUSER_IMS@@"%" IDENTIFIED BY GRANT SELECT (comment) ON @DBNAME@.devices TO @DBUSER_IMS@@localhost IDENTIFIED BY GRANT SELECT (comment) ON @DBNAME@.devices TO @DBUSER_IMS@@"127.0.0.1" GRANT SELECT (comment) ON @DBNAME@.devices TO @DBUSER_IMS@@"@HOST_NAME@" GRANT SELECT (comment) ON @DBNAME@.devices TO @DBUSER_IMS@@"@HOST_IP@" GRANT SELECT (comment) ON @DBNAME@.devices TO @DBUSER_IMS@@"%" IDENTIFIED BY GRANT SELECT (deleted_on) ON @DBNAME@.devices TO @DBUSER_IMS@@localhost GRANT SELECT (deleted_on) ON @DBNAME@.devices TO @DBUSER_IMS@@"127.0.0.1" GRANT SELECT (deleted_on) ON @DBNAME@.devices TO @DBUSER_IMS@@"@HOST_NAME@" GRANT SELECT (deleted_on) ON @DBNAME@.devices TO @DBUSER_IMS@@"@HOST_IP@" GRANT SELECT (deleted_on) ON @DBNAME@.devices TO @DBUSER_IMS@@"%" IDENTIFIED BY GRANT SELECT ON @DBNAME@.module_interface_version TO @DBUSER_IMS@@localhost GRANT SELECT ON @DBNAME@.module_interface_version TO @DBUSER_IMS@@"127.0.0.1" GRANT SELECT ON @DBNAME@.module_interface_version TO @DBUSER_IMS@@"@HOST_NAME@" GRANT SELECT ON @DBNAME@.module_interface_version TO @DBUSER_IMS@@"@HOST_IP@" GRANT SELECT ON @DBNAME@.module_interface_version TO @DBUSER_IMS@@"%" IDENTIFIED BY GRANT SELECT ON @DBNAME@.hardware_inventory TO @DBUSER_IMS@@localhost IDENTIFIED BY GRANT SELECT ON @DBNAME@.hardware_inventory TO @DBUSER_IMS@@"127.0.0.1" GRANT SELECT ON @DBNAME@.hardware_inventory TO @DBUSER_IMS@@"@HOST_NAME@" GRANT SELECT ON @DBNAME@.hardware_inventory TO @DBUSER_IMS@@"@HOST_IP@" GRANT SELECT ON @DBNAME@.hardware_inventory TO @DBUSER_IMS@@"%" IDENTIFIED BY Changing the Username and Password and Creating Additional Users for the Inventory Management System SQL Interface 343

JUNOScope 8.2 Software User Guide GRANT SELECT ON @DBNAME@.software_inventory TO @DBUSER_IMS@@localhost IDENTIFIED BY GRANT SELECT ON @DBNAME@.software_inventory TO @DBUSER_IMS@@"127.0.0.1" GRANT SELECT ON @DBNAME@.software_inventory TO @DBUSER_IMS@@"@HOST_NAME@" GRANT SELECT ON @DBNAME@.software_inventory TO @DBUSER_IMS@@"@HOST_IP@" GRANT SELECT ON @DBNAME@.software_inventory TO @DBUSER_IMS@@"%" IDENTIFIED BY GRANT SELECT ON @DBNAME@.packages_inventory TO @DBUSER_IMS@@localhost IDENTIFIED BY GRANT SELECT ON @DBNAME@.packages_inventory TO @DBUSER_IMS@@"127.0.0.1" GRANT SELECT ON @DBNAME@.packages_inventory TO @DBUSER_IMS@@"@HOST_NAME@" GRANT SELECT ON @DBNAME@.packages_inventory TO @DBUSER_IMS@@"@HOST_IP@" GRANT SELECT ON @DBNAME@.packages_inventory TO @DBUSER_IMS@@"%" IDENTIFIED BY GRANT SELECT ON @DBNAME@.licensing_inventory TO @DBUSER_IMS@@localhost GRANT SELECT ON @DBNAME@.licensing_inventory TO @DBUSER_IMS@@"127.0.0.1" GRANT SELECT ON @DBNAME@.licensing_inventory TO @DBUSER_IMS@@"@HOST_NAME@" GRANT SELECT ON @DBNAME@.licensing_inventory TO @DBUSER_IMS@@"@HOST_IP@" GRANT SELECT ON @DBNAME@.licensing_inventory TO @DBUSER_IMS@@"%" IDENTIFIED BY GRANT SELECT ON @DBNAME@.events_inventory TO @DBUSER_IMS@@localhost IDENTIFIED BY GRANT SELECT ON @DBNAME@.events_inventory TO @DBUSER_IMS@@"127.0.0.1" IDENTIFIED BY GRANT SELECT ON @DBNAME@.events_inventory TO @DBUSER_IMS@@"@HOST_NAME@" GRANT SELECT ON @DBNAME@.events_inventory TO @DBUSER_IMS@@"@HOST_IP@" IDENTIFIED BY GRANT SELECT ON @DBNAME@.events_inventory TO @DBUSER_IMS@@"%" IDENTIFIED BY GRANT SELECT ON @DBNAME@.inventory_event_types TO @DBUSER_IMS@@localhost GRANT SELECT ON @DBNAME@.inventory_event_types TO @DBUSER_IMS@@"127.0.0.1" GRANT SELECT ON @DBNAME@.inventory_event_types TO @DBUSER_IMS@@"@HOST_NAME@" GRANT SELECT ON @DBNAME@.inventory_event_types TO @DBUSER_IMS@@"@HOST_IP@" GRANT SELECT ON @DBNAME@.inventory_event_types TO @DBUSER_IMS@@"%" IDENTIFIED BY 344 Changing the Username and Password and Creating Additional Users for the Inventory Management System SQL Interface

Chapter 30: Exporting Inventory Management System Data Inventory Management System Database Tables The Inventory Management System database user read-only access or SELECT privileges to the following JUNOScope Inventory Management System database tables: devices Table on page 345 hardware_inventory Table on page 346 software_inventory Table on page 346 packages_inventory Table on page 347 licensing_inventory Table on page 347 events_inventory Table on page 348 inventory_events_types Table on page 348 module_interface_version Table on page 349 The database user does not have access to other JUNOScope database tables that are not described in this document. devices Table The devices database table stores all Juniper Networks devices added in JUNOScope. For information about adding devices, see Setting Up Devices on page 59. Table 32 shows the fields and columns in the devices table. Table 32: devices Table Field Type Null Key Default Extra id int(11) PRI auto_increment name varchar(40) hostname varchar(40) model varchar(20) Yes comment text Yes deleted_on timestamp(14) Yes Inventory Management System Database Tables 345

JUNOScope 8.2 Software User Guide hardware_inventory Table Table 33: hardware_inventory Table The hardware_inventory database table stores information about all hardware components installed in devices added in JUNOScope. Table 33 shows the fields and columns in the hardware_inventory table. Field Type Null Key Default Extra id int(11) PRI auto_increment device_id int(11) 0 csis_id varchar(20) version varchar(20) part_number varchar(20) serial_number varchar(20) name varchar(40) module varchar(40) Yes submodule varchar(40) Yes subsubmodule varchar(40) Yes description varchar(40) comment text Yes last_scanned timestamp(14) Yes last_modified timestamp(14) Yes created_on timestamp(14) Yes deleted_on timestamp(14) Yes software_inventory Table Table 34: software_inventory Table The software_inventory database table stores information about all JUNOS software packages installed on devices added in JUNOScope. Table 34 shows the fields and columns in the software_inventory table. Field Type Null Key Default Extra id int(11) PRI auto_increment device_id int(11) 0 routing_engine varchar(10) version varchar(20) last_scanned timestamp(14) Yes last_modified timestamp(14) Yes created_on timestamp(14) Yes deleted_on timestamp(14) Yes 346 Inventory Management System Database Tables

Chapter 30: Exporting Inventory Management System Data packages_inventory Table Table 35: packages_inventory Table The packages_inventory database table stores all JUNOS software packages installed on devices added in JUNOScope. Table 35 shows the fields and columns in the packages_inventory table. Field Type Null Key Default Extra id int(11) PRI auto_increment device_id int(11) 0 routing_engine varchar(10) name varchar(20) comment varchar(100) last_scanned timestamp(14) Yes last_modified timestamp(14) Yes created_on timestamp(14) Yes deleted_on timestamp(14) Yes licensing_inventory Table Table 36: licensing_inventory Table The licensing_inventory database table stores information about all licensed features installed on devices added in JUNOScope. Table 36 shows the fields and columns in the licensing_inventory table. Field Type Null Key Default Extra id int(11) PRI auto_increment device_id int(11) 0 feature_name varchar(64) feature_description varchar(64) licensed_count int(11) 0 used_count int(11) 0 given_count int(11) 0 given_hint varchar(64) needed_count int(11) 0 last_scanned timestamp(14) Yes last_modified timestamp(14) Yes created_on timestamp(14) Yes deleted_on timestamp(14) Yes Inventory Management System Database Tables 347

JUNOScope 8.2 Software User Guide events_inventory Table Table 37: events_inventory Table The events_inventory database table stores all events that occur during an inventory scan using the Inventory Management System. For more information about running an inventory scan, see Scanning Inventory Data on page 279. Table 37 shows the fields and columns in the events_inventory table. Field Type Null Key Default Extra id int(11) PRI auto_increment device_id int(11) 0 hardware_id int(11) 0 software_id int(11) 0 package_id int(11) 0 licensing_id int(11) 0 item varchar(40) type varchar(10) description text Yes annotation text Yes event_time timestamp(14) Yes deleted_on timestamp(14) Yes inventory_events_types Table Table 38: inventory_events_types Table The inventory_events_types database table stores all inventory scan event types. Table 38 shows the fields and columns in the inventory_events_types table. Field Type Null Key Default Extra id int(11) PRI auto_increment event_type varchar(10) 348 Inventory Management System Database Tables

Chapter 30: Exporting Inventory Management System Data module_interface_version Table Table 39: module_interface_version Table The module_interface_version database table stores and identifies the module name and version of the Inventory Management System database. Table 39 shows the fields and columns in the module_interface_version table. Field Type Null Key Default Extra module varchar(40) PRI version int(11) 0 For example, the module field can be either: module = core, version = 1 module = ims, version = 1 The version field is incremented when an update is made to the documented SQL interface with respect to the module. An update occurs when: A new public column is added. The meaning of a public column changes. A public column is removed. The module version identifies the public subset of the JUNOScope database schema. Table-to-Module Mapping Two modules are currently defined: ims and core. ims Module Version 1 of the ims module consists of the following tables: hardware_inventory Table on page 346 software_inventory Table on page 346 packages_inventory Table on page 347 licensing_inventory Table on page 347 events_inventory Table on page 348 inventory_events_types Table on page 348 core Module The core module (version 1) consists of the devices table listed in Table 32 on page 345. Inventory Management System Database Tables 349

JUNOScope 8.2 Software User Guide Demo Inventory Management System Database Tables The demo inventory tables are populated with sample data. Use the demo inventory tables to: Experiment and execute the sample query by way of the external SQL interface. See and generate sample reports based on the demo data. You can experiment and use Inventory Management System reports without scanning devices on the network. The demo tables are separate from the normal JUNOScope tables, and belong to a different database; demo rather than jtk. The demo tables are created during the JUNOScope Inventory Management System software installation. The following demo tables, similar to those described in Inventory Management System Database Entity Relationship on page 341, are created and populated with sample data. demo.devices demo.hardware_inventory demo.software_inventory demo.packages_inventory demo.licensing_inventory demo.events_inventory demo.inventory_event_types demo.module_interface_version Demo Inventory Management System Reports Several demo custom reports are packaged as part of the JUNOScope installation. Sample custom reports installed include: Licensing summary Sorted hardware summary All inventory changes in the network between Friday and Sunday All Gigabit Ethernet PICs All JUNOS Release 7.0 or higher 350 Demo Inventory Management System Database Tables

Chapter 30: Exporting Inventory Management System Data Connecting to the Inventory Management System SQL Interface To connect to the Inventory Management System database using the MySQL client provided in the JUNOScope installation, type the following: Where: % <JTK_INSTALL>/mysql/bin/mysql \ - -socket=<jtk_install>/data/db/mysql.sock \ - -port=<dbport> \ - -host=<hostname> \ - -user=<dbuser_ims> \ - -password=<dbuser_ims_password> $<DBNAME> <JTK_INSTALL> is the path of the JUNOScope installation. <DBPORT> is the port number of the database connection. The default port number is 3306. <HOSTNAME> is the hostname of database server. <DBUSER_IMS> is the database user for read-only access to the Inventory Management System. This is the username that the JUNOScope administrator provided during the installation process. <DBUSER_IMS_PASSWORD> is the password for the Inventory Management System database user. This is the password that the JUNOScope administrator provided during the installation process. <DBNAME> is the database name jtk for accessing the production Inventory Management System database, or demo for accessing the demonstration database. Connecting to the Inventory Management System SQL Interface 351

JUNOScope 8.2 Software User Guide Querying All Hardware Inventory Items All of the database query examples are specific to MySQL. If the underlying database is not MySQL, the query will be different. To extract all active hardware inventory items stored in the Demo Inventory Management System database, use the following query. (Enter the entire MySQL command syntax on the same line.) mysql>select dev.name, dev.model, hw.name, hw.version, hw.part_number, hw.serial_number, hw.description, hw.csis_id, hw.module, hw.submodule, hw.subsubmodule, hw.last_scanned, hw.created_on FROM demo.hardware_inventory hw INNER JOIN demo.devices dev ON hw.device_id = dev.id WHERE hw.deleted_on = 0 AND dev.deleted_on = 0; When an item is no longer active, the deleted_on field is updated with the time the entry was removed. You can make an entry inactive in one of two ways: When the item is no longer part of the network (for example, a PIC is removed from a csis). The row is administratively removed from the database by marking the deleted_on field to non-zero, making it virtually hidden from the user. This is not done by user action, but by manually setting the deleted_on field in the database. The last_scanned field stores the timestamp of the item (row) when it was last updated and processed by the Inventory Management System, regardless of whether the item (row) itself was modified. The created_on field stores the timestamp of the item (row) when it was first scanned and processed by the Inventory Management System. If this item is removed from one csis and moved to another, the created_on timestamp will remain the same. 352 Querying All Hardware Inventory Items

Chapter 30: Exporting Inventory Management System Data Querying All Hardware Inventory Items of a Device To extract all active hardware inventory items of device XYZ, use the following query. (Enter the entire MySQL command syntax on the same line.) mysql> SELECT dev.name, dev.model, hw.name, hw.version, hw.part_number, hw.serial_number, hw.description, hw.csis_id, hw.module, hw.submodule, hw.subsubmodule, hw.last_scanned, hw.created_on FROM demo.hardware_inventory hw INNER JOIN demo.devices dev ON hw.device_id = dev.id WHERE hw.deleted_on = 0 AND dev.deleted_on = 0 AND dev.name = 'XYZ'; Querying JUNOS Software and Package Inventory Items To extract all active software and package inventory items stored in the Inventory Management System, use the following query. (Enter the entire MySQL command syntax on the same line.) mysql> SELECT dev.name, dev.model, sw.routing_engine, sw.version, pkg.name, pkg.comment, sw.last_scanned, sw.created_on FROM demo.software_inventory sw INNER JOIN demo.packages_inventory pkg ON sw.device_id = pkg.device_id INNER JOIN demo.devices dev ON sw.device_id = dev.id WHERE sw.routing_engine = pkg.routing_engine AND sw.deleted_on = 0 AND pkg.deleted_on = 0 AND dev.deleted_on = 0; Querying All Hardware Inventory Items of a Device 353

JUNOScope 8.2 Software User Guide Querying All Licensed Feature Inventory Data To extract all active licensed features inventory items stored in the Inventory Management System database, use the following query. (Enter the entire MySQL command syntax on the same line.) mysql> SELECT dev.name, dev.model, lic.feature_name, lic.feature_description, IF(given_count, given_count, "") AS given, lic.used_count, lic.licensed_count, lic.needed_count, lic.last_scanned, lic.created_on FROM demo.licensing_inventory lic INNER JOIN demo.devices dev ON lic.device_id = dev.id WHERE lic.deleted_on = 0 AND dev.deleted_on = 0; Querying Inventory Events Data To extract all active inventory events stored in the Inventory Management System database, use the following query. (Enter the entire MySQL command syntax on the same line.) mysql> SELECT ev.type, ev.item, ev.event_time, ev.description AS details, dev.name, IF(ev.hardware_id!= 0, hw.serial_number, "") AS serial_number, IF(ev.hardware_id!= 0, hw.description, IF(ev.software_id!= 0, "", IF(ev.package_id!= 0, pkg.name, IF(ev.licensing_id!= 0, lic.feature_description, "")))) AS description, IF(ev.software_id!= 0, sw.routing_engine, IF(ev.package_id!= 0, pkg.routing_engine, "")) AS routing_engine FROM demo.events_inventory ev INNER JOIN demo.devices dev ON ev.device_id = dev.id LEFT JOIN demo.hardware_inventory hw ON ev.hardware_id = hw.id LEFT JOIN demo.software_inventory sw ON ev.software_id = sw.id LEFT JOIN demo.packages_inventory pkg ON ev.package_id = pkg.id LEFT JOIN demo.licensing_inventory lic ON ev.licensing_id = lic.id WHERE ev.deleted_on = 0; 354 Querying All Licensed Feature Inventory Data