Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plugin scripts does not work
#1
Hello,

I have created a plugin, with runs through a file called sensit.txt and the output will be the data that needs te be send to the pandora server.

this plugin looks like this:
--------------------------------------------------------------------------------------
#!/bin/bash

while read line
do

appname=`echo -e "$line"| awk '{print $2}'`
port=`echo -e "$line"| awk '{print $1}'`

  total=$(curl -s -u user:password http://localhost:${port}/api/v1/dataCollectors/status | sed s/.*total\":// | sed s/,.*//)
    pres=$(curl -s -u userr:password http://localhost:${port}/api/v1/dataCollectors/status | sed s/.*present\":// | sed s/,.*//)
    let mis=total-pres

latency=$(curl -s -u user:password http://localhost:${port}/api/v1/network/status | sed s/.*latency\":// | sed s/\\..*//)

# Module to get amount of absent datacollectors
echo -e "\t<module>"
echo -e "\t<name><![CDATA[Gateways: $appname]]></name>"
echo -e "\t<type>generic_data</type>"
echo -e "\t<data><![CDATA[$mis]]></data>"
echo -e "\t<description><![CDATA[amount of absent gateways]]></description>"
echo -e "\t<module_group>websites</module_group>"
echo -e "\t</module>"

# Module to get the latency
echo -e "\t<module>"
echo -e "\t<name><![CDATA[Latency: $appname]]></name>"
echo -e "\t<type>generic_data</type>"
echo -e "\t<data><![CDATA[$latency]]></data>"
echo -e "\t<description><![CDATA[Network Latency Sensit Radio Network]]></description>"
echo -e "\t<module_group>websites</module_group>"
echo -e "\t</module>"

done <sensit.txt
--------------------------------------------------

When running this script manually in the terminal the output is like this:

-------------------------------------------------

        <name><![CDATA[Gateways: Nedap-groenlo]]></name>
        <type>generic_data</type>
        <data><![CDATA[0]]></data>
        <description><![CDATA[amount of absent gateways]]></description>
        <module_group>websites</module_group>
        </module>
        <module>
        <name><![CDATA[Latency: Nedap-groenlo]]></name>
        <type>generic_data</type>
        <data><![CDATA[2]]></data>
        <description><![CDATA[Network Latency Sensit Radio Network]]></description>
        <module_group>websites</module_group>
        </module>
        <module>
        <name><![CDATA[Gateways: Huawei]]></name>
        <type>generic_data</type>
        <data><![CDATA[0]]></data>
        <description><![CDATA[amount of absent gateways]]></description>
        <module_group>websites</module_group>
        </module>
        <module>
        <name><![CDATA[Latency: Huawei]]></name>
        <type>generic_data</type>
        <data><![CDATA[0]]></data>
        <description><![CDATA[Network Latency Sensit Radio Network]]></description>
        <module_group>websites</module_group>
        </module>
---------------------------------------------------------

But as soon as a add this plugin to the pandora_agent.conf, i don't get this result. I enabled the debug mode. And also no result from this plugin.

The plugin has execute rights.

I am really stuck on this. 

When i create a plugin which has fixes fields and data is works fine, other plugin which i downloaded are working as well.

hope someone can help
 Reply
#2
Hi michel.korthout,

Can you show me the results of the script when you execute it manually?
Also, show me the module config in the pandora agent conf file.

Best regards,

vic.
 Reply
#3
Hello Vic,

The result of the output when i run it manually:
        <module>
        <name><![CDATA[Gateways: Nedap-groenlo]]></name>
        <type>generic_data</type>
        <data><![CDATA[0]]></data>
        <description><![CDATA[amount of absent gateways]]></description>
        <module_group>websites</module_group>
        </module>
        <module>
        <name><![CDATA[Latency: Nedap-groenlo]]></name>
        <type>generic_data</type>
        <data><![CDATA[2]]></data>
        <description><![CDATA[Network Latency Sensit Radio Network]]></description>
        <module_group>websites</module_group>
        </module>
        <module>
        <name><![CDATA[Gateways: Huawei]]></name>
        <type>generic_data</type>
        <data><![CDATA[0]]></data>
        <description><![CDATA[amount of absent gateways]]></description>
        <module_group>websites</module_group>
        </module>
        <module>
        <name><![CDATA[Latency: Huawei]]></name>
        <type>generic_data</type>
        <data><![CDATA[0]]></data>
        <description><![CDATA[Network Latency Sensit Radio Network]]></description>
        <module_group>websites</module_group>
        </module>


The name if this plugin is called sensit_monitor

i added module_plugin sensit_monitor in the pandora_agent.conf
 Reply
#4
Hello,

i just solved the issue, this had to do with the path the the .txt file. i chanced this to an absolute path and now it works fine.

thanks
 Reply


Users browsing this thread: 1 Guest(s)


(c) 2006-2018 Artica Soluciones Tecnológicas. Contents of this wiki are under Create Common Attribution v3 licence. | pandorafms.com | pandorafms.org

Theme © MyBB Themes