symon.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* $Id: symon.h,v 1.35 2005/10/16 15:27:01 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. /* funcmap holds functions to be called for the individual monitors:
  38. *
  39. * - privinit = priviledged init, called before chroot
  40. * - init = called once, right after configuration
  41. * - gets = called every monitor interval, can be used by modules that get
  42. * all their measurements in one go.
  43. * - get = obtain measurement
  44. */
  45. struct funcmap {
  46. int type;
  47. int used;
  48. void (*privinit) ();
  49. void (*init) (struct stream *);
  50. void (*gets) ();
  51. int (*get) (char *, int, struct stream *);
  52. };
  53. extern struct funcmap streamfunc[];
  54. extern int symon_interval;
  55. /* prototypes */
  56. __BEGIN_DECLS
  57. /* sm_cpu.c */
  58. extern void init_cpu(struct stream *);
  59. extern void gets_cpu();
  60. extern int get_cpu(char *, int, struct stream *);
  61. /* sm_mem.c */
  62. extern void init_mem(struct stream *);
  63. extern void gets_mem();
  64. extern int get_mem(char *, int, struct stream *);
  65. /* sm_if.c */
  66. extern void init_if(struct stream *);
  67. extern void gets_if();
  68. extern int get_if(char *, int, struct stream *);
  69. /* sm_io.c */
  70. extern void init_io(struct stream *);
  71. extern void gets_io();
  72. extern int get_io(char *, int, struct stream *);
  73. /* sm_pf.c */
  74. extern void privinit_pf();
  75. extern void init_pf(struct stream *);
  76. extern void gets_pf();
  77. extern int get_pf(char *, int, struct stream *);
  78. /* sm_pfq.c */
  79. extern void privinit_pfq();
  80. extern void init_pfq(struct stream *);
  81. extern void gets_pfq();
  82. extern int get_pfq(char *, int, struct stream *);
  83. /* sm_mbuf.c */
  84. extern void init_mbuf(struct stream *);
  85. extern int get_mbuf(char *, int, struct stream *);
  86. /* sm_debug.c */
  87. extern void init_debug(struct stream *);
  88. extern int get_debug(char *, int, struct stream *);
  89. /* sm_proc.c */
  90. extern void privinit_proc();
  91. extern void init_proc(struct stream *);
  92. extern void gets_proc();
  93. extern int get_proc(char *, int, struct stream *);
  94. /* sm_sensor.c */
  95. extern void privinit_sensor();
  96. extern void init_sensor(struct stream *);
  97. extern int get_sensor(char *, int, struct stream *);
  98. /* sm_df.c */
  99. extern void init_df(struct stream *);
  100. extern void gets_df();
  101. extern int get_df(char *, int, struct stream *);
  102. __END_DECLS
  103. #endif /* _SYMON_SYMON_H */