Results 1 to 9 of 9
  1. #1

    Reporting Server Stats

    Does anyone know how to create a bash or perl script that will capture and send server stats to another server via wget or something. Server stats like free cpu % idle, 1,5,15 min load average, memory free, memory free + memory buffers, swap used, swap used %, network traffic in + out, total swap used, hard disk use %.

    Then send it to something like IP/something.php?mem=1234&cpu=5678 etc. Ive been searching the net trying to find anything that could start be out with this but no luck. If anyone could help me that would be great. Thanks


  2. #2
    You may be interested in rrdtool. You can find screenshots here:

    If that sounds like what you're after, and you want to create it yourself, I can tell you what the setup would be like for it.

  3. #3
    Thats basically what I want yah. I plan to have multiple servers which will all call home and give stats. However I need the stats in raw number form as well because I want them to load balance via DNS round robin to change as server load levels get too high in some places. Not sure if this can do that.


  4. #4
    I'll give you an idea to run with, which would include having the stats in raw number form, and let you figure out how to do the rrdns (I'm not very well versed in that):

    main server
    create your rrd dbs here, such as loadavg.rrd, mem.rrd, etc

    server to obtain stats from
    code a script that obtains local values (mem usage, load averages, etc) and
    places them inside a directory accessible from the main server (such as via wget, or using IO::Socket with perl)

    back on the main server
    write a script that obtains the values from the server collecting the stats, updates the rrd dbs, then generates the graphs.

    You could also somehow use the stats (collected on the main server from the others) to do the rrdns.

    rrdtool isn't complex, but it will take a bit of reading to learn how it works (creating the dbs, updating the dbs, then graphing the dbs). Once you get past that, it's really great to work with.

    Basically you'll want to learn the following functions from rrdtool:
    rrdtool create
    rrdtool update
    rrdtool graph

  5. #5
    You know, actually, if you don't even need the graphs, this would be much simpler. Just write something that obtains the values from the local server (say, perl reading from /proc/loadavg and writing the output to a file), places them into a web accessible directory, and have another server wget that file, and perform the rrdns functions based on that. Are you more looking for scripts that obtain the values? If so, you can find some in HotSaNIC, or Cacti to base your scripts on.

  6. #6
    Yah, I was basically looking for scripts to obtain the needed values.


  7. #7
    Join Date
    Feb 2003
    North Hollywood, CA
    2,554 Maybe?

    You can probably modify this to do what you want...
    Remote Hands and Your Local Tech for the Los Angeles area.

    (310) 573-8050 - LinkedIn

  8. #8
    I was looking for something that would work without PHP compiled into apache. Thanks.


  9. #9
    Does anyone know how I can do this with bash or shell script? I need to get the data and WGET it somewhere but I don't know how to get the data.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts