From 5b938e05c74ef0f6c162b1899b517440297996d6 Mon Sep 17 00:00:00 2001 From: Adam Drescher Date: Fri, 7 Oct 2016 11:37:13 -0500 Subject: Added a format string example to the man page. While the documentation is clear, it is nice to see an example to get started. Single quotes are used to prevent the shell from running our bmon patterns as commands, and to prevent it from doing wildcard expansion for the interface string. --- man/bmon.8 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/man/bmon.8 b/man/bmon.8 index ec4431c..e371ad8 100644 --- a/man/bmon.8 +++ b/man/bmon.8 @@ -220,6 +220,14 @@ and eth1: .RS 4 \fBbmon \-p eth0,eth1 \-o curses\fP .RE +.PP +To run bmon in format mode, monitoring any eth* interfaces, with a specified +format string: +.PP +.RS 4 +\fBbmon \-p \(aqeth*\(aq \-o format:fmt=\(aq$(element:name) $(attr:rxrate:packets)\en\(aq\fP +.RE +.PP .SH "FILES" /etc/bmon.conf -- cgit v1.2.3 From 577112870d616fb5e65feeefcb16e7889c4ece9d Mon Sep 17 00:00:00 2001 From: Adam Drescher Date: Fri, 7 Oct 2016 11:42:14 -0500 Subject: Replaced format string double quotes with single quotes to prevent the shell from running our provided format placeholders. --- src/out_format.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/out_format.c b/src/out_format.c index aea38c5..be08b29 100644 --- a/src/out_format.c +++ b/src/out_format.c @@ -320,15 +320,15 @@ static void print_help(void) " Supported Escape Sequences: \\n, \\t, \\r, \\v, \\b, \\f, \\a\n" \ "\n" \ " Examples:\n" \ - " \"$(element:name)\\t$(attr:rx:bytes)\\t$(attr:tx:bytes)\\n\"\n" \ + " '$(element:name)\\t$(attr:rx:bytes)\\t$(attr:tx:bytes)\\n'\n" \ " lo 12074 12074\n" \ "\n" \ - " \"$(element:name) $(attr:rxrate:packets) $(attr:txrate:packets)\\n\"\n" \ + " '$(element:name) $(attr:rxrate:packets) $(attr:txrate:packets)\\n'\n" \ " eth0 33 5\n" \ "\n" \ - " \"Item: $(element:name)\\n\" \\\n" \ - " \"Bytes Rate: $(attr:rxrate:bytes)/$(attr:txrate:bytes)\\n\" \\\n" \ - " \"Packets Rate: $(attr:rxrate:packets)/$(attr:txrate:packets)\\n\"\n" \ + " 'Item: $(element:name)\\n' \\\n" \ + " 'Bytes Rate: $(attr:rxrate:bytes)/$(attr:txrate:bytes)\\n' \\\n" \ + " 'Packets Rate: $(attr:rxrate:packets)/$(attr:txrate:packets)\\n'\n" \ " Item: eth0\n" \ " Bytes Rate: 49130/2119\n" \ " Packets Rate: 40/11\n" \ -- cgit v1.2.3 From 32d8c76b18cb829a8e8178f7508cede2a95c9c80 Mon Sep 17 00:00:00 2001 From: Adam Drescher Date: Fri, 7 Oct 2016 11:49:39 -0500 Subject: Changed the long format string example to be one continuous string. While this is less pretty than it was before, it allows the user to actually paste the format string directly into their bmon command to try it out. Before this change, the way the string was formatted you could not simply paste it in and run it (whether it had single or double quotes). --- src/out_format.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/out_format.c b/src/out_format.c index be08b29..4d017f3 100644 --- a/src/out_format.c +++ b/src/out_format.c @@ -326,9 +326,9 @@ static void print_help(void) " '$(element:name) $(attr:rxrate:packets) $(attr:txrate:packets)\\n'\n" \ " eth0 33 5\n" \ "\n" \ - " 'Item: $(element:name)\\n' \\\n" \ - " 'Bytes Rate: $(attr:rxrate:bytes)/$(attr:txrate:bytes)\\n' \\\n" \ - " 'Packets Rate: $(attr:rxrate:packets)/$(attr:txrate:packets)\\n'\n" \ + " 'Item: $(element:name)\\nBytes Rate: $(attr:rxrate:bytes)/" \ + "$(attr:txrate:bytes)\\nPackets Rate: $(attr:rxrate:packets)/" \ + "$(attr:txrate:packets)\\n'\n" \ " Item: eth0\n" \ " Bytes Rate: 49130/2119\n" \ " Packets Rate: 40/11\n" \ -- cgit v1.2.3