TCP Port Template

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

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

TCP Port Template

Post by gilles »

This a TCP Port Template.

It let you graph the state of a TCP port :

Image

You can then set a treshold on it.

http://gilles.boulon.free.fr/tcp/tcp.zip

To use, unzip the template, import xml files and place appropriates files in scripts and ressources.
Not all of the 65535 ports will be tested (too long i think...), so you must edit file ports.inc.
Then go to Associated Data Queries, add TCP, click verbose and go to graphs.

Image

This is derivate from my Plugin Manage and Cacti users without Plugin Architecture can use it.
User avatar
gilles
Cacti User
Posts: 250
Joined: Tue Jul 12, 2005 8:16 pm

Post by gilles »

The template has been updated because it modify your rra settings.

You will experience this problem :
http://forums.cacti.net/viewtopic.php?t=16647

To correct this :
- use these steps http://forums.cacti.net/viewtopic.php?t=16541
or
- reimport the new TCP Port Template
or
- reimport another good template like this one http://forums.cacti.net/viewtopic.php?t=16618

I'm sorry for the inconvenience.
User avatar
gilles
Cacti User
Posts: 250
Joined: Tue Jul 12, 2005 8:16 pm

Post by gilles »

i have just updated the template to be compatible with cacti 0.8.7
cacti_008
Posts: 2
Joined: Mon Nov 06, 2006 1:56 am

Post by cacti_008 »

Hi, I cann't download the tcp.zip, where can I get it? Thx!
KyRoo
Cacti User
Posts: 51
Joined: Fri Oct 19, 2007 10:19 am

Post by KyRoo »

Hi Gillis,

i'm currently teting your cool plugin, but i have a problem

ive installed your manage plugin. everything seems to work. When i bring down a tcp port the manage tool detects that. But when i display the graph, it is always down.
when i look at my poller log i see that it returns the U value.

i've installed this when the zip was updates for version 0.8.7, but i run 0.8.6j. I think this could be the problem.

Do you still have the previous version?


debug info:

Code: Select all

Data Query Debug Information 
 
+ Running data query [12].
+ Found type = '6 '[script query].
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/script_server/tcp.xml'
+ XML file parsed ok.
+ Executing script for list of indexes 'c:\php\php.exe -q C:\Inetpub\wwwroot\cacti\scripts\tcp.php localhost 2 index'
+ Executing script query 'c:\php\php.exe -q C:\Inetpub\wwwroot\cacti\scripts\tcp.php localhost 2 query index'
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'C:/Inetpub/wwwroot/cacti/resource/script_server/tcp.xml'
 

Code: Select all

Data Query [TCP]    
 
This data query returned 0 rows, perhaps there was a problem executing this data query. You can run this data query in debug mode to get more information. 
Thx,
KyRoo
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

KyRoo - I still have the TCP template that is compatible with 0.8.6j...
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
KyRoo
Cacti User
Posts: 51
Joined: Fri Oct 19, 2007 10:19 am

Post by KyRoo »

mcutting wrote:KyRoo - I still have the TCP template that is compatible with 0.8.6j...
TY, works perfect now 8)
User avatar
Jem
Posts: 35
Joined: Tue Apr 12, 2005 4:36 pm
Contact:

Post by Jem »

Hello,

I tried to use this but it's not working for me, I have an error in my cacti log file:

12/10/2007 04:27:40 PM - CMDPHP: Poller[0] Host[2] DS[35] WARNING: Result from SERVER not valid. Partial Result: Invalid include/conf

Host and DS are for my localhost with TCP query on port 80...

Here is my Data Source Debug:

Code: Select all

Data Source Debug

/usr/syno/bin/rrdtool create \
/volume1/web/cacti/rra/uranus_tcp_35.rrd \
--step 300  \
DS:TCP:GAUGE:600:0:U \
RRA:AVERAGE:0.5:1:500 \
RRA:AVERAGE:0.5:1:600 \
RRA:AVERAGE:0.5:6:700 \
RRA:AVERAGE:0.5:24:775 \
RRA:AVERAGE:0.5:288:797 \
RRA:MAX:0.5:1:500 \
RRA:MAX:0.5:1:600 \
RRA:MAX:0.5:6:700 \
RRA:MAX:0.5:24:775 \
RRA:MAX:0.5:288:797 \
If it can help...

