Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Thu Jul 27, 2017 9:19 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 114 posts ]  Go to page 1, 2, 3, 4, 5 ... 8  Next
Author Message
 Post subject: Uptime plugin (reboot monitor)
PostPosted: Fri May 12, 2006 3:05 pm 
Offline
Cacti User
User avatar

Joined: Tue Jul 12, 2005 8:16 pm
Posts: 250
08/04/2008
http://gilles.boulon.free.fr/uptime/uptime-0.4.zip

Obsolete :
http://gilles.boulon.free.fr/uptime/uptime-0.3.rar

like suggesting by torstentfk, i think that Cacti must checks the uptime of
devices, and signal if the device has rebooted.

originals posts :
http://forums.cacti.net/about6508-0-asc-495.html
http://cactiusers.org/forums/topic253.html


so i have done this plugin, using thold and working with cactid


1. decompress plugin in <cacti base dir>\plugins\uptime

2. install plugin (see plugin architecture documentation)

3. optionnaly, use patched host.php (ONLY with Plugin Architecture 0.9)
(this file is only here to add fonctionnality to Uptime and Monitor plugins)

TODO :
i don't need them but all features i want to include are already in thold :
- weekend or hours exception (because my windows servers are rebooted the weekend...)
- global or extra notify...

NB :
for hours exception in thold, see this :
http://cactiusers.org/forums/viewtopic.php?p=1224#1224


Attachments:
File comment: uptime1
uptime2.png
uptime2.png [ 31.02 KiB | Viewed 55581 times ]
File comment: auth
auth.png
auth.png [ 9.72 KiB | Viewed 55582 times ]
File comment: hosts
host.png
host.png [ 29.8 KiB | Viewed 55981 times ]
File comment: devices
devices.png
devices.png [ 12.31 KiB | Viewed 55982 times ]


Last edited by gilles on Tue Apr 08, 2008 2:51 pm, edited 6 times in total.
Top
 Profile  
 
 Post subject:
PostPosted: Sat May 13, 2006 9:54 am 
Offline
Cacti User
User avatar

Joined: Wed Mar 30, 2005 6:48 pm
Posts: 80
Location: BRAZIL/Brasilia
gilles,

Great plugin!
I have just a little suggestion...
Change the line:
Code:
print round(($q_row["uptime"])/8640000, 1) . "d " . (($q_row["uptime"])%8640000)/360000) . "h";
to:
Code:
$days=floor(($q_row["uptime"]/8640000));
$hours=floor((($q_row["uptime"]%8640000)/360000));
$minutes=floor(((($q_row["uptime"]%8640000)%360000)/6000));
print $days . "d " . $hours . "h " . $minutes ."m";

Thanks in advance!
(...and sorry for my poor English!)

_________________
Thanks in advance!
(And sorry for my poor English...)
_______________________________________
twelzy (Enio Sanches)


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 13, 2006 10:10 am 
Offline
Cacti User
User avatar

Joined: Wed Mar 30, 2005 6:48 pm
Posts: 80
Location: BRAZIL/Brasilia
gilles,

I just received +1300 e-mails with the subject "Reboot detected of host:..." from all my hosts that are "Disabled" or "Down"!!!
There is any way to correct this?!
I think that the Uptime plugin should send e-amil only when a reboot is detected in a host, and not when a host is down or when it is disabled!

Thanks in advance!
(...and sorry for my poor English!)

_________________
Thanks in advance!
(And sorry for my poor English...)
_______________________________________
twelzy (Enio Sanches)


Top
 Profile  
 
 Post subject:
PostPosted: Sat May 13, 2006 10:21 pm 
Offline
Cacti User
User avatar

Joined: Tue Jul 12, 2005 8:16 pm
Posts: 250
I thank you for your message.

twelzy wrote:
I think that the Uptime plugin should send e-amil only when a reboot is detected in a host, and not when a host is down or when it is disabled!


I have updated the plugin.

Now, it check if host is down or disabled.

I have also resolve a bug for the checkbox "check uptime".

I have updated too "host.php".

I'm going to see a method to clean the table "uptime" when you delete a host.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 15, 2006 5:05 am 
Offline
Cacti User

Joined: Tue Apr 05, 2005 9:52 am
Posts: 367
Location: Munich, Germany
Hi,

I am happy that my suggestion is now ready for a plugin.
I change my installation and found some issues:
- the sorting o fthe uptime is not correct.
Please use BIGINT as the type of uptime not strings.
- the sort for Uptime-ASC/DESC does not remove other sorting. everytime i click on Uptime (for resorting) I get different views.
- posibility for mass-change to enable all hosts to check uptime.
(I made this via phpmyadmin)

...Works great!

Torsten


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 15, 2006 1:18 pm 
Offline
Cacti User
User avatar

Joined: Tue Jul 12, 2005 8:16 pm
Posts: 250
torstentfk wrote:
Please use BIGINT as the type of uptime not strings.
- posibility for mass-change to enable all hosts to check uptime.
Torsten


Done.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 18, 2006 1:20 pm 
Offline
Cacti User
User avatar

Joined: Tue Jul 12, 2005 8:16 pm
Posts: 250
Uptime plugin has been updated.


Attachments:
File comment: tab
tab_uptime.gif
tab_uptime.gif [ 2.31 KiB | Viewed 55578 times ]
Top
 Profile  
 
 Post subject:
PostPosted: Thu May 25, 2006 12:11 pm 
Offline

Joined: Thu Feb 16, 2006 12:49 pm
Posts: 42
I have installed the uptime plugin and it is working as I see the uptime on the devices page, but when I go to the "Uptime" tab, none of the systems that I have chosen to be monitored are listed? I noticed in your images that you have an option to monitor uptime in the drop down menu that I do not have (I have the checkbox on the individual devices page). Am I missing a step somewhere or would this be a part of the patched host file that is included? thanks.

***EDIT*** Sorry, just used the patched host.php file and it does add the uptime option to the drop down menu and also just realized that the "Uptime" tab lists last reboot and since none of my systems have been rebooted, probably explains why there is no data there. :oops:


Top
 Profile  
 
 Post subject: might be install problem
PostPosted: Tue Jun 06, 2006 1:00 am 
Offline
Cacti User

Joined: Fri Aug 22, 2003 4:33 am
Posts: 83
Its not showing any thing on the devices page....do i need to install the .sql file with the command mysql -p cacti < uptime.sql.....provided in the rar file....its showing N/A....but i have snmp enabled on all the devices....

Chetan Jain.


Top
 Profile  
 
 Post subject: problem uptime
PostPosted: Mon Jun 12, 2006 2:47 am 
Offline

Joined: Fri Jun 02, 2006 4:41 am
Posts: 4
I received 100 e-mails with the subject "Reboot detected of host:..." everyday

Directory: uptime
Version: 0.3
Author: Gilles Boulon
Home Page: http://forums.cacti.net/viewtopic.php?t=13510

Please help me


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 20, 2006 2:36 am 
Offline
Cacti User

Joined: Tue Apr 05, 2005 9:52 am
Posts: 367
Location: Munich, Germany
Hi,

the reboot-monitor alert if the device is more than 497 days up, Mail:
"Host : xxxxx, old uptime was : 4294951006 (497.1d), new is : 13353 (0d)"
(The snmp-variable only stores 32bit of ticks=497 days)

It would be nice, if the plugin checks the old uptime and if it detects a reboot it should check also the uptime beeing between 497 and 498 days. If it is so there should be no alarm.

Torsten


Top
 Profile  
 
 Post subject: Great Tool.. feature suggestion
PostPosted: Tue Jun 20, 2006 10:55 am 
Offline

Joined: Sat Oct 15, 2005 9:34 pm
Posts: 22
Great plugin work !!

This has been working very well in our case, I would like to offer a feature suggestion. Our network has many technicians for many different circuts. We monitor links for other companies as well.. I would like to be able to send individual notices for each device to only certain technicians. For example, reboots should notify:

