Icinga / icinga2

The core of our monitoring platform with a powerful configuration language and REST API.
https://icinga.com/docs/icinga2/latest
GNU General Public License v2.0
2.03k stars 579 forks source link

New Plugins do not sync #7636

Closed danja95 closed 5 years ago

danja95 commented 5 years ago

DISCLAMER: i'm absolute new to icinga2 (or any nagios etc.)

Hello, i have trouble to get new plugins to work. I place them to destination host, setup checkcommand in my zone, but it will not pushed to dest. instead its complaing about not found command. if i manually create checkcommand on dest it works, but vars doesnt get to dest.

This is the plugin: https://github.com/thomas-krenn/check_smart_attributes

Icinga Master:

root@icinga:/etc/icinga2# icinga2 --version
icinga2 - The Icinga 2 network monitoring daemon (version: r2.11.2-1)

Copyright (c) 2012-2019 Icinga GmbH (https://icinga.com/)
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

System information:
  Platform: Debian GNU/Linux
  Platform version: 10 (buster)
  Kernel: Linux
  Kernel version: 5.0.21-5-pve
  Architecture: x86_64

Build information:
  Compiler: GNU 8.3.0
  Build host: runner-LTrJQZ9N-project-298-concurrent-0

Application information:

General paths:
  Config directory: /etc/icinga2
  Data directory: /var/lib/icinga2
  Log directory: /var/log/icinga2
  Cache directory: /var/cache/icinga2
  Spool directory: /var/spool/icinga2
  Run directory: /run/icinga2

Old paths (deprecated):
  Installation root: /usr
  Sysconf directory: /etc
  Run directory (base): /run
  Local state directory: /var

Internal paths:
  Package data directory: /usr/share/icinga2
  State path: /var/lib/icinga2/icinga2.state
  Modified attributes path: /var/lib/icinga2/modified-attributes.conf
  Objects path: /var/cache/icinga2/icinga2.debug
  Vars path: /var/cache/icinga2/icinga2.vars
  PID path: /run/icinga2/icinga2.pid
root@icinga:/etc/icinga2# icinga2 feature list
Disabled features: compatlog debuglog elasticsearch gelf graphite influxdb livestatus opentsdb perfdata statusdata syslog
Enabled features: api checker command ido-mysql mainlog notification
root@icinga:/etc/icinga2# icinga2 daemon -C
[2019-11-20 12:49:16 +0100] information/cli: Icinga application loader (version: r2.11.2-1)
[2019-11-20 12:49:16 +0100] information/cli: Loading configuration file(s).
[2019-11-20 12:49:16 +0100] information/ConfigItem: Committing config item(s).
[2019-11-20 12:49:16 +0100] information/ApiListener: My API identity: icinga.local.domain.de
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 1 FileLogger.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 2 NotificationCommands.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 1 NotificationComponent.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 74 Notifications.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 1 IcingaApplication.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 19 Hosts.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 10 Downtimes.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 1 Comment.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 1 CheckerComponent.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 6 Zones.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 4 Endpoints.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 1 ExternalCommandListener.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 2 ApiUsers.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 1 ApiListener.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 1 IdoMysqlConnection.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 244 CheckCommands.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 1 User.
[2019-11-20 12:49:16 +0100] information/ConfigItem: Instantiated 55 Services.
[2019-11-20 12:49:16 +0100] information/ScriptGlobal: Dumping variables to file '/var/cache/icinga2/icinga2.vars'
[2019-11-20 12:49:16 +0100] information/cli: Finished validating the configuration file(s).

Destination Host:

root@proxmox:/etc/icinga2# icinga2 --version
icinga2 - The Icinga 2 network monitoring daemon (version: r2.10.3-1)

Copyright (c) 2012-2019 Icinga GmbH (https://icinga.com/)
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

System information:
  Platform: Debian GNU/Linux
  Platform version: 10 (buster)
  Kernel: Linux
  Kernel version: 5.0.21-5-pve
  Architecture: x86_64

Build information:
  Compiler: GNU 8.3.0
  Build host: anubis

Application information:

General paths:
  Config directory: /etc/icinga2
  Data directory: /var/lib/icinga2
  Log directory: /var/log/icinga2
  Cache directory: /var/cache/icinga2
  Spool directory: /var/spool/icinga2
  Run directory: /run/icinga2

Old paths (deprecated):
  Installation root: /usr
  Sysconf directory: /etc
  Run directory (base): /run
  Local state directory: /var

Internal paths:
  Package data directory: /usr/share/icinga2
  State path: /var/lib/icinga2/icinga2.state
  Modified attributes path: /var/lib/icinga2/modified-attributes.conf
  Objects path: /var/cache/icinga2/icinga2.debug
  Vars path: /var/cache/icinga2/icinga2.vars
  PID path: /run/icinga2/icinga2.pid
root@proxmox:/etc/icinga2# icinga2 feature list
Disabled features: command compatlog debuglog elasticsearch gelf graphite influxdb livestatus notification opentsdb perfdata statusdata syslog
Enabled features: api checker mainlog
root@proxmox:/etc/icinga2# icinga2 daemon -C
[2019-11-20 12:51:12 +0100] information/cli: Icinga application loader (version: r2.10.3-1)
[2019-11-20 12:51:12 +0100] information/cli: Loading configuration file(s).
[2019-11-20 12:51:12 +0100] information/ConfigItem: Committing config item(s).
[2019-11-20 12:51:12 +0100] information/ApiListener: My API identity: proxmox.local.domain.de
[2019-11-20 12:51:12 +0100] information/ConfigItem: Instantiated 1 CheckerComponent.
[2019-11-20 12:51:12 +0100] information/ConfigItem: Instantiated 4 Zones.
[2019-11-20 12:51:12 +0100] information/ConfigItem: Instantiated 1 IcingaApplication.
[2019-11-20 12:51:12 +0100] information/ConfigItem: Instantiated 2 Endpoints.
[2019-11-20 12:51:12 +0100] information/ConfigItem: Instantiated 1 FileLogger.
[2019-11-20 12:51:12 +0100] information/ConfigItem: Instantiated 215 CheckCommands.
[2019-11-20 12:51:12 +0100] information/ConfigItem: Instantiated 1 ApiListener.
[2019-11-20 12:51:12 +0100] information/ScriptGlobal: Dumping variables to file '/var/cache/icinga2/icinga2.vars'
[2019-11-20 12:51:12 +0100] information/cli: Finished validating the configuration file(s).

Expected Behavior

Plugin should provide output to Webgui with right device spezified.

Current Behavior

Complain about Command not Found

Possible Solution

Force to Sync config inside zone.d ?

Steps to Reproduce (for bugs)

  1. Setup https://github.com/thomas-krenn/check_smart_attributes
  2. Create CheckCommand on Master, set vars for a device
  3. Restart icinga on master
  4. error in webgui

Context

I want to monitor my disks with that plugin to have notifications on that.

Your Environment

Master:

Object 'proxmox.local.domain.de' of type 'Endpoint':
  % declared in '/etc/icinga2/zones.d/master/internal-servers.conf', lines 13:1-13:45
  * __name = "proxmox.local.domain.de"
  * host = ""
  * log_duration = 86400
  * name = "proxmox.local.domain.de"
  * package = "_etc"
  * port = "5665"
  * source_location
    * first_column = 1
    * first_line = 13
    * last_column = 45
    * last_line = 13
    * path = "/etc/icinga2/zones.d/master/internal-servers.conf"
  * templates = [ "proxmox.local.domain.de" ]
    % = modified in '/etc/icinga2/zones.d/master/internal-servers.conf', lines 13:1-13:45
  * type = "Endpoint"
  * zone = "master"

Object 'mail3.domain.de' of type 'Endpoint':
  % declared in '/etc/icinga2/zones.d/master/external-servers.conf', lines 2:1-2:37
  * __name = "mail3.domain.de"
  * host = ""
  * log_duration = 86400
  * name = "mail3.domain.de"
  * package = "_etc"
  * port = "5665"
  * source_location
    * first_column = 1
    * first_line = 2
    * last_column = 37
    * last_line = 2
    * path = "/etc/icinga2/zones.d/master/external-servers.conf"
  * templates = [ "mail3.domain.de" ]
    % = modified in '/etc/icinga2/zones.d/master/external-servers.conf', lines 2:1-2:37
  * type = "Endpoint"
  * zone = "master"

Object 'icinga.local.domain.de' of type 'Endpoint':
  % declared in '/etc/icinga2/zones.conf', lines 7:1-7:44
  * __name = "icinga.local.domain.de"
  * host = ""
  * log_duration = 86400
  * name = "icinga.local.domain.de"
  * package = "_etc"
  * port = "5665"
  * source_location
    * first_column = 1
    * first_line = 7
    * last_column = 44
    * last_line = 7
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "icinga.local.domain.de" ]
    % = modified in '/etc/icinga2/zones.conf', lines 7:1-7:44
  * type = "Endpoint"
  * zone = ""

Object 'server01.de.domain.de' of type 'Endpoint':
  % declared in '/etc/icinga2/zones.d/master/external-servers.conf', lines 19:1-19:43
  * __name = "server01.de.domain.de"
  * host = ""
  * log_duration = 86400
  * name = "server01.de.domain.de"
  * package = "_etc"
  * port = "5665"
  * source_location
    * first_column = 1
    * first_line = 19
    * last_column = 43
    * last_line = 19
    * path = "/etc/icinga2/zones.d/master/external-servers.conf"
  * templates = [ "server01.de.domain.de" ]
    % = modified in '/etc/icinga2/zones.d/master/external-servers.conf', lines 19:1-19:43
  * type = "Endpoint"
  * zone = "master"

root@icinga:/etc/icinga2# icinga2 object list --type Zone
Object 'server01.de.domain.de' of type 'Zone':
  % declared in '/etc/icinga2/zones.d/master/external-servers.conf', lines 22:1-22:39
  * __name = "server01.de.domain.de"
  * endpoints = [ "server01.de.domain.de" ]
    % = modified in '/etc/icinga2/zones.d/master/external-servers.conf', lines 23:9-23:51
  * global = false
  * name = "server01.de.domain.de"
  * package = "_etc"
  * parent = "master"
    % = modified in '/etc/icinga2/zones.d/master/external-servers.conf', lines 24:9-24:25
  * source_location
    * first_column = 1
    * first_line = 22
    * last_column = 39
    * last_line = 22
    * path = "/etc/icinga2/zones.d/master/external-servers.conf"
  * templates = [ "server01.de.domain.de" ]
    % = modified in '/etc/icinga2/zones.d/master/external-servers.conf', lines 22:1-22:39
  * type = "Zone"
  * zone = "master"

Object 'global-templates' of type 'Zone':
  % declared in '/etc/icinga2/zones.conf', lines 24:1-24:30
  * __name = "global-templates"
  * endpoints = null
  * global = true
    % = modified in '/etc/icinga2/zones.conf', lines 25:3-25:15
  * name = "global-templates"
  * package = "_etc"
  * parent = ""
  * source_location
    * first_column = 1
    * first_line = 24
    * last_column = 30
    * last_line = 24
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "global-templates" ]
    % = modified in '/etc/icinga2/zones.conf', lines 24:1-24:30
  * type = "Zone"
  * zone = ""

