credativ / icingaweb2-module-azure

Importer plugin module for IcingaWeb2 Director plugin to connect to Microsoft Azure API
MIT License
7 stars 4 forks source link

AppGW Import: Undefined property: stdClass::$enableHttp2 #7

Open uffsalot opened 3 years ago

uffsalot commented 3 years ago

When I try to import our application gateways, I get the following error:

image

The Import source is configured as such: image

The Load balancer import does not work either:

Undefined property: stdClass::$publicIPAddress (LoadBalancers.php:100)
#0 /usr/share/icingaweb2/modules/azure/library/Azure/LoadBalancers.php(100): Icinga\Application\ApplicationBootstrap->Icinga\Application\{closure}(8, 'Undefined prope...', '/usr/share/icin...', 100, Array)
#1 /usr/share/icingaweb2/modules/azure/library/Azure/Api.php(133): Icinga\Module\Azure\LoadBalancers->scanResourceGroup(Object(stdClass))
#2 /usr/share/icingaweb2/modules/azure/library/Azure/ProvidedHook/Director/ImportSource.php(172): Icinga\Module\Azure\Api->getAll('')
#3 /usr/share/icingaweb2/modules/director/library/Director/Web/Table/ImportsourceHookTable.php(100): Icinga\Module\Azure\ProvidedHook\Director\ImportSource->fetchData()
#4 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Table/SimpleQueryBasedTable.php(29): Icinga\Module\Director\Web\Table\ImportsourceHookTable->prepareQuery()
#5 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Table/SimpleQueryBasedTable.php(15): gipfl\IcingaWeb2\Table\SimpleQueryBasedTable->getQuery()
#6 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Table/QueryBasedTable.php(56): gipfl\IcingaWeb2\Table\SimpleQueryBasedTable->getPaginationAdapter()
#7 /usr/share/icingaweb2/modules/incubator/vendor/gipfl/icingaweb2/src/Table/QueryBasedTable.php(255): gipfl\IcingaWeb2\Table\QueryBasedTable->getPaginator(Object(gipfl\IcingaWeb2\Url))
#8 /usr/share/icingaweb2/modules/director/application/controllers/ImportsourceController.php(162): gipfl\IcingaWeb2\Table\QueryBasedTable->renderTo(Object(Icinga\Module\Director\Controllers\ImportsourceController))
#9 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Module\Director\Controllers\ImportsourceController->previewAction()
#10 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch('previewAction')
#11 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#12 /usr/share/php/Icinga/Application/Web.php(300): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#13 /usr/share/php/Icinga/Application/webrouter.php(99): Icinga\Application\Web->dispatch()
#14 /usr/share/icingaweb2/public/index.php(4): require_once('/usr/share/php/...')
#15 {main}

Is there a configuration issue on my side, or did Microsoft change something in the api, which breaks the import? The VM import on the other hand works fine.

archandha commented 3 years ago

Hi, and a good morning, sorry, I did not see your issue posting.

for the load balancers it looks like there is no IP configured on the Azure side. For the application gateways, the error might indicate, that the "enabledHTTP2" property is missing.

As of now, I had no chance to work on this project anymore for two years or so. It is possible, that the API has changed. If its just the missing property, it might help to replace line 112 in AppGW.php with

                'enabledHTTP2'      => (
                    property_exists($current->properties, 'enabledHTTP2') ?
                    $current->properties->enableHttp2 :
                    NULL
                ),

If this helps for the AppGW, please report back, than I will provide a patch on this. Sadly, I have no option to test this on my own, as the original project ended and I don't have access to an Azure Setup.

Best Peter