symon.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * Copyright (c) 2001-2010 Willem Dijkstra
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. *
  9. * - Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * - Redistributions in binary form must reproduce the above
  12. * copyright notice, this list of conditions and the following
  13. * disclaimer in the documentation and/or other materials provided
  14. * with the distribution.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  17. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  18. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  19. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  20. * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  21. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  22. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  24. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  26. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  27. * POSSIBILITY OF SUCH DAMAGE.
  28. *
  29. */
  30. #ifndef _SYMON_SYMON_H
  31. #define _SYMON_SYMON_H
  32. #include "lex.h"
  33. #include "data.h"
  34. #define SYMON_PID_FILE "/var/run/symon.pid"
  35. #define SYMON_DEFAULT_INTERVAL 5 /* measurement interval */
  36. /* funcmap holds functions to be called for the individual monitors:
  37. *
  38. * - privinit = priviledged init, called before chroot
  39. * - init = called once, right after configuration
  40. * - gets = called every monitor interval, can be used by modules that get
  41. * all their measurements in one go.
  42. * - get = obtain measurement
  43. */
  44. struct funcmap {
  45. int type;
  46. int used;
  47. void (*privinit) ();
  48. void (*init) (struct stream *);
  49. void (*gets) ();
  50. int (*get) (char *, int, struct stream *);
  51. };
  52. extern struct funcmap streamfunc[];
  53. extern int symon_interval;
  54. /* prototypes */
  55. __BEGIN_DECLS
  56. /* sm_cpu.c */
  57. extern void init_cpu(struct stream *);
  58. extern void gets_cpu();
  59. extern int get_cpu(char *, int, struct stream *);
  60. /* sm_cpuiow.c */
  61. extern void init_cpuiow(struct stream *);
  62. extern void gets_cpuiow();
  63. extern int get_cpuiow(char *, int, struct stream *);
  64. /* sm_mem.c */
  65. extern void init_mem(struct stream *);
  66. extern void gets_mem();
  67. extern int get_mem(char *, int, struct stream *);
  68. /* sm_if.c */
  69. extern void init_if(struct stream *);
  70. extern void gets_if();
  71. extern int get_if(char *, int, struct stream *);
  72. /* sm_io.c */
  73. extern void init_io(struct stream *);
  74. extern void gets_io();
  75. extern int get_io(char *, int, struct stream *);
  76. /* sm_pf.c */
  77. extern void privinit_pf();
  78. extern void init_pf(struct stream *);
  79. extern void gets_pf();
  80. extern int get_pf(char *, int, struct stream *);
  81. /* sm_pfq.c */
  82. extern void privinit_pfq();
  83. extern void init_pfq(struct stream *);
  84. extern void gets_pfq();
  85. extern int get_pfq(char *, int, struct stream *);
  86. /* sm_mbuf.c */
  87. extern void init_mbuf(struct stream *);
  88. extern int get_mbuf(char *, int, struct stream *);
  89. /* sm_debug.c */
  90. extern void init_debug(struct stream *);
  91. extern int get_debug(char *, int, struct stream *);
  92. /* sm_proc.c */
  93. extern void privinit_proc();
  94. extern void init_proc(struct stream *);
  95. extern void gets_proc();
  96. extern int get_proc(char *, int, struct stream *);
  97. /* sm_sensor.c */
  98. extern void privinit_sensor();
  99. extern void init_sensor(struct stream *);
  100. extern int get_sensor(char *, int, struct stream *);
  101. /* sm_df.c */
  102. extern void init_df(struct stream *);
  103. extern void gets_df();
  104. extern int get_df(char *, int, struct stream *);
  105. /* sm_smart.c */
  106. extern void init_smart(struct stream *);
  107. extern void gets_smart();
  108. extern int get_smart(char *, int, struct stream *);
  109. /* sm_load.c */
  110. extern void init_load(struct stream *);
  111. extern void gets_load();
  112. extern int get_load(char *, int, struct stream *);
  113. __END_DECLS
  114. #endif /* _SYMON_SYMON_H */