Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule Forced Host and Service Notifications and Event Handlers #966

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

nagiosgwesterman
Copy link
Contributor

@nagiosgwesterman nagiosgwesterman commented May 30, 2024

SUMMARY

  • The following two features were requested:
    1. Force send scheduled notifications:
      • Implement two new external commands - one for hosts and one for services.
      • The scheduled forced host notification takes a host name and notification time and, when executed, sends a notification for the specified host "near" the desired notification time.
      • The scheduled forced service notification does the same but additionally takes in a service description and sends the notification for the service.
    2. Force run scheduled event handler:
      • Implement two new external commands - one for hosts and one for services.
      • The scheduled forced host event handler takes a host name and notification time and, when executed, runs the event handler associated with the specified host "near" the desired notification time.
      • The scheduled forced service event handler does the same but additionally takes in a service description and runs the event handler associated with the service.

For internal reviewers, these are the actual feature requests: here and here.

IMPLEMENTATION

  • I found it most straightforward to implement each of these new external commands within existing core functionality with new options.
  • In order to both force and schedule the notifications and event handlers, I made the external commands schedule a forced check (either for a host or service, appropriately) which is a functionality that already exists.
  • However, these checks do not necessarily send a notification or run an event handler. To ensure the notification is sent or the event handler runs, I added two new check options: CHECK_OPTION_FORCE_NOTIFICATION and CHECK_OPTION_FORCE_EVENT_HANDLER. When the check result is processed, it checks for these options and reacts accordingly.

TESTING PLAN

  • Run each of the four new external commands and verify that they work properly.
  1. SCHEDULE_FORCED_HOST_NOTIFICATION
  2. SCHEDULE_FORCED_SVC_NOTIFICATION
  3. SCHEDULE_FORCED_HOST_EVENT_HANDLER
  4. SCHEDULE_FORCED_SVC_EVENT_HANDLER
  • These require some setup to test (including setting up event handlers). Here are some docs to help with that:
    [1] Example external command
    [2] List of external commands
    [3] Setting up event handlers

  • Please also check for code quality and any functional flaws in my prospective changes. There is a solid chance this is nowhere near to what was requested or is otherwise terrible. I learned a lot and that's what life is all about isn't it?

…both CHECK_OPTION_FORCE_EXECUTION and CHECK_OPTION_FORCED_NOTIFICATION
… to send CHECK_OPTION_FORCE_EVENT_HANDLER in commands.c
… schedule_host/service_check and added CMD_SCHEDULE_FORCED_HOST_EVENT_HANDLER to valid host verification check
@aaronagios
Copy link
Contributor

@tsadpbb would you please review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants