![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Well, I had written a shell script, that listed all the packages of all my servers AIX. It then grouped and sorted information in an html formatted array.
Unfortunatelly this script was too long and not enough fast. So I had the idea to use a tool more flexible powerfull and light.:sqlite.
sqlitesupplies a ligth database without putting a whole machine in work as mysql or PostgreSQL will.
Thesite where you can find sqlite isPmWiki SQLite
You can complie source of sqlite, to have a 32 bits or 64bits version depending of your needs.
rpms are also available for download in 32 bits. It works fine enough for the use I have planned to do. I have mirrored the files and you can download them here:
Package | Description |
---|---|
dependence | |
readline | |
sqlite3 |
The following script will create a lslpp.s3 database that will be filled by the name of the packages installed on the network servers. The file liste_machines contains the list of all the servers , one server by line. The acocunt intranet have to be created on each server and have a right ssh certificate to launch the script on each server without having to enter the password.
We extract the list of package on each server and then we format in csv mode collected data. Separator caracter choosen is :. Indeed, a comma can raise problems because this character exists in the description of AIX package.
Then I add by the sed command the name of each server and the name of the package.
#!/usr/bin/ksh db="lslpp.s3" sqlite3 $db "create table lpp(serveur varchar(12), package varchar(20),fileset varchar(30), level varchar(8),state varchar(1),description varchar(50))" for i in `cat liste_machines` do echo $i ssh intranet@$i lslpp -Lc | grep -v "#" | awk -F ":" '{ print $1,":",$2,":",$3,":", $6,":",$8 }' > lslpp.imp sed "s/^/$i: /" lslpp.imp > lslpp.imp2 sqlite3 $db << 'EOC' .separator : .import lslpp.imp2 lpp EOC done
Nous disposons maintenant d’une base locale We have now a local lslpp.s3 database which contains our information. We are going to write a small quite simple script to format data. The page will be made by a header of document, the data extracted by a sql request and the end of page.
This gives that script:
#!/usr/bin/ksh db="lslpp.s3" cat << 'HEAD' > lslpp.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso8859_15" /> <meta name="generator" content="script shell 1.0" /> <title>Packages des serveurs systeme AIX</title> <body> <p> <table border=1> <tr> <th>serveur</th> <th>package</th> <th>fileset</th> <th>level</th> <th>state</th> <th>description</th> </tr> HEAD sqlite3 $db 'select * from lpp order by serveur,package,level' |awk -F "|" '{ printf "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", $1,$2,$3,$4,$5,$6 }' >> lslpp.html cat << 'FOOT' >> lslpp.html </table> </body> </html> FOOT