snmp management software LoriotProsnmp management software LoriotPro

Administrator Handbook
www.loriotpro.com

TOC

Database Query tool

Introduction

Once the ODBC driver installed and the software correctly set up, you could access the database directly from LoriotPro. This tool is able to accomplish simple queries to the database. More sophisticated tool are commonly available that could performs advanced queries and presents the results in various way.

To start the Database Query tool from the main menu select:

Supervise>Database  Query                                                   


The main menu option Database Query

A window is displayed with all the options needed to perform the Database queries.


Result of a simple query

Table of the Database Query tool

Options

Definitions

The ‘From table’ option allows you to select the table that you want to query.

The selected table name should appear in the combobox.

The ‘Limits’ option allows you to define from which table line you want to start and how many lines you want to process

In this example, we start from the first record with a maximum of 100 records.

Warning

If you specify a lager amount of records, you could fill the software memory and hang the process.

This option allows you to select the table fields that you want to display.

Examples

Results displayed

*

All fields

Timestamp, level, string

Only the specified fields.

Warning

This field should exist in the table.

This option allows you to select the table fields that you want to display according to specified filter.

Examples

Displayed results

Level=1

All the records where the filed level equal1.

Ip_agent_add like «%192%» and level=1

All the records where the ip_agent_add field contains the string 192 and having the level =1.

Perform a query on the database with the current options

Display the next or previous records according to the limit (0 100 by default).

This field allows you to perform direct SQL queries.

Warning

Only the SELECT command is supported.

Examples:

Use of the SQLQuery command

Select * from loriot_events where level=4

Figure 8 : Example of directe SQLQuery

An example of use of fields and filter options in a Query command.

Field : timestamp, level, string, ip_source_add

Filter : ip_agent_add like « %192% » and level=1


s
ample of a complex Query

The same operation with the SQLQuery command.

select timestamp, level, string, ip_source_add from loriot_events where ip_agent_add like "%192%" and  level=4

For more information on the available syntax, refer to the Database documentation.

 Warning : If the command does not provide results, the information box will not be refreshed and no warning message will be displayed.

Nonetheless, if you do a mistake in the syntax the ODBC driver will display a warning message.

Example 1 :

select timestamp, level, string, ip_source_add from loriot_events where ip_agent_add like "%192%" and  level4

The equal sign has been forgotten.

Example 2 :

select timestamp, level, stringip_source_add from loriot_events where ip_agent_add like "%192%" and  level=4

The coma has been forgotten.

PHP Script example of Database query

PHP script examples dedicated to the Loriotpro Table queries are available in the directory bin/www/www.

These file help you to access the Database with a remote WEB navigator.

Using PHP script

The home page of the LoritoPro WEB server has a menu with the option Database. Clicking on it will start the PHP script and displays a Query tool.

Warning : The PHP interpreter should be installed and configured else this option will not work.

Figure 10 : Databse access from a WEB navigator

A new window is open with a second menu that gives you access to the various tables.

LoriotPro WEB access window

If we choose the Events  option a frame is added to the window with a multi criterium selection.


Multi criterion example on the LoriotPro event table


Multi criterion example on the LoriotPro host table


Multi criterion example on the LoriotPro network table


Multi criterion example on the LoriotPro Netflow table

If you encounter difficulties to access the Database, you might have to modify the l_connection_data.php3 file and set the right parameters.

File : l_connection_data.php3

<?
$MySQL_Host="localhost";
$MySQL_User="root";
$MySQL_Passw="";
$db="loriotpro";
/*
if (! @$cc=mysql_connect("$MySQL_Host","$MySQL_User","$MySQL_Passw")) {
   echo "Unable to establish the connection at ",$MySQL_Host,"<br>";
   exit;
}
*/
?>

Remark : These scripts could be used by other HTTP servers than the one provided with LoriotPro. The Apache server has been tested successfully.

Warning : The HTML and PHP scripts provided are only examples. Security holes that could be link to the use of these files remain possible.


www.loriotpro.com
Copyright © 2004 LUTEUS SARL. All rights reserved. This documentation is copyrighted by LUTEUS SARL. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying or otherwise, without the prior express written permission of LUTEUS SARL