Windows Compatibility ;)

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
paul
Posts: 12
Joined: Thu Jan 31, 2002 7:00 pm

Post by paul »

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?
paul
Posts: 12
Joined: Thu Jan 31, 2002 7:00 pm

Post by paul »

as a side note, also remember that the custom scripts won't work as they are specific to *nix, e.g. grep isn't installed etc.
So if running cmd.php without removing/modifying those scripts, then it will display a number of errors/warnings.
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

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
paul
Posts: 12
Joined: Thu Jan 31, 2002 7:00 pm

Post by paul »

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
paul
Posts: 12
Joined: Thu Jan 31, 2002 7:00 pm

Post by 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 :wink:

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?
raX
Lead Developer
Posts: 2243
Joined: Sat Oct 13, 2001 7:00 pm
Location: Carlisle, PA
Contact:

Post by raX »

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
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests