|
|
| Author |
Message |
gilles Cacti User
Joined: 12 Jul 2005 Posts: 210
|
Posted: Fri May 12, 2006 3:05 pm Post subject: Uptime plugin (reboot monitor) |
|
|
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
| Description: |
|
| Filesize: |
31.02 KB |
| Viewed: |
22458 Time(s) |

|
| Description: |
|
| Filesize: |
9.72 KB |
| Viewed: |
22459 Time(s) |

|
| Description: |
|
| Filesize: |
29.8 KB |
| Viewed: |
22858 Time(s) |

|
| Description: |
|
| Filesize: |
12.31 KB |
| Viewed: |
22859 Time(s) |

|
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
|
Posted: Sat May 13, 2006 9:54 am Post subject: |
|
|
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
|
Posted: Sat May 13, 2006 10:10 am Post subject: |
|
|
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: 210
|
Posted: Sat May 13, 2006 10:21 pm Post subject: |
|
|
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: 175 Location: Munich, Germany
|
Posted: Mon May 15, 2006 5:05 am Post subject: |
|
|
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: 210
|
Posted: Mon May 15, 2006 1:18 pm Post subject: |
|
|
| 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: 210
|
Posted: Thu May 18, 2006 1:20 pm Post subject: |
|
|
Uptime plugin has been updated.
| Description: |
|
| Filesize: |
2.31 KB |
| Viewed: |
22455 Time(s) |

|
|
|
| Back to top |
|
 |
shakey_1
Joined: 16 Feb 2006 Posts: 42
|
Posted: Thu May 25, 2006 12:11 pm Post subject: |
|
|
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
|
Posted: Tue Jun 06, 2006 1:00 am Post subject: might be install problem |
|
|
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
|
Posted: Mon Jun 12, 2006 2:47 am Post subject: problem uptime |
|
|
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: 175 Location: Munich, Germany
|
Posted: Tue Jun 20, 2006 2:36 am Post subject: |
|
|
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
|
Posted: Tue Jun 20, 2006 10:55 am Post subject: Great Tool.. feature suggestion |
|
|
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: 175 Location: Munich, Germany
|
Posted: Wed Jun 28, 2006 5:02 am Post subject: |
|
|
| 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: 175 Location: Munich, Germany
|
Posted: Fri Jul 07, 2006 9:20 am Post subject: |
|
|
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
|
Posted: Tue Jul 11, 2006 10:03 am Post subject: Re: Uptime plugin (reboot monitor) |
|
|
| 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 |
|
 |
|