symon.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. extern time_t now;
  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_cpuiow.c */
  62. extern void init_cpuiow(struct stream *);
  63. extern void gets_cpuiow();
  64. extern int get_cpuiow(char *, int, struct stream *);
  65. /* sm_mem.c */
  66. extern void init_mem(struct stream *);
  67. extern void gets_mem();
  68. extern int get_mem(char *, int, struct stream *);
  69. /* sm_if.c */
  70. extern void init_if(struct stream *);
  71. extern void gets_if();
  72. extern int get_if(char *, int, struct stream *);
  73. /* sm_io.c */
  74. extern void init_io(struct stream *);
  75. extern void gets_io();
  76. extern int get_io(char *, int, struct stream *);
  77. /* sm_pf.c */
  78. extern void privinit_pf();
  79. extern void init_pf(struct stream *);
  80. extern void gets_pf();
  81. extern int get_pf(char *, int, struct stream *);
  82. /* sm_pfq.c */
  83. extern void privinit_pfq();
  84. extern void init_pfq(struct stream *);
  85. extern void gets_pfq();
  86. extern int get_pfq(char *, int, struct stream *);
  87. /* sm_mbuf.c */
  88. extern void init_mbuf(struct stream *);
  89. extern int get_mbuf(char *, int, struct stream *);
  90. /* sm_debug.c */
  91. extern void init_debug(struct stream *);
  92. extern int get_debug(char *, int, struct stream *);
  93. /* sm_proc.c */
  94. extern void privinit_proc();
  95. extern void init_proc(struct stream *);
  96. extern void gets_proc();
  97. extern int get_proc(char *, int, struct stream *);
  98. /* sm_sensor.c */
  99. extern void privinit_sensor();
  100. extern void init_sensor(struct stream *);
  101. extern int get_sensor(char *, int, struct stream *);
  102. /* sm_df.c */
  103. extern void init_df(struct stream *);
  104. extern void gets_df();
  105. extern int get_df(char *, int, struct stream *);
  106. /* sm_smart.c */
  107. extern void init_smart(struct stream *);
  108. extern void gets_smart();
  109. extern int get_smart(char *, int, struct stream *);
  110. /* sm_load.c */
  111. extern void init_load(struct stream *);
  112. extern void gets_load();
  113. extern int get_load(char *, int, struct stream *);
  114. /* sm_flukso.c */
  115. void init_flukso(struct stream *);
  116. void gets_flukso();
  117. int get_flukso(char *, int, struct stream *);
  118. __END_DECLS
  119. #endif /* _SYMON_SYMON_H */