Uptime plugin (reboot monitor)

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
torstentfk
Cacti User
Posts: 367
Joined: Tue Apr 05, 2005 9:52 am
Location: Munich, Germany

Post by torstentfk »

Hi again,

sorry for wrong code, but there were some bug in the mod-code, but this should work:
Change last if-statement until last "?>"

Code: Select all

if (($old_uptime<4294937286) || ($old_uptime>4294967295))
    {
        if ($new_uptime < $old_uptime) {
            cacti_log("Reboot detected of host : " . $q_row["hostname"] , true, "UPTIME");
            $today = getdate();
            $reboot_date = $today['year']."-".$today['mon']."-".$today['mday']." ".$today['hours'].":".$today['minutes'].":".$today['seconds'];
            db_execute("insert into uptime_data ( id , datetime, extra ) values ( '" . $q_row["id"] . "' , '" . $reboot_date . "' , '' ) ");
            thold_mail($global_alert_address, '', 'Reboot detected at ' . $reboot_date . ' of host : ' . $q_row["hostname"], 'Host : ' . $q_row["hostname"] . ' (' . $q_row["description"] . '), old uptime was : ' . $old_uptime . ' (' . round(($old_uptime)/8640000, 1) . 'd), new is : ' . $new_uptime . ' (' . round(($new_uptime)/8640000, 1) . 'd)', '');
         }
         else {$new_uptime = $new_uptime ;}  
    }
    else
       {cacti_log("Near on SNMP-overflow of host : " . $q_row["hostname"] , true, "UPTIME"); }
  }
 
}

          
?>
Torsten
User avatar
gilles
Cacti User
Posts: 250
Joined: Tue Jul 12, 2005 8:16 pm

Post by gilles »

All functions of Uptime Plugin are in Manage Plugin.

Features from Torsten has been include in Manage Plugin 0.4 (actually in testing)
gandolfi
Posts: 2
Joined: Thu Jul 28, 2005 5:41 pm

Primary Index not wanted

Post by gandolfi »

My version of MySQL (4.1.11-Debian_4sarge7) automatically put as primary key the field Id on the table uptime_data, so I was seeing only one reboot per device (and the first one that ocurred). I double checked the uptime.sql supplied, and it doesn't has the index, so I has to be mysql, don't know why.

I just added another field (an integer as primary key) on uptime_data, and updated check-uptime.php to pass null in the insert statement.

Another two things that may be helpful are:
- order the combobox by host.description
- put a link in the list of last reboots, to go directly to uptime.php?id=

(I have done them manually, so just suggesting)
airwalk
Cacti User
Posts: 103
Joined: Fri Aug 18, 2006 11:22 am
Location: MSK, RU

Post by airwalk »

Here's a modified devices.php for "devices" plugin with support of uptime
Attachments
devices.php.txt
(8.89 KiB) Downloaded 903 times
User avatar
twelzy
Cacti User
Posts: 83
Joined: Wed Mar 30, 2005 6:48 pm
Location: BRAZIL/Brasilia

Post by twelzy »

And here is a modified devices.php for the Devices Plugin with support of Manage Plugin:
airwalk wrote:Here's a modified devices.php for "devices" plugin with support of uptime
(Thanks airwalk!!!)

Bye!
(And sorry for my poor English...)
Attachments
devices.php.txt
(8.91 KiB) Downloaded 818 times
Thanks in advance!
(And sorry for my poor English...)
_______________________________________
twelzy (Enio Sanches)
gonz0
Posts: 8
Joined: Sun Apr 01, 2007 11:28 am
Location: Poland - Warsaw

Post by gonz0 »

when I trying to use choose na action on devices (in combobox "Check uptime" and GO) I am getting this message:
Notice: Undefined index: host_status in /home/www/cacti/host.php on line 804
Any ideas why ?

edit: I have used patched host.php
User avatar
adrianmarsh
Cacti User
Posts: 437
Joined: Wed Aug 17, 2005 8:51 am
Location: UK

Post by adrianmarsh »

Does this work with 0.8.6j, plugin arch 1.1 ?

I installed the basic rar file, and I see the Uptime tab, but nothing in devices.

I'm guessing that if I use the files in the forum topic, that they may not be compatible ?
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

The plugin works fine with the current version of PA. Do you see the plugin tab ? If you click on devices, then select the device to monitor, you should see a "Check Uptime" tick box ?
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

Hi all,
I just re-installed this plugin after rebuilding my Cacti installation. I used the host.php file that Giles included with the plugin, so i can see the uptime on the devices page for all of my hosts. But, now, when i go to my devices page, i get the following error at the top of the screen:

Code: Select all

Notice: Undefined index: host_status in E:\cacti\host.php on line 804
I saved a copy of my original host.php, so i will revert back to that one, but does anyone have a fix for that problem. Looking at the code in the new host.php at the line it is referencing, it says:

Code: Select all

	if (!empty($_SESSION["sess_host_status"])) {
		if ($_SESSION["sess_host_status"] != $_REQUEST["host_status"]) {
			$_REQUEST["page"] = 1;
		}
Any help would be greatly apprecaited.

thanks much

app
[b]Cacti Version[/b] - 0.8.7b
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

App - I think that the host.php file from Gilles was a hack that directly modified the code. I am using the CACTI based host.php, and it works fine.
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

OK, thanks. One question, does your hosts page have the system's uptime listed on it? Just would be something nice to have.

thanks

app
[b]Cacti Version[/b] - 0.8.7b
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

No - this hack was designed for PA 0.9, which is out of date now.
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

one other question, if i am using Cactid as the poller, do i need to schedule a separate task to call the check_uptime.php?

Since i installed the plugin, it hasnt run. I know it works, because it runs fine when i run the check_uptime.php from the command line.

app
[b]Cacti Version[/b] - 0.8.7b
[b]Plugin Architecture[/b] - 2.2 Beta
[b]Poller Type[/b] - CMD.php
[b]Server Info[/b] - Linux 2.6.9-78.0.1.ELsmp
[b]Web Server[/b] - Apache/2.0.52 (Red Hat)
[b]PHP[/b] - 4.3.9
[b]MySQL[/b] - 4.1.22
[b]RRDTool[/b] - 1.2.23
[b]SNMP[/b] - 5.1.2
[b]Plugins[/b][list]Global Plugin Settings (settings - v0.5)
SuperLinks (superlinks - v0.72)
Host Info (hostinfo - v0.2)
Report Creator (reports - v0.3)
Update Checker (update - v0.4)
Realtime for Cacti (realtime - v0.35)
Cacti Log View (clog - v1.1)
RRD File Cleaner (rrdclean - v0.36)
Network Discovery (discovery - v0.9)
Uptime (uptime - v0.4)[/list]
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

You shouldn't need another poller - mine works ok with CACTID as the main poller. It should run just after the data collection.
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
User avatar
adrianmarsh
Cacti User
Posts: 437
Joined: Wed Aug 17, 2005 8:51 am
Location: UK

Post by adrianmarsh »

Hi mcutting,

I see the:

- uptime tab
- The uptime checkbox on each device

But I don't see the uptime column under Management -> Devices
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests