MSSQL from Linux Host via SNMP (kind of)

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

Moderators: Developers, Moderators

Post Reply
User avatar
Cylindric
Cacti User
Posts: 54
Joined: Mon Jul 16, 2007 9:32 am

MSSQL from Linux Host via SNMP (kind of)

Post by Cylindric »

Okay, I've finally got this working! There appears to be a "feature" of the SNMP implementation that Microsoft have used for the MSSQL stats. The feature basically means that an snmpwalk or snmpgetnext works fine, but an snmpget for the same OID will fail. I've seen some obscure references to comments made by MS techs in blogs, but never an actual statement :D.

I've wrapped the thing up in an Indexed Data Script, and it seems to work fine now.

I'm not sure on the best way of bundling this stuff up, so I've attached here the an archive containing the following:

mssql.php - the Script, put this in <cacti_root>/site/scripts/
mssql.xml - the Definition, put this in <cacti_root>/resources/script_queries
cacti_data_query_php_mssql_databases.xml - Data Query - import into cacti_data_template_php_mssql_database.xml - Data Template- import into Cacti
cacti_graph_template_mssql_database_size.xml - Graph - import into Cacti

The graph currently only shows a single database. Shouldn't be too difficult to add others to a new graph.

Any problems, let me know, it's my first template :D
Attachments
cacti.tar.gz
(3.77 KiB) Downloaded 738 times
Server: Windows Server 2008 R2 x64 (running on a VM, 4Gb RAM)
Cacti: 0.8.8a (using cmd, 270 datasources in 145s)
MySQL: 5.5.16, Apache: 2.2.21, PHP: 5.3.16
User avatar
Cylindric
Cacti User
Posts: 54
Joined: Mon Jul 16, 2007 9:32 am

Post by Cylindric »

Aah, one thing I've just noticed is that when creating graphs for a device, they're all called "Hostname - MSSQL" and it doesn't put the dbname next to the name. This means that when graphing multiple DB's, they all have the same graph-name. (The data-sources are fine)

Once I've found the bit I've missed, I'll update the above.
Server: Windows Server 2008 R2 x64 (running on a VM, 4Gb RAM)
Cacti: 0.8.8a (using cmd, 270 datasources in 145s)
MySQL: 5.5.16, Apache: 2.2.21, PHP: 5.3.16
aleu
Cacti User
Posts: 216
Joined: Mon Dec 11, 2006 10:17 am

Post by aleu »

Cylindric wrote:Aah, one thing I've just noticed is that when creating graphs for a device, they're all called "Hostname - MSSQL" and it doesn't put the dbname next to the name. This means that when graphing multiple DB's, they all have the same graph-name. (The data-sources are fine)

Once I've found the bit I've missed, I'll update the above.
Any update on this? I would love to be able to get some statistics from my MSSQL servers.
bubby
Posts: 1
Joined: Tue Sep 18, 2007 5:34 am

Post by bubby »

edit the graph template for "MSSQL Database Size" and change the title
from
|host_description| - MSSQL Database Size

to
|host_description| - |query_mssqlDbInfoDbName| Database Size
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

Has anyone gotten this to work? I have tried on two different Cacti installations, and i am not getting anything. Here is what a verbose query gives me when i run it:

Code: Select all

+ Running data query [13].
+ Found type = '4 '[script query].
+ Found data query XML file at '/usr/opt/apache/htdocs/cacti/resource/script_queries/mssql.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/local/bin/php -q /usr/opt/apache/htdocs/cacti/scripts/mssql.php 10.8.100.30 XXXXXXXXX 1 161 2000 "" "" index'
+ Executing script query '/usr/local/bin/php -q /usr/opt/apache/htdocs/cacti/scripts/mssql.php 10.8.100.30 XXXXXXXXX 1 161 2000 "" "" query mssqlDbInfoDbId'
+ Executing script query '/usr/local/bin/php -q /usr/opt/apache/htdocs/cacti/scripts/mssql.php 10.8.100.30 XXXXXXXXX 1 161 2000 "" "" query mssqlDbInfoDbName'
+ Found data query XML file at '/usr/opt/apache/htdocs/cacti/resource/script_queries/mssql.xml'
+ Found data query XML file at '/usr/opt/apache/htdocs/cacti/resource/script_queries/mssql.xml'
+ Found data query XML file at '/usr/opt/apache/htdocs/cacti/resource/script_queries/mssql.xml'
I have tried both on a windows cacti and a FreeBSD installation, and neither works for me.

I would love to monitor the MSSQL DBs that we have, and this appears to be the best option.

Thanks for the help

app
[b]Cacti Version[/b] - 0.8.7b
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
aleu
Cacti User
Posts: 216
Joined: Mon Dec 11, 2006 10:17 am

Post by aleu »

I am surprised that there are no MS SQL 2005 server templates on the entire forum. I guess we all know that one cannot monitor SQL server performance via SNMP, but how about WMI? Is someone has some nice MS SQL server 2005 templates, please share.

Thanks in advance.
frdt
Posts: 13
Joined: Thu Aug 09, 2007 4:13 am

configuration help

Post by frdt »

I try to setup this template. Importationof templates (xml files) is run without error and all seams to be fine
When I go to graph management/filter by host and chose a host then add template, I can chose the template "mssql database size", but I can't chose "Supplemental Graph Template Data .. data Source [mssqlsize]" in the drop down list.
If I go through "create new grah" with a specific host, in the pane "grap template" the template drop down list don't display the template name
do you have some issue or instruction to setup this
fr
frdt
Posts: 13
Joined: Thu Aug 09, 2007 4:13 am

help :) no reply to my post

Post by frdt »

Noboy to help me to setup this templates ?
thanks in advance
shull
Cacti User
Posts: 54
Joined: Thu Aug 24, 2006 1:20 am
Location: South Texas
Contact:

Post by shull »

You won't be able to get SNMP data for SQL. You will need to use WMI. Microsoft removed the SNMP counters from Exchange 2000 and up and SQL 2005 and up. I know that these don't work. They may have removed them sooner for previous versions. I don't know exactly what versions, but they did remove the counters. Now you can only use SNMP on Microsoft for some "limited" basic counters.

-Stephen
www.cactiexchange.com -- Hosted Tools for the Cacti Community:
Cacti Perl Tool
Cacti XML Tool
Search OID-to-Names

[url=http://www.google.com/search?num=100&hl=en&safe=off&domains=forums.cacti.net&q=cacti&sitesearch=forums.cacti.net]Cacti Forums Google Index -- Better than the main page version![/url]
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests