Ad Widget

Collapse

Howto - WhatsApp Zabbix notifications with Mudslide

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • ahmedk
    replied
    markfree i generate the QR code in zabbix server , but when i try to connect the QR code with my device via whatsapp always i have an error message (could not connect)

    Leave a comment:


  • markfree
    commented on 's reply
    What do you mean @ahmek?

  • ahmedk
    commented on 's reply
    Je peux pas scanner le QR code généré dans Zabbix, il me renvoie toujours une erreur.

  • markfree
    replied
    Check out this media type for Go WhatsApp gateway.

    Leave a comment:


  • johnbeece@gmail.com
    replied
    Team,

    Thanks for the above post.

    But recently I am facing a problem to send Zabbix WhatsApp alert to WhatsApp group using group id. It says "No session". Seems to be its blocked by WhatsApp.

    Any other solution will be helpful.

    /snapshot/dist-ncc/index.js:139006
    throw new errors.SessionError("No sessions");
    ^
    SessionError: No sessions
    at Object.200712462020669.53 [as awaitable] (/snapshot/dist-ncc/index.js:139006:23)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async _asyncQueueExecutor (/snapshot/dist-ncc/index.js:138707:29)

    Leave a comment:


  • inqwaynej
    replied
    Originally posted by mandud
    Hi inqwaynej

    Actually at this time, I also looking for best way to send alert from Zabbix into whatsapp
    some youtobe videos seems good, but need to fulfill the requirement, like use their whatsapp API / webhook

    This video share how to send zabbix chart to whatsapp group
    Code:
    https://www.youtube.com/watch?v=CH67ePM1NJA
    I'm still stuck how to replicate it using another whatsapp API gateway, the one I've tried using WAHA
    Code:
    https://waha.devlike.pro
    Another Whatsapp API Gateway using this one
    Code:
    https://github.com/aldinokemal/go-whatsapp-web-multidevice
    Script in zabbix alertscripts

    Code:
    cat alert_zabbix.sh
    URL="http://whatsapp-api:3000/send/message"
    PHONE="phone number"
    TITLE="$2"
    MESSAGE="$TITLE$3"
    
    curl --location --request POST "$URL" \
    --header 'Content-Type: application/json' \
    --data-raw "{
    \"phone\": \"${PHONE}\",
    \"message\": \"${MESSAGE}\"
    }"
    Glad If somebody have better way to sending zabbix alert into whatsapp

    Thanks
    I expect the API is more stable, but you'd need to pay for that. Mudslide does logout from time to time and needs to be re-linked to the account.

    Mudslide can send messages to groups. You just need to find the group id. You can see which groups (with the group id) the account is a member of with "mudslide groups"

    For charts, Mudslide can send images and attachments. There are example on the Github readme https://github.com/robvanderleek/mud...-an-image-file

    Leave a comment:


  • inqwaynej
    replied
    Originally posted by vpalmar
    Good day,

    Please add to point 5, "Add media type to Zabbix":

    Script parameters: {ALERT.SENDTO}
    Script parameters: {ALERT.MESSAGE}

    Thank you very much for the information.

    Greetings

    Victor Palmar
    Thanks for pointing that out Victor, can't figure out how to edit the original post though.

    Leave a comment:


  • mandud
    replied
    Hi inqwaynej

    Actually at this time, I also looking for best way to send alert from Zabbix into whatsapp
    some youtobe videos seems good, but need to fulfill the requirement, like use their whatsapp API / webhook

    This video share how to send zabbix chart to whatsapp group
    Code:
    https://www.youtube.com/watch?v=CH67ePM1NJA
    I'm still stuck how to replicate it using another whatsapp API gateway, the one I've tried using WAHA
    Code:
    https://waha.devlike.pro
    Another Whatsapp API Gateway using this one
    Code:
    https://github.com/aldinokemal/go-whatsapp-web-multidevice
    Script in zabbix alertscripts

    Code:
    cat alert_zabbix.sh
    URL="http://whatsapp-api:3000/send/message"
    PHONE="phone number"
    TITLE="$2"
    MESSAGE="$TITLE$3"
    
    curl --location --request POST "$URL" \
         --header 'Content-Type: application/json' \
         --data-raw "{
            \"phone\": \"${PHONE}\",
            \"message\": \"${MESSAGE}\"
         }"
    Glad If somebody have better way to sending zabbix alert into whatsapp

    Thanks

    Leave a comment:


  • vpalmar
    replied
    Good day,

    Please add to point 5, "Add media type to Zabbix":

    Script parameters: {ALERT.SENDTO}
    Script parameters: {ALERT.MESSAGE}

    Thank you very much for the information.

    Greetings

    Victor Palmar

    Leave a comment:


  • Howto - WhatsApp Zabbix notifications with Mudslide

    First post from a long time Zabbix user.

    I've been looking for a while for a way to send Zabbix notifications from WhatsApp. I struggled to find a simple solution that still worked on Debian 11. I eventually stumbled on a project called Mudslide. I was initially put off by the need for docker/NPM, which I'm not familiar with, but I found pre-compiled binaries which I was able to use. I thought I'd share some notes for anyone who may be interested. Below are my notes using Mudslide with Zabbix 6.4 on Debian 11.

    1. Download the pre-compiled binary for mudslide
    From https://github.com/robvanderleek/mud...tform-binaries
    Code:
    wget https://github.com/robvanderleek/mudslide/releases/download/0.25.1/mudslide-linuxstatic-x64
    2. Make executable and move to /usr/local/bin
    Code:
    chmod +x mudslide-linuxstatic-x64
    mv mudslide-linuxstatic-x64 /usr/local/bin/mudslide
    3. Create alert script.
    Our alert script is more complex in order to filter out some notifications. The script hasn't been tested, but it should work.
    Code:
    vi /usr/lib/zabbix/alertscripts/whatsapp
    Code:
    #!/bin/bash
    mudslide -c /tmp/mudslide-cache send $1 "$2"
    Code:
    chmod +x /usr/lib/zabbix/alertscripts/whatsapp
    4. Login to WhatsApp
    Command below displays a QR code to login as a linked device.
    Code:
    sudo -u zabbix mudslide -c /tmp/mudslide-cache login
    5. Add media type to Zabbix
    Add media type to Zabbix from the WebUI. Alerts > Media types. I cloned the SMS media type and changed the following:
    Code:
    Name:         WhatsApp
    Type:         Script
    Script name:  whatsapp
    6. Adding media to users
    Use the full number with country code for "Send to" when adding media for a user. No preceding 0's or "+". e.g. 442079460000 (UK), 12065550100 (US)
    Messages can also be sent to groups. Use the group ID in "Send to". Group IDs can be found from CLI with:
    Code:
    sudo -u zabbix mudslide -c /tmp/mudslide-cache groups
    This will fetch the groups the account is currently a member of.

    Note on the cache folder:
    The Zabbix user on our system does not have a home folder, so we use /tmp/mudslide-cache for the cache folder. The cache contains login information. /tmp is cleared on reboot so you'll need to login on each reboot or change the cache folder. The cache folder does need to be writeable by the Zabbix user. I work around this I sync the folder to another location with cron:
    Code:
    vi /usr/local/bin/mudslide-cache-sync.sh
    Code:
    #!/bin/bash
    # This script syncs the mudslide cache from /tmp to /var/cache. This is to work around the cache being cleared every time the server is rebooted.
    # First rsync files from the backup to the cache. "-u" prevents overwriting newer files. This will also recreate the folder if it has been removed.
    rsync -quazvh --copy-as=zabbix:zabbix /var/cache/mudslide/* /tmp/mudslide-cache/
    # Then sync any updated files from the cache to the back-up.
    rsync -qazvh /tmp/mudslide-cache/* /var/cache/mudslide/
    ​
    Code:
    chmod +x /usr/local/bin/mudslide-cache-sync.sh
    cd /etc/cron.hourly
    ln -s /usr/local/bin/mudslide-cache-sync.sh mudslide-cache-sync
    ​Hope this has been useful.
Working...