You are here

How do we define parameters per service check?

4 posts / 0 new
Last post
nmilas
nmilas's picture
How do we define parameters per service check?

Hello,

In Service Checks which need the definition of per-case parameters, how do we define these?

For example, when we add to a host the "Database - MySQL Server" template , we have a bunch of service checks which depend on mysql credentials. For instance, one of them, "MySQL Aborted connects" takes as parameters:

-H $HOSTADDRESS$ -u %MYSQLCREDENTIALS:1% -p %MYSQLCREDENTIALS:2% --metricname=Aborted_connects -w 20 -c 30

...and we know that $HOSTADDRESS$ is taken automatically by host definition.

But where/how do we define:

%MYSQLCREDENTIALS:1% %MYSQLCREDENTIALS:2%

...? Is it in a file, or in some field in the host definition? Some way must exist so that the template can operate without problems on multiple hosts with different MySQL credentials.

Can you please provide some clarifications?

Thanks,
Nick

smarsh
smarsh's picture
Re: How do we define parameters per service check?

Hi Nick,

Those % symbols indicate an attribute. You can configure the global value via 'settings > attributes' - this means that %MYSQLCREDENTIALS:1% will always be what you set in the aforementioned section, regardless of host.

Alternatively, you can add attributes per host (edit a host, last tab - 'attributes') - add a new one, set it to MYSQL.. and then click 'edit' or 'override' (cant remember off the top of my head). The first argument would be the username (:1) and the second will be the password (:2).

HTH,

Sam

nmilas
nmilas's picture
Re: How do we define parameters per service check?

Thank you Sam,

You have been most helpful. I now configured these attributes but all service checks based on check_mysql_performance did not return any data. They all return: "(Return code of 255 is out of bounds)".

I tried running one directly from linux (CentOS 5.10 x86_64), and I get: 

# ./check_mysql_performance -H 1.2.3.4 -u myusername -p mypassword --metricname=Connections -w 20 -c 30 Undefined subroutine &Carp::shortmess_heavy called at /usr/lib/perl5/5.8.8/Carp.pm line 260.

I am running: Opsview Core 3.20131016.0

Can you provide any clue on what is wrong here?

Thanks,
Nick

nmilas
nmilas's picture
Re: How do we define parameters per service check?

Thank you Sam,

You have been most helpful. I now configured these attributes but all service checks based on check_mysql_performance did not return any data. They all return: "(Return code of 255 is out of bounds)".

I tried running one directly from linux (CentOS 5.10 x86_64), and I get: 

# ./check_mysql_performance -H 1.2.3.4 -u myusername -p mypassword --metricname=Connections -w 20 -c 30 Undefined subroutine &Carp::shortmess_heavy called at /usr/lib/perl5/5.8.8/Carp.pm line 260.

I am running: Opsview Core 3.20131016.0

Also:

# perl -MCarp -e 'print $Carp::VERSION'
1.04

Can you provide any clue on what is wrong here?

Thanks,
Nick