Closed evanderv closed 9 years ago
So the vendor_num will pull from the sysObjectID and maybe there's no data there. I don't think I accounted for that in the code. I ran into that same error testing the utility on other systems.
I'm actually just in the middle of wrapping up the fix for this. I'm curious how a \r got in there - do you mind helping me debug? Above line 127 where v_match is set, can you add a line to print the sysobject?
print sysobject
v_match = vendor_match(numbers, sysobject)
Just pushed some changes that might fix your problem. If it didn't I added a debug option that will print the host data out.
First, do a git pull.
Then run it with debug:
./icinga-autod.py -n NETWORK/24 -L Location -d true
Paste debug output here (delete any sensitive info like special snmp communities)
Perfect! I will try that. Thanks
Traceback (most recent call last):
File "./icinga-autod.py", line 2, in
I forgot to commit init.py for that directory. Try a git pull now and run again. Sorry about the issues.
It's doing its thing but this was at the top...
Unknown sysObjectID prefix encountered - you can add it to the prefix list in vendor_match(), but please report this on GitHub
Ok that's what I thought would happen. Is it happening for all your devices or just one?
Well I think just one in fact I don't think it actually finished, if it did it was fast. I had 89 objects.
Shouldn't I see a file with the hosts for icinga?
It's because I had it exit if it encountered an unknown sysObjectID which was not very wise of me. Reworked that portion - try a git pull and run again. Thanks for hanging in there.
OK that worked. I did it to one device that was having that problem. I will try the whole subnet again.
Looks good. I am going to put the file in icinga and see what it looks like
Great. Let me know if you have any issues with it running in icinga2.
running in icinga2? I thought I had to do this manually. Is there a way in icinga2 to run it?
Yes you have to manually copy it to /etc/icinga2/conf.d/ then restart icinga2. What I meant was does your instance restart successfully or give an error in /var/log/icinga2/startup.log?
critical/config: Error: Value computed is not used. Location: /etc/icinga2/conf.d/hosts_location.conf(141): vars.location = "Location" /etc/icinga2/conf.d/hosts_location.conf(142): vars.vendor = "NSC" /etc/icinga2/conf.d/hosts_location.conf(143): vars.os == "Linux" ^^^^^^^^^^^^^^^^^^ /etc/icinga2/conf.d/hosts_location.conf(144): /etc/icinga2/conf.d/hosts_location.conf(145): }
I thought I fixed that... It should be a single = not ==.
You can do a git pull, run the script again, and copy the config over or you can run this command on your config file to get rid of the ==
sed -i 's/vars.os ==/vars.os =/g' /etc/icinga2/conf.d/hosts_location.conf
A side note is that I typically use the -L option to specify a certain network location or datacenter, like DC1 or Headquarters, etc. Maybe I should make it optional?
Oh ok I really don't need it. I would probably do that later. The -L option that is.
It looks like they populated and so there was no errors after the restart. Looks good. I'll keep watching if you make changes or additions.
Awesome. Just curious - what Linux distro are you running? Running into a few issues on CentOS which is why I ask.
Ubuntu 14.04
When the file creates a hosts and ads the object it's grabbing the name of the hosts from the domain servers (Active Directory) but it appends (the ip address) to the host name. Because of this icinga is spitting invalid hostname.
I'm not sure how that is happening - can you paste a line of debug output where this is happening to a host?
Found 1 hosts - gathering more info (can take up to 2 minutes) "hostname" (10.10.10.7) {'sysdesc': '', 'snmp_version': '2c', 'hostname': '', 'vendor': 'NA', 'community': 'unknown'}
Hm. Ok - can you provide some details on the host(s)? What kind of devices are these?
Also can you paste the output of 'nmap -v' on your Ubuntu box? Thanks
Its a windows 2008 server. Starting Nmap 6.40
Ok how about the output of:
nmap -sP -sn 10.10.10.7
Starting Nmap 6.40 ( http://nmap.org ) at 2015-09-02 21:26 EDT Nmap scan report for "hostname" (10.10.10.7) Host is up (0.0017s latency). MAC Address: 00:15:5D:0A:16:05 (Microsoft) Nmap done: 1 IP address (1 host up) scanned in 0.23 seconds
Ok I did not account for hostnames being returned by DNS from NMAP scans but should have. I will fix that. Thanks
np. I am off to bed I can check in the morning. I am in Michigan so I am EST so 1 hour off I think.
I'll have it fixed by then. Thanks for reporting your issues, I really appreciate it.
Glad I can help.
It worked!
Awesome, good to hear. What do you think about its usefulness? Did it make the initial adding hosts easier?
Yes it did. Works great!
On Thu, Sep 3, 2015 at 12:15 PM, Wylie Hobbs notifications@github.com wrote:
Awesome, good to hear. What do you think about its usefulness? Did it make the initial adding hosts easier?
— Reply to this email directly or view it on GitHub https://github.com/hobbsh/icinga-autod/issues/1#issuecomment-137499511.
Great to hear! I'm gonna close this issue out but if you have any questions, issues or suggestions please let me know. Thanks again,
Wylie
When I try running it looking at an individual ip or a whole subnet I get this....
Traceback (most recent call last): File "./icinga-autod.py", line 335, in
main()
File "./icinga-autod.py", line 127, in main
v_match = vendor_match(numbers, sysobject)
File "./icinga-autod.py", line 156, in vendor_match
vendor_string = numbers[vendor_num]
KeyError: '\r'
Any ideas?
Saw this on reddit. I hope it work would be nice. Just trying out icinga2 today.