symon.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* $Id: symon.h,v 1.33 2005/03/20 16:17:22 dijkstra Exp $ */
  2. /*
  3. * Copyright (c) 2001-2005 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 "lex.h"
  34. #include "data.h"
  35. #define SYMON_PID_FILE "/var/run/symon.pid"
  36. #define SYMON_DEFAULT_INTERVAL 5 /* measurement interval */
  37. #define SYMON_WARN_SENDERR 50 /* warn every x errors */
  38. #define SYMON_MAX_DOBJECTS 10000 /* max dynamic allocation; local limit per
  39. * measurement module */
  40. #define SYMON_MAX_OBJSIZE (_POSIX2_LINE_MAX)
  41. #define SYMON_SENSORMASK 0xFF /* sensors 0-255 are allowed */
  42. #define SYMON_MAXCPUS 4
  43. /* funcmap holds functions to be called for the individual monitors:
  44. *
  45. * - privinit = priviledged init, called before chroot
  46. * - init = called once, right after configuration
  47. * - gets = called every monitor interval, can be used by modules that get
  48. * all their measurements in one go.
  49. * - get = obtain measurement
  50. */
  51. struct funcmap {
  52. int type;
  53. int used;
  54. void (*privinit) ();
  55. void (*init) (char *);
  56. void (*gets) ();
  57. int (*get) (char *, int, char *);
  58. };
  59. extern struct funcmap streamfunc[];
  60. extern int symon_interval;
  61. /* prototypes */
  62. __BEGIN_DECLS
  63. /* sm_cpu.c */
  64. extern void init_cpu(char *);
  65. extern void gets_cpu();
  66. extern int get_cpu(char *, int, char *);
  67. /* sm_mem.c */
  68. extern void init_mem(char *);
  69. extern int get_mem(char *, int, char *);
  70. /* sm_if.c */
  71. extern void init_if(char *);
  72. extern void gets_if();
  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_pfq.c */
  83. extern void privinit_pfq();
  84. extern void init_pfq(char *);
  85. extern void gets_pfq();
  86. extern int get_pfq(char *, int, char *);
  87. /* sm_mbuf.c */
  88. extern void init_mbuf(char *);
  89. extern int get_mbuf(char *, int, char *);
  90. /* sm_debug.c */
  91. extern void init_debug(char *);
  92. extern int get_debug(char *, int, char *);
  93. /* sm_proc.c */
  94. extern void init_proc(char *);
  95. extern void gets_proc();
  96. extern int get_proc(char *, int, char *);
  97. /* sm_sensor.c */
  98. extern void privinit_sensor();
  99. extern void init_sensor(char *);
  100. extern int get_sensor(char *, int, char *);
  101. __END_DECLS
  102. #endif /* _SYMON_SYMON_H */