From e6b32529bdceb2602c0eeced69c826d9a5f5ab54 Mon Sep 17 00:00:00 2001 From: jsatoh Date: Wed, 6 Oct 2010 01:49:48 +0000 Subject: [PATCH] 2010-10-06 Junichi Satoh * unix/pandora_agent: Added FreeBSD specific commands. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3346 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_agents/ChangeLog | 4 ++++ pandora_agents/unix/ChangeLog | 4 ++++ pandora_agents/unix/pandora_agent | 15 ++++++++++----- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/pandora_agents/ChangeLog b/pandora_agents/ChangeLog index 4e00e793ce..7020116d54 100644 --- a/pandora_agents/ChangeLog +++ b/pandora_agents/ChangeLog @@ -1,3 +1,7 @@ +2010-10-06 Junichi Satoh + + * unix/pandora_agent: Added FreeBSD specific commands. + 2010-09-27 Junichi Satoh * unix/FreeBSD/pandora_agent: Fixed a typo. diff --git a/pandora_agents/unix/ChangeLog b/pandora_agents/unix/ChangeLog index d23c03eb21..b47a076a80 100644 --- a/pandora_agents/unix/ChangeLog +++ b/pandora_agents/unix/ChangeLog @@ -1,3 +1,7 @@ +2010-10-06 Junichi Satoh + + * pandora_agent: Added FreeBSD specific commands. + 2010-10-04 Ramon Novoa * plugins/inventory: Fixed inventory process information. diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index ec3ad00229..80ce69ec5a 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -61,21 +61,24 @@ use constant AGENT_BUILD => '100608'; use constant TOTALMEMORY_CMDS => { linux => 'cat /proc/meminfo | grep MemTotal: | awk \'{ print $2 }\'', solaris => 'MEM=`prtconf | grep Memory | awk \'{print $3}\'` bash -c \'echo $(( 1024 * $MEM ))\'', - hpux => 'swapinfo -t | grep memory | awk \'{print $2}\'' + hpux => 'swapinfo -t | grep memory | awk \'{print $2}\'', + freebsd => 'sysctl hw.physmem | awk \'{print $2 / 1024}\'' }; # Commands to retrieve free memory information in kB use constant FREEMEMORY_CMDS => { linux => 'cat /proc/meminfo | grep MemFree: | awk \'{ print $2 }\'', solaris => 'vmstat 1 2 | tail -1 | awk \'{ print $5 }\'', - hpux => 'swapinfo -t | grep memory | awk \'{print $4}\'' + hpux => 'swapinfo -t | grep memory | awk \'{print $4}\'', + freebsd => 'vmstat -H 1 2 | tail -1 | awk \'{ print $5 }\'' }; # Commands to retrieve cpu information use constant CPUUSAGE_CMDS => { linux => 'vmstat 1 2 | tail -1 | awk \'{ print $13 }\'', solaris => 'vmstat 1 2 | tail -1 | awk \'{ print $21 }\'', - hpux => 'vmstat 1 2 | tail -1 | awk \'{ print $16 }\'' + hpux => 'vmstat 1 2 | tail -1 | awk \'{ print $16 }\'', + freebsd => 'vmstat -n 0 1 2 | tail -1 | awk \'{ print $15 }\'' }; # Commands to retrieve process information @@ -84,7 +87,8 @@ use constant PROC_CMDS => { linux => 'ps aux | awk \'NR > 1 {ps = ""; for (i = 11; i <= NF; ++i) {ps = (ps " " $i) }; print $3, $6, ps}\'', solaris => 'prstat 1 1 | awk \'NR > 1 {split ($10, ps, "/"); cpu = substr ($9, 1, length ($9) - 1); mem = substr ($3, 1, length ($3) - 1); print cpu, mem, ps[1]}\'', hpux => 'ps -elf | awk \'NR > 1 {ps = ""; for (i = 15; i <= NF; ++i) {ps = (ps " " $i) }; print 0, $10, ps}\'', - aix => 'ps aux | awk \'NR > 1 {print $3, $6, $11}\'' + aix => 'ps aux | awk \'NR > 1 {print $3, $6, $11}\'', + freebsd => 'ps -axw -o %cpu,%mem,command | awk \'NR > 1 {ps = ""; for (i = 3; i <= NF; ++i) {ps = (ps " " $i) }; print $1, $2, ps}\'' }; # Commands to retrieve partition information in kB @@ -93,7 +97,8 @@ use constant PART_CMDS => { linux => 'df -P | awk \'NR > 1 {print $2, $4, $6}\'', solaris => 'df -k | awk \'NR > 1 {print $2, $4, $6}\'', hpux => 'df -P | awk \'NR > 1 {print $2, $4, $6}\'', - aix => 'df -kP | awk \'NR > 1 {print $2, $4, $6}\'' + aix => 'df -kP | awk \'NR > 1 {print $2, $4, $6}\'', + freebsd => 'df -k | awk \'NR > 1 {print $2, $4, $6}\'' }; # OS and OS version