(SOLVED)Custom "SS + Data Source", data breaks after X items

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
tarre
Posts: 12
Joined: Wed Mar 05, 2008 6:15 am

(SOLVED)Custom "SS + Data Source", data breaks after X items

Post by tarre »

Hi all!
I face a problem, maybe with some kind of limitation in "Data Source Items".

1)
I have made a Server Script in php. It gathers an SNMP STRING of 64 bits, where each bit represent some kind of boolean status.
The script returns the processed string.

As example, the script:
fetches: 000110 (...)
returns: fan1_fail:0 fan2_fail:0 fan3_fail:0 online:1 communications_ok:1 blablabla:0 (...)

So in this example i wrote 6, but i have 64 different data items.
As far as i can see, the script works ok.
Captura2.PNG
Captura2.PNG (68.71 KiB) Viewed 599 times
2)
I have made a Data Source Template that gets all that 64 "Data source items".
I have mapped the variables there.
Captura3.PNG
Captura3.PNG (74.13 KiB) Viewed 599 times
3)
i have made a Graph Template (just for tests) (incomplete, only 15-16 data items).
Captura4.PNG
Captura4.PNG (93.36 KiB) Viewed 599 times

4)
i have made the graph for a device


5)
i found a problem using spine (default result limit is 1024 characters, i compiled it again with 2048 to support all those items).

-----

All looks OK, but when i have review the "Data Source" for this device, i have found that "Data items after #22 are not getting populated".

I dont see any problem in cLog

Is there some kind of restriction in the amount of Data Items that a Data Source can handle?
Can someone point me to some log/checks?

Captura1.PNG
Captura1.PNG (88.77 KiB) Viewed 599 times


Thanks in advance!
Regards, Daniel
Last edited by tarre on Tue Jun 05, 2018 6:59 am, edited 2 times in total.
tarre
Posts: 12
Joined: Wed Mar 05, 2008 6:15 am

Re: Custom "SS + Data Source", data break after 22 items pro

Post by tarre »

Ok, it has something to do with stuff outside Cacti.
As i read in this forum, maybe there are also "Operative System" argument limit.

i have modified the script output to something more simple, as for example:
where it return "some_fancy_variable_name:1", now it return "data_1:1".

With just this change, Cacti now stores properly 51 Data Sources versus the 15-16 previous.
Great! =)
Captura5.PNG
Captura5.PNG (56.84 KiB) Viewed 579 times
I'm going to try "shortning" the output even more, and i will post results here.
tarre
Posts: 12
Joined: Wed Mar 05, 2008 6:15 am

Re: Custom "SS + Data Source", data break after 22 items pro

Post by tarre »

Now that i have reduced the script output even more, Cacti is properly getting all the data and storing it properly.
Captura6.PNG
Captura6.PNG (64.19 KiB) Viewed 578 times
Time to display all data sources in graph, tidy all stuff, and i will post the template.

Regards!
User avatar
Osiris
Cacti Guru User
Posts: 1424
Joined: Mon Jan 05, 2015 10:10 am

Re: (SOLVED)Custom "SS + Data Source", data breaks after X i

Post by Osiris »

I have a position on this that you may or may not agree with. I would break this into a simple script that does the following:

1) One data source per RRD
2) Script that takes the data source name as in input variable and echos one response
3) In that script, you first check for the timestamp in /tmp/cacti/$monitoredhost/apcstat.out and if it's older than X minute where X is the sampling rate run the entire script, and output to that file as new
4) Grep out and echo the value afterwards.

This way, the data is returned only once and all subsequent calls during the same sampling time will simply grep out the result. You could also do this with a MySQL table too. I would label the table something like apc_stats with the following columns host_id, name, value, update_time. Then instead of using the temporary file, you would simply look at the timestamp in update_time, and if the time was old, then update the values.

By using this approach, you do not need a real wide column in the poller_output and poller_output_boost tables, you won't have to deal with an ugly RRDfile and you will maintain real good performance.
Before history, there was a paradise, now dust.
tarre
Posts: 12
Joined: Wed Mar 05, 2008 6:15 am

Re: (SOLVED)Custom "SS + Data Source", data breaks after X i

Post by tarre »

Osiris wrote:I have a position on this that you may or may not agree with. I would break this into a simple script that does the following:

1) One data source per RRD
2) Script that takes the data source name as in input variable and echos one response
3) In that script, you first check for the timestamp in /tmp/cacti/$monitoredhost/apcstat.out and if it's older than X minute where X is the sampling rate run the entire script, and output to that file as new
4) Grep out and echo the value afterwards.

This way, the data is returned only once and all subsequent calls during the same sampling time will simply grep out the result. You could also do this with a MySQL table too. I would label the table something like apc_stats with the following columns host_id, name, value, update_time. Then instead of using the temporary file, you would simply look at the timestamp in update_time, and if the time was old, then update the values.

By using this approach, you do not need a real wide column in the poller_output and poller_output_boost tables, you won't have to deal with an ugly RRDfile and you will maintain real good performance.
Oh thanks, that looks to me a smarter approach :) It's my very first attempt to make a Cacti Template
I already faced the problem with ugly RRD Data, and the output nightmare, and it look like i was making a base mistake.

The cache for the script will solve the problem with "multiple subsecuent calls", so then allow us to simplify the "Data Input" / "Data Source" / Variables mapping a lot.

I will post the work done now as it works, but as soon as i can i will try to improve this template that way.
Tnx Osiris, regards, t
tarre
Posts: 12
Joined: Wed Mar 05, 2008 6:15 am

Re: (SOLVED)Custom "SS + Data Source", data breaks after X i

Post by tarre »

Here comes the template. I'm learning, i'm noob, don't expect this to work.
Any feedback will be appreciated.
It's on the roadmap to apply the previous post idea from Osiris.

APC Smart UPS - Basic Status - Template
tarre
Posts: 12
Joined: Wed Mar 05, 2008 6:15 am

Re: (SOLVED)Custom "SS + Data Source", data breaks after X i

Post by tarre »

Here i have post this "beta" template, and all others i made around APC Smart UPS device.
Hope that help others.

viewtopic.php?f=12&t=58848
tarre
Posts: 12
Joined: Wed Mar 05, 2008 6:15 am

Re: (SOLVED)Custom "SS + Data Source", data breaks after X i

Post by tarre »

And here is the script, beta version, working:
ss_ups_basicstatus.zip
(1.67 KiB) Downloaded 26 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest