[racktables-users] Re: Noob assistance IP calculation assistance

  • From: Tim Price <tim@xxxxxxxxxx>
  • To: racktables-users@xxxxxxxxxxxxx
  • Date: Wed, 7 Mar 2012 09:43:42 +1300

You could potentially save that query in a file called query.txt for instance 
and then run it from the command line like so:

mysql -D racktables_db < query.txt > result.txt

That would output a result.txt file to the filesystem.  Or you could email the 
report to ourself like this:

mysql -D racktables_db < query.txt | mailx -s 'IP Address Report' 
email@xxxxxxxxxxx

Once you've got that configured you could schedule that report by putting the 
whole command in cron.
On 7/03/2012, at 9:23 AM, James S wrote:

> I did a little more research and was able to create some pretty basic SQL 
> queries that I ran individually in PhpMyAdmin, I then exported them. Is there 
> an easier way?
> 
> Here are two of the queries:
> 
> SELECT name, INET_NTOA(ip)
> FROM IPv4Network
> LIMIT 0 , 30;
> 
> SELECT name,reserved, INET_NTOA(ip)
> FROM IPv4Address
> LIMIT 0 , 30;
> 
> Should I be manually running them there or is there a better way to store the 
> SQL query so I can run it periodically?
> 
> 
> The Stockdale paradox
> 
> > From: infrastation@xxxxxxxxx
> > To: racktables-users@xxxxxxxxxxxxx
> > Subject: [racktables-users] Re: Noob assistance IP calculation assistance
> > Date: Mon, 5 Mar 2012 15:01:46 +0400
> > 
> > 01.03.2012, 23:47, "James S" <vahokie94@xxxxxxxxxxx>:
> > > I am new to Rack Tables. I am using it to track VMs in a small test 
> > > environment.
> > > I would like to print reports of IP space usage etc. I saw that in late 
> > > 2011 (Nov) someone posted about how to take the values from the database 
> > > and use the INET_NTOA/INET_ATON functions to convert the value to a 
> > > 'normal' IP value. 
> > > http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_inet-aton
> > > Would someone be able to share an SQL query that provides a report of IP 
> > > addresses in use, or point to a FAQ that shows me how to do it?
> > > Thanks,
> > > James
> > 
> > Hello, James.
> > 
> > The right answer varies depending on the data you are looking to extract 
> > and process. Do you have any design sample?
> > 
> > -- 
> > Denis Ovsienko
> >

Other related posts: