|
|
| Author |
Message |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12148 Location: Muenster, Germany
|
Posted: Wed Feb 08, 2006 4:09 am Post subject: [INFO] Displaying work shifts only |
|
|
This information was taken from the rrdtool users mailing list and is not prooved yet
| Quote: | You want localtime 8:00 to 18:00. 10 hours per 24 hours. Keep that interval each day, set the rest to unknown or to zero. You want monday to friday. Keep that interval (which has undesired time removed already) and set the rest to unknown or to zero.
Remaining: office hours. The average computed may be too low. This will be the case if you used zero to mask out the other hours. Compensate by multiplying by 24/10 and by 7/5.
Without generating complete CDEFs, and without testing and debugging, I think the following should get you started:
| Code: | if (localtime more than 08:00 and less or equal to 18:00) {
then use ds0
else use value zero
}
ds0_modified1=LTIME,86400,%,28801,64800,LIMIT,UN,0,ds0,IF
if (localtime between saturday and sunday) {
then use value zero
else use outcome of previous CDEF
}
ds0_modified2=LTIME,604800,%,21000,28000,LIMIT,UN,ds0_modified1,0,IF
|
You will need to tweak the numbers 21000 and 28000 so that they match the beginning of saturday and the end of sunday. The numbers are no magic. Modulo 86400 gives the hour in a day, modulo 604800 gives the hour in a week. Weeks do not start on monday, they start on friday 00:00 UTC.
CDEF compiled should look like
| Code: |
CDEF:ds0_officehours=LTIME,604800,%,3600,47,*,3600,47,48,
+,*,LIMIT,UN,LTIME,86400,%,3600,8,*,1,+,3600,17,*,LIMIT,UN,UNKN,ds0,IF,UNKN,IF
|
My office hours are 8h - 17h in this example (see digits 8 and 17).
Instead of setting values outside office hours to 0 I set it to UNKN.
48 is the length in hours of the weekend beginning on Sat 0h.
One correction: The "week" begins on Thursday (1.1.1970), not on Friday. This is the reason for the 47 in the CDEF. |
There were already several posts asking for this. It may be useful as a starting point
Reinhard |
|
| Back to top |
|
 |
romain.quinat
Joined: 21 Sep 2005 Posts: 15
|
Posted: Fri Mar 03, 2006 4:53 am Post subject: ERROR: invalid rpn expression |
|
|
are you still working on this CDEF expression ?
I have ERROR when I applied it :
ERROR: invalid rpn expression 'ds0_officehours=LTIME,604800,%,3600,47,*,3600,47,48,+,*,LIMIT,UN,LTIME,86400,%,3600,8,*,1,+,3600,19,*,LIMIT,UN,UNKN,a,IF,UNKN,IF,8,*'
Here is my CDEF :
cdef=ds0_officehours=LTIME,604800,%,3600,47,*,3600,47,48,+,*,LIMIT,UN,LTIME,86400,%,3600,8,*,1,+,3600,19,*,LIMIT,UN,UNKN,CURRENT_DATA_SOURCE,IF,UNKN,IF,8,*
Thanks LVM |
|
| Back to top |
|
 |
romain.quinat
Joined: 21 Sep 2005 Posts: 15
|
Posted: Fri Mar 03, 2006 5:56 am Post subject: That's all folks |
|
|
| It works, i only made a bad CDEF expression |
|
| Back to top |
|
 |
gandalf Developer
Joined: 02 Dec 2004 Posts: 12148 Location: Muenster, Germany
|
Posted: Fri Mar 03, 2006 10:25 am Post subject: |
|
|
Would you consider Shift Displays as a good extension to http://forums.cacti.net/viewtopic.php?t=12192? Would the definition of one shift be enough? Per whole cacti system or per user config?
Reinhard |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|