Giter Club home page Giter Club logo

community.healthchecksio's Introduction

Healthchecks.io Community Collection

coverage black integration sanity unit

This Ansible collection contains modules for assisting in the automation of the Healthchecks.io monitoring service. To learn more about this service, please read https://healthchecks.io/about/.

From their site:

Healthchecks.io is an online service for monitoring regularly running tasks such as cron jobs. It uses the Dead man's switch technique: the monitored system must "check in" with Healthchecks.io at regular, configurable time intervals. When Healthchecks.io detects a missed check-in, it sends out alerts.

The service documentation is located at https://healthchecks.io/docs/ and the API documentation is located at https://healthchecks.io/docs/api/. This Ansible module strives for API parity.

Code of Conduct

We follow the Ansible Code of Conduct in all our interactions within this project.

If you encounter abusive behavior, please refer to the policy violations section of the Code for information on how to raise a complaint.

Communication

Join us in the #ansible-healthchecksio channel of Libera Chat.

We take part in the global quarterly Ansible Contributor Summit virtually or in-person. Track The Bullhorn newsletter and join us.

For more information about communication, refer to the Ansible Communication guide.

Contributing to this collection

The content of this collection is made by people like you, a community of individuals collaborating on making the world better through developing automation software.

We are actively accepting new contributors.

Any kind of contribution is very welcome.

You don't know how to start? Refer to our contribution guide!

We use the following guidelines:

Collection maintenance

The current maintainers are listed in the MAINTAINERS file. If you have questions or need help, feel free to mention them in the proposals.

To learn how to maintain / become a maintainer of this collection, refer to the Maintainer guidelines.

Governance

The process of decision making in this collection is based on discussing and finding consensus among participants.

Every voice is important. If you have something on your mind, create an issue or dedicated discussion and let's discuss it!

Tested with Ansible

Tested with the current Ansible 2.9 and 2.10 releases and the current development version of Ansible. Ansible versions before 2.9.10 are not supported.

External requirements

An account (and API token) for Healthchecks.io.

Supported connections

N/A

Included content

Modules

Management API

  • community.healthchecksio.badges_info - Returns a map of all tags in the project, with badge URLs for each tag.
  • community.healthchecksio.channels_info - Returns a list of integrations belonging to the project.
  • community.healthchecksio.checks_flips_info - Get a list of check's status changes.
  • community.healthchecksio.checks_info - Returns a list of checks belonging to the user, optionally filtered by one or more tags.
  • community.healthchecksio.checks_pings_info - Returns a list of pings this check has received.
  • community.healthchecksio.checks - Create, delete, update, and pause checks.

Ping API

  • community.healthchecksio.ping - Signal success, fail, and start events.

Using this collection

Management API

- name: Get the project badges
  community.healthchecksio.badges_info:
    state: present
    api_key: "{{ api_key }}"
- name: Get a list of integrations
  community.healthchecksio.channels_info:
    state: present
    api_key: "{{ api_key }}"
- name: Create a check named "test"
  community.healthchecksio.checks:
    state: present
    api_key: "{{ api_key }}"
    name: test
    unique: ["name"]
- name: Create a check named "test hourly"
  community.healthchecksio.checks:
    state: present
    api_key: "{{ api_key }}"
    name: "test hourly"
    unique: ["name"]
    tags: ["test", "hourly"]
    desc: "my hourly test check"
    schedule: "0 * * * *"
- name: Returns all of the checks
  community.healthchecksio.checks_info:
    state: present
    api_key: "{{ api_key }}"
- name: Pause a check by uuid
  community.healthchecksio.checks:
    state: pause
    api_key: "{{ api_key }}"
    uuid: "{{ check_uuid }}"
- name: Delete a check by uuid
  community.healthchecksio.checks:
    state: absent
    api_key: "{{ api_key }}"
    uuid: "{{ check_uuid }}"
- name: Get a list of checks pings
  community.healthchecksio.checks_pings_info:
    state: pings
    api_key: "{{ api_key }}"
    uuid: "{{ check_uuid }}"
