summaryrefslogtreecommitdiff
path: root/src/pmdas/lmsensors
diff options
context:
space:
mode:
Diffstat (limited to 'src/pmdas/lmsensors')
-rw-r--r--src/pmdas/lmsensors/GNUmakefile61
-rwxr-xr-xsrc/pmdas/lmsensors/Install35
-rw-r--r--src/pmdas/lmsensors/README69
-rwxr-xr-xsrc/pmdas/lmsensors/Remove38
-rw-r--r--src/pmdas/lmsensors/help1
-rw-r--r--src/pmdas/lmsensors/lmsensors.c953
-rw-r--r--src/pmdas/lmsensors/lmsensors.h113
-rw-r--r--src/pmdas/lmsensors/pmns106
-rw-r--r--src/pmdas/lmsensors/root12
9 files changed, 1388 insertions, 0 deletions
diff --git a/src/pmdas/lmsensors/GNUmakefile b/src/pmdas/lmsensors/GNUmakefile
new file mode 100644
index 0000000..15df27c
--- /dev/null
+++ b/src/pmdas/lmsensors/GNUmakefile
@@ -0,0 +1,61 @@
+#
+# Original implementation by Troy Dawson (dawson@fnal.gov)
+#
+# Copyright (c) 2001,2004 Silicon Graphics, Inc. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+
+TOPDIR = ../../..
+include $(TOPDIR)/src/include/builddefs
+
+IAM = lmsensors
+DOMAIN = LMSENSORS
+TARGETS = $(IAM)
+CFILES = lmsensors.c
+HFILES = lmsensors.h
+SCRIPTS = Install Remove
+DFILES = README
+LSRCFILES = $(SCRIPTS) pmns help root $(DFILES)
+
+PMDADIR = $(PCP_PMDAS_DIR)/$(IAM)
+
+LDIRT = domain.h $(IAM).log pmda$(IAM) pmda_$(IAM).so $(TARGETS) \
+ help.pag help.dir
+LLDLIBS = $(PCP_PMDALIB)
+
+default: build-me
+
+include $(BUILDRULES)
+
+ifeq "$(TARGET_OS)" "linux"
+build-me: $(TARGETS)
+
+install : default
+ $(INSTALL) -m 755 -d $(PMDADIR)
+ $(INSTALL) -m 755 $(IAM) $(PMDADIR)/pmda$(IAM)
+ $(INSTALL) -m 755 $(SCRIPTS) $(PMDADIR)
+ $(INSTALL) -m 644 $(DFILES) pmns help root domain.h $(PMDADIR)
+else
+build-me:
+install:
+endif
+
+$(IAM): $(OBJECTS)
+
+lmsensors.o: domain.h
+
+default_pcp: default
+
+install_pcp: install
+
+domain.h: ../../pmns/stdpmid
+ $(DOMAIN_MAKERULE)
diff --git a/src/pmdas/lmsensors/Install b/src/pmdas/lmsensors/Install
new file mode 100755
index 0000000..977f06e
--- /dev/null
+++ b/src/pmdas/lmsensors/Install
@@ -0,0 +1,35 @@
+#! /bin/sh
+#
+# Original implementation by Troy Dawson (dawson@fnal.gov)
+#
+# Copyright (c) 2001,2004 Silicon Graphics, Inc. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+
+. $PCP_DIR/etc/pcp.env
+. $PCP_SHARE_DIR/lib/pmdaproc.sh
+
+iam=lmsensors
+pmda_interface=2
+forced_restart=true
+
+# Do it
+#
+pmdaSetup
+
+dso_opt=true
+socket_opt=true
+socket_inet_def=2079
+
+pmdaInstall
+
+exit 0
diff --git a/src/pmdas/lmsensors/README b/src/pmdas/lmsensors/README
new file mode 100644
index 0000000..961d26a
--- /dev/null
+++ b/src/pmdas/lmsensors/README
@@ -0,0 +1,69 @@
+#
+# Original implementation by Troy Dawson (dawson@fnal.gov)
+#
+# Copyright (c) 2001,2004 Silicon Graphics, Inc. All Rights Reserved.
+#
+
+lmsensors PMDA
+==============
+
+This PMDA exports information about the lm sensors on
+compatible motherboards.
+
+This source code was contributed by Troy Dawson (dawson@fnal.gov)
+to the PCP open source project.
+
+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 lmsensors
+
+Installation
+============
+
+ + # cd $PCP_PMDAS_DIR/lmsensors
+
+ + Check that there is no clash in the Performance Metrics Domain
+ defined in ./domain.h and the other PMDAs currently in use
+ ($PCP_PMCDCONF_PATH). If there is, edit ./domain.h to choose another
+ domain number.
+
+ + Then simply use
+
+ # ./Install
+
+ and choose both the "collector" and "monitor" installation
+ configuration options -- everything else is automated.
+
+ + Alternatively, to install just the Performance Metrics Name Space
+ for the lmsensors metrics on the local system, but not the lmsensors 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 lmsensors PMDA
+ is running), make sure the Performance Metrics Domain defined in
+ ./domain.h matches the domain chosen for the lmsensors PMDA on the
+ remote system (check the second field in the corresponding line of
+ the $PCP_PMCDCONF_PATH file on the remote system), then
+
+ # ./Install -N
+
+De-installation
+===============
+
+ + Simply use
+
+ # cd $PCP_PMDAS_DIR/lmsensors
+ # ./Remove
+
+Troubleshooting
+===============
+
+ + After installing or restarting the agent, the PMCD log file
+ ($PCP_LOG_DIR/pmcd/pmcd.log) and the PMDA log file
+ ($PCP_LOG_DIR/pmcd/lmsensors.log) should be checked for any warnings or
+ errors.
diff --git a/src/pmdas/lmsensors/Remove b/src/pmdas/lmsensors/Remove
new file mode 100755
index 0000000..ddcbfc0
--- /dev/null
+++ b/src/pmdas/lmsensors/Remove
@@ -0,0 +1,38 @@
+#! /bin/sh
+#
+# Original implementation by Troy Dawson (dawson@fnal.gov)
+#
+# Copyright (c) 2001,2004 Silicon Graphics, Inc. All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+# source the PCP configuration environment variables
+. $PCP_DIR/etc/pcp.env
+
+# Get the common procedures and variable assignments
+#
+. $PCP_SHARE_DIR/lib/pmdaproc.sh
+
+# The name of the PMDA
+#
+iam=lmsensors
+
+# Do it
+#
+pmdaSetup
+pmdaRemove
+
+exit 0
diff --git a/src/pmdas/lmsensors/help b/src/pmdas/lmsensors/help
new file mode 100644
index 0000000..792d600
--- /dev/null
+++ b/src/pmdas/lmsensors/help
@@ -0,0 +1 @@
+#
diff --git a/src/pmdas/lmsensors/lmsensors.c b/src/pmdas/lmsensors/lmsensors.c
new file mode 100644
index 0000000..c8891f0
--- /dev/null
+++ b/src/pmdas/lmsensors/lmsensors.c
@@ -0,0 +1,953 @@
+/*
+ * lmsensors, configurable PMDA
+ *
+ * Original implementation by Troy Dawson (dawson@fnal.gov)
+ *
+ * Copyright (c) 2012,2014 Red Hat.
+ * Copyright (c) 2001,2004 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include <fcntl.h>
+
+#include "pmapi.h"
+#include "impl.h"
+#include "pmda.h"
+#include "domain.h"
+#include "lmsensors.h"
+
+static char *username;
+static char buf[4096];
+static chips schips;
+
+/*
+ * lmsensors PMDA
+ *
+ */
+
+/*
+ * all metrics supported in this PMDA - one table entry for each
+ */
+
+static pmdaMetric metrictab[] = {
+/* n_total */
+ { NULL,
+ { PMDA_PMID(0,0), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* n_lm75 */
+ { NULL,
+ { PMDA_PMID(0,1), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* n_lm79 */
+ { NULL,
+ { PMDA_PMID(0,2), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* n_lm87 */
+ { NULL,
+ { PMDA_PMID(0,3), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* n_w83781d */
+ { NULL,
+ { PMDA_PMID(0,4), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* n_mtp008 */
+ { NULL,
+ { PMDA_PMID(0,5), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm75 temp */
+ { NULL,
+ { PMDA_PMID(1,0), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm79 fan1 */
+ { NULL,
+ { PMDA_PMID(2,0), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm79 fan2 */
+ { NULL,
+ { PMDA_PMID(2,1), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm79 fan3 */
+ { NULL,
+ { PMDA_PMID(2,2), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm79 fan_div */
+ { NULL,
+ { PMDA_PMID(2,3), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm79 temp */
+ { NULL,
+ { PMDA_PMID(2,4), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm79 alarms */
+ { NULL,
+ { PMDA_PMID(2,5), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm79 VCore1 */
+ { NULL,
+ { PMDA_PMID(2,6), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm79 VCore2 */
+ { NULL,
+ { PMDA_PMID(2,7), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm79 p33V */
+ { NULL,
+ { PMDA_PMID(2,8), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm79 p5V */
+ { NULL,
+ { PMDA_PMID(2,9), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm79 p12V */
+ { NULL,
+ { PMDA_PMID(2,10), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm79 n12V */
+ { NULL,
+ { PMDA_PMID(2,11), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm79 n5V */
+ { NULL,
+ { PMDA_PMID(2,12), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm79 vid */
+ { NULL,
+ { PMDA_PMID(2,13), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm87 fan1 */
+ { NULL,
+ { PMDA_PMID(3,0), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm87 fan2 */
+ { NULL,
+ { PMDA_PMID(3,1), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm87 temp1 */
+ { NULL,
+ { PMDA_PMID(3,2), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm87 CPUtemp */
+ { NULL,
+ { PMDA_PMID(3,3), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm87 Vccp1 */
+ { NULL,
+ { PMDA_PMID(3,4), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm87 Vccp2 */
+ { NULL,
+ { PMDA_PMID(3,5), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm87 p25V */
+ { NULL,
+ { PMDA_PMID(3,6), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm87 p33V */
+ { NULL,
+ { PMDA_PMID(3,7), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm87 p5V */
+ { NULL,
+ { PMDA_PMID(3,8), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm87 p12V */
+ { NULL,
+ { PMDA_PMID(3,9), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* lm87 vid */
+ { NULL,
+ { PMDA_PMID(3,10), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d fan1 */
+ { NULL,
+ { PMDA_PMID(4,0), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d fan2 */
+ { NULL,
+ { PMDA_PMID(4,1), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d fan3 */
+ { NULL,
+ { PMDA_PMID(4,2), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d fan_div */
+ { NULL,
+ { PMDA_PMID(4,3), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d temp1 */
+ { NULL,
+ { PMDA_PMID(4,4), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d temp2 */
+ { NULL,
+ { PMDA_PMID(4,5), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d temp3 */
+ { NULL,
+ { PMDA_PMID(4,6), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d alarms */
+ { NULL,
+ { PMDA_PMID(4,7), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d beep */
+ { NULL,
+ { PMDA_PMID(4,8), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d VCore1 */
+ { NULL,
+ { PMDA_PMID(4,9), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d VCore2 */
+ { NULL,
+ { PMDA_PMID(4,10), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d p33V */
+ { NULL,
+ { PMDA_PMID(4,11), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d p5V */
+ { NULL,
+ { PMDA_PMID(4,12), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d p12V */
+ { NULL,
+ { PMDA_PMID(4,13), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d n12V */
+ { NULL,
+ { PMDA_PMID(4,14), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d n5V */
+ { NULL,
+ { PMDA_PMID(4,15), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* w83781d vid */
+ { NULL,
+ { PMDA_PMID(4,16), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* mtp008 fan1 */
+ { NULL,
+ { PMDA_PMID(5,0), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* mtp008 fan2 */
+ { NULL,
+ { PMDA_PMID(5,1), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* mtp008 fan3 */
+ { NULL,
+ { PMDA_PMID(5,2), PM_TYPE_32, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* mtp008 temp1 */
+ { NULL,
+ { PMDA_PMID(5,3), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* mtp008 temp2 */
+ { NULL,
+ { PMDA_PMID(5,4), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* mtp008 VCore1 */
+ { NULL,
+ { PMDA_PMID(5,5), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* mtp008 VCore2 */
+ { NULL,
+ { PMDA_PMID(5,6), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* mtp008 p33V */
+ { NULL,
+ { PMDA_PMID(5,7), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* mtp008 p12V */
+ { NULL,
+ { PMDA_PMID(5,8), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* mtp008 n12V */
+ { NULL,
+ { PMDA_PMID(5,9), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* mtp008 vid */
+ { NULL,
+ { PMDA_PMID(5,10), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+/* mtp008 vtt */
+ { NULL,
+ { PMDA_PMID(5,11), PM_TYPE_FLOAT, PM_INDOM_NULL, PM_SEM_INSTANT,
+ PMDA_PMUNITS(0, 0, 0, 0, 0, 0) }, },
+};
+
+
+w83781d get_w83781d()
+{
+ float f;
+ w83781d sensor= {0,0,0,0,00.01,00.01,00.01,0,0,00.01,00.01,00.01,00.01,00.01,00.01,00.01,00.01};
+
+ if (schips.n_w83781d > 0) {
+
+/* fan1 */
+ get_file(schips.s_w83781d[0],"/fan1");
+ sensor.fan1 = get_int(buf,2);
+/* fan2 */
+ get_file(schips.s_w83781d[0],"/fan2");
+ sensor.fan2 = get_int(buf,2);
+/* fan3 */
+ get_file(schips.s_w83781d[0],"/fan3");
+ sensor.fan3 = get_int(buf,2);
+/* fan_div */
+ get_file(schips.s_w83781d[0],"/fan_div");
+ sensor.fan_div = get_int(buf,1);
+/* temp1 */
+ get_file(schips.s_w83781d[0],"/temp1");
+ sensor.temp1 = get_float(buf,3);
+/* temp2 */
+ get_file(schips.s_w83781d[0],"/temp2");
+ sensor.temp2 = get_float(buf,3);
+/* temp3 */
+ get_file(schips.s_w83781d[0],"/temp3");
+ sensor.temp3 = get_float(buf,3);
+/* alarms */
+ get_file(schips.s_w83781d[0],"/alarms");
+ sensor.alarms = get_int(buf,1);
+/* beep */
+ get_file(schips.s_w83781d[0],"/beep");
+ sensor.beep = get_int(buf,1);
+/* VCore1 */
+ get_file(schips.s_w83781d[0],"/in0");
+ sensor.VCore1 = get_float(buf,3);
+/* VCore2 */
+ get_file(schips.s_w83781d[0],"/in1");
+ sensor.VCore2 = get_float(buf,3);
+/* p33V */
+ get_file(schips.s_w83781d[0],"/in2");
+ sensor.p33V = get_float(buf,3);
+/* p5V */
+ get_file(schips.s_w83781d[0],"/in3");
+ f = get_float(buf,3);
+ sensor.p5V = f * ((6.80/10)+1);
+/* p12V */
+ get_file(schips.s_w83781d[0],"/in4");
+ f = get_float(buf,3);
+ sensor.p12V = f * ((28.00/10)+1);
+/* n12V */
+ get_file(schips.s_w83781d[0],"/in5");
+ f = get_float(buf,3);
+ sensor.n12V = -1 * f * (210/60.40);
+/* n5V */
+ get_file(schips.s_w83781d[0],"/in6");
+ f = get_float(buf,3);
+ sensor.n5V = -1 * f * (90.9/60.40);
+/* vid */
+ get_file(schips.s_w83781d[0],"/vid");
+ sensor.vid = get_float(buf,1);
+ }
+ return sensor;
+}
+
+mtp008 get_mtp008()
+{
+ float f;
+ mtp008 sensor= {0,0,0,00.01,00.01,00.01,00.01,00.01,00.01,00.01,00.01,00.01};
+
+ if (schips.n_mtp008 > 0) {
+
+/* fan1 */
+ get_file(schips.s_mtp008[0],"/fan1");
+ sensor.fan1 = get_int(buf,2);
+/* fan2 */
+ get_file(schips.s_mtp008[0],"/fan2");
+ sensor.fan2 = get_int(buf,2);
+/* fan3 */
+ get_file(schips.s_mtp008[0],"/fan3");
+ sensor.fan3 = get_int(buf,2);
+/* temp1 */
+ get_file(schips.s_mtp008[0],"/temp1");
+ sensor.temp1 = get_float(buf,3);
+/* temp2 */
+ get_file(schips.s_mtp008[0],"/temp2");
+ sensor.temp2 = get_float(buf,3);
+/* VCore1 */
+ get_file(schips.s_mtp008[0],"/in0");
+ sensor.VCore1 = get_float(buf,3);
+/* VCore2 */
+ get_file(schips.s_mtp008[0],"/in3");
+ sensor.VCore2 = get_float(buf,3);
+/* p33V */
+ get_file(schips.s_mtp008[0],"/in1");
+ sensor.p33V = get_float(buf,3);
+/* p12V */
+ get_file(schips.s_mtp008[0],"/in2");
+ f = get_float(buf,3);
+ sensor.p12V = f * ((38.00/10)+1);
+/* n12V */
+ get_file(schips.s_mtp008[0],"/in5");
+ f = get_float(buf,3);
+ sensor.n12V = ( f * 36 - 118.61 ) / 7;
+/* vid */
+ get_file(schips.s_mtp008[0],"/vid");
+ sensor.vid = get_float(buf,1);
+/* vtt */
+ get_file(schips.s_mtp008[0],"/in6");
+ sensor.vid = get_float(buf,3);
+ }
+ return sensor;
+}
+
+lm79 get_lm79()
+{
+ float f;
+ lm79 sensor= {0,0,0,00.01,0,00.01,00.01,00.01,00.01,00.01,00.01,00.01,00.01,00.01};
+
+ if (schips.n_lm79 > 0) {
+/* fan1 */
+ get_file(schips.s_lm79[0],"/fan1");
+ sensor.fan1 = get_int(buf,2);
+/* fan2 */
+ get_file(schips.s_lm79[0],"/fan2");
+ sensor.fan2 = get_int(buf,2);
+/* fan3 */
+ get_file(schips.s_lm79[0],"/fan3");
+ sensor.fan3 = get_int(buf,2);
+/* fan_div */
+ get_file(schips.s_lm79[0],"/fan_div");
+ sensor.fan_div = get_int(buf,1);
+/* temp */
+ get_file(schips.s_lm79[0],"/temp");
+ sensor.temp = get_float(buf,3);
+/* alarms */
+ get_file(schips.s_lm79[0],"/alarms");
+ sensor.alarms = get_int(buf,1);
+/* VCore1 */
+ get_file(schips.s_lm79[0],"/in0");
+ sensor.VCore1 = get_float(buf,3);
+/* VCore2 */
+ get_file(schips.s_lm79[0],"/in1");
+ sensor.VCore2 = get_float(buf,3);
+/* p33V */
+ get_file(schips.s_lm79[0],"/in2");
+ sensor.p33V = get_float(buf,3);
+/* p5V */
+ get_file(schips.s_lm79[0],"/in3");
+ f = get_float(buf,3);
+ sensor.p5V = f * ((6.80/10)+1);
+/* p12V */
+ get_file(schips.s_lm79[0],"/in4");
+ f = get_float(buf,3);
+ sensor.p12V = f * ((28.00/10)+1);
+/* n12V */
+ get_file(schips.s_lm79[0],"/in5");
+ f = get_float(buf,3);
+ sensor.n12V = -1 * f * (210/60.40);
+/* n5V */
+ get_file(schips.s_lm79[0],"/in6");
+ f = get_float(buf,3);
+ sensor.n5V = -1 * f * (90.9/60.40);
+/* vid */
+ get_file(schips.s_lm79[0],"/vid");
+ sensor.vid = get_float(buf,1);
+ }
+
+ return sensor;
+}
+
+lm87 get_lm87()
+{
+ lm87 sensor= {0,0,00.01,00.01,00.01,00.01,00.01,00.01,00.01,00.01,00.01};
+
+ if (schips.n_lm87 > 0) {
+/* fan1 */
+ get_file(schips.s_lm87[0],"/fan");
+ sensor.fan1 = get_int(buf,2);
+/* fan2 */
+ get_file(schips.s_lm87[0],"/fan2");
+ sensor.fan2 = get_int(buf,2);
+/* temp1 */
+ get_file(schips.s_lm87[0],"/temp1");
+ sensor.temp1 = get_float(buf,3);
+/* CPUtemp */
+ get_file(schips.s_lm87[0],"/temp2");
+ sensor.CPUtemp = get_float(buf,3);
+/* Vccp1 */
+ get_file(schips.s_lm87[0],"/in1");
+ sensor.Vccp1 = get_float(buf,3);
+/* Vccp2 */
+ get_file(schips.s_lm87[0],"/in5");
+ sensor.Vccp2 = get_float(buf,3);
+/* p25V */
+ get_file(schips.s_lm87[0],"/in0");
+ sensor.p25V = get_float(buf,3);
+/* p33V */
+ get_file(schips.s_lm87[0],"/in2");
+ sensor.p33V = get_float(buf,3);
+/* p5V */
+ get_file(schips.s_lm87[0],"/in3");
+ sensor.p5V = get_float(buf,3);
+/* p12V */
+ get_file(schips.s_lm87[0],"/in4");
+ sensor.p12V = get_float(buf,3);
+/* vid */
+ get_file(schips.s_lm87[0],"/vid");
+ sensor.vid = get_float(buf,1);
+ }
+
+ return sensor;
+}
+
+lm75 get_lm75()
+{
+ lm75 sensor= {00.01};
+
+ if (schips.n_lm75 > 0) {
+ get_file(schips.s_lm75[0],"/temp");
+ sensor.temp = get_float(buf,3);
+ }
+ return sensor;
+}
+
+void
+get_chips()
+{
+ int i;
+ int n;
+ int nbufindex;
+ char *bufindex[64];
+ char *temp;
+
+ n = get_file("chips", "");
+
+ buf[sizeof(buf)-1] = '\0';
+
+ nbufindex = 0;
+ bufindex[nbufindex++] = &buf[0];
+ for (i=0; i < n; i++) {
+ if (buf[i] == '\n') {
+ buf[i] = '\0';
+ bufindex[nbufindex++] = buf + i + 1;
+ }
+ }
+
+ for ( i=0; i < nbufindex ; i++ ) {
+ temp="";
+ if (strncmp("lm75", bufindex[i]+4, 4) == 0 ) {
+ temp = strtok(bufindex[i]+4," ");
+ strcat(schips.s_lm75[schips.n_lm75], temp);
+ schips.total++;
+ schips.n_lm75++;
+ }
+ else if (strncmp("lm79", bufindex[i]+4, 4) == 0 ) {
+ temp = strtok(bufindex[i]+4," ");
+ strcat(schips.s_lm79[schips.n_lm79], temp);
+ schips.total++;
+ schips.n_lm79++;
+ }
+ else if (strncmp("lm87", bufindex[i]+4, 4) == 0 ) {
+ temp = strtok(bufindex[i]+4," ");
+ strcat(schips.s_lm87[schips.n_lm87], temp);
+ schips.total++;
+ schips.n_lm87++;
+ }
+ else if (strncmp("w83781d", bufindex[i]+4, 7) == 0 ) {
+ temp = strtok(bufindex[i]+4," ");
+ strcat(schips.s_w83781d[schips.n_w83781d], temp);
+ schips.total++;
+ schips.n_w83781d++;
+ }
+ else if (strncmp("mtp008", bufindex[i]+4, 6) == 0 ) {
+ temp = strtok(bufindex[i]+4," ");
+ strcat(schips.s_mtp008[schips.n_mtp008], temp);
+ schips.total++;
+ schips.n_mtp008++;
+ }
+ }
+}
+
+
+/*
+ * Get the contents of a file and return them
+ */
+int get_file(char *middle, char *end){
+
+ int fd;
+ int n;
+ char s[1024]="/proc/sys/dev/sensors/";
+
+/*
+ * create the new string, the end result being the actual file name
+ */
+ strcat(s,middle);
+ strcat(s,end);
+
+/*
+ * read in the file into the buffer buf
+ */
+ if ((fd = open(s, O_RDONLY)) < 0) {
+ return -1;
+ }
+ n = read(fd, buf, sizeof(buf));
+ close(fd);
+ return n;
+}
+
+/*
+ * Pull a certain float value out of a string of floats
+ */
+float get_float(char *s, int i){
+ char *temp;
+ float f;
+ int j;
+
+ temp = strtok(s," ");
+
+ for (j=1;j<i;j++)
+ temp = strtok(NULL," ");
+
+ f = atof(temp);
+ return f;
+}
+
+/*
+ * Pull a certain int value out of a string of int's
+ */
+int get_int(char *s, int i){
+ char *temp;
+ int f;
+ int j;
+
+ temp = strtok(s," ");
+
+ for (j=1;j<i;j++)
+ temp = strtok(NULL," ");
+
+ f = atoi(temp);
+ return f;
+}
+
+/*
+ * callback provided to pmdaFetch
+ */
+static int
+lmsensors_fetchCallBack(pmdaMetric *mdesc, unsigned int inst, pmAtomValue *atom)
+{
+ mtp008 sensormtp008;
+ w83781d sensorw83781d;
+ lm87 sensor87;
+ lm79 sensor79;
+ lm75 sensor75;
+ __pmID_int *idp = (__pmID_int *)&(mdesc->m_desc.pmid);
+
+ if (idp->cluster > 5)
+ return PM_ERR_PMID;
+ else if (inst != PM_IN_NULL)
+ return PM_ERR_INST;
+
+ if (idp->cluster == 0) { /*lmsensors*/
+ switch (idp->item) {
+ case 0:
+ atom->l = schips.total;
+ break ;
+ case 1:
+ atom->l = schips.n_lm75;
+ break ;
+ case 2:
+ atom->l = schips.n_lm79;
+ break ;
+ case 3:
+ atom->l = schips.n_lm87;
+ break ;
+ case 4:
+ atom->l = schips.n_w83781d;
+ break ;
+ case 5:
+ atom->l = schips.n_mtp008;
+ break ;
+ default:
+ return PM_ERR_PMID;
+ }
+ }
+ if (idp->cluster == 1) { /*lmsensors.lm75*/
+ if (schips.n_lm75 > 0) {
+ sensor75=get_lm75();
+ switch (idp->item) {
+ case 0:
+ atom->f = sensor75.temp;
+ break ;
+ default:
+ return PM_ERR_PMID;
+ }
+ } else atom->f=9999;
+ }
+ if (idp->cluster == 2) { /*lmsensors.lm79*/
+ if (schips.n_lm79 > 0) {
+ sensor79=get_lm79();
+ switch (idp->item) {
+ case 0:
+ atom->l = sensor79.fan1;
+ break ;
+ case 1:
+ atom->l = sensor79.fan2;
+ break ;
+ case 2:
+ atom->l = sensor79.fan3;
+ break ;
+ case 3:
+ atom->l = sensor79.fan_div;
+ break ;
+ case 4:
+ atom->f = sensor79.temp;
+ break ;
+ case 5:
+ atom->l = sensor79.alarms;
+ break ;
+ case 6:
+ atom->f = sensor79.VCore1;
+ break ;
+ case 7:
+ atom->f = sensor79.VCore2;
+ break ;
+ case 8:
+ atom->f = sensor79.p33V;
+ break ;
+ case 9:
+ atom->f = sensor79.p5V;
+ break ;
+ case 10:
+ atom->f = sensor79.p12V;
+ break ;
+ case 11:
+ atom->f = sensor79.n12V;
+ break ;
+ case 12:
+ atom->f = sensor79.n5V;
+ break ;
+ case 13:
+ atom->f = sensor79.vid;
+ break ;
+ default:
+ return PM_ERR_PMID;
+ }
+ } else atom->f=9999;
+ }
+ if (idp->cluster == 3) { /*lmsensors.lm87*/
+ if (schips.n_lm87 > 0) {
+ sensor87=get_lm87();
+ switch (idp->item) {
+ case 0:
+ atom->l = sensor87.fan1;
+ break ;
+ case 1:
+ atom->l = sensor87.fan2;
+ break ;
+ case 2:
+ atom->f = sensor87.temp1;
+ break ;
+ case 3:
+ atom->f = sensor87.CPUtemp;
+ break ;
+ case 4:
+ atom->f = sensor87.Vccp1;
+ break ;
+ case 5:
+ atom->f = sensor87.Vccp2;
+ break ;
+ case 6:
+ atom->f = sensor87.p25V;
+ break ;
+ case 7:
+ atom->f = sensor87.p33V;
+ break ;
+ case 8:
+ atom->f = sensor87.p5V;
+ break ;
+ case 9:
+ atom->f = sensor87.p12V;
+ break ;
+ case 10:
+ atom->f = sensor87.vid;
+ break ;
+ default:
+ return PM_ERR_PMID;
+ }
+ } else atom->f=9999;
+ }
+ if (idp->cluster == 4) { /*lmsensors.w83781d*/
+ if (schips.n_w83781d > 0) {
+ sensorw83781d=get_w83781d();
+ switch (idp->item) {
+ case 0:
+ atom->l = sensorw83781d.fan1;
+ break ;
+ case 1:
+ atom->l = sensorw83781d.fan2;
+ break ;
+ case 2:
+ atom->l = sensorw83781d.fan3;
+ break ;
+ case 3:
+ atom->l = sensorw83781d.fan_div;
+ break ;
+ case 4:
+ atom->f = sensorw83781d.temp1;
+ break ;
+ case 5:
+ atom->f = sensorw83781d.temp2;
+ break ;
+ case 6:
+ atom->f = sensorw83781d.temp3;
+ break ;
+ case 7:
+ atom->l = sensorw83781d.alarms;
+ break ;
+ case 8:
+ atom->l = sensorw83781d.beep;
+ break ;
+ case 9:
+ atom->f = sensorw83781d.VCore1;
+ break ;
+ case 10:
+ atom->f = sensorw83781d.VCore2;
+ break ;
+ case 11:
+ atom->f = sensorw83781d.p33V;
+ break ;
+ case 12:
+ atom->f = sensorw83781d.p5V;
+ break ;
+ case 13:
+ atom->f = sensorw83781d.p12V;
+ break ;
+ case 14:
+ atom->f = sensorw83781d.n12V;
+ break ;
+ case 15:
+ atom->f = sensorw83781d.n5V;
+ break ;
+ case 16:
+ atom->f = sensorw83781d.vid;
+ break ;
+ default:
+ return PM_ERR_PMID;
+ }
+ } else atom->f=9999;
+ }
+ if (idp->cluster == 5) { /*lmsensors.mtp008*/
+ if (schips.n_mtp008 > 0) {
+ sensormtp008=get_mtp008();
+ switch (idp->item) {
+ case 0:
+ atom->l = sensormtp008.fan1;
+ break ;
+ case 1:
+ atom->l = sensormtp008.fan2;
+ break ;
+ case 2:
+ atom->l = sensormtp008.fan3;
+ break ;
+ case 3:
+ atom->f = sensormtp008.temp1;
+ break ;
+ case 4:
+ atom->f = sensormtp008.temp2;
+ break ;
+ case 5:
+ atom->f = sensormtp008.VCore1;
+ break ;
+ case 6:
+ atom->f = sensormtp008.VCore2;
+ break ;
+ case 7:
+ atom->f = sensormtp008.p33V;
+ break ;
+ case 8:
+ atom->f = sensormtp008.p12V;
+ break ;
+ case 9:
+ atom->f = sensormtp008.n12V;
+ break ;
+ case 10:
+ atom->f = sensormtp008.vid;
+ break ;
+ case 11:
+ atom->f = sensormtp008.vtt;
+ break ;
+ default:
+ return PM_ERR_PMID;
+ }
+ } else atom->f=9999;
+ }
+
+ return 0;
+}
+
+/*
+ * Initialise the agent (both daemon and DSO).
+ */
+void
+lmsensors_init(pmdaInterface *dp)
+{
+ get_chips();
+
+ __pmSetProcessIdentity(username);
+ pmdaSetFetchCallBack(dp, lmsensors_fetchCallBack);
+ pmdaInit(dp, NULL, 0,
+ metrictab, sizeof(metrictab)/sizeof(metrictab[0]));
+}
+
+pmLongOptions longopts[] = {
+ PMDA_OPTIONS_HEADER("Options"),
+ PMOPT_DEBUG,
+ PMDAOPT_DOMAIN,
+ PMDAOPT_LOGFILE,
+ PMDAOPT_USERNAME,
+ PMOPT_HELP,
+ PMDA_OPTIONS_END
+};
+
+pmdaOptions opts = {
+ .short_options = "D:d:l:U:?",
+ .long_options = longopts,
+};
+
+/*
+ * Set up the agent if running as a daemon.
+ */
+int
+main(int argc, char **argv)
+{
+ int sep = __pmPathSeparator();
+ pmdaInterface desc;
+ char mypath[MAXPATHLEN];
+
+ __pmSetProgname(argv[0]);
+ __pmGetUsername(&username);
+
+ snprintf(mypath, sizeof(mypath), "%s%c" "lmsensors" "%c" "help",
+ pmGetConfig("PCP_PMDAS_DIR"), sep, sep);
+ pmdaDaemon(&desc, PMDA_INTERFACE_2, pmProgname, LMSENSORS,
+ "lmsensors.log", mypath);
+
+ pmdaGetOptions(argc, argv, &opts, &desc);
+ if (opts.errors) {
+ pmdaUsageMessage(&opts);
+ exit(1);
+ }
+ if (opts.username)
+ username = opts.username;
+
+ pmdaOpenLog(&desc);
+ lmsensors_init(&desc);
+ pmdaConnect(&desc);
+ pmdaMain(&desc);
+ exit(0);
+}
diff --git a/src/pmdas/lmsensors/lmsensors.h b/src/pmdas/lmsensors/lmsensors.h
new file mode 100644
index 0000000..14cbb9b
--- /dev/null
+++ b/src/pmdas/lmsensors/lmsensors.h
@@ -0,0 +1,113 @@
+/*
+ * Original implementation by Troy Dawson (dawson@fnal.gov)
+ *
+ * Copyright (c) 2001,2004 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+typedef struct {
+ int total;
+ int n_lm75;
+ int n_lm79;
+ int n_lm87;
+ int n_w83781d;
+ int n_mtp008;
+ char s_lm75[2][1024] ;
+ char s_lm79[2][1024] ;
+ char s_lm87[2][1024] ;
+ char s_w83781d[2][1024] ;
+ char s_mtp008[2][1024] ;
+} chips;
+
+typedef struct {
+ float temp;
+} lm75;
+
+typedef struct {
+ int fan1;
+ int fan2;
+ int fan3;
+ int fan_div;
+ float temp;
+ int alarms;
+ float VCore1;
+ float VCore2;
+ float p33V;
+ float p5V;
+ float p12V;
+ float n12V;
+ float n5V;
+ float vid;
+} lm79;
+
+typedef struct {
+ int fan1;
+ int fan2;
+ float temp1;
+ float CPUtemp;
+ float Vccp1;
+ float Vccp2;
+ float p25V;
+ float p33V;
+ float p5V;
+ float p12V;
+ float vid;
+} lm87;
+
+typedef struct {
+ int fan1;
+ int fan2;
+ int fan3;
+ int fan_div;
+ float temp1;
+ float temp2;
+ float temp3;
+ int alarms;
+ int beep;
+ float VCore1;
+ float VCore2;
+ float p33V;
+ float p5V;
+ float p12V;
+ float n12V;
+ float n5V;
+ float vid;
+} w83781d;
+
+typedef struct {
+ int fan1;
+ int fan2;
+ int fan3;
+ float temp1;
+ float temp2;
+ float VCore1;
+ float VCore2;
+ float p33V;
+ float p12V;
+ float n12V;
+ float vid;
+ float vtt;
+} mtp008;
+
+extern void get_chips();
+extern lm75 get_lm75();
+extern lm79 get_lm79();
+extern lm87 get_lm87();
+extern w83781d get_w83781d();
+extern mtp008 get_mtp008();
+extern int get_file(char *, char *);
+extern int get_int(char * , int);
+extern float get_float(char * , int);
diff --git a/src/pmdas/lmsensors/pmns b/src/pmdas/lmsensors/pmns
new file mode 100644
index 0000000..2a41f07
--- /dev/null
+++ b/src/pmdas/lmsensors/pmns
@@ -0,0 +1,106 @@
+/*
+ * Metrics for lmsensors PMDA
+ *
+ * Original implementation by Troy Dawson (dawson@fnal.gov)
+ *
+ * Copyright (c) 2001 Silicon Graphics, Inc. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+lmsensors {
+ n_total LMSENSORS:0:0
+ n_lm75 LMSENSORS:0:1
+ n_lm79 LMSENSORS:0:2
+ n_lm87 LMSENSORS:0:3
+ n_w83781d LMSENSORS:0:4
+ n_mtp008 LMSENSORS:0:5
+ lm75
+ lm79
+ lm87
+ w83781d
+ mtp008
+}
+
+lmsensors.lm75 {
+ temp LMSENSORS:1:0
+}
+
+lmsensors.lm79 {
+ fan1 LMSENSORS:2:0
+ fan2 LMSENSORS:2:1
+ fan3 LMSENSORS:2:2
+ fan_div LMSENSORS:2:3
+ temp LMSENSORS:2:4
+ alarms LMSENSORS:2:5
+ VCore1 LMSENSORS:2:6
+ VCore2 LMSENSORS:2:7
+ p33V LMSENSORS:2:8
+ p5V LMSENSORS:2:9
+ p12V LMSENSORS:2:10
+ n12V LMSENSORS:2:11
+ n5V LMSENSORS:2:12
+ vid LMSENSORS:2:13
+}
+
+lmsensors.lm87 {
+ fan1 LMSENSORS:3:0
+ fan2 LMSENSORS:3:1
+ temp1 LMSENSORS:3:2
+ CPUtemp LMSENSORS:3:3
+ Vccp1 LMSENSORS:3:4
+ Vccp2 LMSENSORS:3:5
+ p25V LMSENSORS:3:6
+ p33V LMSENSORS:3:7
+ p5V LMSENSORS:3:8
+ p12V LMSENSORS:3:9
+ vid LMSENSORS:3:10
+}
+
+lmsensors.w83781d {
+ fan1 LMSENSORS:4:0
+ fan2 LMSENSORS:4:1
+ fan3 LMSENSORS:4:2
+ fan_div LMSENSORS:4:3
+ temp1 LMSENSORS:4:4
+ temp2 LMSENSORS:4:5
+ temp3 LMSENSORS:4:6
+ alarms LMSENSORS:4:7
+ beep LMSENSORS:4:8
+ VCore1 LMSENSORS:4:9
+ VCore2 LMSENSORS:4:10
+ p33V LMSENSORS:4:11
+ p5V LMSENSORS:4:12
+ p12V LMSENSORS:4:13
+ n12V LMSENSORS:4:14
+ n5V LMSENSORS:4:15
+ vid LMSENSORS:4:16
+}
+
+lmsensors.mtp008 {
+ fan1 LMSENSORS:5:0
+ fan2 LMSENSORS:5:1
+ fan3 LMSENSORS:5:2
+ temp1 LMSENSORS:5:3
+ temp2 LMSENSORS:5:4
+ VCore1 LMSENSORS:5:5
+ VCore2 LMSENSORS:5:6
+ p33V LMSENSORS:5:7
+ p12V LMSENSORS:5:8
+ n12V LMSENSORS:5:9
+ vid LMSENSORS:5:10
+ vtt LMSENSORS:5:11
+}
+
diff --git a/src/pmdas/lmsensors/root b/src/pmdas/lmsensors/root
new file mode 100644
index 0000000..b17d559
--- /dev/null
+++ b/src/pmdas/lmsensors/root
@@ -0,0 +1,12 @@
+/*
+ * fake "root" for validating the local PMNS subtree
+ *
+ * Original implementation by Troy Dawson (dawson@fnal.gov)
+ */
+
+#include <stdpmid>
+
+root { lmsensors }
+
+#include "pmns"
+