Object 'director-global' of type 'Zone':
  % declared in '/etc/icinga2/zones.conf', lines 36:1-36:29
  * __name = "director-global"
  * endpoints = null
  * global = true
    % = modified in '/etc/icinga2/zones.conf', lines 37:3-37:15
  * name = "director-global"
  * package = "_etc"
  * parent = ""
  * source_location
    * first_column = 1
    * first_line = 36
    * last_column = 29
    * last_line = 36
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "director-global" ]
    % = modified in '/etc/icinga2/zones.conf', lines 36:1-36:29
  * type = "Zone"
  * zone = ""

Object 'mail3.domain.de' of type 'Zone':
  % declared in '/etc/icinga2/zones.d/master/external-servers.conf', lines 5:1-5:33
  * __name = "mail3.domain.de"
  * endpoints = [ "mail3.domain.de" ]
    % = modified in '/etc/icinga2/zones.d/master/external-servers.conf', lines 6:2-6:38
  * global = false
  * name = "mail3.domain.de"
  * package = "_etc"
  * parent = "master"
    % = modified in '/etc/icinga2/zones.d/master/external-servers.conf', lines 7:2-7:18
  * source_location
    * first_column = 1
    * first_line = 5
    * last_column = 33
    * last_line = 5
    * path = "/etc/icinga2/zones.d/master/external-servers.conf"
  * templates = [ "mail3.domain.de" ]
    % = modified in '/etc/icinga2/zones.d/master/external-servers.conf', lines 5:1-5:33
  * type = "Zone"
  * zone = "master"

