symux.8 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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" |
  110. "proc" | "mbuf" | "sensor"
  111. argument = number | interfacename | diskname
  112. datadir-stmt = "datadir" dirname
  113. write-stmts = write-stmt [write-stmts]
  114. write-stmt = "write" resource "in" filename
  115. .fi
  116. .Pp
  117. Note that
  118. .Bl -tag -width Ds
  119. .It Va port
  120. in the
  121. .Va mux-stmt
  122. specifies the port-number for both the udp port (incoming
  123. .Xr symon 8
  124. traffic) and the tcp port for incoming listeners.
  125. .It Va datadir
  126. will guess filenames for all
  127. accepted streams.
  128. .Va write
  129. statements always take precendence over a
  130. .Va datadir
  131. statement.
  132. .Sh EXAMPLE
  133. Here is an example
  134. .Ar symux.conf
  135. that listens to udp port 2100 on lo0, and accepts cpu, memory, pf,
  136. interfaces xl0/de0/lo0/wi0, disks wd[0-3]/cd[0-1] streams from a
  137. .Xr symon 8
  138. on localhost.
  139. .Nm
  140. will also listen on tcp port 2100 for incoming listeners.
  141. .Pp
  142. .nf
  143. mux 127.0.0.1 2100
  144. source 127.0.0.1 {
  145. accept { cpu(0), mem, pf,
  146. if(xl0), if(de0),
  147. if(lo0), if(wi0),
  148. io(wd0), io(wd1), io(wd2),
  149. io(wd3), io(cd0), io(cd1) }
  150. datadir "/export/symon/localhost"
  151. }
  152. .fi
  153. .Sh LISTENERS
  154. .Nm
  155. offers received
  156. .Xr symon 8
  157. data to other programs via tcp. An example of a listener session:
  158. .Pp
  159. .nf
  160. hoard:~/project/symon$ telnet 127.0.0.1 2100
  161. Trying 127.0.0.1...
  162. Connected to 127.0.0.1.
  163. Escape character is '^]'.
  164. 127.0.0.1;io:cd1:1027452867:262:308:536576;io:cd0:1027452867
  165. :0:0:0;io:wd3:1027452867:249140:249140:11797277696;io:wd2:10
  166. 27452867:4074001:4074001:64923271168;io:wd1:1027452867:43183
  167. 9:431839:11880622080;io:wd0:1027452867:10890717:10890717:125
  168. 382360064;if:lo0:1027452867:86952111:86952111:1164079422:116
  169. 4079422:0:0:0:0:0:0;if:de0:1027452867:117562055:90333984:405
  170. 8603563:1844391820:2588654:1:0:0:4013757:0;if:xl0:1027452867
  171. :149845272:187785769:2494862812:739916810:43291:1:3:0:318440
  172. 7:0;mem::1027452867:26566656:68579328:323141632:3571712:1047
  173. 67488;cpu:0:1027452867:0.00:0.00:0.00:0.00:99.00;
  174. ^]
  175. telnet> close
  176. Connection closed.
  177. .fi
  178. .Lp
  179. The format is
  180. .Va symon-version
  181. :
  182. .Va symon-host-ip
  183. :
  184. .Va io|if|cpu|mem|pf|mbuf|proc|debug
  185. :
  186. .Va stream-argument
  187. :
  188. .Va timestamp
  189. :
  190. .Va data
  191. .Lp
  192. Data formats:
  193. .Bl -tag -width Ds
  194. .It cpu
  195. Time spent in ( user, nice, system, interrupt, idle ). Total time is 100, data
  196. is offered with precision 2.
  197. .It mem
  198. Memory in ( real_active, real_total, free, swap_used, swap_total ). All values
  199. are in bytes rounded of to page boundaries. Values are 32 bit unsigned integers
  200. internally.
  201. .It if
  202. Interface counters ( packets_in, packets_out, bytes_in, bytes_out,
  203. multicasts_in, multicasts_out, errors_in, errors_out, collisions, drops
  204. ). Values are 32 bit unsigned integers internally.
  205. .It io
  206. Io/disk counters ( total_transfers, total_seeks, total_bytes ). Values are 64
  207. bit unsigned integers internally.
  208. .It pf
  209. Packet filter statistics ( bytes_v4_in : bytes_v4_out : bytes_v6_in :
  210. bytes_v6_out : packets_v4_in_pass : packets_v4_in_drop : packets_v4_out_pass :
  211. packets_v4_out_drop : packets_v6_in_pass : packets_v6_in_drop :
  212. packets_v6_out_pass : packets_v6_out_drop : states_entries : states_searches :
  213. states_inserts : states_removals : counters_match : counters_badoffset :
  214. counters_fragment : counters_short : counters_normalize : counters_memory
  215. ). Values are 64 bit unsigned integers internally.
  216. .It debug
  217. Kernel variables debug0 to debug19. ( debug0 : ... : debug19 ). Values are 32
  218. bit unsigned integers.
  219. .It proc
  220. Process statistics ( number : uticks : sticks : iticks : cpusec : cpupct :
  221. procsz : rsssz ).
  222. .It mbuf
  223. Mbuf statistics ( totmbufs : mt_data : mt_oobdata : mt_control :
  224. mt_header : mt_ftable : mt_soname : mt_soopts : pgused : pgtotal :
  225. totmem : totpct : m_drops : m_wait : m_drain ).
  226. .It sensor
  227. Single sensor value. ( value ) Value is a double that is offered with 7.6
  228. precision. Value depends on sensor type.
  229. .El
  230. .Sh SIGNALS
  231. .Bl -tag -width Ds
  232. .It SIGHUP
  233. Causes
  234. .Nm
  235. to read
  236. .Pa /etc/symux.conf
  237. or the file specified by the
  238. .Fl f
  239. flag.
  240. .Nm
  241. will keep the old configuration if errors occured during parsing of the
  242. configuration file.
  243. .El
  244. .Sh FILES
  245. .Bl -tag -width Ds
  246. .It Pa /var/run/symux.pid
  247. Contains the program id of the
  248. .Nm
  249. daemon.
  250. .It Pa /etc/symux.conf
  251. .Nm
  252. system wide configuration file.
  253. .El
  254. .Sh BUGS
  255. .Nm
  256. writes incoming data to rrd files "in process". An rrdupdate on a somewhat
  257. stale rrdfile -- with the last data from quite some time in the past -- is a
  258. very expensive operation. This can cause
  259. .Nm
  260. to lockup while rrdupdate is updating the rrd file.
  261. .Nm
  262. will be unresponsive during this process.
  263. .Sh AUTHOR
  264. Willem Dijkstra <wpd@xs4all.nl>. Daniel Hartmeier <daniel@benzedrine.cx>
  265. contributed the pf probe and helped to port to big-endian architectures.
  266. .Sh SEE ALSO
  267. .Xr symon 8