Can I get a few advices on my plugin

Discussions on developing plugins for the Cacti Plugin Architecture

Moderators: Developers, Moderators

Post Reply
victorantunes
Cacti User
Posts: 111
Joined: Fri Sep 28, 2012 6:52 pm

Can I get a few advices on my plugin

Post by victorantunes »

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.
victorantunes
Cacti User
Posts: 111
Joined: Fri Sep 28, 2012 6:52 pm

Re: Can I get a few advices on my plugin

Post by victorantunes »

bumping this so at least maybe I can get an answer
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Can I get a few advices on my plugin

Post by phalek »

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 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
victorantunes
Cacti User
Posts: 111
Joined: Fri Sep 28, 2012 6:52 pm

Re: Can I get a few advices on my plugin

Post by victorantunes »

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
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Can I get a few advices on my plugin

Post by phalek »

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 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
victorantunes
Cacti User
Posts: 111
Joined: Fri Sep 28, 2012 6:52 pm

Re: Can I get a few advices on my plugin

Post by victorantunes »

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.
netniV
Cacti Guru User
Posts: 3440
Joined: Sun Aug 27, 2017 12:05 am

Re: Can I get a few advices on my plugin

Post by netniV »

If you look at plugin_maint on our repos, this does allow for scheduled downtime. Whether it fits exactly what you want, I don't know.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests