Ajout option use_proxy
This commit is contained in:
parent
49d74231a5
commit
c9126681c9
26
ntfy.sh
26
ntfy.sh
@ -1,18 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Script de notification Ntfy pour Zabbix
|
# Script de notification Ntfy pour Zabbix
|
||||||
# Version 0.3
|
# Version 0.4
|
||||||
|
|
||||||
# Paramètres personnalisables
|
### Paramètres personnalisables
|
||||||
|
|
||||||
# Ntfy
|
## Ntfy
|
||||||
ntfy_user="USER"
|
ntfy_user="USER"
|
||||||
ntfy_password="PASSWORD"
|
ntfy_password="PASSWORD"
|
||||||
|
|
||||||
# Carte réseau
|
## Carte réseau
|
||||||
address_interface="172.17.17.18"
|
address_interface="172.17.17.18"
|
||||||
|
|
||||||
# Proxy
|
## Proxy
|
||||||
|
# Utiliser un proxy ; 1 = oui et 0 = non
|
||||||
|
use_proxy=0
|
||||||
# Adresse + port du proxy (1.2.3.4:1234)
|
# Adresse + port du proxy (1.2.3.4:1234)
|
||||||
proxy_address="172.17.0.1:3128"
|
proxy_address="172.17.0.1:3128"
|
||||||
proxy_user="USER"
|
proxy_user="USER"
|
||||||
@ -38,6 +40,19 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ use_proxy = 0]
|
||||||
|
then
|
||||||
|
# Ne pas utiliser de proxy
|
||||||
|
curl \
|
||||||
|
-interface $address_interface \
|
||||||
|
-u $ntfy_user:$ntfy_password \
|
||||||
|
-H "Title: $subject" \
|
||||||
|
-H "Tags: $tag" \
|
||||||
|
-d "$body" \
|
||||||
|
https://ntfy.axolito.fr/$topic
|
||||||
|
elif [ use_proxy = 1 ]
|
||||||
|
then
|
||||||
|
# Utiliser un proxy
|
||||||
curl \
|
curl \
|
||||||
-x "http://$proxy_user:$proxy_password@$proxy_address" \
|
-x "http://$proxy_user:$proxy_password@$proxy_address" \
|
||||||
-interface $address_interface \
|
-interface $address_interface \
|
||||||
@ -46,5 +61,6 @@ curl \
|
|||||||
-H "Tags: $tag" \
|
-H "Tags: $tag" \
|
||||||
-d "$body" \
|
-d "$body" \
|
||||||
https://ntfy.axolito.fr/$topic
|
https://ntfy.axolito.fr/$topic
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user