Skip to content

Simple bash script to create a graph of a changing value using screen and gnuplot.

License

Notifications You must be signed in to change notification settings

jerri/screengraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Screen-Graph

Gerhard Hellmann [email protected]

This is a simple bash script to use screen and gnuplot, to output a simple graph of one changing number output to a screen window.

This script is written for bash and uses quite a lot of common tools. Namely:

  • bash
  • gnuplot
  • sed
  • perl
  • gnu screen

This script is not very elegant, mostly from being hacked together in about 2 hours. I just wanted to visualize the output of another script which was output to a screen-window. It works. Nevertheless YMMV!

Usage

You need at least one screen running. Check for the $STY, as you need this for screen-graph to find the data. So inside screen do:

$ echo $STY
2294.pts-0.fun

Then create a new window in screen and give it a title. Using standard-shortcuts that would be CTRL-a c to create the new window followed by ctrl-a :title WINDOWNAME<RETURN> to set the title WINDOWNAME for that window.

Now this will be the data-window. Just run a script inside this window which just outputs the data to visualize in the following form:

UNIX-TIMESTAMP yourValue

For example the following line outputs your computers load in the required format:

$ while true; do echo -n $(date +%s)' '; cat /proc/loadavg | cut -f 1 -d ' '; sleep 10; done

The output will look something like this:

1144870745 0.22
1144870755 0.18
1144870765 0.39
1144870775 0.64
1144870785 0.85

Now comes the magic. In another window, or even on another terminal (on the same computer as the same user though!) enter (considering screen-graph.sh is in your PATH!)

$ screen-graph.sh 2294.pts-0.fun WINDOWNAME

Use the parameters entered above! The result should be a graph filling up your terminal-window. If it doesn't work, well, use the source, luke. :)

If you have ideas to improve this script, or found any bugs, please tell me via email [email protected].

This script is published under the GPL.

About

Simple bash script to create a graph of a changing value using screen and gnuplot.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages