start to fill out some sysinfo related fields

This commit is contained in:
jasper 2015-06-17 12:10:42 +00:00
parent ea481b3b05
commit ca74a7df73
4 changed files with 70 additions and 3 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.1.1.1 2015/06/17 10:06:34 jasper Exp $
# $OpenBSD: Makefile,v 1.2 2015/06/17 12:10:42 jasper Exp $
COMMENT= PostgreSQL performances monitoring and auditing tool
DISTNAME= pgcluu-2.3
REVISION= 0
CATEGORIES= databases sysutils
HOMEPAGE= http://pgcluu.darold.net/

View File

@ -0,0 +1,38 @@
$OpenBSD: patch-pgcluu,v 1.1 2015/06/17 12:10:42 jasper Exp $
- Set $sysinfo{"KERNEL"} and $sysinfo{"CPU"} (minus cache) values
--- pgcluu.orig Wed Jun 17 13:18:10 2015
+++ pgcluu Wed Jun 17 13:49:47 2015
@@ -6854,13 +6854,13 @@ sub read_sysinfo
next;
}
if ($section eq 'CPU') {
- my ($key, $val) = split(/\s+:\s+/, $l);
- if ($key eq 'processor') {
- $sysinfo{$section}{$key} = $val + 1;
- } elsif ($key eq 'model name') {
- $val =~ s/\s+\@\s+(.*)$//;
- $sysinfo{$section}{'cpu MHz'} = $1;
- $sysinfo{$section}{$key} = $val;
+ my ($key, $val) = split(/=/, $l);
+ if ($key eq 'hw.ncpu') {
+ $sysinfo{$section}{'processor'} = $val;
+ } elsif ($key eq 'hw.model') {
+ $sysinfo{$section}{'model name'} = $val;
+ } elsif ($key eq 'hw.cpuspeed') {
+ $sysinfo{$section}{'cpu MHz'} = $val;
} else {
$sysinfo{$section}{$key} = $val;
}
@@ -6868,8 +6868,8 @@ sub read_sysinfo
if ($section eq 'KERNEL') {
my @kinf = split(/\s+/, $l);
$sysinfo{$section}{'hostname'} = $kinf[1];
- $sysinfo{$section}{'kernel'} = "$kinf[0] $kinf[2] $kinf[3] $kinf[4]";
- $sysinfo{$section}{'arch'} = "$kinf[-2] $kinf[-1]";
+ $sysinfo{$section}{'kernel'} = "$kinf[2] $kinf[3]";
+ $sysinfo{$section}{'arch'} = "$kinf[-1]";
}
if ($section eq 'RELEASE') {
my ($key, $val) = split(/=/, $l);

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-pgcluu_collectd,v 1.1 2015/06/17 12:10:42 jasper Exp $
- Set $sysinfo{"RELEASE"}, $sysinfo{"CPU"} (minus cache)
--- pgcluu_collectd.orig Wed Jun 17 13:18:13 2015
+++ pgcluu_collectd Wed Jun 17 13:49:47 2015
@@ -1102,9 +1102,9 @@ sub grab_os_information
{
# Look at CPU informations
- my $cmd = 'cat /proc/cpuinfo 2>/dev/null';
+ my $cmd = 'sysctl hw.ncpu hw.model hw.cpuspeed 2>/dev/null';
$cmd = $sshcmd . ' "' . $cmd . "\"" if ($sshcmd);
- my @cpuinfo = `$cmd | grep -E "model name|cpu MHz|cache size|cpu cores|processor"`;
+ my @cpuinfo = `$cmd`;
# Look at kernel informations
$cmd = 'uname -a 2>/dev/null';
$cmd = $sshcmd . ' "' . $cmd . "\"" if ($sshcmd);
@@ -1130,8 +1130,7 @@ sub grab_os_information
$cmd = $sshcmd . ' "' . $cmd . "\"" if ($sshcmd);
my @pciinfo = `$cmd`;
# Release informations
- $cmd = 'cat /etc/*release 2>/dev/null';
- $cmd = $sshcmd . ' "' . $cmd . "\"" if ($sshcmd);
+ $cmd = 'uname -srv 2>/dev/null';
my @releaseinfo = `$cmd`;
# System kernel tuning parameters
$cmd = '/sbin/sysctl -a 2>/dev/null';

View File

@ -1,9 +1,9 @@
#!/bin/sh
#
# $OpenBSD: pgcluu_collectd.rc,v 1.1.1.1 2015/06/17 10:06:34 jasper Exp $
# $OpenBSD: pgcluu_collectd.rc,v 1.2 2015/06/17 12:10:42 jasper Exp $
daemon="${TRUEPREFIX}/bin/pgcluu_collectd --daemon"
daemon_flags="-i 60 -h localhost -U postgres --disable-sar --no-sysinfo -f /var/run/pgcluu_collectd.pid /var/db/pgcluu"
daemon_flags="-i 60 -h localhost -U postgres --disable-sar -f /var/run/pgcluu_collectd.pid /var/db/pgcluu"
. /etc/rc.d/rc.subr