Programming :: Calculating Bandwidth With SNMP And Bash?

Mar 25, 2011

I'm writing a script which will calculate bandwidth usage, I'm monitoring the bandwidth with cacti and the results don't quite line up, can someone either correct my script (if it contains faults) or tell me why the results aren't the same. I'm using a guide obtained from cisco here: [URL]. Here's my code:

Code:
SNMPCOMMUNITY=public
IP=127.0.0.1
INTNUMBER=1
OUT=$(snmpget -v2c -c $SNMPCOMMUNITY $IP ifOutOctets.$INTNUMBER | awk '{print $4}')

[Code]....

View 2 Replies


ADVERTISEMENT

General :: Calculating Protocol Bandwidth Usage

Feb 17, 2010

I'm trying to create a script that will find the bandwidth usage of certain protocols only. For example, SMTP. I would like it to just return a number. Is there a known command/parameters to output something like this?

View 2 Replies View Related

Programming :: Calculating Average In PHP Array?

Jan 27, 2010

With array in php. All I was having the following columns:

Code:

Now Like the Above there were more variables defined through script:

Code:

Now what the above code is doing is calculating average of above values from columns{1-?,4-?)..likewise

Say If I remove two Machine and calculate the avg.

View 1 Replies View Related

Programming :: Calculating Average From Python Script

Apr 25, 2010

I'm trying to write a python script that will calculate my test scores from a text file named "exams."

Sample input would be:

Output will look like:

I have the following code:

Code:

My intent is to sum the values found in L and divide by len(L).

I think my issue is that when I split the values, I get a string array (ex. ['85', '90'] ), which makes it hard to do calculations.

View 5 Replies View Related

Programming :: Awk Syntax For Calculating Average And Standard Deviation

Apr 20, 2011

I have a data in a column.

Code:

I want to calculate average and standard deviation. As first step I want to calculate average for the data than calculate (del=data - avg) for all the data.

I suppose get

Code:

For this I use AWK and the code goes like this

Code:

But I get different answers.

Code:

Why the answers are so different? since this is wrong I can not continue calculating the standard deviation.

View 6 Replies View Related

General :: Bash: Calculating In Array And Storing Result In Array?

Dec 2, 2010

I have an array called arrayini which stores numbers. I want to take log to the base 2 of each of the numbers in that array and put it in file called result. I've used the following code to do it.

Code:

size=${#arrayini[@]}
for ((i=0;i<size;i++))
do
echo "scale = 12; l(${arrayini[$i]})/l(2)" | bc -l
done >result

It works fine but its taking pretty long to calculate since I've got about 230,000 items in the array. So I decided to store the result into an array hoping that it'd be faster. I tried the following code. arrayresult is where I try and store the result. The code doesn't work because of the second last line.

Code:

unset arrayresult
size=${#arrayini[@]}
for ((i=0;i<size;i++))
do
arrayresult[$i]="scale = 12; l(${arrayini[$i]})/l(2)" | bc -l
done >FILE2

There is a syntax error clearly.

View 6 Replies View Related

CentOS 5 Networking :: Configuring SNMP To Send Traps To SNMP Server?

Aug 12, 2010

I'm trying to configure SNMP service to send traps to SNMP server. I've installed net-snmp-utils, now I need to configure the "snmpd.conf" file...

View 2 Replies View Related

Fedora Networking :: Finding The Upcoming Bandwidth And Specify The Bandwidth Rateto Classes

Nov 18, 2010

I created a the class like this for shaping the packets with a specified bandwidth rate.....

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb default 15
tc class add dev eth0 parent 1:0 classid 1:1 htb rate 750kbit ceil 750kbit
tc class add dev eth0 parent 1:1 classid 1:3 htb rate 600kbit ceil 750kbit prio 0

For Our Requirement:-

I dont want to specify the bandwidth rate strictly like this rate750kbit ceil 750kbit,based on whatever speed is coming which should allocate the bandwidth rate for particular class...I need one application for finding the upcoming bandwidth & Is any other method is there for specify the bandwidth rate in a classes.

View 1 Replies View Related

Programming :: Serial Port Communications - CPU Bandwidth

Sep 15, 2010

I have an application written in C (by somebody else) monitoring a device connected to a serial port. I'm using an old laptop w. tinycore linux for an os. The app works well enough, and the communication speed is relatively slow, 9600bps, unidirectional, comes in packets of 18 bytes. The app is just picking apart the packets and displaying the contents on a formatted screen (ncurses), updating about once every 1/2 second. The trouble is, the app is polling the serial port and using *all* of the cpu bandwidth. The cpu fan runs full bore all the time.

Other activities are sluggish when the monitoring program is running. I'd like to modify the app to be a little more intelligent, use a receive buffer and interrupts to trigger processing each packet and, most importantly, not poll in a tight loop waiting for data. I'm not sure where to start, but I'm convinced this isn't that complicated of a change. Is there a good resource that would explain the basics of reading data from serial port software buffers, triggering on interrupts and suspending or sleeping when no interrupt is pending?

View 5 Replies View Related

Programming :: Snmp Programming In C?

Mar 27, 2010

Is there any good simple useful API for programming a software in C to send snmp trap agent. I wanted to write a program to gather the information from a system and send it as snmp agent trap for cacti or nagios or. for monitoring.

View 1 Replies View Related

Programming :: Bash: Printing The Line Number In Bash Script?

Feb 4, 2011

I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.

View 3 Replies View Related

Programming :: Bash Ctrl+c Tarp And Bash Read With Timeout?

Jan 24, 2010

simple bash code:

Code:
#!/bin/bash
trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c
echo "Press ctrl+c during 5 sec loop"
for ((i=0;i<5;i++)); do

[Code]...

How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!

View 10 Replies View Related

Programming :: Reading A Bash Variable In Bash Scripting ?

Nov 26, 2008

I have a config file that contains:

my.config:

Code:

Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.

Here is my parse_cmd script:

Code:

View 3 Replies View Related

Programming :: Run Multiple Bash And Php Scripts From A Bash Script?

Jul 25, 2011

I have written quite a few separate bash & scripts and php scripts that up to now I have run from cron jobs. However I have to estimate how long each takes to run, before running the next and so it probably takes much longer than necessary to run them all. They have to run in order.

Now there are so many I am thinking it would be better to have a master bash script that would run one after the other, but I am not sure how to get the master script to wait before starting to run the next script. Is this possible and is there a command that will make the script wait between bash and php scripts , for them to finish, before running the next?

View 5 Replies View Related

Programming :: Bash: Get Filename And Extension Using Bash?

Jan 9, 2010

I would like to get the filename (without extension) and the extension separately. The best solution I found so far is:

Let FILE="thefilenameofsomefilesfor_instance.txt"

Code:

NAME=`echo "$FILE" | cut -d'.' -f1`
EXTENSION=`echo "$FILE" | cut -d'.' -f2`

I think it would be better to count the len and remove 3 chars to right to get the extension, but it can be macintosh filenames with have 4 chars for extensions.

View 5 Replies View Related

Networking :: Control Bandwidth Access With Squid - Allow Certain IPs To Have Higher Bandwidth Access?

May 27, 2009

We have a sipmle office network set up that we also use use to connect to the internet, however of late the number of users has increased thus slowing internet access. Bandwidth upgrade is not an option thus i have to do bandwidth shaping on our linux router. The question is how do set the squid configs to allow certain IP's range a certain percentage bandwidtheg 60% and furthe divide the rest. Alternatively how can allow certain IPs to have higher bandwidth access.

View 1 Replies View Related

Programming :: Bash Programming - Rename Files In A Loop?

Mar 31, 2011

I need to rename the resulted searched files from a loopI have the following code:

find . -name DOC* | while read i
do
find $i -type f -name '*.txt'
done

basically, I am searching for all txt files inside any folder starting with DOC name.this code is working fine with me.I need to rename those .txt files to .txtOLDOS: Ubuntu 10.4Bash shell

View 10 Replies View Related

Red Hat / Fedora :: Calculating The Throughput Of A Server?

Feb 21, 2011

I have read many articles on hdparam to calculate the disk read and write speeds and some on interface and CPU limits. But is there a structured way of calculating the maximum throughput of a server including all the subsystems. Like storage, CPU, network, memory and so on? So that I can create a script that i can run on a newly installed Linux machine and calculate the maximum throughput .

View 4 Replies View Related

Hardware :: Calculating IOPS For The System?

Oct 4, 2010

calculating the IOPS for my system ?I had understood that IOPS could be calculated by monitoring IOSTAT. The r/s (reads/sec) and w/s (write/sec) combined basically gave you the peak IOPS.However having monitored iostat for my app during a performance test, the figures I'm seeing lead me to believe that iostat couldn't be a reliable way to calculate IOPS. I get values of over 10,000 for w/s! I didn't think this was possible given the storage system i have (4 x 7500rpm sata disks in raid 5).

View 1 Replies View Related

Ubuntu :: Creating Script For Calculating Payments

Jul 16, 2010

Recently I was trying to make a quick script for calculating payment between workers. I got stuck however. Here is what I am in for...

#!/bin/bash
#Setting the calculator
calc=` bc << EOF
scale=4
a=$2*($3/100)
b=$4
a/b
EOF
`
I've saved the $1 for further script.
#Creating the script
while [ -n $1 ]
do
case $1 in
workerA) read -p "Enter the total sum: " total
total=$2;
read -p "Enter the percentage:" percent
percent=$3;
read -p "Enter number of workers:" workers
workers=$4 ;;
*) echo "Error usage!"
break
esac
done

