I just thought I'd share what I came across while trying to get cacti working with IIS and windows for snmp.
I started while version 0.6.4 was out, so although I'm running 0.6.5, I'm not sure if it's running the builtin smnp support or the snmpget utility i downloaded.
It has taken me a while to get it working, as eventually, I'd like to use mssql as backend server.
the snmp source makes a reference to wc-l
/* get the total number of interfaces */
//$num_interfaces = exec("$path_snmpwalk $hostname $community interfaces.ifTable.ifEntry.ifIndex | wc -l");
Now, as far i am concerned this is seems to be a pointless step. The next command runs the same, but stores the results into the array. Would it not be more efficient to just set $num_interfaces to $i (snmp_functions.php, lines 45-52)
The second issue I had was with the detection of a Win32 platform, as this failed.
I assume that this is because the environment variable server_software does not include the string "win32", maybe $config["remote_os"] should be manually set?
Windows Compatibility ;)
Moderators: Developers, Moderators
The $num_interfaces variable works that way because getting the value from the array is not always accurate when getting the total number of interfaces. I have experimented with this myself. If you can get it working otherwise, please tell.
I have to admit the remote os detection is not the best. It was all I could come up with at the time. If anyone has a "cleaner" way of doing this, I'd be more than happy to change it.
You may get your wish in the near future about using a MS SQL server once I impliment that database compability layer. Even once that is done, there will still be a lot of work required to make all of my SQL queries work on other SQL servers.
The current data gathering scripts are very unix-centric. If anyone wants to make win32 equivilants, feel free.
-Ian
I have to admit the remote os detection is not the best. It was all I could come up with at the time. If anyone has a "cleaner" way of doing this, I'd be more than happy to change it.
You may get your wish in the near future about using a MS SQL server once I impliment that database compability layer. Even once that is done, there will still be a lot of work required to make all of my SQL queries work on other SQL servers.
The current data gathering scripts are very unix-centric. If anyone wants to make win32 equivilants, feel free.
-Ian
On 2002-02-26 19:31, raX wrote:
The $num_interfaces variable works that way because getting the value from the array is not always accurate when getting the total number of interfaces. I have experimented with this myself. If you can get it working otherwise, please tell.
hmm, when did you find that if failed?
$num_interfaces = exec("$path_snmpwalk $hostname $community interfaces.ifTable.ifEntry.ifIndex | wc -l");
exec("$path_snmpwalk $hostname $community interfaces.ifTable.ifEntry.ifIndex",$out,$err);
ok, so exec returns the last line of the output which is what $num_interfaces returns, or it fills an array with every line of the output.
Provided the array is unset, then surely it should return the same, might need to check for empty array entries etc, but....
After, running the same command twice, you then loop with $i < $num_interfaces, surely this would shouw up as an issue, as if it does not return the same number then there will either be a) missing interfaces, or b) interfaces with null entries?
Paul
with regards to the OS detection, I know that windows sets an environment variable for _SERVER["OS"]. I can't remember if this is standard or not
phpinfo(INFO_GENERAL) should return the system/build date etc. I don't know if there's a method to access that information my directly.
What I don't get is assuming it only really needs to os options - *nix or windows, and one already has to configure database name, why not just have OS configured manually and defaulted to *nix?
phpinfo(INFO_GENERAL) should return the system/build date etc. I don't know if there's a method to access that information my directly.
What I don't get is assuming it only really needs to os options - *nix or windows, and one already has to configure database name, why not just have OS configured manually and defaulted to *nix?
The problem I would always have when not using '$num_interfaces = exec...' is I would get null interfaces. All I knew is adding that command fixed it for me at least. Perhaps this deserves some further investigation...
Thanks for those three suggestions about OS detection. I will explore them and see what I can come up with for future versions of cacti.
-Ian
Thanks for those three suggestions about OS detection. I will explore them and see what I can come up with for future versions of cacti.
-Ian
Who is online
Users browsing this forum: No registered users and 0 guests