Author |
Message |
|
Post subject: skript pre test ip a zaslanie mailu a zapisania do logu
Posted: 15.01.2014 - 10:25 #105628
|
|
Majster
Joined: Máj 12, 2004
Posts: 4579
Location: Bratislava
|
|
mam nieco taketo
Code: › :local gw "192.168.112.1"
:if ([/ping $gw count=6] = 0) do={
/tool e-mail send from=watchdog@nieco.sk to=admin@nieco.sk server=ip.server.u user=user password=heslo subject="gw not reachable" body="gw problem";
:log info "gw problem: EMail sent to $mailto";
}
mohlo by to takto fungovat?
ak by som pouzil netwatch, ten posle len jeden ping? ja potrebujem monitorovat dlhsie vypadky.... |
Last edited by Chalan on 15.01.2014 - 13:36; edited 1 time in total
|
|
|
|
![](./modules/PNphpBB2/templates/PNTheme/images/spacer.gif) |
|
Post subject: skript pre test ip a zaslanie mailu a zapisania do logu
Posted: 15.01.2014 - 10:58 #105629
|
|
Ucen
Joined: Júl 15, 2011
Posts: 769
|
|
Chalan wrote: ›mam nieco taketo
:local gw "192.168.112.1"
:if ([/ping $gw count=6] = 0) do={
/tool e-mail send from=watchdog@nieco.sk to=admin@nieco.sk server=ip.server.u user=user password=heslo subject="gw not reachable" body="gw problem";
:log info "gw problem: EMail sent to $mailto";
}
mohlo by to takto fungovat?
ak by som pouzil netwatch, ten posle len jeden ping? ja potrebujem monitorovat dlhsie vypadky....
najlepsie je pouzit kombinanciu newtachtu a donho dan script kde si presne zadefinujes nech posle email az pri vacsej strate... |
|
|
|
|
![](./modules/PNphpBB2/templates/PNTheme/images/spacer.gif) |
|
Post subject: RE: skript pre test ip a zaslanie mailu a zapisania do logu
Posted: 15.01.2014 - 11:06 #105630
|
|
Majster
Joined: Máj 12, 2004
Posts: 4579
Location: Bratislava
|
|
skusim... len ked je gw dole neposle mail lebo sa nevie spojit so serverom, posle len pri up... ako ale do mailu vlozit ze ako dlho bola gw dole ked to mail posle len pri funkcnom pripojeni? |
|
|
|
|
![](./modules/PNphpBB2/templates/PNTheme/images/spacer.gif) |
|
Post subject: RE: skript pre test ip a zaslanie mailu a zapisania do logu
Posted: 15.01.2014 - 11:40 #105631
|
|
Majster
![](./images/avatar/cunt.gif)
Joined: Jan 08, 2006
Posts: 2584
|
|
Code: › /tool netwatch get X since
Cez toto vies zistit aky cas uhebol od poslednej zmeny stavu v netwatch. X je id netwatch pravidla. |
|
|
|
|
![](./modules/PNphpBB2/templates/PNTheme/images/spacer.gif) |
|
Post subject: RE: skript pre test ip a zaslanie mailu a zapisania do logu
Posted: 15.01.2014 - 15:44 #105632
|
|
Majster
Joined: Máj 12, 2004
Posts: 4579
Location: Bratislava
|
|
nejak mi to nic neukazuje /tool netwatch get number=0 since ; este to skusim ked budem priamo pri routeri, len ak to ukaze ako to implementovat do skriptu aby ten cas poslal do mailu? najskor to supnut do premennej? |
|
|
|
|
![](./modules/PNphpBB2/templates/PNTheme/images/spacer.gif) |
|
Post subject: RE: skript pre test ip a zaslanie mailu a zapisania do logu
Posted: 15.01.2014 - 15:53 #105633
|
|
Majster
![](./images/avatar/cunt.gif)
Joined: Jan 08, 2006
Posts: 2584
|
|
neukazuje nic, lebo je to prave pre potreby skriptov... takze najprv supnes do premennej a potom do retazca napr takto
Code: › :global OdKedy
:set OdKedy [/tool netwatch get 0 since]
:put "Posledna zmena stavu: $OdKedy" |
|
|
|
|
![](./modules/PNphpBB2/templates/PNTheme/images/spacer.gif) |
|
Post subject: RE: skript pre test ip a zaslanie mailu a zapisania do logu
Posted: 16.01.2014 - 13:38 #105642
|
|
Majster
Joined: Máj 12, 2004
Posts: 4579
Location: Bratislava
|
|
diki mam to takto:
pri down:
Code: › :global OdKedy
:set OdKedy [/tool netwatch get 0 since]
log info "gw down";
pri up:
Code: › :global OdKedy
:global DoKedy
:set DoKedy [/tool netwatch get 0 since]
/tool e-mail send from=watchdog@nieco.sk to=alarm@nieco.sk server=serverip user=user password=pass subject="gw is alive" body="gw bola dole od $OdKedy do $DoKedy";
:log info "gw ok: EMail sent to email@adress.sk";
mail to sice posle ale telo je bez odkedy cize "gw bola dole od do jan/16/2014 13:32:46"
co robim zle? |
|
|
|
|
![](./modules/PNphpBB2/templates/PNTheme/images/spacer.gif) |
|
Post subject: RE: skript pre test ip a zaslanie mailu a zapisania do logu
Posted: 16.01.2014 - 15:01 #105644
|
|
Majster
![](./images/avatar/cunt.gif)
Joined: Jan 08, 2006
Posts: 2584
|
|
skus si dat vystup aj do logu aby si videl, ci nie je problem niekde v send mail rutine...
Code: › :log info "gw bola dole od $OdKedy do $DoKedy"
mne to do logov vypisalo pekne odkedy aj dokedy...
ROS v6.7 |
|
|
|
|
![](./modules/PNphpBB2/templates/PNTheme/images/spacer.gif) |
|
Post subject: RE: skript pre test ip a zaslanie mailu a zapisania do logu
Posted: 16.01.2014 - 18:09 #105646
|
|
Majster
Joined: Máj 12, 2004
Posts: 4579
Location: Bratislava
|
|
kam sa prosim ukladaju tie premenne? viem ze v scripte v enviroment ale ked sa nieco pusta cez netwatch a zapisuje premmenu nemam to tam... potrebujem skontolovat ci sa ta premmenna $OdKedy vobec zapisala... diki
ja mam inak 5.26 ale nemyslim si ze je to tym... |
|
|
|
|
![](./modules/PNphpBB2/templates/PNTheme/images/spacer.gif) |
|
Post subject: RE: skript pre test ip a zaslanie mailu a zapisania do logu
Posted: 16.01.2014 - 18:57 #105648
|
|
Majster
![](./images/avatar/cunt.gif)
Joined: Jan 08, 2006
Posts: 2584
|
|
skus to s logom ako som ti pisal.. tam uvidis ci je to ok...
mne to do logu normalne da oba casy... skus tak, ze zmenis IPcku v netwatch na nieco co neexistuje a potom o chvilku zas nazad.. uvidis ci to to vypise spravne |
|
|
|
|
![](./modules/PNphpBB2/templates/PNTheme/images/spacer.gif) |
|
Post subject: RE: skript pre test ip a zaslanie mailu a zapisania do logu
Posted: 16.01.2014 - 19:37 #105649
|
|
Majster
Joined: Máj 12, 2004
Posts: 4579
Location: Bratislava
|
|
nevypisalo... nemozes to prosim skusit na 5.26? mne este nikde nebezi 6.x a upgradnut zatial nechcem... |
|
|
|
|
![](./modules/PNphpBB2/templates/PNTheme/images/spacer.gif) |
|
Post subject: RE: skript pre test ip a zaslanie mailu a zapisania do logu
Posted: 16.01.2014 - 22:18 #105652
|
|
Majster
![](./images/avatar/cunt.gif)
Joined: Jan 08, 2006
Posts: 2584
|
|
ja mam zasa vsade 6.x ![Neutral](modules/PNphpBB2/images/smiles/icon_neutral.gif) |
|
|
|
|
![](./modules/PNphpBB2/templates/PNTheme/images/spacer.gif) |
|
Post subject: RE: skript pre test ip a zaslanie mailu a zapisania do logu
Posted: 17.01.2014 - 08:35 #105653
|
|
Majster
Joined: Máj 12, 2004
Posts: 4579
Location: Bratislava
|
|
ok, dik, updatol som na 6.7 a uz to funguje... pekne mini bugy maju v tom MK... len 6.x sa este bojim nahadzovat je to ozaj uz stable? hlavne na wireless, nv2... |
|
|
|
|
![](./modules/PNphpBB2/templates/PNTheme/images/spacer.gif) |
|
Post subject: RE: skript pre test ip a zaslanie mailu a zapisania do logu
Posted: 17.01.2014 - 09:16 #105654
|
|
Ucen
Joined: Júl 15, 2011
Posts: 769
|
|
Chalan wrote: ›ok, dik, updatol som na 6.7 a uz to funguje... pekne mini bugy maju v tom MK... len 6.x sa este bojim nahadzovat je to ozaj uz stable? hlavne na wireless, nv2...
6.7 ide uy dobre predosle 6 haprovali aj qu ale 6.7 je zatial good... |
|
|
|
|
![](./modules/PNphpBB2/templates/PNTheme/images/spacer.gif) |
|
Post subject: RE: skript pre test ip a zaslanie mailu a zapisania do logu
Posted: 19.01.2014 - 10:31 #105664
|
|
Guru
Joined: Jan 24, 2004
Posts: 1685
|
|
pedro4444 wrote: › Chalan wrote: ›ok, dik, updatol som na 6.7 a uz to funguje... pekne mini bugy maju v tom MK... len 6.x sa este bojim nahadzovat je to ozaj uz stable? hlavne na wireless, nv2...
6.7 ide uy dobre predosle 6 haprovali aj qu ale 6.7 je zatial good...
(neviem ci som to pisal tu alebo na ine forum)
nooo ja som nahadzoval 6,7 na x86 a ked som vo winboxe vypol interface, zmizli mi vsetky interfejsy. Nezobrazili sa ani cez konzolu. Net a vsetko fungovalo. len takyto cudny stav.
po upgrade sa znova objavili... |
|
|
|
|
![](./modules/PNphpBB2/templates/PNTheme/images/spacer.gif) |
|
Powered by PNphpBB2 © 2003-2005 The PNphpBB Group Credits |