Object 'proxmox.local.domain.de' of type 'Zone':
  % declared in '/etc/icinga2/zones.d/master/internal-servers.conf', lines 16:1-16:41
  * __name = "proxmox.local.domain.de"
  * endpoints = [ "proxmox.local.domain.de" ]
    % = modified in '/etc/icinga2/zones.d/master/internal-servers.conf', lines 17:9-17:53
  * global = false
  * name = "proxmox.local.domain.de"
  * package = "_etc"
  * parent = "master"
    % = modified in '/etc/icinga2/zones.d/master/internal-servers.conf', lines 18:9-18:25
  * source_location
    * first_column = 1
    * first_line = 16
    * last_column = 41
    * last_line = 16
    * path = "/etc/icinga2/zones.d/master/internal-servers.conf"
  * templates = [ "proxmox.local.domain.de" ]
    % = modified in '/etc/icinga2/zones.d/master/internal-servers.conf', lines 16:1-16:41
  * type = "Zone"
  * zone = "master"

Object 'master' of type 'Zone':
  % declared in '/etc/icinga2/zones.conf', lines 10:1-10:20
  * __name = "master"
  * endpoints = [ "icinga.local.domain.de" ]
    % = modified in '/etc/icinga2/zones.conf', lines 11:9-11:52
  * global = false
  * name = "master"
  * package = "_etc"
  * parent = ""
  * source_location
    * first_column = 1
    * first_line = 10
    * last_column = 20
    * last_line = 10
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "master" ]
    % = modified in '/etc/icinga2/zones.conf', lines 10:1-10:20
  * type = "Zone"
  * zone = ""

