Passive check configuration with ncpa and nsca
-
- Posts: 222
- Joined: Thu Jul 06, 2017 8:55 am
Re: Passive check configuration with ncpa and nsca
thanks for the replay.
I have tested as you suggested i have done changes in script and we are getting output as you suggest but still i am not getting out put in nagios console and graphs.
Please find the attachment for the output of the script and nagios console output also in attachments.
After changing the script we are not getting data in advanced tab-->perfdata. Please find the attachment.
As you told if the data is huge i want to break it as we are getting the 100 plus rows in output, we will call only 25 scopes, can you give me that command how to call only 25 scopes. please provide the command to call only 25 scopes we will try that also, and also please provide above details too.
I have tested as you suggested i have done changes in script and we are getting output as you suggest but still i am not getting out put in nagios console and graphs.
Please find the attachment for the output of the script and nagios console output also in attachments.
After changing the script we are not getting data in advanced tab-->perfdata. Please find the attachment.
As you told if the data is huge i want to break it as we are getting the 100 plus rows in output, we will call only 25 scopes, can you give me that command how to call only 25 scopes. please provide the command to call only 25 scopes we will try that also, and also please provide above details too.
You do not have the required permissions to view the files attached to this post.
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Passive check configuration with ncpa and nsca
My recommendation is to create an individual service per scope.
Looking at the plugin you need to use the -s argument:
Any other method of reducing the amount of scopes returned by the plugin is going to require you to manually edit the Powershell script to your needs.
Looking at the plugin you need to use the -s argument:
Code: Select all
.PARAMETER scopeID (-s)
Optional - define a single scope in the format of the subnet ID, or all scopes by using "all"
Default: all
Example: 192.168.0.0
Example: all
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
- Posts: 222
- Joined: Thu Jul 06, 2017 8:55 am
Re: Passive check configuration with ncpa and nsca
As you suggest i tried to call the script with argument but still i did not get any valid output.
Our requirement is simple we should get the graphs for scope monitoring.
root@ip-172-31-84-117:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_ncpa.py -H ip-172-31-94-235.ec2.internal -t 'Test@123' -P 5693 -M 'plugins/dhcpncpa.ps1' -a 'scope1,scope2'
Get-DhcpServerv4Scope : Cannot process argument transformation on parameter 'ScopeId'. Cannot convert value
"scope1,scope2" to type "System.Net.IPAddress[]". Error: "Cannot convert value "scope1,scope2" to type
"System.Net.IPAddress". Error: "An invalid IP address was specified.""
At C:\Program Files (x86)\Nagios\NCPA\plugins\dhcpncpa.ps1:75 char:43
+ $activeScopes = Get-DhcpServerv4Scope $scopeID | Where { $_.State ...
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-DhcpServerv4Scope], ParameterBindingArgumentTransformationExceptio
n
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-DhcpServerv4Scope
Get-DhcpServerv4ScopeStatistics : Cannot validate argument on parameter 'ScopeId'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
At C:\Program Files (x86)\Nagios\NCPA\plugins\dhcpncpa.ps1:82 char:46
+ $stats = Get-DhcpServerv4ScopeStatistics $scope.ScopeId
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-DhcpServerv4ScopeStatistics], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Get-DhcpServerv4ScopeStatistics
OK: in good order. is 0% used, (0 leases, 0 IP's available.) | _freeIPS=0; _AvailableIPS=0;
Please tell me how to define command for this ncpa and how to call from nagios. I know the script is having -S argument but in ncpa.cfg some where we should define where we have define, and how to call from nagios server. If you could help on this we will try to call 25 scope per service. Please help on this.
As you requested we have given output for the perfdata after changing the script but you haven't replay for this can you please help on that also please.
Our requirement is simple we should get the graphs for scope monitoring.
root@ip-172-31-84-117:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_ncpa.py -H ip-172-31-94-235.ec2.internal -t 'Test@123' -P 5693 -M 'plugins/dhcpncpa.ps1' -a 'scope1,scope2'
Get-DhcpServerv4Scope : Cannot process argument transformation on parameter 'ScopeId'. Cannot convert value
"scope1,scope2" to type "System.Net.IPAddress[]". Error: "Cannot convert value "scope1,scope2" to type
"System.Net.IPAddress". Error: "An invalid IP address was specified.""
At C:\Program Files (x86)\Nagios\NCPA\plugins\dhcpncpa.ps1:75 char:43
+ $activeScopes = Get-DhcpServerv4Scope $scopeID | Where { $_.State ...
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-DhcpServerv4Scope], ParameterBindingArgumentTransformationExceptio
n
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-DhcpServerv4Scope
Get-DhcpServerv4ScopeStatistics : Cannot validate argument on parameter 'ScopeId'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
At C:\Program Files (x86)\Nagios\NCPA\plugins\dhcpncpa.ps1:82 char:46
+ $stats = Get-DhcpServerv4ScopeStatistics $scope.ScopeId
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-DhcpServerv4ScopeStatistics], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Get-DhcpServerv4ScopeStatistics
OK: in good order. is 0% used, (0 leases, 0 IP's available.) | _freeIPS=0; _AvailableIPS=0;
Please tell me how to define command for this ncpa and how to call from nagios. I know the script is having -S argument but in ncpa.cfg some where we should define where we have define, and how to call from nagios server. If you could help on this we will try to call 25 scope per service. Please help on this.
As you requested we have given output for the perfdata after changing the script but you haven't replay for this can you please help on that also please.
Re: Passive check configuration with ncpa and nsca
Try the check_ncpa.py command like this,
Code: Select all
root@ip-172-31-84-117:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_ncpa.py -H ip-172-31-94-235.ec2.internal -t 'Test@123' -P 5693 -M 'plugins/dhcpncpa.ps1' -a '-s scope1,scope2'
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: Passive check configuration with ncpa and nsca
we have tried both ip and name please find the below error from the command.
root@ip-172-31-84-117:~# /usr/local/nagios/libexec/check_ncpa.py -H 172.31.94.235 -t 'Test@123' -P 5693 -M 'plugins/dhcpncpa.ps1' -a '-s scope1,scope2'
Get-DhcpServerv4Scope : Cannot process argument transformation on parameter 'ScopeId'. Cannot convert value
"scope1,scope2" to type "System.Net.IPAddress[]". Error: "Cannot convert value "scope1,scope2" to type
"System.Net.IPAddress". Error: "An invalid IP address was specified.""
At C:\Program Files (x86)\Nagios\NCPA\plugins\dhcpncpa.ps1:75 char:43
+ $activeScopes = Get-DhcpServerv4Scope $scopeID | Where { $_.State ...
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-DhcpServerv4Scope], ParameterBindingArgumentTransformationExceptio
n
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-DhcpServerv4Scope
Get-DhcpServerv4ScopeStatistics : Cannot validate argument on parameter 'ScopeId'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
At C:\Program Files (x86)\Nagios\NCPA\plugins\dhcpncpa.ps1:82 char:46
+ $stats = Get-DhcpServerv4ScopeStatistics $scope.ScopeId
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-DhcpServerv4ScopeStatistics], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Get-DhcpServerv4ScopeStatistics
OK: in good order. is 0% used, (0 leases, 0 IP's available.) | _freeIPS=0; _AvailableIPS=0;
root@ip-172-31-84-117:~# /usr/local/nagios/libexec/check_ncpa.py -H 172.31.94.235 -t 'Test@123' -P 5693 -M 'plugins/dhcpncpa.ps1' -a '-s 192.168.92.0,192.168.93.0'
Get-DhcpServerv4Scope : Cannot process argument transformation on parameter 'ScopeId'. Cannot convert value
"192.168.92.0,192.168.93.0" to type "System.Net.IPAddress[]". Error: "Cannot convert value "192.168.92.0,192.168.93.0"
to type "System.Net.IPAddress". Error: "An invalid IP address was specified.""
At C:\Program Files (x86)\Nagios\NCPA\plugins\dhcpncpa.ps1:75 char:43
+ $activeScopes = Get-DhcpServerv4Scope $scopeID | Where { $_.State ...
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-DhcpServerv4Scope], ParameterBindingArgumentTransformationExceptio
n
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-DhcpServerv4Scope
Get-DhcpServerv4ScopeStatistics : Cannot validate argument on parameter 'ScopeId'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
At C:\Program Files (x86)\Nagios\NCPA\plugins\dhcpncpa.ps1:82 char:46
+ $stats = Get-DhcpServerv4ScopeStatistics $scope.ScopeId
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-DhcpServerv4ScopeStatistics], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Get-DhcpServerv4ScopeStatistics
OK: in good order. is 0% used, (0 leases, 0 IP's available.) | _freeIPS=0; _AvailableIPS=0;
root@ip-172-31-84-117:~# /usr/local/nagios/libexec/check_ncpa.py -H 172.31.94.235 -t 'Test@123' -P 5693 -M 'plugins/dhcpncpa.ps1' -a '-s scope1,scope2'
Get-DhcpServerv4Scope : Cannot process argument transformation on parameter 'ScopeId'. Cannot convert value
"scope1,scope2" to type "System.Net.IPAddress[]". Error: "Cannot convert value "scope1,scope2" to type
"System.Net.IPAddress". Error: "An invalid IP address was specified.""
At C:\Program Files (x86)\Nagios\NCPA\plugins\dhcpncpa.ps1:75 char:43
+ $activeScopes = Get-DhcpServerv4Scope $scopeID | Where { $_.State ...
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-DhcpServerv4Scope], ParameterBindingArgumentTransformationExceptio
n
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-DhcpServerv4Scope
Get-DhcpServerv4ScopeStatistics : Cannot validate argument on parameter 'ScopeId'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
At C:\Program Files (x86)\Nagios\NCPA\plugins\dhcpncpa.ps1:82 char:46
+ $stats = Get-DhcpServerv4ScopeStatistics $scope.ScopeId
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-DhcpServerv4ScopeStatistics], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Get-DhcpServerv4ScopeStatistics
OK: in good order. is 0% used, (0 leases, 0 IP's available.) | _freeIPS=0; _AvailableIPS=0;
root@ip-172-31-84-117:~# /usr/local/nagios/libexec/check_ncpa.py -H 172.31.94.235 -t 'Test@123' -P 5693 -M 'plugins/dhcpncpa.ps1' -a '-s 192.168.92.0,192.168.93.0'
Get-DhcpServerv4Scope : Cannot process argument transformation on parameter 'ScopeId'. Cannot convert value
"192.168.92.0,192.168.93.0" to type "System.Net.IPAddress[]". Error: "Cannot convert value "192.168.92.0,192.168.93.0"
to type "System.Net.IPAddress". Error: "An invalid IP address was specified.""
At C:\Program Files (x86)\Nagios\NCPA\plugins\dhcpncpa.ps1:75 char:43
+ $activeScopes = Get-DhcpServerv4Scope $scopeID | Where { $_.State ...
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-DhcpServerv4Scope], ParameterBindingArgumentTransformationExceptio
n
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-DhcpServerv4Scope
Get-DhcpServerv4ScopeStatistics : Cannot validate argument on parameter 'ScopeId'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
At C:\Program Files (x86)\Nagios\NCPA\plugins\dhcpncpa.ps1:82 char:46
+ $stats = Get-DhcpServerv4ScopeStatistics $scope.ScopeId
+ ~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-DhcpServerv4ScopeStatistics], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Get-DhcpServerv4ScopeStatistics
OK: in good order. is 0% used, (0 leases, 0 IP's available.) | _freeIPS=0; _AvailableIPS=0;
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Passive check configuration with ncpa and nsca
The help says "define a single scope"Box293 wrote:My recommendation is to create an individual service per scope.
Looking at the plugin you need to use the -s argument:
Any other method of reducing the amount of scopes returned by the plugin is going to require you to manually edit the Powershell script to your needs.Code: Select all
.PARAMETER scopeID (-s) Optional - define a single scope in the format of the subnet ID, or all scopes by using "all" Default: all Example: 192.168.0.0 Example: all
So:
Code: Select all
/usr/local/nagios/libexec/check_ncpa.py -H 172.31.94.235 -t 'Test@123' -P 5693 -M 'plugins/dhcpncpa.ps1' -a '-s 192.168.92.0'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
- Posts: 222
- Joined: Thu Jul 06, 2017 8:55 am
Re: Passive check configuration with ncpa and nsca
Let me know how to define command in ncpa.cfg for the script. I mean i will call the "check_DHCP_perscope" so that i will create service with different scopes. In ncpa.cfg where we have to define the command and how to define as below ??
check_DHCP_perscope = powershell.exe -command C:\Program` Files\NSClient++\scripts\check_DHCP_perscope.ps1 -s $ARG1$
check_DHCP_perscope = powershell.exe -command C:\Program` Files\NSClient++\scripts\check_DHCP_perscope.ps1 -s $ARG1$
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Passive check configuration with ncpa and nsca
This guide provides a working example of how you can do this and I suggest you follow it and implement the example. Once you understand how it works then it will make it easy to implement your script.
https://support.nagios.com/kb/article/n ... a-722.html
You don't define plugin commands with NCPA, you call the plugins directly, for example:
https://support.nagios.com/kb/article/n ... a-722.html
You don't define plugin commands with NCPA, you call the plugins directly, for example:
Code: Select all
/usr/local/nagios/libexec/check_ncpa.py -H your_windows_server_ip_address -t your_windows_server_ncpa_token -P 5693 -M 'plugins/check_DHCP_perscope.ps1' -q "args=-s 192.168.92.0"
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
- Posts: 222
- Joined: Thu Jul 06, 2017 8:55 am
Re: Passive check configuration with ncpa and nsca
thanks for the command but we don't have any luck we are not able to pass multiple scopes. please find the below error.
root@ip-172-31-84-117:~# /usr/local/nagios/libexec/check_ncpa.py -H 172.31.94.235 -t Test@123 -P 5693 -M 'plugins/dhcpncpa.ps1' -q "args=-s 192.168.92.0"
OK: 92 in good order. 92 is 0% used, (0 leases, 4 IP's available.) | 92_freeIPS=4; 92_AvailableIPS=0;
root@ip-172-31-84-117:~# /usr/local/nagios/libexec/check_ncpa.py -H 172.31.94.235 -t Test@123 -P 5693 -M 'plugins/dhcpncpa.ps1' -q "args=-s 192.168.92.0,192.168.93.0"
UNKNOWN: Error occurred while running the plugin. Use the verbose flag for more details.
root@ip-172-31-84-117:~# /usr/local/nagios/libexec/check_ncpa.py -H 172.31.94.235 -t Test@123 -P 5693 -M 'plugins/dhcpncpa.ps1' -q "args=-s 192.168.92.0"
OK: 92 in good order. 92 is 0% used, (0 leases, 4 IP's available.) | 92_freeIPS=4; 92_AvailableIPS=0;
root@ip-172-31-84-117:~# /usr/local/nagios/libexec/check_ncpa.py -H 172.31.94.235 -t Test@123 -P 5693 -M 'plugins/dhcpncpa.ps1' -q "args=-s 192.168.92.0,192.168.93.0"
UNKNOWN: Error occurred while running the plugin. Use the verbose flag for more details.
Re: Passive check configuration with ncpa and nsca
You cannot pass two IPs with "-s"... it's for a "single scope. This is not supported by the plugin. See the usage below:thanks for the command but we don't have any luck we are not able to pass multiple scopes. please find the below error.
You could use "-all" instead:EXAMPLE
If using standalone:
>.check_dhcp_scope.ps1
This will evaluate all DHCP scopes and return a warning or critical if any of the scopes are above 90% or 98% full.
>.check_dhcp_scope.ps1 -all -w 50 -c 80
This will evaluate all DHCP scopes and return a warning or critical if any of the scopes are above 50% or 80% full.
>.check_dhcp_scope.ps1 -s 192.168.0.0
This will evaluate the 192.168.0.0 scope and return a warning or critical if is above 90% or 98% full.
Code: Select all
/usr/local/nagios/libexec/check_ncpa.py -H 172.31.94.235 -t Test@123 -P 5693 -M 'plugins/dhcpncpa.ps1' -q "args=-all"
Be sure to check out our Knowledgebase for helpful articles and solutions!