Nagios Exchange Nagios Exchange
  • Home
  • Directory
  • Library
  • Support
  • About

Advanced Search

Build precise queries to find exactly what you need

Search Logic

Select compatible versions

Press ESC to close

Sign In Sign Up
  • Home
  • Directory
  • Library
  • Support
  • About
Plugins4391Themes and Skins12Add-ons742Documentation283Graphics and Logos36View All Categories
LinuxSecuritySNMPFile SystemCloud
New Listings Recently Updated Listings Most Favored Listings Most Popular Listings Most Rated Listings Most Reviewed Listings
Random Project
Nagios XI Documentation Database Access For Development Purposes
0.0 (0)
62.5K
RSS Feed
Newest Listings Updated Listings
Top Contributors
Julien DESMAREST (6)LAMY (6)Davide Lemma (4)deskwork_itunes142 (4)Claudio Kuenzler (2)
See More
Newest Contributors
sowoii (1)Nitatemic (1)cjdepaul (1)ixs (1)messefreeze (2)
See More

Copyright © 2009-2025 Nagios Enterprises, LLC. All rights reserved.

Privacy PolicyTerms of UseTrademarks
Home > Thomas
T

Thomas

@thomasemr

User Stats

Member Since: July 3, 2013

Favorites0

Views

Projects0

No Projects Found
check_dhcp_free.vbs

Portuguese Version - Not necessary subnet argument

Portuguese version This script is not necessary to pass the subnet argument On Error Resume Next '************************************************************** ' Ejecugtar el comando en el servidor para ver que redes existen: ' netsh dhcp server show mibinfo '************************************************************** 'Variables Dim sendMessageResultCriticalWarning, sendMessageOK, sendMessageResultOK, sendMessageResultCritical, sendMessagewarning, sendMessagecritical, sendMessageResultWarning, i_warning, i_critical, i_ok, current_path, command, command2, strLine, IPsTotal, IPsUso, IPsLivres, IPsLivrespercetual, sendMessage, warning, critical, segmento, IPsocupadaspercentual '************************************************************** 'Const for return val's Const intOK = 0 Const intWarning = 1 Const intCritical = 2 Const intUnknown = 3 warning = WScript.Arguments(0) warning = Int(warning) critical = WScript.Arguments(1) critical = Int(critical) Subnet = "Subnet" Set fso = CreateObject("Scripting.FileSystemObject") current_path = fso.GetParentFolderName(wscript.ScriptFullName) ' Comando para chequeo command = "netsh dhcp server show mibinfo" Set objShell = CreateObject("WScript.Shell") Set objWshScriptExec = objShell.Exec(command) Set objStdOut = objWshScriptExec.StdOut i_critical = 0 i_ok = 0 i_warning = 0 'Verificar o IPs em Uso e IPs Livres , calcula total etc... Do until objStdOut.AtEndOfStream strLine = objStdOut.ReadLine If InStr(strLine,Subnet) > 0 Then strScope_array = Split(strLine, "Subnet") strScope_array2 = Split(strScope_array(1), " ") strScope = strScope_array2(2) IPsTotal = 0 IPsUso = 0 IPsLivres = 0 IPsLivrespercetual = 0 IPsocupadaspercentual = 0 ' No. of Addresses in use strLine = objStdOut.ReadLine IPsUso_array = Split(strLine, ".") IPsUso_array2 = Split(IPsUso_array(1), " ") IPsUso = IPsUso_array2(6) ' No. of free Addresses strLine = objStdOut.ReadLine IPsLivres_array = Split(strLine, ".") IPsLivres_array2 = Split(IPsLivres_array(1), " ") IPsLivres = IPsLivres_array2(5) IPsUso=Int(IPsUso) IPsLivres=Int(IPsLivres) IPsTotal=Int(IPsTotal) IPsTotal = IPsUso + IPsLivres IPsLivrespercetual = (IPsLivres*100)/IPsTotal IPsLivrespercetual=Int(IPsLivrespercetual) IPsocupadaspercentual = (100-IPsLivrespercetual) ' Validaciones 'Critical If IPsocupadaspercentual >= critical Then sendMessagecritical = " # ESCOPO: " & strScope & " IPs livres: " & IPsLivres & " (" & IPsLivrespercetual & "%) Ips Usados: " & IPsUso & " (" & IPsocupadaspercentual & "%) " sendMessageResultCritical = sendMessageResultCritical + sendMessagecritical i_critical = i_critical + 1 End If 'Warning If IPsocupadaspercentual >= warning AND IPsocupadaspercentual 0 Then WScript.Echo ("WARNING: " + sendMessageResultWarning) Wscript.Quit(intWarning) End If If i_ok > 0 Then WScript.Echo ("OK: " + sendMessageResultOK) Wscript.Quit(intOK) End If 'Si llega hasta aqui, no se conoce el error sendMessage = "UNKNOWN: Erro no Script" WScript.Echo sendMessage Wscript.Quit(intUnknown)

Reviewed 12 years ago

No Favorites Found

Copyright © 2009-2025 Nagios Enterprises, LLC. All rights reserved.

Privacy PolicyTerms of UseTrademarks
Home Browse Submit Profile