<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Technical Diary &#187; monitoring</title>
	<atom:link href="http://andriigrytsenko.net/tag/monitoring/feed/" rel="self" type="application/rss+xml" />
	<link>http://andriigrytsenko.net</link>
	<description>With Andrii Grytsenko</description>
	<lastBuildDate>Tue, 17 Aug 2010 08:25:33 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Some perl functions for monitoring</title>
		<link>http://andriigrytsenko.net/2009/06/some-perl-functions-for-monitoring/</link>
		<comments>http://andriigrytsenko.net/2009/06/some-perl-functions-for-monitoring/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 15:30:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripting]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://localhost/?p=16</guid>
		<description><![CDATA[I would like to provide you library which was very useful for me during my working under monitoring system.

To make it works you have to install next perl libraries :
Net::SSH::Expect;
Net::SCP::Expect;
Net::SFTP::Foreign;
Net::FTP;
It&#8217;s easy to do through cpan. For example:
# cpan i Net::SSH::Expect
or download directly from cpan
function  exec_cmd__ :
This function execute command at remote host. Example:
exec_cmd__(hostname, username, [...]]]></description>
			<content:encoded><![CDATA[<p>I would like to provide you library which was very useful for me during my working under monitoring system.<br />
<span id="more-16"></span></p>
<p>To make it works you have to install next perl libraries :</p>
<p>Net::SSH::Expect;<br />
Net::SCP::Expect;<br />
Net::SFTP::Foreign;<br />
Net::FTP;</p>
<p>It&#8217;s easy to do through cpan. For example:</p>
<p><code># cpan i Net::SSH::Expect</code></p>
<p>or download directly from <a href="http://cpan.org">cpan</a></p>
<p><strong>function  exec_cmd__ </strong>:</p>
<p>This function execute command at remote host. Example:</p>
<p>exec_cmd__(hostname, username, password, port, command)</p>
<p><strong>function sub transfer_file__ </strong>:</p>
<p>This function  can get or put file to remote host via ssh. Example :</p>
<p>transfer_file__(hostname, username, password, port, source file|directory, destination file|directory, method)</p>
<p>where option &#8220;method&#8221;  can be &#8220;fh&#8221;(means get file from somewhere and put to localhost) or &#8220;th&#8221;(send file to host)</p>
<p><strong>function sub sftp_func__</strong> :</p>
<p>This function can get and send file to remote computer via sftp protocol. Example<br />
sftp_func__(hostname, username, password, port, source file|directory, destination file|directory, method)</p>
<p>Where option &#8220;method&#8221; can be &#8216;get&#8217;(get file from remote host) and &#8216;put&#8217;(put file to remote host) and &#8216;del&#8217;(delete file from remote host )<br />
<em>NOTICE: if you use method &#8220;del&#8221; please specify the target as &#8220;source_file&#8221; and skip &#8220;destination_file&#8221; option</em></p>
<p><strong>function  ftp_func__</strong> :</p>
<p>This function get and delete remote file via ftp protocol. Example:</p>
<p>ftp_func__(hostname, username, password, port, source file|directory, destination file|directory, method)<br />
where option &#8220;method&#8221; can be &#8216;get&#8217; or &#8216;put&#8217;</p>
<p><strong>function get_file_via_ftp__</strong>:</p>
<p>This function is the same to previous one EXCEPT its doesn&#8217;t put a file at remote computer and when its get a file doesn&#8217;t remove it at remote system. Example:</p>
<p>get_file_via_ftp(hostname, username, password, port, source file|directory,  destination file|directory)</p>
<p><strong>function get_yesterday__</strong>:</p>
<p>This function return date of yesterday in format which was got by function as first argument. Example:</p>
<p>get_yesterday__(&#8221;YYYYDDMM&#8221;), get_yesterday__(&#8221;DDMMYYYY&#8221;) and so on.</p>
<p>How it&#8217;s use? Good question :) </p>
<p>Download <a href="http://andriigrytsenko.net/files/monitoring.pm">this</a> library and put into the /usr/lib/perl5/Net/. Ex.:  </p>
<p><code># cp monitoring.pm /usr/lib/perl5/Net/</code></p>
<p>Create new test script :<br />
<code>$ cat > test.pl<br />
#!/usr/bin/perl<br />
use monitoring;<br />
$yesterday=monitoring::get_yesterday__("DDMMYYYY");<br />
print "$yesterday\n";<br />
</code></p>
<p>Set executable rights:<br />
<code>$ chmod +x test.pl</code></p>
<p>And run it:<br />
<code>$ ./test.pl</code><br />
11062009</p>
<p>That&#8217;s all :)</p>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/06/some-perl-functions-for-monitoring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