My script ends here. It just does not work. Did I sat the vars in the wrong way?

View 5 Replies View Related

General :: Calculating Process Memory Usage?

May 13, 2010

What originally seemed like an easy thing to calculate has given me a big headache. Perhaps someone can help me with my issue. I am trying to find, in particular, how much memory certain application processes are taking. The process always is the same name, main_server, but with an argument to tell it what to do when running as a daemon.

When running the following command against all "main_server" processes, it produces a result in megabytes based on the output of the rss field in 'ps'.

Code:
CALC=0
for ea in
`ps -e -orss=,args= |
sort -b -k1,1n |
pr -TW$COLUMNS |
grep main_server |
grep -v "grep main_server" |

[Code]...

Currently I am left scratching my head. For capacity planning purposes, it would be nice to know how many more 'main_server' processes could run on the system without causing it to swap. Knowing the buffer and cache usage will go down as running processes demand more memory, I prefer to look at the free memory excluding cache and buffers. However, since 'ps' is reporting the processes are using more memory than free reports is in use without those things, I have no way to know how many more processes the system can support. I played around with different fields in 'ps', such as vsize, size, etc, but with no luck in matching up any numbers.

View 7 Replies View Related

Programming :: Write A Bash Script That Sources Another Bash Script?

Jan 29, 2011

I am trying to write a bash script that sources another bash script. Essentially, I need a few lines to check to see if a certain variable is set. If not, I set it manually, and then source a scripts with that variable in the path. I wrote a test script to try it, but for some reason the last line does not work. Here is what I wrote:

#!/bin/sh
source ~setupdir/setup.shrc #just a test, this line works
echo ${#SETUP} # prints 0 if setup is not set, which it isn't
if [ ${#SETUP} -eq 0 ]
then
SETUP="~setupdir"
fi
echo $SETUP # prints ~setupdir

[Code]...

View 5 Replies View Related

General :: Debian - Filesystem - Difference In Calculating Size Using Df & Du?

Jun 30, 2011

When I run df it shows the root device is full.

Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.9G 9.4G 0 100% /

I looked at the inode usage and there is pretty much space available for root device

Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda1 640K 103K 538K 16% /

But, when I run the du command, it shows I have used only 2G out of 9.9G.

ip-10-204-70-44:/$ du -xh --max-depth=1
14M ./etc
4.0K ./mnt[code]....

It just driving me crazy and interesting too. This is big problem for us since the root disk / is full and some of the function in our site is failing.

View 2 Replies View Related

Server :: Calculating Percentage Of Swap Usage / Consumption

Dec 18, 2009

My monitor tools indicate that the percentage of swap used is more than the ideal , so I want to calculate which process is consuming from the swap. I tried the following but it didn't help be 100%

#ps -eo vsz,rss,pid,args | sort -n

How to accurately calculate which process consuming from swap, just the swap no ram + swap!

View 6 Replies View Related

Server :: Syslog Collector - Calculating Severity Of Message?

Jan 18, 2010

I am writing my own syslog collector, but im stuck with calculating the severity of the message. The PRI value is calculated:-
Code:
(Facility * 8) + Severity
But from the context of a collector, neither Facility or severity would be known? You need to know either severity or Facility to calculate facility or severity?! The RFC goes in to no more detail about calculating the severity value, other tan this expression.

View 1 Replies View Related

Server :: An Unresolvable Problem Occurred While Calculating The Upgrade

Dec 21, 2010

I am trying to update from ubuntu 10.04.1 to 10.10 using the do-release-upgrade command. I get this error:

Code:

An unresolvable problem occurred while calculating the upgrade: The package 'update-manager-core' is marked for removal but it is in the removal blacklist.

This can be caused by:

* Upgrading to a pre-release version of Ubuntu
* Running the current pre-release version of Ubuntu
* Unofficial software packages not provided by Ubuntu

The first two can't be correct right? So... If the third one is true. How can I find these packages? Or, is there any other way to upgrade to 10.10?

View 5 Replies View Related

General :: Calculating Handoff Latency In Mobile Ipv6 Environment

Nov 30, 2010

i have installed ns 2.33 and added the patch mobiwan for supprting mobile ipv6. i ran some tcl scripts , and below is the trace file generated. calculate the handoff latency, and if someone has awk or perl script to do so, tcl file [URL] out.tr [URL]

View 1 Replies View Related

General :: Want To Write Script For Calculating Usage Of Software From Text File Contains Log

Sep 10, 2009

Actually i m new to scripting in Linux, we have RedHat Server Edition 4 in which different software licences are installed and software itself installed at client side. the usage of the software is recorded daily in a text file which is of format

I want to write a script that checks that for any OUT & IN, if utility, user and Client PC Name are same then subtract OUT Time from IN Time. This has to be done for each & every user and utility.Is there any GUI programming possible in Linux.

View 7 Replies View Related

Programming :: Bash Scripting To Programming?

Jul 13, 2011

i'm in the process of learing C++. currently i'm creating shell scripts to get things done. i'm just curious how, as a programmer using C++ you would get a similar job done.as an example i have a script that takes the contents of files, pipes it to some sed and awk commands, which is piped to create a new file. that file is then imported into a mysql database.if you were going to do this in C++, would you call the sed/awk programs to modify the file, or can it be done within the program itself? i'm probably jumping the gun here because i've just started learing about pointers so this is above my ability

View 12 Replies View Related

Ubuntu Installation :: Error Upgrading To 10.10 - An Unresolvable Problem Occurred While Calculating The Upgrade

Apr 26, 2011

I have just tried to upgrade to Ubuntu 10.10 from 10.04 using the update manager

It asks me for me password and then a window opens saying "Upgrading Ubuntu to version 10.10"

It gets to "setting new software channels" then a message pops up saying "third party sources disabled" next a little error icon appears in the Notification Area then another message saying: Could not calculate the upgrade

An unresolvable problem occurred while calculating the upgrade: E:Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

This can be caused by:
-Upgrading to a pre-release version of Ubuntu
-Running the current pre-release version of Ubuntu
-Unofficial software packages not provided by Ubuntu

If none of this applies, then please report this bug against the 'update-manager' package and include the files in /var/log/dist-upgrade/ in the bug report.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved