Daveyz83
asked on
Perl with windows dos programs
I'm trying to write a snmp script from scratch to retrieve information about the equipments in the network (not using the ready made modules/libraries due to security policy in the organisation).
I've been using $variable = `snmpget ip oid` so the values will be returned to the variable and allow me to write it to a .xls file. This works perfectly for existing equipments until I come upon some equipments which no longer exist int he network. The snmpget command will then return a snmp error message within the Dos Prompt.
Is there anyway I can prevent the error from appearing? Or may I capture the error message so I can write that IP to a invalid equipment excel file.
Any suggestions will be appreciated.
I've been using $variable = `snmpget ip oid` so the values will be returned to the variable and allow me to write it to a .xls file. This works perfectly for existing equipments until I come upon some equipments which no longer exist int he network. The snmpget command will then return a snmp error message within the Dos Prompt.
Is there anyway I can prevent the error from appearing? Or may I capture the error message so I can write that IP to a invalid equipment excel file.
Any suggestions will be appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
... I guess that they've audited perl then ;) ?
...and DOS?
Just trying to highlight an issue to demonstrate how ridiculous it is! Of course, bear in mind that a code audit of this nature is normally *ONLY* valid for the version audited, and that upgrading requires a complete revalidation of the code, unless the update is done via a patch, *PLUS*, the validation should only apply to a local copy (the one that is validated), and this should have a validation date/approval header and associated hash (preferably signed with the validators key)to verify that the module being used is OK to use.
HTH:)
Just trying to highlight an issue to demonstrate how ridiculous it is! Of course, bear in mind that a code audit of this nature is normally *ONLY* valid for the version audited, and that upgrading requires a complete revalidation of the code, unless the update is done via a patch, *PLUS*, the validation should only apply to a local copy (the one that is validated), and this should have a validation date/approval header and associated hash (preferably signed with the validators key)to verify that the module being used is OK to use.
HTH:)
ASKER
Thanks for all the help rendered, i will give it a try!
With regard to the security concern, all our scripts/programs have to abide to certain structures, hence, my trouble. (seriously I do not see a point too, but heck, at least I learn something new everyday!)
Thanks to everyone.
With regard to the security concern, all our scripts/programs have to abide to certain structures, hence, my trouble. (seriously I do not see a point too, but heck, at least I learn something new everyday!)
Thanks to everyone.
However, thinking about this, if your security policy is that stringent, surely, it allows the inclusion of code that your company audits. After you have written your code, then it will be audited by someone before it is approved? Why can't you do a similar audit for the error.pm code?
This approach would save re-inventing the wheel, and provided the auditing process is done sensibly, will save your company time and money.
HTH:)