Commit 60bf62f9 authored by Markus Frosch's avatar Markus Frosch
Browse files

Remove classicui package

parent 69685f2e
These webpages are copied from the icinga classic interface, for being able
to provide this interface for Icinga 2.
Unfortunatly some modifications have to be made...
-- Markus Frosch <markus@lazyfrosch.de>
# apache configuration for icinga
ScriptAlias /cgi-bin/icinga2-classicui /usr/lib/cgi-bin/icinga2-classicui
# Where the stylesheets (config files) reside
Alias /icinga2-classicui/stylesheets /etc/icinga2-classicui/stylesheets
# Where the HTML pages live
Alias /icinga2-classicui /usr/share/icinga2/classicui
<LocationMatch "^/cgi-bin/icinga2-classicui">
SetEnv ICINGA_CGI_CONFIG /etc/icinga2-classicui/cgi.cfg
</LocationMatch>
<DirectoryMatch "^(?:/usr/share/icinga2/classicui/htdocs|/usr/lib/cgi-bin/icinga2-classicui|/etc/icinga2-classicui/stylesheets)/">
Options FollowSymLinks
DirectoryIndex index.html
AllowOverride AuthConfig
<IfVersion < 2.3>
Order Allow,Deny
Allow From All
</IfVersion>
AuthName "Icinga Access"
AuthType Basic
AuthUserFile /etc/icinga2-classicui/htpasswd.users
Require valid-user
</DirectoryMatch>
// Written by Kepi (kepi.cz)
$(document).ready(function() {
'use strict';
var min_char = 3;
var max_items_per_cat = 10;
var display_services = true;
window.icingaAC = {
// This is number of miliseconds to cache partial result
// so we don't query server again and again for same terms
expireMsecs: 60000,
// internal variables
shorten: undefined,
results: {}
}
// extension for category support in autocomplete result
$.widget("custom.catcomplete", $.ui.autocomplete, {
_renderMenu: function( ul, items ) {
var that = this;
var currentCategory = "";
var current_id = 0;
$.each( items, function( index, item ) {
if (item.category != currentCategory) {
$('<li/>').addClass('ui-autocomplete-category').html(item.category).appendTo(ul);
currentCategory = item.category;
current_id = 0;
}
if (current_id < max_items_per_cat)
that._renderItemData( ul, item );
if (current_id == max_items_per_cat)
$('<li/>').addClass('ui-menu-item').html("...").appendTo(ul);
current_id++;
});
}
});
// extend renderItem so we can add custom class
$.extend( $.ui.autocomplete.prototype, {
_renderItem: function( ul, item ) {
return $( '<li class="status' + item.status + '">' )
.append( $( "<a>" ).text( item.label ) )
.appendTo( ul );
}
});
// autocomplete function
$("#autocomplete").catcomplete( { minLength: min_char, delay : 700 }, {
// select function is used to open url for selected item
select: function( event, ui ) { top.frames['main'].location.href = ui.item.url },
// get results from icinga API
source: function(request, response) {
var shorten = request.term.substring(0, min_char);
var output = [];
if (window.icingaAC.shorten === undefined || shorten != window.icingaAC.shorten || window.icingaAC.results[window.icingaAC.shorten].expire < (new Date).getTime()) {
$.ajax({
async: false,
url: '/cgi-bin/icinga2-classicui/status.cgi?livesearchdata',
dataType: 'json',
data: {
search_string: shorten // parameter for API search
},
success: function(data) {
// prepare hosts data
if ( data.status.hosts ) {
$.each( data.status.hosts, function(index, item) {
output.push( {
category: 'Hosts',
url: '/cgi-bin/icinga2-classicui/status.cgi?search_string=' + encodeURIComponent(item.host_name),
label: item.host_display_name,
local_match: new Array( item.host_name, item.host_display_name, item.host_alias, item.host_address, item.host_address6 ),
status: item.status
});
});
}
// prepare services data
if ( data.status.services && display_services) {
$.each( data.status.services, function(index, item) {
output.push( {
category: 'Services ' + item.host_name,
url: '/cgi-bin/icinga2-classicui/extinfo.cgi?type=2&host=' + encodeURIComponent(item.host_name) + '&service=' + encodeURIComponent(item.service_description),
label: item.service_display_name,
local_match: new Array( item.service_description, item.service_display_name,
item.host_name + ' ' + item.service_description,
item.host_name + ' ' + item.service_display_name,
item.host_display_name + ' ' + item.service_description,
item.host_display_name + ' ' + item.service_display_name ),
value: item.host_name + ' ' + item.service_description,
status: item.status
});
});
}
// prepare host groups data
if ( data.status.hostgroups ) {
$.each( data.status.hostgroups, function(index, item) {
output.push( {
category: 'Hostgroups',
url: '/cgi-bin/icinga2-classicui/status.cgi?style=overview&hostgroup=' + encodeURIComponent(item.hostgroup_name),
local_match: new Array( item.hostgroup_name, item.hostgroup_alias ),
label: item.hostgroup_alias,
status: "group"
});
});
}
// prepare service groups data
if ( data.status.servicegroups ) {
$.each( data.status.servicegroups, function(index, item) {
output.push( {
category: 'Servicegroups',
url: '/cgi-bin/icinga2-classicui/status.cgi?style=overview&servicegroup=' + encodeURIComponent(item.servicegroup_name),
local_match: new Array( item.servicegroup_name, item.servicegroup_alias ),
label: item.servicegroup_alias,
status: "group"
});
});
}
window.icingaAC.shorten = shorten;
window.icingaAC.results[window.icingaAC.shorten] = {
expire: (new Date).getTime() + window.icingaAC.expireMsecs,
data: output
}
}
})
}
var matcher = new RegExp( request.term.replace(/\*/g, ".*"), "i" );
response( $.grep( window.icingaAC.results[window.icingaAC.shorten].data, function( item ){
var match_result = false;
$.each( item.local_match, function( index, match_item ) {
if (match_item !== undefined && matcher.test( match_item )) {
match_result = true;
return;
}
});
return match_result;
}) );
}
}).bind('focus', function(){ $(this).catcomplete("search"); } );
});
// vim: syntax=javascript ts=2 sw=2 sts=2 sr et
# Icinga 2 Classic UI configuration
#
# requires icinga-gui package
# check http://docs.icinga.org for option details
standalone_installation=1
physical_html_path=/usr/share/icinga
url_html_path=/icinga2-classicui
url_stylesheets_path=/icinga2-classicui/stylesheets
http_charset=utf-8
refresh_rate=30
refresh_type=1
escape_html_tags=1
result_limit=50
show_tac_header=1
use_pending_states=1
first_day_of_week=0
suppress_maintenance_downtime=0
action_url_target=main
notes_url_target=main
use_authentication=1
use_ssl_authentication=0
lowercase_user_name=0
authorized_for_system_information=icingaadmin
authorized_for_configuration_information=icingaadmin
authorized_for_full_command_resolution=icingaadmin
authorized_for_system_commands=icingaadmin
authorized_for_all_services=icingaadmin
authorized_for_all_hosts=icingaadmin
authorized_for_all_service_commands=icingaadmin
authorized_for_all_host_commands=icingaadmin
show_all_services_host_is_authorized_for=1
show_partial_hostgroups=0
show_partial_servicegroups=0
default_statusmap_layout=5
status_show_long_plugin_output=0
display_status_totals=0
highlight_table_rows=1
add_notif_num_hard=28
add_notif_num_soft=0
use_logging=0
cgi_log_file=/var/log/icinga/gui/icinga-cgi.log
cgi_log_rotation_method=d
cgi_log_archive_path=/var/log/icinga/gui
enforce_comments_on_actions=0
send_ack_notifications=1
persistent_ack_comments=0
lock_author_names=1
default_downtime_duration=7200
set_expire_ack_by_default=0
default_expiring_acknowledgement_duration=86400
default_expiring_disabled_notifications_duration=86400
tac_show_only_hard_state=0
show_tac_header_pending=1
exclude_customvar_name=PASSWORD,COMMUNITY
exclude_customvar_value=secret
extinfo_show_child_hosts=0
tab_friendly_titles=1
######################################
# STANDALONE (ICINGA 2) OPTIONS
# requires standalone_installation=1
######################################
object_cache_file=/var/cache/icinga2/objects.cache
status_file=/var/cache/icinga2/status.dat
resource_file=/etc/icinga/resource.cfg
command_file=/var/run/icinga2/cmd/icinga2.cmd
check_external_commands=1
interval_length=60
status_update_interval=10
log_file=/var/log/icinga2/compat/icinga.log
log_rotation_method=h
log_archive_path=/var/log/icinga2/compat/archives
date_format=us
url_cgi_path=/cgi-bin/icinga2-classicui
# EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Icinga2 Classic</title>
<meta name="robots" content="noindex, nofollow" />
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" />
</head>
<frameset frameborder="0" framespacing="0" rows="72,*" onLoad='document.title="Icinga2 Classic: "+window.location.hostname; document.getElementById("main").focus();'>
<frame src="/cgi-bin/icinga2-classicui/tac.cgi?tac_header" name="top" target="main" scrolling="no" />
<frameset frameborder="0" framespacing="0" cols="200,*">
<frame src="menu.html" name="menu" target="main" scrolling="auto"/>
<frame src="/cgi-bin/icinga2-classicui/tac.cgi" name="main" id="main" />
</frameset>
</frameset>
<noframes>
<body>
<p>These pages require a browser which supports frames.</p>
</body>
</noframes>
</html>
<!DOCTYPE html PUBLIC "-//W4C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Web Interface Monitoring</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en" />
<meta name="robots" content="noindex, nofollow" />
<link rel="stylesheet" type="text/css" href="stylesheets/menu.css" media="screen, projection" />
<link rel="stylesheet" type="text/css" href="jquery-ui/themes/base/jquery.ui.all.css" media="screen, projection" />
<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico" />
<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="js/menu.js"></script>
<script type="text/javascript" src="jquery-ui/ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="jquery-ui/ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="jquery-ui/ui/jquery.ui.menu.js"></script>
<script type="text/javascript" src="jquery-ui/ui/jquery.ui.position.js"></script>
<script type="text/javascript" src="jquery-ui/ui/jquery.ui.autocomplete.js"></script>
</head>
<body>
<div id="menu">
<h2>General</h2>
<ul>
<li class="menuli_style1"><a href="main.html" target="main">Home</a></li>
<!-- hidden for icinga2-classicui
<li class="menuli_style2">
<div class="flag">Documentation
<a class="flag" href="docs/de/index.html" target="main"><img src="docs/images/flags/de.png" /></a>
<a class="flag" href="docs/en/index.html" target="main"><img src="docs/images/flags/um_gb.png" /></a>
</div>
</li>
-->
<!-- classic search -->
<li class="menuli_style3">Search:</li>
<li class="menuli_style2">
<div class="navbarsearch">
<form method="get" action="/cgi-bin/icinga2-classicui/status.cgi" target="main">
<input type='text' name='search_string' id="autocomplete" style="width: 150px; padding: 2px; margin-left: 10px; border: 1px solid grey">
</form>
</div>
</li>
</ul>
<h2>Status</h2>
<ul>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/tac.cgi" target="main">Tactical Overview</a></li>
<li class="menuli_style2"><a href="/cgi-bin/icinga2-classicui/status.cgi?style=hostdetail" target="main">Host Detail</a></li>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/status.cgi" target="main">Service Detail</a></li>
<li class="menuli_style2"><a href="/cgi-bin/icinga2-classicui/status.cgi?hostgroup=all&amp;style=overview" target="main">Hostgroup Overview</a></li>
<li class="menuli_style2"><a href="/cgi-bin/icinga2-classicui/status.cgi?hostgroup=all&amp;style=summary" target="main">Hostgroup Summary</a></li>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/status.cgi?servicegroup=all&amp;style=overview" target="main">Servicegroup Overview</a></li>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/status.cgi?servicegroup=all&amp;style=summary" target="main">Servicegroup Summary</a></li>
<li class="menuli_style2"><a href="/cgi-bin/icinga2-classicui/statusmap.cgi?host=all" target="main">Status Map</a></li>
</ul>
<h2>Problems</h2>
<ul>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/status.cgi?servicestatustypes=28" target="main">Service Problems</a></li>
<li class="menuli_style2"><a href="/cgi-bin/icinga2-classicui/status.cgi?servicestatustypes=28&amp;hoststatustypes=3&amp;serviceprops=2097162" target="main">Unhandled Services</a></li>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/status.cgi?style=hostdetail&amp;hoststatustypes=12" target="main">Host Problems</a></li>
<li class="menuli_style2"><a href="/cgi-bin/icinga2-classicui/status.cgi?style=hostdetail&amp;hoststatustypes=12&amp;hostprops=2097162" target="main">Unhandled Hosts</a></li>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/status.cgi?allunhandledproblems" target="main">All Unhandled Problems</a></li>
<li class="menuli_style2"><a href="/cgi-bin/icinga2-classicui/status.cgi?allproblems" target="main">All Problems</a></li>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/outages.cgi" target="main">Network Outages</a></li>
</ul>
<h2>System</h2>
<ul>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/extinfo.cgi?type=3" target="main">Comments</a></li>
<li class="menuli_style2"><a href="/cgi-bin/icinga2-classicui/extinfo.cgi?type=6" target="main">Downtime</a></li>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/extinfo.cgi?type=0" target="main">Process Info</a></li>
<li class="menuli_style2"><a href="/cgi-bin/icinga2-classicui/extinfo.cgi?type=4" target="main">Performance Info</a></li>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/extinfo.cgi?type=7" target="main">Scheduling Queue</a></li>
</ul>
<h2>Reporting</h2>
<ul>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/trends.cgi" target="main">Trends</a></li>
<li class="menuli_style2"><a href="/cgi-bin/icinga2-classicui/avail.cgi" target="main">Availability</a></li>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/histogram.cgi" target="main">Alert Histogram</a></li>
<li class="menuli_style2"><a href="/cgi-bin/icinga2-classicui/history.cgi?host=all" target="main">Alert History</a></li>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/summary.cgi" target="main">Alert Summary</a></li>
<li class="menuli_style2"><a href="/cgi-bin/icinga2-classicui/notifications.cgi?contact=all" target="main">Notifications</a></li>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/showlog.cgi" target="main">Event Log</a></li>
</ul>
<h2>Configuration</h2>
<ul>
<li class="menuli_style1"><a href="/cgi-bin/icinga2-classicui/config.cgi" target="main">View Config</a></li>
</ul>
</div>
<script type="text/javascript" src="autocomplete.js"></script>
</body>
</html>
icinga2 (2.2.0-1) unstable; urgency=medium
To protect sensitive configuration files of icinga2
the configuration files for classicui were moved to
/etc/icinga2-classicui.
-- Alexander Wirt <formorer@debian.org> Thu, 20 Nov 2014 21:41:55 +0100
#!/bin/sh
set -e
. /usr/share/debconf/confmodule
db_fget icinga2-classicui/adminpassword seen || true
password_seen="$RET"
if [ "$1" = "reconfigure" ]; then
password_seen=false
fi
if [ "$password_seen" != "true" ]; then
# the passwords are reset at the end of every postinst run,
# however, they are left in the "seen" state so that the
# admin is not prompted for them at every upgrade.
while [ ! "$passwordsmatch" ]; do
#only ask for a password if no htpasswd exists
db_input high icinga2-classicui/adminpassword || true
db_input high icinga2-classicui/adminpassword-repeat || true
db_go || true
db_get icinga2-classicui/adminpassword
p1="$RET"
db_get icinga2-classicui/adminpassword-repeat
p2="$RET"
if [ "$p1" = "$p2" ]; then
passwordsmatch="yes"
else
db_fset icinga2-classicui/adminpassword seen false
db_fset icinga2-classicui/adminpassword-repeat seen false
db_fset icinga2-classicui/adminpassword-mismatch seen false
db_input critical icinga2-classicui/adminpassword-mismatch || true
fi
done
fi
db_go || true
usr/share/icinga2/classicui
etc/icinga2-classicui
debian/classicui/*.html usr/share/icinga2/classicui
debian/classicui/*.js usr/share/icinga2/classicui
debian/classicui/apache2.conf etc/icinga2-classicui
debian/classicui/cgi.cfg etc/icinga2-classicui
etc/icinga/stylesheets etc/icinga2-classicui/stylesheets
etc/icinga2-classicui/apache2.conf etc/apache2/conf-available/icinga2-classicui.conf
usr/lib/cgi-bin/icinga usr/lib/cgi-bin/icinga2-classicui
#usr/share/icinga/htdocs/docs usr/share/icinga2/classicui/docs
usr/share/icinga/htdocs/images usr/share/icinga2/classicui/images
usr/share/icinga/htdocs/jquery-ui usr/share/icinga2/classicui/jquery-ui
usr/share/icinga/htdocs/jquery-ui-addon usr/share/icinga2/classicui/jquery-ui-addon
usr/share/icinga/htdocs/js usr/share/icinga2/classicui/js
usr/share/icinga/htdocs/main.html usr/share/icinga2/classicui/main.html
usr/share/icinga/htdocs/media usr/share/icinga2/classicui/media
usr/share/icinga/htdocs/ssi usr/share/icinga2/classicui/ssi
# ignoring apache2 warning
# this is actually not a problem, because the handling is backwards compatible
apache2-reverse-dependency-calls-invoke-rc.d postrm
apache2-reverse-dependency-calls-wrapper-script postinst a2enmod
apache2-reverse-dependency-calls-invoke-rc.d postinst
# backwards compat for allow from all
apache2-deprecated-auth-config Order
apache2-deprecated-auth-config Allow
#!/bin/sh
# postinst script for icinga2-classicui
set -e
. /usr/share/debconf/confmodule
# shorthand
en="/etc/icinga2-classicui"
# location of the default apache configuration for icinga
apacheconf=$en/apache2.conf
# location of the default htpasswd authentication file.
htpw=$en/htpasswd.users
setperm() {
user="$1"
group="$2"
mode="$3"
file="$4"
shift 4
# only do something when no setting exists
if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then
chown "$user":"$group" "$file"
chmod "$mode" "$file"
fi
}
is_fresh_install()
{
if [ -z "$2" ] ; then
return 0
fi
return 1
}
enable_features_for_classic() {
if is_fresh_install $@; then
echo "enabling icinga2 features for classicui"
icinga2 feature enable compatlog statusdata command
echo "reloading icinga2"
[ -x $(which invoke-rc.d) ] && invoke-rc.d icinga2 reload
fi
# handle new default features here in the future
}
case "$1" in
configure)
enable_features_for_classic $@
dpkg-maintscript-helper mv_conffile \
/etc/icinga2/classicui/apache2.conf \
/etc/icinga2-classicui/apache2.conf 2.2.0-1~ icinga2-classicui -- "$@"
dpkg-maintscript-helper mv_conffile /etc/icinga2/classicui/cgi.cfg \
/etc/icinga2-classicui/cgi.cfg 2.2.0-1~ icinga2-classicui -- "$@"
if [ -f '/etc/icinga2/classicui/htpasswd.users' ] && [ ! -f '/etc/icinga2-classicui/htpasswd.users' ];
then
echo "Move classicui password file to new location"
mv -f /etc/icinga2/classicui/htpasswd.users \
/etc/icinga2-classicui/htpasswd.users
rmdir /etc/icinga2/classicui || true
fi
echo "enabling Apache2 config..."
COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
# NEW method for Apache >= 2.4
if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke enmod cgi
apache2_invoke enconf icinga2-classicui
# OLD methods for Apache < 2.4
elif [ "$COMMON_STATE" = "installed" ] || [ "$COMMON_STATE" = "unpacked" ] ; then
a2enmod cgi
# create symlink if not existing
[ -e /etc/apache2/conf.d/icinga2-classicui.conf ] || ln -vs $en/apache2.conf /etc/apache2/conf.d/icinga2-classicui.conf
# reload webserver
[ -x $(which invoke-rc.d) ] && invoke-rc.d apache2 reload
fi
# check for an old symlink to the stylesheets
test -L /etc/icinga2/classicui/stylesheets && rm \
/etc/icinga2/classicui/stylesheets && rmdir /etc/icinga2/classicui || true
###
# Admin password
###
db_get icinga2-classicui/adminpassword
admpass="$RET"
test -f "$htpw" || touch "$htpw"
setperm root www-data 0640 "$htpw"
# we reset the password every run, so if it exists we're running
# after being specifically given a password and can unconditionally set it.
# XXX there's no way of setting the pw w/out giving it on the cmdline? wtf?
if [ -n "$admpass" ]; then
#unfortunatly that method only works with 2.4
if htpasswd 2>&1 | grep -q ' -i'; then
echo "$admpass" | htpasswd -i "$htpw" icingaadmin
else
htpasswd -b "$htpw" icingaadmin "$admpass"
fi
fi
# everything went well, so now let's reset the password
db_set icinga2-classicui/adminpassword ""
db_set icinga2-classicui/adminpassword-repeat ""
# ... done with debconf here
db_stop
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
init_failed ()
{
echo "Icinga 2 was unable to start due to configuration errors.";
echo "Please fix them and manually restart the icinga2 daemon using";
echo " ´service icinga2 start´";
}
#DEBHELPER#
exit 0
#!/bin/sh
# postrm script for icinga2-common
set -e