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    


Polling Statistics cacti 0.8.6g based (mysql)
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
gandalf
Developer


Joined: 02 Dec 2004
Posts: 17009
Location: Muenster, Germany

PostPosted: Sun Sep 11, 2005 3:17 pm    Post subject: Polling Statistics cacti 0.8.6g based (mysql) Reply with quote

To all cacti fans:
cacti now stores some statistics in mysql table "settings", key stats_poller. So it is possible to get those data without log file parsing. The entry looks like
Quote:
Time:3.1807 Method:cmd.php Processes:1 Threads:N/A Hosts:6 HostsPerProcess:6 DataSources:58 RRDsProcessed:45
for cmd.php usage.
So I wrote a tiny php script (ok, did not write it by myself, just did a little copying; it is my first php script ) ss_poller.php to get those data.
Also attached, you will find some graph template, including data template and data input (dependencies included). Attention: export is done using cacti 0.8.6g. You will need that very version at minimum!

Usage:
Put that ss_poller.php script under <path_cacti>/scripts. You may have to "save as ..."
Import the xml. You may have to "save as ..."
Add the new graph template to localhost (yes, it pertains only to your local cacti installation).
Wait some polling cycles.

ToDo:
Fire effects, better scaling of those values that differ extremely, perhpas splitting those graphs into two or more.

Comments are welcome

Reinhard



Poller Statistics.png
 Description:
The first graph (not fed very well)
 Filesize:  29.01 KB
 Viewed:  19993 Time(s)

Poller Statistics.png



ss_poller.php.gz
 Description:
The PHP Scripts (v0.1, date 2005-09-11), gzipped

Download
 Filename:  ss_poller.php.gz
 Filesize:  355 Bytes
 Downloaded:  1705 Time(s)


cacti_graph_template_local_poller_statistics.xml
 Description:
The Templates (v 0.1, date 2005-09-11)

Download
 Filename:  cacti_graph_template_local_poller_statistics.xml
 Filesize:  20.7 KB
 Downloaded:  2005 Time(s)

Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 13135
Location: MI, USA

PostPosted: Sun Sep 11, 2005 7:25 pm    Post subject: Reply with quote

lvm,

Did you know that I am now storing this information in the Settings Table: Stats, Export and Recache

Larry

EDIT: Ah, you noticed
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 17009
Location: Muenster, Germany

PostPosted: Mon Sep 12, 2005 6:01 am    Post subject: Reply with quote

TheWitness,

well, if it comes to Export and Recache, it should be possible to implement those based on this one. Is it of interest? If required, I'll look forward to implement that.
Reinhard
Back to top
fmangeant
Cacti Guru User


Joined: 19 Sep 2003
Posts: 2326
Location: Sophia-Antipolis, France

PostPosted: Mon Sep 12, 2005 7:30 am    Post subject: Reply with quote

Excellent work

I agree with you, it would be even better to have 2 graphs (processes, threads and hosts/processes usually have lower values).
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 13135
Location: MI, USA

PostPosted: Mon Sep 12, 2005 6:47 pm    Post subject: Reply with quote

The only issue with that is that those activities can take over 5 minutes. Threfore, it is not accurate to graph them without additional changes to the output processing. I wish I had thought of this when writing the darn thingy. It's not a big deal, but I am really interested in those fire effects!

Larry
Back to top
fmangeant
Cacti Guru User


Joined: 19 Sep 2003
Posts: 2326
Location: Sophia-Antipolis, France

PostPosted: Wed Sep 21, 2005 8:19 am    Post subject: Reply with quote

Hi lvm

your template works fine on my test system, but not on the production server. I get only the poller runtime on the graph, everything else shows as '0'.

I can run the script by hand :
Code:
$ php /cacti/cacti-0.8.6g/script_server.php
PHP Script Server has Started - Parent is cmd

/cacti/cacti-0.8.6g/scripts/ss_poller.php ss_poller
Time:115.5023 Method:cactid Processes:4 Threads:15 Hosts:583 HostsPerProcess:146 DataSources:8742 RRDsProcessed:6573

quit
PHP Script Server Shutdown request received, exiting

In Cacti's poller cache I have the following :

Code:
Data Source: Local - Poller Statistics 
RRD: /cacti/RRD/xxxxxx/phoenix/xxxxxx_phoenix_hosts_12545.rrd 
Action: 2, Script: /cacti/cacti-0.8.6g/scripts/ss_poller.php ss_poller


After running with DEBUG logging level, I have :
Code:
09/21/2005 03:05:09 PM - PHPSVR: Poller[0] DEBUG: INCLUDE: '/cacti/cacti-0.8.6g/scripts/ss_poller.php' SCRIPT: 'ss_poller' CMD: ''
09/21/2005 03:05:09 PM - CACTID: Poller[0] Host[17] SERVER: /cacti/cacti-0.8.6g/scripts/ss_poller.php ss_poller, output: Time:194.5112
09/21/2005 03:05:09 PM - PHPSVR: Poller[0] SERVER: /cacti/cacti-0.8.6g/scripts/ss_poller.php ss_poller output Time:194.5112 Method:cactid Processes:4 Threads:15 Hosts:583 HostsPerProcess:146 DataSources:8742 RRDsProcessed:6532
09/21/2005 03:05:17 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /cacti/RRD/xxxxx/phoenix/xxxxx_phoenix_hosts_12545.rrd --template Time 1127307902:194.5112


Do you have a clue ?

Thanks in advance.
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 17009
Location: Muenster, Germany

PostPosted: Wed Sep 21, 2005 12:40 pm    Post subject: Reply with quote

Yep, I have.
Had the very same issue with another php server scrip: the ping script. In both cases, only the first output parm is updated. This issue pertains to the poller when running cactid. If you switch to cmd.php, it's gone.
Of course, this is not an option for a production system. I posted my issue in the fping thread. But no clue up to the moment.
Perhaps it's time for a new thread?
Reinhard
Back to top
TheWitness
Developer


Joined: 14 May 2002
Posts: 13135
Location: MI, USA

PostPosted: Wed Sep 21, 2005 6:07 pm    Post subject: Reply with quote

This is a template issue caused by (I don't know yet).

TheWitness
Back to top
fmangeant
Cacti Guru User


Joined: 19 Sep 2003
Posts: 2326
Location: Sophia-Antipolis, France

PostPosted: Thu Sep 22, 2005 3:48 am    Post subject: Reply with quote

Hi lvm

I've modified your data input method like this :
- Input Type = "Script/Command"
- Input String = "php <path_cacti>/scripts/ss_poller.php"

The graphs works fine then.
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 17009
Location: Muenster, Germany

PostPosted: Thu Sep 22, 2005 1:13 pm    Post subject: Reply with quote

Wow, very well. Will check this tomorrow (just don't have any cacti system in here). There is a new thread for that problem; will see...
Reinhard
Back to top
henryd31



Joined: 13 Apr 2005
Posts: 30

PostPosted: Fri Sep 23, 2005 9:00 am    Post subject: Reply with quote

lvm wrote:
Wow, very well. Will check this tomorrow (just don't have any cacti system in here). There is a new thread for that problem; will see...
Reinhard


I have an issue with this script as well. Just upgraded to the 0.8.6g and everything else went smooth. After putting the ss_poller.php in the scripts dir and importing the xml which worked fine, whenever I try to apply the graph template to my local cacti install it seems to work. However, the data sources are not being created, no data template gets automatically created. So, I manually add the data template which then allows me to manually match in the different graph items to the source fields. The graph is still not being generated as the rrd file does not seem to be generated either. The debug only shows following:

09/23/2005 09:50:02 AM - PHPSVR: Poller[0] DEBUG: INCLUDE: 'php' SCRIPT: '/data/www/cacti/scripts/ss_poller.php' CMD: 'ss_poller'
09/23/2005 09:50:02 AM - CACTID: Poller[0] Host[1] SERVER: php /data/www/cacti/scripts/ss_poller.php ss_poller, output: WARNING:

Then, I tried what others said about changing the data input field to "script/cmd" and in that case the rrd file gets generated and the graph comes out (still having to the the steps manuall though) but the log message is still the same as above, so no actual data gets in.
Anyone can help ?
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 17009
Location: Muenster, Germany

PostPosted: Fri Sep 23, 2005 10:44 am    Post subject: Reply with quote

fmangeant wrote:
Hi lvm

I've modified your data input method like this :
- Input Type = "Script/Command"
- Input String = "php <path_cacti>/scripts/ss_poller.php"

The graphs works fine then.

Hi fmangeant,
now as I look at ot more carefully, I recognize your workaround
You omit the php script server by directly executing the script under php. Well, I'm trying this at the moment. But your way round is not at maximum performance, I guess
So I suppose there's something left to do for me
Reinhard
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 17009
Location: Muenster, Germany

PostPosted: Fri Sep 23, 2005 1:35 pm    Post subject: Reply with quote

fmangeant wrote:
Hi lvm

your template works fine on my test system, but not on the production server. I get only the poller runtime on the graph, everything else shows as '0'.

fmangeant,
I recently opened another thread at http://forums.cacti.net/viewtopic.php?p=42748#42748. Today I've closed it filing a bug against cactid (solution is supplied). If your error pertains to cactid only (e.g. disappears using cmd.php), the solution may help you as well. If I'm right, I suppose it will find it's way into newest cactid code.
So I'm still running this as a script server "script" without your walkaround. And now I don't need the cmd.php anymore.
Reinhard
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 17009
Location: Muenster, Germany

PostPosted: Sun Oct 23, 2005 1:32 pm    Post subject: Reply with quote

lvm wrote:
fmangeant wrote:
Hi lvm

your template works fine on my test system, but not on the production server. I get only the poller runtime on the graph, everything else shows as '0'.

fmangeant,
I recently opened another thread at http://forums.cacti.net/viewtopic.php?p=42748#42748. Today I've closed it filing a bug against cactid (solution is supplied). If your error pertains to cactid only (e.g. disappears using cmd.php), the solution may help you as well. If I'm right, I suppose it will find it's way into newest cactid code.
So I'm still running this as a script server "script" without your walkaround. And now I don't need the cmd.php anymore.
Reinhard

At the moment, this issue is resolved by the current cactid-0.8.6f1. If it is still failing for you, please post.
Reinhard
Back to top
tman
Cacti User


Joined: 14 Oct 2004
Posts: 94

PostPosted: Mon Jan 23, 2006 7:04 am    Post subject: Reply with quote

I'm trying this on Cacti 0.8.6h (Win2k) with php 4.4.1.

Everything imported ok, and if I run the script from the command line on the Cacti server, it returns all data ok. Because I'm running php 4.4.1, I have to suppress the HTTP headers using;

php -q <path cacti>/scripts/ss_poller.php ss_poller

Trouble is, whenever I run this in Cacti as a Script Command or Script server, I get no response. The logfile says;

01/23/2006 12:00:24 PM - PHPSVR: Poller[0] WARNING: Function does not exist
01/23/2006 12:00:24 PM - PHPSVR: Poller[0] WARNING: PHP Script File to be included, does not exist

I've not using Cactid by the way, just normal CMD.

Oh yeh, anyone know how to permanently turn off the HTTP headers in PHP 4.4.1??? Maybe something in the INI file?

Any ideas?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 



Powered by phpBB © 2001, 2005 phpBB Group