TeamViewer.tst: New test to check TeamViewer Host on OS X
[nagcollect.git] / client / lib / tests / Darwin / TeamViewer.tst
1 # NagCollect -- Nagios Data Collector for Passive Checks
2 # Copyright (c)2010-2014 Alexander Barton, alex@barton.de
3
4 # Check TeamViewer Host installation
5
6 SERVICE="TV_p"
7
8 v=9
9 id=`defaults read /Library/Preferences/com.teamviewer.teamviewer9 ClientID 2>/dev/null`
10 if [ -z "$id" ]; then
11         v=8
12         id=`defaults read /Library/Preferences/com.TeamViewer8.Settings ClientID 2>/dev/null`
13         if [ -z "$id" ]; then
14                 v=7
15                 id=`defaults read /Library/Preferences/com.TeamViewer7.Settings ClientID 2>/dev/null`
16                 if [ -z "$id" ]; then
17                         v=6
18                         id=`defaults read /Library/Preferences/com.TeamViewer6.Settings ClientID 2>/dev/null`
19                 fi
20         fi
21 fi
22
23 if [ -n "$id" ]; then
24         STATUS=4
25         TEXT="TeamViewer $v ID: $id"
26         killall -0 TeamViewerHost >/dev/null 2>&1
27         if [ $? -ne 0 ]; then
28                 STATUS=1
29                 TEXT="$TEXT - TeamViewerHost seems not to be running?"
30         else
31                 STATUS=0
32         fi
33 fi