Add hook to include custom variables by default when searching under Overview entries
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.inifile and retrieve them from it
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:
- check if your git client is configured with an email to sign commits
git config --list | grep email - If not, set it up using
git config --global user.email [email protected] - Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails
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.
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.
Is it possibile to retrigger the CLA check? Thanks
@cla-bot check
Please, is it possible to check this quite old PR? Thanks 😇
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)