pcp
[Top] [All Lists]

pmrep: adjust examples for RHBZ#1289912

To: pcp developers <pcp@xxxxxxxxxxx>
Subject: pmrep: adjust examples for RHBZ#1289912
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Wed, 9 Dec 2015 13:15:12 +0200
Delivered-to: pcp@xxxxxxxxxxx
Organization: Red Hat
Reply-to: myllynen@xxxxxxxxxx
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0
Hi,

the easiest solution for pmrep command line handling needs a change how
the context is being setup. But looks like it also revealed a corner
case issue in Python PMAPI command like option handling. Adjust the
examples to make to err on the safe side for the time being regardless
of the actual root cause. Adjust the allcache derived examples while at
it.

https://bugzilla.redhat.com/show_bug.cgi?id=1289912

---
 man/html/guide.html    | 6 +++---
 src/pmrep/pmrep.conf   | 2 +-
 src/pmrep/pmrep.conf.5 | 2 +-
 src/pmrep/pmrep.py     | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/man/html/guide.html b/man/html/guide.html
index 28af3f7..2c01fe3 100644
--- a/man/html/guide.html
+++ b/man/html/guide.html
@@ -217,7 +217,7 @@ Monitor live CPU load, memory usage, and disk write 
operations per partition wit
 <TABLE WIDTH="100%" BORDER=0 CELLPADDING=10 CELLSPACING=20>
         <TR><TD BGCOLOR="#e2e2e2" WIDTH="70%"><BR><IMG 
SRC="images/stepfwd_on.png" ALT="" WIDTH=16 HEIGHT=16 
BORDER=0>&nbsp;&nbsp;&nbsp;
 Monitor live process creation rate and free/used memory with two second 
interval printing timestamps and using GBs for output values in CSV 
format:<BR><B>
-<BR> $ <a href="http://man7.org/linux/man-pages/man1/pmrep.1.html";>pmrep</a> 
-p -b GB -t 2sec -o csv kernel.all.sysfork mem.util.free mem.util.used -h 
acme.com</B>
+<BR> $ <a href="http://man7.org/linux/man-pages/man1/pmrep.1.html";>pmrep</a> 
-h acme.com -p -b GB -t 2sec -o csv kernel.all.sysfork mem.util.free 
mem.util.used</B>
 </TD></TR>
 </TABLE>
 
@@ -320,7 +320,7 @@ Dump past CPU load, memory usage, and disk write operations 
per partition in an
 <TABLE WIDTH="100%" BORDER=0 CELLPADDING=10 CELLSPACING=20>
         <TR><TD BGCOLOR="#e2e2e2" WIDTH="70%"><BR><IMG 
SRC="images/stepfwd_on.png" ALT="" WIDTH=16 HEIGHT=16 
BORDER=0>&nbsp;&nbsp;&nbsp;
 Dump past CPU load, memory usage, and disk write operations per partition in 
an archive with extended header using MBs but without interpolation between 9 
AM and 10 AM:<BR><B>
-<BR> $ <a href="http://man7.org/linux/man-pages/man1/pmrep.1.html";>pmrep</a> 
-p -u -b MB -x -S @09:00 -T @10:00 kernel.all.load mem.util.used 
disk.partitions.write -a acme.com/20140902</B>
+<BR> $ <a href="http://man7.org/linux/man-pages/man1/pmrep.1.html";>pmrep</a> 
-a acme.com/20140902 -p -u -b MB -x -S @09:00 -T @10:00 kernel.all.load 
mem.util.used disk.partitions.write</B>
 </TD></TR>
 </TABLE>
 
@@ -490,7 +490,7 @@ Create a file containing definitions of derived metrics and 
point PCP_DERIVED_CO
 <TABLE WIDTH="100%" BORDER=0 CELLPADDING=10 CELLSPACING=20>
         <TR><TD BGCOLOR="#e2e2e2" WIDTH="70%"><BR><IMG 
SRC="images/stepfwd_on.png" ALT="" WIDTH=16 HEIGHT=16 
BORDER=0>&nbsp;&nbsp;&nbsp;
 Define a derived metric on the command line and monitor it with regular 
metrics:</BR><B>
-<BR> $ <a href="http://man7.org/linux/man-pages/man1/pmrep.1.html";>pmrep</a> 
-t 2sec -p -b MB -e "mem.util.allcache = mem.util.cached + mem.util.slab + 
mem.util.bufmem" mem.util.free mem.util.allcache mem.util.used
+<BR> $ <a href="http://man7.org/linux/man-pages/man1/pmrep.1.html";>pmrep</a> 
-t 2sec -p -b MB -e "mem.util.allcache = mem.util.bufmem + mem.util.cached + 
mem.util.slab" mem.util.free mem.util.allcache mem.util.used
 </TD></TR>
 </TABLE>
 
diff --git a/src/pmrep/pmrep.conf b/src/pmrep/pmrep.conf
index 8610872..92150a7 100644
--- a/src/pmrep/pmrep.conf
+++ b/src/pmrep/pmrep.conf
@@ -72,7 +72,7 @@ pswpout.width = 10
 
 # vmstat example
 [vmstat]
-derived=mem.util.allcache=mem.util.cached+mem.util.slab,kernel.all.cpu.alluser=kernel.all.cpu.user+kernel.all.cpu.nice
+derived=mem.util.allcache=mem.util.bufmem+mem.util.cached+mem.util.slab,kernel.all.cpu.alluser=kernel.all.cpu.user+kernel.all.cpu.nice
 header = yes
 unitinfo = no
 globals = no
diff --git a/src/pmrep/pmrep.conf.5 b/src/pmrep/pmrep.conf.5
index c044214..4acc34f 100644
--- a/src/pmrep/pmrep.conf.5
+++ b/src/pmrep/pmrep.conf.5
@@ -432,7 +432,7 @@ space_scale = MB
 [global]
 kernel.all.sysfork = fork/s,,,,8
 allcache = mem.util.allcache
-allcache.formula = mem.util.cached+mem.util.slab
+allcache.formula = mem.util.bufmem + mem.util.cached + mem.util.slab
 
 [db1]
 source = db-host1.example.com
diff --git a/src/pmrep/pmrep.py b/src/pmrep/pmrep.py
index d422663..627d0d6 100644
--- a/src/pmrep/pmrep.py
+++ b/src/pmrep/pmrep.py
@@ -1299,7 +1299,7 @@ class PMReporter(object):
                 val = str(list(values[i])[j][2])
                 self.zabbix_metrics.append(ZabbixMetric(self.zabbix_host, key, 
val, ts))
 
-        # Send when need
+        # Send when needed
         if self.context.type == PM_CONTEXT_ARCHIVE:
             if len(self.zabbix_metrics) >= self.zabbix_interval:
                 send_to_zabbix(self.zabbix_metrics, self.zabbix_server, 
self.zabbix_port)
@@ -1311,7 +1311,7 @@ class PMReporter(object):
 
     def connect(self):
         """ Establish a PMAPI context to archive, host or local, via args """
-        self.context = pmapi.pmContext.fromOptions(self.opts, sys.argv)
+        self.context = pmapi.pmContext.fromOptions(self.opts, sys.argv, 
self.opts.pmGetOptionContext())
 
 if __name__ == '__main__':
     try:

Thanks,

-- 
Marko Myllynen

<Prev in Thread] Current Thread [Next in Thread>
  • pmrep: adjust examples for RHBZ#1289912, Marko Myllynen <=