Success failed rate calculation based on true false values


I want to show somehow the success/failed rate of the spawning results.
I have 1 and 0 values, 1 is if it is successfully spawned, 0 if it is failed. How can I calculate the success and failed rate, so summarize the 1s and 0s, and divide the success / all. Singlestat wil be the final so I want the graph and single stat.

I forgot to mention that I’m using collectd graphite and the job is running from cron, the values are reported every 18-19 minutes.