Carlos Arnt Neto wrote: > Can't figure out a way to show a graphic that only takes my serial status > (Online / Offline) then show in a Red / Green bar . For day-month-year .
I'll assume that you know a way to query the status of your serial port. Let's assume it signals you when the status changes. You also need some timer somewhere that expires after a certain amount of no-change. RRDtool gets updated either - when the status alters or - after five minutes of no change (using the timer) What do you send to rrdtool? Four possibilities: -a- the status changes from inactive to active -b- the status changes from active to inactive -c- the status doesn't change, it has been inactive for 5 minutes -d- the status doesn't change, it has been active for 5 minutes In cases a and c, the status upto the update has been inactive. Feed 0 to rrdtool. In cases b and d, the status has been active. Feed 1 to rrdtool. Your input is now an alternating 0 and 1, corresponding with your serial line status. Even if the status doesn't change you will get an update of the database so you won't suffer from timeouts. What should your rrd look like? You feed numbers that have nothing to do with time. They don't increment over time. This means you should be using the GAUGE counter type. Create a database that has such a DS. Examples are everywhere on your disk and on the web. Now the graphing. Whatever time period you fetch and in whatever resolution you fetch it, you will get a fraction of 1. It can be 0, it can be 1, it can be somewhere inbetween. If you use this number as a fraction of the y-axis, you can plot green from the x-axis upwards, and fill the rest of the y-axis with red. This means you stack a certain amount of red on top of a certain amount of green. This will result in what you want. Untested code: DEF:ratio=/path/to/serial.rrd:updown:AVERAGE CDEF:up=ratio,100,* CDEF:down=1,ratio,-,100,* COMMENT:"Up and down as a percentage of time\n" AREA:up#00CC00:up STACK:down#FF0000:down After consolidating the up and down status into a single number per day (for the year image) you will end up with (for instance) 0.75 in the database. This means you plot green from 0 to 100*0.75=75 and red from 75 to 75+100*(1-0.75)=100 HTH -- __________________________________________________________________ / [EMAIL PROTECTED] [EMAIL PROTECTED] \ | work private | | My employer is capable of speaking therefore I speak only for myself | +----------------------------------------------------------------------+ | Technical questions sent directly to me will be nuked. Use the list. | +----------------------------------------------------------------------+ | http://faq.mrtg.org/ | | http://rrdtool.eu.org --> tutorial | +----------------------------------------------------------------------+ -- Unsubscribe mailto:[EMAIL PROTECTED] Help mailto:[EMAIL PROTECTED] Archive http://www.ee.ethz.ch/~slist/rrd-users WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