And my log in DEBUG mode:

Code: Select all

 12/10/2007 05:52:27 PM - CMDPHP: Poller[0] DEBUG: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (35, 'TCP', '2007-12-10 17:52:15', 'U')"
12/10/2007 05:52:27 PM - CMDPHP: Poller[0] Host[2] DS[35] SERVER: /volume1/web/cacti/scripts/tcp.php TCP 192.168.78.7 2 get TCP 80, output: U
12/10/2007 05:52:27 PM - CMDPHP: Poller[0] Host[2] DS[35] WARNING: Result from SERVER not valid. Partial Result: Invalid include/conf
12/10/2007 05:52:26 PM - PHPSVR: Poller[0] DEBUG: INC: '/volume1/web/cacti/scripts/tcp.php' FUNC: 'TCP' PARMS: '192.168.78.7 2 get TCP 80'
Thanks for your answers
oven
Posts: 10
Joined: Sat Mar 24, 2007 8:55 am

Re: TCP Port Template

Post by oven »

gilles wrote:This a TCP Port Template.

It let you graph the state of a TCP port :

Image

You can then set a treshold on it.

http://gilles.boulon.free.fr/tcp/tcp.zip

To use, unzip the template, import xml files and place appropriates files in scripts and ressources.
Not all of the 65535 ports will be tested (too long i think...), so you must edit file ports.inc.
Then go to Associated Data Queries, add TCP, click verbose and go to graphs.

Image

This is derivate from my Plugin Manage and Cacti users without Plugin Architecture can use it.

Code: Select all

RRDTool Command:

/usr/local/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="OCN Proxy - TCP State - 80" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/var/www/html/cacti/rra/ocn_proxy_tcp_155.rrd":TCP:LAST \
DEF:b="/var/www/html/cacti/rra/ocn_proxy_tcp_155.rrd":TCP:AVERAGE \
AREA:a#EA8F00FF:"TCP"  \
GPRINT:a:LAST:"%8.0lf\n"  \
COMMENT:"(1 = Running, 0 = Stopped)" 

RRDTool Says:

ERROR: the RRD does not contain an RRA matching the chosen CF
WHo can help me ?
bcarpio
Posts: 6
Joined: Wed Jun 04, 2008 8:42 pm

Post by bcarpio »

I installed this and all my queries in debug mode show no errors, however the graph never displays here is the error I get in my /var/log/httpd/error_log:

the RRD does not contain an RRA matching the chosen CF
gueutzilla
Posts: 9
Joined: Sun Jul 13, 2008 10:28 am

Post by gueutzilla »

Hi,

I have a problem whith graph on TCP template for all my devices.

The snmp query is ok and return :
5) TCP (Verbose Query) Uptime Goes Backwards Success [7 Items, 7 Rows]
In verbose :
+ Running data query [16].
+ Found type = '6 '[script query].
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ XML file parsed ok.
+ Executing script for list of indexes 'D:\Web\PHP5\php.exe -q D:\Web\Cacti\scripts\tcp.php 172.17.170.8 53 index'
+ Executing script query 'D:\Web\PHP5\php.exe -q D:\Web\Cacti\scripts\tcp.php 172.17.170.8 53 query index'
+ Found item [ServiceIndex='80'] index: 80
+ Found item [ServiceIndex='443'] index: 443
+ Found item [ServiceIndex='110'] index: 110
+ Found item [ServiceIndex='995'] index: 995
+ Found item [ServiceIndex='25'] index: 25
+ Found item [ServiceIndex='143'] index: 143
+ Found item [ServiceIndex='993'] index: 993
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
In the graph tabs, there is no graph for "|host_description| -TCP -".

In the cacti Console -> Graph Management , I turn on debug mod and I have the result in the first attachment.

In the Cacti Console -> Data Sources I turn on debug mode and have the result in second attachment.


The poller run properly and return correct value : 1 for port status.

In the cacti log file have this errors :
07/30/2008 05:30:21 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1224.
07/30/2008 05:30:20 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1218.
07/30/2008 05:30:20 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1219.
07/30/2008 05:30:20 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1222.
07/30/2008 05:30:20 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1223.
07/30/2008 05:30:20 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1221.
07/30/2008 05:30:20 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1220.
07/30/2008 05:30:16 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1212.
07/30/2008 05:30:14 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1242.
07/30/2008 05:30:10 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1257.
07/30/2008 05:30:10 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1259.

