Does any one have a SNMP disk usage script for Linux ?
Moderators: Developers, Moderators
Does any one have a SNMP disk usage script for Linux ?
Does any one have a SNMP disk usage script for Linux ?
What about the simple one that comes with cacti in 'scripts/diskfree.pl'?
The newest cacti.sql file includes the data input as well, but in case you don't have it, here are the settings.
Name:
Input String:
Output String:
Then define the following fields:
Name: Disk Partition
Data Name: partition
Input/Output: Input
Update RRA: No
Name: Megabytes Free
Data Name: megabytes
Input/Output: Output
Update RRA: Yes
Name: Percent Free
Data Name: percent
Input/Output: Output
Update RRA: No
-Ian
The newest cacti.sql file includes the data input as well, but in case you don't have it, here are the settings.
Name:
Code: Select all
Get Free Disk Space
Code: Select all
perl <path_cacti>/scripts/diskfree.pl <partition>
Code: Select all
<megabytes>:<percent>
Name: Disk Partition
Data Name: partition
Input/Output: Input
Update RRA: No
Name: Megabytes Free
Data Name: megabytes
Input/Output: Output
Update RRA: Yes
Name: Percent Free
Data Name: percent
Input/Output: Output
Update RRA: No
-Ian
Thanks IAN, but I'm looking for an SNMP version....
It looks like you are talking about a local disk usage.
If not, where you define the SNMP Community in this script?
If not, where you define the SNMP Community in this script?
Hi dbenders,
I don't have an specific script for plot swap, real mem and disk space, but I have two separate ones to monitor swap and real mem.
Idea stolen from Gilson , BTW thanks again Gilson!
these are the scripts:
For RAM:
For SWAP:
Remember that these scripts are for linux pc's!
With this two scrits in your server all what you have to do is fallow the instrctions tha Gilson have post in http://www.raxnet.net/board/viewtopic.php?t=622
Only keep in mind that the output of these scripts gona be:
I don't have an specific script for plot swap, real mem and disk space, but I have two separate ones to monitor swap and real mem.
Idea stolen from Gilson , BTW thanks again Gilson!
these are the scripts:
For RAM:
Code: Select all
#!/bin/sh
memTotalReal=`$1 -Ont $2 $3 .1.3.6.1.4.1.2021.4.5.0|cut -d" " -f3`
memAvailReal=`$1 -Ont $2 $3 .1.3.6.1.4.1.2021.4.6.0|cut -d" " -f3`
let "memUsedReal=$memTotalReal-$memAvailReal"
echo $memTotalReal $memUsedReal $memAvailReal
Code: Select all
#!/bin/sh
memTotalSwap=`$1 -Ont $2 $3 .1.3.6.1.4.1.2021.4.3.0|cut -d" " -f3`
memAvailSwap=`$1 -Ont $2 $3 .1.3.6.1.4.1.2021.4.4.0|cut -d" " -f3`
let "memUsedSwap=$memTotalSwap-$memAvailSwap"
echo $memTotalSwap $memUsedSwap $memAvailSwap
With this two scrits in your server all what you have to do is fallow the instrctions tha Gilson have post in http://www.raxnet.net/board/viewtopic.php?t=622
Only keep in mind that the output of these scripts gona be:
Any way, if you need any more help, only ask for it!TotalMem UsedMem AvailableMem
Regards,
BM
BM
Script wanted to monitor RAM and Disk usage
Hi sayasif,
Can you please post here the script you have written, that way I will save some time or learn another way to do the same, always is good to see new scripts from others.
Thanks for you TIP.
Can you please post here the script you have written, that way I will save some time or learn another way to do the same, always is good to see new scripts from others.
Thanks for you TIP.
Problem doing the command directly
Hi bocasman,
I just tried to run the command directly, but I get only a -1 value:
Same with the OID .1.3.6.1.4.1.2021.4.6.0
Any idea what is wrong?
Maybe the UCD-SNMP version???
mine are:
[root@host]# rpm -qa|grep snmp
ucd-snmp-4.2.5-7.73.0
ucd-snmp-utils-4.2.5-7.73.0
ucd-snmp-devel-4.2.5-7.73.0
php-snmp-4.1.2-7
I just tried to run the command directly, but I get only a -1 value:
Code: Select all
shell# /usr/bin/snmpget -Ont myhost mysnmpcomunity .1.3.6.1.4.1.2021.4.5.0
shell# .1.3.6.1.4.1.2021.4.5.0 = -1
Any idea what is wrong?
Maybe the UCD-SNMP version???
mine are:
[root@host]# rpm -qa|grep snmp
ucd-snmp-4.2.5-7.73.0
ucd-snmp-utils-4.2.5-7.73.0
ucd-snmp-devel-4.2.5-7.73.0
php-snmp-4.1.2-7
I'm running NET-SNMP version: 5.0.6, and configured the OID's for diskspace in the snmpd:
http://hobbes.sa-char.net/cacti/graph.p ... &rraid=all
although it returns a NAN value for used diskspace, don't know why that is.
Code: Select all
disk / 10000
# % snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.9
enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0
enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F
enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/hda1"
enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1 = 10000
enterprises.ucdavis.diskTable.dskEntry.diskTotal.1 = 837130
enterprises.ucdavis.diskTable.dskEntry.diskAvail.1 = 316325
enterprises.ucdavis.diskTable.dskEntry.diskUsed.1 = 437092
enterprises.ucdavis.diskTable.dskEntry.diskPercent.1 = 58
enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1 = 0
enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1 = ""
although it returns a NAN value for used diskspace, don't know why that is.
-
- Posts: 5
- Joined: Mon Jul 19, 2004 4:11 am
- Contact:
-
- Cacti User
- Posts: 311
- Joined: Tue Jun 29, 2004 12:52 pm
- Location: Indiana
It was VERY easy for me. Use "snmpconf -g basic_setup". This will create a snmpd.conf file for you. You can specify partitions you want to monitor, usernames, passwords... it's very easy to use (i.e. I got through it without reading any documentation, first time through) The net-snmp daemon will use the host MIB which gives all sorts of information about disk partitions among other things.
Dave
Generic setup for an snmpd.conf is to start with a blank.., and put in the following:
rocommunity putapasswordhere
disk / 10000
disk /tmp 10000
That's it.., it'll let you monitor Processor, memory, interfaces, the above mentioned disk partitions (add the ones you need) and load..
rocommunity putapasswordhere
disk / 10000
disk /tmp 10000
That's it.., it'll let you monitor Processor, memory, interfaces, the above mentioned disk partitions (add the ones you need) and load..
Jeroen Wunnink
Easyhosting.nl Sysadmin
Easyhosting.nl Sysadmin
Who is online
Users browsing this forum: No registered users and 0 guests