Template SQL Server Database Size

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
User avatar
loytstf
Posts: 13
Joined: Thu Sep 01, 2005 5:18 am
Contact:

Template SQL Server Database Size

Post by loytstf »

A Template for Monitoring SQL Server Database Size.
Some screenshots here : http://www.pfoh.fr/C/monitoring-bases-d ... ous-cacti/

How to install : http://www.pfoh.fr/C/template-cacti-ms-sql-server/

The source : http://www.pfoh.fr/C/wp-content/uploads ... _MSSQL.zip

Image
_______________________________________
Cacti 0.8.8a under RedHat 6.6
NET-SNMP version: 5.5
RRDTool 1.4.x
PHP Version 5.3.3
ksdjfh
Posts: 19
Joined: Fri May 31, 2013 2:06 pm

Re: Template SQL Server Database Size

Post by ksdjfh »

This looks very interesting and I'm trying to use it but nothing I do seems to make it work.

I put the files where they need to go, updated the login info/created the table. I imported the templates but the instructions don't say to create the data query/input method needed. Do I need a Data Input Method or a Data Query?

I tried Data Query but when I add it to my device and click verbose query, this is all I get. Seems I'm not pulling in any data as the status shows 0 items, 0 rows.

Code: Select all

+ Running data query [32].
+ Found type = '6' [Script Query - Script Server].
+ Found data query XML file at 'C:/inetpub/cacti/resource/script_server/mssql_db.xml'
+ XML file parsed ok.
+ Executing script for num of indexes '"C:\php\php.exe" -q C:\inetpub\cacti\scripts\ss_mssqldb.php 10.2.110.76 num_indexes'
+ Executing script for list of indexes '"C:\php\php.exe" -q C:\inetpub\cacti\scripts\ss_mssqldb.php 10.2.110.76 index' Index Count: 0
+ Executing script query '"C:\php\php.exe" -q C:\inetpub\cacti\scripts\ss_mssqldb.php 10.2.110.76 query dbname'
+ Executing script query '"C:\php\php.exe" -q C:\inetpub\cacti\scripts\ss_mssqldb.php 10.2.110.76 query dbid'
I've tried connecting manually and running the queries I see in the php file and things seem ok but still no data in cacti. What am I doing wrong?
ksdjfh
Posts: 19
Joined: Fri May 31, 2013 2:06 pm

Re: Template SQL Server Database Size

Post by ksdjfh »

Does the current version of your template support a named instance of sql? I couldn't tell if I can query a server like myserver\sqlexpress.

As for my problem above, I'm running cacti on Windows if it makes a difference.
ksdjfh
Posts: 19
Joined: Fri May 31, 2013 2:06 pm

Re: Template SQL Server Database Size

Post by ksdjfh »

The problem is this: Call to undefined function mssql_connect()

if I run this command it seems the module I need is loaded:

php -m
[PHP Modules]
bcmath
calendar
Core
ctype
date
dom
ereg
filter
ftp
gd
hash
iconv
json
ldap
libxml
mcrypt
mhash
mysql
mysqli
mysqlnd
odbc
pcre
PDO
pdo_mysql
pdo_sqlsrv
Phar
Reflection
session
SimpleXML
snmp
sockets
SPL
sqlsrv
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
zip
zlib

and from what I read on another site I may need the sql native client (which was already installed on my cacti machine) but it always failed.

if I use this function: sqlsrv_connect() then it connects but I get errors further down because more functions are undefined. Does anyone know how to make this work under windows?
User avatar
loytstf
Posts: 13
Joined: Thu Sep 01, 2005 5:18 am
Contact:

Re: Template SQL Server Database Size

Post by loytstf »

I update the zip file.
I forget the data query.

For the installation on a Windows server, i didn't test it.
So I can't help you.
_______________________________________
Cacti 0.8.8a under RedHat 6.6
NET-SNMP version: 5.5
RRDTool 1.4.x
PHP Version 5.3.3
User avatar
loytstf
Posts: 13
Joined: Thu Sep 01, 2005 5:18 am
Contact:

Re: Template SQL Server Database Size

Post by loytstf »

ksdjfh wrote:Does the current version of your template support a named instance of sql? I couldn't tell if I can query a server like myserver\sqlexpress.

As for my problem above, I'm running cacti on Windows if it makes a difference.
I don't test it under Windows and sure it doesn't support a named instance.
Perhaps the next version !
_______________________________________
Cacti 0.8.8a under RedHat 6.6
NET-SNMP version: 5.5
RRDTool 1.4.x
PHP Version 5.3.3
ksdjfh
Posts: 19
Joined: Fri May 31, 2013 2:06 pm

Re: Template SQL Server Database Size

Post by ksdjfh »

loytstf wrote:
ksdjfh wrote:Does the current version of your template support a named instance of sql? I couldn't tell if I can query a server like myserver\sqlexpress.

As for my problem above, I'm running cacti on Windows if it makes a difference.
I don't test it under Windows and sure it doesn't support a named instance.
Perhaps the next version !
I spent some time playing around and using another template I found on the forums for query stats from a DB, I managed to find equivalent commands and get your script pulling in data on Windows. I posted a question on here about a week earlier for help but I couldn't get my attempt at a template working so a big thank you for posting your solution and giving me the ability to get what I needed!
colifa
Posts: 6
Joined: Wed Oct 29, 2014 11:06 am

Re: Template SQL Server Database Size

Post by colifa »

Hello,

This is exactly what I was looking for!

Only problem is that I'm getting an error when importing the data query, saying "Error: XML: Hash version does not exist"

All the rest goes fine:

Import Results
Cacti has imported the following items:
GPRINT Preset
[success] [update]
Data Input Method
[success] [update]
Data Template
[success] [update]
[success] [update]
Graph Template
[success] [update]
[success] [update]
Data Query
[success] [update]

I believe this error is due to Cacti versions, but it seems we are using the same:

Cacti Version 0.8.8a
Cacti OS unix
SNMP Version NET-SNMP version: 5.4.2.1
RRDTool Version RRDTool 1.3.x

Any help you can provide will be greatly appreciated!

Pablo
colifa
Posts: 6
Joined: Wed Oct 29, 2014 11:06 am

Re: Template SQL Server Database Size

Post by colifa »

I've ended up updating Cacti to 0.8.8f and that solved the issue. I am able to get all the database names, and create graphs, although all the graphs show the same information! They belong to different data sources, of course.

If you have any ideas, I will certainly appreciate them.

Thank you,

Pablo
minghao
Posts: 1
Joined: Tue Oct 06, 2020 10:29 pm

Re: Template SQL Server Database Size

Post by minghao »

Hi, Sir

  Does this function suitable for Version 1.2.6?
  Because when i import template, it display this messages.
  
  Cacti would make the following changes if the Template was imported:

GPRINT Preset

[preview] Normal [unchanged]
Data Template

[preview] MSSQL - DB Size [new]
[preview] MSSQL - Log Size [new]
Graph Template

[preview] MSSQL Database Size [new]
[preview] MSSQL Log Size [new]
Data Query

[preview] MSSQL - Get db size [new]

  Seems no imported.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests