Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zabbix SMS #5

Open
empangilinan opened this issue Dec 1, 2022 · 54 comments
Open

Zabbix SMS #5

empangilinan opened this issue Dec 1, 2022 · 54 comments

Comments

@empangilinan
Copy link

empangilinan commented Dec 1, 2022

The sms were able to sent. However, we are receiving a multiple SMSES. For example the alert is only 1. Problem started(Operation) and Problem Resolved (Recovery). When the SMS sent. we got about 9 Problem Started and 9 Problem Resolved. Something like that.

What do you think is the issue? or should i use twilio-alert.sh instead of twilio-alert-escalate.sh? Thanks!

Here is the media types
image

image

@ericallenpaul
Copy link
Owner

ericallenpaul commented Dec 1, 2022 via email

@empangilinan
Copy link
Author

Hello, thanks for replying me. Where can i see the action log on zabbix server? Thanks!

@ericallenpaul
Copy link
Owner

ericallenpaul commented Dec 2, 2022 via email

@empangilinan
Copy link
Author

Do i need to put a phone number also on Users - Media?

image

@empangilinan
Copy link
Author

i think i got the issue now. however, is it possible to send to multiple different phone number?

@ericallenpaul
Copy link
Owner

ericallenpaul commented Dec 2, 2022 via email

@empangilinan
Copy link
Author

How to alter the script?

@empangilinan
Copy link
Author

Do you any sample for multiple phone numbers please?

@empangilinan
Copy link
Author

One more thing, even though the action log was sent. The SMS didn't receive.

Uploading image.png…

@empangilinan
Copy link
Author

Here is the version of my zabbix

root@zabbix alertscripts]# zabbix_server --version
zabbix_server (Zabbix) 4.4.6
Revision 8cc702429d 21 February 2020, compilation time: Feb 21 2020 09:32:24

Copyright (C) 2020 Zabbix SIA
License GPLv2+: GNU GPL version 2 or later http://gnu.org/licenses/gpl.html.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.

This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (http://www.openssl.org/).

Compiled with OpenSSL 1.0.1e-fips 11 Feb 2013
Running with OpenSSL 1.0.1e-fips 11 Feb 2013

@empangilinan
Copy link
Author

image
Here is the few Audit logs from zabbix, do you see any issues?

@empangilinan
Copy link
Author

Also, is it ok to use the twilio messaging sid on CALLERID = "messaging sid"? Thank you

@ericallenpaul
Copy link
Owner

From the audit log it looks like Zabbix is being triggered twice

@ericallenpaul
Copy link
Owner

The sms were able to sent. However, we are receiving a multiple SMSES. For example the alert is only 1. Problem started(Operation) and Problem Resolved (Recovery). When the SMS sent. we got about 9 Problem Started and 9 Problem Resolved. Something like that.

What do you think is the issue? or should i use twilio-alert.sh instead of twilio-alert-escalate.sh? Thanks!

Here is the media types image

image

I woukld remove the "send to group" and just make it focus on sending the twillio message.

@ericallenpaul
Copy link
Owner

ericallenpaul commented Dec 3, 2022 via email

@ericallenpaul
Copy link
Owner

ericallenpaul commented Dec 3, 2022 via email

@empangilinan
Copy link
Author

Hello,
i think your sample is same with my script.
here is my current config.

-rwxr-xr-x 1 zabbix zabbix 1.1K Dec 3 04:44 twilio-alert.sh
[root@zabbix alertscripts]# more twilio-alert.sh
#!/bin/bash

#get the current weeknumber
weeknumber=date +%V

function usage
{
if [ -n "$1" ]; then echo $1; fi
echo "Usage: twilio-alert.sh [-v] [-c configfile]"
exit 1
}

set to verbose by default

VERBOSE=0

get the current script directory

DIRECTORY=$(cd dirname $0 && pwd)

create a path to the default config file

CONFIGFILE="$DIRECTORY/twilio-alert.conf"

create a schedule path

PHONEFILE="$DIRECTORY/Schedule/${weeknumber}"

check the command line options

while getopts ":c:v" opt; do
case "$opt" in
c) CONFIGFILE=$OPTARG ;;
v) VERBOSE=1 ;;
*) echo "Unknown param: $opt"; usage ;;
esac
done

test configfile

if [ -n "$CONFIGFILE" -a ! -f "$CONFIGFILE" ]; then echo "Configfile not found: $CONFIGFILE"; usage; fi

source configfile

if [ "$VERBOSE" -eq 1 ]; then echo "Reading twilio-alert.conf..."; fi
if [ -n "$CONFIGFILE" ]; then . "$CONFIGFILE"; fi

get the phone number

if [ "$UseWeeklySchedule" -eq 1 ];
then
PHONENUMBER=$(cat $PHONEFILE)
else
PHONENUMBER="$OnCallNumber"
fi

echo "$1" | $DIRECTORY/twilio-sms.sh -c $DIRECTORY/twilio-sms.conf "+1st_phone_number" && echo "$1" | $DIRECTORY/twilio-sms.sh -c $DIRECTORY/twilio-sms.conf "+2nd_phone_number"
echo ok

[root@zabbix alertscripts]#

@empangilinan
Copy link
Author

What if i create a multiple media type? and the attached script is different number?

@empangilinan
Copy link
Author

Okay, i've created multiple media type but 1 action only. since, the current action is setup to all media. but whenever we have a new alerts, we were able to received email alerts, but not the SMS, even though on the action log was sent to SMSes as well.
image

2 scripts that attached to media types
image

@empangilinan
Copy link
Author

My 2 scripts on Media types. whenever i tried to test it. they are sending SMSs
image

@empangilinan
Copy link
Author

One more thing. how can we filter only critical alerts on SMS? is it thru media type?

here is my curent script parameters. We are receiving all alerts.

image

@ericallenpaul
Copy link
Owner

ericallenpaul commented Jan 3, 2023 via email

@empangilinan
Copy link
Author

empangilinan commented Jan 3, 2023

How about this

Administration - Users - Media

There are filtering on the severity whenever the SMS sent to these number

image

@ericallenpaul
Copy link
Owner

ericallenpaul commented Jan 3, 2023 via email

@empangilinan
Copy link
Author

Thanks!

what is the meaning of this error? when i tried to do the manual testing on server.

[root@zabbix alertscripts]# echo "TEST_along_baquiran" | /usr/lib/zabbix/alertscripts/twilio-sms.sh -c /usr/lib/zabbix/alertscripts/twilio-sms.conf twilio-alert.sh
Sending SMS to twilio-alert.sh from MG9add5b8a5eb1661d95837597bc95c0ca...ok

image

@ericallenpaul
Copy link
Owner

ericallenpaul commented Jan 5, 2023 via email

@Epangilinangt
Copy link

Hello @ericallenpaul - i am receiving this error , is this something from your config/package, or this should be check on twilio account? Thanks!

curl: (22) The requested URL returned error: 410 Gone
curl: (22) The requested URL returned error: 410 Gone
curl: (22) The requested URL returned error: 410 Gone
curl: (22) The requested URL returned error: 410 Gone
curl: (22) The requested URL returned error: 410 Gone
curl: (22) The requested URL returned error: 410 Gone

@keithlammers
Copy link
Contributor

@Epangilinangt: If you haven't updated the script lately, grab the latest version. Twilio's endpoint URL changed a while back. See this pull request for details: #7

@Epangilinangt
Copy link

Thanks! it's working now. but it is sending through Viber apps, is there a way to send it via SMS? Thanks @keithlammers @ericallenpaul

@keithlammers
Copy link
Contributor

No idea why that would be happening, mine come via SMS. Maybe your Viber app is setup to act as the default SMS client on the phone?

@Epangilinangt
Copy link

Hello @ericallenpaul @keithlammers received this error again upon checking, just wanted to know if there is a recent changes on this repo/package? Thanks

Errorcode

image

TEST0outbound-apiTue, 24 Oct 2023 01:22:01 +0000/2010-04-01/Accounts/ACfd5c9815a45dbd660377d45abdd9d6c1/Messages/SM16a257c49b6e5b14278eb98bbfaff43cACfd5c9815a45dbd660377d45abdd9d6c10+639609146389Tue, 24 Oct 2023 01:22:01 +0000acceptedSM16a257c49b6e5b14278eb98bbfaff43cMG9add5b8a5eb1661d95837597bc95c0ca2010-04-01/2010-04-01/Accounts/ACfd5c9815a45dbd660377d45abdd9d6c1/Messages/SM16a257c49b6e5b14278eb98bbfaff43c/Media

@Epangilinangt
Copy link

or should i check my twilio account?

@Epangilinangt
Copy link

Hello @ericallenpaul @keithlammers - i been receiving this errors during my testing. any idea? Thanks

image

rection>Tue, 09 Jan 2024 10:42:37 +0000/2010-04-01/Accounts/ACfd5c9815a45dbd660377d45abdd9d6c1/Messages/SM6b5dbe65203fd680ed0a3d67b8193f50ACfd5c9815a45dbd660377d45abdd9d6c10+639086217742Tue, 09 Jan 2024 10:42:37 +0000acceptedSM6b5dbe65203fd680ed0a3d67b8193f50MG9add5b8a5eb1661d95837597bc95c0ca2010-04-01/2010-04-01/Accounts/ACfd5c9815a45dbd660377d45abdd9d6c1/Messages/SM6b5dbe65203fd680ed0a3d67b8193f50/Media
curl: (22) The requested URL returned error: 401
curl: (22) The requested URL returned error: 401
curl: (22) The requested URL returned error: 401
curl: (22) The requested URL returned error: 401
curl: (22) The requested URL returned error: 401
[root@zabbix alertscripts]#

image

@ericallenpaul
Copy link
Owner

ericallenpaul commented Jan 24, 2024 via email

@empangilinan
Copy link
Author

empangilinan commented Jan 24, 2024 via email

@Epangilinangt
Copy link

Any thought here sir? Thanks

@Epangilinangt
Copy link

@ericallenpaul

@ericallenpaul
Copy link
Owner

ericallenpaul commented Jan 25, 2024 via email

@Epangilinangt
Copy link

Epangilinangt commented Jan 25, 2024 via email

@ericallenpaul
Copy link
Owner

ericallenpaul commented Jan 25, 2024 via email

@Epangilinangt
Copy link

Epangilinangt commented Jan 25, 2024 via email

@ericallenpaul
Copy link
Owner

ericallenpaul commented Jan 25, 2024 via email

@Epangilinangt
Copy link

Epangilinangt commented Jan 25, 2024 via email

@ericallenpaul
Copy link
Owner

ericallenpaul commented Jan 25, 2024 via email

@Epangilinangt
Copy link

Epangilinangt commented Jan 25, 2024 via email

@keithlammers
Copy link
Contributor

This script is still working for me as of today, so my guess would be that you've got an auth error with Twilio.

@ericallenpaul
Copy link
Owner

ericallenpaul commented Jan 25, 2024 via email

@Epangilinangt
Copy link

Hello @keithlammers , thanks for confirming. Probably i have an issue on my twilio account. The configuration still same on your side? no changes done? Thanks!

@keithlammers
Copy link
Contributor

That's correct, haven't changed anything on my end since this change back in May last year: #7

If you've had your script setup since before May 2023, you should grab the latest version.

@Epangilinangt
Copy link

Epangilinangt commented Jan 25, 2024 via email

@empangilinan
Copy link
Author

empangilinan commented Jan 25, 2024 via email

@keithlammers
Copy link
Contributor

Yeah that's correct, the only thing changed in May 2023 was the endpoint URL so if you've got that latest URL, then it must be something on Twilio's end. Unfortunately I don't have the capacity to troubleshoot it further than that, sorry!

@Epangilinangt
Copy link

Thank you @ericallenpaul and @keithlammers . I will check my twilio account and update here. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants