Can't delete a contact group and contact

I feel like they got created when I tried Director (now uninstalled). I can’t find that information (the contact group’s name) in any of the files in conf.d. Can’t delete them in the console.

I keep getting these notification emails and I want them to stop.

Tks :slight_smile:

icinga2 object list --type Contact (Not sure of the correct type, maybe run it first without the type)

Hello @GenBuri!

To figure out where a config object resides you may run e.g.:

icinga2 object list --type User --name icingaadmin

… with User being the type of the config object you’re searching (available types) and icingaadmin being its name (may be omitted to get all). Output:

Object 'icingaadmin' of type 'User':
  % declared in '/etc/icinga2/conf.d/users.conf', lines 6:1-6:25
  * __name = "icingaadmin"
  * display_name = "Icinga 2 Admin"
    % = modified in '/etc/icinga2/conf.d/users.conf', lines 9:3-9:33
  * email = "icinga@localhost"
    % = modified in '/etc/icinga2/conf.d/users.conf', lines 12:3-12:28
  * enable_notifications = true
  * groups = [ "icingaadmins" ]
    % = modified in '/etc/icinga2/conf.d/users.conf', lines 10:3-10:29
  * name = "icingaadmin"
  * package = "_etc"
  * pager = ""
  * period = ""
  * source_location
    * first_column = 1
    * first_line = 6
    * last_column = 25
    * last_line = 6
    * path = "/etc/icinga2/conf.d/users.conf"
  * states = null
  * templates = [ "icingaadmin", "generic-user" ]
    % = modified in '/etc/icinga2/conf.d/users.conf', lines 6:1-6:25
    % = modified in '/etc/icinga2/conf.d/templates.conf', lines 37:1-37:28
  * type = "User"
  * types = null
  * vars = null
  * zone = ""

The second line (% declared in ...) tells you the config file you have to edit (or remove completely).

Best,
AK

1 Like

@Al2Klimov @unic

Hi guys!

It says it is declared in a Director file :

% declared in ‘/var/lib/icinga2/api/packages/director/805a66e3-125a-4b52-a5e3-b22cde2d816e/zones.d/monitor-hpci3.cmc.ec.gc.ca/users.conf’, lines 1:0-1:27

Will I have to reinstall it to delete it?

AFAIK you should just have to edit that file and remove the user.

It worked. Thank you.

1 Like

If you don’t need the Director, I would also advise to copy all config you need, into /etc/zones.d/master for example, and purge the API package entirely. The safest way to do this is to use the REST API itself. https://icinga.com/docs/icinga2/latest/doc/12-icinga2-api/#deleting-configuration-package with director as package name.

Cheers,
Michael