[Nagiosplug-help] (no subject)
Charles H. Baker
cbaker at windstream.com
Fri May 14 17:23:57 CEST 2010
On Fri, 2010-05-14 at 07:43 -0700, Bill Lopez wrote:
> I have a vb script that checks mounted disk size and pukes out the numbers (all included below)
>
>
> how does nagios know to show warning and critical?
>
> how do I get nagios to understand what values should be used for WARNING and CRITICAL ?
>
> here is the vb script
>
> ---------------
>
> On Error Resume Next
> strComputer = "."
> Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
> Set colItems = objWMIService.ExecQuery _
> ("Select * from Win32_MappedLogicalDisk Where Name = 'F:' ")
>
> For Each objItem in colItems
>
> disk_total=objItem.Size/(1024*1024*1024)
>
> disk_used=(objItem.Size-objItem.FreeSpace)/(1024*1024*1024)
> disk_used_perc=disk_used/disk_total
> disk_free=objItem.FreeSpace/(1024*1024*1024)
> disk_free_perc=disk_free/disk_total
>
>
>
>
> Wscript.Echo objItem.ProviderName & "- total: " & Round(disk_total, 2) & " Gb" & " - used: " & Round(disk_used, 2) & " Gb" & " (" & Round(disk_used_perc*100) & "%)" & " - free: " & Round(disk_free, 2) & " Gb" & " (" & Round(disk_free_perc*100) & "%)"
>
> Next
>
> ---------------
>
> text output from the script is
>
> \\servername\FS300- total: 246.19 Gb - used: 110.13 Gb (45%) - free: 136.05 Gb (55%)
>
> nagios display shows
> DISKSPACE FS301 OK 05-13-2010 20:50:05 0d 3h 30m 42s 1/4 \essnas1FS301- total: 246.19 Gb - used: 207.88 Gb (84%) - free: 38.3 Gb (16%)
>
I'm curious why you want to use a vbscript instead of following the
standard way of doing it as outlined here:
http://nagios.sourceforge.net/docs/3_0/monitoring-windows.html
Have you read the nagios documentation? Here are a couple of service
definitons for disk checks from our working configuration
define service{
use nt-server-check-disk
host_name SCGVLMONITOR1
service_description Disk - C
check_command check_nt_disk!c!95!98
}
define service{
use nt-server-check-disk
host_name SCGVLMONITOR1
service_description Disk - D
check_command check_nt_disk!d!95!98
}
And here is the definition of check_nt_disk
# 'check_nt_disk' command definition
define command{
command_name check_nt_disk
command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 1248 -v
USEDDISKSPACE -l $ARG1$ -w $ARG2$ -c $ARG3$
}
ARG2 and ARG3 set the warning and critical levels. Hope this helps.
--
Charles H. Baker, Unix System Administration
Windstream Communications
Charles.Baker at windstream.com | 864.331.7896 | 864.990.1297
Be the change you wish to see in the world. Gandhi
More information about the Help
mailing list