monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: check script value and alert


From: Volkan Celebi
Subject: Re: check script value and alert
Date: Thu, 16 Jun 2016 20:08:39 +0200

Hello,

I am a bit confused. Here is my bash file:

#!/bin/bash
for i in 37 59 70 82 90 69 70 67 81
do
URL="" href="http://127.0.0.1:8000/live/user/pass/$i.ts">http://127.0.0.1:8000/live/user/pass/$i.ts"
HAS_AAC_OUT=$(ffmpeg -i $URL 2>&1 | grep 48000)
if [ -z "$HAS_AAC_OUT" ];then
  FILE=${URL##*/}
  echo "ERRORTS=${FILE%.*}"
else
  echo "$HAS_AAC_OUT"
fi
done

if I exec this one I am getting like this if everything is ok:

    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 117 kb/s
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 120 kb/s
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 118 kb/s
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 115 kb/s
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 118 kb/s
    Stream #0:0[0x100]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 109 kb/s
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 118 kb/s
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, 5.1, fltp, 99 kb/s
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 124 kb/s

but any stream has problem and doesnt get 48000 then script gives me ERRORTS=37 or 59 or 70.....

I need the alert me via email and I have to see value of ERRORTS. How can I realize it?

many thanks 



On 16 June 2016 at 19:18, SZÉPE Viktor <address@hidden> wrote:
Hello!

The Bash script should return an error:

#!/bin/bash
#
# This script does something
#

get-value-of-errorts

if [ -n "$ERRORTS" ]; then
    RET="1"
    echo "ERROR: ${ERRORTS}"
else
    RET="0"
fi

exit "$RET"


monit config:

check program errorts_test with path "/usr/local/bin/errorts.sh"
  if status != 0 then alert


All the best!


Idézem/Quoting Volkan Celebi <address@hidden>:

Dear all,

I have a bash script and I would like to exec it every 5 minutes to check
the value of ERRORTS variable. If everything goes well this variable
doesn't get any value if is tehre any error this script assign to this
variable a int integer.

How I can realize this scenieri in monitrc file?

Thanks in advance

--
Volkan Çelebi
IT System Spezialist
Heimstr. 10
8953 Dietikon
Tel: +41 788 488 319



SZÉPE Viktor
--
+36-20-4242498  address@hidden  skype: szepe.viktor
Budapest, III. kerület





--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general



--
Volkan Çelebi
IT System Spezialist
Heimstr. 10
8953 Dietikon
Tel: +41 788 488 319

reply via email to

[Prev in Thread] Current Thread [Next in Thread]