Check_drivesize arguments

Hello,

I am having some difficulty to add more arguments for check_nscp_api:

From cli and Icinga this is working fine.

'/usr/lib64/nagios/plugins/check_nscp_api' '--password' '****' '-H' '10.......' '-a' 'warning=used>90%'  '-q' 'check_drivesize'
check_drivesize CRITICAL F:\: 1.221MB/1.221MB used | 'D:\ used'=1.621986GB;17.997360;17.997360;0;19.997066 'D:\ used %'=8%;90;90;0;100 'E:\ used'=349.953125MB;449.996484;449.996484;0;499.996094 'E:\ used %'=70%;90;90;0;100 'C:\ used'=18.798653GB;62.557907;62.557907;0;69.508785 'C:\ used %'=27%;90;90;0;100 'F:\ used'=1.220703MB;1.098633;1.098633;0;1.220703 'F:\ used %'=100%;90;90;0;100

From cli this is working fine.

'/usr/lib64/nagios/plugins/check_nscp_api' '--password' '****' '-H' '10.......' '-a' 'warning=used>90%' 'exclude=F:' '-q' 'check_drivesize'
check_drivesize OK All 3 drive(s) are ok | 'D:\ used'=1.621990GB;17.997360;17.997360;0;19.997066 'D:\ used %'=8%;90;90;0;100 'E:\ used'=349.953125MB;449.996484;449.996484;0;499.996094 'E:\ used %'=70%;90;90;0;100 'C:\ used'=18.817516GB;62.557907;62.557907;0;69.508785 'C:\ used %'=27%;90;90;0;100

In Icinga I see:

'/usr/lib64/nagios/plugins/check_nscp_api' '--password' '****' '-H' '10....' '-a' 'warning=used>90% exclude=F:' '-q' 'check_drivesize'

This is when I Inspect the check. I have no idea how to fix this problem with the quota. Can someone help?

Hey can you please send the whole command? Its not easy to see what you doing there
Like it is in your commands.conf

Hi,
Sure!

Blockquote
object CheckCommand “nscp_api” {
import “plugin-check-command”
command = [ PluginDir + “/check_nscp_api” ]
timeout = 1m
arguments += {
“–password” = {
description = “NSCP API password”
value = “$nscp_api_password$”
}
“-H” = {
description = “NSCP API host address”
required = true
value = “$nscp_api_host$”
}
“-P” = {
description = “NSCP API host port. Defaults to 8443.”
value = “$nscp_api_port$”
}
“-a” = {
description = “NSCP API Query arguments”
repeat_key = true
value = “$nscp_api_arguments$”
}
“-q” = {
description = “NSCPI API Query endpoint to use”
value = “$nscp_api_query$”
}
}
vars.check_address = {
arguments = [ ]
deprecated = false
name = “”
side_effect_free = false
type = “Function”
}
vars.check_ipv4 = false
vars.check_ipv6 = false
vars.nscp_api_host = “$check_address$”
}

Hey @adrian1

repeat_key is set to true. That means you can use an array for the nscp_api_arguments. In your service definition, use it like this:

vars.nscp_api_arguments = [ "warning=used>90%", "exclude=F:" ]

Hi @ritzgu ,

I get the error:

check_drivesize Invalid command line: unrecognised option '[ "warning=used>90%", "exclude=F:" ]'

This is what it’s trying to execute:

'/usr/lib64/nagios/plugins/check_nscp_api' '--password' '****' '-H' '10.....' '-a' '[ "warning=used>90%", "exclude=F:" ]' '-q' 'check_drivesize'

Can you show us the service definition?

Hello,

Sorry, I didn’t know that you were using icinga director. You have to set the type of the data field ‘nscp_api_arguments’ to ‘Array’ to make this work.

Hi @ritzgu

Thanks for the support! now it works!

Thanks again.

Have a nice day!
Adrian