Xymon Mailing List Archive search

Help with a custom test script

3 messages in this thread

list Q · Sun, 26 Aug 2007 15:39:21 -0700 ·
Hello,

  I am new to writing custom scripts and looking for advice on how to write a test to monitor the status of a machine in our render farm. Each machine is broken down into a number of CPU cores. We have a command that displays the status of each core in the format per line of  "<machine name>_<core number> in|out <partition name>" (i.e. testbox_0 in testpartition). So here is the part I an trying to work out. A machine with 4 cores will produce 4 lines each with it's own status. I would like to to include all cores in one test. I would like to produce a YELLOW status if any core is labeled as out and RED if they are all listed as out. I would also like to make rrd graphs that shows the in and out time for each core. Any help would be greatly appreciated.

Q
list Henrik Størner · Mon, 27 Aug 2007 07:42:20 +0200 ·
quoted from Q
On Sun, Aug 26, 2007 at 03:39:21PM -0700, Q wrote:
 I am new to writing custom scripts and looking for advice on how to write a test to monitor the status of a machine in our render farm. Each machine is broken down into a number of CPU cores. We have a command that displays the status of each core in the format per line of  "<machine name>_<core number> in|out <partition name>" (i.e. testbox_0 in testpartition). So here is the part I an trying to work out. A machine with 4 cores will produce 4 lines each with it's own status. I would like to to include all cores in one test. I would like to produce a YELLOW status if any core is labeled as out and RED if they are all listed as out. I would also like to make rrd graphs that shows the in and out time for each core. Any help would be greatly appreciated.
This doesn't do the graph, but it will give you the status you want:

  #!/bin/sh

  # Change this command to the one you use to collect the data
  getthestatus >$BBTMP/corestat.$$

  OUTCOUNT=`grep -c " out " $BBTMP/corestat.$$`
  if test "$OUTCOUNT" = "4"
  then
     COLOR=red
  elif test "$OUTCOUNT" -gt 0
  then
     COLOR=yellow
  else
     COLOR=green
  fi

  # Note: This command spans multiple lines
  $BB $BBDISP "status $MACHINE.cores $COLOR `date`

  $OUTCOUNT cores out

  `cat $BBTMP/corestat.$$
  "

  rm $BBTMP/corestat.$$
  exit 0


Regards,
Henrik
list Q · Tue, 28 Aug 2007 07:59:33 -0700 ·
Thanks Henrik,

  That did the trick for status and helped me write a few more testes. . Your help is very much appreciated.

I still need to work out how to do rrd data I am starting to do research on that but if anyone has any suggestions I would be glad to see them.

Q
quoted from Henrik Størner

Henrik Stoerner wrote:
On Sun, Aug 26, 2007 at 03:39:21PM -0700, Q wrote:
  
 I am new to writing custom scripts and looking for advice on how to write a test to monitor the status of a machine in our render farm. Each machine is broken down into a number of CPU cores. We have a command that displays the status of each core in the format per line of  "<machine name>_<core number> in|out <partition name>" (i.e. testbox_0 in testpartition). So here is the part I an trying to work out. A machine with 4 cores will produce 4 lines each with it's own status. I would like to to include all cores in one test. I would like to produce a YELLOW status if any core is labeled as out and RED if they are all listed as out. I would also like to make rrd graphs that shows the in and out time for each core. Any help would be greatly appreciated.
    
This doesn't do the graph, but it will give you the status you want:

  #!/bin/sh

  # Change this command to the one you use to collect the data
  getthestatus >$BBTMP/corestat.$$

  OUTCOUNT=`grep -c " out " $BBTMP/corestat.$$`
  if test "$OUTCOUNT" = "4"
  then
     COLOR=red
  elif test "$OUTCOUNT" -gt 0
  then
     COLOR=yellow
  else
     COLOR=green
  fi

  # Note: This command spans multiple lines
  $BB $BBDISP "status $MACHINE.cores $COLOR `date`

  $OUTCOUNT cores out

  `cat $BBTMP/corestat.$$
  "

  rm $BBTMP/corestat.$$
  exit 0


Regards,
Henrik