Temat: SMS/mail przy przełączeniu na zapasowy wan?

Mam prośbę, poszukuję skryptu, który będzie wysyłał smsa (ewentualnie maila) na wskazany numer telefonu przy przełączeniu internetu z sieci podstawowej (interfejs wan)na sieć zapasową (interfejs wan2) znacie może coś takiego?
Dodam, że używam dodatku simplefailover (działa prawidłowo) mam także poprawnie skonfigurowany dodatek 3ginfo wraz z obsługą SMSów w jaki sposób można automatycznie wykonać wysłanie smsa przy przełączeniu na zapasowy interfejs wan2?

2

Odp: SMS/mail przy przełączeniu na zapasowy wan?

Zmodyfikuj skrypt simplefailover - w tej chwili zapisuje sobie to do logów, zamiast tego dodaj wysyłanie smsa.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

3

Odp: SMS/mail przy przełączeniu na zapasowy wan?

Nie znam się ale spróbuję zapytać wink Czy tak byłoby dobrze?

                if [ "$WAN" = "1" ]; then
                        WAN=2
                        ifup $WAN2
                        route add -host $HOST gateway $GATEWAY $IFNAME
                        echo "Przelaczono na zapasowe lacze" | gnokii --sendsms +48XXXXXXXXX
                fi

4

Odp: SMS/mail przy przełączeniu na zapasowy wan?

Coś takiego, tak.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

5 (edytowany przez tenobcy 2015-04-12 10:47:58)

Odp: SMS/mail przy przełączeniu na zapasowy wan?

Ok sprawdzam, dzięki smile
Cezary potwierdzam, działa smile

6 (edytowany przez tenobcy 2015-10-18 16:45:16)

Odp: SMS/mail przy przełączeniu na zapasowy wan?

Odświeżę trochę temat wszystko działa prawidłowo ale simplefailover podczas przełączania sieci dwa razy wysyła smsa w logread jest zapis:

