# SQL Querier Tool

# Introduction

<span dir="ltr" role="presentation">Plugin for monitoring SQL Server databases</span> <span dir="ltr" role="presentation">through custom SQL queries.</span>  
<span dir="ltr" role="presentation">Obtains the result of the launched SQL query as a</span> <span dir="ltr" role="presentation">value for the modules that use it.</span>

<span dir="ltr" role="presentation">**Type:** Server plugin</span>

# Prerrequisites

<span dir="ltr" role="presentation">This plugin requires:</span>  
<span dir="ltr" role="presentation">●</span> <span dir="ltr" role="presentation">Connection between the Pandora server and the SQL</span> <span dir="ltr" role="presentation">Server database.</span>  
<span dir="ltr" role="presentation">●</span> <span dir="ltr" role="presentation">Login username and password.</span>  
<span dir="ltr" role="presentation">●</span> <span dir="ltr" role="presentation">The package "perl DBI SQL server odbc" installed on</span> <span dir="ltr" role="presentation">the Pandora server (only for the </span><span dir="ltr" role="presentation">perl version of the plugin).</span>

<span dir="ltr" role="presentation">● The ODBC Driver 18 is required for the Python version.</span>

# Execution Perl version

```
./msql_query -Q "<sql_query>" -U "<sql_user>" -P "<sql_password>" -H "<sql_host>"
```

  
**<span dir="ltr" role="presentation">&lt;sql\_query&gt;</span>**  
<span dir="ltr" role="presentation">SQL query to get the value.</span>  
**<span dir="ltr" role="presentation">&lt;sql\_user&gt;</span>**  
<span dir="ltr" role="presentation">Database connection user.</span>  
**<span dir="ltr" role="presentation">&lt;sql\_password&gt;</span>**  
<span dir="ltr" role="presentation">Database connection password.</span>  
**<span dir="ltr" role="presentation">&lt;sql\_host&gt;</span>**  
<span dir="ltr" role="presentation">SQL ServerHost\\Instance to connect.</span>

**<span dir="ltr" role="presentation"><span dir="ltr" role="presentation">Example:</span></span>**

```
./msql_query -Q "select * from tdata where value=’monitoring’" -U "artica" -P "pandora" -H "SQLSERVER\INSTANCE1"
```

# Execution Python version

```
./msql_query "<sql_host>" "<sql_port>" "<sql_user>" "<sql_password>" "<sql_database>" "<sql_query>" ["<delimiter_character>"]
```

  
**<span dir="ltr" role="presentation">&lt;sql\_host&gt;</span>**  
<span dir="ltr" role="presentation">SQL ServerHost\\Instance to connect.  
**&lt;sql\_port&gt;**  
Sql port  
</span>**<span dir="ltr" role="presentation">&lt;sql\_user&gt;</span>**  
<span dir="ltr" role="presentation">Database connection Domain\\User.</span>  
**<span dir="ltr" role="presentation">&lt;sql\_password&gt;</span>**  
<span dir="ltr" role="presentation">Database connection password.</span>  
**<span dir="ltr" role="presentation">&lt;sql\_database&gt;</span>**  
<span dir="ltr" role="presentation">Database name.</span>  
**<span dir="ltr" role="presentation">&lt;sql\_query&gt;</span>**  
<span dir="ltr" role="presentation">SQL query to get the value. Strings in WHERE statement</span> <span dir="ltr" role="presentation">must use single quotes..</span>  
**<span dir="ltr" role="presentation">&lt;delimiter\_character&gt;</span>**  
<span dir="ltr" role="presentation">Optional. Field delimiter character of the SQL query</span> <span dir="ltr" role="presentation">result. By default it uses “,”</span>

<div id="bkmrk-"></div>**<span dir="ltr" role="presentation">Example:</span>**

```
./msql_query "SQLSERVER\INSTANCE1" "artica" "pandora" "pandora_database" "select * from tdata where value=’monitoring’" "|"
```