OCS Diff script

Here is the script I used to generate hardware change reports from the OCS NG database.  This script is implemented much like the daily disk reports from OCS (see this).  Sorry there is no better documentation for this, I just have not had the time and soon will no longer have access to test or refine this.  If you post a comment here I will try to help as best I can and as time allows.

Download OCS Diff Version 1.0

15 Responses to “OCS Diff script”

  1. Raman Pillai says:

    Thanks, its functional now. But I am getting the output like :
    Computer name BANK-SUMANS last logged into by user sumans RAM has changed from 256 to 254
    Computer name IT-AJAYM last logged into by user ajaym CPU has changed from to Intel(R) Pentium(R) 4 CPU 2.40GHz
    Computer name IT-AJAYM last logged into by user ajaym RAM has changed from to 768
    Computer name BAG-HARSHU last logged into by user harshu CPU has changed from to Genuine Intel(R) CPU T2250 @ 1.73GHz

    Here the From field is empty for some instances , can you guess why this is happening . Here the users are in domain .

  2. Mike says:

    I would suggest modifying the script – try adding

    print_r($snapram);

    below the line where snapram is set (shown below) and then run the script manually. What are the results?

    $snapram = $snapline['memory'];

  3. caio says:

    onde colocar este script?

  4. Mike says:

    I would suggest reading this article and following the same general instructions including the location for the script. There is no GUI component to this, it does not link to the web interface of OCS … it is simply a script you can run either manually or schedule with cron to generate a report.

    Let me know if that does not make sense (and I hope my answer in English is OK since I don’t speak Portuguese).

    Mike

  5. Dioni Vidal says:

    Dei uma melhorada neste script de hardware e criei um para software, que notifica alterações de ip, espaço em disco, memória, processador, etc… e o de software que notifica instalações e desinstalações de softwares…

    Interessados entrem em contato pelo msn dionividal@hotmail.com ou pelo e-mail dionividal@gmail.com

  6. Mike says:

    I think I guessed right that your comment was Portuguese, so translated to English it is (approximately):

    I gave one improved in this script of the hardware and created one for software, that notifies alterations of IP, space in record, memory, processor, etc… and of software that notifies installations and desinstalações of softwares…

    In which case I would ask if you have posted it somewhere or if you would be willing to either post it or send it to me so I can add it here.

    Mike

  7. Fred Leão says:

    Helo Mike, Helo guys.

    I’ve made a response on another post “an update to OCS Diff Scripts” about a script of mine, but it still moderated! Are you guys alive ? It’s been a long time since the last comment here.

    It’s now ready to share at http://awaken.com.br/2010/06/07/ocs-alertas-e-notificacoes/

    Is about alerts & notifications of the machines activity. It has a nice config file and may still be improved a litle more. And I’ll integrate the other scripts(hard/soft diff) in my ocsstuff too.

  8. Mike says:

    Sorry for the delayed response Fred … I was enjoying a weekend off ;)

    Thanks for posting the link to your updates. Hopefully they will help others with similar interests.

    Mike

  9. narasimha rao says:

    helo guys

    how to run these scripts ocsalerts.tar.gz which will be downloaded from
    http://awaken.com.br/2010/06/07/ocs-alertas-e-notificacoes/

    help me

  10. Mike says:

    I am not sure whether the author of that particular set of scripts will check here or not. I would suggest you post a comment there where the scripts can be downloaded.

    Mike

  11. narasimha rao says:

    Helo Mike, Helo guys.

    how to implement ocsdiff scripts as my ocs ng server on linux.
    hardware change reports from the OCS NG database. is possible to redirect hardware changes to a text file

  12. Mike says:

    Why don’t you have a look at this post and see if that doesn’t help. The same method can be used to implement the diff scripts as is used to implement the diskspace reports.

    As for the ability to save the output in a file, take a look at the code at line 96. You will note that the text is contained in the variable called $msg. The code starting at line 96 sends the text via email and it could easily be replaced or augmented with code that saves the text ($msg) to a file instead of via email (PHP fopen, fwrite, fclose, etc).

    If you look at the link and still can’t figure out how to implement this reply back with any issues you are hitting and I will try to help.

    Mike

  13. erik says:

    Hi Mike,

    Have tried your script, but I am getting these errors

    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /var/www/ocsng/reports/ocsdiff.php on line 127

    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /var/www/ocsng/reports/ocsdiff.php on line 128

    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /var/www/ocsng/reports/ocsdiff.php on line 129

    Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in /var/www/ocsng/reports/ocsdiff.php on line 130

    - by the way under the ocsdiff_conf.php where it has
    $domains = array(
    are
    0 => array(
    ‘name’ => ‘XXXXX’,
    ‘email’ => “email@yourdomain.tld”),
    the destined receiver of the update?

    -please instruct, thanks..

  14. erik says:

    balony… sorry…
    wasn’t reading the comments on the script
    -all set now, thanks!!

    your great

  15. [...] fazer com que o OCS* alerte sobre alterações de hardware, você pode baixar os arquivos: OCSDiff e Conf e Disk Report. Após isso cole-os na pasta: [...]

Leave a Response