Script server command line - unexpected output

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
_CL
Posts: 39
Joined: Mon Feb 25, 2008 5:01 pm
Location: USA

Script server command line - unexpected output

Post by _CL »

I recently implemented my first script server template and it is running successfully. I am writing my second one and want to clarify something I have seen with both of the templates.

When I test the "index" and "query" commands, I get an additional line of output that simply has the capital letter U. Within Cacti, though, it doesn't seem to affect the verbose query

Code: Select all

administrator@grunt-11:/usr/share/cacti$ php ./script_server.php
PHP Script Server has Started - Parent is cmd
./scripts/ss_cisco_enh_mempool.php ss_cisco_enh_mempool 13.10.253.11 public 2 161 500 "" "" index
module_2.1
CPU_of_Switching_Processor_5.1
CPU_of_Switching_Processor_5.2
CPU_of_Routing_Processor_5.1
CPU_of_Routing_Processor_5.2
CPU_of_Switching_Processor_6.1
CPU_of_Switching_Processor_6.2
CPU_of_Routing_Processor_6.1
CPU_of_Routing_Processor_6.2
U                                <== this line here

Code: Select all

+ Running data query [17].
+ Found type = '6 '[script query].
+ Found data query XML file at '/usr/share/cacti/resource/script_server/ss_cisco_enh_mempool.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/bin/php -q /usr/share/cacti/scripts/ss_cisco_enh_mempool.php 13.10.253.11 public 2 161 500 "" "" index'
+ Executing script query '/usr/bin/php -q /usr/share/cacti/scripts/ss_cisco_enh_mempool.php 13.10.253.11 public 2 161 500 "" "" query index'
+ Found item [scriptIndex='module_2.1'] index: module_2.1
+ Found item [scriptIndex='CPU_of_Switching_Processor_5.1'] index: CPU_of_Switching_Processor_5.1
+ Found item [scriptIndex='CPU_of_Switching_Processor_5.2'] index: CPU_of_Switching_Processor_5.2
+ Found item [scriptIndex='CPU_of_Routing_Processor_5.1'] index: CPU_of_Routing_Processor_5.1
+ Found item [scriptIndex='CPU_of_Routing_Processor_5.2'] index: CPU_of_Routing_Processor_5.2
+ Found item [scriptIndex='CPU_of_Switching_Processor_6.1'] index: CPU_of_Switching_Processor_6.1
+ Found item [scriptIndex='CPU_of_Switching_Processor_6.2'] index: CPU_of_Switching_Processor_6.2
+ Found item [scriptIndex='CPU_of_Routing_Processor_6.1'] index: CPU_of_Routing_Processor_6.1
+ Found item [scriptIndex='CPU_of_Routing_Processor_6.2'] index: CPU_of_Routing_Processor_6.2
+ Executing script query '/usr/bin/php -q /usr/share/cacti/scripts/ss_cisco_enh_mempool.php 13.10.253.11 public 2 161 500 "" "" query cpuName'
+ Found item [cpuName='module_2'] index: module_2.1
+ Found item [cpuName='CPU_of_Switching_Processor_5'] index: CPU_of_Switching_Processor_5.1
+ Found item [cpuName='CPU_of_Switching_Processor_5'] index: CPU_of_Switching_Processor_5.2
+ Found item [cpuName='CPU_of_Routing_Processor_5'] index: CPU_of_Routing_Processor_5.1
+ Found item [cpuName='CPU_of_Routing_Processor_5'] index: CPU_of_Routing_Processor_5.2
+ Found item [cpuName='CPU_of_Switching_Processor_6'] index: CPU_of_Switching_Processor_6.1
+ Found item [cpuName='CPU_of_Switching_Processor_6'] index: CPU_of_Switching_Processor_6.2
+ Found item [cpuName='CPU_of_Routing_Processor_6'] index: CPU_of_Routing_Processor_6.1
+ Found item [cpuName='CPU_of_Routing_Processor_6'] index: CPU_of_Routing_Processor_6.2
+ Executing script query '/usr/bin/php -q /usr/share/cacti/scripts/ss_cisco_enh_mempool.php 13.10.253.11 public 2 161 500 "" "" query memName'
+ Found item [memName='Processor'] index: module_2.1
+ Found item [memName='Processor'] index: CPU_of_Switching_Processor_5.1
+ Found item [memName='I/O'] index: CPU_of_Switching_Processor_5.2
+ Found item [memName='Processor'] index: CPU_of_Routing_Processor_5.1
+ Found item [memName='I/O'] index: CPU_of_Routing_Processor_5.2
+ Found item [memName='Processor'] index: CPU_of_Switching_Processor_6.1
+ Found item [memName='I/O'] index: CPU_of_Switching_Processor_6.2
+ Found item [memName='Processor'] index: CPU_of_Routing_Processor_6.1
+ Found item [memName='I/O'] index: CPU_of_Routing_Processor_6.2
+ Executing script query '/usr/bin/php -q /usr/share/cacti/scripts/ss_cisco_enh_mempool.php 13.10.253.11 public 2 161 500 "" "" query memType'
+ Found item [memType='2'] index: module_2.1
+ Found item [memType='2'] index: CPU_of_Switching_Processor_5.1
+ Found item [memType='3'] index: CPU_of_Switching_Processor_5.2
+ Found item [memType='2'] index: CPU_of_Routing_Processor_5.1
+ Found item [memType='3'] index: CPU_of_Routing_Processor_5.2
+ Found item [memType='2'] index: CPU_of_Switching_Processor_6.1
+ Found item [memType='3'] index: CPU_of_Switching_Processor_6.2
+ Found item [memType='2'] index: CPU_of_Routing_Processor_6.1
+ Found item [memType='3'] index: CPU_of_Routing_Processor_6.2
+ Executing script query '/usr/bin/php -q /usr/share/cacti/scripts/ss_cisco_enh_mempool.php 13.10.253.11 public 2 161 500 "" "" query physIndex'
+ Found item [physIndex='1000'] index: module_2.1
+ Found item [physIndex='2001'] index: CPU_of_Switching_Processor_5.1
+ Found item [physIndex='2001'] index: CPU_of_Switching_Processor_5.2
+ Found item [physIndex='2017'] index: CPU_of_Routing_Processor_5.1
+ Found item [physIndex='2017'] index: CPU_of_Routing_Processor_5.2
+ Found item [physIndex='3001'] index: CPU_of_Switching_Processor_6.1
+ Found item [physIndex='3001'] index: CPU_of_Switching_Processor_6.2
+ Found item [physIndex='3017'] index: CPU_of_Routing_Processor_6.1
+ Found item [physIndex='3017'] index: CPU_of_Routing_Processor_6.2
+ Found data query XML file at '/usr/share/cacti/resource/script_server/ss_cisco_enh_mempool.xml'
+ Found data query XML file at '/usr/share/cacti/resource/script_server/ss_cisco_enh_mempool.xml'
+ Found data query XML file at '/usr/share/cacti/resource/script_server/ss_cisco_enh_mempool.xml'
Back to the command line, I don't get the additional U line when I test the "get" command.

