symux.8 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. .\" -*- nroff -*-
  2. .\"
  3. .\" Copyright (c) 2001-2008 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 January 30, 2008
  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 dltv
  39. .Op Fl f Ar filename
  40. .Pp
  41. .Sh DESCRIPTION
  42. .Xr symon 8
  43. is a lightweight system monitor that measures cpu, filesystem, interface, disk,
  44. memory, pf, pf queues, mbuf, proc and sensor statistics every 5 seconds. This
  45. information 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 privileges 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 d
  75. Stop
  76. .Nm
  77. from becoming a daemon and show debug information on stdout. Use this setting
  78. to find hosts or specific statistics that do get sent, but are ignored due to
  79. configuration.
  80. .It Fl f Ar filename
  81. Read configuration from
  82. .Ar filename
  83. instead of
  84. .Pa /etc/symux.conf .
  85. .It Fl l
  86. List rrd files found in active configuration.
  87. .It Fl t
  88. Test configuration file and exit.
  89. .It Fl v
  90. Show version.
  91. .El
  92. .Sh CONFIGURATION
  93. .Nm
  94. obtains configuration data from
  95. .Pa /etc/symux.conf .
  96. The configuration file contains one mux stanza that defines on what host
  97. address and port
  98. .Nm
  99. should listen to for incoming monitored data. There is a source section
  100. for every host that is to be monitored. The source section defines what
  101. data to accept and where to write that data to. In the case that a
  102. source is of another address family than the mux stanza, i.e. source =
  103. ipv6 with mux = ipv4, a listen port of the sources' family is opened
  104. using the unspecified address. Whitespace, newlines and text behind '#'
  105. are ignored. The format in BNF:
  106. .Pp
  107. .nf
  108. stmt = mux-stmt | source-stmt
  109. mux-stmt = "mux" host [ port ]
  110. host = ip4addr | ip6addr | hostname
  111. port = [ "port" | "," ] portnumber
  112. source-stmt = "source" host "{"
  113. accept-stmts
  114. [ write-stmts ]
  115. [ datadir-stmt ] "}"
  116. accept-stmts = accept-stmt [accept-stmts]
  117. accept-stmt = "accept" "{" resources "}"
  118. resources = resource [ version ] ["(" argument ")"]
  119. [ ","|" " resources ]
  120. resource = "cpu" | "cpuiow" | "debug" | "df" | "if" | "io"
  121. "mbuf" | "mem" | "pf" | "pfq" | "proc" | "sensor"
  122. version = number
  123. argument = number | interfacename | diskname
  124. datadir-stmt = "datadir" dirname
  125. write-stmts = write-stmt [write-stmts]
  126. write-stmt = "write" resource "in" filename
  127. .fi
  128. .Pp
  129. Note that
  130. .Bl -tag -width Ds
  131. .It Va port
  132. in the
  133. .Va mux-stmt
  134. specifies the port-number for both the udp port (incoming
  135. .Xr symon 8
  136. traffic) and the tcp port for incoming listeners.
  137. .It Va version
  138. is needed to distinguish between the same type of information (i.e.
  139. .Va io
  140. ) coming from different versions of OpenBSD. If no version number is
  141. supplied, the latest will be assumed.
  142. .It Va datadir
  143. will guess filenames for all accepted streams.
  144. .Va write
  145. statements always take precendence over a
  146. .Va datadir
  147. statement.
  148. .El
  149. .Sh EXAMPLE
  150. Here is an example
  151. .Ar symux.conf
  152. that listens to udp port 2100 on lo0, and accepts cpu, memory, pf,
  153. interfaces xl0/de0/lo0/wi0, disks wd[0-3]/cd[0-1], disk free blocks
  154. of three partition streams from a
  155. .Xr symon 8
  156. on localhost.
  157. .Nm
  158. will also listen on tcp port 2100 for incoming listeners.
  159. .Pp
  160. .nf
  161. mux 127.0.0.1 2100
  162. source 127.0.0.1 {
  163. accept { cpu(0), mem, pf,
  164. if(xl0), if(de0),
  165. if(lo0), if(wi0),
  166. io(wd0), io(wd1), io(wd2),
  167. io(wd3), io(cd0), io(cd1),
  168. df(sd0a), df(sd0d), df(sd0e) }
  169. .Pp
  170. datadir "/var/www/symon/rrds/localhost"
  171. }
  172. .fi
  173. .Sh LISTENERS
  174. .Nm
  175. offers received
  176. .Xr symon 8
  177. data to other programs via tcp. An example of a listener session:
  178. .Pp
  179. .nf
  180. nexus:~/project/symon$ telnet 10.0.0.1 2100
  181. Trying 10.0.0.1...
  182. Connected to 10.0.0.1.
  183. Escape character is '^]'.
  184. .Pp
  185. 10.0.0.1;mem::1077662160:7630848:53850112:469417984:0:25600;cpu:0:
  186. 1077662160:0.00:0.00:0.30:0.20:99.50;io:wd0:1077662160:2074:12759:
  187. 0:30736384:131780608;
  188. 10.0.0.2;mbuf::1077658247:138:74:0:0:41:0:23:0:90:360:868352:25:0:
  189. 0:0;pf::1077658247:700930123:535398451:0:352:1107229:706391:119833
  190. 9:4:0:0:2:3:29:4109383:83291:83262:980325:0:1:6:0:0;mem::107765824
  191. 7:79155200:131956736:391430144:0:536739840;cpu:0:1077658247:0.50:0
  192. .00:0.00:0.90:98.60;proc:httpd:1077658247:9:216:172:8:3:0.00:14999
  193. 552:0;if:lo0:1077658247:147104:147104:45868177:45868177:0:0:0:0:0:
  194. 0;if:xl0:1077658247:284267:452077:150620236:273265863:372:89478:0:
  195. 0:0:0;if:de0:1077658247:1813721:1197722:729054136:568900227:101:2:
  196. 0:0:198:0;
  197. .Pp
  198. ^]
  199. telnet> close
  200. Connection closed.
  201. .fi
  202. .Lp
  203. The format is
  204. .Va symon-version
  205. :
  206. .Va symon-host-ip
  207. :
  208. .Va stream-name
  209. :
  210. .Va stream-argument
  211. :
  212. .Va timestamp
  213. :
  214. .Va data
  215. .Lp
  216. Data formats:
  217. .Bl -tag -width Ds
  218. .It cpu
  219. Time spent in ( user, nice, system, interrupt, idle ). Total time is 100, data
  220. is offered with precision 2.
  221. .It cpuiow
  222. Time spent in ( user, nice, system, interrupt, idle, iowait ). Total time is
  223. 100, data is offered with precision 2.
  224. .It debug
  225. Kernel variables debug0 to debug19. ( debug0 : ... : debug19 ). Values are 32
  226. bit unsigned integers.
  227. .It df
  228. Disk free statistics ( blocks : bfree : bavail : files :
  229. ffree : synwrites : asyncwrites). Values are 64 bit unsigned integers.
  230. .It if
  231. Alias for if2. See below.
  232. .It if1
  233. Pre OpenBSD 4.3 interface counters ( packets_in, packets_out, bytes_in,
  234. bytes_out, multicasts_in, multicasts_out, errors_in, errors_out, collisions,
  235. drops ). Values are 32 bit unsigned integers.
  236. .It if2
  237. Interface counters ( packets_in, packets_out, bytes_in, bytes_out,
  238. multicasts_in, multicasts_out, errors_in, errors_out, collisions, drops
  239. ). Values are 64 bit unsigned integers.
  240. .It io
  241. Alias for io2. See below.
  242. .It io1
  243. Pre OpenBSD 3.5 io/disk counters ( total_transfers, total_seeks, total_bytes
  244. ). Values are 64 bit unsigned integers.
  245. .It io2
  246. Io/disk counters ( total_rxfer, total_wxfer, total_seeks, total_rbytes,
  247. total_wbytes). Values are 64 bit unsigned integers.
  248. .It mbuf
  249. Mbuf statistics ( totmbufs : mt_data : mt_oobdata : mt_control :
  250. mt_header : mt_ftable : mt_soname : mt_soopts : pgused : pgtotal :
  251. totmem : totpct : m_drops : m_wait : m_drain ).
  252. .It mem
  253. Alias for mem2. See below.
  254. .It mem1
  255. Pre symon 2.78 memory counters ( real_active, real_total, free, swap_used,
  256. swap_total ). All values are in bytes rounded to page boundaries. Values are 32
  257. bit unsigned integers.
  258. .It mem2
  259. Memory in ( real_active, real_total, free, swap_used, swap_total ). All values
  260. are in bytes rounded to page boundaries. Values are 64 bit unsigned integers.
  261. .It pf
  262. Packet filter statistics ( bytes_v4_in : bytes_v4_out : bytes_v6_in :
  263. bytes_v6_out : packets_v4_in_pass : packets_v4_in_drop : packets_v4_out_pass :
  264. packets_v4_out_drop : packets_v6_in_pass : packets_v6_in_drop :
  265. packets_v6_out_pass : packets_v6_out_drop : states_entries : states_searches :
  266. states_inserts : states_removals : counters_match : counters_badoffset :
  267. counters_fragment : counters_short : counters_normalize : counters_memory
  268. ). Values are 64 bit unsigned integers.
  269. .It pfq
  270. pf/altq queue statistics ( sent_bytes : sent_packets : drop_bytes :
  271. drop_packets ). Values are 64 bit unsigned integers.
  272. .It proc
  273. Process statistics ( number : uticks : sticks : iticks : cpusec : cpupct :
  274. procsz : rsssz ).
  275. .It sensor
  276. Single sensor measurement offered with 7.6 precision. Value depends on sensor
  277. type.
  278. .El
  279. .Sh SIGNALS
  280. .Bl -tag -width Ds
  281. .It SIGHUP
  282. Causes
  283. .Nm
  284. to read
  285. .Pa /etc/symux.conf
  286. or the file specified by the
  287. .Fl f
  288. flag.
  289. .Nm
  290. will keep the old configuration if errors occured during parsing of the
  291. configuration file.
  292. .El
  293. .Sh FILES
  294. .Bl -tag -width Ds
  295. .It Pa /var/run/symux.pid
  296. Contains the program id of the
  297. .Nm
  298. daemon.
  299. .It Pa /etc/symux.conf
  300. .Nm
  301. system wide configuration file.
  302. .El
  303. .Sh LEGACY FORMATS
  304. .Nm
  305. supports symon(8) clients that send
  306. .Bl -tag -width Ds
  307. .It pre OpenBSD 3.5 disk statistics.
  308. These streams should be identified as io1(<disk>) instead of
  309. io(<disk>) in
  310. .Pa /etc/symux.conf.
  311. Also note that symon(8) measures io1 or io2 depending on whether it was
  312. compiled on a host that supports version 1 or 2. The rrd datastructures of
  313. these streams differ and there is no easy way to change an io1 rrd into an io2
  314. rrd.
  315. .It pre symon 2.78 mem/if statistics.
  316. These streams should be identified as if1(<interface>) and mem1() in
  317. .Pa /etc/symux.conf.
  318. symon versions 2.78 and up will always report if2 and mem2 statistics. The rrd
  319. files for the old and new probes are identical and need not be changed.
  320. .El
  321. .Pp
  322. .Nm
  323. will output what version of information it is offered by symon(8)s on
  324. the network when started with the
  325. .Va -d
  326. flag.
  327. .Sh BUGS
  328. .Nm
  329. writes incoming data to rrd files "in process". An rrdupdate on a somewhat
  330. stale rrdfile -- with the last data from quite some time in the past -- is a
  331. very expensive operation. This can cause
  332. .Nm
  333. to lockup while rrdupdate is updating the rrd file.
  334. .Nm
  335. will be unresponsive during this process.
  336. .Sh AUTHOR
  337. Willem Dijkstra <wpd@xs4all.nl>. \%Daniel \%Hartmeier helped to port to big-endian
  338. architectures. \%Matthew \%Gream helped to port symon to other BSD platforms.
  339. .Pp
  340. Port contributors: \%Marc \%Balmer, \%Matthew \%Gream, \%Daniel \%Hartmeier,
  341. \%Constantine A. \%Murenin, J. \%Martin \%Petersen, \%Fredrik \%Soderblom,
  342. \%Harm \%Schotanus and \%Martin van der \%Werff.
  343. .Sh SEE ALSO
  344. .Xr symon 8