[HOWTO] aix 5.3 quickie howto

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Developers, Moderators

Post Reply
shanekennedy
Posts: 45
Joined: Tue Oct 10, 2006 10:35 am

[HOWTO] aix 5.3 quickie howto

Post by shanekennedy »

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/ ... nload.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

madunix
Posts: 13
Joined: Sun Apr 10, 2005 8:58 am

Post by madunix »

any feedback about this script before i use it ...
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

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... :x
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
madunix
Posts: 13
Joined: Sun Apr 10, 2005 8:58 am

Post by madunix »

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
Throbulator
Posts: 15
Joined: Mon Sep 29, 2008 9:09 am

AIX native SNMP agent

Post by Throbulator »

It's hard to hide my disappointment regarding Cacti and AIX. I've chunked through everything in the Forum that a search for AIX+SNMP provided... just several big piles of disorganized mutterings. As often as not, it is unclear whether the posters are working in the context of net-SNMP or the native AIX SNMP cruft.

Have things changed significantly since 2005 for the native AIX SNMP agent? Should it be avoided altogether, if net-SNMP is an option?
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Anything with my name on it is with concern to the AIX SNMP Agent.

To be honest, if you can use the net-snmp agent, do it. The AIX agent is a convoluted piece of crap.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
andyfb
Posts: 2
Joined: Fri Nov 28, 2008 5:48 am

Post by andyfb »

With which graph templates do you monitor the results?
Can you attach them, please?

Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests