Hi all,
i am newbee on Cacti, il get it working, but now i am tring to make scripts to get the CPU % utilisation adding the User and the Process, and another to get the memory % utilisation insteed of the free and total.
i start writing the script for the memory :
#/usr/bin/perl
echo total
total=$(snmpget -v1 -c public 192.168.20.236 .1.3.6.1.4.1.2021.4.5.0 | awk -F"INTEGER:" ' { print $2 } ')
echo $total
echo free
free=$(snmpget -v1 -c public 192.168.20.236 .1.3.6.1.4.1.2021.4.6.0 | awk -F"INTEGER:" ' { print $2 } ')
echo $free
echo calcul du %
pour=$(($total-$free)/$total)
echo $pour
but it's not working.
i get error message :
# ./test.pl
total
905884
free
106940
calcul du %
./test.pl: line 9: 905884-: command not found
The Cacti version i get is the 0.8.6i under a debian.
% of CPU and % of Memory used
Moderators: Developers, Moderators
-
- Posts: 4
- Joined: Mon Nov 13, 2006 4:44 am
Ok i get it but not in perl code, but n shell code:
#!/bin/sh
COMMUNITY=public
IP=$1
OID_MEM_TOTAL=".1.3.6.1.4.1.2021.4.5.0"
OID_MEM_FREE=".1.3.6.1.4.1.2021.4.6.0"
MEM_TOTAL=`snmpget -c $COMMUNITY -v1 $IP $OID_MEM_TOTAL | cut -d : -f4`
echo "Mem total $MEM_TOTAL"
MEM_FREE=`snmpget -c $COMMUNITY -v1 $IP $OID_MEM_FREE | cut -d : -f4`
echo "Mem free $MEM_FREE"
MEM_USED=$(($MEM_TOTAL-$MEM_FREE))
echo "Mem used $MEM_USED"
MEM_USEDP=$(($MEM_USED*100/MEM_TOTAL))
echo "Mem utilis
#!/bin/sh
COMMUNITY=public
IP=$1
OID_MEM_TOTAL=".1.3.6.1.4.1.2021.4.5.0"
OID_MEM_FREE=".1.3.6.1.4.1.2021.4.6.0"
MEM_TOTAL=`snmpget -c $COMMUNITY -v1 $IP $OID_MEM_TOTAL | cut -d : -f4`
echo "Mem total $MEM_TOTAL"
MEM_FREE=`snmpget -c $COMMUNITY -v1 $IP $OID_MEM_FREE | cut -d : -f4`
echo "Mem free $MEM_FREE"
MEM_USED=$(($MEM_TOTAL-$MEM_FREE))
echo "Mem used $MEM_USED"
MEM_USEDP=$(($MEM_USED*100/MEM_TOTAL))
echo "Mem utilis
-
- Posts: 4
- Joined: Mon Nov 13, 2006 4:44 am
No i haven't read about CDEF befor.
But to use CDEF, i need the correct values and the CDEF juste do the operation.
For exemple i need the total memory and the free memory, than i can calculate the used memory and obtain the result in % format.
But for the memory the basic script get the swap free and memory free, i do not get the total for each one.
And already have a look hoto graph a scrit and it doesn't result.
I will be great if you get an url who explain all the details to make a script in shell for exemple and get it grahed.
Regards
Adamentium
But to use CDEF, i need the correct values and the CDEF juste do the operation.
For exemple i need the total memory and the free memory, than i can calculate the used memory and obtain the result in % format.
But for the memory the basic script get the swap free and memory free, i do not get the total for each one.
And already have a look hoto graph a scrit and it doesn't result.
I will be great if you get an url who explain all the details to make a script in shell for exemple and get it grahed.
Regards
Adamentium
-
- Posts: 4
- Joined: Mon Nov 13, 2006 4:44 am
I follow the howto with the ping exemple, i get graphs but nothing in.
The line current said nan, avarage said nan, and maximum said nan.
When i execute manualy the script i guet a result on the command screen.
debian:/cacti/scripts# perl ping.pl 212.27.48.10
39.7debian:/cacti/scripts# perl ping.pl 212.27.48.10
39.4debian:/cacti/scripts# perl ping.pl 212.27.48.10
40.0debian:/cacti/scripts#
The line current said nan, avarage said nan, and maximum said nan.
When i execute manualy the script i guet a result on the command screen.
debian:/cacti/scripts# perl ping.pl 212.27.48.10
39.7debian:/cacti/scripts# perl ping.pl 212.27.48.10
39.4debian:/cacti/scripts# perl ping.pl 212.27.48.10
40.0debian:/cacti/scripts#
Who is online
Users browsing this forum: No registered users and 1 guest