--- lilac-1.0.2.orig/docs/SETUP.sudo
+++ lilac-1.0.2/docs/SETUP.sudo
@@ -0,0 +1,5 @@
+www-data ALL=(ALL) NOPASSWD: /usr/bin/nmap
+www-data ALL=(ALL) NOPASSWD: /usr/sbin/nagios3
+www-data ALL=(ALL) NOPASSWD: /etc/init.d/nagios3 restart
+www-data ALL=(ALL) NOPASSWD: /etc/init.d/nagios3 reload
+
--- lilac-1.0.2.orig/debian/preinst.ex
+++ lilac-1.0.2/debian/preinst.ex
@@ -0,0 +1,37 @@
+#!/bin/sh
+# preinst script for lilac
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <new-preinst> `install'
+#        * <new-preinst> `install' <old-version>
+#        * <new-preinst> `upgrade' <old-version>
+#        * <old-preinst> `abort-upgrade' <new-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    install|upgrade)
+    ;;
+
+    abort-upgrade)
+    ;;
+
+    *)
+        echo "preinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
--- lilac-1.0.2.orig/debian/watch
+++ lilac-1.0.2/debian/watch
@@ -0,0 +1,23 @@
+# Example watch control file for uscan
+# Rename this file to "watch" and then you can run the "uscan" command
+# to check for upstream updates and more.
+# See uscan(1) for format
+
+# Compulsory line, this is a version 3 file
+version=3
+
+# Uncomment to examine a Webpage
+# <Webpage URL> <string match>
+http://www.lilacplatform.com/downloads lilac-(.*)\.tar\.gz
+
+# Uncomment to examine a Webserver directory
+#http://www.example.com/pub/lilac-(.*)\.tar\.gz
+
+# Uncommment to examine a FTP server
+#ftp://ftp.example.com/pub/lilac-(.*)\.tar\.gz debian uupdate
+
+# Uncomment to find new files on sourceforge, for devscripts >= 2.9
+# http://sf.net/lilac/lilac-(.*)\.tar\.gz
+
+# Uncomment to find new files on GooglePages
+# http://example.googlepages.com/foo.html lilac-(.*)\.tar\.gz
--- lilac-1.0.2.orig/debian/control
+++ lilac-1.0.2/debian/control
@@ -0,0 +1,18 @@
+Source: lilac
+Section: net
+Priority: extra
+Maintainer: James A. Pattie <pattieja1@yahoo.com>
+Build-Depends: debhelper (>= 7)
+Standards-Version: 3.7.3
+Homepage: http://www.lilacplatform.com/
+
+Package: lilac
+Architecture: all
+Depends: apache2, php5-cli (>= 5.2.0), libapache2-mod-php5 (>= 5.2.0), php5-curl (>= 5.2.0), php5-mysql (>= 5.2.0), php-pear (>= 5.2.0), mysql-server-5.0, mysql-client-5.0, nmap, sudo, nagios3, nsca, nagios-plugins, nagios-images
+Suggests: nagios-nrpe-plugin, nagios-statd-plugin, nagios-snmp-plugins
+Description: lilac is a nagios 3.x web configuration gui
+ lilac provides a nagios 3.x web configuration gui written in php5.
+ The configuration is stored in a MySQL database and can be exported
+ for use in nagios 3.x at any time.  You can import existing nagios
+ 2.x or 3.x config files and can also do auto discovery of services
+ and hosts to populate your configuration file.
--- lilac-1.0.2.orig/debian/changelog
+++ lilac-1.0.2/debian/changelog
@@ -0,0 +1,77 @@
+lilac (1.0.2-12) unstable; urgency=low
+
+  * Fixed the Host and Service nagios importer where it was losing the last
+    entry in a definition due to the variable specified by &$ in the foreach
+    loop not being unset and then being re-used again.
+
+ -- James A. Pattie <pattieja1@yahoo.com>  Fri, 12 Jun 2009 13:41:40 -0700
+
+lilac (1.0.2-11) unstable; urgency=low
+
+  * Removing /var/spool/nagios3 for the checkresults directory.
+  * Updated the sql seed info with all the correct debian paths.
+
+ -- James A. Pattie <pattieja1@yahoo.com>  Thu, 11 Jun 2009 15:04:40 -0700
+
+lilac (1.0.2-10) unstable; urgency=low
+
+  * Adding /var/spool/nagios3 for the checkresults directory.
+
+ -- James A. Pattie <pattieja1@yahoo.com>  Wed, 10 Jun 2009 14:52:40 -0700
+
+lilac (1.0.2-9) unstable; urgency=low
+
+  * Make sure www-data owns /etc/nagios3 so we can do backups, etc.
+
+ -- James A. Pattie <pattieja1@yahoo.com>  Wed, 10 Jun 2009 14:46:40 -0700
+
+lilac (1.0.2-8) unstable; urgency=low
+
+  * Adding /etc/nagios3/lilac-backup and making it so apache can write to it.
+
+ -- James A. Pattie <pattieja1@yahoo.com>  Wed, 10 Jun 2009 14:34:40 -0700
+
+lilac (1.0.2-7) unstable; urgency=low
+
+  * Fixed up all the sample sql seed data to point to the valid Debian paths.
+
+ -- James A. Pattie <pattieja1@yahoo.com>  Wed, 10 Jun 2009 14:27:40 -0700
+
+lilac (1.0.2-6) unstable; urgency=low
+
+  * Add code to postinst to fix the php.ini settings.
+
+ -- James A. Pattie <pattieja1@yahoo.com>  Wed, 10 Jun 2009 13:03:40 -0700
+
+lilac (1.0.2-5) unstable; urgency=low
+
+  * Fix postinst to not blowup on return codes = 0 from shell commands.
+
+ -- James A. Pattie <pattieja1@yahoo.com>  Wed, 10 Jun 2009 12:51:40 -0700
+
+lilac (1.0.2-4) unstable; urgency=low
+
+  * Changed Recommends to Suggests.
+
+ -- James A. Pattie <pattieja1@yahoo.com>  Wed, 10 Jun 2009 12:44:40 -0700
+
+lilac (1.0.2-3) unstable; urgency=low
+
+  * Automated the configuration of sudo and told the user how to check it.
+
+ -- James A. Pattie <pattieja1@yahoo.com>  Wed, 10 Jun 2009 12:37:40 -0700
+
+lilac (1.0.2-2) unstable; urgency=low
+
+  * Adding dependancy on sudo, nagios3, etc.
+  * Checking to see if sudo is configured and telling the user what to do to
+    set it up.
+
+ -- James A. Pattie <pattieja1@yahoo.com>  Wed, 10 Jun 2009 12:07:40 -0700
+
+lilac (1.0.2-1) unstable; urgency=low
+
+  * Initial release
+
+ -- James A. Pattie <pattieja1@yahoo.com>  Wed, 10 Jun 2009 10:52:40 -0700
+
--- lilac-1.0.2.orig/debian/postinst
+++ lilac-1.0.2/debian/postinst
@@ -0,0 +1,94 @@
+#!/bin/sh
+# postinst script for lilac
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    configure)
+	chown www-data:www-data /var/www/lilac/includes
+
+	# make sure lilac can backup exported configurations.
+	mkdir -p /etc/nagios3/lilac-backups
+	chown -R www-data:nagios /etc/nagios3/lilac-backups
+	chmod 750 /etc/nagios3/lilac-backups
+
+	# make sure that apache can see the nagios config files so lilac can do a backup.
+	chown -R www-data /etc/nagios3
+
+	# check and see if sudo is configured.
+	set +e
+	CONFIGURED=`grep nagios /etc/sudoers`
+	if [ -z "${CONFIGURED}" ]
+	then
+		echo "" >> /etc/sudoers
+		echo "# lilac sudo configuration" >> /etc/sudoers
+		cat /usr/share/doc/lilac/SETUP.sudo >> /etc/sudoers
+		echo "You need to make sure sudo likes the changes I just made by running the visudo command and exiting the editor!"
+		echo
+	fi
+
+	# check the php settings
+	PHP_CHANGED=0
+	QUOTES=`grep magic_quotes_gpc /etc/php5/apache2/php.ini | cut -d ' ' -f 3`
+	if [ $QUOTES = "On" ]
+	then
+		echo "Turning magic_quotes_gpc OFF in php5 apache2 php.ini file..."
+		perl -pi -e 's/(magic_quotes_gpc\s+=)\s+(On)/$1 Off/i' /etc/php5/apache2/php.ini
+		PHP_CHANGED=1
+	fi
+	QUOTES=`grep magic_quotes_gpc /etc/php5/cli/php.ini | cut -d ' ' -f 3`
+	if [ $QUOTES = "On" ]
+	then
+		echo "Turning magic_quotes_gpc OFF in php5 cli php.ini file..."
+		perl -pi -e 's/(magic_quotes_gpc\s+=)\s+(On)/$1 Off/i' /etc/php5/cli/php.ini
+		PHP_CHANGED=1
+	fi
+	MEMORY=`grep memory_limit /etc/php5/cli/php.ini | cut -d ' ' -f 3`
+	if [ $MEMORY != "-1" ]
+	then
+		echo "Setting memory limit to unlimited (-1) in php5 cli php.ini file..."
+		perl -pi -e 's/(memory_limit\s+=)\s+([^\s]+)/$1 -1/i' /etc/php5/cli/php.ini
+		PHP_CHANGED=1
+	fi
+	if [ $PHP_CHANGED -eq 1 ]
+	then
+		echo "Restarting apache2 so php changes take affect..."
+		/etc/init.d/apache2 restart
+	fi
+	set -e
+	HOSTNAME=`/bin/hostname -f`
+	echo "You need to finish the installation by surfing to http://${HOSTNAME}/lilac/install.php"
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
--- lilac-1.0.2.orig/debian/prerm.ex
+++ lilac-1.0.2/debian/prerm.ex
@@ -0,0 +1,40 @@
+#!/bin/sh
+# prerm script for lilac
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <prerm> `remove'
+#        * <old-prerm> `upgrade' <new-version>
+#        * <new-prerm> `failed-upgrade' <old-version>
+#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
+#        * <deconfigured's-prerm> `deconfigure' `in-favour'
+#          <package-being-installed> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    remove|upgrade|deconfigure)
+    ;;
+
+    failed-upgrade)
+    ;;
+
+    *)
+        echo "prerm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
--- lilac-1.0.2.orig/debian/postrm.ex
+++ lilac-1.0.2/debian/postrm.ex
@@ -0,0 +1,39 @@
+#!/bin/sh
+# postrm script for lilac
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <overwriter>
+#          <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    ;;
+
+    *)
+        echo "postrm called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
+
--- lilac-1.0.2.orig/debian/docs
+++ lilac-1.0.2/debian/docs
@@ -0,0 +1,4 @@
+docs/INSTALL
+docs/LICENSE
+docs/UPGRADING
+docs/SETUP.sudo
--- lilac-1.0.2.orig/debian/rules
+++ lilac-1.0.2/debian/rules
@@ -0,0 +1,93 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+
+
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	# Add here commands to configure the package.
+
+	touch configure-stamp
+
+
+build: build-stamp
+
+build-stamp: configure-stamp  
+	dh_testdir
+
+	# Add here commands to compile the package.
+	#$(MAKE)
+	#docbook-to-man debian/lilac.sgml > lilac.1
+
+	touch $@
+
+clean: 
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	# Add here commands to clean up after the build process.
+	#$(MAKE) clean
+
+	dh_clean 
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	dh_installdirs
+
+	# Add here commands to install the package into debian/lilac.
+	#$(MAKE) DESTDIR=$(CURDIR)/debian/lilac install
+	cp -ar src/* $(CURDIR)/debian/lilac/var/www/lilac/
+
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs 
+	dh_installdocs
+	dh_installexamples
+#	dh_install
+#	dh_installmenu
+#	dh_installdebconf	
+#	dh_installlogrotate
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installmime
+#	dh_python
+#	dh_installinit
+#	dh_installcron
+#	dh_installinfo
+#	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#	dh_perl
+#	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
--- lilac-1.0.2.orig/debian/compat
+++ lilac-1.0.2/debian/compat
@@ -0,0 +1 @@
+7
--- lilac-1.0.2.orig/debian/lilac.dirs
+++ lilac-1.0.2/debian/lilac.dirs
@@ -0,0 +1 @@
+/var/www/lilac
--- lilac-1.0.2.orig/debian/README.Debian
+++ lilac-1.0.2/debian/README.Debian
@@ -0,0 +1,8 @@
+lilac for Debian
+----------------
+
+The original package was modified so that the php source is now in a src
+subdirectory, documentation files are in doc and the necessary debianization
+files are in debian.  This has initially been packaged for Debian Lenny.
+
+ -- James A. Pattie <pattieja1@yahoo.com>  Wed, 10 Jun 2009 10:52:40 -0700
--- lilac-1.0.2.orig/debian/copyright
+++ lilac-1.0.2/debian/copyright
@@ -0,0 +1,35 @@
+This package was debianized by James A. Pattie <pattieja1@yahoo.com> on
+Wed, 10 Jun 2009 10:52:40 -0700.
+
+It was downloaded from http://www.lilacplatform.com/
+
+Upstream Author(s):
+
+    Lilac Networks (http://www.lilacnetworks.com/)
+
+Copyright:
+
+    Copyright (C) 2009 Lilac Networks
+
+License:
+
+    This package is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This package is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this package; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2009, James A. Pattie <pattieja1@yahoo.com> and
+is licensed under the GPL, see above.
+
--- lilac-1.0.2.orig/src/sqldata/seed.sql
+++ lilac-1.0.2/src/sqldata/seed.sql
@@ -121,7 +121,7 @@
 
 LOCK TABLES `nagios_cgi_configuration` WRITE;
 /*!40000 ALTER TABLE `nagios_cgi_configuration` DISABLE KEYS */;
-INSERT INTO `nagios_cgi_configuration` (`id`, `physical_html_path`, `url_html_path`, `use_authentication`, `default_user_name`, `authorized_for_system_information`, `authorized_for_system_commands`, `authorized_for_configuration_information`, `authorized_for_all_hosts`, `authorized_for_all_host_commands`, `authorized_for_all_services`, `authorized_for_all_service_commands`, `lock_author_names`, `statusmap_background_image`, `default_statusmap_layout`, `statuswrl_include`, `default_statuswrl_layout`, `refresh_rate`, `host_unreachable_sound`, `host_down_sound`, `service_critical_sound`, `service_warning_sound`, `service_unknown_sound`, `ping_syntax`, `escape_html_tags`, `notes_url_target`, `action_url_target`, `enable_splunk_integration`, `splunk_url`) VALUES (2,'/home/tdondich/apps/share','/nagios',1,NULL,'nagiosadmin','nagiosadmin','nagiosadmin','nagiosadmin','nagiosadmin','nagiosadmin','nagiosadmin',NULL,NULL,5,NULL,4,90,NULL,NULL,NULL,NULL,NULL,'/bin/ping -n -U -c 5 $HOSTADDRESS$',NULL,NULL,NULL,NULL,NULL);
+INSERT INTO `nagios_cgi_configuration` (`id`, `physical_html_path`, `url_html_path`, `use_authentication`, `default_user_name`, `authorized_for_system_information`, `authorized_for_system_commands`, `authorized_for_configuration_information`, `authorized_for_all_hosts`, `authorized_for_all_host_commands`, `authorized_for_all_services`, `authorized_for_all_service_commands`, `lock_author_names`, `statusmap_background_image`, `default_statusmap_layout`, `statuswrl_include`, `default_statuswrl_layout`, `refresh_rate`, `host_unreachable_sound`, `host_down_sound`, `service_critical_sound`, `service_warning_sound`, `service_unknown_sound`, `ping_syntax`, `escape_html_tags`, `notes_url_target`, `action_url_target`, `enable_splunk_integration`, `splunk_url`) VALUES (2,'/usr/share/nagios3/htdocs','/nagios3',1,NULL,'nagiosadmin','nagiosadmin','nagiosadmin','nagiosadmin','nagiosadmin','nagiosadmin','nagiosadmin',NULL,NULL,5,NULL,4,90,NULL,NULL,NULL,NULL,NULL,'/bin/ping -n -U -c 5 $HOSTADDRESS$',NULL,NULL,NULL,NULL,NULL);
 /*!40000 ALTER TABLE `nagios_cgi_configuration` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -131,7 +131,7 @@
 
 LOCK TABLES `nagios_command` WRITE;
 /*!40000 ALTER TABLE `nagios_command` DISABLE KEYS */;
-INSERT INTO `nagios_command` (`id`, `name`, `line`, `description`) VALUES (25,'notify-host-by-email','/usr/bin/printf \"%b\" \"***** Nagios *****\\n\\nNotification Type: $NOTIFICATIONTYPE$\\nHost: $HOSTNAME$\\nState: $HOSTSTATE$\\nAddress: $HOSTADDRESS$\\nInfo: $HOSTOUTPUT$\\n\\nDate/Time: $LONGDATETIME$\\n\" | /usr/bin/mail -s \"** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **\" $CONTACTEMAIL$',NULL),(26,'notify-service-by-email','/usr/bin/printf \"%b\" \"***** Nagios *****\\n\\nNotification Type: $NOTIFICATIONTYPE$\\n\\nService: $SERVICEDESC$\\nHost: $HOSTALIAS$\\nAddress: $HOSTADDRESS$\\nState: $SERVICESTATE$\\n\\nDate/Time: $LONGDATETIME$\\n\\nAdditional Info:\\n\\n$SERVICEOUTPUT$\" | /usr/bin/mail -s \"** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **\" $CONTACTEMAIL$',NULL),(27,'check-host-alive','$USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5',NULL),(28,'check_local_disk','$USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$',NULL),(29,'check_local_load','$USER1$/check_load -w $ARG1$ -c $ARG2$',NULL),(30,'check_local_procs','$USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$',NULL),(31,'check_local_users','$USER1$/check_users -w $ARG1$ -c $ARG2$',NULL),(32,'check_local_swap','$USER1$/check_swap -w $ARG1$ -c $ARG2$',NULL),(33,'check_local_mrtgtraf','$USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$',NULL),(34,'check_ftp','$USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$',NULL),(35,'check_hpjd','$USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$',NULL),(36,'check_snmp','$USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$',NULL),(37,'check_http','$USER1$/check_http -I $HOSTADDRESS$ $ARG1$',NULL),(38,'check_ssh','$USER1$/check_ssh $ARG1$ $HOSTADDRESS$',NULL),(39,'check_dhcp','$USER1$/check_dhcp $ARG1$',NULL),(40,'check_ping','$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5',NULL),(41,'check_pop','$USER1$/check_pop -H $HOSTADDRESS$ $ARG1$',NULL),(42,'check_imap','$USER1$/check_imap -H $HOSTADDRESS$ $ARG1$',NULL),(43,'check_smtp','$USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$',NULL),(44,'check_tcp','$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$',NULL),(45,'check_udp','$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$',NULL),(46,'check_nt','$USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$',NULL),(47,'process-host-perfdata','/usr/bin/printf \"%b\" \"$LASTHOSTCHECK$\\t$HOSTNAME$\\t$HOSTSTATE$\\t$HOSTATTEMPT$\\t$HOSTSTATETYPE$\\t$HOSTEXECUTIONTIME$\\t$HOSTOUTPUT$\\t$HOSTPERFDATA$\\n\" >> /home/tdondich/apps/var/host-perfdata.out',NULL),(48,'process-service-perfdata','/usr/bin/printf \"%b\" \"$LASTSERVICECHECK$\\t$HOSTNAME$\\t$SERVICEDESC$\\t$SERVICESTATE$\\t$SERVICEATTEMPT$\\t$SERVICESTATETYPE$\\t$SERVICEEXECUTIONTIME$\\t$SERVICELATENCY$\\t$SERVICEOUTPUT$\\t$SERVICEPERFDATA$\\n\" >> /home/tdondich/apps/var/service-perfdata.out',NULL);
+INSERT INTO `nagios_command` (`id`, `name`, `line`, `description`) VALUES (25,'notify-host-by-email','/usr/bin/printf \"%b\" \"***** Nagios *****\\n\\nNotification Type: $NOTIFICATIONTYPE$\\nHost: $HOSTNAME$\\nState: $HOSTSTATE$\\nAddress: $HOSTADDRESS$\\nInfo: $HOSTOUTPUT$\\n\\nDate/Time: $LONGDATETIME$\\n\" | /usr/bin/mail -s \"** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **\" $CONTACTEMAIL$',NULL),(26,'notify-service-by-email','/usr/bin/printf \"%b\" \"***** Nagios *****\\n\\nNotification Type: $NOTIFICATIONTYPE$\\n\\nService: $SERVICEDESC$\\nHost: $HOSTALIAS$\\nAddress: $HOSTADDRESS$\\nState: $SERVICESTATE$\\n\\nDate/Time: $LONGDATETIME$\\n\\nAdditional Info:\\n\\n$SERVICEOUTPUT$\" | /usr/bin/mail -s \"** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **\" $CONTACTEMAIL$',NULL),(27,'check-host-alive','$USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5',NULL),(28,'check_local_disk','$USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$',NULL),(29,'check_local_load','$USER1$/check_load -w $ARG1$ -c $ARG2$',NULL),(30,'check_local_procs','$USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$',NULL),(31,'check_local_users','$USER1$/check_users -w $ARG1$ -c $ARG2$',NULL),(32,'check_local_swap','$USER1$/check_swap -w $ARG1$ -c $ARG2$',NULL),(33,'check_local_mrtgtraf','$USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$',NULL),(34,'check_ftp','$USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$',NULL),(35,'check_hpjd','$USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$',NULL),(36,'check_snmp','$USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$',NULL),(37,'check_http','$USER1$/check_http -I $HOSTADDRESS$ $ARG1$',NULL),(38,'check_ssh','$USER1$/check_ssh $ARG1$ $HOSTADDRESS$',NULL),(39,'check_dhcp','$USER1$/check_dhcp $ARG1$',NULL),(40,'check_ping','$USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5',NULL),(41,'check_pop','$USER1$/check_pop -H $HOSTADDRESS$ $ARG1$',NULL),(42,'check_imap','$USER1$/check_imap -H $HOSTADDRESS$ $ARG1$',NULL),(43,'check_smtp','$USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$',NULL),(44,'check_tcp','$USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$',NULL),(45,'check_udp','$USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$',NULL),(46,'check_nt','$USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$',NULL),(47,'process-host-perfdata','/usr/bin/printf \"%b\" \"$LASTHOSTCHECK$\\t$HOSTNAME$\\t$HOSTSTATE$\\t$HOSTATTEMPT$\\t$HOSTSTATETYPE$\\t$HOSTEXECUTIONTIME$\\t$HOSTOUTPUT$\\t$HOSTPERFDATA$\\n\" >> /var/cache/nagios3/host-perfdata.out',NULL),(48,'process-service-perfdata','/usr/bin/printf \"%b\" \"$LASTSERVICECHECK$\\t$HOSTNAME$\\t$SERVICEDESC$\\t$SERVICESTATE$\\t$SERVICEATTEMPT$\\t$SERVICESTATETYPE$\\t$SERVICEEXECUTIONTIME$\\t$SERVICELATENCY$\\t$SERVICEOUTPUT$\\t$SERVICEPERFDATA$\\n\" >> /var/cache/nagios3/service-perfdata.out',NULL);
 /*!40000 ALTER TABLE `nagios_command` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -331,7 +331,7 @@
 
 LOCK TABLES `nagios_main_configuration` WRITE;
 /*!40000 ALTER TABLE `nagios_main_configuration` DISABLE KEYS */;
