icingadb-web icon indicating copy to clipboard operation
icingadb-web copied to clipboard

Add hook to include custom variables by default when searching under Overview entries

Open oskarnrk opened this issue 1 year ago • 7 comments

refs #1045

The hook can be implemented in multiple ways. For example:

Add to run.php

$this->provideHook('Icingadb/CustomVarsRetriever', 'ExampleCustomVarsRetriever');

ExampleCustomVarsRetriever.php

<?php

namespace Icinga\Module\Icingadb\ProvidedHook;

use Icinga\Module\Icingadb\Hook\CustomVarsRetrieverHook;
use ipl\Orm\Model;

class ExampleCustomVarsRetriever extends CustomVarsRetrieverHook
{
    public function retrieveCustomVars(Model $model): array
    {
        switch ($model->getTableName()) {
            case 'host':
                return ['host.vars.hostfoo', 'host.vars.hostbar'];
            case 'service':
                return ['service.vars.servicefoo', 'service.vars.servicebar'];
            default:
                return [];
        }
    }
}

Some implementation suggestions could be:

  • retrieve the custom vars and filter letting pass only the ones that actually exist
  • provide multiple hooks to implement different logic for a specific model (it's given as input)
  • save the wanted custom variables in a config.ini file and retrieve them from it

oskarnrk avatar Aug 20 '24 12:08 oskarnrk

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Oscar Zambotti. This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

cla-bot[bot] avatar Aug 20 '24 12:08 cla-bot[bot]

Thank you for your pull request. Before we can look at it, you'll need to sign a Contributor License Agreement (CLA).

Please follow instructions at https://icinga.com/company/contributor-agreement to sign the CLA.

After that, please reply here with a comment and we'll verify.

Contributors that have not signed yet: @oskarnrk

  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Please contact us if you think this is the case.

  • If you signed the CLA as a corporation, your GitHub username may not have been submitted to us. Please reach out to the responsible person in your organization.

cla-bot[bot] avatar Aug 20 '24 13:08 cla-bot[bot]

Thank you for your pull request. Before we can look at it, you'll need to sign a Contributor License Agreement (CLA).

Please follow instructions at https://icinga.com/company/contributor-agreement to sign the CLA.

After that, please reply here with a comment and we'll verify.

Contributors that have not signed yet: @oskarnrk

I signed the ICLA, thanks in advance.

oskarnrk avatar Aug 20 '24 15:08 oskarnrk

Is it possibile to retrigger the CLA check? Thanks

oskarnrk avatar Oct 18 '24 07:10 oskarnrk

@cla-bot check

bobapple avatar Oct 23 '24 08:10 bobapple

Please, is it possible to check this quite old PR? Thanks 😇

oskarnrk avatar Feb 26 '25 09:02 oskarnrk

Hi, the reason why (at least for me) no-one looked at this yet, is that this isn't just a small feature. This has so many other parts which might be affected, that I don't want to introduce a half baked solution. (Besides that a new hook also requires us to cover support for it, which I cannot guarantee at all)

nilmerg avatar Feb 26 '25 09:02 nilmerg