How to send notifications with ZBXalert

1. Register a sender account

Registering an account can easily be made over the API. To register just send the following request containing your own data with any desired tool via HTTP Post to https://api.zbxalert.com/v1/user

  1. {
  2. "email": "demo@zbxalert.com",
  3. "firstname": "First name",
  4. "lastname": "Last name",
  5. "password": "1SecurePassword!"
  6. }

The answer you will receive if you registration was successful contains the status of the request as well as your AccountID and your API token:

  1. {
  2. "status": "ok",
  3. "statusDetail": "User successfully created",
  4. "requestId": "2b1a6bf0-465b-11e8-a691-55a1dd521900",
  5. "user": {
  6. "email": "demo@zbxalert.com",
  7. "firstname": "First name",
  8. "lastname": "Last name",
  9. "accountId": "21342c36-337a-5699-a1z3-483dd4fj763c",
  10. "token": "kytffZ4patSkaGgSkmylf1BnHAkSKP2cDsauvrSA6Oad1dR1WEcwpVFPXJ8rgOOI7TXvjAeW7NrHFZ61cfDe1MI5y9TtBAHCJl5EkA4Mc1d6GbsuXrEdDrcUqJolABd2"
  11. }
  12. }
Device

2. Confirm email address

A validation mail has been sent to the registered email address. With opening the included link the email address is confirmed.

3. Find AccountIDs of the receiver(s)

To be able to send a notification/alert to a recipient you need his AccountID. The AccountID can be found within the App under settings-recipient information and has to be communicated to the sender.
The public key of the recipient can also be found here. This public key is necessary for some encryption tools.

4. Send notifications

The sending of the notifications/alerts is also operated over the API. To send a notification/alert a HTTP Post Request has to be sent to https://api.zbxalert.com/v1/message In this request you will have to replace the containing data with your data as follows:

Header: X-API-KEY

  1. {
  2. "senderToken": "2KvcX7yfpQfrH8HUvKJVox5ZcCrcCaO5gIV63u9x7EYA4pAu7jyCqRAA4QEIIWjn",
  3. "recipient": "52ababa5-9ca9-4a0a-8db7-b0de5ea960be",
  4. "identifier": "km1",
  5. "eventid": 20006,
  6. "status": 1,
  7. "severity": 2,
  8. "title": "Free disk space is less than 15% on volume /srv",
  9. "text": "Item values:\n\n1. Free disk space on /srv (percentage) (grey031 (Customer 12):vfs.fs.size[/export,pfree]): 2.75 %\n\n2. Free disk space on /export (percentage) (grey031 (Customer 12):vfs.fs.size[/export,pfree]): 2.75 %\n\n3. *UNKNOWN* (*UNKNOWN*:*UNKNOWN*): *UNKNOWN*\n\nTrigger Description:\nThe free disk space for this volume is lower than 3% for at least 10 minutes.",
  10. "hostname": "grey031",
  11. "hostgroup": "webserver",
  12. "hosttype": "linux"
  13. }

The answer you will receive contains the status of the request as well as the ID of the outgoing message:

  1. {
  2. "status": "ok",
  3. "statusDetail": "Message successfully sent",
  4. "requestId": "90db711a-4fb7-11e8-814a-39667866b640",
  5. "messageId": "-LBfxwhKDXm0gYij29Jy"
  6. }

Definition of parameters

# Parameter Definition Required
1 senderToken API token of the sender. Shown while registering the user yes
2 recipient AccountID of the receiver yes
3 identifier A kind of instanceID of the sender. With this parameter an EventID can be assigned to an instance. Required for more than one monitoring system, for example, that sent from one and the same sender account yes
4 eventid Unique ID of the event from the monitoring system yes
5 status Status of the event. 0= ok; 1 = problem yes
6 severity Classification of events: 0=not classified; 1=information, 2=warning; 3=average; 4=high; 5=disaster yes
7 title Title of the event yes
8 text Notification text of the event yes
9 hostname Hostname of the triggered system for this event yes
10 hostgroup Host group of the triggered system for this event yes
11 hosttype Hosttype of the triggered system. For example Linux, Windows or MacOS yes