Hi guys, Its me again, Well i have one smallhardware (running one closed linux) and id like to create a custom agent to it. Basically i was reading the Pandora 3.2 documentation i found "Pandora FMS's agents can be developed in almost any language, as long as it complies with the API for data interchange with Pandora FMS's data server (defined by a data interchange XML). The Windows agents are developed in a free environment for C++ (Mingw) and use the same interface and modularity as the UNIX agents, though with quite some own peculiar oddities." This is a closed Linux, so im not able to install Pandora_Agent as usual, but i can create a ShellScript to find out the information (cat with greps and cuts) that i want and send to my server by FTP. Something like that (true commands): filename=`cat /var/log/device | grep Serial | awk -F"=" '{print $2}'` gwip=`cat /apps/etc/network.cfg | grep eth0.gw0.addr | awk -F"=" '{print $2}'` lan_on=`route | grep $gwip | awk '{print $5}' | grep -c 101` tstamp=`date +%s` #Make management string gprsis=`cat /var/log/stat/netrouter.info | grep mobile_network_provider | awk -F":" '{print $2}' | awk -F"/" '{print $1}'` gprssignal=`cat /var/log/stat/netrouter.info | grep mobile_network_signal | awk -F":" '{print $2}'` gprsip=` cat /var/log/stat/netrouter.info | grep mobile_network_ip | awk -F":" '{print $2}'` if [ $lan_on == 0 ]; then linkis=0 string=$tstamp":"$linkis":"$gprsis":"$gprssignal":"$gprsip":" echo $string > /tmp/mngt.info ftpput -u USER -p PASS IP $filename /tmp/mngt.info else linkis=1 string=$tstamp":"$linkis":"$gprsis":"$gprssignal":"$gprsip":" echo $string > /tmp/mngt.info ftpput -u USER -p PASS IP $filename /tmp/mngt.info fi Id like to rewrite this shell to work as an agent, so Pandora when receive the file can automatically insert into the Console. Is that possible? exit 0
Creating Agent Based on Shell
nydiow · 10 ago 2011, 23:14 · 5 mensajes · 69 visitas
- Inicio del debate
Something like that: filename=`cat /var/log/device | grep Serial | awk -F"=" '{print $2}'` gprsis=`cat /var/log/stat/netrouter.info | grep mobile_network_provider | awk -F":" '{print $2}' | awk -F"/" '{print $1}'` gprssignal=`cat /var/log/stat/netrouter.info | grep mobile_network_signal | awk -F":" '{print $2}'` gprsip=` cat /var/log/stat/netrouter.info | grep mobile_network_ip | awk -F":" '{print $2}'` lan_on=`route | grep $gwip | awk '{print $5}' | grep -c 101` gprsis generic_data_string $gprsis gprssignal generic_data_string $gprssignal gprsip generic_data_string $gprsip lan_on generic_boolean $lan_on What else i need? How i need to save it? What name? Will FTP Service (Pandora Server) be able to recognize the file?
The current version of the Pandora Agent is based in Perl... However, I'm pretty sure prior versions of the agent are based in Shell... so you might want to check them out. If the agent provides a correct XML format, I think you shouldn't have any problem. Regards.
Well i didnt know that, can someone give me some tips how to do that? I think its a good idea to keep a Agent Based on Shell for case such as mine, i only have FTP avaliable i cant install standart agents. Todays scenario i have one shell that send me a file with some information(by FTP), next i have to build one Plugin Module for each information in the file, so manually i have to add the Agents inserting the Plugins modules. Its bring me a lot of problems because ill have many agents based on Plugins (each with 12 modules = 12 information) and Add this manually is not good.
Do i really need the .checksum file or just the .data is ok? I dont have MD5 and is not possible to install it.
Entra en tu cuenta para publicar.
