2010-10-06 Junichi Satoh <junichi@rworks.jp>

* 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
This commit is contained in:
jsatoh 2010-10-06 01:49:48 +00:00
parent db9f5da826
commit e6b32529bd
3 changed files with 18 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2010-10-06 Junichi Satoh <junichi@rworks.jp>
* unix/pandora_agent: Added FreeBSD specific commands.
2010-09-27 Junichi Satoh <junichi@rworks.jp> 2010-09-27 Junichi Satoh <junichi@rworks.jp>
* unix/FreeBSD/pandora_agent: Fixed a typo. * unix/FreeBSD/pandora_agent: Fixed a typo.

View File

@ -1,3 +1,7 @@
2010-10-06 Junichi Satoh <junichi@rworks.jp>
* pandora_agent: Added FreeBSD specific commands.
2010-10-04 Ramon Novoa <rnovoa@artica.es> 2010-10-04 Ramon Novoa <rnovoa@artica.es>
* plugins/inventory: Fixed inventory process information. * plugins/inventory: Fixed inventory process information.

View File

@ -61,21 +61,24 @@ use constant AGENT_BUILD => '100608';
use constant TOTALMEMORY_CMDS => { use constant TOTALMEMORY_CMDS => {
linux => 'cat /proc/meminfo | grep MemTotal: | awk \'{ print $2 }\'', linux => 'cat /proc/meminfo | grep MemTotal: | awk \'{ print $2 }\'',
solaris => 'MEM=`prtconf | grep Memory | awk \'{print $3}\'` bash -c \'echo $(( 1024 * $MEM ))\'', 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 # Commands to retrieve free memory information in kB
use constant FREEMEMORY_CMDS => { use constant FREEMEMORY_CMDS => {
linux => 'cat /proc/meminfo | grep MemFree: | awk \'{ print $2 }\'', linux => 'cat /proc/meminfo | grep MemFree: | awk \'{ print $2 }\'',
solaris => 'vmstat 1 2 | tail -1 | awk \'{ print $5 }\'', 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 # Commands to retrieve cpu information
use constant CPUUSAGE_CMDS => { use constant CPUUSAGE_CMDS => {
linux => 'vmstat 1 2 | tail -1 | awk \'{ print $13 }\'', linux => 'vmstat 1 2 | tail -1 | awk \'{ print $13 }\'',
solaris => 'vmstat 1 2 | tail -1 | awk \'{ print $21 }\'', 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 # 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}\'', 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]}\'', 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}\'', 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 # 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}\'', linux => 'df -P | awk \'NR > 1 {print $2, $4, $6}\'',
solaris => 'df -k | 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}\'', 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 # OS and OS version