used/free ips per scope on the DHCP Server
Re: used/free ips per scope on the DHCP Server
Yes, I have confirmed as far as I can, this is a limitation with NSClient. I have tested NSClient against a standard NRPE client, and the NRPE client is able to return significantly more data than NSClient. NSClient is a 3rd party product, so that is about as far as we can take this issue. Anything more would have to be taken up with their support.
https://www.nsclient.org/
https://www.nsclient.org/
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 222
- Joined: Thu Jul 06, 2017 8:55 am
Re: used/free ips per scope on the DHCP Server
Do we have such script like below as we have limitations,
can we have script like scop1 to scope 10 details should show So that 1st script will show 10 scopes used and free ippude details and script 2 should show scope 11 to scope 20 used and free ips
can we have script like scop1 to scope 10 details should show So that 1st script will show 10 scopes used and free ippude details and script 2 should show scope 11 to scope 20 used and free ips
Re: used/free ips per scope on the DHCP Server
A script like that could be made. It might be best to create a quick wrapper script that uses the check_DHCP_perscope.ps1 script, and just calls it 10 times with 10 different DHCP scopes, each time reading the output, and then it returns the worst result to Nagios.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 222
- Joined: Thu Jul 06, 2017 8:55 am
Re: used/free ips per scope on the DHCP Server
thanks for the replay, we want to try to enable single scope monitoring. And it should show the historical data.
if we want to enable the below single scope monitoring could you please help us on what we need to change in nsclient.cfg additionally for below blue line colored and please provide the command to us how to call from nagios for the same.
check_DHCP_perscope = powershell.exe -command C:\Program` Files\NSClient++\scripts\check_DHCP_perscope.ps1
We need performance graphs/data for the below single scopes.
\check_DHCP_perscope.ps1 -s 172.9.3.0,
OK: pool1 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
if we want to enable the below single scope monitoring could you please help us on what we need to change in nsclient.cfg additionally for below blue line colored and please provide the command to us how to call from nagios for the same.
check_DHCP_perscope = powershell.exe -command C:\Program` Files\NSClient++\scripts\check_DHCP_perscope.ps1
We need performance graphs/data for the below single scopes.
\check_DHCP_perscope.ps1 -s 172.9.3.0,
OK: pool1 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
Re: used/free ips per scope on the DHCP Server
All you would need to do to the nsclient.ini entry is add an argument, like this.
Then, in Nagios, you can pass -s 172.9.3.0 using the $ARG1$ field in the service configuration.
Code: Select all
check_DHCP_perscope = powershell.exe -command C:\Program` Files\NSClient++\scripts\check_DHCP_perscope.ps1 $ARG1$
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 222
- Joined: Thu Jul 06, 2017 8:55 am
Re: used/free ips per scope on the DHCP Server
1) As you suggested we have done changes but we are getting the error. Please find the below error
nagios@nagi ~]$ /usr/local/nagios/libexec/check_nrpe -H DHCP t 120 -c check_DHCP_perscope -s 192.9.3.0
Get-DhcpServerv4Scope : Cannot process argument transformation on parameter
'ScopeId'. Cannot convert value "$" to type "System.Net.IPAddress[]". Error:
"Cannot convert value "$" to type "System.Net.IPAddress". Error: "An invalid
IP address was specified.""
At C:\Program Files\NSClient++\scripts\own\check_DHCP_perscope.ps1:75
char:43
+ $activeScopes = Get-DhcpServerv4Scope $scopeID |'Where'=0 '{'=0 '$_.State'=0 '...
+'=0 '~~~~~~~~
'=0 '+'=0 'CategoryInfo'=0 ':'=0 'InvalidData:'=0 '(:)'=0 '[Get-DhcpServerv4Scope],'=0 'Parame'=0 '
'=0 'terBindingArgumentTransformationException
'=0 '+'=0 'FullyQualifiedErrorId'=0 ':'=0 'ParameterArgumentTransformationError,Get-DhcpSer'=0 '
'=0 'verv4Scope
'=0 '
Get-DhcpServerv4ScopeStatistics'=0 ':'=0 'Cannot'=0 'validate'=0 'argument'=0 'on'=0 'parameter'=0 '
'ScopeId'.'=0 'The'=0 'argument'=0 'is'=0 'null'=0 'or'=0 'empty.'=0 'Provide'=0 'an'=0 'argument'=0 'that'=0 'is'=0 'not'=0 'null'=0 '
or'=0 'empty,'=0 'and'=0 'then'=0 'try'=0 'the'=0 'command
Can you please help to resolve the issue.
2) The script is showing the right output if we use multiple scope names saying as below
\check_DHCP_perscope.ps1 -s 192.9.3.0,192.9.4.0,192.9.5.0,192.9.6.0,
OK: pool1 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
OK: pool2 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
OK: pool3 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
OK: pool4 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
if you can provide the what arguments we need to change in nsclient and how to call from nagios. We will also try this and this will help us.
3) In order to get the performance graph, script its self it have capability to sent performance data right ??
4) And Do we have such scripts like and methods if any DHCP scope is newly added in dhcp server and script should send the scope parameter to nagios server and it should display in nagios.( Ex: today night new scope they created in dhcp server and script should configure the service saying as new scope is added with scope name in nagios server)
5) have heard that we can monitor the dhcp scopes states with snmp for windows server can you please also give more information how to configure this please
Please help on to resolve the all the details which is having error and 1,2,3,4,5 points. I know we ask much more but we have requirements.
nagios@nagi ~]$ /usr/local/nagios/libexec/check_nrpe -H DHCP t 120 -c check_DHCP_perscope -s 192.9.3.0
Get-DhcpServerv4Scope : Cannot process argument transformation on parameter
'ScopeId'. Cannot convert value "$" to type "System.Net.IPAddress[]". Error:
"Cannot convert value "$" to type "System.Net.IPAddress". Error: "An invalid
IP address was specified.""
At C:\Program Files\NSClient++\scripts\own\check_DHCP_perscope.ps1:75
char:43
+ $activeScopes = Get-DhcpServerv4Scope $scopeID |'Where'=0 '{'=0 '$_.State'=0 '...
+'=0 '~~~~~~~~
'=0 '+'=0 'CategoryInfo'=0 ':'=0 'InvalidData:'=0 '(:)'=0 '[Get-DhcpServerv4Scope],'=0 'Parame'=0 '
'=0 'terBindingArgumentTransformationException
'=0 '+'=0 'FullyQualifiedErrorId'=0 ':'=0 'ParameterArgumentTransformationError,Get-DhcpSer'=0 '
'=0 'verv4Scope
'=0 '
Get-DhcpServerv4ScopeStatistics'=0 ':'=0 'Cannot'=0 'validate'=0 'argument'=0 'on'=0 'parameter'=0 '
'ScopeId'.'=0 'The'=0 'argument'=0 'is'=0 'null'=0 'or'=0 'empty.'=0 'Provide'=0 'an'=0 'argument'=0 'that'=0 'is'=0 'not'=0 'null'=0 '
or'=0 'empty,'=0 'and'=0 'then'=0 'try'=0 'the'=0 'command
Can you please help to resolve the issue.
2) The script is showing the right output if we use multiple scope names saying as below
\check_DHCP_perscope.ps1 -s 192.9.3.0,192.9.4.0,192.9.5.0,192.9.6.0,
OK: pool1 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
OK: pool2 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
OK: pool3 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
OK: pool4 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
if you can provide the what arguments we need to change in nsclient and how to call from nagios. We will also try this and this will help us.
3) In order to get the performance graph, script its self it have capability to sent performance data right ??
4) And Do we have such scripts like and methods if any DHCP scope is newly added in dhcp server and script should send the scope parameter to nagios server and it should display in nagios.( Ex: today night new scope they created in dhcp server and script should configure the service saying as new scope is added with scope name in nagios server)
5) have heard that we can monitor the dhcp scopes states with snmp for windows server can you please also give more information how to configure this please
Please help on to resolve the all the details which is having error and 1,2,3,4,5 points. I know we ask much more but we have requirements.
- tacolover101
- Posts: 432
- Joined: Mon Apr 10, 2017 11:55 am
Re: used/free ips per scope on the DHCP Server
it looks liek your variables aren't passing properly.
take a look at this guide: https://docs.nsclient.org/howto/nrpe/
3. yes - you'll need to write performance data into the plugin if it does not exist.
http://nagios-plugins.org/doc/guidelines.html#AEN200
4. if the plugin does not do that, then you would need to write it. if you have a way to retrieve all the different subnets, then you could feed that as the variable to nagios to use as it's criteria.
5. for dhcp in snmp, you might be able to find more info by branching deeper in this oid: .1.3.6.1.4.1.311.1.3.2
take a look at this guide: https://docs.nsclient.org/howto/nrpe/
3. yes - you'll need to write performance data into the plugin if it does not exist.
http://nagios-plugins.org/doc/guidelines.html#AEN200
4. if the plugin does not do that, then you would need to write it. if you have a way to retrieve all the different subnets, then you could feed that as the variable to nagios to use as it's criteria.
5. for dhcp in snmp, you might be able to find more info by branching deeper in this oid: .1.3.6.1.4.1.311.1.3.2
Re: used/free ips per scope on the DHCP Server
Thanks for jumping in, Taco! That's a lot of good information!
@grayloglearn,
1. Did you change the command entry in NSClient at all? If so, can you show me that command entry?
2. You may have stumbled across a bug in this Powershell script. You actually are not getting the correct output. It says pool1,2,3,4 are in good order, but it's giving you the data for pool1 four times. Hopefully it's just the text output that is incorrect, and on the backside it's actually checking pool1,2,3, and 4 properly. But either way, it's a bug.
4. I can't think of a good way to do this right now. Bare minimum, you could have a script that lists the total number of DHCP pools, monitor that script and set the critical threshold for the number of pools you know exist. Then, if someone adds a pool, you will get an alert, you can add the new pool to your monitoring setup, and increase the threshold on the service that checks the number of DHCP scopes.
5. You can monitor DHCP scope states with SNMP, for Windows Server 2012 and below. Server 2016 and newer, Microsoft has removed this feature. I would recommend against monitoring DHCP with SNMP, even if you are currently running Server 2012 or lower, simply because eventually you will upgrade the DHCP server, and you will just have to deal with this problem when that happens. Though, if you did go this route, it would buy you time to build a more robust, and maintainable solution.
@grayloglearn,
1. Did you change the command entry in NSClient at all? If so, can you show me that command entry?
2. You may have stumbled across a bug in this Powershell script. You actually are not getting the correct output. It says pool1,2,3,4 are in good order, but it's giving you the data for pool1 four times. Hopefully it's just the text output that is incorrect, and on the backside it's actually checking pool1,2,3, and 4 properly. But either way, it's a bug.
3. Taco posted an excellent link for perf data. I don't have anything to add to this.2) The script is showing the right output if we use multiple scope names saying as below
\check_DHCP_perscope.ps1 -s 192.9.3.0,192.9.4.0,192.9.5.0,192.9.6.0,
OK: pool1 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
OK: pool2 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
OK: pool3 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
OK: pool4 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
4. I can't think of a good way to do this right now. Bare minimum, you could have a script that lists the total number of DHCP pools, monitor that script and set the critical threshold for the number of pools you know exist. Then, if someone adds a pool, you will get an alert, you can add the new pool to your monitoring setup, and increase the threshold on the service that checks the number of DHCP scopes.
5. You can monitor DHCP scope states with SNMP, for Windows Server 2012 and below. Server 2016 and newer, Microsoft has removed this feature. I would recommend against monitoring DHCP with SNMP, even if you are currently running Server 2012 or lower, simply because eventually you will upgrade the DHCP server, and you will just have to deal with this problem when that happens. Though, if you did go this route, it would buy you time to build a more robust, and maintainable solution.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
- Posts: 222
- Joined: Thu Jul 06, 2017 8:55 am
Re: used/free ips per scope on the DHCP Server
Hi taco,
1) Please find the below line which we added in nsclient.cfg as suggested correct me if we did wrong.
At nsclient.cfg check_DHCP_perscope = powershell.exe -command C:\Program` Files\NSClient++\scripts\check_DHCP_perscope.ps1 $ARG1$
And we calling the from nagios as below.
/usr/local/nagios/libexec/check_nrpe -H DHCP t 120 -c check_DHCP_perscope -s 192.9.3.0 (Correct us if we did wrong)
2) And i don't have knowledge on power shell script language to enable the performance data could you please help with change that will help us to resolve ASAP.
@ mbellerue
The script is working fine we are getting the right output, That is my mistake while copied the out put i have not changed(19 leases, 135 IP's available.) We should not provide the actual pool names, Now i provided the actual output.
\check_DHCP_perscope.ps1 -s 192.9.3.0,192.9.4.0,192.9.5.0,192.9.6.0,
OK: pool1 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
OK: pool2 in good order. pool1 is 0% used, (1 leases, 233 IP's available.)
OK: pool3 in good order. pool1 is 2% used, (4 leases, 216 IP's available.)
OK: pool4 in good order. pool1 is 3% used, ( 7 leases, 213 IP's available.)
and point number 4, We want to decrease the number of service define, if you can provide details what needs to be change in nsclient.cfg to call multiples scope this we will try once.
yes we are using the 2016 windows server might be we can't enable the snmp monitoring for dhcp scopes
Does snmp service will not work in windows server 2016??
Please help to resolve for single scope and multiple scope monitoring what we to have change??. And also please help with the changing the script with performance graph please.
1) Please find the below line which we added in nsclient.cfg as suggested correct me if we did wrong.
At nsclient.cfg check_DHCP_perscope = powershell.exe -command C:\Program` Files\NSClient++\scripts\check_DHCP_perscope.ps1 $ARG1$
And we calling the from nagios as below.
/usr/local/nagios/libexec/check_nrpe -H DHCP t 120 -c check_DHCP_perscope -s 192.9.3.0 (Correct us if we did wrong)
2) And i don't have knowledge on power shell script language to enable the performance data could you please help with change that will help us to resolve ASAP.
@ mbellerue
The script is working fine we are getting the right output, That is my mistake while copied the out put i have not changed(19 leases, 135 IP's available.) We should not provide the actual pool names, Now i provided the actual output.
\check_DHCP_perscope.ps1 -s 192.9.3.0,192.9.4.0,192.9.5.0,192.9.6.0,
OK: pool1 in good order. pool1 is 12% used, (19 leases, 135 IP's available.)
OK: pool2 in good order. pool1 is 0% used, (1 leases, 233 IP's available.)
OK: pool3 in good order. pool1 is 2% used, (4 leases, 216 IP's available.)
OK: pool4 in good order. pool1 is 3% used, ( 7 leases, 213 IP's available.)
and point number 4, We want to decrease the number of service define, if you can provide details what needs to be change in nsclient.cfg to call multiples scope this we will try once.
yes we are using the 2016 windows server might be we can't enable the snmp monitoring for dhcp scopes
Does snmp service will not work in windows server 2016??
Please help to resolve for single scope and multiple scope monitoring what we to have change??. And also please help with the changing the script with performance graph please.
- tacolover101
- Posts: 432
- Joined: Mon Apr 10, 2017 11:55 am
Re: used/free ips per scope on the DHCP Server
hi gray,
1. it sounds like this is working as expected then. $ARG1$ on the windows side is being passed 192.9.3.0 (if it should not be this, then you'll want to put it into a variable in your defined check command, or the host command being utilized)
2 & 4. for perf data, and checking multiple, it may be worth reaching out to the author of the plugin to see if they can add in this functionality, or seeing if someone on your team has powershell experience and can modify it. i think this is a bit beyond what support can do.
1. it sounds like this is working as expected then. $ARG1$ on the windows side is being passed 192.9.3.0 (if it should not be this, then you'll want to put it into a variable in your defined check command, or the host command being utilized)
2 & 4. for perf data, and checking multiple, it may be worth reaching out to the author of the plugin to see if they can add in this functionality, or seeing if someone on your team has powershell experience and can modify it. i think this is a bit beyond what support can do.