-
Notifications
You must be signed in to change notification settings - Fork 928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running SyslogMonitor #90
Comments
The ability to also pass arguments would be great too, for example, running using port 1514 doesn't require extra privileges. |
I've not tried the example more less since initial commit, so it's not exactly user-friendly right now, it more explains how you can benefit from some oxidized features. So first question, does it work, at all, today? I understand that as you're doing init script for it, you've been able to succesfully run it, which makes me quite impressed already. You're getting actual user in git (git blame) and all? I'm amazed if we've not changed the API enough to break it. Perhaps ea7503d fixes your issue? |
ea7503d does fix that, thank you :) I've changed syslog.rb and it starts, and listens on the port. I'll test it shortly and let you know what happens! |
How about 02b3b0f does it fix your UDP port issue? |
02b3b0f works fine, if you pass a port number. It should default to 514 if no argument is given. |
Fixed in fb0e4e1 |
I have set up a 2960 to log the config changes, and SyslogMonitor is getting this as I saw an error connecting to port 8888 (I have it set to bind to the public IP). I now have it binding on 0.0.0.0:8888 but I see nothing in the logs - what is the best way to start debugging this? |
I'd first check in 'def ios' what are values you're sending to the rest client. What it should do is get syslog entry from far-end, get out information who made the config change and to which node, then it should ask oxidized via HTTP to fetch this node next and would pass the username as argument. Then when the node has finished your output model can consume this information, and git output will, git output will mark the user seen in syslog as the committer of the change. |
Ah, I see the issue. getname is not resolving the name, because we have no PTR for these IP's. I guess this relates to Issue #78 |
Right, and you now actually have name there as 'primary key', and it can't find your node? If you had IP as primary key, it would still working. Maybe there could be API call for /next_by_ip/XYZ so it wouldn't rely on finding by name. |
Perhaps /nodes/next/ could accept both a name and IP address? If it is a valid IP then use that, otherwise assume it is a name. That I think would help stop any future changes breaking it :) |
Here is where the matching happens: So I suppose something like index { |e| e.name == node or e.ip == node} might fix it, and insha'allah doesn't break anything else... |
That seems to work fine, I can pass "/node/next/" either the IP, or the name and it queues it for the next device. Syslog doesnt work correctly though, I dont see it queued. It is posting to the correct URL, the data it is sending is: {"user":"<username>","from":"<ipv4>","model":"ios","ip":"<ipv4>","name":"<ipv4>"} Where can we start to debug this? :) |
So what should happen, and has worked, at least loong time ago is:
Where are you failing? Is it not moving the node to the head of the queue? Or is it moving, but the data, like committer does not appear in git? |
Its failing on either point 5, or 6. Is there a way of adding more logging for the data being sent? What I do notice is that nodes.next references opt['msg'] which isnt sent as part of the data, could that be the issue here? |
'msg' missing shouldn't be a problem, it'll be used in 'commit message' if set, but not required. It's more curious if 'node' is set to something which works. I'd add 'p node' and 'p opt' before 'nodes.next. line in webapp.rb, to see how those variables are set, prior to being called. |
It looks like its failing on line 75 of webapp.rb - with this error: NameError - uninitialized constant Oxidized::API::WebApp::JSON: Adding "require 'json'" to the top of that file fixes this. The git repo now has the correct user as authored, and the IP the change was made from |
Some of our devices have reverse DNS, and that will resolve to a full host name including our domain. However, the "name" in Oxidized is a shorter version. I'm not sure of a sensible way of handling this. Perhaps we could have a config option to disable DNS resolution, if somebody is happy to do everything based on IP's alone? |
Fixed oxidized-web, thank you for all the hard work you've done to get the syslog working Option to disable DNS resolution should be somewhat easy to implement. |
You're welcome :) Its working very well at the moment - we see the user and their IP. Using GitList as it appears to be a simple web based git browser. I've changed the function getname in syslog.rb so it will return back the IP and that works fine. Perhaps we should just have a config variable for this? The next thing would be to have a wrapper for this, so we can run "/usr/local/bin/oxidized-syslog". Is that something that is easy to do so it isnt version dependent? :) |
Should this syslog code be a separate gem? I guess that way it will have a wrapper and can be demonized in the same way that oxidized itself is :) |
I really like 'gitlab' for hosting my git repos. (you could run 'git push' in crontab every 5min or 10min or what not, to push your oxidized repo periodically to 'upstream'). I think gemifying the syslog.rb to generic trigger which allows multiple types of triggers for config pull. The currently it already almost supports reading syslog file from filesystem in addition to udp/network. But I'm not personally going to contribute any time for it in foreseeable future, even though this feature probably would be quite interesting to many, if it were more userfriendly. |
I guess this can be closed, seeing MrRJ45 fixed this |
What is the best way to run the Syslog Monitor? I have tried this:
[program:oxidized-syslog]
command=/var/lib/gems/1.9.1/gems/oxidized-0.4.1/extra/syslog.rb
autostart=true
autorestart=true
user=oxidized
stderr_logfile=/var/log/oxidized-syslog.err.log
stdout_logfile=/var/log/oxidized-syslog.out.log
It fails with this:
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in
'require': cannot load such file -- ./rest_client (LoadError) from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in
require'from /var/lib/gems/1.9.1/gems/oxidized-0.4.1/extra/syslog.rb:17:in `
Hard coding the full path to rest_client.rb works fine, but all of this is version specific.
What would be nice would be to have /usr/local/bin/oxidized-syslog which can be ran and doesnt depend on the version number or hard coding paths :)
The text was updated successfully, but these errors were encountered: