06-26-2013
Help in making a basic bash script
Hi All,
I am trying to monitor CPU load of few processes, with the same name.
The output that I get from top is the following
28171 root 20 0 1089m 21m 3608 S 103 0.3 15:16.89 /opt/ppp//h264rtptranscoder.bin --videoPort=14504 --audioPort=14505
27589 root 20 0 1060m 23m 3548 S 94 0.3 35:16.57 /opt/ppp/h264rtptranscoder.bin --videoPort=14500 --audioPort=14501
The problem I see here is that top reports my CPU utilisation per core, not avg.
I wanna put the avg load for each process in a nice graph in zabbix.
Anyone who did it before ?
Last edited by liviusbr; 06-26-2013 at 07:08 AM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I'm on SunOS 5.8.
I'm not sure of the exact terminology, but I want to make a "remote mount" from my server to another server. (Basically I want to create one of the mount points on my server be a shared volume that's on another server here). So if I do a df -k, I want to see all of the volumes... (1 Reply)
Discussion started by: FredSmith
1 Replies
2. Shell Programming and Scripting
Hello once again:
One thing that seems to be a nice feature is a progress gauge... so I can see how long an operation will take for a task to complete if it is requiring a lot of processing or the file is enormous. I have seen references to gauge operations, but I don't know anything about it or... (1 Reply)
Discussion started by: ccox85
1 Replies
3. UNIX for Dummies Questions & Answers
Hello there
Been using Unix bash scripting for two days now so am very new to this. I am currently doing a project now and i'm basically making a noughts and crosses game (or tic tac toe).
I have created the board using an array. When I try and check to see if the array is empty using an If... (3 Replies)
Discussion started by: ChrisHoogie
3 Replies
4. Shell Programming and Scripting
ok basically im trying to count how many people fail a class by comparing there grade by -gt 49
i tried putting a count inside the while loop but i know you cant access a count outside a subshell. is there an easy way to count the number of failures?
declare -i failcount=0
awk... (2 Replies)
Discussion started by: nilekyle
2 Replies
5. Shell Programming and Scripting
Hello all!
This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician.
Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix:
... (16 Replies)
Discussion started by: torchij
16 Replies
6. Shell Programming and Scripting
Here's the assignment. I'll bold the parts that are rough for me. Unfortunately, that's quite a bit lol. The syntax is, of course, where my issues lie, for the most part. I don't have a lot of programming experience at all :/. I'd post what I've already done, but I'm so lost I really don't know... (1 Reply)
Discussion started by: twk101
1 Replies
7. Shell Programming and Scripting
I am working with autodock vina for virtual screening and docking with cygwin. Autodock vina generates conformers for multiple ligands. I want to make the complex of these conformers with receptor. e.g. I have 100 .pdbqt files form vina output and one receptor pdbqt file. By running command-
cut... (1 Reply)
Discussion started by: Rajesh Patil
1 Replies
8. Shell Programming and Scripting
Does it possible to make some bash script automatic to be a executable when transfered to another pc...? (5 Replies)
Discussion started by: tomislav91
5 Replies
9. UNIX for Beginners Questions & Answers
Hi everyone, first time visitor to these forums here.
Keeping a long story short I've been attempting to learn how to code in bash. I have VERY little previous experience with coding languages besides simply copying and pasting batch scripts for Windows. So, with that in mind I've followed a... (4 Replies)
Discussion started by: Meta
4 Replies
10. Shell Programming and Scripting
I am not able to execute bash script on Fedora. They were running on another environment. This is a sample script:
#!/usr/bin/bash
input="./data/heu/hout1"
i=1
j=0
while IFS= read -r file1
do
#Some code here
done < "$input"
#echo $j
I get an error:
bash: s.sh: command not... (3 Replies)
Discussion started by: ngabrani
3 Replies
LEARN ABOUT DEBIAN
hobbitgraph.cfg
HOBBITGRAPH.CFG(5) File Formats Manual HOBBITGRAPH.CFG(5)
NAME
hobbitgraph.cfg - Configuration of the hobbitgraph CGI
SYNOPSIS
$BBHOME/etc/hobbitgraph.cfg
DESCRIPTION
hobbitgraph.cgi(1) uses the configuration file $BBHOME/etc/hobbitgraph.cfg to build graphs from the RRD files collected by Xymon.
FILE FORMAT
Each definition of a graph type begins with a "[SERVICE]" indicator, this is the name passed as the "service" parameter to hobbit-
graph.cgi(1). If the service name passed to hobbitgraph.cgi is not found, it will attempt to match the service name to a graph via the
TEST2RRD environment variable. So calling hobbitgraph.cgi with "service=cpu" or "service=la" will end up producing the same graph.
A graph definition needs to have a TITLE and a YAXIS setting. These are texts shown as the title of the graph, and the YAXIS heading
respectively. (The X-axis is always time-based).
If a fixed set of RRD files are used for the graph, you just write those in the RRDtool definitions. Note that Xymon keeps all RRD files
for a host in a separate directory per host, so you need not worry about the hostname being part of the RRD filename.
For graphs that use multiple RRD files as input, you specify a filename pattern in the FNPATTERN statement, and optionally a pattern of
files to exclude from the graph with EXFNPATTERN (see "[tcp]" for an example). When FNPATTERN is used, you can use "@RRDFN@" in the RRD-
tool definitions to pick up each filename. "@RRDIDX@" is an index (starting at 0) for each file in the set. "@RRDPARAM@" contains the first
word extracted from the pattern of files (see e.g. "[memory]" how this is used). "@COLOR@" picks a new color for each graph automatically.
The remainder of the lines in each definition are passed directly to the RRDtool rrd_graph() routine.
The following is an example of how the "la" (cpu) graph is defined. This is a simple definition that uses a single RRD-file, la.rrd:
[la]
TITLE CPU Load
YAXIS Load
DEF:avg=la.rrd:la:AVERAGE
CDEF:la=avg,100,/
AREA:la#00CC00:CPU Load Average
GPRINT:la:LAST: %5.1lf (cur)
GPRINT:la:MAX: %5.1lf (max)
GPRINT:la:MIN: %5.1lf (min)
GPRINT:la:AVERAGE: %5.1lf (avg)
Here is an example of a graph that uses multiple RRD-files, determined automatically at run-time via the FNPATTERN setting. Note how it
uses the @RRDIDX@ to define a unique RRD parameter per input-file, and the @COLOR@ and @RRDPARAM@ items to pick unique colors and a match-
ing text for the graph legend:
[disk]
FNPATTERN disk(.*).rrd
TITLE Disk Utilization
YAXIS % Full
DEF:p@RRDIDX@=@RRDFN@:pct:AVERAGE
LINE2:p@RRDIDX@#@COLOR@:@RRDPARAM@
-u 100
-l 0
GPRINT:p@RRDIDX@:LAST: %5.1lf (cur)
GPRINT:p@RRDIDX@:MAX: %5.1lf (max)
GPRINT:p@RRDIDX@:MIN: %5.1lf (min)
GPRINT:p@RRDIDX@:AVERAGE: %5.1lf (avg)
ADVANCED GRAPH TITLES
Normally the title of a graph is a static text defined in the hobbitgraph.cfg file. However, there may be situations where you want to use
different titles for the same type of graph, e.g. if you are incorporating RRD files from MRTG into Xymon. In that case you can setup the
TITLE definition so that it runs a custom script to determine the graph title. Like this:
TITLE exec:/usr/local/bin/graphitle
The /usr/local/bin/graphtitle command is then called with the hostname, the graphtype, the period string, and all of the RRD files used as
parameters. The script must generate one line of output, which is then used as the title of the graph.
ENVIRONMENT
TEST2RRD Maps service names to graph definitions.
NOTES
Most of the RRD graph definitions shipped with Xymon have been ported from the definitions in the larrd-grapher.cgi CGI from LARRD 0.43c.
SEE ALSO
hobbitserver.cfg(5), rrdtool(1), rrdgraph(1)
Xymon Version 4.2.3: 4 Feb 2009 HOBBITGRAPH.CFG(5)