Killspike integration in webinterface

Anything that you think should be in Cacti.

Moderators: Developers, Moderators

Ahuber
Cacti User
Posts: 59
Joined: Thu Nov 16, 2006 1:57 pm
Location: BC, kootenays

Post by Ahuber »

Hey Alice, I used it again on another graph, and same thing happened The whole graph goes ZERO). I will use your updated code from now on and test it. FYI i am using on CactiEZ

*UPDATE*
For some reason it works now....
Thanks!
torstentfk
Cacti User
Posts: 367
Joined: Tue Apr 05, 2005 9:52 am
Location: Munich, Germany

Post by torstentfk »

Hi,

found some points that my be the cause that the script does not work:
check removespike.pl for:
- path definition for rrdtool
- change (unix-version) the $ARGV[1] to $ARGV[0].
Now the checking algorithm works.

Torsten
User avatar
ruud
Cacti User
Posts: 64
Joined: Tue Aug 22, 2006 3:07 am
Location: Rotterdam, The Netherlands
Contact:

killspike changes file permissions - stops graphing

Post by ruud »

I was quite happy with the results of kill spike.. i push the button, viola spike is gone..

the thing is.. after killing the spike, the permissions and ownership of the particular ra file is changed..

The file is owned by apache instead of my cactiuser and the file permissions get changed as well...

This causes my graph to stop functioning since cacti no longer has access to the file..

How can i prevent this from happening ? I assume killspike creates a copy of the original rra file but with the wrong permissions / owner..
Server #1 : Cacti 0.8.7b | cmd.php | HP Proliant DL380 G5 (Dual Core Xeon 3.2 GHz, 14 Gb, 2x73 Gb RAID1 - System + 3x73 Gb RAID5 - SQL/RRA) | Gentoo Linux
_________SYSTEM STATS: Time:114.6022 Method:cmd.php Processes:8 Threads:N/A Hosts:408 HostsPerProcess:51 DataSources:32276 RRDsProcessed:16148
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

1) You must have Unix as your OS, which I assume is the case.
2) You must have the POSIX php module installed "php -m".
3) You will change add the following lines of code to your/the program:

Code: Select all

if (file_exists($myfile)) {
   $current_process_owner = posix_getuid();
   $current_owner = fileowner($myfile);

   /* change the process owner of the current process */
   if (posix_setuid($current_owner)) {
      /* perform spike kill */
      spike_kill_me_mama();
      /* return ownership of the current process */
      posix_setuid($current_process_owner);
   }else{
      echo "Too bad so sad, can not change uid of the current process\n";
   }
}
Of course, you will have to change some things around to make it actually work, but it is essentially in tact.

Maybe Alice can make these changes for you?

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
Alice
Cacti User
Posts: 111
Joined: Tue Oct 28, 2003 4:54 pm
Location: Bucharest, RO.

Post by Alice »

It won't work.

PHP file is launched as apache_user.
It should run the killspike.pl script as cacti_user, which is impossible. [security]
It WOULD be possible if the apache would be run as root.

ruud: you can do the following thing:

create a new group, let's call it cactiperm
include cacti_user and apache_user in cactiperm
chown cacti_user.cactiperm /home/cacti/rra -R
chmod go+rw /home/cacti/rra -R

this should work.
[url=http://www.x-graphs.com/]http://www.x-graphs.com[/url] [color=red]X[/color]-[color=blue]graphs[/color] :: All kind of graphs
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

So, Alice, what you are saying is that the Apache user is not privileged and therefore can not SU to the new user. I guess I should have known this :(

Maybe we could have the boost_server perform these tasks? Do you want to team up to do this?

Larry
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
Alice
Cacti User
Posts: 111
Joined: Tue Oct 28, 2003 4:54 pm
Location: Bucharest, RO.

Post by Alice »

Sorry, i don't have time to play w/ boost, other than image caching, on another machine.
AND weathermaps are more important to me than boost. And, right now, i don't need it.
Soon i'll install another cacti server, on another machine, without weathermaps. THERE I can play with it.
[url=http://www.x-graphs.com/]http://www.x-graphs.com[/url] [color=red]X[/color]-[color=blue]graphs[/color] :: All kind of graphs
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Cool. I've got to talk with Howie on making his stuff compatible :) He was not to excited about doing it himself. He wanted me to re-write his code. I too am quite busy :). We'll get there though.

Larry
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
gg234
Cacti User
Posts: 63
Joined: Fri Oct 07, 2005 11:14 am
Contact:

Post by gg234 »

Hi,

I am trying to use killspike and i am getting the following error and i ma using cacti 0.8.6j and i have installed RRD tool from source when can i change the RRD tool path in .pl script.

Notice: Undefined index: killspike.php: in /var/www/cacti/lib/functions.php on line 1432

Notice: Undefined index: killspike.php: in /var/www/cacti/lib/functions.php on line 1451
-> Import Templates


Removing spikes for: /var/www/cacti/rra/localhost_proc_7.rrd

Limit set to 0.6
No peaks found!

I have given the execute permissions for .pl script and my rra is having web server user ownership.

Could some one help me how to fix this error.

Thanks for your help
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

No error messages in this forum, please.
And no crossposts ...
Reinhard
User avatar
twelzy
Cacti User
Posts: 83
Joined: Wed Mar 30, 2005 6:48 pm
Location: BRAZIL/Brasilia

Post by twelzy »

Anyone make it work under the Windows environment?!


Thanks in advance!
(And sorry for my poor English)
Thanks in advance!
(And sorry for my poor English...)
_______________________________________
twelzy (Enio Sanches)
apperrault
Cacti User
Posts: 379
Joined: Fri Feb 16, 2007 11:37 am
Location: Emeryville, CA
Contact:

Post by apperrault »

I was going to ask the same question Twelzy. I have installed the plugin, and when i run it, i don't get any errors, but the spikes don't go away either.

I hope that someone can make this work on a Windows hosted Cacti environment.

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]
User avatar
cjennings_cr
Posts: 20
Joined: Thu Jan 06, 2005 8:09 am
Contact:

Post by cjennings_cr »

I got it working on Windows (2003) with Cacti 0.8.6j - but had to manually edit the removespikes.pl:

(Note also - I use LDAP for login and so my realm is different - 0 = local / 1 = LDAP) - so I had to edit the setup.php file to just remove the whole realm check for the user id {replaced " and realm = 0" with "" } on line 44.

Line 33: put a windows path to temp file (c:/tmp/blah)
Make sure NETWORK SERVICE user had modify rights here.

Line 37: change to windows style path to RRDTOOL (c:/rrdtool/rrdtool blah)
Make sure NETWORK SERVICE user had read rights here.

Line 130: change to windows style path to RRDTOOL (c:/rrdtool/rrdtool blah)

Make sure NETWORK SERVICE has read rights to perl (c:/perl) and modify rights to <cacti path>/rra

do not know why it is using NETWORD SERVICE as the user - but this is what I determined was the user being used.
leonardo_gyn
Cacti User
Posts: 85
Joined: Sat Jan 22, 2005 4:51 pm

Post by leonardo_gyn »

silly question ..... how is this supposed to work ??? I found absolutely nothing related to plugin in my cacti 0.8.6j installation !
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

This is a Plugin. It is not a part of Cacti.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest