ServiceNav offers 2 service models to allow you to run your own MS-MSSQL-request-integer and MS-MSSQL-request-integer SQL queries.
By default these templates work with Microsoft SQLServer and Sybase.
We will focus here on the MS-MSSQL-Request-Integer model
Using the MS-MSSQL-request-integer model
This template allows you to execute a query that will return an integer value on a single line.
The returned value can be compared to thresholds.
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. To consult the documentation on this link : https://servicenav.coservit.com/en/documentations/configure-the-supervision-of-ms-sql-server-database/
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 text to be displayed as a prefix of the returned value
- The alert threshold and the whole type critical threshold
Use Case - Controlling an Application Scenario
Aim : I have an application that manages application scenarios. As I don't have a model for this application in ServiceNav, I can nevertheless control the scenario execution time directly in the database.
Using the model MS-MSSQL-request-integer present in ServiceNav, so I will create my own service model to supervise my application scenario.
From its SQL server
In its Microsoft SQL Server Management console, prepare your query to return only one value on a row.
select top 1 status 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 "Totaltime" which I will use to know the execution time of my scenario.
Now you just need to implement it in a ServiceNav service model.
Create a new unit service from the template MS-MSSQL-Query_Integer
In the Configuration Module / Services Menu / Lists
Click on the Add button:
Choose Service Model
Instanciate the fields :
The query will therefore return an integer value that I will compare to the defined thresholds.
Add this service on its equipment that manages scenarios.
Click 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.
There is also access to performance data.
Click on the service
This model opens up many possibilities that can be displayed in its MAP module.