Combining different data in one gprint or comment

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

Moderators: Moderators, Developers

Post Reply
Author
Message
wvr120364
Posts: 16
Joined: Tue May 06, 2003 7:48 am

Combining different data in one gprint or comment

#1 Post by wvr120364 » Thu Nov 10, 2005 2:32 pm

Hello,
I've written a perl script that feeds the following data into cacti:

Code: Select all

uptime_sec:12345678 days:2 hrs:14 min:32
So far so good, i created the data source for uptime_sec and graphed it with a cdef funtion to display the uptime in days.

My question is, is there a way to combine the other values into one comment or gprint so the uptime is readable in the following way:

Code: Select all

Uptime (syslog): 2 days, 14 hrs. and 32 min.
I searched the forum for this and could not find a solution for Windows, just a patch for *nix.

Thanks,
Wietze

User avatar
gandalf
Developer
Posts: 22375
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

#2 Post by gandalf » Sat Nov 12, 2005 5:50 am

There's a Template for Generic - Uptime on the forum. It solves this issue by converting the seconds to days, minutes, seconds using three different CDEFs and printing the according GPRINTS in a single line. Not exactly what you asked for, but a possible workaround ...
Reinhard

wvr120364
Posts: 16
Joined: Tue May 06, 2003 7:48 am

#3 Post by wvr120364 » Sat Nov 12, 2005 10:26 am

Thank you Reinhard, I'll give it a try.

Wietze

Post Reply