device1 : [email protected] , [email protected]
device2 : [email protected] , [email protected]

Is that something that can be coded into the plugin?

Thanks !!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 28, 2006 5:02 am 
Offline
Cacti User

Joined: Tue Apr 05, 2005 9:52 am
Posts: 367
Location: Munich, Germany
torstentfk wrote:
Hi,

the reboot-monitor alert if the device is more than 497 days up, Mail:
"Host : xxxxx, old uptime was : 4294951006 (497.1d), new is : 13353 (0d)"
(The snmp-variable only stores 32bit of ticks=497 days)

It would be nice, if the plugin checks the old uptime and if it detects a reboot it should check also the uptime beeing between 497 and 498 days. If it is so there should be no alarm.

Torsten

Found time to change it: file "check-uptime"
Insert before last if-Statement: if (($old_uptime<4294937286) || ($old_uptime>4294967297)) {
insert after befor last 3rd } another }to close the new if-statement

Also changed the thold_mail - function call:
thold_mail($global_alert_address, '', 'Reboot detected at' . $reboot_date . ' of host : ' . $q_row........

Torsten


Last edited by torstentfk on Tue Jul 11, 2006 2:52 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 07, 2006 9:20 am 
Offline
Cacti User

Joined: Tue Apr 05, 2005 9:52 am
Posts: 367
Location: Munich, Germany
Hello developer,

found a bug for computing the uptime at host.php. The floor function could not read BIGINT or it does not run with very big numbers.
I changed this:
Code:
# diff host.new  host.php
835,836c835
<       $sql_where =" ON host.id=uptime.id ";
<     $sql_where .= "where (host.hostname like '%%" . $_REQUEST["filter"] . "%%' OR host.description like '%%" . $_REQUEST["filter"] . "%%')";
---
>     $sql_where = "where (host.hostname like '%%" . $_REQUEST["filter"] . "%%' OR host.description like '%%" . $_REQUEST["filter"] . "%%')";
852a852
>
857c857
<               from host LEFT JOIN uptime
---
>               from host
870,872c870,871
<               host.availability,
<                 uptime.uptime
<               FROM host LEFT JOIN uptime
---
>               host.availability
>               FROM host
909c908
<               "avg_time" => array("Average (ms)", "DESC"),
---
>               "avg_time" => array("Average (ms>", "DESC"),
940,942c939,942
<     $days=floor($q_row["uptime"]/8640000); $r=$q_row["uptime"]-$days*8640000;
<     $hours=floor(  $r/360000 );  $r=$q_row["uptime"]-$days*8640000-$hours*360000;
<     $minutes=floor($r/6000);
---
>
>     $days=floor(($q_row["uptime"]/8640000));
>     $hours=floor((($q_row["uptime"]%8640000)/360000));
>     $hours=floor((($q_row["uptime"]%8640000)/360000));
>     $minutes=floor(((($q_row["uptime"]%8640000)%360000)/6000));


I use the host.php version where I can sort the columns by clicking in the headers. Please check this and incoorperate it in the future versions.

Torsten


Top
 Profile  
 
 Post subject: Re: Uptime plugin (reboot monitor)
PostPosted: Tue Jul 11, 2006 10:03 am 
Offline
User avatar

Joined: Thu Nov 03, 2005 11:51 am
Posts: 14
Location: Elgin, Illinois
gilles wrote:
so i have done this plugin, using thold and working with cactid


1. decompress plugin in <cacti base dir>\plugins\uptime

2. install plugin (see plugin architecture documentation)

3. optionnaly, use patched host.php (ONLY with Plugin Architecture 0.9)
(this file is only here to add fonctionnality to Uptime and Monitor plugins)


This looks like an awesome patch. I am having troubles getting it to install. I have decompressed the files but am not sure how to install it. Can someone help?

Thanks,

Mike


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 114 posts ]  Go to page 1, 2, 3, 4, 5 ... 8  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 4 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