| [661] | 1 | /* |
|---|
| 2 | * sensord |
|---|
| 3 | * |
|---|
| [828] | 4 | * A daemon that periodically logs sensor information to syslog. |
|---|
| [661] | 5 | * |
|---|
| [1357] | 6 | * Copyright (c) 1999-2002 Merlin Hughes <merlin@merlin.org> |
|---|
| [661] | 7 | * |
|---|
| 8 | * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | * it under the terms of the GNU General Public License as published by |
|---|
| 10 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 11 | * (at your option) any later version. |
|---|
| 12 | * |
|---|
| 13 | * This program is distributed in the hope that it will be useful, |
|---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | * GNU General Public License for more details. |
|---|
| 17 | * |
|---|
| 18 | * You should have received a copy of the GNU General Public License |
|---|
| 19 | * along with this program; if not, write to the Free Software |
|---|
| 20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 21 | */ |
|---|
| 22 | |
|---|
| [828] | 23 | #include "lib/sensors.h" |
|---|
| 24 | |
|---|
| 25 | extern void sensorLog (int priority, const char *fmt, ...); |
|---|
| 26 | |
|---|
| 27 | /* from args.c */ |
|---|
| 28 | |
|---|
| 29 | extern int isDaemon; |
|---|
| 30 | extern const char *sensorsCfgFile; |
|---|
| [1024] | 31 | extern const char *pidFile; |
|---|
| [1357] | 32 | extern const char *rrdFile; |
|---|
| 33 | extern const char *cgiDir; |
|---|
| [835] | 34 | extern int scanTime; |
|---|
| [828] | 35 | extern int logTime; |
|---|
| [1357] | 36 | extern int rrdTime; |
|---|
| [2503] | 37 | extern int rrdNoAverage; |
|---|
| [828] | 38 | extern int syslogFacility; |
|---|
| [835] | 39 | extern int doScan; |
|---|
| [828] | 40 | extern int doSet; |
|---|
| [1357] | 41 | extern int doCGI; |
|---|
| [1474] | 42 | extern int doLoad; |
|---|
| [1024] | 43 | extern int debug; |
|---|
| [828] | 44 | extern sensors_chip_name chipNames[]; |
|---|
| 45 | extern int numChipNames; |
|---|
| 46 | |
|---|
| 47 | extern int parseArgs (int argc, char **argv); |
|---|
| 48 | extern int parseChips (int argc, char **argv); |
|---|
| 49 | |
|---|
| 50 | /* from lib.c */ |
|---|
| 51 | |
|---|
| 52 | extern int initLib (void); |
|---|
| 53 | extern int loadLib (void); |
|---|
| 54 | extern int reloadLib (void); |
|---|
| 55 | extern int unloadLib (void); |
|---|
| 56 | |
|---|
| 57 | /* from sense.c */ |
|---|
| 58 | |
|---|
| [4668] | 59 | extern int getRawLabel (const sensors_chip_name *name, int feature, const char **label); |
|---|
| [1357] | 60 | |
|---|
| [828] | 61 | extern int readChips (void); |
|---|
| [835] | 62 | extern int scanChips (void); |
|---|
| 63 | extern int setChips (void); |
|---|
| [1357] | 64 | extern int rrdChips (void); |
|---|
| [828] | 65 | |
|---|
| [1357] | 66 | /* from rrd.c */ |
|---|
| 67 | |
|---|
| 68 | extern char rrdBuff[]; |
|---|
| 69 | extern int rrdInit (void); |
|---|
| 70 | extern int rrdUpdate (void); |
|---|
| 71 | extern int rrdCGI (void); |
|---|
| 72 | |
|---|
| [828] | 73 | /* from chips.c */ |
|---|
| 74 | |
|---|
| [661] | 75 | #define MAX_DATA 5 |
|---|
| 76 | |
|---|
| [835] | 77 | typedef const char * (*FormatterFN) (const double values[], int alarm, int beep); |
|---|
| [661] | 78 | |
|---|
| [1357] | 79 | typedef const char * (*RRDFN) (const double values[]); |
|---|
| 80 | |
|---|
| 81 | typedef enum { |
|---|
| 82 | DataType_voltage = 0, |
|---|
| 83 | DataType_rpm, |
|---|
| 84 | DataType_temperature, |
|---|
| 85 | DataType_other = -1 |
|---|
| 86 | } DataType; |
|---|
| 87 | |
|---|
| [661] | 88 | typedef struct { |
|---|
| 89 | FormatterFN format; |
|---|
| [1357] | 90 | RRDFN rrd; |
|---|
| 91 | DataType type; |
|---|
| [828] | 92 | int alarmMask; |
|---|
| 93 | int beepMask; |
|---|
| [4817] | 94 | int dataNumbers[MAX_DATA + 1]; /* First entry is used for the label */ |
|---|
| [661] | 95 | } FeatureDescriptor; |
|---|
| 96 | |
|---|
| 97 | typedef struct { |
|---|
| [4817] | 98 | FeatureDescriptor *features; |
|---|
| [828] | 99 | int alarmNumber; |
|---|
| 100 | int beepNumber; |
|---|
| [661] | 101 | } ChipDescriptor; |
|---|
| 102 | |
|---|
| [4817] | 103 | extern ChipDescriptor * generateChipDescriptor (const sensors_chip_name *chip); |
|---|