- name: Get a list of checks flips
  community.healthchecksio.checks_flips_info:
    state: flips
    api_key: "{{ api_key }}"
    uuid: "{{ check_uuid }}"

Ping API

- name: Send a success signal
  community.healthchecksio.ping:
    state: present
    uuid: "{{ check_uuid }}"
    signal: success
- name: Send a fail signal
  community.healthchecksio.ping:
    state: present
    uuid: "{{ check_uuid }}"
    signal: fail
- name: Send a start signal
  community.healthchecksio.ping:
    state: present
    uuid: "{{ check_uuid }}"
    signal: start

Installing the Collection from Ansible Galaxy

Before using this collection, you need to install it with the Ansible Galaxy command-line tool:

ansible-galaxy collection install community.healthchecksio

You can also include it in a requirements.yml file and install it with ansible-galaxy collection install -r requirements.yml, using the format:

---
collections:
  - name: community.healthchecksio

Note that if you install the collection from Ansible Galaxy, it will not be upgraded automatically when you upgrade the ansible package. To upgrade the collection to the latest available version, run the following command:

ansible-galaxy collection install community.healthchecksio --upgrade

You can also install a specific version of the collection, for example, if you need to downgrade when something is broken in the latest version (please report an issue in this repository). Use the following syntax to install version 0.1.0:

ansible-galaxy collection install community.healthchecksio

See Ansible Using collections for more details.

Release notes

See the changelog.

Roadmap

There's a pinboard issue here and we can have discussions here.

More information

Licensing

GNU General Public License v3.0 or later.

See LICENSE to see the full text.

community.healthchecksio's People

Contributors

gsauthof avatar mamercad avatar mjsalmi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

community.healthchecksio's Issues

Sanity tests failing Ansible devel

SUMMARY
ERROR: Found 1 validate-modules issue(s) which need to be resolved:
ERROR: plugins/modules/ping.py:0:0: no-default-for-required-parameter: DOCUMENTATION.options.uuid: Argument is marked as required but specifies a default. Arguments with a default should not be marked as required for dictionary value @ data['options']['uuid']. Got {'description': ['Check uuid to delete when state is C(absent) or C(pause).'], 'type': 'str', 'required': True, 'default': ''}
ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • ping
ANSIBLE VERSION
❯ ansible --version
ansible [core 2.12.1]
  config file = /Users/mark/.ansible.cfg
  configured module search path = ['/Users/mark/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/mark/.pyenv/versions/3.9.9/lib/python3.9/site-packages/ansible
  ansible collection location = /Users/mark/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/mark/.pyenv/versions/3.9.9/bin/ansible
  python version = 3.9.9 (main, Dec  9 2021, 19:41:06) [Clang 13.0.0 (clang-1300.0.29.3)]
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
❯ ansible-galaxy collection list community.healthchecksio

# /Users/mark/.ansible/collections/ansible_collections
Collection               Version
------------------------ -------
community.healthchecksio 0.1.1
CONFIGURATION
❯ ansible-config dump --only-changed
DEFAULT_STDOUT_CALLBACK(/Users/mark/.ansible.cfg) = yaml
DIFF_ALWAYS(/Users/mark/.ansible.cfg) = True
INTERPRETER_PYTHON(/Users/mark/.ansible.cfg) = /Users/mark/.pyenv/shims/python3
OS / ENVIRONMENT
STEPS TO REPRODUCE

They're failing in the action.

EXPECTED RESULTS

Sanity tests pass.

ACTUAL RESULTS

Sanity tests aren't passing.

Ansible Contributor Summit. Tuesday, April 12, 2022.

Ansible Contributor Summit

We are happy to announce that the registration for the Ansible Contributor Summit is open!

Why
  • This is a great opportunity for interested people to meet, discuss related topics, share their stories and opinions, get the latest important updates and just to hang out together.

  • There will be different announcements & presentations by Community, Core, Cloud, Network, and other teams.

  • Current contributors will be happy to share their stories and experience with newcomers.

  • There will be links to interactive self-passed instruqt scenarios shared during the event that help newcomers learn different aspects of development.

Where/when

Online on Matrix and Youtube. Tuesday, April 12, 2022, 12:00 - 20:00 UTC.

How to join
  • Add the event to your calendar. Use the ical URL (for example, in Google Calendar "Add other calendars" > "Import from URL") instead of importing the .ics file so that any updates to the event will be reflected in your calendar.

  • Check out the Summit page:

    • Add you name to attendees.
    • Suggest summit topics that would be interesting to you to hear about.
    • Vote on and propose changes to topics suggested by others.
    • If you want to be a presenter, please contact the Ansible Community team via [email protected].

We are looking forward to seeing you!:)

