checksensor...
git-svn-id: file:///home/jan/tmp/wetterstation/trunk@58 dd492736-c11a-0410-ad51-8c26713eaf7f
This commit is contained in:
parent
822e8f408d
commit
6af8bd3138
|
|
@ -0,0 +1,26 @@
|
||||||
|
# Enstellungen fuer den Test
|
||||||
|
checkinterval 24 # Interval (jetzt-x Stunden) das ueberprueft wird
|
||||||
|
min_sendings 24 # Minimale Anzahl von Daten die im gegebenem Interval gekommen sein sollten
|
||||||
|
|
||||||
|
# Einstellungen zu den Sensoren
|
||||||
|
sensorid_from_db yes # Sensoren aus der Datenbank holen (no wenn manuell anegeben)
|
||||||
|
#sensorid 1 # ID eines Sensors der ueberprueft werden soll (nur bei sensorid_from_db no)
|
||||||
|
#sensorid 2 # weitere ID (es koennen beliebig viele anggeben werden)
|
||||||
|
|
||||||
|
# Mail-Addressen
|
||||||
|
adminaddress root@localhost # Addresse an die die Nachichten gesandt werden sollen
|
||||||
|
#adminaddress sysop@localhost # weitere Addresse an die eine Nachicht geschickt wird (beliebig viele möglich)
|
||||||
|
|
||||||
|
# Mail-einstellungen
|
||||||
|
mail_host localhost # Hostname des Mailservers
|
||||||
|
mail_port 25 # Port des Servers
|
||||||
|
mail_use_ssl yes # SSL (TLS) benutzen
|
||||||
|
mail_use_auth no # Authentifizierung benutzen
|
||||||
|
mail_auth_user user # Username bei Authentifizierung
|
||||||
|
mail_auth_pass pass # Passwort bei Authentifizierung
|
||||||
|
|
||||||
|
# Postgres-Einstellungen
|
||||||
|
pg_host localhost
|
||||||
|
pg_user user
|
||||||
|
pg_pass pass
|
||||||
|
pg_database wetter
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
/*
|
/*
|
||||||
|
|
||||||
weatherdeamon -- Weather Data Capture Program for the
|
config.c -- Part of checksensor
|
||||||
'ELV-PC-Wettersensor-Empfänger'
|
|
||||||
config.c -- Part of the weatherdeamon
|
|
||||||
|
|
||||||
Copyright (C) 2006 Jan Losinski
|
Copyright (C) 2006 Jan Losinski
|
||||||
|
|
||||||
|
|
@ -20,7 +18,6 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
$Id: process.c v 1.00 11 Aug 2006 losinski $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -32,10 +29,9 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "definitions.h"
|
#include "definitions.h"
|
||||||
#include "checksensor.h"
|
#include "checksensor.h"
|
||||||
//#include "mailer.h"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Funktionsdefinitionen */
|
||||||
static int read_int(const char *, void *);
|
static int read_int(const char *, void *);
|
||||||
static int read_yn(const char *, void *);
|
static int read_yn(const char *, void *);
|
||||||
static int add_sens_id(const char *, void *);
|
static int add_sens_id(const char *, void *);
|
||||||
|
|
@ -68,6 +64,10 @@ static const struct config_keyword keywords[] = {
|
||||||
{"", NULL, NULL, ""}
|
{"", NULL, NULL, ""}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Implementierungen */
|
||||||
|
|
||||||
|
|
||||||
/* Liest eine Option (line) als String und speichert diese in
|
/* Liest eine Option (line) als String und speichert diese in
|
||||||
* dem entsprechendem Feld der Optionen-Struktur (arg) */
|
* dem entsprechendem Feld der Optionen-Struktur (arg) */
|
||||||
static int read_str(const char *line, void *arg){
|
static int read_str(const char *line, void *arg){
|
||||||
|
|
@ -96,6 +96,7 @@ static int read_yn(const char *line, void *arg){
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* fuegt eine id zur liste hinzu */
|
||||||
static int add_sens_id(const char *line, void *arg){
|
static int add_sens_id(const char *line, void *arg){
|
||||||
sens_id_list_ptr id_new, id_temp;
|
sens_id_list_ptr id_new, id_temp;
|
||||||
|
|
||||||
|
|
@ -118,7 +119,7 @@ static int add_sens_id(const char *line, void *arg){
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* furgt eine addresse zur liste hinzu */
|
||||||
static int add_address(const char *line, void *arg){
|
static int add_address(const char *line, void *arg){
|
||||||
mail_list_ptr adr_new, adr_temp;
|
mail_list_ptr adr_new, adr_temp;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
definitions.h -- Part of the checksensor
|
||||||
|
|
||||||
|
Copyright (C) 2006 Jan Losinski
|
||||||
|
|
||||||
|
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Default-Werte ----------------------------------------------------- */
|
||||||
|
#define DEFAULT_PG_HOST "localhost" /* Postgres-host */
|
||||||
|
#define DEFAULT_PG_USER "localuser" /* Postgres-Username */
|
||||||
|
#define DEFAULT_PG_PASS "" /* Postgres-Passwort */
|
||||||
|
#define DEFAULT_PG_DATABASE "localbase" /* Postgres-Datenbank */
|
||||||
|
#define DEFAULT_CONFIG_FILE "./checksensor.conf" /* Standart-Configdatei */
|
||||||
|
#define DEFAULT_CHECK_INTERVAL "24" /* Standart-Interval, indem der Sensor das letzte mal hätte senden sollen (in h) */
|
||||||
|
#define DEFAULT_MIN_SENDINGS "24" /* Standart-Wert, wieviele Daten der Sensor in den letzten x stunden hätte senden sollen */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*Alle möglichen Definitionen, die in allen code-schnipseln benötigt werden*/
|
||||||
|
|
||||||
|
/* Fehlermeldungen ------------------------------------------------------*/
|
||||||
|
#define ERROR_MAKECONN "PgSQL-Fehler: Kann Datenbankverbindung nicht herstellen\n"
|
||||||
|
#define ERROR_QUERY "PgSQL-Fehler: Kann query nicht sudführen \n"
|
||||||
|
#define ERROR_SEIINST "Signal-Fehler: Kann Signalhandler zum beenden nicht installieren\n"
|
||||||
|
|
||||||
|
/* Mail - Kopf -----------------------------------------------------------*/
|
||||||
|
#define MAIL_HEAD "--Wetterstation--\r\nEs sind Probleme mit einigen Sensoren aufgetreten:\r\n\r\n"
|
||||||
|
|
||||||
|
|
||||||
|
/* Debug --------------------------------------------------------------- */
|
||||||
|
#ifdef DEBUG
|
||||||
|
#define DEBUGOUT1(x) fprintf(stderr,x)
|
||||||
|
#define DEBUGOUT2(x,y) fprintf(stderr,x,y)
|
||||||
|
#define DEBUGOUT3(x,y,z) fprintf(stderr,x,y,z)
|
||||||
|
#define DEBUGOUT4(x,y,z,a) fprintf(stderr,x,y,z,a)
|
||||||
|
#define DEBUGOUT5(x,y,z,a,b) fprintf(stderr,x,y,z,a,b)
|
||||||
|
#define FOR(x) for(x)
|
||||||
|
#else
|
||||||
|
#define DEBUGOUT1(x)
|
||||||
|
#define DEBUGOUT2(x,y)
|
||||||
|
#define DEBUGOUT3(x,y,z)
|
||||||
|
#define DEBUGOUT4(x,y,z,a)
|
||||||
|
#define DEBUGOUT5(x,y,z,a,b)
|
||||||
|
#define FOR(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
Loading…
Reference in New Issue