How to stop user from adding hosts and services in icingaweb2 dynamically?

Hi Everyone,

Introduction:
Hope you all are having a great day. For the last couple of days, I have doing some brain storming on a new requirement that have been shared with me. I couldn’t pin point or came up with a solution. So I thought to share on this amazing community with lot of experts in this domain.

Requirement:
As per this new requirement, I was to control number of hosts and services that a user can add. If a user exceed a specific limit of hosts/services, then he/she shouldn’t be able to further add any more hosts/services. This have to be achieved without effecting the monitoring module of the system.

If anyone has any solution or ideas regarding this functionality or can offer any help, please let me know. Your kind support will be very appreciated.

  • Director version (director -- 1.9):
  • Icinga Web 2 version (icingaweb2 -- 2.8.2):
  • Icinga 2 version (icinga2 -- 2.12.3):
  • PHP version (php --7.4):

Best Regards,
M. Kashan Zafar

You could write a icingaweb2 module that saves the service and host count per user and hooks into IcingaObjectFormHook in order to count saving and prevent further saving

Hi @moreamazingnick,
Can you please elaborate more on that last part of hooking into the IcingaObjectFormHook. Thanks.

Hooks are used to hook into operations of other modules and do “something”.
look at this:
https://icinga.com/docs/icinga-web/latest/modules/monitoring/doc/20-Hooks/
If my assumptions are correct than hooking into the IcingaObjectFormHook which is used to load and submit Host/Service Forms, you could count the created per month and o a successful save, and prevent saving after a specified count