Code: Select all

administrator@grunt-11:/usr/share/cacti$ php ./script_server.php
PHP Script Server has Started - Parent is cmd
./scripts/ss_cisco_enh_mempool.php ss_cisco_enh_mempool 13.10.253.11 public 2 161 500 "" "" get memUsed CPU_of_Switching_Processor_5.2
11743136
./scripts/ss_cisco_enh_mempool.php ss_cisco_enh_mempool 13.10.253.11 public 2 161 500 "" "" get memFree CPU_of_Switching_Processor_5.2
55365728
./scripts/ss_cisco_enh_mempool.php ss_cisco_enh_mempool 13.10.253.11 public 2 161 500 "" "" get memLargestFree CPU_of_Switching_Processor_5.2
55365692
./scripts/ss_cisco_enh_mempool.php ss_cisco_enh_mempool 13.10.253.11 public 2 161 500 "" "" get memLowestFree CPU_of_Switching_Processor_5.2
55169120
The difference I am sure is that the index and query commands use print to send the results and the get command uses return....Actually, this whole business of when to use return was initially confusing. The Cacti manual in chapter 14.3.1 says

Code: Select all

5. The last step is to change the function call that could have traditionally returned the value to the Cacti poller using the PRINT function. You must change that line or lines in your code to utilize the RETURN function instead. However, this does not apply to PRINT statements that are not called from the Poller.
Through trial and error, I figured out that I have to use return for the get command. I didn't use return for the index and query commands because the sample scripts included in Cacti use print for the index and query commands.

Anyhow, back on topic - should I just ignore the additional U output I get with the index and query commands?
CL
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests