How to use SQL-Request-string templates?

blackboard 583692 340 534x250 1

Need some help?

ServiceNav offers 2 service models to allow you to run your own MS-MSSQL-request-integer and MS-MSSQL-request-string SQL queries.

By default these templates work with Microsoft SQLServer and Sybase.

We will focus here on the MS-MSSQL-Request-String model.

Using the MS-MSSQL-request-string model

This template allows you to execute a query that will return a or both columns for single line.
The first column is used to perform a comparison with the string searched for when configuring the model.
The second column [optional] is used to display an output text in the operating interface.

Prerequisites for configuration :
Supervision account type MS SQL with the right to run the command on the SQL Server or Sybase instance and database.
File configuration freetds.conf. Consult the documentation :

Model Parameter :
- The server name: This is the name defined in the freetds.conf file: [LOGIN_NAME]
- The name of the database to be queried
- The SQL query
- The string to search in column 1 of the query result.
- The status to be displayed if the channel is present
- The status to be displayed if the channel is not present

Use Case - Controlling an Application Scenario

Objective: I have an application that manages application scenarios. As there is no model for this application in ServiceNav, it is nevertheless possible to check the scenario result directly in the database.
Using the model MS-MSSQL-request-string present in ServiceNav, create its own service model to supervise its application scenario.

From its SQL server

In the Microsoft SQL Server Management console, prepare your query to return only one row and 2 columns.
select top 1 status, webscriptname from SchedItemResult where webscriptName='ServiceNav - Demo' and DATEDIFF(minute, PollTime, getdate()) < 5 order by PollTime desc;

The result is this.

Here I have a result with the column "status" which will be used to search for the word "success" and the column "webscriptname" which will display the name of the script.

Now you just need to implement it in a ServiceNav service model.

From ServiceNav

Create a new unit service from the template MS-MSSQL-Query_String

In the Configuration Module / Services Menu / Lists

Click on the Add button

Choose Service Model

Instanciate the fields

The query will therefore return 2 columns.
The control will therefore search for the string "success" in column 1 and display the description in column 2.

Add this service on its equipment that manages scenarios.

Click on Apply and reload its configuration.

Verification of this new model in supervision

In the Supervision / Technical Operation Module

Look for its control point and check its operation.

This may also be of interest to you

Map 4

Application mapping

Representing application supervision Supervising applications can pose problems of legibility of information, dependencies and alerts,

Read more "

Welcome to ServiceNav!

Need help? More information about our products? Write to us!
You have taken note of our privacy policy.


While the epidemic lasts, ensure the availability and performance of your IT services for teleworking, with ServiceNav!

Following the government's call to mobilize to help businesses overcome the current health and economic context, we help you, free of charge, to ensure the complete monitoring of your teleworking environments: VPN, VDI, Teams, Skype Enterprise, Citrix... Objectives: collection, availability and usage indicators, dashboards to support your communication.
We use cookies to ensure that you have the best possible experience on our site, and if you continue to use this site, we will assume that you are satisfied with it.

Reserve your place

You have taken note of our privacy policy.