Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


[HOWTO] aix 5.3 quickie howto

 
Post new topic   Reply to topic    Cacti Forum Index -> Informational/HOWTO's
Author Message
shanekennedy



Joined: 10 Oct 2006
Posts: 16

PostPosted: Thu Dec 13, 2007 3:30 pm    Post subject: [HOWTO] aix 5.3 quickie howto Reply with quote

just set up aix host as cacti device & thought i'd share info. my cacti server is on linux

compiled perl 5.8.8 w/ ibm C compiler
used compiled perl to compile net-snmp 5.4.1 using sed & grep rpms from
http://www-03.ibm.com/systems/p/os/aix/linux/toolbox/download.html
set up perl w/ "configure --enable-as-needed --without-kmem-usage"

started snmp w/ "/usr/local/sbin/snmpd -A -r"




created /sbin/snmp-cacti script containing:

#!/bin/ksh

if (( `ps -ef | grep snmp-cacti | wc -l` > 20 )) then
exit 1
fi

case $1 in
"cpuStats")
sar -u 2 | tail -1 | awk '{printf("user:%.0f system:%.0f iowait:%.0f total:%.0f", $2, $3, $4, 100-$5)}'
;;
"loadStats")
uptime | tr -d ',' | awk '{print "load_1min:"$11" load_5min:"$12" load_15min:"$13}'
;;
"countProcesses")
ps -ef | wc -l | awk '{print "countProcesses:"$1}'
;;
"countTcpConnections")
netstat -n | grep tcp | grep -v LISTEN | wc -l | awk '{print "countTcpConnections:"$1}'
;;
"countThreads")
ps -em | wc -l | awk '{print "countThreads:"$1}'
;;
"countUsers")
who | wc -l | awk '{print "countUsers:"$1}'
;;
"nfsClientStats")
/usr/sbin/nfsstat -cn | tail -10 | grep -v '[a-z]' | awk 'BEGIN{ RS = "" }{print "getattr:"$3" setattr:"$5" lookup:"$7" access:"$9" readlink:"$11" read:"$13" write:"$15" create:"$17" mkdir:"$19" rename:"$29" fsstat:"$37}'
;;
"memStats")
#svmon -G | tr '\n' ' ' | awk '{print "memtot:"$7*4/1024" memfree:"$9*4/1024 }'
svmon -G | tr '\n' ' ' | awk '{print "memused:"100-$9/$7*100 }'
;;
"swapStats")
#swap -l | grep MB | tr -d MB | awk '{print "swaptot:"$4" swapfree:"$5}'
swap -l | grep MB | tr -d MB | awk '{print "swapused:"100-$5/$4*100}'
;;
"4kbPages")
svmon -G | tr '\n' ' ' | awk '{print "4kbpages:"$38}'
;;
"64kbPages")
svmon -G | tr '\n' ' ' | awk '{print "64kbpages:"$46}'
;;
"16mbPages")
pages=`svmon -G | tr '\n' ' ' | awk '{print $54}'`
if [[ $pages == "" ]] then
print "16mbpages:0"
else
print "16mbpages:${pages}"
fi
;;
esac
exit 0







created /usr/local/share/snmp/snmpd.conf containing:

com2sec local localhost public
com2sec mynetwork 192.168.0.0/24 public
group MyRWGroup v1 local
group MyROGroup v1 mynetwork
group MyRWGroup v2c local
group MyROGroup v2c mynetwork
view all included .1 80
access MyROGroup "" v1 noauth exact all none none
access MyRWGroup "" v1 noauth exact all all none
access MyROGroup "" v2c noauth exact all none none
access MyRWGroup "" v2c noauth exact all all none
# Add custom oid's for cacti.
extend .1.3.6.1.4.1.2021.59 countUsers /sbin/snmp-cacti countUsers
extend .1.3.6.1.4.1.2021.60 countProcesses /sbin/snmp-cacti countProcesses
extend .1.3.6.1.4.1.2021.61 countTcpConnections /sbin/snmp-cacti countTcpConnections
extend .1.3.6.1.4.1.2021.62 memStats /sbin/snmp-cacti memStats
extend .1.3.6.1.4.1.2021.63 swapStats /sbin/snmp-cacti swapStats
extend .1.3.6.1.4.1.2021.64 4kbPagess /sbin/snmp-cacti 4kbPages
extend .1.3.6.1.4.1.2021.65 64kbPagess /sbin/snmp-cacti 64kbPages
extend .1.3.6.1.4.1.2021.66 16mbPagess /sbin/snmp-cacti 16mbPages
extend .1.3.6.1.4.1.2021.82 cpuStats /sbin/snmp-cacti cpuStats
extend .1.3.6.1.4.1.2021.83 nfsClientStats /sbin/snmp-cacti nfsClientStats
extend .1.3.6.1.4.1.2021.86 countThreads /sbin/snmp-cacti countThreads
extend .1.3.6.1.4.1.2021.88 loadStats /sbin/snmp-cacti loadStats

Back to top
madunix



Joined: 10 Apr 2005
Posts: 9

PostPosted: Thu Feb 28, 2008 7:12 am    Post subject: Reply with quote

any feedback about this script before i use it ...
Back to top
rony
Developer/Forum Admin


Joined: 17 Nov 2003
Posts: 5365
Location: Wisconsin, USA

PostPosted: Thu Feb 28, 2008 9:40 am    Post subject: Reply with quote

I like what I see!

The only thing is, for example, where I work, we will not install net-snmp. So, I wonder if the AIX SNMP implementation supports external scripts? I think I will have more luck playing the lottery...
Back to top
madunix



Joined: 10 Apr 2005
Posts: 9

PostPosted: Sun Aug 10, 2008 12:51 am    Post subject: Reply with quote

I have a linux server RHEL5 64bit running cacti, I am in process to capture the snmp data of my AIX clients, any help how to proceed with this.


Thanks
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Informational/HOWTO's All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group