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    


Thold 2.x - Thresholding/Alerting module for cacti 8.6
Goto page Previous  1, 2, 3 ... 33, 34, 35, 36  Next
 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cacti Forum Index -> Plugin: (Threshold)
Author Message
cigamit
Developer


Joined: 07 Apr 2005
Posts: 945
Location: B/CS Texas

PostPosted: Fri Feb 10, 2006 9:56 am    Post subject: Reply with quote

Diggit2001 wrote:
Hmmm. This looks interesting. I wish I would have found this earlier.

Can I install this architecture overtop of my existing (old) thold or should I attempt to remove thold first?

Thanks!


You definitely have to remove the old one first, or there could be issues with duplicate functions. Also, remove the old cron job as its not needed anymore.
Back to top
torstentfk
Cacti User


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

PostPosted: Tue Feb 21, 2006 11:50 am    Post subject: Reply with quote

Hello,

last week a switch rebooted and we did not recognize it.
So I changed the thold functions (here is allready an email-function included) so that cacti checks the uptime, stores it in the host-db and sets a flag if the device has rebooted. This flag is cleared in the next poller run.

Alter the host-table:
Code:

mysql
 ALTER TABLE `host` ADD `uptime` VARCHAR(20)  NULL DEFAULT '0' , ADD `reboot` VARCHAR( 3 )  NULL DEFAULT '0';


in plugin/thold/check-thold.php insert this lines after line 92 and
before "foreach ($queryrows as $q_row) ":
Code:

#-------reboot-monitor
$sql = "SELECT description, hostname, id, uptime FROM host where reboot ='1' AND uptime > 1";
## $result = db_fetch_assoc($sql) or die (mysql_error());
## changed to:
$result = db_fetch_assoc($sql);

foreach ($result as $item)
{
$msg= " Device ". $item["description"]." has rebooted an came up at ".date("h:i:s d-m-Y");
$subject = "Reboot of ".$item["hostname"] ;
$file_array =array();
 if ($deadnotify)
 {  thold_mail($global_alert_address, '', $subject, $msg, $file_array);
    print("Reboot detected on " . $item["hostname"]."\n");
 }
}
#-------reboot-monitor



in cmd.php insert this lines:
Line 106 add:
Code:

         $snmp_uptime = 0;



At line 259 near $new_host = false;
insert this right after it:
$last_host2 = $last_host;

Some line further insert quite after the "else" of this block
Code:

            if (($item["snmp_version"] == 0) || (($item["snmp_community"] == "") && ($item["snmp_version"] != 3))) {
                                        cacti_log("Host[$host_id] DS[$data_source] ERROR: Invalid SNMP Data Source.  Please either delete it from the database, or correct it.", $print_data_to_stdout);
                                        $output = "U";
                         }else {


insert this block:
Code:

                             if ($last_host2 != $current_host)
                             {
                                $last_host2 = $current_host;
                                $snmp_uptime = cacti_snmp_get($item["hostname"], $item["snmp_community"], ".1.3.6.1.2.1.1.3.0", $item["snmp_version"], $item["snmp_username"], $item["snmp_password"], $item["snmp_port"], $item["snmp_timeout"], SNMP_WEBUI);
  if ($snmp_uptime > 10 )
                                {
                                    $old_uptime= db_fetch_cell("SELECT uptime FROM host WHERE  id='" . $item["host_id"] . "'");
                                    cacti_log("Uptime of " . $item["hostname"] . ",ID:" . $item["host_id"] . " - old=$old_uptime cur
:$snmp_uptime",$print_data_to_stdout);
                                    if ( $old_uptime > $snmp_uptime )
                                      {  db_execute("update host set reboot='1' where id='" . $item["host_id"] . "'");
                                         cacti_log("REBOOT detected of device " . $item["hostname"] . ": Old:".$old_uptime." Current
:".$snmp_uptime ,$print_data_to_stdout);
                                      }
                                    else
                                     { db_execute("update host set reboot='0' where id='" . $item["host_id"] . "'");  }
                                    db_execute("update host set uptime=$snmp_uptime where id='" . $item["host_id"] . "'");
                                }
                                else
                                   {cacti_log("Could not fetch Uptime of " . $item["hostname"] . ",ID:" . $item["host_id"],$print_da
ta_to_stdout); }
}                               



Finally I changed host.php:
at line 784 I inserted host.uptime so that this look like
Code:

 host.avg_time,
                   host.availability ,
                     host.uptime
                   from host
                   $sql_where
                   order by host.description

and at line 828 I inserted at the end of the <td>s:
Code:

<td><?php print (round($host["uptime"]/8640000, 1));?>d</td>


Now cacti stores for each host the uptime and set the flag. Thold checks for this flag and send an email to the admins (only if dead host notification is enabled).

Hope this would not interfear with other scripts /php commands. I hope this mod could make it into the official releases.

Torsten


Last edited by torstentfk on Wed Mar 08, 2006 6:55 am; edited 2 times in total
Back to top
torstentfk
Cacti User


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

PostPosted: Wed Feb 22, 2006 5:50 am    Post subject: Reply with quote

Hi,

last post changed:
The table changed to
ALTER TABLE `host` ADD `uptime` VARCHAR(20) NULL DEFAULT '0' , ADD `reboot` VARCHAR( 3 ) NULL DEFAULT '0';

the devisor of the uptime changed to 8640000.

Torsten
Back to top
jay_kumar



Joined: 02 Feb 2006
Posts: 8

PostPosted: Sun Mar 05, 2006 12:48 pm    Post subject: segmentation fault Reply with quote

after i installed thold plugin on my cacti-0.8.6h-1.2.el4.rf the webpage stopped working and running poller gave segmentation fault. what could be the problem??
Back to top
espinojo



Joined: 17 Jan 2006
Posts: 4

PostPosted: Mon Mar 06, 2006 1:47 pm    Post subject: Re: segmentation fault Reply with quote

jay_kumar wrote:
after i installed thold plugin on my cacti-0.8.6h-1.2.el4.rf the webpage stopped working and running poller gave segmentation fault. what could be the problem??


i had the same problem, but haven't found a complete solution yet. The problem is releted to the functions.php file. Just backup it and replace it with the original file (it was saved by install.sh as functions.php.bak)

You will get access to the tool again, but u will receive some error mesagges.
Back to top
aggie



Joined: 07 Mar 2006
Posts: 3
Location: Swansea, Wales

PostPosted: Tue Mar 07, 2006 7:15 am    Post subject: Reply with quote

I've been using cacti for about a year, but haven't really had the time to look into expanding it.

Tried out Thold 0.2.1a on two existing cacti installations (0.86g and 0.86c) and it managed to break importing templates for both of them,

When I upgraded to 0.86h (as I thought well maybe templates need to be from the same version of cacti), it finally broke the cacti frontend (poller seemed to be okay). I managed to uninstall it using the script and removing the thold tables for the mysql database.

I've now installed the plugin architecture 0.9 and thold 0.2.7 from cactiusers.org and all is now well, and I've only lost about an hour of monitoring data!

Moderators - I know I'm new around here and don't want to cause trouble; but do you think that it would be good forum moderation for this thread to be locked. With a new one created with details of thold 0.2.7 and the plugin architecture method of install? (and a reference to this thread) As I know I for one wasn't prepared to read 34 pages of posts before installing.
Back to top
cigamit
Developer


Joined: 07 Apr 2005
Posts: 945
Location: B/CS Texas

PostPosted: Tue Mar 07, 2006 10:04 am    Post subject: Reply with quote

aggie wrote:
I've been using cacti for about a year, but haven't really had the time to look into expanding it.

Tried out Thold 0.2.1a on two existing cacti installations (0.86g and 0.86c) and it managed to break importing templates for both of them,

When I upgraded to 0.86h (as I thought well maybe templates need to be from the same version of cacti), it finally broke the cacti frontend (poller seemed to be okay). I managed to uninstall it using the script and removing the thold tables for the mysql database.

I've now installed the plugin architecture 0.9 and thold 0.2.7 from cactiusers.org and all is now well, and I've only lost about an hour of monitoring data!

Moderators - I know I'm new around here and don't want to cause trouble; but do you think that it would be good forum moderation for this thread to be locked. With a new one created with details of thold 0.2.7 and the plugin architecture method of install? (and a reference to this thread) As I know I for one wasn't prepared to read 34 pages of posts before installing.


I have been thinking of doing that for a bit, it would save me alot of time also. I will see about starting writing it.
Back to top
anuraganuj
Cacti User


Joined: 21 Feb 2006
Posts: 70

PostPosted: Wed Mar 08, 2006 3:08 am    Post subject: Threshold not sending email Reply with quote

i can send test mail sucessfully from threshold but when a host goes down or breaches threshold it says Trigger as YES but no mail is seen.pls help
Back to top
torstentfk
Cacti User


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

PostPosted: Wed Mar 08, 2006 6:57 am    Post subject: Reply with quote

Hello,

found a bug in my code for reboot-monitor at plugin/thold/check-thold.php :
(marked in code).
I changed
$result = db_fetch_assoc($sql) or die (mysql_error());
to
$result = db_fetch_assoc($sql);


Torsten
Back to top
TomekN



Joined: 02 Mar 2006
Posts: 12
Location: Warsaw, Poland

PostPosted: Wed Mar 08, 2006 8:07 am    Post subject: Reply with quote

Plugin achitecture, thold, monitor and other plugins from http://cactiusers.org/
work out of the box with latest version of Cacti.

I don't know who Jimmy is but he does a great job.
Back to top
cigamit
Developer


Joined: 07 Apr 2005
Posts: 945
Location: B/CS Texas

PostPosted: Wed Mar 08, 2006 9:04 am    Post subject: Re: Threshold not sending email Reply with quote

anuraganuj wrote:
i can send test mail sucessfully from threshold but when a host goes down or breaches threshold it says Trigger as YES but no mail is seen.pls help


Usually a problem with your mail settings. Check them and make sure you are able to receive the test emails properly.
Back to top
anuraganuj
Cacti User


Joined: 21 Feb 2006
Posts: 70

PostPosted: Fri Mar 10, 2006 11:57 pm    Post subject: Tested again Reply with quote

Hi cigamit,

I tested sending d test mails again and again but trigger mail is missing
Back to top
joe_hznm



Joined: 19 May 2005
Posts: 28

PostPosted: Sun Mar 12, 2006 9:16 pm    Post subject: Reply with quote

Could the threshold trigger sound alarm ?

Joe
Back to top
tgk



Joined: 11 Mar 2006
Posts: 28

PostPosted: Fri Mar 17, 2006 9:26 am    Post subject: Problem creating threshold template Reply with quote

I'm creating a threshold template for my Interface - Traffic in and out. I want to do baseline deviation up only. The instructions for ignoring baseline deviation down say "if not set, lower bound threshold will not be checked at all". I left that box empty and saved, but when I came back to it, it was filled with "0". I cannot remove it.

When I apply the threshold to one of my interfaces, it reports the baseline deviation down.

I can go to Management / Thresholds, edit the individual threshold, and delete the baseline deviation down in that screen.

It seems to be a bug. It's not possible to leave the baseline deviation box empty in the Threshold Template page.
Back to top
saveus



Joined: 10 Jul 2005
Posts: 25

PostPosted: Fri Mar 17, 2006 3:01 pm    Post subject: problem with current value Reply with quote

hi have a problem with thold

when i use "Auto-create thresholds" its add all graph on thold
but the "current" values are all time at "0"

when i start manually the "check-thold.php"
i have never value in "Cur. value:" :

------------------
RRA: 420 : proc
Ref. values count: 37
Ref. value (min): 36
Ref. value (max): 42
Cur. value:
Low bl thresh: 31
High bl thresh: 48
Check against baseline: FAIL: Below baseline threshold!
------------------
RRA: 360 : cpu_nice
Ref. values count: 26
Ref. value (min): 0
Ref. value (max): 0
Cur. value:
Low bl thresh: 0
High bl thresh: 0
Check against baseline: OK
------------------
RRA: 364 : load_15min
Ref. values count: 26
Ref. value (min): 1
Ref. value (max): 2
Cur. value:
Low bl thresh: 1
High bl thresh: 2
Check against baseline: FAIL: Below baseline threshold!
------------------


in the thold.log have no value too :


03-17-06.20:50:02 element: mail6 - Traffic - shaper0[traffic_in] alertstat: 0 graph_id: 329 thold_low: thold_hi: rra: 371 trigger: 1 triggerct: 0 current: logset:
03-17-06.20:50:02 element: mail6 - Partition - /dev/sda1[hdd_free] alertstat: 0 graph_id: 330 thold_low: thold_hi: rra: 372 trigger: 1 triggerct: 0 current: logset:
03-17-06.20:50:02 element: mail6 - Partition - /dev/sda1[hdd_used] alertstat: 0 graph_id: 330 thold_low: thold_hi: rra: 372 trigger: 1 triggerct: 0 current: logset:
03-17-06.20:50:02 element: mail6 - Partition - /dev/sdb1[hdd_used] alertstat: 0 graph_id: 331 thold_low: thold_hi: rra: 373 trigger: 1 triggerct: 0 current: logset:
03-17-06.20:50:04 element: mail6 - Partition - /dev/sdb1[hdd_free] alertstat: 0 graph_id: 331 thold_low: thold_hi: rra: 373 trigger: 1 triggerct: 0 current: logset:
03-17-06.20:50:07 element: mail6 - Partition - /dev/sdb2[hdd_free] alertstat: 0 graph_id: 332 thold_low: thold_hi: rra: 374 trigger: 1 triggerct: 0 current: logset:
03-17-06.20:50:07 element: mail6 - Partition - /dev/sdb2[hdd_used] alertstat: 0 graph_id: 332 thold_low: thold_hi: rra: 374 trigger: 1 triggerct: 0 current: logset:
03-17-06.20:50:07 element: mail6 - Partition - /dev/sda3[hdd_free] alertstat: 0 graph_id: 333 thold_low: thold_hi: rra: 375 trigger: 1 triggerct: 0 current: logset:
03-17-06.20:50:07 element: mail6 - Partition - /dev/sda3[hdd_used] alertstat: 0 graph_id: 333 thold_low: thold_hi: rra: 375 trigger: 1 triggerct: 0 current: logset:
03-17-06.20:50:07 element: mail6 - CPU Usage - System[cpu_system] alertstat: 0 graph_id: 324 thold_low: thold_hi: rra: 361 trigger: 1 triggerct: 0 current: logset:
03-17-06.20:50:08 element: hdi - Processes[proc] alertstat: 0 graph_id: 365 thold_low: thold_hi: 30 rra: 420 trigger: 1 triggerct: 0 current: logset:
03-17-06.20:50:08 element: mail6 - CPU Usage - Nice[cpu_nice] alertstat: 0 graph_id: 324 thold_low: thold_hi: rra: 360 trigger: 1 triggerct: 0 current: logset:
03-17-06.20:50:08 element: mail6 - Load Average - 15 Minute[load_15min] alertstat: 0 graph_id: 325 thold_low: thold_hi: rra: 364 trigger: 1 triggerct: 0 current: logset:
03-17-06.20:50:08 element: mail6 - Load Average - 1 Minute[load_1min] alertstat: 0 graph_id: 325 thold_low: thold_hi: rra: 363 trigger: 1 triggerct: 0 current: logset:
03-17-06.20:50:08 element: mail6 - CPU Usage - User[cpu_user] alertstat: 0 graph_id: 324 thold_low: thold_hi: rra: 362 trigger: 1 triggerct: 0 current: logset:


someone have an idea for resolve that ?

thanks
Back to top
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cacti Forum Index -> Plugin: (Threshold) All times are GMT - 5 Hours
Goto page Previous  1, 2, 3 ... 33, 34, 35, 36  Next
Page 34 of 36

 



Powered by phpBB © 2001, 2005 phpBB Group