Solved

Use a resource on a template

  • 15 April 2022
  • 4 replies
  • 207 views

Userlevel 4
Badge +14

Hello,

We have PostgreSQL clusters, which each postgreSQL instances have his LUN mounted who present his folder.

So i try to develop a host template with a macro DBNAME who is used on a service template to check specificaly the file system of one database and i want to use standard command from the centreon-plugins Linux NRPE3.

Context :

I set a new Resource :

$DBNAME$ = $_HOSTDBNAME$

On my Host Template i define my macro :

$_HOSTDBNAME$ = xxxxxxdb01

On the Service Tempate Disks inherit from OS-Linux-Disks-NRPE3-custom, i use the macro FILTERMOUNTPOINT

$_SERVICEFILTERMOUNTPOINT$ = /data/postgres/$DBNAME$

In my idea nagios mechanism could display the value of DBNAME from the Host macro, but it doesn’t work.

It’s possible to use a resource at service template level ? or it just used at the command level ?

Regards,

Greg

icon

Best answer by Kriko 19 April 2022, 11:44

View original

4 replies

Userlevel 5
Badge +16

Hello @gespada 

I’m going to try to reproduce your issue.

But I’m kind sure that you cannot define a custom macro (or a macro) as the value of a ressource.

Maybe it could easier to create a custom service discovery rule and using some filter to get the mountpoint :)

Like this:

You can define a filter like this one for example : ^(?!(.*db01)$) to exclure everything that doesn’t match your XXXXdb01 mountpoint (if I’m correct with all the negation :’))

 

Userlevel 4
Badge +14

Hello @Kriko 

This way don’t solve my problem, because the services template in place check file age (postgresql.conf, pg_hba.conf, backup.log) and a cmd-return to check a pattern in the backup.log also

To have only postgres file system, i’ll do use the :

  • Type : Exclusion
  • String : $name$
  • Regular Expression : ^(?!/db_data/postgres)
  • And keep the overwritten value for the macro FILTERMOUNTPOINT ^$name$$

Regards,

Userlevel 5
Badge +16

AH! Sorry. The “Like” give me bad signal ^^’

Oh okay it was for checking a file. I see.

Userlevel 4
Badge +14

No problem @Kriko 

The template in place is not logical, it use many features of a Linux plugins and just one service command of postgres, but we have a Linux template also to monitor the RH HA Clusters. By this way, they wanted to decorrelate System and RDBMS but in fact it’s more linked i think.

It’s bad, but i have the initial solution who consist to harcode the path and the macro $_ HOSTDBNAME$ who permits to distinguish the path for all instances. It works but it involve a custom command and a custom service template, who is not a standard approach.

Regards,

Reply