David Kirwan
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee
  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Monitoring Fedora Releng systems with Zabbix This SOP documents step by step, of what was required [14] to add Zabbix monitoring to the Fedora Releng systems. This will hopefully act as a guide which community members might follow if they wanted to help roll out Zabbix to the wider Fedora Infra systems (or help maintain going forward). Once complete this SOP will live in [3],[4]. ### Resources - 1 [Ansible Zabbix module for managing templates](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_template_module.html) - 2 [Zabbix Sender pushing metrics](https://www.zabbix.com/documentation/6.0/en/manpages/zabbix_sender) - 3 [Fedora Infra Docs](https://docs.fedoraproject.org/en-US/infra/sysadmin_guide/#_standard_operating_procedures) - 4 [Fedora Infra Docs Git Repo](https://pagure.io/infra-docs-fpo) - 5 [Zabbix Staging Server](https://zabbix.stg.fedoraproject.org) - 6 [Targetting groups for specific Ansible tasks](https://stackoverflow.com/questions/21008083/run-task-only-if-host-does-not-belong-to-a-group) - 7 [Zabbix Plugins](https://www.zabbix.com/documentation/guidelines/en/plugins) - 8 [Zabbix Scripts](https://www.zabbix.com/documentation/6.0/en/manual/web_interface/frontend_sections/administration/scripts) - 9 [Monitor running time of specific process with Zabbix](https://www.zabbix.com/forum/zabbix-help/13350-monitor-running-time-of-a-specific-process) - 10 [Zabbix proc num](https://www.zabbix.com/documentation/current/en/manual/appendix/items/proc_mem_num_notes) - 11 [Zabbix added to Releng Hosts PR](https://pagure.io/fedora-infra/ansible/pull-request/1653#) - 12 [Zabbix kvm Virtual Host template](https://www.zabbix.com/integrations/kvm) - 13 [Releng Ansible cronjob installation](https://pagure.io/fedora-infra/ansible/blob/main/f/roles/releng/tasks/main.yml) - 14 [Fedora Infra Ticket](https://pagure.io/fedora-infrastructure/issue/11577) - 15 [Failed Compose Monitoring](https://pagure.io/releng/failed-composes/issues) - 16 [Fedora Infra Releng Compose Monitoring Software](https://pagure.io/releng/compose-tracker) - 17 [Zabbix Production Server](https://zabbix.fedoraproject.org) - 18 [Zabbix ansible host group](https://docs.ansible.com/ansible/latest/collections/community/zabbix/zabbix_group_module.html) ### Releng Machine List The following machines are those which are relevant to Releng. ``` machines: [releng_compose] compose-x86-01.iad2.fedoraproject.org compose-branched01.iad2.fedoraproject.org compose-rawhide01.iad2.fedoraproject.org compose-iot01.iad2.fedoraproject.org [releng_compose_stg] compose-x86-01.stg.iad2.fedoraproject.org ``` First install the Zabbix agent on these `releng_compose:releng_compose_stg` hosts via the `zabbix/zabbix_agent` ansible role [11]. We targetted the`groups/releng-compose.yml` playbook as this is responsible for targetting these hosts. ``` diff --git a/playbooks/groups/releng-compose.yml b/playbooks/groups/releng-compose.yml index 04b68aba4f..69c0acdad3 100644 --- a/playbooks/groups/releng-compose.yml +++ b/playbooks/groups/releng-compose.yml @@ -28,6 +28,8 @@ - ipa/client - rkhunter - nagios_client + - zabbix/zabbix_agent - collectd/base - sudo - role: keytab/service ``` Run the playbook like so `sudo rbac-playbook groups/releng-compose.yml` on the `batcave01` host. Then check the Zabbix console hosts section to ensure the new hosts have been picked up by Zabbix[5][17]. To get access to the Zabbix server, your FAS user must be a member of the group `sysadmin-noc`, then run the playbook `sudo rbac-playbook groups/zabbix.yml`. Once run you can then authenticate via FAS on the Zabbix web console. ### Requirements There is no compose being run in the staging environment at all, so this is unfortunately going to be need to be implemented on the production environment only. Existing monitoring is in place to track composes fails or finishes with success, however there is currently no monitoring to track when a compose hangs. Cronjobs are installed on the releng hosts via the following ansible task[13]. There are a total of 8 cronjobs in total. - 1: ftbfs weekly cron job `"ftbfs.cron" /etc/cron.weekly/ on compose-x86-01` - 2: branched compose cron `"branched" /etc/cron.d/branched on compose-branched01.iad2` - 3: rawhide compose cron `"rawhide" etc/cron.d/rawhide on compose-rawhide01.iad2` - 4: cloud-updates compose cron `"cloud-updates" /etc/cron.d/cloud-updates on compose-x86-01.iad2` - 5: container-updates compose cron `"container-updates" /etc/cron.d/container-updates on compose-x86-01.iad2` - 6: clean-amis cron `"clean-amis.j2" /etc/cron.d/clean-amis on compose-x86-01.iad2` - 7: rawhide-iot compose cron `"rawhide-iot" /etc/cron.d/rawhide-iot on compose-iot-01.iad2` - 8: sig_policy cron `"sig_policy.j2" /etc/cron.d/sig_policy on compose-x86-01.iad2'` Need at least one Zabbix check per cronjob. The Zabbix check should do the following. - When a cronjob starts: -- create a file in `/tmp/name-of-cron-job` - When a cronjob ends: -- delete the file in `/tmp/name-of-cron-job` - If file exists, assume cron is running and if file exists for more than a set period, assume the cron job is stalled. ### Implementation - Create a custom template called `fedora releng compose cronjobs`. - Create a host group called `fedora releng compose`. - Add the ansible hosts from the group `releng_compose` in production only since we currently don't do composes in staging, to this host group. - In this template create an item, one for each cronjob. - In this template create a trigger, one for each cronjob. Initially set the trigger to alert when the item returns true for more than 1 hour. This can be changed later when we understand just how long these cron jobs run for. - Implement this template in JSON see [12] for inspiration and format examples. This template can then be placed in `roles/zabbix/zabbix_server/files/zabbix_templates/releng_compose_cronjobs.json`. - Create a task in the `roles/zabbix/zabbix_server/tasks` to make use of the zabbix_api key to create this template on the server see [1]. - Use the community Ansible role for adding this template to the releng hosts. - Update each cronjob in Ansible, to create the files such as `/tmp/name-of-cron-job` when starting, and deleting when completed. ### Create a custom template Using the zabbix ansible role `community.zabbix.zabbix_template`, create a template: ``` # Create template - name: Set API token tags: always set_fact: ansible_zabbix_auth_key: XXXXAPIKEYXXXX ansible_network_os: community.zabbix.zabbix ansible_connection: httpapi ansible_httpapi_port: 443 ansible_httpapi_use_ssl: true ansible_httpapi_validate_certs: false ansible_host: ZABBIX_SERVER_HOSTNAME ansible_zabbix_url_path: "" # If Zabbix WebUI runs on non-default zabbix path (/),e.g. http://<FQDN>/zabbix # If implementing the template in the Zabbix GUI, can export the completed template with the following two - name: Get Zabbix template as JSON community.zabbix.zabbix_template_info: template_name: fedora releng compose cronjobs format: json omit_date: yes register: zabbix_template_json - name: Write Zabbix templte to JSON file local_action: module: copy content: "{{ zabbix_template_json['template_json'] }}" dest: "roles/zabbix_server/files/zabbix_templates/releng_compose_cronjobs.json" # Import the template JSON - name: Import Zabbix templates from JSON community.zabbix.zabbix_template: template_json: "{{ lookup('file', 'files/zabbix_templates/releng_compose_cronjobs.json') }}" state: present ``` ### Create a host group ``` # Create host-group - name: Set API token tags: always set_fact: ansible_zabbix_auth_key: XXXXAPIKEYXXXX ansible_network_os: community.zabbix.zabbix ansible_connection: httpapi ansible_httpapi_port: 443 ansible_httpapi_use_ssl: true ansible_httpapi_validate_certs: false ansible_host: ZABBIX_SERVER_HOSTNAME ansible_zabbix_url_path: "" # If Zabbix WebUI runs on non-default zabbix path (/),e.g. http://<FQDN>/zabbix - name: Create host groups # set task level variables as we change ansible_connection plugin here community.zabbix.zabbix_group: state: present host_groups: - fedora releng compose ``` ### Add production releng_compose hosts to the Zabbix host group ``` - name: Set API token tags: always set_fact: ansible_zabbix_auth_key: XXXXAPIKEYXXXX ansible_network_os: community.zabbix.zabbix ansible_connection: httpapi ansible_httpapi_port: 443 ansible_httpapi_use_ssl: true ansible_httpapi_validate_certs: false ansible_host: ZABBIX_SERVER_HOSTNAME ansible_zabbix_url_path: "" # If Zabbix WebUI runs on non-default zabbix path (/),e.g. http://<FQDN>/zabbix - name: Create host groups community.zabbix.zabbix_host: host_name: "{{ item }}" host_groups: - fedora releng compose link_templates: - fedora releng compose cronjobs force: false with_items: - compose-branched01.iad2.fedoraproject.org - compose-iot01.iad2.fedoraproject.org - compose-rawhide01.iad2.fedoraproject.org - compose-x86-01.iad2.fedoraproject.org ``` ### In this template create an item, one for each cronjob - Configure the type as zabbix agent active - Configure history to 7d for 1 week - Configure the resolution to 1m to check every minute - Configure the key to match something like the following, changing the * to what ever the name of the cronjob is, eg rawhide ``` vfs.file.exists[/tmp/fedora-compose-*] ``` ### In this template create a trigger, one for each cronjob. - Configure the trigger to 1 hour initially. - Configure the severity to high - In this example the `fedora releng compose cronjobs` is the hostgroup that the hosts are members of, and have this template attached. - Configure the expression to something like the following, changing the * to what ever the name of the file in the key in the matching item ``` last(/fedora releng compose cronjobs/vfs.file.exists[/tmp/fedora-compose-*])=1 and min(/fedora releng compose cronjobs/vfs.file.exists[/tmp/fedora-compose-*],1h)>0 ``` ### Modify each cronjob in ansible - When a cronjob starts: -- create a file in `/tmp/name-of-cron-job` - When a cronjob ends: -- delete the file in `/tmp/name-of-cron-job` - If file exists, assume cron is running and if file exists for more than a set period, assume the cron job is stalled. ### Future Work Replace these custom releng monitoring things with zabbix. - https://pagure.io/releng/failed-composes/issues - https://pagure.io/releng/compose-tracker

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully