symux.8 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. .\" -*- nroff -*-
  2. .\"
  3. .\" Copyright (c) 2001-2002 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. .Dd April 5, 2002
  31. .Dt SYMUX 8
  32. .Os
  33. .Sh NAME
  34. .Nm symux
  35. .Nd symon stream multiplexer
  36. .Sh SYNOPSIS
  37. .Nm
  38. .Op Fl vd
  39. .Op Fl f Ar filename
  40. .Pp
  41. .Sh DESCRIPTION
  42. .Xr symon 8
  43. is a lightweight system monitor that measures cpu, memory, mbuf, debug,
  44. process, interface and disk statistics every 5 seconds. This information
  45. is then spooled to
  46. .Nm
  47. for further processing.
  48. .Pp
  49. .Xr symon 8
  50. has been designed to inflict minimal performance and security impact on
  51. the system it monitors.
  52. .Nm
  53. has performance impact proportional to the amount of streams it needs to
  54. manage. Ideally
  55. .Nm
  56. should live on a different system and collect data from several
  57. .Xr symon 8
  58. instances in a LAN.
  59. .Nm
  60. stores the incoming streams in .rrd files and distributes the
  61. information to connected listeners. Listeners can connect to
  62. .Nm
  63. on a tcp port and receive incoming
  64. .Xr symon 8
  65. transmissions decoded into ascii.
  66. .Lp
  67. .Nm
  68. needs no specific priviledges besides being able to open it's ports and
  69. the rrd files. It should be run as
  70. .Ar "nobody" .
  71. .Lp
  72. The options:
  73. .Bl -tag -width Ds
  74. .It Fl v
  75. Show version information.
  76. .It Fl d
  77. Stop
  78. .Nm
  79. from becoming a daemon and show debug information on stdout.
  80. .It Fl f Ar filename
  81. Read configuration from
  82. .Ar filename
  83. instead of
  84. .Pa /etc/symux.conf .
  85. .Sh CONFIGURATION
  86. .Nm
  87. obtains configuration data from
  88. .Pa /etc/symux.conf .
  89. The configuration file contains one mux stanza that defines on what host
  90. address and port
  91. .Nm
  92. should listen to for incoming monitored data. There is a source section
  93. for every host that is to be monitored. The source section defines what
  94. data to accept and where to write that data to. In the case that a
  95. source is of another address family than the mux stanza, i.e. source =
  96. ipv6 with mux = ipv4, a listen port of the sources' family is opened
  97. using the unspecified address. Whitespace, newlines and text behind '#'
  98. are ignored. The format in BNF:
  99. .Pp
  100. .nf
  101. stmt = mux-stmt | source-stmt
  102. mux-stmt = "mux" host [ port ]
  103. host = ip4addr | ip6addr | hostname
  104. port = [ "port" | "," ] portnumber
  105. source-stmt = "source" host "{" accept-stmts write-stmts [ datadir-stmt ] "}"
  106. accept-stmts = accept-stmt [accept-stmts]
  107. accept-stmt = "accept" "{" resources "}"
  108. resources = resource ["(" argument ")"] [ ","|" " resources ]
  109. resource = "cpu" | "mem" | "if" | "io" | "pf" | "debug" | "proc" | "mbuf"
  110. argument = number | interfacename | diskname
  111. datadir-stmt = "datadir" dirname
  112. write-stmts = write-stmt [write-stmts]
  113. write-stmt = "write" resource "in" filename
  114. .fi
  115. .Pp
  116. Note that
  117. .Bl -tag -width Ds
  118. .It Va port
  119. in the
  120. .Va mux-stmt
  121. specifies the port-number for both the udp port (incoming
  122. .Xr symon 8
  123. traffic) and the tcp port for incoming listeners.
  124. .It Va datadir
  125. will guess filenames for all
  126. accepted streams.
  127. .Va write
  128. statements always take precendence over a
  129. .Va datadir
  130. statement.
  131. .Sh EXAMPLE
  132. Here is an example
  133. .Ar symux.conf
  134. that listens to udp port 2100 on lo0, and accepts cpu, memory, pf,
  135. interfaces xl0/de0/lo0/wi0, disks wd[0-3]/cd[0-1] streams from a
  136. .Xr symon 8
  137. on localhost.
  138. .Nm
  139. will also listen on tcp port 2100 for incoming listeners.
  140. .Pp
  141. .nf
  142. mux 127.0.0.1 2100
  143. source 127.0.0.1 {
  144. accept { cpu(0), mem, pf,
  145. if(xl0), if(de0),
  146. if(lo0), if(wi0),
  147. io(wd0), io(wd1), io(wd2),
  148. io(wd3), io(cd0), io(cd1) }
  149. datadir "/export/symon/localhost"
  150. }
  151. .fi
  152. .Sh LISTENERS
  153. .Nm
  154. offers received
  155. .Xr symon 8
  156. data to other programs via tcp. An example of a listener session:
  157. .Pp
  158. .nf
  159. hoard:~/project/symon$ telnet 127.0.0.1 2100
  160. Trying 127.0.0.1...
  161. Connected to 127.0.0.1.
  162. Escape character is '^]'.
  163. 127.0.0.1;io:cd1:1027452867:262:308:536576;io:cd0:1027452867
  164. :0:0:0;io:wd3:1027452867:249140:249140:11797277696;io:wd2:10
  165. 27452867:4074001:4074001:64923271168;io:wd1:1027452867:43183
  166. 9:431839:11880622080;io:wd0:1027452867:10890717:10890717:125
  167. 382360064;if:lo0:1027452867:86952111:86952111:1164079422:116
  168. 4079422:0:0:0:0:0:0;if:de0:1027452867:117562055:90333984:405
  169. 8603563:1844391820:2588654:1:0:0:4013757:0;if:xl0:1027452867
  170. :149845272:187785769:2494862812:739916810:43291:1:3:0:318440
  171. 7:0;mem::1027452867:26566656:68579328:323141632:3571712:1047
  172. 67488;cpu:0:1027452867:0.00:0.00:0.00:0.00:99.00;
  173. ^]
  174. telnet> close
  175. Connection closed.
  176. .fi
  177. .Lp
  178. The format is
  179. .Va symon-version
  180. :
  181. .Va symon-host-ip
  182. :
  183. .Va io|if|cpu|mem|pf|mbuf|proc|debug
  184. :
  185. .Va stream-argument
  186. :
  187. .Va timestamp
  188. :
  189. .Va data
  190. .Lp
  191. Data formats:
  192. .Bl -tag -width Ds
  193. .It cpu
  194. Time spent in ( user, nice, system, interrupt, idle ). Total time is 100, data
  195. is offered with precision 2.
  196. .It mem
  197. Memory in ( real_active, real_total, free, swap_used, swap_total ). All values
  198. are in bytes rounded of to page boundaries. Values are 32 bit unsigned integers
  199. internally.
  200. .It if
  201. Interface counters ( packets_in, packets_out, bytes_in, bytes_out,
  202. multicasts_in, multicasts_out, errors_in, errors_out, collisions, drops
  203. ). Values are 32 bit unsigned integers internally.
  204. .It io
  205. Io/disk counters ( total_transfers, total_seeks, total_bytes ). Values are 64
  206. bit unsigned integers internally.
  207. .It pf
  208. Packet filter statistics ( bytes_v4_in : bytes_v4_out : bytes_v6_in :
  209. bytes_v6_out : packets_v4_in_pass : packets_v4_in_drop : packets_v4_out_pass :
  210. packets_v4_out_drop : packets_v6_in_pass : packets_v6_in_drop :
  211. packets_v6_out_pass : packets_v6_out_drop : states_entries : states_searches :
  212. states_inserts : states_removals : counters_match : counters_badoffset :
  213. counters_fragment : counters_short : counters_normalize : counters_memory
  214. ). Values are 64 bit unsigned integers internally.
  215. .It debug
  216. Kernel variables debug0 to debug19. ( debug0 : ... : debug19 ). Values are 32
  217. bit unsigned integers.
  218. .It proc
  219. Process statistics ( number : uticks : sticks : iticks : cpusec : cpupct :
  220. procsz : rsssz ).
  221. .It mbuf
  222. Mbuf statistics ( totmbufs : mt_data : mt_oobdata : mt_control :
  223. mt_header : mt_ftable : mt_soname : mt_soopts : pgused : pgtotal :
  224. totmem : totpct : m_drops : m_wait : m_drain ).
  225. .El
  226. .Sh SIGNALS
  227. .Bl -tag -width Ds
  228. .It SIGHUP
  229. Causes
  230. .Nm
  231. to read
  232. .Pa /etc/symux.conf
  233. or the file specified by the
  234. .Fl f
  235. flag.
  236. .Nm
  237. will keep the old configuration if errors occured during parsing of the
  238. configuration file.
  239. .El
  240. .Sh FILES
  241. .Bl -tag -width Ds
  242. .It Pa /var/run/symux.pid
  243. Contains the program id of the
  244. .Nm
  245. daemon.
  246. .It Pa /etc/symux.conf
  247. .Nm
  248. system wide configuration file.
  249. .El
  250. .Sh BUGS
  251. .Nm
  252. writes incoming data to rrd files "in process". An rrdupdate on a somewhat
  253. stale rrdfile -- with the last data from quite some time in the past -- is a
  254. very expensive operation. This can cause
  255. .Nm
  256. to lockup while rrdupdate is updating the rrd file.
  257. .Nm
  258. will be unresponsive during this process.
  259. .Sh AUTHOR
  260. Willem Dijkstra <wpd@xs4all.nl>. Daniel Hartmeier <daniel@benzedrine.cx>
  261. contributed the pf probe and helped to port to big-endian architectures.
  262. .Sh SEE ALSO
  263. .Xr symon 8