Important information for collection maintainers

SUMMARY

Dear maintainers,

This is important for your collections!

  • In accordance with the Community decision, we have created the news-for-maintainers repository for announcements of changes impacting collection maintainers (see the examples) instead of Issue 45 that will be closed soon.

    • To keep yourself well-informed and, therefore, things in your collection working, please subscribe to the repository by using the Watch button in the upper right corner on the repository's home page.
    • If you do not want to get notifications about related discussions, please subscribe only to Issues.
    • Please read the brief guidelines on how the repository should be used.
    • Please avoid unnecessary discussions in issues, use the Discussions feature. Every comment posted will notify a lot of folks!
  • Also we would like to remind you about the Bullhorn contributor newsletter which has recently started to be released weekly. To learn what it looks like, see the past releases. Please subscribe and talk to the Community via Bullhorn!

  • Join us in #ansible-social (for news reporting & chat), #ansible-community (for discussing collection & maintainer topics), and other channels on Matrix/IRC.

  • Help the Community and the Steering Committee to make right decisions by taking part in discussing and voting on the Community Topics that impact the whole project and the collections in particular. Your opinion there will be much appreciated!

Thank you!

Pause check not working, Error: Failed delete check <uuid> [HTTP 400]

SUMMARY

Trying to pause check with this task:

- name: Pause healtschecks.io check for download Feed"
  community.healthchecksio.checks:
    state: pause
    api_key: "{{ healthchecks_api_key.field.value }}"
    uuid: "{{ healthchecksio_download_feed.uuid }}"
  when: app_cron_disabled
  register: healthchecksio_download_feed_paused

Got error: Failed delete check [HTTP 400]

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION
ansible [core 2.15.5]
COLLECTION VERSION
Collection               Version
------------------------ -------
community.healthchecksio 1.3.1  

the `unique` param of `community.healthchecksio.checks` does nothing

SUMMARY

The unique param of community.healthchecksio.checks is not used AFAICT.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.healthchecksio.checks

ANSIBLE VERSION
ansible [core 2.14.1]
  config file = sanitized
  configured module search path = ['sanitized/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = sanitized/collections
  executable location = /usr/bin/ansible
  python version = 3.11.1 (main, Jan  6 2023, 00:00:00) [GCC 12.2.1 20221121 (Red Hat 12.2.1-4)] (/usr/bin/python3)
  jinja version = 3.0.3
  libyaml = True
COLLECTION VERSION
community.healthchecksio 1.2.0 
OS / ENVIRONMENT

Fedora 37

STEPS TO REPRODUCE
- name: Create rootfs backup healthcheck
  community.healthchecksio.checks:
    state: present
    api_key: "{{ healthchecksio_api_key }}"
    name: "something {{ a_var }} rootfs backup"
    unique: ["name"]
    tags: ["ansible"]
    desc: "(ansible managed)"
    # 2 days
    timeout: 172800
  register: hc_check
EXPECTED RESULTS

The module is idempotent.

ACTUAL RESULTS

The moduel is not idempotent. It is changing on every run.

healthchecks.io Pinboard

Thanks for looking at the community.healthchecksio Collection :)

So this issue is a call for potential interested parties (earlier and existing contributors to Ansible). The benefits of having a Working Group is that members of the Working Group can:

  • test, review and approve existing Issues and PRs
  • work collectively on the healthchecksio roadmap
  • provide a single-point-of-contact for interested healthchecksio contributors

Unit tests

Would be useful to have some unit tests added

Maintainers

If you are interested in helping maintain this collection, please add a comment on this issue

Diff mode for checks module

SUMMARY

It would be great if the checks module would support diffing.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

checks

ADDITIONAL INFORMATION
ansible-playbook example.yml -i hosts -b --tags healthchecks --diff

I'm currently using community.healthchecksio 1.3.0 where checks task work as expected and properly show changed indication, but calling ansible-playbook with --diff is a null-op.

Action required: Add stable-2.13 to the test matrix

Dear maintainers,

According to the Collection requirements, collections included in the ansible package MUST run the ansible-test sanity command from the latest stable ansible-core branch.

It has been recently announced via the news-for-maintainers repository that the ansible-core stable-2.13 branch is available for testing.

  • Please add the stable-2.13 branch to your test matrix in the .github/workflows directory, at least, in the sanity jobs section. Any questions, just mention me here.

  • If you have integration and/or unit tests, please consider adding the branch to the corresponding sections too.

  • If you're not subscribed to the news-for-maintainers repository, please do it to avoid CI related issues in the future.

  • If the issue is not relevant to your collection, please close it.

Thank you!

Integration tests failing (check deletion)

[testhost] testhost: checks : Verify integrations that=['result.changed', 'result.msg is defined', "result.msg == 'Check {{ uuid }} successfully deleted'"]: tests/integration/targets/checks/tasks/main.yml:58
{
    "msg": "The conditional check 'result.msg == 'Check {{ uuid }} successfully deleted'' failed. The error was: Conditional is marked as unsafe, and cannot be evaluated."
}

@mamercad The following line is problematic:

@mamercad The following line is problematic:

        # if schedule and tz, create a Cron check
         if request_params.get("schedule") and request_params.get("tz"):
             del request_params["grace"]
             del request_params["timeout"]

grace should not be removed as it can be used in cron checks. Now cron checks grace value fallback to its default, 3600.

Originally posted by @ahjohannessen in #17 (comment)

Not possible to create checks with simple schedule

SUMMARY

As schedule parameter has a default value "* * * * *", it will always be passed to healthchecks.io overriding the timeout parameter. Hence a check with simple schedule cannot be done.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

community.healthchecksio.checks

ANSIBLE VERSION
ansible [core 2.12.2]
COLLECTION VERSION
0.1.1
CONFIGURATION

OS / ENVIRONMENT
STEPS TO REPRODUCE
- name: Create a check named "test hourly"
  community.healthchecksio.checks:
    state: present
    name: "test hourly"
    unique: ["name"]
    tags: ["test", "hourly"]
    desc: "my hourly test check"
    timeout: 3600
EXPECTED RESULTS

Expected simple schedule with one hour timeout

ACTUAL RESULTS

Got chron schedule "* * * * *"


Create proper unit tests

SUMMARY

Create proper unit tests for all of the module_utils and modules.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • module_utils/test_healthchecksio.py
  • modules/test_badges_info.py
  • modules/test_checks.py
  • modules/test_checks_flips_info.py
  • modules/test_checks_info.py
  • modules/test_checks_pings_info.py
  • modules/test_ping.py
COLLECTION VERSION
Collection               Version
------------------------ -------
community.healthchecksio 0.1.0

Check mode for checks module

SUMMARY

It would be great if the checks module would support ansible check mode.

Especially returning the check's uuid, if it already exists.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

checks

ADDITIONAL INFORMATION
ansible-playbook playbook.yml -i hosts -b --diff --tags healthchecks --check

Currently, the module unconditionally returns an empty dictionary in ansible check mode:

def create(self):
if self.module.check_mode:
self.module.exit_json(changed=False, data={})

With minimal support, the UUID of the check could be returned, if it already exists.

Ideally, it would also set the changed attribute based on whether it would have to change the check.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.