Sun Oct 18 17:33:36 2015 daemon.notice netifd: Interface 'wan2' is setting up now
Sun Oct 18 17:33:36 2015 user.notice /usr/bin/simplefailover: Changing connection to backup wan: wan2
Sun Oct 18 17:33:38 2015 daemon.notice pppd[3247]: pppd 2.4.7 started by root, uid 0
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: abort on (BUSY)
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: abort on (NO CARRIER)
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: abort on (ERROR)
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: report (CONNECT)
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: timeout set to 10 seconds
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: send (AT&F^M)
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: expect (OK)
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: ^M
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: Manufacturer: huawei^M
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: Model: E3131^M
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: Revision: 21.157.11.00.264^M
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: IMEI: 862732011674160^M
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: +GCAP: +CGSM,+DS,+ES^M
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: ^M
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: OK
Sun Oct 18 17:33:39 2015 local2.info chat[3267]:  -- got it
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: send (ATE1^M)
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: expect (OK)
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: ^M
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: AT&F^M^M
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: OK
Sun Oct 18 17:33:39 2015 local2.info chat[3267]:  -- got it
Sun Oct 18 17:33:39 2015 local2.info chat[3267]: send (AT+CGDCONT=1,"IP","internet"^M)
Sun Oct 18 17:33:40 2015 local2.info chat[3267]: timeout set to 30 seconds
Sun Oct 18 17:33:40 2015 local2.info chat[3267]: expect (OK)
Sun Oct 18 17:33:40 2015 local2.info chat[3267]: ^M
Sun Oct 18 17:33:40 2015 local2.info chat[3267]: ATE1^M^M
Sun Oct 18 17:33:40 2015 local2.info chat[3267]: OK
Sun Oct 18 17:33:40 2015 local2.info chat[3267]:  -- got it
Sun Oct 18 17:33:40 2015 local2.info chat[3267]: send (ATD*99***1#^M)
Sun Oct 18 17:33:40 2015 local2.info chat[3267]: expect (CONNECT)
Sun Oct 18 17:33:40 2015 local2.info chat[3267]: ^M
Sun Oct 18 17:33:40 2015 local2.info chat[3267]: AT+CGDCONT=1,"IP","internet"^M^M
Sun Oct 18 17:33:40 2015 local2.info chat[3267]: OK^M
Sun Oct 18 17:33:40 2015 local2.info chat[3267]: ATD*99***1#^M^M
Sun Oct 18 17:33:40 2015 local2.info chat[3267]: CONNECT
Sun Oct 18 17:33:40 2015 local2.info chat[3267]:  -- got it
Sun Oct 18 17:33:40 2015 local2.info chat[3267]: send ( ^M)
Sun Oct 18 17:33:40 2015 daemon.info pppd[3247]: Serial connection established.
Sun Oct 18 17:33:40 2015 daemon.info pppd[3247]: Using interface 3g-wan2
Sun Oct 18 17:33:40 2015 daemon.notice pppd[3247]: Connect: 3g-wan2 <--> /dev/ttyUSB0
Sun Oct 18 17:33:40 2015 kern.info kernel: [  127.480000] 3g-wan2: renamed from ppp0
Sun Oct 18 17:33:41 2015 daemon.info pppd[3247]: Terminating on signal 15
Sun Oct 18 17:33:41 2015 daemon.notice pppd[3247]: Connection terminated.
Sun Oct 18 17:33:41 2015 user.notice /usr/bin/simplefailover: Changing connection to backup wan: wan2
Sun Oct 18 17:33:42 2015 daemon.info pppd[3247]: Exit.
Sun Oct 18 17:33:42 2015 daemon.notice netifd: Interface 'wan2' is now down
Sun Oct 18 17:33:42 2015 daemon.notice netifd: Interface 'wan2' is setting up now
Sun Oct 18 17:33:42 2015 authpriv.notice dropbear[3181]: Password auth succeeded for 'root' from 192.168.1.241:51602
Sun Oct 18 17:33:44 2015 daemon.notice pppd[3477]: pppd 2.4.7 started by root, uid 0
Sun Oct 18 17:33:45 2015 local2.info chat[3486]: abort on (BUSY)
Sun Oct 18 17:33:45 2015 local2.info chat[3486]: abort on (NO CARRIER)
Sun Oct 18 17:33:45 2015 local2.info chat[3486]: abort on (ERROR)
Sun Oct 18 17:33:45 2015 local2.info chat[3486]: report (CONNECT)
Sun Oct 18 17:33:45 2015 local2.info chat[3486]: timeout set to 10 seconds
Sun Oct 18 17:33:45 2015 local2.info chat[3486]: send (AT&F^M)
Sun Oct 18 17:33:45 2015 local2.info chat[3486]: expect (OK)
Sun Oct 18 17:33:45 2015 local2.info chat[3486]: AT&F^M^M
Sun Oct 18 17:33:45 2015 local2.info chat[3486]: OK
Sun Oct 18 17:33:45 2015 local2.info chat[3486]:  -- got it
Sun Oct 18 17:33:45 2015 local2.info chat[3486]: send (ATE1^M)
Sun Oct 18 17:33:45 2015 local2.info chat[3486]: expect (OK)
Sun Oct 18 17:33:45 2015 local2.info chat[3486]: ^M
Sun Oct 18 17:33:45 2015 local2.info chat[3486]: ATE1^M^M
Sun Oct 18 17:33:45 2015 local2.info chat[3486]: OK
Sun Oct 18 17:33:45 2015 local2.info chat[3486]:  -- got it
Sun Oct 18 17:33:45 2015 local2.info chat[3486]: send (AT+CGDCONT=1,"IP","internet"^M)
Sun Oct 18 17:33:46 2015 local2.info chat[3486]: timeout set to 30 seconds
Sun Oct 18 17:33:46 2015 local2.info chat[3486]: expect (OK)
Sun Oct 18 17:33:46 2015 local2.info chat[3486]: ^M
Sun Oct 18 17:33:46 2015 local2.info chat[3486]: AT+CGDCONT=1,"IP","internet"^M^M
Sun Oct 18 17:33:46 2015 local2.info chat[3486]: OK
Sun Oct 18 17:33:46 2015 local2.info chat[3486]:  -- got it
Sun Oct 18 17:33:46 2015 local2.info chat[3486]: send (ATD*99***1#^M)
Sun Oct 18 17:33:46 2015 local2.info chat[3486]: expect (CONNECT)
Sun Oct 18 17:33:46 2015 local2.info chat[3486]: ^M
Sun Oct 18 17:33:46 2015 local2.info chat[3486]: ATD*99***1#^M^M
Sun Oct 18 17:33:46 2015 local2.info chat[3486]: CONNECT
Sun Oct 18 17:33:46 2015 local2.info chat[3486]:  -- got it
Sun Oct 18 17:33:46 2015 local2.info chat[3486]: send ( ^M)
Sun Oct 18 17:33:46 2015 daemon.info pppd[3477]: Serial connection established.
Sun Oct 18 17:33:46 2015 kern.info kernel: [  133.410000] 3g-wan2: renamed from ppp0
Sun Oct 18 17:33:46 2015 daemon.info pppd[3477]: Using interface 3g-wan2
Sun Oct 18 17:33:46 2015 daemon.notice pppd[3477]: Connect: 3g-wan2 <--> /dev/ttyUSB0
Sun Oct 18 17:33:50 2015 daemon.warn pppd[3477]: Could not determine remote IP address: defaulting to 10.64.64.64
Sun Oct 18 17:33:50 2015 daemon.notice pppd[3477]: local  IP address 109.243.63.100
Sun Oct 18 17:33:50 2015 daemon.notice pppd[3477]: remote IP address 10.64.64.64
Sun Oct 18 17:33:50 2015 daemon.notice pppd[3477]: primary   DNS address 89.108.195.21
Sun Oct 18 17:33:50 2015 daemon.notice pppd[3477]: secondary DNS address 89.108.202.21
Sun Oct 18 17:33:50 2015 daemon.notice netifd: Network device '3g-wan2' link is up
Sun Oct 18 17:33:50 2015 daemon.notice netifd: Interface 'wan2' is now up
Sun Oct 18 17:33:50 2015 daemon.info dnsmasq[2336]: reading /tmp/resolv.conf.auto
Sun Oct 18 17:33:50 2015 daemon.info dnsmasq[2336]: using local addresses only for domain lan
Sun Oct 18 17:33:50 2015 daemon.info dnsmasq[2336]: using nameserver 8.8.8.8#53
Sun Oct 18 17:33:50 2015 daemon.info dnsmasq[2336]: using nameserver 213.199.198.248#53
Sun Oct 18 17:33:50 2015 daemon.info dnsmasq[2336]: using nameserver 82.160.1.1#53
Sun Oct 18 17:33:50 2015 daemon.info dnsmasq[2336]: using nameserver 89.108.195.21#53
Sun Oct 18 17:33:50 2015 daemon.info dnsmasq[2336]: using nameserver 89.108.202.21#53
Sun Oct 18 17:33:50 2015 daemon.notice netifd: Network alias '3g-wan2' link is up
Sun Oct 18 17:33:50 2015 daemon.notice netifd: Interface 'wan2_6' is enabled
Sun Oct 18 17:33:50 2015 daemon.notice netifd: Interface 'wan2_6' has link connectivity
Sun Oct 18 17:33:50 2015 daemon.notice netifd: Interface 'wan2_6' is setting up now
Sun Oct 18 17:33:50 2015 user.notice firewall: Reloading firewall due to ifup of wan2 (3g-wan2)
Sun Oct 18 17:35:22 2015 user.notice /usr/bin/simplefailover: Changing connection to main wan: wan
Sun Oct 18 17:35:22 2015 daemon.info pppd[3477]: Terminating on signal 15
Sun Oct 18 17:35:22 2015 daemon.info pppd[3477]: Connect time 1.6 minutes.
Sun Oct 18 17:35:22 2015 daemon.info pppd[3477]: Sent 104673 bytes, received 63683 bytes.
Sun Oct 18 17:35:22 2015 daemon.notice netifd: Network device '3g-wan2' link is down
Sun Oct 18 17:35:22 2015 daemon.notice netifd: Network alias '3g-wan2' link is down
Sun Oct 18 17:35:22 2015 daemon.notice netifd: Interface 'wan2_6' has link connectivity loss
Sun Oct 18 17:35:22 2015 daemon.notice pppd[3477]: Connection terminated.
Sun Oct 18 17:35:22 2015 daemon.info pppd[3477]: Exit.
Sun Oct 18 17:35:22 2015 daemon.notice netifd: Interface 'wan2' is now down
Sun Oct 18 17:35:22 2015 daemon.info dnsmasq[2336]: reading /tmp/resolv.conf.auto
Sun Oct 18 17:35:22 2015 daemon.info dnsmasq[2336]: using local addresses only for domain lan
Sun Oct 18 17:35:22 2015 daemon.info dnsmasq[2336]: using nameserver 8.8.8.8#53
Sun Oct 18 17:35:22 2015 daemon.info dnsmasq[2336]: using nameserver 213.199.198.248#53
Sun Oct 18 17:35:22 2015 daemon.info dnsmasq[2336]: using nameserver 82.160.1.1#53
Sun Oct 18 17:35:23 2015 daemon.notice netifd: Interface 'wan2_6' is now down
Sun Oct 18 17:35:23 2015 daemon.notice netifd: Interface 'wan2_6' is disabled
Sun Oct 18 17:35:26 2015 user.notice /usr/bin/simplefailover: Changing connection to main wan: wan

Czy to nie jest jakiś błąd simplefailover?

7

Odp: SMS/mail przy przełączeniu na zapasowy wan?

Bo dwa razy nawiązał ci połączenie. Za pierwszym natychmiast zostało ono zerwane i simplefailover nie widział połączenia, ponownie uruchomił wan2. Masz to wszystko w logach.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

8

Odp: SMS/mail przy przełączeniu na zapasowy wan?

Dlaczego się tak dzieje? Tak jest za każdym razem hmm

9

Odp: SMS/mail przy przełączeniu na zapasowy wan?

Nie mam pojęcia czemu ci zrywa połączenie modemowe.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.