Ad Widget

Collapse

[Zabbkit] Push notifications on your smartphone

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    [Zabbkit] Push notifications on your smartphone

    Project is open source now (https://github.com/CactusSoft), support has been stopped.
    Please be careful. Regardless the service is still working and all applications are available in markets, it could be stopped any time without a notification.
    -------------------------------------


    Step 0: What are you talking about?
    Since we use Zabbix for monitoring our servers and have cool mobile client that helps us, we want to receive push-notifications to mobile devices about troubles. General solution is to make accounts in Apple/Google/Microsoft market (annually paid), receive some secrete keys create application that is able to communicate with notification cloud and call it from Zabbix. Acceptable for us. But we'd like to shere it with you.
    Thanks for CactusSoft team all that you need to have is cURL (usually you already have it on server) and to do simple configuration on your Zabbix using web interface.
    Below is step-by-step instruction that we applied on our Zabbix, but the system is quite flexible and you can make your own configuration.

    Step 1: Get your ID
    Get unique ID from Zabbkit application. Go to Notifications screen and get it.

    It will be used to identify you device. Like a phone number, but used for notifications

    Step 2: Create bash script
    Create bash script that will send notifications. Let's call it "zabbkit-push":
    Simple one
    Code:
    #!/bin/bash
    curl -X POST\
     -H "Content-type:application/json"\
     -d "{Id:'$1', text:'$2', triggerId:'$3', playSound:true}"\
     http://zabbkit.inside.cactussoft.biz/api/messages
    Advanced variant with logging, thanks to wolf_ktl
    Code:
    #!/bin/bash
    STRING=`curl -X POST\
    -H "Content-type:application/json"\
    -d "{Id:'$1', text:'$2', triggerId:'$3', playSound:true}"\
    http://zabbkit.inside.cactussoft.biz/api/messages`
    
    echo $(date +"%y-%m-%d %T"),$1,$STRING,$2,$3 >> /var/log/zabbix/push_zabbkit.log
    Put it to your Zabbix alertscript folder. On our server it's /usr/local/share/zabbix/alertscripts
    Don't forget to make it executable.

    Step 3: Check that script works properly
    Close Zabbkit app on device before sending notification. Then just run our script, like this:
    Code:
    ./zabbkit-push YOUR-ID-FROM-STEP-1 "test message" 0
    wait for a few seconds and ensure that notification appears on device.
    Troubleshooting:
    - Ensure that your device have internet connection
    - Ensure that you exit from Zabbkit app on your devise. Some platforms don't show the notification if app is run.
    - Check that script didn't return any errors. Correct reply looks like
    Code:
    {"trackingId":"520271616cc4b20b642bcdcd"}
    - Check the message status using tracking id. The id is similar to postal tracking id for a package. Go to http://zabbkit.inside.cactussoft.biz, type you ID and press check. If it says "Delivered", that means the message is successfully delivered to Apple/Google/Microsoft cloud.
    Last edited by yan; 21-04-2017, 12:16. Reason: stop supporting warning

    #2
    Step 4: Configure you Zabbix
    Now let's teach our Zabbix to call our script apropriately.
    Create mediatype

    Create action and specify params that will be passed to script


    Finally join zabbix user with mediatype using the user's device-specified id:

    Comment


      #3
      Awesome tool
      thanks a lot for that.
      One thing I noticed though is that I needed to add a shell for the Zabbix user, not sure why...
      in /etc/passwd:
      zabbix:x:108:115::/var/run/zabbix/:/bin/bash


      Otherwise, the script doesn't seem to work

      Comment


        #4
        I just downloaded it on my iphone. When I run zabbix at the first time, the screen shows up username and password. I did not see "your ID". Could you show me where I could see it?

        Comment


          #5
          Originally posted by maytinh View Post
          I just downloaded it on my iphone. When I run zabbix at the first time, the screen shows up username and password. I did not see "your ID". Could you show me where I could see it?
          You need to login to your Zabbix first. When you logged in, Notification screen is available using the slide panel at the left.

          Comment


            #6
            Originally posted by Razique View Post
            One thing I noticed though is that I needed to add a shell for the Zabbix user, not sure why...
            in /etc/passwd:
            zabbix:x:108:115::/var/run/zabbix/:/bin/bash

            Otherwise, the script doesn't seem to work
            Thank you for reply. I don't know why but I didn't do anything extra on our server .
            Anyway, the script is very simple, it just sends JSON packet over HTTP POST. So you always can use your own way to send it, we use cURL because we are familiar with it, but I believe there's wide range of other ways.
            Also the script is not perfert. It will fail if your message contains " or ', because " is used by bash and ' is used by JSON in the script. The right way is to make some pre-processing of $2 before using, but we are to lazy to do that . If the community uses the system, then somebody will solve the issue or propose a better way.

            Comment


              #7
              some statistics

              During the last month our server passed over 17000 notifications to your devices. For about 10% of them we didn't receive delivery confirmation from Apple/Google/MS clouds.
              We use the system internally and didn't feel that any notifications are lost.
              Did anyone feel it?
              Last edited by yan; 06-09-2013, 08:58. Reason: Grammar correction

              Comment


                #8
                Originally posted by yan View Post
                During the last month our server passed over 17000 notifications to your devices. For about 10% of them we didn't receive delivery confirmation from Apple/Google/MS clouds.
                We use the system internally and didn't fill that any notifications are lost.
                Did anyone feel it?
                Notifications seem reliable. By the way I love the app thank you so much for bringing it to Windows Phone! The only question I have is when ever there trigger it shows push notification action twice. It is some what hard to explain so I will post a screen shot. I am just curious if it is normal.
                Attached Files

                Comment


                  #9
                  Originally posted by kdawg89 View Post
                  Notifications seem reliable. By the way I love the app thank you so much for bringing it to Windows Phone! The only question I have is when ever there trigger it shows push notification action twice. It is some what hard to explain so I will post a screen shot. I am just curious if it is normal.
                  Thanks for feedback, we appreciate it! Regarding you question. Check your actions configuration. Maybe some of them have "All" value in field "Send only to". If so, the action sends alert using all accessible media-types including push and you receive two notifications from two different Actions but about the same event.

                  Comment


                    #10
                    Multiple notification

                    Hello,

                    at first a great solution. We notice that it don´t send multipel notification if there are multipel problems on the same host.

                    e.g.

                    Host1: got a problem. message get send.
                    Host1: have the same problem again get send.
                    but only the latest is visible.

                    is there a way to get all Notifications? Even from the same Host and Problem?

                    Thanks a lot

                    Comment


                      #11
                      Originally posted by Sententiosus View Post
                      Host1: got a problem. message get send.
                      Host1: have the same problem again get send.
                      but only the latest is visible.

                      is there a way to get all Notifications? Even from the same Host and Problem?
                      What platform do you use? Currently Android app joins messages with the same triggerId and shows only the last one of them. Looks like it's your case.

                      We did it in order to remove "historical rubbish" from notification area. Isn't convenient?

                      Comment


                        #12
                        triggerId with more than 10 digits

                        Hello,

                        we are having an issue with zabbkit notification. If we set the variable {TRIGGER.ID} in the action definition, we are getting no notification.

                        I discoverd that our zabbix generates triggerIds with more than 10 digits. triggerIds with =< 10 digits are working. We are using Zabbix 2.2.1 on Debian.

                        Many thanks in advanced.

                        Comment


                          #13
                          Originally posted by GSrg View Post
                          Hello,

                          we are having an issue with zabbkit notification. If we set the variable {TRIGGER.ID} in the action definition, we are getting no notification.

                          I discoverd that our zabbix generates triggerIds with more than 10 digits. triggerIds with =< 10 digits are working. We are using Zabbix 2.2.1 on Debian.

                          Many thanks in advanced.
                          Fixed! Thank you for letting us know!

                          Comment


                            #14
                            Hello, i got a problem. With android everything works just fine! I get "deliverd" on the site: "http://zabbkit.inside.cactussoft.biz". But now im on iOS and i get "processing". It never change to "deliverd" and i cant figure out what i did wrong?? Can somebody help me please!??

                            Comment


                              #15
                              Originally posted by kennethtims View Post
                              Hello, i got a problem. With android everything works just fine! I get "deliverd" on the site: "http://zabbkit.inside.cactussoft.biz". But now im on iOS and i get "processing". It never change to "deliverd" and i cant figure out what i did wrong?? Can somebody help me please!??
                              Could you give me one of your tracking id that is in processing state?

                              Comment

                              Working...
                              X