Talk:OCS Inventory Tools

From SME Server
Jump to navigationJump to search

ipdiscover bug

We need to confirm that ipdiscover works when the smeserver is the forced client.

I Tried the following:

ipdiscover eth0 10
Important.png Note:
Usage : ipdiscover [iface name] [latency in ms]


Here's what I got on my server:

<IPDISCOVER>
<H>192.168.0.100<M>00:xx:xx:xx:xx:xx</M><N>pc-00100.mydomain.com</N></H>
<H>192.168.0.253<M>00:xx:xx:xx:xx:xx</M><N>pc-00253.mydomain.com</N></H>
<H>192.168.0.254<M>00:xx:xx:xx:xx:xx</M><N>pc-00254.mydomain.com</N></H>
</IPDISCOVER>

Sounds like it's working for me... But IpDiscover discovers nothing when launched by SME OCS' Agent. There must be a problem here!

Windows Agent don't have this problem...

Cool34000


deployment

deletion bug

When you delete a package, ocs complains, but it deletes the files anyway, document later

Stefen


The only way I was able to reproduce an error on package deletion is when I refreshed the page (as files were already removed, I got an error)

Could you be more clear on this bug? How did it happened?

Cool34000


add a package, deploy > activate > click on the red X

ERROR: Can't delete directory /opt/inventory/ocs/download/1194511477

I have documented that you can ignore the error, maybe i should say if you see the error you can ignore?

stephen


Upload size limit

Must document that on the Wiki:

Max allowed packet value is locked at 10M by default on SME.

No need to create a custom template: DB values already exist for this! They are hidden in php.ini templates 40DataHandling and 60FileUploads

What is the impact of setting large values on the server?


php Values can be changed with the following:

config setprop php UploadMaxFilesize 50M PostMaxSize 50M
expand-template /etc/php.ini
signal-event ocsglpi-update

I will add php.ini to the list of templates2expand

Let's delete the mysql custom-template in the RPM and document how to change both values to allow uploading larger files!


Cool34000


I think you should restrict the affect to just the ocs directory

config setprop ocs MaxUpload 50M
php_admin_value post_max_size $ocs{'MaxUpload'}
php_admin_value upload_max_filesize $ocs{'MaxUpload'}
expand-template /etc/httpd/conf/httpd.conf
/etc/init.d/httpd-e-smith condrestart

$ocs{'MaxUpload'} default = 10M

yes delete /etc/e-smith/templates-custom/etc/my.cnf/005mysqld

stephen



you have to set a db value anyway so you may as well add it to the ocs fragment


Yes, I tried to limit changes to ocs in the template, but it didn't worked for me.

Maybe I was missing this line:

/etc/init.d/httpd-e-smith condrestart

Testing this now, of course it would be better to limit these values only for ocs!

=> Still doesn't work... Values are expanded but can't upload file >10M... Looks like this value must be global.

Here's the non working template:

#--------------------------------------------------------------
# OCS Inventory Next Generation
#--------------------------------------------------------------
Alias /download /opt/inventory/ocs/download
Alias /ocs      /opt/inventory/ocs/ocsreports
+{
+    if (exists $ocs{'URL'})
+      { $OUT .= "Alias  /$ocs{'URL'} /opt/inventory/ocs/ocsreports"; }
+}

<Directory /opt/inventory/ocs/download>
  Options None
  Options +Indexes
  Options +Includes
  AllowOverride None
  order deny,allow
  deny from all
  allow from { $localAccess }
  php_admin_value open_basedir /opt/inventory/ocs/download:/tmp
+  php_admin_value post_max_size $ocs{'MaxUpload'}
+  php_admin_value upload_max_filesize $ocs{'MaxUpload'}
</Directory>
config setprop ocs MaxUpload 50M
signal-event ocsglpi-update
/etc/init.d/httpd-e-smith condrestart

Cool34000


