File manager - Edit - /home/veronikagstoette/public_html/fastcomet.tar
Back
nightwatch/debian/fastcomet-nightwatch.prerm 0000755 00000000065 15246236675 0015344 0 ustar 00 #!/bin/sh set -e invoke-rc.d nightwatch stop || true nightwatch/debian/compat 0000644 00000000002 15246236675 0011344 0 ustar 00 7 nightwatch/debian/fastcomet-nightwatch.templates 0000644 00000003640 15246236675 0016214 0 ustar 00 Template: Nightwatch/APIKey Type: string Default: Description: Please enter your Nightwatch API Key: Please enter your Nightwatch API Key. Template: Nightwatch/apache-location Type: string Default: Description: Mod_Status URL: Not really for human consumption. Template: Nightwatch/apache-try-configure Type: boolean Default: Description: Autoconfigure Mod_Status: Nightwatch has detected Apache running on this server but was unable to access the server status page. Would you like to attempt to automatically configure mod_status? This will require reloading Apache to enable. Template: Nightwatch/nginx-location Type: string Default: Description: Nginx Status URL: Not really for human consumption. Template: Nightwatch/nginx-try-configure Type: boolean Default: Description: Autoconfigure status page: Nightwatch has detected Nginx running on this server but was unable to access the server status page. Would you like to attempt to automatically configure the Nginx status module? This will require restarting Nginx to enable. Template: Nightwatch/mysql-create-creds Type: note Default: Description: Unable to automatically configure MySQL plugin: Nightwatch has detected MySQL running on this server but was unable to automatically configure the connection. To allow Nightwatch to access your MySQL instance please run the following queries: ${create_statement} FLUSH PRIVILEGES; Template: Nightwatch/mysql-overwrite-creds Type: boolean Default: Description: Overwrite existing Nightwatch MySQL config: Nightwatch has detected MySQL running on this server but was unable to log in with the provided credentials for the '${found_user}' user. However a 'debian-sys-maint' user was found, would you like to configure nightwatch to use those credentials instead? Template: Nightwatch/mysql-password Type: string Default: Description: Nightwatch Mysql user password: Not really for human consumption. nightwatch/debian/fastcomet-nightwatch.config 0000755 00000017132 15246236675 0015467 0 ustar 00 #!/bin/sh set -e nightwatch_config_dir='/etc/fastcomet/nightwatch.d/' echoerr() { echo "$@" 1>&2; } _fake_curl() { _input_url=$1 PERL_LWP_SSL_VERIFY_HOSTNAME=0 perl -MLWP::UserAgent -e '$ua=LWP::UserAgent->new(); print $ua->get("$ARGV[0]")->decoded_content;' "$1" return 0 } _check_apache_url() { _apache_url=$1 _fake_curl "$_apache_url" | grep -q 'Scoreboard:' return $? } _check_nginx_url() { _nginx_url=$1 _fake_curl "$_nginx_url" | grep -q 'server accepts handled requests' return $? } _mysql_check_install() { _mysql_username=$1 _mysql_password=$2 perl -MDBI -e "eval { local \$SIG{ALRM} = sub { die; }; alarm(5); \$dbh = DBI->connect('DBI:mysql:host=localhost', '$_mysql_username', '$_mysql_password'); exit \$DBI::err; alarm(0); }; exit 1 if \$@" return $? } apache_status_path() { echoerr "Checking Apache configuration..." apache_config_filename=${nightwatch_config_dir}Apache.conf apache_default_url='http://127.0.0.1/server-status?auto' apache_default_https='https://127.0.0.1/server-status?auto' apache_url=$(grep '^location' $apache_config_filename | tail -n1 | awk '{print $2}') # use the url if it exists if [ ! -z $apache_url ]; then if _check_apache_url $apache_url ; then echoerr "Found Apache status page at $apache_url specified in $apache_config_filename" db_set Nightwatch/apache-location "" return 0 elif [ "$apache_url" = "$apache_default_url" ]; then echoerr "Attempt to access $apache_url specified in $apache_config_filename failed..." else echoerr "Attempt to access $apache_url specified in $apache_config_filename failed...trying default" if _check_apache_url $apache_default_url; then echoerr "Found Apache status page at $apache_default_url (default URL)" db_set Nightwatch/apache-location "$apache_default_url" return 0; elif _check_apache_url $apache_default_https; then echoerr "Found Apache status page at $apache_default_https" db_set Nightwatch/apache-location "$apache_default_https" return 0; fi fi else if _check_apache_url $apache_default_url; then echoerr "Found Apache status page at $apache_default_url (default URL)" db_set Nightwatch/apache-location "$apache_default_url" return 0; elif _check_apache_url $apache_default_https; then echoerr "Found Apache status page at $apache_default_https" db_set Nightwatch/apache-location "$apache_default_https" return 0; fi fi # really ghetto url extraction guess_url=$(grep '^ *<Location' /etc/apache2/mods-enabled/status.conf 2>/dev/null | head -n1 | sed 's/>$//' | awk '{print $2}') if [ ! -z $guess_url ]; then if _check_apache_url http://127.0.0.1$guess_url?auto; then echoerr "Found Apache status page at http://127.0.0.1$guess_url?auto" db_set Nightwatch/apache-location "http://127.0.0.1$guess_url?auto" return 0 fi fi db_set Nightwatch/apache-location "$apache_default_url" db_fset Nightwatch/apache-try-configure seen "false" db_input high Nightwatch/apache-try-configure } nginx_status_path(){ echoerr "Checking Nginx configuration..." nginx_config_filename=${nightwatch_config_dir}Nginx.conf nginx_default_url='http://127.0.0.1/nginx_status' nginx_default_https='https://127.0.0.1/nginx_status' nginx_url=$(grep '^location' $nginx_config_filename 2>/dev/null | tail -n1 | awk '{print $2}') # use the url if it exists if [ ! -z $nginx_url ]; then if _check_nginx_url $nginx_url; then echoerr "Found nginx status page at $nginx_url specified in $nginx_config_filename" db_set Nightwatch/nginx-location "" return 0 elif [ "$nginx_url" = "$nginx_default_url" ]; then echoerr "Attempt to access $nginx_url specified in $nginx_config_filename failed..." else echoerr "Attempt to access $nginx_url specified in $nginx_config_filename failed...trying default" if _check_nginx_url $nginx_default_url; then echoerr "Found nginx status page at $nginx_default_url (default URL)" db_set Nightwatch/nginx-location "" return 0; elif _check_nginx_url $nginx_default_https; then echoerr "Found nginx status page at $nginx_default_https" db_set Nightwatch/nginx-location "$nginx_default_https" return 0; fi fi fi if _check_nginx_url $nginx_default_url; then echoerr "Found nginx status page at $nginx_default_url (default URL)" db_set Nightwatch/nginx-location "" return 0; elif _check_nginx_url $nginx_default_https; then echoerr "Found nginx status page at $nginx_default_https" db_set Nightwatch/nginx-location "$nginx_default_https" return 0; fi # don't be smart unless we know where to work if [ ! -d /etc/nginx/sites-enabled ]; then echoerr "Unable to automatically configure nginx for Nightwatch. Please see https://library.linode.com/nightwatch/nightwatch-for-nginx#sph_manual-configuration-all-distributions" db_set Nightwatch/nginx-location "" return 0 fi # this is kind of weird # check to make sure that the haxor mode is gonna work if grep -ri '^[[:space:]]*server_name.*127\.0\.0\.2' /etc/nginx/sites-enabled; then echoerr "Unable to automatically configure nginx for Nightwatch. Please see https://library.linode.com/nightwatch/nightwatch-for-nginx#sph_manual-configuration-all-distributions" db_set Nightwatch/nginx-location "" return 0 fi if [ -e /etc/nginx/sites-available/nightwatch ]; then if _check_nginx_url http://127.0.0.2/nginx_status; then echoerr "Found location configured by Nightwatch previously." db_set Nightwatch/nginx-location "http://127.0.0.2/nginx_status" return 0 fi echoerr "Unable to automatically configure nginx for Nightwatch. Please see https://library.linode.com/nightwatch/nightwatch-for-nginx#sph_manual-configuration-all-distributions" db_set Nightwatch/nginx-location "" return 0 fi db_input high Nightwatch/nginx-try-configure || true } mysql_cred_check() { echoerr "Checking MySQL configuration..." mysql_config_filename=${nightwatch_config_dir}MySQL.conf mysql_username=$(grep '^username' $mysql_config_filename 2>/dev/null | tail -n1 | awk '{print $2}') mysql_password=$(grep '^password' $mysql_config_filename 2>/dev/null | tail -n1 | awk '{print $2}') if [ ! -z $mysql_username ] && [ ! -z $mysql_password ]; then if _mysql_check_install $mysql_username $mysql_password; then echoerr "Successfully connected to MySQL with the credentials located in $mysql_config_filename" db_set Nightwatch/mysql-password "" return 0 else echoerr "Unable to connect using the credentials specified in $mysql_config_filename...trying Debian maintenance user" fi fi if [ -e /etc/mysql/debian.cnf ]; then mysql_password=$(egrep '^\s*password\s*=\s*' /etc/mysql/debian.cnf | head -n1 | sed 's/^\s*password\s*=\s*//') if _mysql_check_install debian-sys-maint $mysql_password; then echoerr "Successfully connected to MySQL" db_set Nightwatch/mysql-password "" if [ ! -z $mysql_username ] && [ ! -z $mysql_password ]; then db_subst Nightwatch/mysql-overwrite-creds found_user "$mysql_username" db_input high Nightwatch/mysql-overwrite-creds || true fi return 0 fi fi mysql_username='fastcomet-nightwatch' mysql_password=$(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32) create_statement="CREATE USER 'fastcomet-nightwatch'@'localhost' IDENTIFIED BY '$mysql_password';" db_set Nightwatch/mysql-password "$mysql_password" db_subst Nightwatch/mysql-create-creds create_statement "$create_statement" db_input high Nightwatch/mysql-create-creds || true } . /usr/share/debconf/confmodule db_input medium Nightwatch/APIKey || true if pgrep -f 'httpd|apache2' >/dev/null; then apache_status_path fi if pgrep -f 'nginx' >/dev/null; then nginx_status_path fi if pgrep -f 'mysqld' >/dev/null; then mysql_cred_check fi db_go || true nightwatch/debian/copyright 0000644 00000002616 15246236675 0012106 0 ustar 00 Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: linode-longview Source: https://github.com/linode Files: * Copyright: 2013 Linode, LLC License: GPL-2.0/Perl Artistic License Files: debian/* Copyright: 2013 Linode, LLC License: GPL-2.0/Perl Artistic License License: GPL-2.0/Perl Artistic License Copyright 2013 Linode, LLC. Longview is made available under the terms of the Perl Artistic License, or GPLv2 at the recipients discretion. Perl Artistic License Read it at: http://dev.perl.org/licenses/artistic.html GNU General Public License (GPL) Version 2 This program 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 program 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 program. If not, see http://www.gnu.org/licenses/ On Debian GNU/Linux systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL-2'. See the full license at http://www.gnu.org/licenses/ nightwatch/debian/rules 0000755 00000001340 15246236675 0011224 0 ustar 00 #!/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. # # Modified to make a template file for a multi-binary package with separated # build-arch and build-indep targets by Bill Allombert 2001 # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # This has to be exported to make some magic below work. export DH_OPTIONS override_dh_auto_build: override_dh_auto_install: override_dh_pysupport: %: dh $@ nightwatch/debian/fastcomet-nightwatch.postrm 0000755 00000000343 15246236675 0015542 0 ustar 00 #!/bin/sh set -e if [ "$1" = "purge" ]; then . /usr/share/debconf/confmodule db_purge db_stop fi if [ "$1" = "upgrade" ]; then exit 0 fi if [ "$1" = "remove" -o "$1" = "purge" ]; then update-rc.d -f nightwatch remove fi nightwatch/debian/fastcomet-nightwatch.install 0000644 00000000424 15246236675 0015661 0 ustar 00 Fastcomet/* opt/fastcomet/nightwatch/Fastcomet/ Extras/app-report.pl opt/fastcomet/nightwatch/Extras/ Extras/Modules/Packages/APT.pm opt/fastcomet/nightwatch/Fastcomet/Nightwatch/DataGetter/Packages/ Extras/init/nightwatch etc/init.d Extras/conf/* etc/fastcomet/nightwatch.d/ nightwatch/debian/fastcomet-nightwatch.conffiles 0000644 00000000000 15246236675 0016151 0 ustar 00 nightwatch/debian/control 0000644 00000001226 15246236675 0011552 0 ustar 00 Source: fastcomet-nightwatch Section: utils Priority: optional Maintainer: Fastcomet Nightwatch Team Build-Depends: debhelper (>= 8.0.0) Standards-Version: 3.9.3 Homepage: https://www.fastcomet.com/ Package: fastcomet-nightwatch Architecture: all Depends: libjson-perl, libwww-perl, libcrypt-ssleay-perl | liblwp-protocol-https-perl, libio-socket-ssl-perl, libio-socket-inet6-perl, liblog-loglite-perl, libtry-tiny-perl, libdbi-perl, libdbd-mysql-perl, liblinux-distribution-perl, ${misc:Depends}, ${perl:Depends} Description: Nightwatch Monitoring Agent This agent collects various system wide statistics and post them to the Nightwatch collection endpoint. nightwatch/debian/changelog 0000644 00000007776 15246236675 0012041 0 ustar 00 fastcomet-nightwatch (1.1.5) stable; urgency=low * fix naming issues in debian installation files * Update README.m * Fix warnings when apache regex doesn't match * Fix for issue #5, cpu core fix in SysInfo.pm * Fix for issue #16, typo in fastcomet-nightwatch.postinst -- James Ottinger <jottinger@linode.com> Wed, 20 Apr 2016 10:23:35 -0400 fastcomet-nightwatch (1.1.4) stable; urgency=low * Add a timeout via sig alarm when posting data -- Peter Sandin <psandin@linode.com> Thu, 06 Mar 2014 13:30:47 -0500 fastcomet-nightwatch (1.1.3) stable; urgency=low * Match the longname of a process more accurately * Added diagnostic tool for Application module configuration -- Peter Sandin <psandin@linode.com> Mon, 06 Jan 2014 17:06:16 +0000 fastcomet-nightwatch (1.1.2) stable; urgency=low * Better checks for applications when invoked with fully qualified paths * Better handling of sector size for physical disks * Improved backwards compatibility for allowing certificate errors on local host with older LWP * Various bug fixes -- Peter Sandin <psandin@linode.com> Fri, 22 Nov 2013 17:27:12 -0500 fastcomet-nightwatch (1.1.1) stable; urgency=low * Support HTTPS for web server status pages * Increase log verbosity * Various bug fixes -- Peter Sandin <psandin@linode.com> Tue, 12 Nov 2013 17:37:01 -0500 fastcomet-nightwatch (1.1.0.3) stable; urgency=low * Fix flags on update-rc.d when purging -- Peter Sandin <psandin@linode.com> Tue, 05 Nov 2013 14:36:29 -0500 fastcomet-nightwatch (1.1.0.2) stable; urgency=low * Removed bashism from Nginx rollback -- Peter Sandin <psandin@linode.com> Tue, 05 Nov 2013 12:44:58 -0500 fastcomet-nightwatch (1.1.0.1) stable; urgency=low [ Stan Schwertly ] * Pure perl implementation of timeout in MySQL check -- Peter Sandin <psandin@linode.com> Mon, 04 Nov 2013 14:12:09 -0500 fastcomet-nightwatch (1.1.0) stable; urgency=low * Support for automatically loading modules under the DataGetter package * New modules for gathering MySQL, Apache, and Nginx specific statistics -- Peter Sandin <psandin@linode.com> Mon, 04 Nov 2013 12:03:52 -0500 fastcomet-nightwatch (1.0.1) stable; urgency=low * Collect disk usage in both operations per second and bytes per second * Fix typo in export for Util.pm * Fix parent disks sometimes inheriting the properties of their children -- Peter Sandin <psandin@linode.com> Tue, 01 Oct 2013 08:22:59 -0400 fastcomet-nightwatch (1.0.0) stable; urgency=low * Identify system architecture/integer size better * Improve processor model detection -- Peter Sandin <psandin@linode.com> Wed, 04 Sep 2013 23:29:13 -0400 fastcomet-nightwatch (0.2.7) stable; urgency=low * Check for package updates more efficiently by checking the modified times on package cache files * Nightwatch now identifies itself even when /proc/pid/status shows its name as perl * Nightwatch now uses paths relative to Nightwatch.pl to locate modules and dependancies * Perl 5.8 compatibility -- Peter Sandin <psandin@linode.com> Wed, 28 Aug 2013 17:05:04 -0400 fastcomet-nightwatch (0.2.6.1) stable; urgency=low * Fix control data for Log::LogLite -- Peter Sandin <psandin@linode.com> Thu, 22 Aug 2013 16:17:02 -0400 fastcomet-nightwatch (0.2.6) stable; urgency=low * Improved handling of falling back to IPv4 when IPv6 is unavailable * Fixed runtime addition of api keys * Performance improvements in port monitoring for high traffic systems * Replaced Log::Log4Perl with Log::LogLite * LVM disks now consistently name keys for IO and FS statistics -- Peter Sandin <psandin@linode.com> Thu, 22 Aug 2013 16:01:43 -0400 fastcomet-nightwatch (0.2.5) stable; urgency=low * 2nd beta release. * Escape dots in mount point and device paths * Remove Linux::APT dependancy * Fix IPv6 address formatting in ports listing * Try to avoid locking conflicts when checking for package updates * Fix regex for rx and tx bytes under networking -- Peter Sandin <psandin@linode.com> Thu, 27 Jun 2013 16:00:13 -0400 nightwatch/debian/fastcomet-nightwatch.postinst 0000755 00000012445 15246236675 0016107 0 ustar 00 #!/bin/sh set -e nightwatch_config_dir='/etc/fastcomet/nightwatch.d/' echoerr() { echo "$@" 1>&2; } _fake_curl() { _input_url=$1 PERL_LWP_SSL_VERIFY_HOSTNAME=0 perl -MLWP::UserAgent -e '$ua=LWP::UserAgent->new(); print $ua->get("$ARGV[0]")->decoded_content;' "$1" return 0 } _check_apache_url() { _apache_url=$1 _fake_curl "$_apache_url" | grep -q 'Scoreboard:' return $? } _check_nginx_url() { _nginx_url=$1 _fake_curl "$_nginx_url" | grep -q 'server accepts handled requests' return $? } _write_option(){ _write_file=$1 _checked_directive=$2 _value=$3 if egrep "^\s*$_checked_directive[[:space:]]+\S+" $_write_file >/dev/null; then sed -i "s|^\s*$_checked_directive.*|$_checked_directive $_value|g" $_write_file else if ! tail -c1 $_write_file | grep '^$' >/dev/null; then echo "" >> $_write_file fi echo "$_checked_directive $_value" >> $_write_file fi } apache_install() { apache_config_filename=${nightwatch_config_dir}Apache.conf db_get Nightwatch/apache-location location="$RET" if [ ! -z "$location" ]; then _write_option $apache_config_filename location "$location" apache_url="$location" else apache_url='http://127.0.0.1/server-status?auto' fi db_fset Nightwatch/apache-try-configure seen "false" db_get Nightwatch/apache-try-configure if [ "$RET" != "true" ]; then return 0 fi db_set Nightwatch/apache-try-configure "false" # check for mod_status if [ ! -e /etc/apache2/mods-enabled/status.conf ]; then if ! a2enmod status; then echoerr "Unable to enable mod_status for Apache. Please see https://library.linode.com/nightwatch/nightwatch-for-apache#sph_manual-configuration-all-distributions for instructions on configuring Apache to work with Nightwatch" return 1 fi else pre_existing_status="true" fi cat >> /etc/apache2/mods-enabled/status.conf <<END <IfModule mod_status.c> ExtendedStatus On <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from 127.0.0.1 </Location> </IfModule> END apache_url_https=`echo $apache_url | sed 's/^http/https/'` if /etc/init.d/apache2 reload; then if _check_apache_url $apache_url; then _write_option $apache_config_filename location "$apache_url" echoerr "Apache mod_status enabled" return 0 elif _check_apache_url $apache_url_https; then _write_option $apache_config_filename location "$apache_url_https" return 0; fi fi echoerr "Enabling mod_status for Apache failed. Rolling back changes" if [ -z "$pre_existing_status" ]; then a2dismod status fi head -n -9 /etc/apache2/mods-available/status.conf | tee /etc/apache2/mods-available/status.conf > /dev/null /etc/init.d/apache2 reload echoerr "Please see https://library.linode.com/nightwatch/nightwatch-for-apache#sph_manual-configuration-all-distributions for instructions on configuring Apache to work with Nightwatch. Auto-configuration failed" } nginx_install() { nginx_config_filename=${nightwatch_config_dir}Nginx.conf db_get Nightwatch/nginx-location location="$RET" if [ ! -z "$location" ]; then _write_option $nginx_config_filename location "$location" return 0 fi db_fset Nightwatch/nginx-try-configure seen "false" db_get Nightwatch/nginx-try-configure if [ "$RET" != "true" ]; then return 0 fi db_set Nightwatch/nginx-try-configure "false" cat >> /etc/nginx/sites-available/nightwatch <<END server { listen 127.0.0.2:80; server_name 127.0.0.2; location /nginx_status { stub_status on; allow 127.0.0.1; deny all; } } END ln -s /etc/nginx/sites-available/nightwatch /etc/nginx/sites-enabled/ if [ -h /etc/nginx/sites-enabled/nightwatch ]; then if /etc/init.d/nginx restart; then if _check_nginx_url http://127.0.0.2/nginx_status; then echoerr "Finished configuring nginx, writing new configuration to $nginx_config_filename" _write_option $nginx_config_filename location "http://127.0.0.2/nginx_status" return 0 fi fi fi echoerr "Enabling stub_status failed. Rolling back changes" rm /etc/nginx/sites-enabled/nightwatch /etc/nginx/sites-available/nightwatch /etc/init.d/nginx restart echoerr "Please see https://library.linode.com/nightwatch/nightwatch-for-nginx#sph_manual-configuration-all-distributions for instructions on configuring nginx to work with Nightwatch. Auto-configuration failed" } mysql_install() { mysql_config_filename=${nightwatch_config_dir}MySQL.conf db_get Nightwatch/mysql-overwrite-creds overwrite="$RET" db_fset Nightwatch/mysql-create-creds seen "false" db_set Nightwatch/mysql-overwrite-creds "false" if [ "$overwrite" = "true" ]; then sed -i 's/^\s*\(username.*\)/#\1/g' $mysql_config_filename sed -i 's/^\s*\(password.*\)/#\1/g' $mysql_config_filename return 0 fi db_get Nightwatch/mysql-password pass="$RET" if [ ! -z "$pass" ]; then _write_option $mysql_config_filename username "fastcomet-nightwatch" _write_option $mysql_config_filename password "$pass" db_set Nightwatch/mysql-password "" return 0 fi } . /usr/share/debconf/confmodule if [ ! -e /etc/fastcomet/nightwatch.key ]; then db_get Nightwatch/APIKey echo "$RET" > /etc/fastcomet/nightwatch.key fi apache_install nginx_install mysql_install chmod -R o-rwx $nightwatch_config_dir db_stop if invoke-rc.d nightwatch status 1>/dev/null 2>&1; then invoke-rc.d nightwatch restart || true else invoke-rc.d nightwatch start || true fi update-rc.d nightwatch defaults nightwatch/debian/source/format 0000644 00000000015 15246236675 0012655 0 ustar 00 3.0 (native) nightwatch/Extras/specs/centos-nightwatch.spec 0000644 00000005605 15246236675 0015622 0 ustar 00 Name: fastcomet-nightwatch Version: 1.1 Release: 5 Summary: Fastcomet Nightwatch Agent License: GPLv2+ BuildArch: noarch Requires: perl(Crypt::SSLeay),perl(DBD::mysql),perl(LWP::Protocol::https) Obsoletes: nightwatch %description The Fastcomet Nightwatch data collection agent %prep http_fetch() { mkdir -p `dirname $2` if command -v wget >/dev/null 2>&1; then wget -q -4 -O $2 $1 || { echo >&2 "Failed to fetch $1. Aborting install."; exit 1; } elif command -v curl >/dev/null 2>&1; then curl -sf4L $1 > $2 || { echo >&2 "Failed to fetch $1. Aborting install."; exit 1; } else echo "Unable to find curl or wget, can not fetch needed files" exit 1 fi } [ -e $OLDPWD/Extras/lib/perl5/Linux/Distribution.pm ] || http_fetch http://cpansearch.perl.org/src/CHORNY/Linux-Distribution-0.23/lib/Linux/Distribution.pm $OLDPWD/Extras/lib/perl5/Linux/Distribution.pm [ -e $OLDPWD/Extras/lib/perl5/Try/Tiny.pm ] || http_fetch http://cpansearch.perl.org/src/ETHER/Try-Tiny-0.24/lib/Try/Tiny.pm $OLDPWD/Extras/lib/perl5/Try/Tiny.pm %install rm -rf %{buildroot} mkdir -p %{buildroot}/opt/fastcomet/nightwatch/lib/perl5/ mkdir -p %{buildroot}/opt/fastcomet/nightwatch/Fastcomet/Nightwatch/DataGetter/Packages/ mkdir -p %{buildroot}/opt/fastcomet/nightwatch/Extras/ mkdir -p %{buildroot}/etc/init.d/ mkdir -p %{buildroot}/etc/fastcomet/nightwatch.d cp $OLDPWD/Extras/init/nightwatch.centos.sh %{buildroot}/etc/init.d/nightwatch cp -r $OLDPWD/Extras/lib/perl5/* %{buildroot}/opt/fastcomet/nightwatch/lib/perl5/ cp -r $OLDPWD/Fastcomet %{buildroot}/opt/fastcomet/nightwatch/ cp $OLDPWD/Extras/Modules/Packages/YUM.pm %{buildroot}/opt/fastcomet/nightwatch/Fastcomet/Nightwatch/DataGetter/Packages/YUM.pm cp $OLDPWD/Extras/app-report.pl %{buildroot}/opt/fastcomet/nightwatch/Extras/app-report.pl cp $OLDPWD/Extras/conf/* %{buildroot}/etc/fastcomet/nightwatch.d/ %files /etc/init.d/nightwatch /opt/fastcomet/nightwatch/lib/perl5/Linux/Distribution.pm /opt/fastcomet/nightwatch/lib/perl5/Try/Tiny.pm /opt/fastcomet/nightwatch/Fastcomet/Nightwatch.pl /opt/fastcomet/nightwatch/Fastcomet/Nightwatch/*.pm /opt/fastcomet/nightwatch/Fastcomet/Nightwatch/DataGetter/*.pm /opt/fastcomet/nightwatch/Fastcomet/Nightwatch/DataGetter/Applications/*.pm /opt/fastcomet/nightwatch/Fastcomet/Nightwatch/DataGetter/Packages/YUM.pm %config %attr(640,root,root) /etc/fastcomet/nightwatch.d/*.conf /opt/fastcomet/nightwatch/Extras/app-report.pl %post if [ $1 -eq 1 ] ; then # Initial installation service nightwatch start || : chkconfig --add nightwatch chkconfig --level 35 nightwatch on fi chmod -R o-rwx /etc/fastcomet/nightwatch.d/ %preun if [ $1 -eq 0 ] ; then # Package removal, not upgrade service nightwatch stop || : chkconfig --del nightwatch fi %postun /bin/systemctl daemon-reload >/dev/null 2>&1 || : if [ $1 -ge 1 ] ; then # Package upgrade, not uninstall service nightwatch restart || : fi nightwatch/Extras/specs/fedora-nightwatch.spec 0000644 00000006224 15246236675 0015565 0 ustar 00 Name: fastcomet-nightwatch Version: 1.1 Release: 5 Summary: Fastcomet Nightwatch Agent License: GPLv2+ BuildArch: noarch Source: https://github.com/linode/longview/archive/v%{version}.%{release}.tar.gz Requires: perl-LWP-Protocol-https,perl-DBD-MySQL BuildRequires: systemd-units Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units %description The Fastcomet Nightwatch data collection agent %prep http_fetch() { mkdir -p `dirname $2` if command -v wget >/dev/null 2>&1; then wget -q -4 -O $2 $1 || { echo >&2 "Failed to fetch $1. Aborting install."; exit 1; } elif command -v curl >/dev/null 2>&1; then curl -sf4L $1 > $2 || { echo >&2 "Failed to fetch $1. Aborting install."; exit 1; } else echo "Unable to find curl or wget, can not fetch needed files" exit 1 fi } [ -e $OLDPWD/Extras/lib/perl5/Linux/Distribution.pm ] || http_fetch http://cpansearch.perl.org/src/CHORNY/Linux-Distribution-0.23/lib/Linux/Distribution.pm $OLDPWD/Extras/lib/perl5/Linux/Distribution.pm [ -e $OLDPWD/Extras/lib/perl5/Try/Tiny.pm ] || http_fetch http://cpansearch.perl.org/src/ETHER/Try-Tiny-0.24/lib/Try/Tiny.pm $OLDPWD/Extras/lib/perl5/Try/Tiny.pm %install echo $OLDPWD rm -rf %{buildroot} mkdir -p %{buildroot}/opt/fastcomet/nightwatch/lib/perl5/ mkdir -p %{buildroot}%{_unitdir} mkdir -p %{buildroot}/etc/fastcomet/nightwatch.d mkdir -p %{buildroot}/opt/fastcomet/nightwatch/Fastcomet/Nightwatch/DataGetter/Packages mkdir -p %{buildroot}/opt/fastcomet/nightwatch/Extras/ cp $OLDPWD/Extras/init/nightwatch.service %{buildroot}%{_unitdir}/nightwatch.service cp -r $OLDPWD/Extras/lib/perl5/* %{buildroot}/opt/fastcomet/nightwatch/lib/perl5/ cp -r $OLDPWD/Fastcomet %{buildroot}/opt/fastcomet/nightwatch/ cp $OLDPWD/Extras/app-report.pl %{buildroot}/opt/fastcomet/nightwatch/Extras/app-report.pl cp $OLDPWD/Extras/Modules/Packages/YUM.pm %{buildroot}/opt/fastcomet/nightwatch/Fastcomet/Nightwatch/DataGetter/Packages/YUM.pm cp $OLDPWD/Extras/conf/* %{buildroot}/etc/fastcomet/nightwatch.d/ %files %{_unitdir}/nightwatch.service /opt/fastcomet/nightwatch/lib/perl5/Linux/Distribution.pm /opt/fastcomet/nightwatch/lib/perl5/Try/Tiny.pm /opt/fastcomet/nightwatch/Fastcomet/Nightwatch.pl /opt/fastcomet/nightwatch/Fastcomet/Nightwatch/*.pm /opt/fastcomet/nightwatch/Fastcomet/Nightwatch/DataGetter/*.pm /opt/fastcomet/nightwatch/Fastcomet/Nightwatch/DataGetter/Applications/*.pm /opt/fastcomet/nightwatch/Fastcomet/Nightwatch/DataGetter/Packages/YUM.pm %config %attr(640,root,root) /etc/fastcomet/nightwatch.d/*.conf /opt/fastcomet/nightwatch/Extras/app-report.pl %post if [ $1 -eq 1 ] ; then # Initial installation /bin/systemctl daemon-reload >/dev/null 2>&1 || : /bin/systemctl enable nightwatch.service >/dev/null 2>&1 || : fi %preun if [ $1 -eq 0 ] ; then # Package removal, not upgrade /bin/systemctl --no-reload disable nightwatch.service > /dev/null 2>&1 || : /bin/systemctl stop nightwatch.service > /dev/null 2>&1 || : fi %postun /bin/systemctl daemon-reload >/dev/null 2>&1 || : if [ $1 -ge 1 ] ; then # Package upgrade, not uninstall /bin/systemctl try-restart nightwatch.service >/dev/null 2>&1 || : fi nightwatch/Extras/app-report.pl 0000755 00000033334 15246236675 0012631 0 ustar 00 #!/usr/bin/env perl use strict; use warnings; =head1 COPYRIGHT/LICENSE Copyright 2013 Linode, LLC. Longview is made available under the terms of the Perl Artistic License, or GPLv2 at the recipients discretion. =head2 Perl Artistic License Read it at L<http://dev.perl.org/licenses/artistic.html>. =head2 GNU General Public License (GPL) Version 2 This program 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 program 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 program. If not, see http://www.gnu.org/licenses/ See the full license at L<http://www.gnu.org/licenses/>. =cut BEGIN { use Config; use FindBin; push @INC, "$FindBin::RealBin/../"; push @INC, "$FindBin::RealBin/../lib/perl5"; push @INC, "$FindBin::RealBin/../lib/perl5/${Config{archname}}/"; push @INC, "$FindBin::RealBin/../usr/include"; } use Fastcomet::Nightwatch::DataGetter::Applications::Apache; use Fastcomet::Nightwatch::DataGetter::Applications::Nginx; use Fastcomet::Nightwatch::DataGetter::Applications::MySQL; use Fastcomet::Nightwatch::DataGetter::Processes qw(process_info process_list); use Fastcomet::Nightwatch::Util qw(get_config_file_name get_config_data get_UA slurp_file $apikey); use DBI; use Socket; use Getopt::Long; use Term::ANSIColor; use Tie::File; use Fcntl 'O_RDONLY'; our $processes = {}; my $force = ''; my $module = 'ALL'; my $verbose = ''; my $usage = ''; Getopt::Long::Configure ("bundling"); GetOptions ('h|help' => \$usage, 'f|force' => \$force, 'm|module=s' => \$module, 'v|verbose' => \$verbose); if ($usage){ print <<USAGE; Usage: $0 [OPTIONS] -v, --verbose Include raw error messages, and config file sections -f, --force Run all checks even if successful, or continue checking after critical errors -m, --module <Name> Only run checks for the named applications -h, --help Display this text USAGE exit 0; } our $sys_type ="generic"; $sys_type = "debian" if -e "/etc/debian_version"; $sys_type = "redhat" if -e "/etc/redhat-release"; my $running_apps = check_running(); $apikey = "Nightwatch Config Test"; check_apache() if $module eq "ALL" or $module eq "Apache"; check_nginx() if $module eq "ALL" or $module eq "Nginx"; check_mysql() if $module eq "ALL" or $module eq "MySQL"; print "=" x 28 . "\n"; sub check_running{ my $sigs = { Apache => $Fastcomet::Nightwatch::DataGetter::Applications::Apache::SIGNATURES, Nginx => $Fastcomet::Nightwatch::DataGetter::Applications::Nginx::SIGNATURES, MySQL => $Fastcomet::Nightwatch::DataGetter::Applications::MySQL::SIGNATURES, }; my $found = {Apache => 0, Nginx => 0, MySQL => 0}; my @procs = process_list(); for my $proc (@procs) { my %info = process_info($proc); next if ( !%info ); # no such proc, it probably died while we were gathering info next if ( $info{ppid} == 2 ); next if ( $info{pid} == 2 ); for my $app (keys %$sigs){ for my $sig (@{$sigs->{$app}}){ $found->{$app} = 1 if ($info{name} =~ /$sig$/); $found->{$app} = 1 if ($info{longname} =~ /$sig$/); } } } return $found; } sub check_apache { print "=" x 10 . " Apache " . "=" x 10 ."\n"; my $conf = get_config_data(get_config_file_name("Apache")); $conf->{location} = "http://127.0.0.1/server-status?auto" unless defined $conf->{location}; my $conf_port = 80; $conf_port = 443 if $conf->{location} =~ m|^https://|; my ($host, undef, $file_port) = ($conf->{location} =~ /^https?:\/\/([^:\/]+)(:(\d+))?\/.*/); $conf_port = $file_port if defined $file_port; my $ua = get_UA(); # temporarily skip checks for self-signed certs $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; my $res = $ua->get($conf->{location}); $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 1; if ( $res->is_success ) { if ( $res->content =~ /Scoreboard:/ ) { print color 'bold green'; print "Found apache status page at configured location ($conf->{location})\n"; print color 'reset'; return unless $force; }else{ print color 'bold yellow'; print "Got HTTP ".$res->status_line." for $conf->{location} but the content doesn't look like a status page\n"; print color 'reset'; } } else{ print color 'bold red'; print "Got HTTP ".$res->status_line." for $conf->{location}\n"; print color 'reset'; } unless ($running_apps->{Apache}) { print color 'bold red'; print "Apache does not appear to be running\n"; print color 'reset'; } my $host_ip = inet_ntoa(scalar(gethostbyname($host))); my $found = 0; my $default = 0; my $skip_block = 0; my ($vname, $conf_file, $line_number); my $ctl_bin = "apache2ctl"; $ctl_bin = "apachectl" if $sys_type eq "redhat"; open(A2C,"$ctl_bin -t -D DUMP_MODULES 2>/dev/null|") or do { print "Could not exec the Apache control binary ($ctl_bin)\n"; return; }; my @mod_list = <A2C>; close(A2C); if($?){ print color 'bold yellow'; print "Could not find the Apache control binary ($ctl_bin) assuming apache isn't installed\n"; print color 'reset'; return; } unless(grep(/^\s*status_module/,@mod_list)){ print color 'bold red'; print "Apache mod_status not loaded\n"; print color 'reset'; return unless $force; } open(A2C,"$ctl_bin -t -D DUMP_VHOSTS 2>/dev/null|") or do { print "Could not exec the Apache control binary ($ctl_bin)\n"; return; }; my @conf_lines = <A2C>; close(A2C); foreach my $line (@conf_lines) { print $line; chomp($line); if($line =~ /^(\S+).*NameVirtualHost$/){ my ($addr,$port) = ($line =~ /^(.*):(\d+)\s.*$/); unless ($port == $conf_port) { $skip_block = 1; next; } unless (($host eq $addr) or ($addr eq "*")) { $skip_block = 1; next } $skip_block = 0; } next if $skip_block; if($line =~ /^\s+default/) { ($vname, $conf_file, $line_number) = ($line =~ /^\s+default\sserver\s(.*)\s\((.*):(\d+)\)$/) unless $found; $default = 1; } elsif($line =~ /^\s+port\s+\d+\s+namevhost.*$/){ my ($name, $file, $ln) = ($line =~ /^\s+port\s+\d+\s+namevhost\s+(.*)\s+\((.*):(\d+)\)$/); if($name eq $host or inet_ntoa(scalar(gethostbyname($name))) eq $host_ip){ ($vname, $conf_file, $line_number) = ($name, $file, $ln); $found = 1; } } } if(defined $vname){ print "Found a likely vhost $vname in $conf_file on line $line_number"; print " [DEFAULT]" if $default and !$found; print "\n"; print_vhost($conf_file, $line_number) if $verbose; } } sub print_vhost { my ($file, $line_no) = @_; $line_no--; my @vhost_conf; tie @vhost_conf, 'Tie::File', $file, mode => O_RDONLY; while (($line_no < scalar(@vhost_conf)) and ($vhost_conf[$line_no] !~ m|^\s*</VirtualHost>|)) { print $vhost_conf[$line_no++] . "\n"; } print $vhost_conf[$line_no] . "\n"; untie @vhost_conf; } sub check_mysql { print "=" x 10 . " MySQL " . "=" x 11 ."\n"; my $conf = get_config_data(get_config_file_name("MySQL")); my $connection_string = "DBI:mysql:host=localhost;"; my $socket_error = 0; my $spath_from_error; unless ($running_apps->{MySQL}) { print color 'bold red'; print "MySQL does not appear to be running\n"; print color 'reset'; return unless $force; } if ( exists( $conf->{username} ) && exists( $conf->{password} ) ) { my $success = 1; my $dbh = DBI->connect_cached($connection_string, $conf->{username}, $conf->{password},{PrintError => 0,PrintWarn => 0}) or do { $success = 0; }; if($success) { print color 'bold green'; print "Connected to mysql with user '$conf->{username}' and the password supplied in /etc/fastcomet/nightwatch.d/MySQL.conf\n"; print color 'reset'; return unless $force; } else { print color 'bold yellow'; print "Could not connect to mysql with user '$conf->{username}' and the password supplied in /etc/fastcomet/nightwatch.d/MySQL.conf\n"; print $DBI::errstr . "\n" if $verbose; print color 'reset'; if($DBI::errstr =~ /Can't connect to local MySQL server through socket/){ $socket_error = 1; ($spath_from_error) = ($DBI::errstr =~ /^Can't connect to local MySQL server through socket '(.*)'/); } } } else{ print color 'bold yellow'; print "No credentials found in /etc/fastcomet/nightwatch.d/MySQL.conf\n"; print color 'reset'; } if( $sys_type eq "debian" && -e '/etc/mysql/debian.cnf'){ my $password; for my $line ( slurp_file('/etc/mysql/debian.cnf') ) { if ( $line =~ /^password\s+=\s+(.*)$/ ) { $password = $1; last; } } unless (defined $password) { print color 'bold yellow'; print "Could not find user credentials in /etc/mysql/debian.cnf\n"; print color 'reset'; }else{ my $success = 1; my $dbh = DBI->connect_cached($connection_string, 'debian-sys-maint', $password,{PrintError => 0,PrintWarn => 0}) or do { $success = 0; }; if($success) { print color 'bold green'; print "Connected to mysql with user 'debian-sys-maint'\n"; print color 'reset'; return unless $force; } else { print color 'bold yellow'; print "Could not connect to mysql as user 'debian-sys-maint' with the password set in /etc/mysql/debian.cnf\n"; print $DBI::errstr . "\n" if $verbose; print color 'reset'; if($DBI::errstr =~ /Can't connect to local MySQL server through socket/){ $socket_error = 1; ($spath_from_error) = ($DBI::errstr =~ /^Can't connect to local MySQL server through socket '(.*)'/); } } } } if($socket_error){ print "Could not connect due to socket error.\n"; my $conf_file = "/etc/my.cnf"; $conf_file = "/etc/mysql/my.cnf" if $sys_type eq "debian"; my $spath_from_conf = mysql_socket_path_from_config($conf_file); print "Found socket "; print color 'bold'; print $spath_from_conf; print color 'reset'; print " in $conf_file\n"; unless (-S $spath_from_conf){ print color 'bold red'; print "Socket $spath_from_conf does not exist\n"; print color 'reset'; } print "Client attempted to connect using socket "; print color 'bold'; print "$spath_from_error\n"; print color 'reset'; unless($spath_from_conf eq $spath_from_error){ print color 'bold red'; print "Client appears to be using the wrong socket path\n"; print color 'reset'; } } } sub mysql_socket_path_from_config { my $file = shift; my @conf_lines = slurp_file($file); my ($section, $socket_path) = ('',undef); foreach my $line (@conf_lines) { chomp($line); if($line =~ /^\s*\[\S+\]/) { ($section) = ($line =~ /^\s*\[(\S+)\]/); } next unless $section eq "mysqld"; if($line =~ /^\s*socket\s*=\s*\S+/){ ($socket_path) = ($line =~ /^\s*socket\s*=\s*(\S+)/); } } return $socket_path; } sub check_nginx { print "=" x 10 . " Nginx " . "=" x 11 ."\n"; my $conf = get_config_data(get_config_file_name("Nginx")); $conf->{location} = 'http://127.0.0.1/nginx_status' unless defined $conf->{location}; my $conf_port = 80; $conf_port = 443 if $conf->{location} =~ m|^https://|; my ($host, undef, $file_port) = ($conf->{location} =~ /^https?:\/\/([^:\/]+)(:(\d+))?\/.*/); $conf_port = $file_port if defined $file_port; my $ua = get_UA(); # temporarily skip checks for self-signed certs $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; my $res = $ua->get($conf->{location}); $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 1; if ( $res->is_success ) { if ( $res->content =~ /server accepts handled requests/ ) { print color 'bold green'; print "Found nginx status page at configured location ($conf->{location})\n"; print color 'reset'; return unless $force; }else{ print color 'bold yellow'; print "Got HTTP ".$res->status_line." for $conf->{location} but the content doesn't look like a status page\n"; print color 'reset'; } } else{ print color 'bold red'; print "Got HTTP ".$res->status_line." for $conf->{location}\n"; print color 'reset'; } unless ($running_apps->{Nginx}) { print color 'bold red'; print "Nginx does not appear to be running\n"; print color 'reset'; } open(NXV,"nginx -V 2>&1 |") or do { print "Could not exec nginx\n"; return; }; my @conf_lines = <NXV>; close(NXV); if($?){ print color 'bold yellow'; print "Could not find nginx assuming it isn't installed\n"; print color 'reset'; return; } my $conf_line = (grep(m/^configure arguments:/,@conf_lines))[0]; $conf_line =~ s/^configure arguments://; my @config_opts = split(' ', $conf_line); unless(grep(/--with-http_stub_status_module/,@config_opts)){ print "Installed version of Nginx does not include status stub\n"; return; } else{ print "Nginx status stub available\n"; } my $prefix = (grep(m/^--prefix=/,@config_opts))[0]; $prefix =~ s/^--prefix=//; my $conf_path = (grep(m/^--conf-path=/,@config_opts))[0]; $conf_path =~ s/^--conf-path=//; print "Prefix: $prefix\n"; print "Base Config File: $conf_path\n"; my (@pending, @confs); push @pending, $conf_path; while(@pending){ push @pending, nginx_get_includes($pending[0]); push @confs, shift @pending; } print "All Config Files:\n"; print "\t$_\n" for (@confs); nginx_find_status($_) for (@confs); } sub nginx_get_includes { my $file = shift; my @conf_lines = slurp_file($file); return () unless @conf_lines; my @res; for my $child (grep(/^\s*include\s+/,@conf_lines)){ $child =~ s/^\s*include\s+//; $child =~ s/;$//; push @res, glob($child); } return @res; } sub nginx_find_status { my $file = shift; my @conf_lines = slurp_file($file); return () unless @conf_lines; my @res = grep { $conf_lines[$_-1] =~ /^\s*stub_status on;/ } 1..$#conf_lines+1; if (@res){ print "Found what looks like a status stub handler in $file on line " .join(', ',@res)."\n"; print `egrep -n -C5 '^\\s*stub_status on;' $file` if $verbose; } } nightwatch/Extras/Modules/Packages/Gentoo.pm 0000644 00000003530 15246236675 0015112 0 ustar 00 package Fastcomet::Nightwatch::DataGetter::Packages::Gentoo; =head1 COPYRIGHT/LICENSE Copyright 2013 Linode, LLC. Longview is made available under the terms of the Perl Artistic License, or GPLv2 at the recipients discretion. =head2 Perl Artistic License Read it at L<http://dev.perl.org/licenses/artistic.html>. =head2 GNU General Public License (GPL) Version 2 This program 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 program 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 program. If not, see http://www.gnu.org/licenses/ See the full license at L<http://www.gnu.org/licenses/>. =cut use strict; use warnings; use Fastcomet::Nightwatch::Util; our $DEPENDENCIES = []; our $next_run; our @pkgs; sub get { my ( undef, $dataref ) = @_; $logger->trace('Entering Gentoo module'); if(should_update()){ @pkgs = qx(VERSION='<version>,' eix -u '-*' --format '<category>/<name> <installedversions:VERSION> <bestslotupgradeversions:VERSION>\n'); } $dataref->{INSTANT}->{Packages} = [ map { my ($name, $current, $new) = $_ =~ /^([^ ]+) (.+?), (.+?),$/; { name => $name, current => join(', ', split(/,/, $current)), new => join(', ', split(/,/, $new)) } } @pkgs ]; return $dataref; } sub should_update { return 0 if((defined $next_run) && ($next_run > time)); $next_run = time + 1800; # Checking updates is expensive; only do it every 30 minutes return 1; } 1; nightwatch/Extras/Modules/Packages/APT.pm 0000644 00000005044 15246236675 0014305 0 ustar 00 package Fastcomet::Nightwatch::DataGetter::Packages::APT; =head1 COPYRIGHT/LICENSE Copyright 2013 Linode, LLC. Longview is made available under the terms of the Perl Artistic License, or GPLv2 at the recipients discretion. =head2 Perl Artistic License Read it at L<http://dev.perl.org/licenses/artistic.html>. =head2 GNU General Public License (GPL) Version 2 This program 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 program 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 program. If not, see http://www.gnu.org/licenses/ See the full license at L<http://www.gnu.org/licenses/>. =cut use strict; use warnings; use Fastcomet::Nightwatch::Util; our $DEPENDENCIES = ['Processes.pm']; our $next_run; our $cache_touch_dt; sub get { my ( undef, $dataref ) = @_; $logger->trace('Entering APT module'); if(check_running($dataref)){ $logger->debug('Another instance of apt-get is already running, skip package this pass'); $dataref->{INSTANT}->{Packages} = []; return $dataref; } if(should_update()){ $logger->trace('Running apt-get update before reporting packages'); `apt-get -q update 2>/dev/null`; } my $new_touch_dt = (stat('/var/cache/apt/pkgcache.bin'))[9]; return $dataref if (defined($cache_touch_dt) && ($new_touch_dt == $cache_touch_dt)); $cache_touch_dt = $new_touch_dt; $dataref->{INSTANT}->{Packages} = []; my $held = 1; if (open(APT, "echo n | apt-get -q -V upgrade 2>&1 |")) { while (my $line = <APT>) { chomp($line); $held = 0 if ($line =~ m/^The following packages will be upgraded:/); if ($line =~ m/^\s+(\S+)\s+\((\S+)\s+=>\s+(\S+)\)/) { my $update = {}; $update->{name} = $1; $update->{current} = $2; $update->{new} = $3; $update->{held} = $held; push @{$dataref->{INSTANT}->{Packages}}, $update; } } close(APT); } return $dataref; } sub should_update { return 0 if((defined $next_run) && ($next_run > time)); $next_run = time + 86400; #Only actually hit the mirrors once every 24 hours. return 1; } sub check_running { my $dataref = shift; return grep(m/Processes\.apt(?:-get|itude)/,keys %{$dataref->{LONGTERM}}); } 1; nightwatch/Extras/Modules/Packages/YUM.pm 0000644 00000004510 15246236675 0014330 0 ustar 00 package Fastcomet::Nightwatch::DataGetter::Packages::YUM; =head1 Perl Artistic License Copyright 2013 Linode, LLC. Longview is made available under the terms of the Perl Artistic License, or GPLv2 at the recipients discretion. =head2 Perl Artistic License Read it at L<http://dev.perl.org/licenses/artistic.html>. =head2 GNU General Public License (GPL) Version 2 This program 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 program 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 program. If not, see http://www.gnu.org/licenses/ See the full license at L<http://www.gnu.org/licenses/>. =cut use strict; use warnings; use Fastcomet::Nightwatch::Util; our $DEPENDENCIES = []; our $cache_touch_dt; sub get { my (undef, $dataref) = @_; $logger->trace('Entering YUM module'); return $dataref if defined $cache_touch_dt && get_DB_touch_dt() == $cache_touch_dt; my %u_pkgs = upgradable_pkgs(); if (!%u_pkgs){ $dataref->{INSTANT}->{Packages} = []; $cache_touch_dt = get_DB_touch_dt(); return $dataref; } my %c_pkgs = current_pkgs(); $dataref->{INSTANT}->{Packages} = [ map { { name => $_, current => $c_pkgs{$_}, new => $u_pkgs{$_} } } keys %u_pkgs ]; $cache_touch_dt = get_DB_touch_dt(); return $dataref; } sub get_DB_touch_dt { my $oldest = 0; my $candidate; for my $db (glob('/var/lib/rpm/__db.*')) { $candidate = (stat($db))[9]; $oldest = $candidate if $oldest < $candidate; } return $oldest; } sub current_pkgs { # yum wraps unless we fake a tty my @pkg_list = qx(script -c 'yum --color=never list installed' /dev/null); my %pkgs; for my $pkg (@pkg_list) { if ( $pkg =~ m/^(.*?)\s+(.*?)\s+@(.*)$/ ) { $pkgs{$1} = $2; } } return %pkgs; } sub upgradable_pkgs { my @pkg_list = qx(yum check-update); my %pkgs; for my $pkg (@pkg_list) { if ( $pkg =~ m/^(\S+\.\S+)\s+(\S+)\s+\S+$/ ) { $pkgs{$1} = $2; } } return %pkgs; } 1; nightwatch/Extras/install-dependencies.sh 0000755 00000002604 15246236675 0014625 0 ustar 00 #!/bin/bash http_fetch() { if command -v wget >/dev/null 2>&1; then wget -q -4 -O $2 $1 || { echo >&2 "Failed to fetch $1. Aborting install."; exit 1; } elif command -v curl >/dev/null 2>&1; then curl -sf4L $1 > $2 || { echo >&2 "Failed to fetch $1. Aborting install."; exit 1; } else echo "Unable to find curl or wget, can not fetch needed files" exit 1 fi } check_builddep() { command -v $1 >/dev/null 2>&1 || { echo >&2 "$1 is required but not available, please install it and try again. Aborting install."; exit 1; } } BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" echo "Installing dependencies in to: $BASE_DIR" check_builddep make check_builddep cc http_fetch http://cpanmin.us /tmp/cpanm chmod +x /tmp/cpanm echo "==== Installing Nightwatch core dependencies ====" /tmp/cpanm -q -L $BASE_DIR LWP::UserAgent Crypt::SSLeay IO::Socket::INET6 JSON::PP JSON Log::LogLite Try::Tiny DBI echo "==== Installing Nightwatch-MySQL dependencies ====" /tmp/cpanm -q -L $BASE_DIR DBD::mysql rm /tmp/cpanm echo "==== Compiling headers ====" h2ph -d $BASE_DIR /usr/include/syscall.h h2ph -d $BASE_DIR /usr/include/sys/syscall.h h2ph -d $BASE_DIR /usr/include/asm/unistd.h h2ph -d $BASE_DIR /usr/include/asm/unistd_32.h h2ph -d $BASE_DIR /usr/include/asm/unistd_64.h h2ph -d $BASE_DIR /usr/include/bits/wordsize.h h2ph -d $BASE_DIR /usr/include/bits/syscall.h nightwatch/Extras/conf/Nginx.conf 0000644 00000000047 15246236675 0013052 0 ustar 00 #location http://127.0.0.1/nginx_status nightwatch/Extras/conf/Apache.conf 0000644 00000000055 15246236675 0013147 0 ustar 00 #location http://127.0.0.1/server-status?auto nightwatch/Extras/conf/MySQL.conf 0000644 00000000051 15246236675 0012727 0 ustar 00 #username root #password example_password nightwatch/Extras/init/nightwatch.generic.sh 0000755 00000001760 15246236675 0015253 0 ustar 00 #!/bin/bash SUCCESS="\E[32;40mSuccess\E[0m" FAILED="\E[31;40mFailed\E[0m" LV="/opt/fastcomet/nightwatch/Fastcomet/Nightwatch.pl" case "$1" in start) echo -n $"Starting nightwatch: " $LV RET=$? [ $RET -eq 0 ] && echo -e $SUCCESS || echo -e $FAILED exit $RET ;; debug) echo -n $"Starting nightwatch (With Debug Flag): " $LV Debug RET=$? [ $RET -eq 0 ] && echo -e $SUCCESS || echo -e $FAILED exit $RET ;; stop) echo -n $"Stopping nightwatch: " kill `cat /var/run/nightwatch.pid` 2>/dev/null RET=$? [ $RET -eq 0 ] && echo -e $SUCCESS || echo -e $FAILED exit $RET ;; restart) $0 stop $0 start ;; status) [ ! -e /var/run/nightwatch.pid ] && echo "No nightwatch pid file: status unknown" && exit 1 PID=`cat /var/run/nightwatch.pid` grep "fastcomet-nightwatch" "/proc/$PID/cmdline" 2>/dev/null RET=$? [ $RET -eq 0 ] && echo "Nightwatch is running" || echo "Nightwatch is not running" exit $RET ;; *) echo $"Usage: $0 {start|stop|restart|status}" ;; esac nightwatch/Extras/init/nightwatch.centos.sh 0000755 00000002713 15246236675 0015131 0 ustar 00 #!/bin/bash #description: Nightwatch statistics gathering #processname: fastcomet-nightwatch LVDAEMON="/opt/fastcomet/nightwatch/Fastcomet/Nightwatch.pl" . /etc/rc.d/init.d/functions case "$1" in start) echo -n "Starting Nightwatch: " $LVDAEMON RET=$? [ $RET -eq 0 ] && success || failure echo exit $RET ;; debug) echo -n "Starting Nightwatch (With Debug Flag): " $LVDAEMON Debug RET=$? [ $RET -eq 0 ] && success || failure echo exit $RET ;; stop) echo -n "Stopping Nightwatch: " kill `cat /var/run/nightwatch.pid` 2>/dev/null RET=$? [ $RET -eq 0 ] && success || failure [ $RET -eq 0 ] && rm /var/run/nightwatch.pid echo exit $RET ;; restart) $0 stop $0 start ;; status) status -p /var/run/nightwatch.pid fastcomet-nightwatch ;; update) $0 stop echo "Updating Nightwatch core files (configs will be preserved)" cd /opt/fastcomet/nightwatch && /usr/bin/git pull $0 start ;; *) echo $"Usage: $0 {start|stop|restart|status|update}" ;; esac nightwatch/Extras/init/nightwatch 0000755 00000003276 15246236675 0013233 0 ustar 00 #!/bin/sh ### BEGIN INIT INFO # Provides: nightwatch # Required-Start: $network $local_fs # Required-Stop: $network $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Nightwatch Monitoring Agent ### END INIT INFO set -e umask 022 DAEMON="/opt/fastcomet/nightwatch/Fastcomet/Nightwatch.pl" PID="/var/run/nightwatch.pid" . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting Nightwatch Agent" "nightwatch" if start-stop-daemon --start -p $PID --startas $DAEMON 2>/dev/null; then log_end_msg 0 else log_end_msg 1 fi ;; debug) log_daemon_msg "Starting Nightwatch Agent (With Debug Flag)" "nightwatch" if start-stop-daemon --start -p $PID --startas $DAEMON Debug 2>/dev/null; then log_end_msg 0 else log_end_msg 1 fi ;; stop) log_daemon_msg "Stopping Nightwatch Agent" "nightwatch" if start-stop-daemon --stop --quiet -p $PID 2>/dev/null; then log_end_msg 0 else log_end_msg 1 fi ;; restart) log_daemon_msg "Restarting Nightwatch Agent" "nightwatch" start-stop-daemon --stop --quiet --oknodo --retry 30 -p /var/run/nightwatch.pid if start-stop-daemon --start -p $PID --startas $DAEMON 2>/dev/null; then log_end_msg 0 else log_end_msg 1 fi ;; reload|force-reload) log_daemon_msg "Restarting Nightwatch Agent" "nightwatch" if start-stop-daemon --stop --quiet --oknodo --signal HUP -p /var/run/nightwatch.pid; then log_end_msg 0 else log_end_msg 1 fi ;; status) status_of_proc -p $PID $DAEMON nightwatch && exit 0 || exit $? ;; *) log_action_msg "Usage: /etc/init.d/nightwatch {start|stop|restart|force-reload|reload|status}" exit 1 esac exit 0 nightwatch/Extras/init/nightwatch.service 0000644 00000000430 15246236675 0014654 0 ustar 00 [Unit] Description=Nightwatch Agent After=network.target [Service] Type=forking ExecStart=/opt/fastcomet/nightwatch/Fastcomet/Nightwatch.pl ExecStop=/bin/kill -TERM $MAINPID ExecReload=/bin/kill -HUP $MAINPID PIDFile=/var/run/nightwatch.pid [Install] WantedBy=multi-user.target nightwatch/config/main.conf 0000644 00000000072 15246236675 0011763 0 ustar 00 post_target http://orwell.fcnode.com:3000/api/server/stats nightwatch/.gitignore 0000644 00000000041 15246236675 0010707 0 ustar 00 /bin/* /lib/* /usr/* /nbproject/* nightwatch/_h2ph_pre.ph 0000644 00000050701 15246236675 0011126 0 ustar 00 # This file was created by h2ph version 4 no warnings qw(portable); unless (defined &_FILE_OFFSET_BITS) { sub _FILE_OFFSET_BITS() { 64 } } unless (defined &_FORTIFY_SOURCE) { sub _FORTIFY_SOURCE() { 2 } } unless (defined &_GNU_SOURCE) { sub _GNU_SOURCE() { 1 } } unless (defined &_LARGEFILE64_SOURCE) { sub _LARGEFILE64_SOURCE() { 1 } } unless (defined &_LARGEFILE_SOURCE) { sub _LARGEFILE_SOURCE() { 1 } } unless (defined &_LP64) { sub _LP64() { 1 } } unless (defined &_POSIX_C_SOURCE) { sub _POSIX_C_SOURCE() { 200809 } } unless (defined &_POSIX_SOURCE) { sub _POSIX_SOURCE() { 1 } } unless (defined &_REENTRANT) { sub _REENTRANT() { 1 } } unless (defined &_STDC_PREDEF_H) { sub _STDC_PREDEF_H() { 1 } } unless (defined &_XOPEN_SOURCE) { sub _XOPEN_SOURCE() { 700 } } unless (defined &_XOPEN_SOURCE_EXTENDED) { sub _XOPEN_SOURCE_EXTENDED() { 1 } } unless (defined &__ATOMIC_ACQUIRE) { sub __ATOMIC_ACQUIRE() { 2 } } unless (defined &__ATOMIC_ACQ_REL) { sub __ATOMIC_ACQ_REL() { 4 } } unless (defined &__ATOMIC_CONSUME) { sub __ATOMIC_CONSUME() { 1 } } unless (defined &__ATOMIC_HLE_ACQUIRE) { sub __ATOMIC_HLE_ACQUIRE() { 65536 } } unless (defined &__ATOMIC_HLE_RELEASE) { sub __ATOMIC_HLE_RELEASE() { 131072 } } unless (defined &__ATOMIC_RELAXED) { sub __ATOMIC_RELAXED() { 0 } } unless (defined &__ATOMIC_RELEASE) { sub __ATOMIC_RELEASE() { 3 } } unless (defined &__ATOMIC_SEQ_CST) { sub __ATOMIC_SEQ_CST() { 5 } } unless (defined &__BIGGEST_ALIGNMENT__) { sub __BIGGEST_ALIGNMENT__() { 16 } } unless (defined &__BYTE_ORDER__) { sub __BYTE_ORDER__() { 1234 } } unless (defined &__CHAR16_TYPE__) { sub __CHAR16_TYPE__() { "short\\\ unsigned\\\ int" } } unless (defined &__CHAR32_TYPE__) { sub __CHAR32_TYPE__() { "unsigned\\\ int" } } unless (defined &__CHAR_BIT__) { sub __CHAR_BIT__() { 8 } } unless (defined &__DBL_DECIMAL_DIG__) { sub __DBL_DECIMAL_DIG__() { 17 } } unless (defined &__DBL_DENORM_MIN__) { sub __DBL_DENORM_MIN__() { "\(double\)4\.94065645841246544177e\-324L" } } unless (defined &__DBL_DIG__) { sub __DBL_DIG__() { 15 } } unless (defined &__DBL_EPSILON__) { sub __DBL_EPSILON__() { "\(double\)2\.22044604925031308085e\-16L" } } unless (defined &__DBL_HAS_DENORM__) { sub __DBL_HAS_DENORM__() { 1 } } unless (defined &__DBL_HAS_INFINITY__) { sub __DBL_HAS_INFINITY__() { 1 } } unless (defined &__DBL_HAS_QUIET_NAN__) { sub __DBL_HAS_QUIET_NAN__() { 1 } } unless (defined &__DBL_MANT_DIG__) { sub __DBL_MANT_DIG__() { 53 } } unless (defined &__DBL_MAX_10_EXP__) { sub __DBL_MAX_10_EXP__() { 308 } } unless (defined &__DBL_MAX_EXP__) { sub __DBL_MAX_EXP__() { 1024 } } unless (defined &__DBL_MAX__) { sub __DBL_MAX__() { "\(double\)1\.79769313486231570815e\+308L" } } unless (defined &__DBL_MIN_10_EXP__) { sub __DBL_MIN_10_EXP__() { -307 } } unless (defined &__DBL_MIN_EXP__) { sub __DBL_MIN_EXP__() { -1021 } } unless (defined &__DBL_MIN__) { sub __DBL_MIN__() { "\(double\)2\.22507385850720138309e\-308L" } } unless (defined &__DEC128_EPSILON__) { sub __DEC128_EPSILON__() { "1E\-33DL" } } unless (defined &__DEC128_MANT_DIG__) { sub __DEC128_MANT_DIG__() { 34 } } unless (defined &__DEC128_MAX_EXP__) { sub __DEC128_MAX_EXP__() { 6145 } } unless (defined &__DEC128_MAX__) { sub __DEC128_MAX__() { "9\.999999999999999999999999999999999E6144DL" } } unless (defined &__DEC128_MIN_EXP__) { sub __DEC128_MIN_EXP__() { -6142 } } unless (defined &__DEC128_MIN__) { sub __DEC128_MIN__() { "1E\-6143DL" } } unless (defined &__DEC128_SUBNORMAL_MIN__) { sub __DEC128_SUBNORMAL_MIN__() { "0\.000000000000000000000000000000001E\-6143DL" } } unless (defined &__DEC32_EPSILON__) { sub __DEC32_EPSILON__() { "1E\-6DF" } } unless (defined &__DEC32_MANT_DIG__) { sub __DEC32_MANT_DIG__() { 7 } } unless (defined &__DEC32_MAX_EXP__) { sub __DEC32_MAX_EXP__() { 97 } } unless (defined &__DEC32_MAX__) { sub __DEC32_MAX__() { "9\.999999E96DF" } } unless (defined &__DEC32_MIN_EXP__) { sub __DEC32_MIN_EXP__() { -94 } } unless (defined &__DEC32_MIN__) { sub __DEC32_MIN__() { "1E\-95DF" } } unless (defined &__DEC32_SUBNORMAL_MIN__) { sub __DEC32_SUBNORMAL_MIN__() { "0\.000001E\-95DF" } } unless (defined &__DEC64_EPSILON__) { sub __DEC64_EPSILON__() { "1E\-15DD" } } unless (defined &__DEC64_MANT_DIG__) { sub __DEC64_MANT_DIG__() { 16 } } unless (defined &__DEC64_MAX_EXP__) { sub __DEC64_MAX_EXP__() { 385 } } unless (defined &__DEC64_MAX__) { sub __DEC64_MAX__() { "9\.999999999999999E384DD" } } unless (defined &__DEC64_MIN_EXP__) { sub __DEC64_MIN_EXP__() { -382 } } unless (defined &__DEC64_MIN__) { sub __DEC64_MIN__() { "1E\-383DD" } } unless (defined &__DEC64_SUBNORMAL_MIN__) { sub __DEC64_SUBNORMAL_MIN__() { "0\.000000000000001E\-383DD" } } unless (defined &__DECIMAL_BID_FORMAT__) { sub __DECIMAL_BID_FORMAT__() { 1 } } unless (defined &__DECIMAL_DIG__) { sub __DECIMAL_DIG__() { 21 } } unless (defined &__DEC_EVAL_METHOD__) { sub __DEC_EVAL_METHOD__() { 2 } } unless (defined &__ELF__) { sub __ELF__() { 1 } } unless (defined &__FINITE_MATH_ONLY__) { sub __FINITE_MATH_ONLY__() { 0 } } unless (defined &__FLOAT_WORD_ORDER__) { sub __FLOAT_WORD_ORDER__() { 1234 } } unless (defined &__FLT_DECIMAL_DIG__) { sub __FLT_DECIMAL_DIG__() { 9 } } unless (defined &__FLT_DENORM_MIN__) { sub __FLT_DENORM_MIN__() { 1.40129846432481707092e-45 } } unless (defined &__FLT_DIG__) { sub __FLT_DIG__() { 6 } } unless (defined &__FLT_EPSILON__) { sub __FLT_EPSILON__() { 1.19209289550781250000e-7 } } unless (defined &__FLT_EVAL_METHOD__) { sub __FLT_EVAL_METHOD__() { 0 } } unless (defined &__FLT_HAS_DENORM__) { sub __FLT_HAS_DENORM__() { 1 } } unless (defined &__FLT_HAS_INFINITY__) { sub __FLT_HAS_INFINITY__() { 1 } } unless (defined &__FLT_HAS_QUIET_NAN__) { sub __FLT_HAS_QUIET_NAN__() { 1 } } unless (defined &__FLT_MANT_DIG__) { sub __FLT_MANT_DIG__() { 24 } } unless (defined &__FLT_MAX_10_EXP__) { sub __FLT_MAX_10_EXP__() { 38 } } unless (defined &__FLT_MAX_EXP__) { sub __FLT_MAX_EXP__() { 128 } } unless (defined &__FLT_MAX__) { sub __FLT_MAX__() { 3.40282346638528859812e+38 } } unless (defined &__FLT_MIN_10_EXP__) { sub __FLT_MIN_10_EXP__() { -37 } } unless (defined &__FLT_MIN_EXP__) { sub __FLT_MIN_EXP__() { -125 } } unless (defined &__FLT_MIN__) { sub __FLT_MIN__() { 1.17549435082228750797e-38 } } unless (defined &__FLT_RADIX__) { sub __FLT_RADIX__() { 2 } } unless (defined &__FXSR__) { sub __FXSR__() { 1 } } unless (defined &__GCC_ATOMIC_BOOL_LOCK_FREE) { sub __GCC_ATOMIC_BOOL_LOCK_FREE() { 2 } } unless (defined &__GCC_ATOMIC_CHAR16_T_LOCK_FREE) { sub __GCC_ATOMIC_CHAR16_T_LOCK_FREE() { 2 } } unless (defined &__GCC_ATOMIC_CHAR32_T_LOCK_FREE) { sub __GCC_ATOMIC_CHAR32_T_LOCK_FREE() { 2 } } unless (defined &__GCC_ATOMIC_CHAR_LOCK_FREE) { sub __GCC_ATOMIC_CHAR_LOCK_FREE() { 2 } } unless (defined &__GCC_ATOMIC_INT_LOCK_FREE) { sub __GCC_ATOMIC_INT_LOCK_FREE() { 2 } } unless (defined &__GCC_ATOMIC_LLONG_LOCK_FREE) { sub __GCC_ATOMIC_LLONG_LOCK_FREE() { 2 } } unless (defined &__GCC_ATOMIC_LONG_LOCK_FREE) { sub __GCC_ATOMIC_LONG_LOCK_FREE() { 2 } } unless (defined &__GCC_ATOMIC_POINTER_LOCK_FREE) { sub __GCC_ATOMIC_POINTER_LOCK_FREE() { 2 } } unless (defined &__GCC_ATOMIC_SHORT_LOCK_FREE) { sub __GCC_ATOMIC_SHORT_LOCK_FREE() { 2 } } unless (defined &__GCC_ATOMIC_TEST_AND_SET_TRUEVAL) { sub __GCC_ATOMIC_TEST_AND_SET_TRUEVAL() { 1 } } unless (defined &__GCC_ATOMIC_WCHAR_T_LOCK_FREE) { sub __GCC_ATOMIC_WCHAR_T_LOCK_FREE() { 2 } } unless (defined &__GCC_HAVE_DWARF2_CFI_ASM) { sub __GCC_HAVE_DWARF2_CFI_ASM() { 1 } } unless (defined &__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1) { sub __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1() { 1 } } unless (defined &__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2) { sub __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2() { 1 } } unless (defined &__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) { sub __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4() { 1 } } unless (defined &__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) { sub __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8() { 1 } } unless (defined &__GCC_IEC_559) { sub __GCC_IEC_559() { 2 } } unless (defined &__GCC_IEC_559_COMPLEX) { sub __GCC_IEC_559_COMPLEX() { 2 } } unless (defined &__GLIBC_MINOR__) { sub __GLIBC_MINOR__() { 23 } } unless (defined &__GLIBC__) { sub __GLIBC__() { 2 } } unless (defined &__GNUC_MINOR__) { sub __GNUC_MINOR__() { 4 } } unless (defined &__GNUC_PATCHLEVEL__) { sub __GNUC_PATCHLEVEL__() { 0 } } unless (defined &__GNUC_STDC_INLINE__) { sub __GNUC_STDC_INLINE__() { 1 } } unless (defined &__GNUC__) { sub __GNUC__() { 5 } } unless (defined &__GNU_LIBRARY__) { sub __GNU_LIBRARY__() { 6 } } unless (defined &__GXX_ABI_VERSION) { sub __GXX_ABI_VERSION() { 1009 } } unless (defined &__INT16_C) { sub __INT16_C() { &__INT16_C } } unless (defined &__INT16_MAX__) { sub __INT16_MAX__() { 0x7fff } } unless (defined &__INT16_TYPE__) { sub __INT16_TYPE__() { "short\\\ int" } } unless (defined &__INT32_C) { sub __INT32_C() { &__INT32_C } } unless (defined &__INT32_MAX__) { sub __INT32_MAX__() { 0x7fffffff } } unless (defined &__INT32_TYPE__) { sub __INT32_TYPE__() { "int" } } unless (defined &__INT64_C) { sub __INT64_C() { &__INT64_C } } unless (defined &__INT64_MAX__) { sub __INT64_MAX__() { hex('0x7fffffffffffffff') } } unless (defined &__INT64_TYPE__) { sub __INT64_TYPE__() { "long\\\ int" } } unless (defined &__INT8_C) { sub __INT8_C() { &__INT8_C } } unless (defined &__INT8_MAX__) { sub __INT8_MAX__() { 0x7f } } unless (defined &__INT8_TYPE__) { sub __INT8_TYPE__() { "signed\\\ char" } } unless (defined &__INTMAX_C) { sub __INTMAX_C() { &__INTMAX_C } } unless (defined &__INTMAX_MAX__) { sub __INTMAX_MAX__() { hex('0x7fffffffffffffff') } } unless (defined &__INTMAX_TYPE__) { sub __INTMAX_TYPE__() { "long\\\ int" } } unless (defined &__INTPTR_MAX__) { sub __INTPTR_MAX__() { hex('0x7fffffffffffffff') } } unless (defined &__INTPTR_TYPE__) { sub __INTPTR_TYPE__() { "long\\\ int" } } unless (defined &__INT_FAST16_MAX__) { sub __INT_FAST16_MAX__() { hex('0x7fffffffffffffff') } } unless (defined &__INT_FAST16_TYPE__) { sub __INT_FAST16_TYPE__() { "long\\\ int" } } unless (defined &__INT_FAST32_MAX__) { sub __INT_FAST32_MAX__() { hex('0x7fffffffffffffff') } } unless (defined &__INT_FAST32_TYPE__) { sub __INT_FAST32_TYPE__() { "long\\\ int" } } unless (defined &__INT_FAST64_MAX__) { sub __INT_FAST64_MAX__() { hex('0x7fffffffffffffff') } } unless (defined &__INT_FAST64_TYPE__) { sub __INT_FAST64_TYPE__() { "long\\\ int" } } unless (defined &__INT_FAST8_MAX__) { sub __INT_FAST8_MAX__() { 0x7f } } unless (defined &__INT_FAST8_TYPE__) { sub __INT_FAST8_TYPE__() { "signed\\\ char" } } unless (defined &__INT_LEAST16_MAX__) { sub __INT_LEAST16_MAX__() { 0x7fff } } unless (defined &__INT_LEAST16_TYPE__) { sub __INT_LEAST16_TYPE__() { "short\\\ int" } } unless (defined &__INT_LEAST32_MAX__) { sub __INT_LEAST32_MAX__() { 0x7fffffff } } unless (defined &__INT_LEAST32_TYPE__) { sub __INT_LEAST32_TYPE__() { "int" } } unless (defined &__INT_LEAST64_MAX__) { sub __INT_LEAST64_MAX__() { hex('0x7fffffffffffffff') } } unless (defined &__INT_LEAST64_TYPE__) { sub __INT_LEAST64_TYPE__() { "long\\\ int" } } unless (defined &__INT_LEAST8_MAX__) { sub __INT_LEAST8_MAX__() { 0x7f } } unless (defined &__INT_LEAST8_TYPE__) { sub __INT_LEAST8_TYPE__() { "signed\\\ char" } } unless (defined &__INT_MAX__) { sub __INT_MAX__() { 0x7fffffff } } unless (defined &__LDBL_DENORM_MIN__) { sub __LDBL_DENORM_MIN__() { 3.64519953188247460253e-4951 } } unless (defined &__LDBL_DIG__) { sub __LDBL_DIG__() { 18 } } unless (defined &__LDBL_EPSILON__) { sub __LDBL_EPSILON__() { 1.08420217248550443401e-19 } } unless (defined &__LDBL_HAS_DENORM__) { sub __LDBL_HAS_DENORM__() { 1 } } unless (defined &__LDBL_HAS_INFINITY__) { sub __LDBL_HAS_INFINITY__() { 1 } } unless (defined &__LDBL_HAS_QUIET_NAN__) { sub __LDBL_HAS_QUIET_NAN__() { 1 } } unless (defined &__LDBL_MANT_DIG__) { sub __LDBL_MANT_DIG__() { 64 } } unless (defined &__LDBL_MAX_10_EXP__) { sub __LDBL_MAX_10_EXP__() { 4932 } } unless (defined &__LDBL_MAX_EXP__) { sub __LDBL_MAX_EXP__() { 16384 } } unless (defined &__LDBL_MAX__) { sub __LDBL_MAX__() { 1.18973149535723176502e+4932 } } unless (defined &__LDBL_MIN_10_EXP__) { sub __LDBL_MIN_10_EXP__() { -4931 } } unless (defined &__LDBL_MIN_EXP__) { sub __LDBL_MIN_EXP__() { -16381 } } unless (defined &__LDBL_MIN__) { sub __LDBL_MIN__() { 3.36210314311209350626e-4932 } } unless (defined &__LONG_LONG_MAX__) { sub __LONG_LONG_MAX__() { hex('0x7fffffffffffffff') } } unless (defined &__LONG_MAX__) { sub __LONG_MAX__() { hex('0x7fffffffffffffff') } } unless (defined &__LP64__) { sub __LP64__() { 1 } } unless (defined &__MMX__) { sub __MMX__() { 1 } } unless (defined &__ORDER_BIG_ENDIAN__) { sub __ORDER_BIG_ENDIAN__() { 4321 } } unless (defined &__ORDER_LITTLE_ENDIAN__) { sub __ORDER_LITTLE_ENDIAN__() { 1234 } } unless (defined &__ORDER_PDP_ENDIAN__) { sub __ORDER_PDP_ENDIAN__() { 3412 } } unless (defined &__PRAGMA_REDEFINE_EXTNAME) { sub __PRAGMA_REDEFINE_EXTNAME() { 1 } } unless (defined &__PTRDIFF_MAX__) { sub __PTRDIFF_MAX__() { hex('0x7fffffffffffffff') } } unless (defined &__PTRDIFF_TYPE__) { sub __PTRDIFF_TYPE__() { "long\\\ int" } } unless (defined &__SCHAR_MAX__) { sub __SCHAR_MAX__() { 0x7f } } unless (defined &__SHRT_MAX__) { sub __SHRT_MAX__() { 0x7fff } } unless (defined &__SIG_ATOMIC_MAX__) { sub __SIG_ATOMIC_MAX__() { 0x7fffffff } } unless (defined &__SIG_ATOMIC_MIN__) { sub __SIG_ATOMIC_MIN__() { "\-0x7fffffff\\\ \-\\\ 1" } } unless (defined &__SIG_ATOMIC_TYPE__) { sub __SIG_ATOMIC_TYPE__() { "int" } } unless (defined &__SIZEOF_DOUBLE__) { sub __SIZEOF_DOUBLE__() { 8 } } unless (defined &__SIZEOF_FLOAT128__) { sub __SIZEOF_FLOAT128__() { 16 } } unless (defined &__SIZEOF_FLOAT80__) { sub __SIZEOF_FLOAT80__() { 16 } } unless (defined &__SIZEOF_FLOAT__) { sub __SIZEOF_FLOAT__() { 4 } } unless (defined &__SIZEOF_INT128__) { sub __SIZEOF_INT128__() { 16 } } unless (defined &__SIZEOF_INT__) { sub __SIZEOF_INT__() { 4 } } unless (defined &__SIZEOF_LONG_DOUBLE__) { sub __SIZEOF_LONG_DOUBLE__() { 16 } } unless (defined &__SIZEOF_LONG_LONG__) { sub __SIZEOF_LONG_LONG__() { 8 } } unless (defined &__SIZEOF_LONG__) { sub __SIZEOF_LONG__() { 8 } } unless (defined &__SIZEOF_POINTER__) { sub __SIZEOF_POINTER__() { 8 } } unless (defined &__SIZEOF_PTRDIFF_T__) { sub __SIZEOF_PTRDIFF_T__() { 8 } } unless (defined &__SIZEOF_SHORT__) { sub __SIZEOF_SHORT__() { 2 } } unless (defined &__SIZEOF_SIZE_T__) { sub __SIZEOF_SIZE_T__() { 8 } } unless (defined &__SIZEOF_WCHAR_T__) { sub __SIZEOF_WCHAR_T__() { 4 } } unless (defined &__SIZEOF_WINT_T__) { sub __SIZEOF_WINT_T__() { 4 } } unless (defined &__SIZE_MAX__) { sub __SIZE_MAX__() { hex('0xffffffffffffffff') } } unless (defined &__SIZE_TYPE__) { sub __SIZE_TYPE__() { "long\\\ unsigned\\\ int" } } unless (defined &__SSE2_MATH__) { sub __SSE2_MATH__() { 1 } } unless (defined &__SSE2__) { sub __SSE2__() { 1 } } unless (defined &__SSE_MATH__) { sub __SSE_MATH__() { 1 } } unless (defined &__SSE__) { sub __SSE__() { 1 } } unless (defined &__SSP_STRONG__) { sub __SSP_STRONG__() { 3 } } unless (defined &__STDC_HOSTED__) { sub __STDC_HOSTED__() { 1 } } unless (defined &__STDC_IEC_559_COMPLEX__) { sub __STDC_IEC_559_COMPLEX__() { 1 } } unless (defined &__STDC_IEC_559__) { sub __STDC_IEC_559__() { 1 } } unless (defined &__STDC_ISO_10646__) { sub __STDC_ISO_10646__() { 201505 } } unless (defined &__STDC_NO_THREADS__) { sub __STDC_NO_THREADS__() { 1 } } unless (defined &__STDC_UTF_16__) { sub __STDC_UTF_16__() { 1 } } unless (defined &__STDC_UTF_32__) { sub __STDC_UTF_32__() { 1 } } unless (defined &__STDC_VERSION__) { sub __STDC_VERSION__() { 201112 } } unless (defined &__STDC__) { sub __STDC__() { 1 } } unless (defined &__UINT16_C) { sub __UINT16_C() { &__UINT16_C } } unless (defined &__UINT16_MAX__) { sub __UINT16_MAX__() { 0xffff } } unless (defined &__UINT16_TYPE__) { sub __UINT16_TYPE__() { "short\\\ unsigned\\\ int" } } unless (defined &__UINT32_C) { sub __UINT32_C() { &__UINT32_C } } unless (defined &__UINT32_MAX__) { sub __UINT32_MAX__() { 0xffffffff } } unless (defined &__UINT32_TYPE__) { sub __UINT32_TYPE__() { "unsigned\\\ int" } } unless (defined &__UINT64_C) { sub __UINT64_C() { &__UINT64_C } } unless (defined &__UINT64_MAX__) { sub __UINT64_MAX__() { hex('0xffffffffffffffff') } } unless (defined &__UINT64_TYPE__) { sub __UINT64_TYPE__() { "long\\\ unsigned\\\ int" } } unless (defined &__UINT8_C) { sub __UINT8_C() { &__UINT8_C } } unless (defined &__UINT8_MAX__) { sub __UINT8_MAX__() { 0xff } } unless (defined &__UINT8_TYPE__) { sub __UINT8_TYPE__() { "unsigned\\\ char" } } unless (defined &__UINTMAX_C) { sub __UINTMAX_C() { &__UINTMAX_C } } unless (defined &__UINTMAX_MAX__) { sub __UINTMAX_MAX__() { hex('0xffffffffffffffff') } } unless (defined &__UINTMAX_TYPE__) { sub __UINTMAX_TYPE__() { "long\\\ unsigned\\\ int" } } unless (defined &__UINTPTR_MAX__) { sub __UINTPTR_MAX__() { hex('0xffffffffffffffff') } } unless (defined &__UINTPTR_TYPE__) { sub __UINTPTR_TYPE__() { "long\\\ unsigned\\\ int" } } unless (defined &__UINT_FAST16_MAX__) { sub __UINT_FAST16_MAX__() { hex('0xffffffffffffffff') } } unless (defined &__UINT_FAST16_TYPE__) { sub __UINT_FAST16_TYPE__() { "long\\\ unsigned\\\ int" } } unless (defined &__UINT_FAST32_MAX__) { sub __UINT_FAST32_MAX__() { hex('0xffffffffffffffff') } } unless (defined &__UINT_FAST32_TYPE__) { sub __UINT_FAST32_TYPE__() { "long\\\ unsigned\\\ int" } } unless (defined &__UINT_FAST64_MAX__) { sub __UINT_FAST64_MAX__() { hex('0xffffffffffffffff') } } unless (defined &__UINT_FAST64_TYPE__) { sub __UINT_FAST64_TYPE__() { "long\\\ unsigned\\\ int" } } unless (defined &__UINT_FAST8_MAX__) { sub __UINT_FAST8_MAX__() { 0xff } } unless (defined &__UINT_FAST8_TYPE__) { sub __UINT_FAST8_TYPE__() { "unsigned\\\ char" } } unless (defined &__UINT_LEAST16_MAX__) { sub __UINT_LEAST16_MAX__() { 0xffff } } unless (defined &__UINT_LEAST16_TYPE__) { sub __UINT_LEAST16_TYPE__() { "short\\\ unsigned\\\ int" } } unless (defined &__UINT_LEAST32_MAX__) { sub __UINT_LEAST32_MAX__() { 0xffffffff } } unless (defined &__UINT_LEAST32_TYPE__) { sub __UINT_LEAST32_TYPE__() { "unsigned\\\ int" } } unless (defined &__UINT_LEAST64_MAX__) { sub __UINT_LEAST64_MAX__() { hex('0xffffffffffffffff') } } unless (defined &__UINT_LEAST64_TYPE__) { sub __UINT_LEAST64_TYPE__() { "long\\\ unsigned\\\ int" } } unless (defined &__UINT_LEAST8_MAX__) { sub __UINT_LEAST8_MAX__() { 0xff } } unless (defined &__UINT_LEAST8_TYPE__) { sub __UINT_LEAST8_TYPE__() { "unsigned\\\ char" } } unless (defined &__USE_FILE_OFFSET64) { sub __USE_FILE_OFFSET64() { 1 } } unless (defined &__USE_GNU) { sub __USE_GNU() { 1 } } unless (defined &__USE_LARGEFILE) { sub __USE_LARGEFILE() { 1 } } unless (defined &__USE_LARGEFILE64) { sub __USE_LARGEFILE64() { 1 } } unless (defined &__USE_MISC) { sub __USE_MISC() { 1 } } unless (defined &__USE_POSIX) { sub __USE_POSIX() { 1 } } unless (defined &__USE_POSIX199309) { sub __USE_POSIX199309() { 1 } } unless (defined &__USE_POSIX199506) { sub __USE_POSIX199506() { 1 } } unless (defined &__USE_POSIX2) { sub __USE_POSIX2() { 1 } } unless (defined &__USE_REENTRANT) { sub __USE_REENTRANT() { 1 } } unless (defined &__USE_UNIX98) { sub __USE_UNIX98() { 1 } } unless (defined &__USE_XOPEN) { sub __USE_XOPEN() { 1 } } unless (defined &__USE_XOPEN_EXTENDED) { sub __USE_XOPEN_EXTENDED() { 1 } } unless (defined &__VERSION__) { sub __VERSION__() { "\"5\.4\.0\\\ 20160609\"" } } unless (defined &__WCHAR_MAX__) { sub __WCHAR_MAX__() { 0x7fffffff } } unless (defined &__WCHAR_MIN__) { sub __WCHAR_MIN__() { "\-0x7fffffff\\\ \-\\\ 1" } } unless (defined &__WCHAR_TYPE__) { sub __WCHAR_TYPE__() { "int" } } unless (defined &__WINT_MAX__) { sub __WINT_MAX__() { 0xffffffff } } unless (defined &__WINT_MIN__) { sub __WINT_MIN__() { 0 } } unless (defined &__WINT_TYPE__) { sub __WINT_TYPE__() { "unsigned\\\ int" } } unless (defined &__amd64) { sub __amd64() { 1 } } unless (defined &__amd64__) { sub __amd64__() { 1 } } unless (defined &__code_model_small__) { sub __code_model_small__() { 1 } } unless (defined &__gnu_linux__) { sub __gnu_linux__() { 1 } } unless (defined &__has_include) { sub __has_include() { &__has_include } } unless (defined &__has_include_next) { sub __has_include_next() { &__has_include_next } } unless (defined &__k8) { sub __k8() { 1 } } unless (defined &__k8__) { sub __k8__() { 1 } } unless (defined &__linux) { sub __linux() { 1 } } unless (defined &__linux__) { sub __linux__() { 1 } } unless (defined &__unix) { sub __unix() { 1 } } unless (defined &__unix__) { sub __unix__() { 1 } } unless (defined &__x86_64) { sub __x86_64() { 1 } } unless (defined &__x86_64__) { sub __x86_64__() { 1 } } unless (defined &linux) { sub linux() { 1 } } unless (defined &unix) { sub unix() { 1 } } 1; nightwatch/LICENSE 0000644 00000057567 15246236675 0007755 0 ustar 00 Copyright 2013 Linode, LLC. Longview is made available under the terms of the Perl Artistic License, or GPLv2 at the recipients discretion. ======================================================================= GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Linode Longview Monitoring Agent Copyright (C) 2013 linode This program 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 program 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 program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. {signature of Ty Coon}, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. ======================================================================= The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End nightwatch/.git/description 0000644 00000000111 15246236675 0012024 0 ustar 00 Unnamed repository; edit this file 'description' to name the repository. nightwatch/.git/hooks/fsmonitor-watchman.sample 0000644 00000011057 15246236675 0015737 0 ustar 00 #!/usr/bin/perl use strict; use warnings; use IPC::Open2; # An example hook script to integrate Watchman # (https://facebook.github.io/watchman/) with git to speed up detecting # new and modified files. # # The hook is passed a version (currently 2) and last update token # formatted as a string and outputs to stdout a new update token and # all files that have been modified since the update token. Paths must # be relative to the root of the working tree and separated by a single NUL. # # To enable this hook, rename this file to "query-watchman" and set # 'git config core.fsmonitor .git/hooks/query-watchman' # my ($version, $last_update_token) = @ARGV; # Uncomment for debugging # print STDERR "$0 $version $last_update_token\n"; # Check the hook interface version if ($version ne 2) { die "Unsupported query-fsmonitor hook version '$version'.\n" . "Falling back to scanning...\n"; } my $git_work_tree = get_working_dir(); my $retry = 1; my $json_pkg; eval { require JSON::XS; $json_pkg = "JSON::XS"; 1; } or do { require JSON::PP; $json_pkg = "JSON::PP"; }; launch_watchman(); sub launch_watchman { my $o = watchman_query(); if (is_work_tree_watched($o)) { output_result($o->{clock}, @{$o->{files}}); } } sub output_result { my ($clockid, @files) = @_; # Uncomment for debugging watchman output # open (my $fh, ">", ".git/watchman-output.out"); # binmode $fh, ":utf8"; # print $fh "$clockid\n@files\n"; # close $fh; binmode STDOUT, ":utf8"; print $clockid; print "\0"; local $, = "\0"; print @files; } sub watchman_clock { my $response = qx/watchman clock "$git_work_tree"/; die "Failed to get clock id on '$git_work_tree'.\n" . "Falling back to scanning...\n" if $? != 0; return $json_pkg->new->utf8->decode($response); } sub watchman_query { my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty') or die "open2() failed: $!\n" . "Falling back to scanning...\n"; # In the query expression below we're asking for names of files that # changed since $last_update_token but not from the .git folder. # # To accomplish this, we're using the "since" generator to use the # recency index to select candidate nodes and "fields" to limit the # output to file names only. Then we're using the "expression" term to # further constrain the results. if (substr($last_update_token, 0, 1) eq "c") { $last_update_token = "\"$last_update_token\""; } my $query = <<" END"; ["query", "$git_work_tree", { "since": $last_update_token, "fields": ["name"], "expression": ["not", ["dirname", ".git"]] }] END # Uncomment for debugging the watchman query # open (my $fh, ">", ".git/watchman-query.json"); # print $fh $query; # close $fh; print CHLD_IN $query; close CHLD_IN; my $response = do {local $/; <CHLD_OUT>}; # Uncomment for debugging the watch response # open ($fh, ">", ".git/watchman-response.json"); # print $fh $response; # close $fh; die "Watchman: command returned no output.\n" . "Falling back to scanning...\n" if $response eq ""; die "Watchman: command returned invalid output: $response\n" . "Falling back to scanning...\n" unless $response =~ /^\{/; return $json_pkg->new->utf8->decode($response); } sub is_work_tree_watched { my ($output) = @_; my $error = $output->{error}; if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) { $retry--; my $response = qx/watchman watch "$git_work_tree"/; die "Failed to make watchman watch '$git_work_tree'.\n" . "Falling back to scanning...\n" if $? != 0; $output = $json_pkg->new->utf8->decode($response); $error = $output->{error}; die "Watchman: $error.\n" . "Falling back to scanning...\n" if $error; # Uncomment for debugging watchman output # open (my $fh, ">", ".git/watchman-output.out"); # close $fh; # Watchman will always return all files on the first query so # return the fast "everything is dirty" flag to git and do the # Watchman query just to get it over with now so we won't pay # the cost in git to look up each individual file. my $o = watchman_clock(); $error = $output->{error}; die "Watchman: $error.\n" . "Falling back to scanning...\n" if $error; output_result($o->{clock}, ("/")); $last_update_token = $o->{clock}; eval { launch_watchman() }; return 0; } die "Watchman: $error.\n" . "Falling back to scanning...\n" if $error; return 1; } sub get_working_dir { my $working_dir; if ($^O =~ 'msys' || $^O =~ 'cygwin') { $working_dir = Win32::GetCwd(); $working_dir =~ tr/\\/\//; } else { require Cwd; $working_dir = Cwd::cwd(); } return $working_dir; } nightwatch/.git/hooks/prepare-commit-msg.sample 0000644 00000003026 15246236675 0015624 0 ustar 00 #!/bin/sh # # An example hook script to prepare the commit log message. # Called by "git commit" with the name of the file that has the # commit message, followed by the description of the commit # message's source. The hook's purpose is to edit the commit # message file. If the hook fails with a non-zero status, # the commit is aborted. # # To enable this hook, rename this file to "prepare-commit-msg". # This hook includes three examples. The first one removes the # "# Please enter the commit message..." help message. # # The second includes the output of "git diff --name-status -r" # into the message, just before the "git status" output. It is # commented because it doesn't cope with --amend or with squashed # commits. # # The third example adds a Signed-off-by line to the message, that can # still be edited. This is rarely a good idea. COMMIT_MSG_FILE=$1 COMMIT_SOURCE=$2 SHA1=$3 /usr/local/cpanel/3rdparty/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" # case "$COMMIT_SOURCE,$SHA1" in # ,|template,) # /usr/local/cpanel/3rdparty/bin/perl -i.bak -pe ' # print "\n" . `git diff --cached --name-status -r` # if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; # *) ;; # esac # SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') # git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" # if test -z "$COMMIT_SOURCE" # then # /usr/local/cpanel/3rdparty/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" # fi nightwatch/.git/hooks/pre-applypatch.sample 0000644 00000000650 15246236675 0015045 0 ustar 00 #!/bin/sh # # An example hook script to verify what is about to be committed # by applypatch from an e-mail message. # # The hook should exit with non-zero status after issuing an # appropriate message if it wants to stop the commit. # # To enable this hook, rename this file to "pre-applypatch". . git-sh-setup precommit="$(git rev-parse --git-path hooks/pre-commit)" test -x "$precommit" && exec "$precommit" ${1+"$@"} : nightwatch/.git/hooks/pre-rebase.sample 0000644 00000011470 15246236675 0014143 0 ustar 00 #!/bin/sh # # Copyright (c) 2006, 2008 Junio C Hamano # # The "pre-rebase" hook is run just before "git rebase" starts doing # its job, and can prevent the command from running by exiting with # non-zero status. # # The hook is called with the following parameters: # # $1 -- the upstream the series was forked from. # $2 -- the branch being rebased (or empty when rebasing the current branch). # # This sample shows how to prevent topic branches that are already # merged to 'next' branch from getting rebased, because allowing it # would result in rebasing already published history. publish=next basebranch="$1" if test "$#" = 2 then topic="refs/heads/$2" else topic=`git symbolic-ref HEAD` || exit 0 ;# we do not interrupt rebasing detached HEAD fi case "$topic" in refs/heads/??/*) ;; *) exit 0 ;# we do not interrupt others. ;; esac # Now we are dealing with a topic branch being rebased # on top of master. Is it OK to rebase it? # Does the topic really exist? git show-ref -q "$topic" || { echo >&2 "No such branch $topic" exit 1 } # Is topic fully merged to master? not_in_master=`git rev-list --pretty=oneline ^master "$topic"` if test -z "$not_in_master" then echo >&2 "$topic is fully merged to master; better remove it." exit 1 ;# we could allow it, but there is no point. fi # Is topic ever merged to next? If so you should not be rebasing it. only_next_1=`git rev-list ^master "^$topic" ${publish} | sort` only_next_2=`git rev-list ^master ${publish} | sort` if test "$only_next_1" = "$only_next_2" then not_in_topic=`git rev-list "^$topic" master` if test -z "$not_in_topic" then echo >&2 "$topic is already up to date with master" exit 1 ;# we could allow it, but there is no point. else exit 0 fi else not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` /usr/local/cpanel/3rdparty/bin/perl -e ' my $topic = $ARGV[0]; my $msg = "* $topic has commits already merged to public branch:\n"; my (%not_in_next) = map { /^([0-9a-f]+) /; ($1 => 1); } split(/\n/, $ARGV[1]); for my $elem (map { /^([0-9a-f]+) (.*)$/; [$1 => $2]; } split(/\n/, $ARGV[2])) { if (!exists $not_in_next{$elem->[0]}) { if ($msg) { print STDERR $msg; undef $msg; } print STDERR " $elem->[1]\n"; } } ' "$topic" "$not_in_next" "$not_in_master" exit 1 fi <<\DOC_END This sample hook safeguards topic branches that have been published from being rewound. The workflow assumed here is: * Once a topic branch forks from "master", "master" is never merged into it again (either directly or indirectly). * Once a topic branch is fully cooked and merged into "master", it is deleted. If you need to build on top of it to correct earlier mistakes, a new topic branch is created by forking at the tip of the "master". This is not strictly necessary, but it makes it easier to keep your history simple. * Whenever you need to test or publish your changes to topic branches, merge them into "next" branch. The script, being an example, hardcodes the publish branch name to be "next", but it is trivial to make it configurable via $GIT_DIR/config mechanism. With this workflow, you would want to know: (1) ... if a topic branch has ever been merged to "next". Young topic branches can have stupid mistakes you would rather clean up before publishing, and things that have not been merged into other branches can be easily rebased without affecting other people. But once it is published, you would not want to rewind it. (2) ... if a topic branch has been fully merged to "master". Then you can delete it. More importantly, you should not build on top of it -- other people may already want to change things related to the topic as patches against your "master", so if you need further changes, it is better to fork the topic (perhaps with the same name) afresh from the tip of "master". Let's look at this example: o---o---o---o---o---o---o---o---o---o "next" / / / / / a---a---b A / / / / / / / / c---c---c---c B / / / / \ / / / / b---b C \ / / / / / \ / ---o---o---o---o---o---o---o---o---o---o---o "master" A, B and C are topic branches. * A has one fix since it was merged up to "next". * B has finished. It has been fully merged up to "master" and "next", and is ready to be deleted. * C has not merged to "next" at all. We would want to allow C to be rebased, refuse A, and encourage B to be deleted. To compute (1): git rev-list ^master ^topic next git rev-list ^master next if these match, topic has not merged in next at all. To compute (2): git rev-list master..topic if this is empty, it is fully merged to "master". DOC_END nightwatch/.git/hooks/commit-msg.sample 0000644 00000001600 15246236675 0014164 0 ustar 00 #!/bin/sh # # An example hook script to check the commit log message. # Called by "git commit" with one argument, the name of the file # that has the commit message. The hook should exit with non-zero # status after issuing an appropriate message if it wants to stop the # commit. The hook is allowed to edit the commit message file. # # To enable this hook, rename this file to "commit-msg". # Uncomment the below to add a Signed-off-by line to the message. # Doing this in a hook is a bad idea in general, but the prepare-commit-msg # hook is more suited to it. # # SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') # grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" # This example catches duplicate Signed-off-by lines. test "" = "$(grep '^Signed-off-by: ' "$1" | sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { echo >&2 Duplicate Signed-off-by lines. exit 1 } nightwatch/.git/hooks/pre-commit.sample 0000644 00000003153 15246236675 0014171 0 ustar 00 #!/bin/sh # # An example hook script to verify what is about to be committed. # Called by "git commit" with no arguments. The hook should # exit with non-zero status after issuing an appropriate message if # it wants to stop the commit. # # To enable this hook, rename this file to "pre-commit". if git rev-parse --verify HEAD >/dev/null 2>&1 then against=HEAD else # Initial commit: diff against an empty tree object against=$(git hash-object -t tree /dev/null) fi # If you want to allow non-ASCII filenames set this variable to true. allownonascii=$(git config --type=bool hooks.allownonascii) # Redirect output to stderr. exec 1>&2 # Cross platform projects tend to avoid non-ASCII filenames; prevent # them from being added to the repository. We exploit the fact that the # printable range starts at the space character and ends with tilde. if [ "$allownonascii" != "true" ] && # Note that the use of brackets around a tr range is ok here, (it's # even required, for portability to Solaris 10's /usr/bin/tr), since # the square bracket bytes happen to fall in the designated range. test $(git diff --cached --name-only --diff-filter=A -z $against | LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 then cat <<\EOF Error: Attempt to add a non-ASCII file name. This can cause problems if you want to work with people on other platforms. To be portable it is advisable to rename the file. If you know what you are doing you can disable this check using: git config hooks.allownonascii true EOF exit 1 fi # If there are whitespace errors, print the offending file names and fail. exec git diff-index --check --cached $against -- nightwatch/.git/hooks/pre-merge-commit.sample 0000644 00000000640 15246236675 0015264 0 ustar 00 #!/bin/sh # # An example hook script to verify what is about to be committed. # Called by "git merge" with no arguments. The hook should # exit with non-zero status after issuing an appropriate message to # stderr if it wants to stop the merge commit. # # To enable this hook, rename this file to "pre-merge-commit". . git-sh-setup test -x "$GIT_DIR/hooks/pre-commit" && exec "$GIT_DIR/hooks/pre-commit" : nightwatch/.git/hooks/applypatch-msg.sample 0000644 00000000736 15246236675 0015052 0 ustar 00 #!/bin/sh # # An example hook script to check the commit log message taken by # applypatch from an e-mail message. # # The hook should exit with non-zero status after issuing an # appropriate message if it wants to stop the commit. The hook is # allowed to edit the commit message file. # # To enable this hook, rename this file to "applypatch-msg". . git-sh-setup commitmsg="$(git rev-parse --git-path hooks/commit-msg)" test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} : nightwatch/.git/hooks/pre-receive.sample 0000644 00000001040 15246236675 0014314 0 ustar 00 #!/bin/sh # # An example hook script to make use of push options. # The example simply echoes all push options that start with 'echoback=' # and rejects all pushes when the "reject" push option is used. # # To enable this hook, rename this file to "pre-receive". if test -n "$GIT_PUSH_OPTION_COUNT" then i=0 while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" do eval "value=\$GIT_PUSH_OPTION_$i" case "$value" in echoback=*) echo "echo from the pre-receive-hook: ${value#*=}" >&2 ;; reject) exit 1 esac i=$((i + 1)) done fi nightwatch/.git/hooks/pre-push.sample 0000644 00000002536 15246236675 0013664 0 ustar 00 #!/bin/sh # An example hook script to verify what is about to be pushed. Called by "git # push" after it has checked the remote status, but before anything has been # pushed. If this script exits with a non-zero status nothing will be pushed. # # This hook is called with the following parameters: # # $1 -- Name of the remote to which the push is being done # $2 -- URL to which the push is being done # # If pushing without using a named remote those arguments will be equal. # # Information about the commits which are being pushed is supplied as lines to # the standard input in the form: # # <local ref> <local oid> <remote ref> <remote oid> # # This sample shows how to prevent push of commits where the log message starts # with "WIP" (work in progress). remote="$1" url="$2" zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0') while read local_ref local_oid remote_ref remote_oid do if test "$local_oid" = "$zero" then # Handle delete : else if test "$remote_oid" = "$zero" then # New branch, examine all commits range="$local_oid" else # Update to existing branch, examine new commits range="$remote_oid..$local_oid" fi # Check for WIP commit commit=$(git rev-list -n 1 --grep '^WIP' "$range") if test -n "$commit" then echo >&2 "Found WIP commit in $local_ref, not pushing" exit 1 fi fi done exit 0 nightwatch/.git/hooks/update.sample 0000644 00000007102 15246236675 0013375 0 ustar 00 #!/bin/sh # # An example hook script to block unannotated tags from entering. # Called by "git receive-pack" with arguments: refname sha1-old sha1-new # # To enable this hook, rename this file to "update". # # Config # ------ # hooks.allowunannotated # This boolean sets whether unannotated tags will be allowed into the # repository. By default they won't be. # hooks.allowdeletetag # This boolean sets whether deleting tags will be allowed in the # repository. By default they won't be. # hooks.allowmodifytag # This boolean sets whether a tag may be modified after creation. By default # it won't be. # hooks.allowdeletebranch # This boolean sets whether deleting branches will be allowed in the # repository. By default they won't be. # hooks.denycreatebranch # This boolean sets whether remotely creating branches will be denied # in the repository. By default this is allowed. # # --- Command line refname="$1" oldrev="$2" newrev="$3" # --- Safety check if [ -z "$GIT_DIR" ]; then echo "Don't run this script from the command line." >&2 echo " (if you want, you could supply GIT_DIR then run" >&2 echo " $0 <ref> <oldrev> <newrev>)" >&2 exit 1 fi if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then echo "usage: $0 <ref> <oldrev> <newrev>" >&2 exit 1 fi # --- Config allowunannotated=$(git config --type=bool hooks.allowunannotated) allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch) denycreatebranch=$(git config --type=bool hooks.denycreatebranch) allowdeletetag=$(git config --type=bool hooks.allowdeletetag) allowmodifytag=$(git config --type=bool hooks.allowmodifytag) # check for no description projectdesc=$(sed -e '1q' "$GIT_DIR/description") case "$projectdesc" in "Unnamed repository"* | "") echo "*** Project description file hasn't been set" >&2 exit 1 ;; esac # --- Check types # if $newrev is 0000...0000, it's a commit to delete a ref. zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0') if [ "$newrev" = "$zero" ]; then newrev_type=delete else newrev_type=$(git cat-file -t $newrev) fi case "$refname","$newrev_type" in refs/tags/*,commit) # un-annotated tag short_refname=${refname##refs/tags/} if [ "$allowunannotated" != "true" ]; then echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 exit 1 fi ;; refs/tags/*,delete) # delete tag if [ "$allowdeletetag" != "true" ]; then echo "*** Deleting a tag is not allowed in this repository" >&2 exit 1 fi ;; refs/tags/*,tag) # annotated tag if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 then echo "*** Tag '$refname' already exists." >&2 echo "*** Modifying a tag is not allowed in this repository." >&2 exit 1 fi ;; refs/heads/*,commit) # branch if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then echo "*** Creating a branch is not allowed in this repository" >&2 exit 1 fi ;; refs/heads/*,delete) # delete branch if [ "$allowdeletebranch" != "true" ]; then echo "*** Deleting a branch is not allowed in this repository" >&2 exit 1 fi ;; refs/remotes/*,commit) # tracking branch ;; refs/remotes/*,delete) # delete tracking branch if [ "$allowdeletebranch" != "true" ]; then echo "*** Deleting a tracking branch is not allowed in this repository" >&2 exit 1 fi ;; *) # Anything else (is there anything else?) echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 exit 1 ;; esac # --- Finished exit 0 nightwatch/.git/hooks/push-to-checkout.sample 0000644 00000005337 15246236675 0015325 0 ustar 00 #!/bin/sh # An example hook script to update a checked-out tree on a git push. # # This hook is invoked by git-receive-pack(1) when it reacts to git # push and updates reference(s) in its repository, and when the push # tries to update the branch that is currently checked out and the # receive.denyCurrentBranch configuration variable is set to # updateInstead. # # By default, such a push is refused if the working tree and the index # of the remote repository has any difference from the currently # checked out commit; when both the working tree and the index match # the current commit, they are updated to match the newly pushed tip # of the branch. This hook is to be used to override the default # behaviour; however the code below reimplements the default behaviour # as a starting point for convenient modification. # # The hook receives the commit with which the tip of the current # branch is going to be updated: commit=$1 # It can exit with a non-zero status to refuse the push (when it does # so, it must not modify the index or the working tree). die () { echo >&2 "$*" exit 1 } # Or it can make any necessary changes to the working tree and to the # index to bring them to the desired state when the tip of the current # branch is updated to the new commit, and exit with a zero status. # # For example, the hook can simply run git read-tree -u -m HEAD "$1" # in order to emulate git fetch that is run in the reverse direction # with git push, as the two-tree form of git read-tree -u -m is # essentially the same as git switch or git checkout that switches # branches while keeping the local changes in the working tree that do # not interfere with the difference between the branches. # The below is a more-or-less exact translation to shell of the C code # for the default behaviour for git's push-to-checkout hook defined in # the push_to_deploy() function in builtin/receive-pack.c. # # Note that the hook will be executed from the repository directory, # not from the working tree, so if you want to perform operations on # the working tree, you will have to adapt your code accordingly, e.g. # by adding "cd .." or using relative paths. if ! git update-index -q --ignore-submodules --refresh then die "Up-to-date check failed" fi if ! git diff-files --quiet --ignore-submodules -- then die "Working directory has unstaged changes" fi # This is a rough translation of: # # head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX if git cat-file -e HEAD 2>/dev/null then head=HEAD else head=$(git hash-object -t tree --stdin </dev/null) fi if ! git diff-index --quiet --cached --ignore-submodules $head -- then die "Working directory has staged changes" fi if ! git read-tree -u -m "$commit" then die "Could not update working tree to new HEAD" fi nightwatch/.git/hooks/post-update.sample 0000644 00000000275 15246236675 0014364 0 ustar 00 #!/bin/sh # # An example hook script to prepare a packed repository for use over # dumb transports. # # To enable this hook, rename this file to "post-update". exec git update-server-info nightwatch/.git/info/exclude 0000644 00000000360 15246236675 0012073 0 ustar 00 # git ls-files --others --exclude-from=.git/info/exclude # Lines that start with '#' are comments. # For a project mostly in C, the following would be a good set of # exclude patterns (uncomment them if you want to use them): # *.[oa] # *~ nightwatch/.git/objects/pack/pack-dd665b83870479f236458c8614e5b7737d771440.idx 0000444 00000054544 15246236675 0020547 0 ustar 00 �tOc # % '