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

Avoid rtmpdump not stop #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,35 @@ It uses the rtmpdump (http://rtmpdump.mplayerhq.hu/) utility for connecting to a
and determine if it's working or not.


## Usage

Copy file `check_rtmp.sh` to `${nagios_home}/libexec/check_rtmp.sh`

Add command to `${nagios_home}/etc/objects/commands.cfg`

```
define command{
command_name check_rtmp
command_line $USER1$/check_rtmp.sh $ARG1$
}

```

In service (`${nagios_home}/etc/server/services.cfg`)

```
define service {
...
check_command check_rtmp! -u <url> -t <timeout>
}
```

AUTHOR: Toni Comerma
DATE: jan-2013

AUTHOR: chadliu23
DATE: jul-2019

Notes:
- The plugin leaves temporary files under /tmp
- You should not run concurrent executions of this plugin for the same stream name (as they will share the same temporary file) and
Expand Down
4 changes: 2 additions & 2 deletions check_rtmp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ NAME=`echo $URL | sed -e s/[^A-Za-z0-9.]/_/g`
ERR=/tmp/check_rtmp_err_$NAME.tmp

# Testejant
$RTMPDUMP --live -r $URL --stop $TIMEOUT > /dev/null 2> $ERR
$RTMPDUMP --live -r $URL --stop $TIMEOUT > /dev/null 2> $ERR & sleep 3
status=$?

sleep 4 && ps -ef | grep "$RTMPDUMP --live -r $URL" | grep -v grep | awk '{print $2}' | xargs -r sudo kill -9

# Retorn de resultats
CONNECTA=`grep "INFO: Connected" $ERR`
Expand Down