check_oracle_health: update to 1.9.3.5
[omd.git] / packages / nagvis / NAGVIS_URLS.hook
blobcf59ef5b29e6c20196195122c4d2fa285aa809ec
1 #!/bin/bash
3 # Alias: NagVis linked Web GUI
4 # Menu: Addons
5 # Description:
6 # When clicking on NagVis map icons the user is redirected to another
7 # Web-GUI. By default this is the classic Nagios webinterface. With
8 # this switch the targeted Web-GUI can be changed.
10 # Makes it possible to switch all the links from NagVis
11 # to the default Web GUI to the choosen GUI or a defined
12 # other one.
14 # Idea: Default mode is "auto". In this mode the HOOK
15 # checks the current configuration for the default
16 # web gui and sets the NagVis links to point to it.
17 # It is also possible to force the other Web GUIs instead
18 # of "auto".
19 # Another option is "none". In this case OMD configures
20 # nothing and NagVis uses the hard coded optionsa
22 case "$1" in
23 default)
24 echo "auto"
26 choices)
27 echo "auto: Use the default Web-GUI"
28 echo "nagios: Classic Nagios webinterface"
29 echo "check_mk: The Check_MK's Multisite GUI"
30 echo "thruk: Thruk Monitoring Webinterface"
31 echo "none: disable"
33 set)
34 # Skip this hook when NagVis configuration directory does not exist
35 if [ ! -d $OMD_ROOT/etc/nagvis ]; then
36 exit 0
39 CFG_FILE=$OMD_ROOT/etc/nagvis/conf.d/urls.ini.php
40 GUI=$2
41 if [ "$GUI" == "auto" ]; then
42 GUI=$CONFIG_DEFAULT_GUI
45 # Fallback to classic Nagios GUI when auto mode and unhandled GUIs selected
46 # (welcome/nagvis GUIs are catched in DEFAULT_GUI hook)
47 if [ "$GUI" == "none" ] && [ -f $CFG_FILE ]; then
48 rm $CFG_FILE
49 exit 0
52 if [ ! -d $OMD_ROOT/etc/nagvis/conf.d ]; then
53 mkdir -p $OMD_ROOT/etc/nagvis/conf.d
56 if [ "$GUI" == "check_mk" ]; then
57 HTMLCGI="/$OMD_SITE/check_mk"
58 HOSTURL="[htmlcgi]/view.py?view_name=host&site=&host=[host_name]"
59 SERVICEURL="[htmlcgi]/view.py?view_name=service&site=&host=[host_name]&service=[service_description]"
60 HOSTGROUPURL="[htmlcgi]/view.py?view_name=hostgroup&site=&hostgroup=[hostgroup_name]"
61 SERVICEGROUPURL="[htmlcgi]/view.py?view_name=servicegroup&site=&servicegroup=[servicegroup_name]"
62 else
63 HTMLCGI="/$OMD_SITE/$GUI/cgi-bin"
64 HOSTURL="[htmlcgi]/status.cgi?host=[host_name]"
65 HOSTGROUPURL="[htmlcgi]/status.cgi?hostgroup=[hostgroup_name]"
66 SERVICEURL="[htmlcgi]/extinfo.cgi?type=2&host=[host_name]&service=[service_description]"
67 SERVICEGROUPURL="[htmlcgi]/status.cgi?servicegroup=[servicegroup_name]&style=detail"
70 # Now write the NagVis configuration. This is a dedicated file so we can easily write it out here
71 cat > $CFG_FILE <<EOF
72 ; <?php exit(1); ?>
73 ; Do not edit this file. Your changes will be overwritten.
74 ; This file is controlled by the OMD hook NAGVIS_URLS.
76 ; Written by OMD hook NAGVIS_URLS at $(date).
77 [paths]
78 htmlcgi="$HTMLCGI"
80 [defaults]
81 hosturl="$HOSTURL"
82 hostgroupurl="$HOSTGROUPURL"
83 serviceurl="$SERVICEURL"
84 servicegroupurl="$SERVICEGROUPURL"
85 EOF
88 esac