Destination:

root@proxmox:/etc/icinga2# icinga2 object list --type Endpoint
Object 'proxmox.local.domain.de' of type 'Endpoint':
  % declared in '/etc/icinga2/zones.conf', lines 15:1-15:45
  * __name = "proxmox.local.domain.de"
  * host = ""
  * log_duration = 86400
  * name = "proxmox.local.domain.de"
  * package = "_etc"
  * port = "5665"
  * source_location
    * first_column = 1
    * first_line = 15
    * last_column = 45
    * last_line = 15
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "proxmox.local.domain.de" ]
    % = modified in '/etc/icinga2/zones.conf', lines 15:1-15:45
  * type = "Endpoint"
  * zone = ""

Object 'icinga.local.domain.de' of type 'Endpoint':
  % declared in '/etc/icinga2/zones.conf', lines 6:1-6:44
  * __name = "icinga.local.domain.de"
  * host = "icinga.local.domain.de"
    % = modified in '/etc/icinga2/zones.conf', lines 7:2-7:36
  * log_duration = 86400
  * name = "icinga.local.domain.de"
  * package = "_etc"
  * port = "5665"
    % = modified in '/etc/icinga2/zones.conf', lines 8:2-8:14
  * source_location
    * first_column = 1
    * first_line = 6
    * last_column = 44
    * last_line = 6
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "icinga.local.domain.de" ]
    % = modified in '/etc/icinga2/zones.conf', lines 6:1-6:44
  * type = "Endpoint"
  * zone = ""

Object 'master' of type 'Zone':
  % declared in '/etc/icinga2/zones.conf', lines 11:1-11:20
  * __name = "master"
  * endpoints = [ "icinga.local.domain.de" ]
    % = modified in '/etc/icinga2/zones.conf', lines 12:2-12:45
  * global = false
  * name = "master"
  * package = "_etc"
  * parent = ""
  * source_location
    * first_column = 1
    * first_line = 11
    * last_column = 20
    * last_line = 11
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "master" ]
    % = modified in '/etc/icinga2/zones.conf', lines 11:1-11:20
  * type = "Zone"
  * zone = ""

