Why are DSes downcased?

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

Moderators: Developers, Moderators

Post Reply
jwiegley
Posts: 31
Joined: Mon Feb 04, 2002 7:00 pm

Post by jwiegley »

It seems annoying to take what entered for the name of a Data Source and then downcase it in the rrd file.</P>
Is this something that can be fixed in cacti or does rrdtool downcase all DS names?</P>

I named something "Foundry_1_01" from "create graph" on the SNMP interfaces. Which created source Foundry_1_01_in and Foundry_1_01_out but the rrd files seems to have "foundry_1_01_in" (downcased).</P>

In general I keep coming up against nomenclature restrictions in cacti and this is annoying. Why am I restricted to a subset of characters and limits on length. Attempts should be made to move away from these arbitrary limits unless its a problem with rrdtool or php or other things that aren't coded by cacti. If I can type in a field box I should be able to use it the way I typed it.</p>
User avatar
drub
Cacti User
Posts: 59
Joined: Thu Jan 31, 2002 7:00 pm
Location: Las Vegas
Contact:

Post by drub »

I think you have to use lowercase names for datasources, or rrd files in 0.6.4 if you create a datasource with any uppercase characters it will create the rrd file with uppercase, but will not graph at all, so it must be an rrdtool restriction, but on your Graph titles you can calle them anything you want.
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

I definetely understand your concern. I find it annoying also when what I type is different than what is saved.

The only reason I ever implimented these 'santity checks' are because of rrdtool restrictions and not by cacti. I could care less what a data source is named. However rrdtool requires that this name is less than 19 characters and cannot include other characters.

My problem is; what if a user types 'Traffic Incoming' in a data source name box? If I did nothing about this, we would end up with a non-working graph/data source. Here are some options:

- Right now cacti will try and 'fix' the name and make it rrdtool-appropraite. And put that value in the 'Internal Data Source' field.
- Perhaps cacti should just warn the user if the data source name is invalid.
- Cacti could have some sort of default internal data source name (like MRTG) and allow the user to name the data source anything they want. (I like this option the best).

I want this problem fixed for the next release, so any feedback would be appriciated.

-Ian
jwiegley
Posts: 31
Joined: Mon Feb 04, 2002 7:00 pm

Post by jwiegley »

Ok. I understand about it being an RRDTool limitation. RRDTool should not have assumed such a limited and arbitrary set of limitations.

I would consider two solutions acceptable:
<OL>
<LI>have cacti simply reject invalid names. If the user inputs an unacceptable name then
the request should be ignored and an error page presented. The user should be informed
by the page with the field exactly what characters are allowed. A regular expression
would be sufficient: [a-z0-9_] add in any
others that I've left out. Also the field
box should only be large enough to store the
maximum number of allowed characters.
<LI>(more programming intensive) Simply abstract the RRD DS name from the Cacti DS name. add a relationship in the MySQL database for mapping the DS names when needed. In fact this might be overkill. Since each cacti datasource has a single rra file associated with it and each rra file holds exactly one DS name I don't see why we couldn't use the same RRD DS name in each database. so that: the cacti DS name could be anything the user wants. The DS name in the resulting RRA file would always be "cacti".

But for long term flexibility I would stay away from the unified name and put in the programming effort to support arbitrary cacti and RRD DS names. That way if the function of storing multiple DS items in a single RRA file becomes possible cacti would be able to support it.
</OL>

If abstracting this layer is chosen then I would enable cacti with a simply algorithm:
cacti DS names are:
<OL>
<LI>downcased
<LI>truncated to the maximum length
<LI>non-acceptable characters are mapped to
'_'<LI>the last chracters are replaced with
incrementing numerical digits to acheive unique RRD DS names.
</OL>
Thus: "A very long$NAME" would become
"a_very_long_name". and "A very$long NAME"
would become "a_very_long_nam0" (assuming
the length limit was 16)
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

I did a little hacking last night and feel this this will work best. Let me explain how I have it working.

- ANYTIME a data source is saved; it is passed through a "filter" function that cleans up the name for rrdtool. This "cleaned up" name as saved into the "Internal Data Source" field, while the "Name" field retains its orgional value. The "cleaned up" name also gets a ".rrd" appended to it, and is used for the actual filename.
- Returning an error like you suggested would work, but would impose rrdtool's name limitations on cacti. This way you can still name the data sources whatever you want, and still get a working rrdtool data source name out of it.
- In the future when I impliment multiple data sources per .rrd file support; this should scale well there too.

One of the problems with 0.6.4 is that it tried to "guess" when a modified name was needed and this did not always work. Also, when using the "Make Graph" feature the data source names did not always stay in sync with that cacti thought they should be. Now every data source name is passed through the same function for checking.

Tell me if you have any additional thoughts.

-Ian
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests