text-status rather than numeric-status
Moderators: Developers, Moderators
text-status rather than numeric-status
Hi There!
I searched the man-pages of RRDTool, many tutorials and the forum for this topic, but couldn't found one. Maybe someone could give me a pointer, how to do this.
I've some graphs, displaying the port-status of an ethernet-device. After some cdef-transformation, the status is now displayed as value of 0 (down) and 1 (up). The "current:" Item of the graph (actually the "last"-value of the rra) also shows the numerical value.
But I'd rather displayed the status as text for this item.
I tried to convert the value through a cdef-function into text, but couldn't achive the result I hoped for. It seems, the "last"-value is displayed as numerical value only.
I know, this is more a rrd-tool related topic, but I expected some experience in this community.
best regards
Andreas
I searched the man-pages of RRDTool, many tutorials and the forum for this topic, but couldn't found one. Maybe someone could give me a pointer, how to do this.
I've some graphs, displaying the port-status of an ethernet-device. After some cdef-transformation, the status is now displayed as value of 0 (down) and 1 (up). The "current:" Item of the graph (actually the "last"-value of the rra) also shows the numerical value.
But I'd rather displayed the status as text for this item.
I tried to convert the value through a cdef-function into text, but couldn't achive the result I hoped for. It seems, the "last"-value is displayed as numerical value only.
I know, this is more a rrd-tool related topic, but I expected some experience in this community.
best regards
Andreas
- TheWitness
- Developer
- Posts: 17059
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Andreas,
RRDtool stores only numeric integer and float data, if you have something else to store, you will have to use a different method. If you have a string value that contains a numeric value, the parsing functions in spine and cmd.php take care of stripping the non-numieric data.
If you are attampting to do anything with string data, it's likely not used in graphing, else you should consider a data query.
Can you provide more details?
TheWitness
RRDtool stores only numeric integer and float data, if you have something else to store, you will have to use a different method. If you have a string value that contains a numeric value, the parsing functions in spine and cmd.php take care of stripping the non-numieric data.
If you are attampting to do anything with string data, it's likely not used in graphing, else you should consider a data query.
Can you provide more details?
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
I don't have to collect or store string data.
It's the SNMP-Data for interface port status (Integer value). The Data is collected with numercial values of 1's (up) and 2's (down).
I created a CDEF, which transforms from the collected data by cdef=Current_Data,-1,*,2,+; [which should be cdef=-x+2]). Now the Port Status is 0 (for down) and 1 (for up). Then I created a graph-template which shows the values as a graph and the current status as numerical value:
This works fine, but what I want is something like:
I thought this could achived by writing a cdef, which "transforms" the value to string using a "if". This value hasn't to be stored, it should be used only, for creating graphs.
I toyed something with Graph-Debug mode and rrdtool returned "invalid expression in rpn" whenever I used quoted strings. I guess there is no way to transform the data to string or change the displayed "Current:" depending on the value.
It's the SNMP-Data for interface port status (Integer value). The Data is collected with numercial values of 1's (up) and 2's (down).
I created a CDEF, which transforms from the collected data by cdef=Current_Data,-1,*,2,+; [which should be cdef=-x+2]). Now the Port Status is 0 (for down) and 1 (for up). Then I created a graph-template which shows the values as a graph and the current status as numerical value:
Code: Select all
current: 1.0
Code: Select all
current: up
I toyed something with Graph-Debug mode and rrdtool returned "invalid expression in rpn" whenever I used quoted strings. I guess there is no way to transform the data to string or change the displayed "Current:" depending on the value.
- TheWitness
- Developer
- Posts: 17059
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Yea, that is a problem. You really need to use a comment. However, there is presently no special function to convert RRDtool output to a comment string. We have hacks like this for other RRDtool limitation's, but now what you have described.
I would like to see if Gandolf has any suggestions.
TheWitness
I would like to see if Gandolf has any suggestions.
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Perhaps there is a way when leaving rrdtool completely out of the picture. You know, when using a Data Query, Cacti will store results from <direction>input</direction> into the poller_cache. And using |query_*| magic will allow printing at least in COMMENTs. I suppose GPRINTs won't work.reboot3d wrote:Great! Thanks for your time!
If this would be a "clean" hack, I have more use for this. There are many MIB's that have numerical values for status information. E.g. for printer: toner level - "full,available,depleted".
Andreas
Everything said is derived from pure theory. But it may be enough to give it a try.
Reinhard
This works!gandalf wrote:Perhaps there is a way when leaving rrdtool completely out of the picture. You know, when using a Data Query, Cacti will store results from <direction>input</direction> into the poller_cache. And using |query_*| magic will allow printing at least in COMMENTs. I suppose GPRINTs won't work.
Everything said is derived from pure theory. But it may be enough to give it a try.
Reinhard
Wow, I didn't knew the |query_*| could be used elsewhere than in titles. Is this somewhere in the manual? Did I missed it?
Thanks anyway. This leaves me with some opportunities ...
Have a nice day!
Andreas
- Attachments
-
- the resulting graph
- graph_image.php.png (17.17 KiB) Viewed 4028 times
-
- the items of the graph template
- port_status.jpg (20.46 KiB) Viewed 4028 times
Well, It's not working.
The |query_*| get it's data from the snmp-cache. So the displayed status is not the current, but the status when the cache was build. If a status-data is not in the cache, the |query_*| is displayed.
Hmm, forcing the cache to be rebuilded every 5 minutes? or giving up?
I guess, I return to my numerical values.
Greetings
Andreas
The |query_*| get it's data from the snmp-cache. So the displayed status is not the current, but the status when the cache was build. If a status-data is not in the cache, the |query_*| is displayed.
Hmm, forcing the cache to be rebuilded every 5 minutes? or giving up?
I guess, I return to my numerical values.
Greetings
Andreas
@gandalfgandalf wrote:You would need to "rebuild the cache of this data query" by changing the re-index option to make cacti re-index quite every polling interval. That will surely add additional load. But that's the best I can achive
Reinhard
Thanks, I appreciate your help. This wouldn't work in my case either. Since I display the status in a graph, and would use the pipes |query_ifOperStatus| the ifOperStatus must be defined input and output in the XML-file, as I understand now.
Wait, this gives me an idea! I duplicate the entry with the same oid, but under a different name.
I tell you the result.
@chino
Thanks. I consider your suggestion, when I write a multiple-state monitoring .It looks quiet good. For now I have only two states, which are represented in the timeline quite well for my purposes.
Greetings
Andreas
Ok, I edited the interface.xml and duplicated the <ifOperStatus> field. now it looks like this:
The first one will be used in |query_ifOperStatus| as Comment in the graphs, and the second one will be used as graphable values. ("the timeline")
The changes in the graph template are like above, only the data template had to be changed to ifOperState as DataSource. Well, no great loss. And now I re-index all devices after the poller had run.
Thanks again to all of you!
Andreas
Code: Select all
<ifOperStatus>
<name>Status</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.2.1.2.2.1.8</oid>
</ifOperStatus>
<ifOperState>
<name>Status</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.2.1.2.2.1.8</oid>
</ifOperState>
The changes in the graph template are like above, only the data template had to be changed to ifOperState as DataSource. Well, no great loss. And now I re-index all devices after the poller had run.
Thanks again to all of you!
Andreas
Who is online
Users browsing this forum: No registered users and 1 guest