$('a[name]').remove(); $('#ic-homepage__footer').before('
'); $("#tabs").tabs({ selected: 1 }); $("#ic-homepage__ic-tips").append( quickTipHTML() ); unhideOneProductTip(); $("#ic-homepage__product-tips").wrapInner('
'); $("#ic-homepage__feed-tips").wrapInner('
'); });
IBM Tivoli Monitoring > Version 6.3 > User's Guides > Agent Builder User's Guide > Monitor data by using a socket IBM Tivoli Monitoring, Version 6.3
Sample script for socket
This samples script demonstrates how a socket client might be written.
Perl sample
The following sample Perl script connects to a socket and sends data. This sample was written for an agent that runs on UNIX, with the product code k00 and an attribute group called SocketData.
#!/usr/bin/perl -w # SocketTest.pl # A simple Agent Builder Socket client using IO:Socket #------------------------ use strict; use IO::Socket; # Initialize socket connection to the agent #----------------------- my $host = '127.0.0.1'; my $port = 0; # This sample is for an agent with the k00 product code. The product code is # used in the following line to find the file containing the port number to use. open PORTFILE, "/tmp/k00_cps.properties" || die "Port file not found $!\n"; while (<PORTFILE>) { if (/^CP_PORT=([0-9]+)/) { $port = $1; } if ($port == 0) { die "Could not find port to use to connect to agent.\n"; my $sock = new IO::Socket::INET( PeerAddr => $host, PeerPort => $port, Proto => 'tcp'); $sock or die "no socket :$!"; # The following call sends 2 rows of data to the agent. Each row contains 1 # String attribute and 3 numeric attributes. syswrite $sock, "<socketData><attrGroup name=\"SocketData\"><in><a v=\"A message from perl\"/> \<a v=\"1\"/><a v=\"2\"/><a v=\"123\"/></in><in><a v=\"More from perl\"/><a v=\"456\"/> \<a v=\"123\"/><a v=\"789\"/></in></attrGroup> </socketData>\n"; close $sock;
Parent topic:
Monitor data by using a socket