Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Uptime plugin (reboot monitor)
Goto page 1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin General
Author Message
gilles
Cacti User


Joined: 12 Jul 2005
Posts: 216

PostPosted: Fri May 12, 2006 3:05 pm    Post subject: Uptime plugin (reboot monitor) Reply with quote

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



uptime2.png
 Description:
uptime1
 Filesize:  31.02 KB
 Viewed:  24449 Time(s)

uptime2.png



auth.png
 Description:
auth
 Filesize:  9.72 KB
 Viewed:  24450 Time(s)

auth.png



host.png
 Description:
hosts
 Filesize:  29.8 KB
 Viewed:  24849 Time(s)

host.png



devices.png
 Description:
devices
 Filesize:  12.31 KB
 Viewed:  24850 Time(s)

devices.png




Last edited by gilles on Tue Apr 08, 2008 2:51 pm; edited 6 times in total
Back to top
twelzy
Cacti User


Joined: 30 Mar 2005
Posts: 74
Location: BRAZIL/Brasilia

PostPosted: Sat May 13, 2006 9:54 am    Post subject: Reply with quote

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!)
Back to top
twelzy
Cacti User


Joined: 30 Mar 2005
Posts: 74
Location: BRAZIL/Brasilia

PostPosted: Sat May 13, 2006 10:10 am    Post subject: Reply with quote

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!)
Back to top
gilles
Cacti User


Joined: 12 Jul 2005
Posts: 216

PostPosted: Sat May 13, 2006 10:21 pm    Post subject: Reply with quote

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.
Back to top
torstentfk
Cacti User


Joined: 05 Apr 2005
Posts: 181
Location: Munich, Germany

PostPosted: Mon May 15, 2006 5:05 am    Post subject: Reply with quote

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
Back to top
gilles
Cacti User


Joined: 12 Jul 2005
Posts: 216

PostPosted: Mon May 15, 2006 1:18 pm    Post subject: Reply with quote

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.
Back to top
gilles
Cacti User


Joined: 12 Jul 2005
Posts: 216

PostPosted: Thu May 18, 2006 1:20 pm    Post subject: Reply with quote

Uptime plugin has been updated.


tab_uptime.gif
 Description:
tab
 Filesize:  2.31 KB
 Viewed:  24446 Time(s)

tab_uptime.gif


Back to top
shakey_1



Joined: 16 Feb 2006
Posts: 42

PostPosted: Thu May 25, 2006 12:11 pm    Post subject: Reply with quote

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.
Back to top
r_chetanjain
Cacti User


Joined: 22 Aug 2003
Posts: 70

PostPosted: Tue Jun 06, 2006 1:00 am    Post subject: might be install problem Reply with quote

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.
Back to top
magix



Joined: 02 Jun 2006
Posts: 4

PostPosted: Mon Jun 12, 2006 2:47 am    Post subject: problem uptime Reply with quote

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
Back to top
torstentfk
Cacti User


Joined: 05 Apr 2005
Posts: 181
Location: Munich, Germany

PostPosted: Tue Jun 20, 2006 2:36 am    Post subject: Reply with quote

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
Back to top
Allen K



Joined: 15 Oct 2005
Posts: 22

PostPosted: Tue Jun 20, 2006 10:55 am    Post subject: Great Tool.. feature suggestion Reply with quote

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 : tech1@host.com, admin@network.com
device2 : tech2@othercompany.com, admin@othercompany.com

Is that something that can be coded into the plugin?

Thanks !!
Back to top
torstentfk
Cacti User


Joined: 05 Apr 2005
Posts: 181
Location: Munich, Germany

PostPosted: Wed Jun 28, 2006 5:02 am    Post subject: Reply with quote

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
Back to top
torstentfk
Cacti User


Joined: 05 Apr 2005
Posts: 181
Location: Munich, Germany

PostPosted: Fri Jul 07, 2006 9:20 am    Post subject: Reply with quote

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
Back to top
MikeP



Joined: 03 Nov 2005
Posts: 14
Location: Elgin, Illinois

PostPosted: Tue Jul 11, 2006 10:03 am    Post subject: Re: Uptime plugin (reboot monitor) Reply with quote

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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin General All times are GMT - 5 Hours
Goto page 1, 2, 3, 4, 5, 6, 7  Next
Page 1 of 7

 



Powered by phpBB © 2001, 2005 phpBB Group