Uptime plugin (reboot monitor)

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

ariesow wrote:My environment her a lot devices and most probably that 10 records is no sufficient for the records. is that possible to me to make it display more than 10 records in the "UPTIME" tab ?
A bit late, but I made some modifications to the uptime.php (better sorting, layout, and more hosts listed). You can get the updated version here.
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Post by timi »

I can't get thist pluging to work :(
do I need to make any changes ?

I have:
Cacti Version - 0.8.7a
Plugin Architecture - 1.4

LE: I mean it detecs the reboot of a device, but in Device section it does not show the uptime ...
User avatar
timi
Cacti User
Posts: 240
Joined: Wed Nov 09, 2005 8:35 am
Location: Timisoara, Romania
Contact:

Post by timi »

looks like host.php need some hacks, anybody ?:)
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

mcutting,
I like the look of the changes, but i had to roll back. The one thing i like about the current layout is it shows me the reboots in reverse order (most recent one at the top). I like the ability to see more than the last 10 reboots, but with the number of servers i have, it is easier for me to see what booted last, than have to choose a host and see when it booted last. Do you know of any way to extend just the number of reboots? Maybe make it configurable?

thanks

app
myfreeke
Cacti User
Posts: 82
Joined: Tue Dec 04, 2007 10:24 pm

Post by myfreeke »

I runing uptime plugin on cacti 0.8.7a .but don't working !

All Devices view N/A

mysql> desc host;
+----------------------+-----------------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+-----------------------+------+-----+---------------------+----------------+
| id | mediumint(8) unsigned | NO | PRI | NULL | auto_increment |
| host_template_id | mediumint(8) unsigned | NO | | 0 | |
| description | varchar(150) | NO | | | |
| hostname | varchar(250) | YES | | NULL | |
| notes | text | YES | | NULL | |
| snmp_community | varchar(100) | YES | | NULL | |
| snmp_version | tinyint(1) unsigned | NO | | 1 | |
| snmp_username | varchar(50) | YES | | NULL | |
| snmp_password | varchar(50) | YES | | NULL | |
| snmp_auth_protocol | varchar(5) | YES | | | |
| snmp_priv_passphrase | varchar(200) | YES | | | |
| snmp_priv_protocol | varchar(6) | YES | | | |
| snmp_context | varchar(64) | YES | | | |
| snmp_port | mediumint(5) unsigned | NO | | 161 | |
| snmp_timeout | mediumint(8) unsigned | NO | | 500 | |
| availability_method | smallint(5) unsigned | NO | | 1 | |
| ping_method | smallint(5) unsigned | YES | | 0 | |
| ping_port | int(12) unsigned | YES | | 0 | |
| ping_timeout | int(12) unsigned | YES | | 500 | |
| ping_retries | int(12) unsigned | YES | | 2 | |
| max_oids | int(12) unsigned | YES | | 10 | |
| disabled | varchar(2) | YES | MUL | NULL | |
| uptime | char(3) | NO | | on | |
| monitor | char(3) | NO | | on | |
| monitor_text | text | NO | | | |
| status | tinyint(2) | NO | | 0 | |
| status_event_count | mediumint(8) unsigned | NO | | 0 | |
| status_fail_date | datetime | NO | | 0000-00-00 00:00:00 | |
| status_rec_date | datetime | NO | | 0000-00-00 00:00:00 | |
| status_last_error | varchar(255) | YES | | | |
| min_time | decimal(10,5) | YES | | 9.99999 | |
| max_time | decimal(10,5) | YES | | 0.00000 | |
| cur_time | decimal(10,5) | YES | | 0.00000 | |
| avg_time | decimal(10,5) | YES | | 0.00000 | |
| total_polls | int(12) unsigned | YES | | 0 | |
| failed_polls | int(12) unsigned | YES | | 0 | |
| availability | decimal(8,5) | NO | | 100.00000 | |
| npc_host_id | int(11) | YES | | NULL | |
| reboot | varchar(3) | YES | | 0 | |
+----------------------+-----------------------+------+-----+---------------------+----------------+
39 rows in set (0.00 sec)

mysql> desc uptime;
+--------+-----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-----------------------+------+-----+---------+-------+
| id | mediumint(8) unsigned | NO | | 0 | |
| uptime | bigint(20) | YES | | NULL | |
+--------+-----------------------+------+-----+---------+-------+
2 rows in set (0.00 sec)

mysql> desc uptime_data;
+----------+-----------------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-----------------------+------+-----+---------------------+-------+
| id | mediumint(8) unsigned | NO | | 0 | |
| datetime | datetime | NO | | 0000-00-00 00:00:00 | |
| extra | text | YES | | NULL | |
+----------+-----------------------+------+-----+---------------------+-------+
3 rows in set (0.00 sec)



Anybody can help me!
myfreeke
Cacti User
Posts: 82
Joined: Tue Dec 04, 2007 10:24 pm

Post by myfreeke »

uptime view Inaccurate

[root@TS263 ~]# uptime
16:50:03 up 8 days, 22:07, 2 users, load average: 0.01, 0.14, 0.17

I use modifi Devices a host view error:
Warning: Missing argument 10 for cacti_snmp_get(), called in /var/monitor/cacti/host.php on line 574 and defined in /var/monitor/cacti/lib/snmp.php on line 39

Warning: Missing argument 10 for cacti_snmp_get(), called in /var/monitor/cacti/host.php on line 579 and defined in /var/monitor/cacti/lib/snmp.php on line 39

Warning: Missing argument 10 for cacti_snmp_get(), called in /var/monitor/cacti/host.php on line 580 and defined in /var/monitor/cacti/lib/snmp.php on line 39

