symux.8 10 KB

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