-INSERT INTO `nagios_main_configuration` (`id`, `config_dir`, `log_file`, `temp_file`, `status_file`, `status_update_interval`, `nagios_user`, `nagios_group`, `enable_notifications`, `execute_service_checks`, `accept_passive_service_checks`, `enable_event_handlers`, `log_rotation_method`, `log_archive_path`, `check_external_commands`, `command_check_interval`, `command_file`, `lock_file`, `retain_state_information`, `state_retention_file`, `retention_update_interval`, `use_retained_program_state`, `use_syslog`, `log_notifications`, `log_service_retries`, `log_host_retries`, `log_event_handlers`, `log_initial_states`, `log_external_commands`, `log_passive_checks`, `global_host_event_handler`, `global_service_event_handler`, `external_command_buffer_slots`, `sleep_time`, `service_interleave_factor`, `max_concurrent_checks`, `service_reaper_frequency`, `interval_length`, `use_aggressive_host_checking`, `enable_flap_detection`, `low_service_flap_threshold`, `high_service_flap_threshold`, `low_host_flap_threshold`, `high_host_flap_threshold`, `soft_state_dependencies`, `service_check_timeout`, `host_check_timeout`, `event_handler_timeout`, `notification_timeout`, `ocsp_timeout`, `ohcp_timeout`, `perfdata_timeout`, `obsess_over_services`, `ocsp_command`, `process_performance_data`, `check_for_orphaned_services`, `check_service_freshness`, `freshness_check_interval`, `date_format`, `illegal_object_name_chars`, `illegal_macro_output_chars`, `admin_email`, `admin_pager`, `execute_host_checks`, `service_inter_check_delay_method`, `use_retained_scheduling_info`, `accept_passive_host_checks`, `max_service_check_spread`, `host_inter_check_delay_method`, `max_host_check_spread`, `auto_reschedule_checks`, `auto_rescheduling_interval`, `auto_rescheduling_window`, `ochp_timeout`, `obsess_over_hosts`, `ochp_command`, `check_host_freshness`, `host_freshness_check_interval`, `service_freshness_check_interval`, `use_regexp_matching`, `use_true_regexp_matching`, `event_broker_options`, `daemon_dumps_core`, `host_perfdata_command`, `service_perfdata_command`, `host_perfdata_file`, `host_perfdata_file_template`, `service_perfdata_file`, `service_perfdata_file_template`, `host_perfdata_file_mode`, `service_perfdata_file_mode`, `host_perfdata_file_processing_command`, `service_perfdata_file_processing_command`, `host_perfdata_file_processing_interval`, `service_perfdata_file_processing_interval`, `object_cache_file`, `precached_object_file`, `retained_host_attribute_mask`, `retained_service_attribute_mask`, `retained_process_host_attribute_mask`, `retained_process_service_attribute_mask`, `retained_contact_host_attribute_mask`, `retained_contact_service_attribute_mask`, `check_result_reaper_frequency`, `max_check_result_reaper_time`, `check_result_path`, `max_check_result_file_age`, `translate_passive_host_checks`, `passive_host_checks_are_soft`, `enable_predictive_host_dependency_checks`, `enable_predictive_service_dependency_checks`, `cached_host_check_horizon`, `cached_service_check_horizon`, `use_large_installation_tweaks`, `free_child_process_memory`, `child_processes_fork_twice`, `enable_environment_macros`, `additional_freshness_latency`, `enable_embedded_perl`, `use_embedded_perl_implicitly`, `p1_file`, `use_timezone`, `debug_file`, `debug_level`, `debug_verbosity`, `max_debug_file_size`) VALUES (2,'/home/tdondich/apps/etc','/home/tdondich/apps/var/nagios.log','/home/tdondich/apps/var/nagios.tmp','/home/tdondich/apps/var/status.dat',10,'nagios','nagios',1,1,1,1,'d','/home/tdondich/apps/var/archives',1,'-1','/home/tdondich/apps/var/rw/nagios.cmd','/home/tdondich/apps/var/nagios.lock',1,'/home/tdondich/apps/var/retention.dat',60,1,1,1,1,1,1,0,1,1,NULL,NULL,4096,0.25,'s',0,NULL,60,0,1,5,20,5,20,0,60,30,30,30,5,NULL,5,0,NULL,0,1,1,NULL,'us','()=','`~$&|\'\"<>','nagios@localhost','pagenagios@localhost',1,'s',1,1,30,'s',30,0,30,180,NULL,0,NULL,0,60,60,0,0,'-1',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'/home/tdondich/apps/var/objects.cache','/home/tdondich/apps/var/objects.precache',0,0,0,0,0,0,10,30,'/home/tdondich/apps/var/spool/checkresults',3600,0,0,1,1,15,15,0,NULL,NULL,1,15,1,1,'/home/tdondich/apps/bin/p1.pl',NULL,'/home/tdondich/apps/var/nagios.debug',0,1,1000000);
+INSERT INTO `nagios_main_configuration` (`id`, `config_dir`, `log_file`, `temp_file`, `status_file`, `status_update_interval`, `nagios_user`, `nagios_group`, `enable_notifications`, `execute_service_checks`, `accept_passive_service_checks`, `enable_event_handlers`, `log_rotation_method`, `log_archive_path`, `check_external_commands`, `command_check_interval`, `command_file`, `lock_file`, `retain_state_information`, `state_retention_file`, `retention_update_interval`, `use_retained_program_state`, `use_syslog`, `log_notifications`, `log_service_retries`, `log_host_retries`, `log_event_handlers`, `log_initial_states`, `log_external_commands`, `log_passive_checks`, `global_host_event_handler`, `global_service_event_handler`, `external_command_buffer_slots`, `sleep_time`, `service_interleave_factor`, `max_concurrent_checks`, `service_reaper_frequency`, `interval_length`, `use_aggressive_host_checking`, `enable_flap_detection`, `low_service_flap_threshold`, `high_service_flap_threshold`, `low_host_flap_threshold`, `high_host_flap_threshold`, `soft_state_dependencies`, `service_check_timeout`, `host_check_timeout`, `event_handler_timeout`, `notification_timeout`, `ocsp_timeout`, `ohcp_timeout`, `perfdata_timeout`, `obsess_over_services`, `ocsp_command`, `process_performance_data`, `check_for_orphaned_services`, `check_service_freshness`, `freshness_check_interval`, `date_format`, `illegal_object_name_chars`, `illegal_macro_output_chars`, `admin_email`, `admin_pager`, `execute_host_checks`, `service_inter_check_delay_method`, `use_retained_scheduling_info`, `accept_passive_host_checks`, `max_service_check_spread`, `host_inter_check_delay_method`, `max_host_check_spread`, `auto_reschedule_checks`, `auto_rescheduling_interval`, `auto_rescheduling_window`, `ochp_timeout`, `obsess_over_hosts`, `ochp_command`, `check_host_freshness`, `host_freshness_check_interval`, `service_freshness_check_interval`, `use_regexp_matching`, `use_true_regexp_matching`, `event_broker_options`, `daemon_dumps_core`, `host_perfdata_command`, `service_perfdata_command`, `host_perfdata_file`, `host_perfdata_file_template`, `service_perfdata_file`, `service_perfdata_file_template`, `host_perfdata_file_mode`, `service_perfdata_file_mode`, `host_perfdata_file_processing_command`, `service_perfdata_file_processing_command`, `host_perfdata_file_processing_interval`, `service_perfdata_file_processing_interval`, `object_cache_file`, `precached_object_file`, `retained_host_attribute_mask`, `retained_service_attribute_mask`, `retained_process_host_attribute_mask`, `retained_process_service_attribute_mask`, `retained_contact_host_attribute_mask`, `retained_contact_service_attribute_mask`, `check_result_reaper_frequency`, `max_check_result_reaper_time`, `check_result_path`, `max_check_result_file_age`, `translate_passive_host_checks`, `passive_host_checks_are_soft`, `enable_predictive_host_dependency_checks`, `enable_predictive_service_dependency_checks`, `cached_host_check_horizon`, `cached_service_check_horizon`, `use_large_installation_tweaks`, `free_child_process_memory`, `child_processes_fork_twice`, `enable_environment_macros`, `additional_freshness_latency`, `enable_embedded_perl`, `use_embedded_perl_implicitly`, `p1_file`, `use_timezone`, `debug_file`, `debug_level`, `debug_verbosity`, `max_debug_file_size`) VALUES (2,'/etc/nagios3','/var/log/nagios3/nagios.log','/var/cache/nagios3/nagios.tmp','/var/cache/nagios3/status.dat',10,'nagios','nagios',1,1,1,1,'d','/var/log/nagios3/archives',1,'-1','/var/lib/nagios3/rw/nagios.cmd','/var/run/nagios3/nagios3.pid',1,'/var/lib/nagios3/retention.dat',60,1,1,1,1,1,1,0,1,1,NULL,NULL,4096,0.25,'s',0,NULL,60,0,1,5,20,5,20,0,60,30,30,30,5,NULL,5,0,NULL,0,1,1,NULL,'us','()=','`~$&|\'\"<>','nagios@localhost','pagenagios@localhost',1,'s',1,1,30,'s',30,0,30,180,NULL,0,NULL,0,60,60,0,0,'-1',0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'/var/cache/nagios3/objects.cache','/var/lib/nagios3/objects.precache',0,0,0,0,0,0,10,30,'/var/lib/nagios3/spool/checkresults',3600,0,0,1,1,15,15,0,NULL,NULL,1,15,1,1,'/usr/lib/nagios3/p1.pl',NULL,'/var/lib/nagios3/nagios.debug',0,1,1000000);
 /*!40000 ALTER TABLE `nagios_main_configuration` ENABLE KEYS */;
 UNLOCK TABLES;
 