Object 'director-global' of type 'Zone':
  % declared in '/etc/icinga2/zones.conf', lines 27:1-27:29
  * __name = "director-global"
  * endpoints = null
  * global = true
    % = modified in '/etc/icinga2/zones.conf', lines 28:2-28:14
  * name = "director-global"
  * package = "_etc"
  * parent = ""
  * source_location
    * first_column = 1
    * first_line = 27
    * last_column = 29
    * last_line = 27
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "director-global" ]
    % = modified in '/etc/icinga2/zones.conf', lines 27:1-27:29
  * type = "Zone"
  * zone = ""

Object 'proxmox.local.domain.de' of type 'Zone':
  % declared in '/etc/icinga2/zones.conf', lines 18:1-18:41
  * __name = "proxmox.local.domain.de"
  * endpoints = [ "proxmox.local.domain.de" ]
    % = modified in '/etc/icinga2/zones.conf', lines 19:2-19:46
  * global = false
  * name = "proxmox.local.domain.de"
  * package = "_etc"
  * parent = "master"
    % = modified in '/etc/icinga2/zones.conf', lines 20:2-20:18
  * source_location
    * first_column = 1
    * first_line = 18
    * last_column = 41
    * last_line = 18
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "proxmox.local.domain.de" ]
    % = modified in '/etc/icinga2/zones.conf', lines 18:1-18:41
  * type = "Zone"
  * zone = ""

Object 'global-templates' of type 'Zone':
  % declared in '/etc/icinga2/zones.conf', lines 23:1-23:30
  * __name = "global-templates"
  * endpoints = null
  * global = true
    % = modified in '/etc/icinga2/zones.conf', lines 24:2-24:14
  * name = "global-templates"
  * package = "_etc"
  * parent = ""
  * source_location
    * first_column = 1
    * first_line = 23
    * last_column = 30
    * last_line = 23
    * path = "/etc/icinga2/zones.conf"
  * templates = [ "global-templates" ]
    % = modified in '/etc/icinga2/zones.conf', lines 23:1-23:30
  * type = "Zone"
  * zone = ""

Thanks !

chrnie commented 5 years ago

Hi danja95,

where did you put the checkCommand? Is it in /etc/icinga2/zones.d/global-templates ?

br

danja95 commented 5 years ago

Hi, in /etc/icinga2/zones.d/master/checkcommand.conf

BR

chrnie commented 5 years ago

Hi,

and your endpoint, where you want to have this command to be synced is in the master zone too?

If not, try to move the checkcommand to /etc/icinga2/zones.d/global-templates and it will be synced to all endpoints.

If it works, be so kind and close the issue with a short reply.

stevie-sy commented 5 years ago

Hi, first of all this is the BugTracker from the devs. ;-) As I understand your question this is not a bug, it is only a question how to configure something. The devs wrote a very good doc where you learn how to configure icinga2. So maybe you should start here: https://icinga.com/docs/icinga2/latest/. If you have more questions there is a community Forum here: https://community.icinga.com/ where you can write your questions and you get help there for your questions.

danja95 commented 5 years ago

Hi,

and your endpoint, where you want to have this command to be synced is in the master zone too?

If not, try to move the checkcommand to /etc/icinga2/zones.d/global-templates and it will be synced to all endpoints.

If it works, be so kind and close the issue with a short reply.

if i do this, i got error: critical/config: Error: Validation failed for object 'webserver.local.domain.de!HTTP' of type 'Service'; Attribute 'check_command': Object 'check_http' of type 'CheckCommand' does not exist.

Hi, first of all this is the BugTracker from the devs. ;-) As I understand your question this is not a bug, it is only a question how to configure something. The devs wrote a very good doc where you learn how to configure icinga2. So maybe you should start here: https://icinga.com/docs/icinga2/latest/. If you have more questions there is a community Forum here: https://community.icinga.com/ where you can write your questions and you get help there for your questions.

i'm aware of that docs. but as said, i dont understand everything. Thats why i open this case. If not wanted this here anymore please close, then i will open this in forums again.

BR Daniel

chrnie commented 5 years ago

Yes, please do so and send me there the output of your master's zones.conf and of the proxmox zones.conf

dnsmichi commented 5 years ago

Move the command configuration into a global zone which is configured on your agent, this is described in the documentation.

mv /etc/icinga2/zones.d/master/checkcommand.conf /etc/icinga2/zones.d/global-templates/
systemctl restart icinga2

For future questions, please use our community forums first before waking up developers here.

Cheers, Michael