summaryrefslogtreecommitdiff
path: root/pcp
diff options
context:
space:
mode:
Diffstat (limited to 'pcp')
-rw-r--r--pcp/README100
-rw-r--r--pcp/domain.h4
-rw-r--r--pcp/help77
-rwxr-xr-xpcp/mkheader.pl63
-rw-r--r--pcp/pmns45
-rw-r--r--pcp/root10
6 files changed, 299 insertions, 0 deletions
diff --git a/pcp/README b/pcp/README
new file mode 100644
index 0000000000..0c302bbfb4
--- /dev/null
+++ b/pcp/README
@@ -0,0 +1,100 @@
+NOTE! The samba.c source in this directory has been removed pending
+approval from SGI to use it under the GPLv3 license.
+
+Please see Samba 3.0.xx for a copy of this code under the GPLv2
+license if required.
+
+samba PMDA
+===========
+
+This PMDA is a sample that illustrates how a simple samba monitor
+PMDA might be constructed, using a shared memory segment to transfer
+information about transaction activity from the smb daemon.
+
+Note:
+ This PMDA may be remade from source and hence requires
+ a C compiler and Perl to be installed.
+
+ Uses of make(1) may fail (without removing or clobbering files)
+ if the C compiler cannot be found. This is most likely to
+ happen when running the PMDA ./Install script.
+
+ The only remedial action is to install the C compiler, or
+ hand-craft changes to the Makefile.
+
+Metrics
+=======
+
+The file ./help contains descriptions for all of the metrics exported
+by this PMDA.
+
+Once the PMDA has been installed, the following command will list all
+the available metrics and their explanatory "help" text:
+
+ $ pminfo -fT samba
+
+Installation
+============
+
+ + # mkdir /var/pcp/pmdas/samba
+ + # cp * /var/pcp/pmdas/samba
+ + # cp ../source/include/profile.h /var/pcp/pmdas/samba
+ + # cd /var/pcp/pmdas/samba
+
+ + Check that there is no clash in the Performance Metrics Domain
+ defined in ./domain.h and the other PMDAs currently in use
+ (/etc/pmcd.conf). If there is, edit ./domain.h to choose another
+ domain number.
+
+ + If you are not installing on an IRIX system, edit samba.c and
+ comment out the
+
+ #define IRIX 1
+
+ + Then simply use
+
+ # ./Install
+
+ + Alternatively, to install just the Performance Metrics Name Space
+ for the samba metrics on the local system, but not the samba PMDA
+ (presumably because the local system is running PCP 1.x and you
+ wish to connect to a remote system where PCP 2.0 and the samba PMDA
+ is running), make sure the Performance Metrics Domain defined in
+ ./domain.h matches the domain chosen for the samba PMDA on the
+ remote system (check the second field in the corresponding line of
+ the pmcd.conf file on the remote system - located in /etc on IRIX
+ and /var/pcp/config/pmcd on Linux), then
+
+ # ./Install -N
+
+De-installation
+===============
+
+ + Simply use
+
+ # cd /var/pcp/pmdas/samba
+ # ./Remove
+
+ + If you also want to remove the sources use
+
+ # cd /
+ # rm -rf /var/pcp/pmdas/samba
+
+Making something happen
+=======================
+
+The application "smbd" updates the shared memory segment to add
+profile information about smbd. By default updating is disabled.
+To start updating of the shared memory segment you need to run the
+smbcontrol command to turn on profiling for one or more smbd processes
+(see the man page for smbcontrol).
+
+
+
+Troubleshooting
+===============
+
+ + After installing or restarting the agent, the PMCD log file
+ (pmcd.log) and the PMDA log file (samba.log) should be checked
+ for any warnings or errors. These logs are located in
+ /var/log/pcp/pmcd on Linux and /var/adm/pcplog on IRIX.
diff --git a/pcp/domain.h b/pcp/domain.h
new file mode 100644
index 0000000000..3cf0bc6ce9
--- /dev/null
+++ b/pcp/domain.h
@@ -0,0 +1,4 @@
+/*
+ * built from /var/pcp/pmns/stdpmid
+ */
+#define SAMBA 123
diff --git a/pcp/help b/pcp/help
new file mode 100644
index 0000000000..dc3b02f03b
--- /dev/null
+++ b/pcp/help
@@ -0,0 +1,77 @@
+#
+# samba PMDA help file in the ASCII format
+#
+# lines beginning with a # are ignored
+# lines beginning @ introduce a new entry of the form
+# @ metric_name oneline-text
+# help test goes
+# here over multiple lines
+# ...
+#
+# the metric_name is decoded against the default PMNS -- as a special case,
+# a name of the form NNN.MM (for numeric NNN and MM) is interpreted as an
+# instance domain identification, and the text describes the instance domain
+#
+# blank lines before the @ line are ignored
+#
+
+@ SAMBA.0 Count and Time Instance Domain
+Contains count and time information for system calls and smb transactions.
+Counts shows the number of times each transaction was called. Times
+indicates the time spent in each transaction.
+
+@ SAMBA.1 Byte Instance Domain
+This domain contains instances for the number of bytes transferred
+using the read and write system call.
+
+@ samba.counts Count of calls to this function
+
+@ samba.times Time required to complete call
+
+@ samba.bytes Number of bytes processed by this call
+
+@ samba.smbd.smb_count Count of SMB packets processed
+
+@ samba.smbd.uid_changes Count of times effective uid changed
+
+@ samba.statcache.lookups Number of lookups in stat cache
+
+@ samba.statcache.misses Number of times stat cache lookup missed
+
+@ samba.statcache.hits Number of times stat cache lookup hit
+
+@ samba.writecache.num_caches Number of write caches available
+
+@ samba.writecache.allocated_caches Number of write caches allocated
+
+@ samba.writecache.read_hits Number of times read request found in write cache
+
+@ samba.writecache.total_writes Number of writes to write cache
+
+@ samba.writecache.init_writes Number of initial writes to write cache
+
+@ samba.writecache.abutted_writes
+
+@ samba.writecache.perfect_writes
+
+@ samba.writecache.direct_writes
+
+@ samba.writecache.non_oplock_writes
+
+@ samba.writecache.seek_flush
+
+@ samba.writecache.read_flush
+
+@ samba.writecache.write_flush
+
+@ samba.writecache.readraw_flush
+
+@ samba.writecache.oplock_rel_flush
+
+@ samba.writecache.close_flush
+
+@ samba.writecache.sync_flush
+
+@ samba.writecache.size_change_flush
+
+@ samba.bytes cumulative number of bytes read or written
diff --git a/pcp/mkheader.pl b/pcp/mkheader.pl
new file mode 100755
index 0000000000..ad069c544a
--- /dev/null
+++ b/pcp/mkheader.pl
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+
+
+open(PROFILE,"profile.h") || die "Unable to open profile.h\n";
+@profile = <PROFILE>;
+close PROFILE;
+
+open(METRICS,"> metrics.h") || die "Unable to open metrics.h for output\n";
+
+print METRICS "#define COUNT_TIME_INDOM 0\n";
+print METRICS "#define BYTE_INDOM 1\n\n";
+print METRICS "#define FIELD_OFF(x) (unsigned)\&(((struct profile_stats *)NULL)->x)\n\n";
+print METRICS "typedef struct {\n";
+print METRICS "\tchar *name;\n";
+print METRICS "\tunsigned offset;\n";
+print METRICS "} samba_instance;\n\n";
+
+@instnames = grep(/unsigned .*_time;/,@profile);
+foreach $instnames (@instnames) {
+ chomp $instnames;
+ $instnames =~ s/^.*unsigned (.*)_time.*$/$1/;
+}
+
+print METRICS "static samba_instance samba_counts[] = {";
+$first = 1;
+foreach $1 (@instnames) {
+ if ($first == 1) {
+ $first = 0;
+ print METRICS "\n";
+ } else {
+ print METRICS ",\n";
+ }
+ print METRICS "\t{\"$1\", FIELD_OFF($1_count)}";
+}
+print METRICS "\n};\n\n";
+print METRICS "static samba_instance samba_times[] = {";
+$first = 1;
+foreach $1 (@instnames) {
+ if ($first == 1) {
+ $first = 0;
+ print METRICS "\n";
+ } else {
+ print METRICS ",\n";
+ }
+ print METRICS "\t{\"$1\", FIELD_OFF($1_time)}";
+}
+print METRICS "\n};\n\n";
+print METRICS "static samba_instance samba_bytes[] = {";
+@instnames = grep(/unsigned .*_bytes;/,@profile);
+$first = 1;
+foreach $_ (@instnames) {
+ if ($first == 1) {
+ $first = 0;
+ print METRICS "\n";
+ } else {
+ print METRICS ",\n";
+ }
+ /^.*unsigned (.*)_bytes.*$/;
+ print METRICS "\t{\"$1\", FIELD_OFF($1_bytes)}";
+}
+print METRICS "\n};\n";
+
+close METRICS
diff --git a/pcp/pmns b/pcp/pmns
new file mode 100644
index 0000000000..1f3dd3934e
--- /dev/null
+++ b/pcp/pmns
@@ -0,0 +1,45 @@
+/*
+ * Metrics for samba PMDA
+ *
+ */
+
+samba {
+ smbd
+ statcache
+ writecache
+ counts SAMBA:3:0
+ times SAMBA:4:0
+ bytes SAMBA:5:0
+}
+
+samba.smbd {
+ smb_count SAMBA:0:0
+ uid_changes SAMBA:0:1
+}
+
+samba.statcache {
+ lookups SAMBA:1:0
+ misses SAMBA:1:1
+ hits SAMBA:1:2
+}
+
+samba.writecache {
+ num_caches SAMBA:2:0
+ allocated_caches SAMBA:2:1
+ read_hits SAMBA:2:2
+ total_writes SAMBA:2:3
+ init_writes SAMBA:2:4
+ abutted_writes SAMBA:2:5
+ perfect_writes SAMBA:2:6
+ direct_writes SAMBA:2:7
+ non_oplock_writes SAMBA:2:8
+ seek_flush SAMBA:2:9
+ read_flush SAMBA:2:10
+ write_flush SAMBA:2:11
+ readraw_flush SAMBA:2:12
+ oplock_rel_flush SAMBA:2:13
+ close_flush SAMBA:2:14
+ sync_flush SAMBA:2:15
+ size_change_flush SAMBA:2:16
+}
+
diff --git a/pcp/root b/pcp/root
new file mode 100644
index 0000000000..d5137bc7dd
--- /dev/null
+++ b/pcp/root
@@ -0,0 +1,10 @@
+/*
+ * fake "root" for validating the local PMNS subtree
+ */
+
+#include "/var/pcp/pmns/stdpmid"
+
+root { samba }
+
+#include "pmns"
+