@@ -341,7 +341,7 @@
 
 LOCK TABLES `nagios_resource` WRITE;
 /*!40000 ALTER TABLE `nagios_resource` DISABLE KEYS */;
-INSERT INTO `nagios_resource` (`id`, `user1`, `user2`, `user3`, `user4`, `user5`, `user6`, `user7`, `user8`, `user9`, `user10`, `user11`, `user12`, `user13`, `user14`, `user15`, `user16`, `user17`, `user18`, `user19`, `user20`, `user21`, `user22`, `user23`, `user24`, `user25`, `user26`, `user27`, `user28`, `user29`, `user30`, `user31`, `user32`) VALUES (2,'/home/tdondich/apps/libexec',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+INSERT INTO `nagios_resource` (`id`, `user1`, `user2`, `user3`, `user4`, `user5`, `user6`, `user7`, `user8`, `user9`, `user10`, `user11`, `user12`, `user13`, `user14`, `user15`, `user16`, `user17`, `user18`, `user19`, `user20`, `user21`, `user22`, `user23`, `user24`, `user25`, `user26`, `user27`, `user28`, `user29`, `user30`, `user31`, `user32`) VALUES (2,'/usr/lib/nagios/plugins',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
 /*!40000 ALTER TABLE `nagios_resource` ENABLE KEYS */;
 UNLOCK TABLES;
 
--- lilac-1.0.2.orig/src/exporter/engines/nagios/NagiosExportEngine.php
+++ lilac-1.0.2/src/exporter/engines/nagios/NagiosExportEngine.php
@@ -145,7 +145,7 @@
 		// First determine, do we need to make backups?
 		if($config->getVar('backup_existing')) {
 			$mainConfiguration = NagiosMainConfigurationPeer::doSelectOne(new Criteria());
-			$backupDir = $mainConfiguration->getConfigDir() . "/" . "lilac-backup-" . date("m-d-Y-H-i");
+			$backupDir = $mainConfiguration->getConfigDir() . "/" . "lilac-backups/lilac-backup-" . date("m-d-Y-H-i");
 			$result = @mkdir($backupDir);
 			if(!$result) {
 				$job->addError("Unable to create backup directory at: " . $backupDir);
--- lilac-1.0.2.orig/src/importer/engines/nagios/NagiosImportEngine.php
+++ lilac-1.0.2/src/importer/engines/nagios/NagiosImportEngine.php
@@ -342,6 +342,7 @@
 	}
 	
 	private function buildSegmentFromConfigFile($fp, $fileName) {
+		$job = $this->getJob();
 		$segment = new NagiosImportFileSegment($fileName);
 		$counter = 0;
 		while ($line = fgets($fp)) {		// Lines better not be over 1024 characters in length
@@ -354,10 +355,12 @@
 				$values = explode(',', $regs[2]);
 				foreach($values as $val) {
 					$segment->add($counter, trim($regs[1]), trim($val), $line);
+					#$job->addNotice("DEBUG:  Found: counter=" . $counter . ", name='" . trim($regs[1]) . "', value='" . trim($val) . "', line='" . $line . "'.");
 				}
 			}
 			else {
 				$segment->add($counter, null, null, $line);
+				#$job->addNotice("DEBUG:  Found: counter=" . $counter . ", line='" . $line . "'.");
 			}
 			continue;
 		}
@@ -409,6 +412,7 @@
 		    if (preg_match('/^\s*define\s+(\S+)\s*{\s*$/', $line, $regs)) {
 		    	// Setup object name
 				$objectName = $regs[1];
+				#$importJob->addNotice("DEBUG: New FileSegement filename='" . $fileName . "'");
 				$segment = new NagiosImportFileSegment($fileName);
 				continue;
 		    }
@@ -419,6 +423,7 @@
 					$values = explode(',', $regs[2]);
 					foreach($values as $val) {
 						$segment->add($lineNumber, trim($regs[1]), trim($val), $line);
+						#$importJob->addNotice("DEBUG:  Found: lineNumber=" . $lineNumber . ", name='" . trim($regs[1]) . "', value='" . trim($val) . "', line='" . $line . "'.");
 					}
 				}
 			continue;
--- lilac-1.0.2.orig/src/importer/importers/nagios/NagiosHostImporter.php
+++ lilac-1.0.2/src/importer/importers/nagios/NagiosHostImporter.php
@@ -274,6 +274,7 @@
 				$entries = array($newEntry);
 			}
 		}
+		unset($entries);  // Break the reference.
 		foreach($values as $key => $entries) {
 			foreach($entries as $entry) {
 				// Skips
--- lilac-1.0.2.orig/src/importer/importers/nagios/NagiosServiceImporter.php
+++ lilac-1.0.2/src/importer/importers/nagios/NagiosServiceImporter.php
@@ -274,6 +274,7 @@
 				$entries = array($newEntry);
 			}
 		}
+		unset($entries);  // Remove the reference.
 		foreach($values as $key => $entries) {
 			foreach($entries as $entry) {
 				// Skips
