Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Wed May 24, 2017 2:45 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Can I get a few advices on my plugin
PostPosted: Wed Feb 27, 2013 10:00 am 
Offline
Cacti User

Joined: Fri Sep 28, 2012 6:52 pm
Posts: 111
Hello,

I'm on the process of making a couple of plugins, and I haven't made a plugin to Cacti before.

On one of those plugins, I intend to make an easy-to-achieve percentage availability report for your devices, based on a certain time range selected by the user. However, I've come across a few design choices.

The basic idea is to have data collected periodically and when the user chooses to see the report, data will simply be calculated into a percentage availability for some given time period.

First I tried inserting data, at each poller run, into a MySQL table. That worked for a time, but started requiring a lot of resources (disk space), even at a small test scenario, and even after I started consolidating older data (e.g. 5-minute polling data from 6 months ago would be consolidated into 1-hour data, and so on).

That's when I started to think that a MySQL-based approach would be sort of a waste, especially when we already have RRDTOOL at our disposal.


Then, I thought "why not simply check the .rrd files for the EXISTENCE of data? If the data exists, the device was probably online".

However, by doing this I must either force the user to implement a certain Data Source AND an associated graph into his devices so that I can read the associated .rrd file OR give the user the option to select whatever Data Sources he wants to be the actual sources for the report generation.

PROBLEM: The second option, where the user has the choice, is not consistent at all. If user chooses a Data Source regarding network traffic, and chooses - let's call it 'by accident' - an interface that has sporadic traffic, his reports won't present data regarding the device's actual availability.

However, if the user chooses a Data Source regarding things like disk usage on the " / " partition, device Uptime, or even a network interface that gets traffic absolutely 24/7 with no exceptions (which I assume is somewhat rare, unless you're a huge company), then the final percentage reports would end up being a lot more trustworthy.


Do you see where I'm getting at? I hope I've made it clear enough.

For you experienced devs out there, what do you think should be the best option for this? I'd like to make as much of a concise, useful and reliable tool as possible. Any advice would be greatly appreciated.


Top
 Profile  
 
 Post subject: Re: Can I get a few advices on my plugin
PostPosted: Mon Mar 04, 2013 12:10 pm 
Offline
Cacti User

Joined: Fri Sep 28, 2012 6:52 pm
Posts: 111
bumping this so at least maybe I can get an answer


Top
 Profile  
 
 Post subject: Re: Can I get a few advices on my plugin
PostPosted: Mon Mar 04, 2013 12:41 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Jan 31, 2008 6:39 am
Posts: 2580
Location: Kressbronn, Germany
Well, cacti is storing the number of total and failed polls it did for a device.

I am using that as a reference and am calculating the difference between the current and previous poll.

So for every polling cycle you end up with a number for the total polls and the failed polls.

Now this number depends on the number of graphs/datasources you add to a device. E.g. A linux system where you only monitor cpu usage, the number of polls is always one. So if it fails, the availability is 0.
If you monitor a switch with multiple ports, the number of polls is higher, so if one of these fails, you will still get an availability higer than zero. E.g if one out of ten polls fail, the availability is still 90%

The table still grows quite fast, but i used the same method as rrd using some aggregation. e.g. Summing up all total/failed polls to 1hour, 1 day, 1 week...

I have also added some mehtods for adding outtages, planned and unplanned ones.

I am thinking of, oving this out of cereusreporting into a separate plugin as the code and calculations are quite complex ( especially when adding sla/non sla relevant times ).

_________________
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusTransporter | CereusReporting | nmidWebService | nmidSmokeping | nmidWeb2 |

Code:
CereusServer Master:  SYSTEM STATS: Time:2.5621 Method:spine Processes:1 Threads:16 Hosts:446 HostsPerProcess:446 DataSources:14683 RRDsProcessed:7573
CereusServer Agent:   SYSTEM STATS: Time:27.4840 Method:spine Processes:1 Threads:8 Hosts:16 HostsPerProcess:16 DataSources:114576 RRDsProcessed:48061


Top
 Profile  
 
 Post subject: Re: Can I get a few advices on my plugin
PostPosted: Mon Mar 04, 2013 1:33 pm 
Offline
Cacti User

Joined: Fri Sep 28, 2012 6:52 pm
Posts: 111
Hmm, the idea of planned / non-planned outages is interesting. Going a bit off-topic, I wonder about a way to tell Cacti that such device is on a scheduled downtime, and... well, that's a story for another time.


On-topic: the total/failed polls columns might suffice for certain scenarios. I've thought about using them at first. However, I wouldn't be able to do the following example (at least not the exact way it is right now):

-Jan. 1st to Jan. 31th => 92% Uptime
-Feb. 1st to Feb. 28th => 85% Uptime

You see, the current way in which Cacti deals with availability is by adding up only to an absolute value (since the device first started being monitored), instead of associating availability values to a certain slot in time.

As I said on the opening comment, storing associated time values on MySQL proved expensive, so I turned to RRDtool since it already does that for you. You just have to read it.

Anyway, by the time I'm writing this, I'm sort of realizing a way to solve my problem. I might include a certain Data Source (Uptime, probably) AND associated graph as a dependency altogether, and just be happy from there. Will see how it works.

Thanks for answering


Top
 Profile  
 
 Post subject: Re: Can I get a few advices on my plugin
PostPosted: Mon Mar 04, 2013 1:39 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Jan 31, 2008 6:39 am
Posts: 2580
Location: Kressbronn, Germany
Yes understood, and i have read your post. It is just a matter of requirements. Mine was to create a nice sla graph including the outtages, so rrdtool wasn't really an option.

But it can be easily implemented in rrd files and you would be able to get the numbers you posted easily from them.

Still, sla numbers are like going to rome. There are multiple ways of creating them :-)

_________________
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusTransporter | CereusReporting | nmidWebService | nmidSmokeping | nmidWeb2 |

Code:
CereusServer Master:  SYSTEM STATS: Time:2.5621 Method:spine Processes:1 Threads:16 Hosts:446 HostsPerProcess:446 DataSources:14683 RRDsProcessed:7573
CereusServer Agent:   SYSTEM STATS: Time:27.4840 Method:spine Processes:1 Threads:8 Hosts:16 HostsPerProcess:16 DataSources:114576 RRDsProcessed:48061


Top
 Profile  
 
 Post subject: Re: Can I get a few advices on my plugin
PostPosted: Mon Mar 04, 2013 1:53 pm 
Offline
Cacti User

Joined: Fri Sep 28, 2012 6:52 pm
Posts: 111
Hmm...

For planned outages, imagine sending Cacti a flag that informs when a host goes down, and send another one when it comes back up. Also, keep the time values associated with those flags.

When it comes back online, you perform a PREDICT routine between the values right before and right after said outage.

In my head, it could work. Just a thought, anyway.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group