[REQUEST] MSSQL DB size
Moderators: Developers, Moderators
[REQUEST] MSSQL DB size
I am looking for a way to monitor MSSQL database size...
I need to graph DB growth on databases on multiple MSSQL 2000 servers.
I am not needing specific table growth, just overal DB size...
Thank you in advance for any help
I need to graph DB growth on databases on multiple MSSQL 2000 servers.
I am not needing specific table growth, just overal DB size...
Thank you in advance for any help
- streaker69
- Cacti Pro User
- Posts: 712
- Joined: Mon Mar 27, 2006 10:35 am
- Location: Psychic Amish Network Administrator
Here's a script that I wrote a while ago and never did anything with. It will output a list of database sizes as well as cache hit ratio. If you don't need the cache hit ration, just comment those lines out or don't bother mapping them in your dataquery.
Code: Select all
#!/usr/bin/perl
# Replace '/usr/local/nagios/libexec/check_nt' with the localtion where your check_nt binary is located
# Usage: perl ms_dbsize.pl <hostname> <MSSQL Instance Name> <Database1,database2,database3>
# eg: perl ms_dbsize.pl server SQLSDE USERS,COLLECTIONS,MAINTENANCE
$CheckNTPath='/usr/local/nagios/libexec';
@array1 = split(/\,/, $ARGV[2]);
foreach $dbname (@array1)
{
$dbSize = `$CheckNTPath/check_nt -H $ARGV[0] -p 1248 -v COUNTER -l '\\MSSQL\$$ARGV[1]:Databases($dbname)\\Data File(s) Size (KB)'`;
chomp $dbSize;
$cache = `$CheckNTPath/check_nt -H $ARGV[0] -p 1248 -v COUNTER -l '\\MSSQL\$$ARGV[1]:Catalog Metadata($dbname)\\Cache Hit Ratio'`;
chomp $cache;
$Output1 .= @array1[$x] . "_size:" . $dbSize . " ";
$Output2 .= @array1[$x] . "_hits:" . $cache . " ";
push(@PrintVal,$Output1);
push(@PrintVal,$Output2);
$x = $x + 1;
}
print $Output1 .
$Output2 .
"\n";
exit 0;
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
- streaker69
- Cacti Pro User
- Posts: 712
- Joined: Mon Mar 27, 2006 10:35 am
- Location: Psychic Amish Network Administrator
You need to have the NSclient running on your Windows box.rtyler778 wrote:Hey,
When I run the script manually from my unix box, I receive :Connection refused could not fetch information from server...
Do I have to some how pass credentials for the sql server?
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
instance name
Hi,
thank you for the scipt. I try to connect to a standard instance of a MSSQL2000 Server. But i can't get any informations. How can i ask the standard instance? MSSQLSERVER and local don't work.
Thank you.
thank you for the scipt. I try to connect to a standard instance of a MSSQL2000 Server. But i can't get any informations. How can i ask the standard instance? MSSQLSERVER and local don't work.
Thank you.
- streaker69
- Cacti Pro User
- Posts: 712
- Joined: Mon Mar 27, 2006 10:35 am
- Location: Psychic Amish Network Administrator
Re: instance name
Here ya go:Flinx wrote:Hi,
thank you for the scipt. I try to connect to a standard instance of a MSSQL2000 Server. But i can't get any informations. How can i ask the standard instance? MSSQLSERVER and local don't work.
Thank you.
Code: Select all
#!/usr/bin/perl
# Replace '/usr/local/nagios/libexec/check_nt' with the localtion where your check_nt binary is located
# Usage: perl ms_dbsize.pl <hostname> <Database1,database2,database3>
# eg: perl ms_dbsize.pl server USERS,COLLECTIONS,MAINTENANCE
$CheckNTPath='/usr/local/nagios/libexec';
@array1 = split(/\,/, $ARGV[1]);
foreach $dbname (@array1)
{
$dbSize = `$CheckNTPath/check_nt -H $ARGV[0] -p 1248 -v COUNTER -l '\\SQLServer:Databases($dbname)\\Data File(s) Size (KB)'`;
chomp $dbSize;
$Output1 .= @array1[$x] . "_size:" . $dbSize . " ";
push(@PrintVal,$Output1);
$x = $x + 1;
}
print $Output1 .
"\n";
exit 0;
[b]Cacti Version[/b] - 0.8.7d
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
[b]Plugin Architecture[/b] - 2.4
[b]Poller Type[/b] - Cactid v
[b]Server Info[/b] - Linux 2.6.18-128.1.6.el5
[b]Web Server[/b] - Apache/2.2.3 (CentOS)
[b]PHP[/b] - 5.2.9
[b]MySQL[/b] - 5.0.45-log
[b]RRDTool[/b] - 1.3.0
[b]SNMP[/b] - 5.3.2.2
[b]Plugins[/b]PHP Network Managing v0.6.1, Global Plugin Settings v0.6,thold v0.4.1,XMLPort v0.3.5,CactiCam v0.1.5,NetTools v0.1.5,pollperf v0.32,RRD Cleaner v1.1,sqlqueries v0.2,superlinks v0.8,syslog v0.5.2,update v0.4,discovery v0.9,zond v0.34a,hostinfo v0.2,Bloom v0.6.5,mactrack v1.1,weathermap v0.96a,mobile v0.1
Modification for not named SQLServer
Hi,
thank you, but I'm a little bit confused about the MSSQL name scheme. What should I modify? I think the name of the standard instance ist MSSQLSERVER, so I modified:
$dbSize = `$CheckNTPath/check_nt -H $ARGV[0] -p 1248 -v COUNTER -l '\\MSSQLServer:Databases($dbname)\\Data File(s) Size (KB)'`;
But the result is the same. The output ist 0.
And the result in NSC.log is:
11.09.2008 09:18:15: debug:.\NSClient++.cpp:353: Injecting: checkCounter: \MSSQLServer:Databases(VCDB)\Data File(s) Size (KB), nsclient
11.09.2008 09:18:15: debug:.\NSClient++.cpp:373: Injected Result: UNKNOWN -- Unknown argument: \MSSQLServer
11.09.2008 09:18:15: debug:.\NSClient++.cpp:374: Injected Performance Result:
Same problem with SQLSERVER. Sorry for this, but I'm not very familiar with the MSSQL Server. ;-(
Thanks.
thank you, but I'm a little bit confused about the MSSQL name scheme. What should I modify? I think the name of the standard instance ist MSSQLSERVER, so I modified:
$dbSize = `$CheckNTPath/check_nt -H $ARGV[0] -p 1248 -v COUNTER -l '\\MSSQLServer:Databases($dbname)\\Data File(s) Size (KB)'`;
But the result is the same. The output ist 0.
And the result in NSC.log is:
11.09.2008 09:18:15: debug:.\NSClient++.cpp:353: Injecting: checkCounter: \MSSQLServer:Databases(VCDB)\Data File(s) Size (KB), nsclient
11.09.2008 09:18:15: debug:.\NSClient++.cpp:373: Injected Result: UNKNOWN -- Unknown argument: \MSSQLServer
11.09.2008 09:18:15: debug:.\NSClient++.cpp:374: Injected Performance Result:
Same problem with SQLSERVER. Sorry for this, but I'm not very familiar with the MSSQL Server. ;-(
Thanks.
Hi,
I currently monitor some of my databases filesize.
For this I use my own tool (see here : http://forums.cacti.net/viewtopic.php?t=25600).
Install the snmp agent mentionned in the thread, create a c:\counters.ini and in there put the following text :
[1.3.6.1.4.1.15.1]
counter=SQLServer:Databases\Data File(s) Size (KB)\iptools
Then query the oid : 1.3.6.1.4.1.15.1 .
"iptools" is the dbname.
If you have sql instances, then the syntax will be MSSQL$Instance_Name
Regards,
Erwan.
I currently monitor some of my databases filesize.
For this I use my own tool (see here : http://forums.cacti.net/viewtopic.php?t=25600).
Install the snmp agent mentionned in the thread, create a c:\counters.ini and in there put the following text :
[1.3.6.1.4.1.15.1]
counter=SQLServer:Databases\Data File(s) Size (KB)\iptools
Then query the oid : 1.3.6.1.4.1.15.1 .
"iptools" is the dbname.
If you have sql instances, then the syntax will be MSSQL$Instance_Name
Regards,
Erwan.
Who is online
Users browsing this forum: No registered users and 0 guests