not download, change ocsreports [we don't upload from /download]

<Directory /opt/inventory/ocs/ocsreports>

Stefen


How stupid am I? Thanks for the fix!

Cool34000


aliases

Future RPM will allow to add aliases using 'URL' value to ocs and glpi

{
  if (exists $foo{'URL'})
  { $OUT .= "Alias  /$foo{'URL'}  /opt/foo\n"; }
}

rpm changes

for your consideration

split help file out into separate rpm to save redownloading
use rm -f root/path/to/help in the spec file
no need to touch the ocs.tar.qz
less chat in the install output, just say look at the wiki page, + renamed wiki page
don't use signal-event my-own-event
charlie doesn't want new events created, so we obey, (mostly)
just give all the commands, or use an existing one, we could use domain-modify

stephen


Thanks for these comments... I didn't know that we should not use events functions for our own events. Any chance to have an explanation? This sounds very weird to me (but there must be some reasons!)

Anyway, I will use domain-modify to expand all templates... I will try to (mostly) obey ;-)

Here's the actual createlinks perl script:

#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);

# Templates to adjust
templates2events("/etc/e-smith/sql/init/80ocs_mysql.sql",          qw(ocsglpi-update post-upgrade ));
templates2events("/etc/e-smith/sql/init/82glpi_mysql.sql",         qw(ocsglpi-update post-upgrade ));
templates2events("/etc/e-smith/sql/init/84ocs-glpi.sql",           qw(ocsglpi-update post-upgrade ));
templates2events("/etc/httpd/conf/httpd.conf",                     qw(ocsglpi-update post-upgrade ));
templates2events("/etc/ocsinventory-agent/ocsinv.conf",            qw(ocsglpi-update post-upgrade ));
templates2events("/etc/php.ini",                                   qw(ocsglpi-update post-upgrade ));
templates2events("/opt/inventory/glpi/config/config_db.php",       qw(ocsglpi-update post-upgrade ));
templates2events("/opt/inventory/ocs/ocsreports/dbconfig.inc.php", qw(ocsglpi-update post-upgrade ));
# Services to restart
safe_symlink("restart", "root/etc/e-smith/events/ocsglpi-update/services2adjust/httpd-e-smith");
safe_symlink("start",   "root/etc/e-smith/events/ocsglpi-update/services2adjust/mysql.init");

As you can see, there's a loooong list as all is templated!


I will also delete all chat in the RPM. That's an old habits of mine...

About the help file, I remember reading that it must be placed into www/ocs/files/guide.pdf (else I would have put this file in /usr/share/doc/) so we cannot delete this file from the RPM :'(



/etc/e-smith/sql/init/* should only be used one to create the db table, then it is deleted
httpd.conf and php.ini are in standard events (and are we still changing php.ini?)
which only leaves three fragments to document in the rare case that something changes

so here we don't really need the event, 
a little documentation will do (and you had to doc the new event anyway)

+I'm looking at the src.rpm and it needs to work a different way before this will work, looking... ++easiest way is to just delete the guide.pdf from the tar.gz, and build another rpm with just the pdf

yes put the help file at www/ocs/files/guide.pdf
just make a new rpm with only that file + make it a dependancy
then you can delete it from the main rpm

+ok, you already have them, just need to check on a clean install what is available

another thing to do in time is...
add all the requires (to perl dependencies)  that are available from existing repos
then you can reduce the number of perl rpm in your download
the less you are responsible for the better

++ - ocsagent.exe is now included in ./ocs/files

I'm not sure this is needed, 
lets delete it from the server and see if it affects anything before removing from the rpm
it does generate a warning during the web installer but that is irrelevant to us (from dev in ocs forums)

stephen


Yes, all that goes in /etc/e-smith/sql/init/ is dropped after a successful importation. I know that, I use it this way:

  • 3 templates to dynamically create the DB+User+Password and change OCS' password in GLPI' database. These templates are harmless if re-expanded...
  • 2 databases (one for ocs, one for glpi). They are imported ONLY ON NEW INSTALL. These 2 databases are dropped once imported (no need to keep them!)... It also allows me to import the right GLPI database according to $LANG

So when the RPM runs:

  • 3 files loaded on RPM updates
  • 5 files loaded on RPM install

Take a look on their name when all 5 files are put in /etc/e-smith/sql/init/ once expanded


About ocsagent.exe, it doesn't help you when you've installed the Agent, but if you use the standalone OCSLogon.exe to send inventories, the client will not download needed files. This file is needed!


OK for the doc new RPM... That's a good way to save bandwidth!