My cacti is 8.7.b with rrdtool 1.2.x (lastest version) and only graph for TCP template not working!!!

Can you help me??? :roll:

Thanks
Attachments
1st attachment
1st attachment
TCP-err.jpg (265.32 KiB) Viewed 52329 times
2nd attachment
2nd attachment
TCP-err1.jpg (220.32 KiB) Viewed 52329 times
jerrison
Cacti User
Posts: 57
Joined: Fri Dec 29, 2006 4:02 am

Post by jerrison »

Hi there,

thanks for the templates.
Just to give some information on how i got them to work with the latest cactiEZ-distribution: i need to edit your tcp.php script, line 54 and 57 (print "0", print "1"). Instead of "printing" the retun values i "returned" them:
return "0", return "1".
I had all "NaN" before, poller output was "1U" instead of only "1" or "0".

Hope this might help someone :).

Greetz,
André
ssabchew
Posts: 2
Joined: Mon Feb 23, 2009 7:27 am

Post by ssabchew »

[quote="gueutzilla"]Hi,

I have a problem whith graph on TCP template for all my devices.

The snmp query is ok and return :
[quote]5) TCP (Verbose Query) Uptime Goes Backwards Success [7 Items, 7 Rows][/quote]
In verbose :
[quote]+ Running data query [16].
+ Found type = '6 '[script query].
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ XML file parsed ok.
+ Executing script for list of indexes 'D:\Web\PHP5\php.exe -q D:\Web\Cacti\scripts\tcp.php 172.17.170.8 53 index'
+ Executing script query 'D:\Web\PHP5\php.exe -q D:\Web\Cacti\scripts\tcp.php 172.17.170.8 53 query index'
+ Found item [ServiceIndex='80'] index: 80
+ Found item [ServiceIndex='443'] index: 443
+ Found item [ServiceIndex='110'] index: 110
+ Found item [ServiceIndex='995'] index: 995
+ Found item [ServiceIndex='25'] index: 25
+ Found item [ServiceIndex='143'] index: 143
+ Found item [ServiceIndex='993'] index: 993
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'
+ Found data query XML file at 'D:/Web/Cacti/resource/script_server/tcp.xml'[/quote]

In the graph tabs, there is no graph for "|host_description| -TCP -".

In the cacti Console -> Graph Management , I turn on debug mod and I have the result in the first attachment.

In the Cacti Console -> Data Sources I turn on debug mode and have the result in second attachment.


The poller run properly and return correct value : 1 for port status.

In the cacti log file have this errors :
[quote]07/30/2008 05:30:21 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1224.
07/30/2008 05:30:20 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1218.
07/30/2008 05:30:20 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1219.
07/30/2008 05:30:20 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1222.
07/30/2008 05:30:20 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1223.
07/30/2008 05:30:20 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1221.
07/30/2008 05:30:20 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1220.
07/30/2008 05:30:16 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1212.
07/30/2008 05:30:14 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1242.
07/30/2008 05:30:10 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1257.
07/30/2008 05:30:10 PM - CMDPHP: Poller[0] ERROR: There are no RRA's assigned to local_data_id: 1259.[/quote]


My cacti is 8.7.b with rrdtool 1.2.x (lastest version) and only graph for TCP template not working!!!

Can you help me??? :roll:

Thanks[/quote]


I have EXACTLY the same problem...
cacti version - 0.8.7d

PLease HEEeeEEeeelp
killshoot
Cacti User
Posts: 84
Joined: Wed Mar 26, 2008 2:51 am

Post by killshoot »

By me the result is always "0" even if the port is really open. Any suggestion?
pthaynes
Cacti User
Posts: 56
Joined: Mon Apr 20, 2009 1:29 am
Location: Australia

TCP Templates

Post by pthaynes »

I noticed that my graphs for the TCP ports I am monitoring always show as down (ie a value of 0). Digging a little further I noticed that within the data template for TCP the "Maximum Value" was 0 (look under Console > Data templates - it's about half way down the page). I've changed that to 1 and now my TCP ports show as up.

I assume that was the right thing to do... if it is could someone please update the templates in the original source location?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest