Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Tue Jun 25, 2019 3:00 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Can the uptime be added to a template?
PostPosted: Tue Apr 17, 2018 7:44 am 
Offline
Cacti User
User avatar

Joined: Fri Feb 10, 2017 2:45 pm
Posts: 240
Location: Long Island, New York, USA
The subject says it all.

Thanks.

_________________
See the Cacti 1.x templates I use at: http://www.camerabob.com/cacti

Live: Cacti 1.2.3 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Test: Cacti 1.2.4 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4


Top
 Profile  
 
 Post subject: Re: Can the uptime be added to a template?
PostPosted: Tue Apr 17, 2018 1:52 pm 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 2523
Can you be more clear what you are after?

_________________
Official Cacti Developer

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

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
 Post subject: Re: Can the uptime be added to a template?
PostPosted: Tue Apr 17, 2018 2:45 pm 
Offline
Cacti User
User avatar

Joined: Fri Feb 10, 2017 2:45 pm
Posts: 240
Location: Long Island, New York, USA
On an interface graph, say bits in/out. I would like to display the device's up time to add some usefulness to the total data counts.

_________________
See the Cacti 1.x templates I use at: http://www.camerabob.com/cacti

Live: Cacti 1.2.3 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Test: Cacti 1.2.4 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4


Top
 Profile  
 
 Post subject: Re: Can the uptime be added to a template?
PostPosted: Tue Apr 17, 2018 4:26 pm 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 2523
The problem is, the uptime is actually stored and read as such:
Code:
$snmp_uptime = $host['snmp_sysUpTimeInstance'];
$days      = intval($snmp_uptime / (60*60*24*100));
$remainder = $snmp_uptime % (60*60*24*100);
$hours     = intval($remainder / (60*60*100));
$remainder = $remainder % (60*60*100);
$minutes   = intval($remainder / (60*100));
$uptime    = $days . 'd:' . $hours . 'h:' . $minutes . 'm';


So, you'd need to basically find a way to do the same via a CDEF or VDEF and then include that onto the graph. Though I'm not sure if you can get at snmp_sysUpTimeInstance from there.

_________________
Official Cacti Developer

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

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
 Post subject: Re: Can the uptime be added to a template?
PostPosted: Wed Apr 18, 2018 8:04 am 
Offline
Cacti User
User avatar

Joined: Fri Feb 10, 2017 2:45 pm
Posts: 240
Location: Long Island, New York, USA
Ugh. That looks like work... Thank you. :roll:

_________________
See the Cacti 1.x templates I use at: http://www.camerabob.com/cacti

Live: Cacti 1.2.3 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Test: Cacti 1.2.4 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4


Top
 Profile  
 
 Post subject: Re: Can the uptime be added to a template?
PostPosted: Wed Apr 18, 2018 2:11 pm 
Offline
Cacti Guru User

Joined: Sun Aug 27, 2017 12:05 am
Posts: 2523
What I would do is raise this as an enhancement on the GitHub issues, as it can then be looked at to be added as a core option... making your life a lot easier when it eventually gets introduced :D

_________________
Official Cacti Developer

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

My resources:
How to submit Pull Requests
Development Wiki and How To's
Updated NetSNMP Memory template for Cacti 1.x
Cisco SFP template for Cacti 0.8.8


Top
 Profile  
 
 Post subject: Re: Can the uptime be added to a template?
PostPosted: Wed Apr 18, 2018 3:19 pm 
Offline
Cacti User
User avatar

Joined: Fri Feb 10, 2017 2:45 pm
Posts: 240
Location: Long Island, New York, USA
Done. Thanks.

_________________
See the Cacti 1.x templates I use at: http://www.camerabob.com/cacti

Live: Cacti 1.2.3 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Test: Cacti 1.2.4 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4


Top
 Profile  
 
 Post subject: Re: Can the uptime be added to a template?
PostPosted: Fri Apr 20, 2018 1:24 pm 
Offline
Cacti User
User avatar

Joined: Fri Feb 10, 2017 2:45 pm
Posts: 240
Location: Long Island, New York, USA
This isn't such a big deal now. I realized that the total data counts represented on the graph are for the time span the graph covers. Uptime of the device overall since last boot is sort of moot at this point. It's nice to have but is more or less irrelevant to the graph.

_________________
See the Cacti 1.x templates I use at: http://www.camerabob.com/cacti

Live: Cacti 1.2.3 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4

Test: Cacti 1.2.4 @ CentOS 7-6.1810.2.el7 & PHP 5.4.16-46.el7
Maint @ 1.2
Monitor @ 2.3.6
Thold @ 1.2.4


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group