symon.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /* $Id: symon.h,v 1.27 2003/12/20 16:30:44 dijkstra Exp $ */
  2. /*
  3. * Copyright (c) 2001-2003 Willem Dijkstra
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * - Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * - Redistributions in binary form must reproduce the above
  13. * copyright notice, this list of conditions and the following
  14. * disclaimer in the documentation and/or other materials provided
  15. * with the distribution.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  18. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  19. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  20. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  21. * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  23. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  24. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  25. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  27. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  28. * POSSIBILITY OF SUCH DAMAGE.
  29. *
  30. */
  31. #ifndef _SYMON_SYMON_H
  32. #define _SYMON_SYMON_H
  33. #include <conf.h>
  34. #include <sys/queue.h>
  35. #include "lex.h"
  36. #include "data.h"
  37. #define SYMON_PID_FILE "/var/run/symon.pid"
  38. #define SYMON_USER "_symon"
  39. #define SYMON_DEFAULT_INTERVAL 5 /* measurement interval */
  40. #define SYMON_WARN_SENDERR 50 /* warn every x errors */
  41. #define SYMON_MAX_DOBJECTS 2000 /* max dynamic allocation; local limit per
  42. * measurement module */
  43. #define SYMON_MAX_OBJSIZE (_POSIX2_LINE_MAX)
  44. #define SYMON_SENSORMASK 0xFF /* sensors 0-255 are allowed */
  45. /* funcmap holds functions to be called for the individual monitors:
  46. *
  47. * - privinit = priviledged init, called before chroot
  48. * - init = called once, right after configuration
  49. * - gets = called every monitor interval, can be used by modules that get all
  50. * their measurements in one go.
  51. * - get = obtain measurement
  52. */
  53. struct funcmap {
  54. int type;
  55. int used;
  56. void (*privinit) ();
  57. void (*init) (char *);
  58. void (*gets) ();
  59. int (*get) (char *, int, char *);
  60. };
  61. extern struct funcmap streamfunc[];
  62. extern int symon_interval;
  63. /* prototypes */
  64. __BEGIN_DECLS
  65. /* sm_cpu.c */
  66. extern void init_cpu(char *);
  67. extern int get_cpu(char *, int, char *);
  68. /* sm_mem.c */
  69. extern void init_mem(char *);
  70. extern int get_mem(char *, int, char *);
  71. /* sm_if.c */
  72. extern void init_if(char *);
  73. extern int get_if(char *, int, char *);
  74. /* sm_io.c */
  75. extern void init_io(char *);
  76. extern void gets_io();
  77. extern int get_io(char *, int, char *);
  78. /* sm_pf.c */
  79. extern void privinit_pf();
  80. extern void init_pf(char *);
  81. extern int get_pf(char *, int, char *);
  82. /* sm_mbuf.c */
  83. extern void init_mbuf(char *);
  84. extern int get_mbuf(char *, int, char *);
  85. /* sm_debug.c */
  86. extern void init_debug(char *);
  87. extern int get_debug(char *, int, char *);
  88. /* sm_proc.c */
  89. extern void init_proc(char *);
  90. extern void gets_proc();
  91. extern int get_proc(char *, int, char *);
  92. /* sm_sensor.c */
  93. extern void init_sensor(char *);
  94. extern int get_sensor(char *, int, char *);
  95. __END_DECLS
  96. #endif /* _SYMON_SYMON_H */