Notifications based on BusinessProcess

This forum was archived to /woltlab and is now in read-only mode.
  • Hi all,


    is it possible to send notifications if a business process gets critical/fails?

    I could not find any option for this in Director, maybe it's possible via Icinga2 directly?


    I'm using Icinga2 2.6.2, Icinga Director 1.3.1 and BusinessProcess 2.1.


    Best regards,


    Logic

  • You can use the CheckCommand icingacli_businessprocess in your host/service object for that. This calls the icingacli for the business process module and allows to check for failures on the specified process.


    https://docs.icinga.com/icinga…icingacli-businessprocess

  • I can't get it to work.

    Apart from that the service check tells me that "usr/bin/icingacli" can't be found: execvpe(/usr/bin/icingacli) failed: No such file or directory though it's there and i can use it from the command line, the bigger problem is, that I can't figure out what input the check/cli command expects.


    List of my business processes:

    sudo -u nagios /usr/bin/icingacli businessprocess process list

    What command exactly do I need to check the status of one of these?


    I tried sudo -u nagios /usr/bin/icingacli businessprocess process check --process E-Mail and get and ERROR: Exception in /usr/share/icingaweb2/modules/businessprocess/library/Businessprocess/BpConfig.php:518 with message: The node "" doesn't exist

    What is expected for the argument "node"? Is it an Icinga2 node (icinga2 node list?)?

    It doesn't seem to be a node from the business process.


    See attached image and following code for email bp config.


    Tried this:


    Code
    1. sudo -u nagios /usr/bin/icingacli businessprocess process check --process E-Mail "E-Mail-Versand und Empfang"
    2. ERROR: Exception in /usr/share/icingaweb2/modules/businessprocess/library/Businessprocess/BpConfig.php:518 with message: The node "E-Mail-Versand und Empfang" doesn't exist


    Can you point me in the right direction?

  • Hello,


    Quote


    sudo -u nagios /usr/bin/icingacli businessprocess process check --process E-Mail "E-Mail-Versand und Empfang"


    "E-Mail" is the "config" ?


    Does this solve your problem:

    sudo -u nagios /usr/bin/icingacli businessprocess process check --config E-Mail "E-Mail-Versand und Empfang" ?

  • Hi fugstrolch,


    thanks for your input!


    E-Mail is on of my business processes.

    In this process I configured the node "E-Mail-Versand und Empfang" and this has four "sub-nodes" BYOD, Clearswift, Exchange-Sevrer, Kemp-Loadmaster which than hold the specific hosts.


    If I run your line, this is the outcome:

    ERROR: Icinga\Exception\ConfigurationError in /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/MonitoringBackend.php:181 with message: No backend has been configured


    I find that quite strange, as the monitoring itself works, and a backend is configured.

  • Something like this should work:


    Code
    1. sudo -u nagios /usr/bin/icingacli businessprocess check --config "E-Mail" process "E-Mail-Versand und Empfang"
  • Sadly it doesn't...

    Code
    1. sudo -u nagios /usr/bin/icingacli businessprocess check --config "E-Mail" process "E-Mail-Versand und Empfang"
    2. ERROR: Icinga\Exception\ConfigurationError in /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/MonitoringBackend.php:181 with message: No backend has been configured

    also tried:

    Code
    1. sudo -u nagios /usr/bin/icingacli businessprocess process check --config "E-Mail" "E-Mail-Versand und Empfang"
    2. ERROR: Icinga\Exception\ConfigurationError in /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/MonitoringBackend.php:181 with message: No backend has been configured

    I don't get why this check tells me that no backend is configured when I clearly have one, because I have a working monitoring system?! Or do I need to configure something else additionally?

  • Can you show the backends.ini and the resources.ini config files (remove sensitive credentials).


    Code
    1. cat /etc/icingaweb2/modules/monitoring/backends.ini
    2. cat /etc/icingaweb2/resources.ini
  • cat /etc/icingaweb2/modules/monitoring/backends.ini

    Code
    1. [icinga]
    2. type = "ido"
    3. resource = "icinga_ido"


    cat /etc/icingaweb2/resources.ini

  • I tried that inside the Vagrant boxes and it works for me. Still curious what this error message might cause, I'm not that deep into the code though.

  • Hi dnsmichi,


    could you show me your BP and the syntax of your successful query?

    Maybe I can rebuild your bp or apply it to my setup and understand what the icingacli businessprocess expects as "node" and "config".


    Thanks for your help!



    #EDIT:

    I previously had the service check bound to the wrong host, so that the check told me, that icingacli could not be found (duh)

    Now I got the check to "work", kind of...


    I tried the "original" check command icingacli-businessprocess as well as created a new one "businessprocess".

    Both commands get the two variables icingacli_businessprocess_process and icingacli_businessprocess_config.


    The new command looks like this (due to the deprecated warning with icingacli businessprocess check process:

    This is the applied service:

    Code
    1. apply Service "BusinessProcess-Citrix" {
    2. import "BusinessProcess-Check"
    3. assign where match("st-mon2-rz*", host.display_name)
    4. vars.icingacli_businessprocess_config = "Citrix"
    5. vars.icingacli_businessprocess_process = "Citrix-Umgebung"
    6. import DirectorOverrideTemplate
    7. }


    And the surprising output is (no matter which of the two commands I use:

    Code
    1. ERROR: There is no such module or command: 'businessprocess'
    2. USAGE: icingacli [module] <command> [action] [options]
    3. [...]

    What the hell?! :D

    The post was edited 2 times, last by log1c: additional info ().

  • I'm playing on top of that git branch which will be merged to master soon: https://github.com/Icinga/icin…nt/commits/feature/bp-cli


    Once I succeed with it, I'll resolve https://github.com/Icinga/icin…26#issuecomment-286999909 and also send in a PR for the Icinga Web 2 BP docs.



  • Thanks for the screenshot!

    I got it to work now, though I don't get the fancy colors and detailed output.

    Code
    1. root@ST-MON2-RZ:~# icingacli businessprocess process check Citrix-Umgebung
    2. Business Process OK: Citrix-Umgebung
    3. root@ST-MON2-RZ:~# icingacli businessprocess process check "LAN-OL" --config "Core Infrastruktur OL"
    4. Business Process OK: LAN-OL

    So the "node" (1st argument after "check") is the root of the business process tree, which then can have several sub-nodes.

    I mostly need the --config because I have some node names multiple times in different BPs.


    Will need to adjust some of my processes, so that they have one single root node.


    Both my check commands still return ERROR: There is no such module or command: 'businessprocess'

  • Colors and details are controled with --colors and --details parameters. You'll get an idea what's possible by calling


    Code
    1. icingacli businessprocess process check --help
  • You are right, I forgot them in my previous post.

    Adding them doesn't change the output though :(

    Code
    1. root@ST-MON2-RZ:/etc/icinga2/conf.d# icingacli businessprocess process check "Citrix-Umgebung" --details --colors --state-type hard
    2. Business Process OK: Citrix-Umgebung



    edit:

    running the same command with sudo -u nagios give me the error message:

    Code
    1. ERROR: Icinga\Exception\ConfigurationError in /usr/share/icingaweb2/modules/monitoring/library/Monitoring/Backend/MonitoringBackend.php:181 with message: No backend has been configured

    I don't understand why. The nagios user is the default user for icinga2 when installed on Ubuntu. I also added the user to the icingaweb2 group.

    The post was edited 1 time, last by log1c ().