[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[monit-dev] [monit] r354 committed - remove strftime implementation ...
From: |
monit |
Subject: |
[monit-dev] [monit] r354 committed - remove strftime implementation ... all platforms except AIX support th... |
Date: |
Tue, 05 Apr 2011 09:58:57 +0000 |
Revision: 354
Author: address@hidden
Date: Tue Apr 5 02:57:57 2011
Log: remove strftime implementation ... all platforms except AIX
support the %z format specifier because of which it was added)
http://code.google.com/p/monit/source/detail?r=354
Deleted:
/trunk/contrib/monit.php
/trunk/contrib/packages/debian
/trunk/contrib/packages/suse
/trunk/contrib/waitdate.patch
/trunk/contrib/wap.php
/trunk/external
/trunk/m4
Modified:
/trunk/Makefile.in
/trunk/configure.ac
=======================================
--- /trunk/contrib/monit.php Sat Nov 7 14:10:27 2009
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-// Copyright (C), 2004 David Fletcher, <address@hidden>
-//
-// 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 3 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// DESCRIPTON
-// Script to forward a request on a web server to the Monit webserver.
-// Allows the Monit information screen to be viewed remotely, without
-// leaving an additional port open on the server.
-//
-// INSTALLATION
-// Place this script on your webserver.
-// Use a password protected area if you like.
-// Set the configuration information below to match your monit
installation.
-// With this script you are accessing monit from the localhost, so you
don't
-// need to allow external access through your firewall.
-//
-// Requires PHP, and a working webserver!
-// @author Author David Fletcher, <address@hidden>
-
-
-//Configuration - set this to match the information in /etc/monitrc
-//Set information about the monit server address, port and login details.
-$addr = 'localhost';
-$port = 2812;
-$path = '/';
-$user = 'admin';
-$pass = 'monit';
-$timeout = 30;
-//End of configuration
-
-$urlHandle = fsockopen($addr, $port, $errno, $errstr, $timeout);
-socket_set_timeout($urlHandle, $timeout);
-
-$urlString = "GET $path HTTP/1.0\r\nHost: $addr\r\nConnection:
Keep-Alive\r\nUser-Agent: MonitPHP\r\n";
-$urlString .= "Authorization: Basic ".base64_encode("$user:$pass")."\r\n";
-$urlString .= "\r\n";
-
-fputs($urlHandle, $urlString);
-$response = fgets($urlHandle);
-
-$endHeader = false; // Strip initial header
information
-while ( !$endHeader){
- if (fgets($urlHandle) == "\r\n")
- $endHeader = true;
-}
-
-$info = ''; // Generate a string to send
to the screen
-
-while (!feof($urlHandle)) {
- $info.=fgets($urlHandle);
-}
-
-fclose ($urlHandle);
-
-echo $info;
-
-?>
=======================================
--- /trunk/contrib/waitdate.patch Wed Sep 22 14:28:15 2010
+++ /dev/null
@@ -1,162 +0,0 @@
-diff -Naur monit-5.1.1-orig/l.l monit-5.1.1-new/l.l
---- monit-5.1.1-orig/l.l 2010-01-08 03:15:43.000000000 -0800
-+++ monit-5.1.1-new/l.l 2010-09-21 18:50:14.687202000 -0700
-@@ -118,7 +118,7 @@
- megabyte ("megabyte"|"mb")
- gigabyte ("gigabyte"|"gb")
-
--%x ARGUMENT_COND DEPEND_COND SERVICE_COND URL_COND STRING_COND INCLUDE
-+%x ARGUMENT_COND DEPEND_COND SERVICE_COND URL_COND STRING_COND INCLUDE
NUMBER_COND
-
- %%
-
-@@ -373,6 +373,11 @@
- return GROUP;
- }
-
-+waitdate[ \t]+ {
-+ BEGIN(NUMBER_COND);
-+ return WAITDATE;
-+ }
-+
- [a-zA-Z0-9]+"://" {
- yylval.url=
- create_URL(xstrndup(yytext, strlen(yytext)-3));
-@@ -595,6 +600,15 @@
-
- }
-
-+<NUMBER_COND>{
-+
-+ {str} {
-+ yylval.number= atoi(yytext);
-+ BEGIN(INITIAL);
-+ save_arg(); return NUMBERNAME;
-+ }
-+}
-+
- <STRING_COND>{
-
- {str} {
-@@ -621,7 +635,7 @@
-
- }
-
--<INITIAL,ARGUMENT_COND,SERVICE_COND,DEPEND_COND,URL_COND,STRING_COND>. {
-+<INITIAL,ARGUMENT_COND,SERVICE_COND,DEPEND_COND,URL_COND,STRING_COND,NUMBER_COND>.
{
- return yytext[0];
- }
-
-diff -Naur monit-5.1.1-orig/monitor.h monit-5.1.1-new/monitor.h
---- monit-5.1.1-orig/monitor.h 2010-02-14 09:55:00.000000000 -0800
-+++ monit-5.1.1-new/monitor.h 2010-09-21 16:22:32.535806000 -0700
-@@ -719,6 +719,7 @@
- Mail_T maillist; /**< Alert notification
mailinglist */
-
- /** Test rules and event handlers */
-+ time_t waitdate; /**< Date to wait for
check */
- ActionRate_T actionratelist; /**< ActionRate check
list */
- Checksum_T checksum; /**< Checksum
check */
- Filesystem_T filesystemlist; /**< Filesystem check
list */
-diff -Naur monit-5.1.1-orig/p.y monit-5.1.1-new/p.y
---- monit-5.1.1-orig/p.y 2010-02-22 13:24:26.000000000 -0800
-+++ monit-5.1.1-new/p.y 2010-09-21 18:52:30.827971000 -0700
-@@ -221,6 +221,7 @@
- static void addhtpasswdentry(char *, char *, int);
- static uid_t get_uid(char *, uid_t);
- static gid_t get_gid(char *, gid_t);
-+ static void addwaitdate(time_t);
- static void addchecksum(Checksum_T);
- static void addperm(Perm_T);
- static void addmatch(Match_T, int, int);
-@@ -285,14 +286,14 @@
- %token <string> MAILBODY SERVICENAME STRINGNAME
- %token <number> NUMBER PERCENT LOGLIMIT CLOSELIMIT DNSLIMIT KEEPALIVELIMIT
- %token <number> REPLYLIMIT REQUESTLIMIT STARTLIMIT WAITLIMIT GRACEFULLIMIT
--%token <number> CLEANUPLIMIT
-+%token <number> CLEANUPLIMIT NUMBERNAME
- %token <real> REAL
- %token CHECKPROC CHECKFILESYS CHECKFILE CHECKDIR CHECKHOST CHECKSYSTEM
CHECKFIFO CHECKSTATUS
- %token CHILDREN SYSTEM
- %token RESOURCE MEMORY TOTALMEMORY LOADAVG1 LOADAVG5 LOADAVG15
- %token MODE ACTIVE PASSIVE MANUAL CPU TOTALCPU CPUUSER CPUSYSTEM CPUWAIT
- %token GROUP REQUEST DEPENDS BASEDIR SLOT EVENTQUEUE SECRET HOSTHEADER
--%token UID GID MMONIT INSTANCE USERNAME PASSWORD
-+%token UID GID MMONIT INSTANCE USERNAME PASSWORD WAITDATE
- %token TIMESTAMP CHANGED SECOND MINUTE HOUR DAY
- %token SSLAUTO SSLV2 SSLV3 TLSV1 CERTMD5
- %token BYTE KILOBYTE MEGABYTE GIGABYTE
-@@ -353,6 +354,7 @@
- | every
- | mode
- | group
-+ | waitdate
- | depend
- | resourceprocess
- ;
-@@ -1274,6 +1276,9 @@
- ;
-
-
-+waitdate : WAITDATE NUMBERNAME { addwaitdate($2);}
-+ ;
-+
- depend : DEPENDS dependlist
- ;
-
-@@ -2217,6 +2222,14 @@
- reset_sizeset();
- }
-
-+/*
-+ * Set waitdate object in current service
-+ */
-+static void addwaitdate(time_t date) {
-+
-+ current->waitdate = date;
-+ LogError("waitdate is: %d\n", date);
-+}
-
- /*
- * Set Checksum object in the current service
-diff -Naur monit-5.1.1-orig/validate.c monit-5.1.1-new/validate.c
---- monit-5.1.1-orig/validate.c 2010-02-23 02:32:40.000000000 -0800
-+++ monit-5.1.1-new/validate.c 2010-09-21 19:04:03.974225000 -0700
-@@ -123,6 +123,7 @@
- static void check_match_if(Service_T, char *);
- static int check_skip(Service_T);
- static void check_timeout(Service_T);
-+static int check_date(Service_T);
- static void check_checksum(Service_T);
- static void check_timestamp(Service_T);
- static void check_process_state(Service_T);
-@@ -178,7 +179,8 @@
- /* Check the services */
- for (s = servicelist; s && !Run.stopped; s = s->next) {
- LOCK(s->mutex)
-- if (! do_scheduled_action(s) && s->monitor && ! check_skip(s)) {
-+ if (! do_scheduled_action(s) && s->monitor && ! check_skip(s)
-+ && ! check_date(s)) {
- check_timeout(s); // Can disable monitoring => need to check
s->monitor again
- if (s->monitor) {
- if (! s->check(s))
-@@ -1255,6 +1257,19 @@
-
- }
-
-+static int check_date(Service_T s) {
-+ time_t now = time(NULL);
-+
-+ ASSERT(s);
-+
-+ if (! s->waitdate)
-+ return FALSE;
-+
-+ if (now < s->waitdate)
-+ return TRUE;
-+
-+ return FALSE;
-+}
-
- static void check_timeout(Service_T s) {
- ActionRate_T ar;
=======================================
--- /trunk/contrib/wap.php Sat Nov 7 14:10:27 2009
+++ /dev/null
@@ -1,288 +0,0 @@
-<?php
-// Copyright (C), 2004 David Fletcher, <address@hidden>
-//
-// 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 3 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-// -----------------------------------------------------------------------
-//
-// DESCRIPTION
-// Script to display basic monit status information in WML on a WAP phone.
-// Based on the contrib/monit.php script for remote access to monit,
-// and including some XML functions developed by
-// mreilly at ZEROSPAM dot MAC dot COM taken from the PHP manual.
-//
-// INSTALLATION
-// Place this script on your webserver. Set the configuration information
-// to match your monit installation. The password can be included in the
-// page request, in which case set it as an empty string in this script.
-//
-// Use this type of request from your phone (with your password!):
-// http:// www.example.co.uk/wap.php?pass=monit
-//
-// Bookmark this if you are happy that your phone is secure.
-//
-// This script accesses monit from the localhost, so you don't
-// need to allow external access to monit through your firewall,
-// just access your normal webserver.
-//
-// Much of the XML manipulation would be better done using Extensible
-// Stylesheet Language (XSL) Transformations, but they need additional
-// libraries which not everyone has installed.
-//
-// This script only outputs basic data, but the array generated from the
-// XML status information holds everything in the monit status report.
-// Just add additional output echo statements to get more detail.
-//
-// This script requires PHP, and a working webserver! Tested on PHP4.
-//
-// @author Author David Fletcher, <address@hidden>
-
-//Configuration data
-$addr = 'localhost';
-$port = 2812;
-$path = '/_status?format=xml';
-$user = 'admin';
-$pass = '';
-$timeout = 30;
-//End of configuration
-
-//Ensure that the page generated appears to be a WML page.
-header("Content-type: text/vnd.wap.wml");
-
-//No security or filtering here.
-//Passwords could contain almost anything, so difficult to filter
-if(isset($_GET['pass'])) $pass = $_GET['pass'];
-
-//Get the status information from monit
-$urlHandle = fsockopen($addr, $port, $errno, $errstr, $timeout);
-socket_set_timeout($urlHandle, $timeout);
-
-$urlString = "GET $path HTTP/1.0\r\nHost: $addr\r\nConnection:
Keep-Alive\r\nUser-Agent: MonitPHP\r\n";
-$urlString .= "Authorization: Basic ".base64_encode("$user:$pass")."\r\n";
-$urlString .= "\r\n";
-
-fputs($urlHandle, $urlString);
-$response = fgets($urlHandle);
-
-$endHeader = false; // Strip initial header
information
-while ( !$endHeader){
- if (fgets($urlHandle) == "\r\n")
- $endHeader = true;
-}
-
-$data = ''; // Generate a string to send to the
screen
-
-while (!feof($urlHandle)) {
- $data.=fgets($urlHandle);
-}
-
-fclose ($urlHandle);
-
-//Status information is now stored as an XML document as $data
-//Convert the XML to an array to make output controllable
-
-// Array to store current xml path
-$ary_path = array();
-
-// We may have many services. They need to be numbered to keep track
-$service_no = 0;
-
-// Array to store parsed data
-$data_parsed = array();
-
-// Starting level - Set to 0 to display all levels. Set to 1 or higher
-// to skip a level that is common to all the fields.
-$int_starting_level = 1;
-
-// create our parser
-$xml_parser = xml_parser_create('UTF-8');
-
-// set some parser options
-xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, true);
-xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, 'UTF-8');
-
-// tell PHP what functions to call when it finds an element
-xml_set_element_handler($xml_parser, 'startElement','endElement');
-
-// tell PHP what function to use on the character data
-xml_set_character_data_handler($xml_parser, 'characterData');
-
-//Parse the XML
-if (!xml_parse($xml_parser, $data)) {
- die(sprintf( "XML error: %s at line %d\n\n",
- xml_error_string(xml_get_error_code($xml_parser)),
- xml_get_current_line_number($xml_parser)));
-}
-
-xml_parser_free($xml_parser);
-
-// This function is called for every opening XML tag. We
-// need to keep track of our path in the XML file, so we
-// will use this function to add the tag name to an array
-function startElement($parser, $name, $attrs=''){
-
- // Make sure we can access the path array
- global $ary_path,$service_no;
-
- //Service type 5 is system information, not a standard service
- if(isset($attrs['TYPE']) && $attrs['TYPE'] == 5){
- $name = 'SYSTEM';
- }
-
- // Push the tag into the array
- array_push($ary_path, $name);
-
- //If the tag is a new SERVICE, increment the number of services
- if($name == 'SERVICE'){
- $service_no++;
- }
-
-}
-
-// This function is called for every closing XML tag. We
-// need to keep track of our path in the XML file, so we
-// will use this function to remove the last item of the array.
-function endElement($parser, $name, $attrs=''){
-
- // Make sure we can access the path array
- global $ary_path;
-
- // Push the tag into the array
- array_pop($ary_path);
-
-}
-
-// This function is called for every data portion found between
-// opening and closing tags. We will use it to insert values
-// into the array.
-function characterData($parser, $data){
-
- // Make sure we can access the path and parsed file arrays
- // and the starting level value
- global $data_parsed, $ary_path, $int_starting_level, $service_no;
-
- // Remove extra white space from the data (so we can tell if it's empty)
- $str_trimmed_data = trim($data);
-
- // Since this function gets called whether there is text data or not,
- // we need to prevent it from being called when there is no text data
- // or it overwrites previous legitimate data.
- // Don't use !empty since it will miss tags which contain the number
zero.
- if ($str_trimmed_data != '') {
-
- // Build the array definition string
- $str_array_define = '$data_parsed';
-
- // Add a [''] and data for each level. (Starting level can be defined.)
- for ($i = $int_starting_level; $i < count($ary_path); $i++) {
- if ($ary_path[$i] == 'SERVICE'){
- //Several SERVICE entries must be accommodated.
- $ary_path[$i] = $ary_path[$i].'-'.$service_no;
- }
- $str_array_define .= '[\'' . $ary_path[$i] . '\']';
- }
-
- // Add the value portion of the statement
- $str_array_define .= " = '" . $str_trimmed_data . "';";
-
- // Evaluate the statement we just created
- eval($str_array_define);
-
- } // if
-
-}
-
-//Prepare for output of the most basic monit data
-
-//For conversion of status codes to text
-$event[0] = 'OK';
-$event[1] = 'Checksum failed';
-$event[2] = 'Resource limit matched';
-$event[4] = 'Timeout';
-$event[8] = 'Timestamp failed';
-$event[16] = 'Size failed';
-$event[32] = 'Connection failed';
-$event[64] = 'Permission failed';
-$event[128] = 'UID failed';
-$event[256] = 'GID failed';
-$event[512] = 'Does not exist';
-$event[1024] = 'Invalid type';
-$event[2048] = 'Data access error';
-$event[4096] = 'Execution failed';
-$event[8192] = 'Changed';
-$event[16384] = 'ICMP failed';
-
-$monitored[0] = 'No';
-$monitored[1] = 'Yes';
-$monitored[2] = 'Init';
-
-//Output document headers. Note that the blank lines between DOCTYPE and
<wml> are important.
-echo '<?xml version="1.0"?>';
-echo '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" ';
-echo '"http://www.wapforum.org/DTD/wml_1.1.xml">';
-echo "\n\n";
-echo '<wml><head><meta http-equiv="Cache-Control"
content="no-cache,must-revalidate"/>';
-echo '<meta http-equiv="Pragma" content="no-cache"/></head><template>';
-echo '<do type="prev" label="Back"><prev/></do></template><card id="main"
title="Server status">';
-
-//Do outputs linked to the machine, not to a specific service
-
-echo '<p>'.date('H:i j-M-y').'</p>';
-echo '<p><b>Hostname</b>: '.$data_parsed['SYSTEM']['NAME'].'<br />';
-
-$days = floor($data_parsed['SERVER']['UPTIME']/60/60/24);
-$hours = $data_parsed['SERVER']['UPTIME']/60/60%24;
-$mins = $data_parsed['SERVER']['UPTIME']/60%60;
-
-echo 'Uptime: '.$days.'d '.$hours.'h '.$mins.'m<br />';
-echo 'Load: '.$data_parsed['SYSTEM']['LOAD']['AVG15'].'<br />';
-echo 'Memory: '.$data_parsed['SYSTEM']['MEMORY']['PERCENT'].'%<br />';
-echo 'User cpu: '.$data_parsed['SYSTEM']['CPU']['USER'].'%<br />';
-echo 'System cpu: '.$data_parsed['SYSTEM']['CPU']['SYSTEM'].'%</p>';
-
-//Output for each of the services monitored
-
-for ($i = 1; $i <= $service_no; $i++){
-
- echo '<p>';
- //Service name
- echo '<b>'.$data_parsed["SERVICE-$i"]['NAME'].'</b><br />';
-
- //Is this service being monitored?
- if(array_key_exists($data_parsed["SERVICE-$i"]['MONITOR'], $monitored))
-
echo 'Monitored: '.$monitored[$data_parsed["SERVICE-$i"]['MONITOR']].'<br
/>';
- else
- echo 'Monitored: '.$data_parsed["SERVICE-$i"]['MONITOR'].'<br />';
-
- //What is the status of this service?
- if(array_key_exists($data_parsed["SERVICE-$i"]['STATUS'], $event))
- echo 'Status: '.$event[$data_parsed["SERVICE-$i"]['STATUS']].'<br />';
- else
- echo 'Status: '.$data_parsed["SERVICE-$i"]['STATUS'].'<br />';
-
- //If this service defined an UPTIME, display it.
- if(isset($data_parsed["SERVICE-$i"]['UPTIME'])){
- $days = floor($data_parsed["SERVICE-$i"]['UPTIME']/60/60/24);
- $hours = $data_parsed["SERVICE-$i"]['UPTIME']/60/60%24;
- $mins = $data_parsed["SERVICE-$i"]['UPTIME']/60%60;
- echo 'Uptime: '.$days.'d '.$hours.'h '.$mins.'m<br />';
- }
-
- echo '</p>';
-}
-
-echo '</card></wml>';
-
-?>
-
=======================================
--- /trunk/Makefile.in Wed Jan 19 10:40:32 2011
+++ /trunk/Makefile.in Tue Apr 5 02:57:57 2011
@@ -76,17 +76,14 @@
GRAMMAR := y.tab.c lex.yy.c
# Filter out platform spesific files
-FILTER := $(wildcard device/sysdep_*.c process/sysdep_*.c\
- external/*.c)
-
-EXTERNALS := @EXTERNALS@
+FILTER := $(wildcard device/sysdep_*.c process/sysdep_*.c)
# Source files
SOURCE := $(filter-out $(GRAMMAR) $(FILTER), \
$(wildcard *.c) $(wildcard */*.c)) \
device/address@hidden@.c\
process/address@hidden@.c\
- $(GRAMMAR) $(EXTERNALS)
+ $(GRAMMAR)
# Object files
OBJECTS := $(SOURCE:.c=.o)
=======================================
--- /trunk/configure.ac Tue Mar 8 01:09:16 2011
+++ /trunk/configure.ac Tue Apr 5 02:57:57 2011
@@ -319,16 +319,6 @@
AC_CHECK_FUNCS(vsyslog)
AC_CHECK_FUNCS(backtrace)
-jm_FUNC_GNU_STRFTIME
-
-EXTERNALS=""
-if test "$jm_cv_func_working_gnu_strftime" = "no"; then
- # We do not have have a working strftime supporting %z
- EXTERNALS="$EXTERNALS external/strftime.c"
-fi
-
-AC_SUBST(EXTERNALS)
-
# Check for SOL_IP
AC_MSG_CHECKING(for SOL_IP)
AC_TRY_COMPILE([
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [monit-dev] [monit] r354 committed - remove strftime implementation ... all platforms except AIX support th...,
monit <=