Warning: Missing argument 10 for cacti_snmp_get(), called in /var/monitor/cacti/host.php on line 581 and defined in /var/monitor/cacti/lib/snmp.php on line 39

Warning: Missing argument 10 for cacti_snmp_get(), called in /var/monitor/cacti/host.php on line 582 and defined in /var/monitor/cacti/lib/snmp.php on line 39
Attachments
uptime--error.JPG
uptime--error.JPG (4.1 KiB) Viewed 10425 times
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

Could someone who has this working in a modern Cacti (0.8.7, PA 1.4 or 2.0) zip up their uptime folder at post it?

I *think* I've followed all the way through this thread, applying the various 'fixes', but I seem to have a half-working plugin - no new options in the Devices page, and no device list in the Uptime tab.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

Howie - try this one - I have this working under 0.8.7b PIA 2.0

Regds
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

mcutting wrote:Howie - try this one - I have this working under 0.8.7b PIA 2.0

Regds
Ah, thanks. Still isn't working for me though... looking at the code, I don't see a hook for device_action_array, so I'm not really sure how it ever would add new actions to the hosts.php dropdown.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

Yes, this part does not work. It will only work if you open the device, and place a tick in the UPTIME field. This unfortunately means that you have to do it for every host.
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
User avatar
chrisgapske
Cacti User
Posts: 278
Joined: Tue May 22, 2007 7:56 am
Location: Pensacola, Fl - Padacuh, Ky-Alpena, MI-Gulf Shores,AL

Post by chrisgapske »

Howie wrote:Could someone who has this working in a modern Cacti (0.8.7, PA 1.4 or 2.0) zip up their uptime folder at post it?

I *think* I've followed all the way through this thread, applying the various 'fixes', but I seem to have a half-working plugin - no new options in the Devices page, and no device list in the Uptime tab.
you will only have devices in the uptime tab when a reboot is detcted.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

Thanks for your help guys, I have this working now. Now we'll see what's going on down there.

Attached is my own tweaks to mcutting's zip. I've added a little note to show that no reboots have been detected yet, and I also added the 'enable uptime' and 'disable uptime' options to the Devices list.

It'd be nice if there was a column in the Device list to show it, but I guess that would need a new hook or two (one for adding headers, and another to fill in the data, I think).
Attachments
uptime-hj.zip
my modified uptime
(23.9 KiB) Downloaded 687 times
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
eterzella.r.t
Cacti User
Posts: 75
Joined: Thu Oct 25, 2007 8:20 pm

Post by eterzella.r.t »

When i run php check-uptime.php this error occurred:

root@svr1:/var/www/cacti_original/plugins/uptime# php check-uptime.php

Invalid PHP_SELF Path

Cacti Version - 0.8.7b
Plugin Architecture - 2.0
Poller Type - CMD.php
Server Info - Linux 2.6.17-10-server
Web Server - Apache/2.0.55 (Ubuntu) PHP/5.1.6
PHP - 5.1.6
PHP Extensions - xmlwriter, libxml, xml, wddx, tokenizer, sysvshm, sysvsem, sysvmsg, standard, SimpleXML, sockets, soap, SPL, shmop, session, Reflection, posix, mime_magic, mbstring, iconv, hash, gettext, ftp, filepro, exif, dom, dba, date, ctype, calendar, bz2, bcmath, zlib, pcre, openssl, xmlreader, apache2handler, mysql, snmp, mysqli, gd
MySQL - 5.0.24a-Debian_9-log
RRDTool - 1.2.23
SNMP - 5.2.2
Plugins
  • Global Plugin Settings (settings - v0.3)
    Thresholds (thold - v0.3.9)
    Network Discovery (discovery - v0.8.3)
    Device Monitoring (monitor - v0.8.2)
    Host Info (hostinfo - v0.2)
    Network Tools (tools - v0.2)
    Device Tracking (mactrack - v1.1)
    FlowView (flowview - v0.4)
    Uptime (uptime - v0.3)
    PHP Network Weathermap (weathermap - v0.95a)
    ReportIt (ReportIt - v0.5.1)
    Report Creator (reports - v0.3)
    Network Management Inventory Database (nmid - v0.3.7g)
    Poller Performance Report (pollperf - v0.32)
    NMID SmokePing Plugin (nmid_smokeping - v0.1)
    NMID NFTracker Plugin (nmid_nftracker - v0.1)
    NMID WebService Plugin (nmid_webservice - v0.1)
    NMID CiscoWorks Plugin (nmid_ciscoworks - v0.1)
    NMID phpIP Plugin (nmidPhpip - v0.3.8a)
    NMID TaskManager Plugin (nmidTaskManager - v0.3.8a)
    IP subnet Calculator IPv4 IPv6 (ipsubnet - v.4d)
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

eterzella.r.t wrote:When i run php check-uptime.php this error occurred:

root@svr1:/var/www/cacti_original/plugins/uptime# php check-uptime.php

Invalid PHP_SELF Path
Then don't do that ;-)

Seriously, you don't need to. It's not like weathermap's check.php - it's used internally by uptime.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

Having found that CentOS 4 seems to restart the snmpd as part of it's weekly maintenance plan, I've made some modifications to check-uptime.php

This modification tried to retrieve the uptime from the HOST-MIB as well as the regular MIB-II one. The one that uptime normally checks is actually the uptime of the SNMP agent, and not the system. Not all devices use HOST-MIB (Cisco routers don't for example), but where both are available this modification prefers the system uptime over the agent uptime.

I haven't tested extensively to see if the extra query that fails slows down the poller too much though. A cleverer version would remember which hosts understand HOST-MIB.

It does stop Cacti sending alerts when the SNMP service is restarted.
Attachments
check-uptime.php.txt
(3.64 KiB) Downloaded 962 times
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests