sensu-plugins / sensu-plugins-filesystem-checks

This plugin provides native instrumentation for monitoring and metrics collection, including:health, usage, and various metrics of filesystem attributes.
http://sensu-plugins.io
MIT License
8 stars 25 forks source link

Execution error #18

Closed uojiaku closed 7 years ago

uojiaku commented 7 years ago

uojiaku@mylaptop plugins]$ /etc/sensu/plugins/check-fs-writable.rb --dir /,/data,/var, /etc/sensu/plugins/check-fs-writable.rb:37: syntax error, unexpected ':', expecting kEND description: 'Directory to check for writability', ^ /etc/sensu/plugins/check-fs-writable.rb:37: syntax error, unexpected ',', expecting kEND /etc/sensu/plugins/check-fs-writable.rb:38: syntax error, unexpected ',', expecting kEND /etc/sensu/plugins/check-fs-writable.rb:39: syntax error, unexpected ',', expecting kEND /etc/sensu/plugins/check-fs-writable.rb:43: syntax error, unexpected ':', expecting kEND description: 'Auto discover mount points via fstab', ^ /etc/sensu/plugins/check-fs-writable.rb:43: syntax error, unexpected ',', expecting kEND /etc/sensu/plugins/check-fs-writable.rb:44: syntax error, unexpected ',', expecting kEND /etc/sensu/plugins/check-fs-writable.rb:48: syntax error, unexpected ':', expecting kEND description: 'Print debug statements', ^ /etc/sensu/plugins/check-fs-writable.rb:48: syntax error, unexpected ',', expecting kEND

uojiaku commented 7 years ago

I keep getting this error message. What should I do?

GhostLyrics commented 7 years ago

Try removing the , after /var.

uojiaku commented 7 years ago

Here's what I get.

[uojiaku@mylaptop plugins]$ /etc/sensu/plugins/check-fs-writable.rb --dir / ,/data/,/var /etc/sensu/plugins/check-fs-writable.rb:37: syntax error, unexpected ':', expect ing kEND description: 'Directory to check for writability', ^ /etc/sensu/plugins/check-fs-writable.rb:37: syntax error, unexpected ',', expect ing kEND /etc/sensu/plugins/check-fs-writable.rb:38: syntax error, unexpected ',', expect ing kEND /etc/sensu/plugins/check-fs-writable.rb:39: syntax error, unexpected ',', expect ing kEND /etc/sensu/plugins/check-fs-writable.rb:43: syntax error, unexpected ':', expect ing kEND description: 'Auto discover mount points via fstab', ^ /etc/sensu/plugins/check-fs-writable.rb:43: syntax error, unexpected ',', expect ing kEND /etc/sensu/plugins/check-fs-writable.rb:44: syntax error, unexpected ',', expect ing kEND /etc/sensu/plugins/check-fs-writable.rb:48: syntax error, unexpected ':', expect ing kEND description: 'Print debug statements', ^ /etc/sensu/plugins/check-fs-writable.rb:48: syntax error, unexpected ',', expect ing kEND

GhostLyrics commented 7 years ago

Please run which ruby and ruby -v and paste the output.

(btw, here's how to make nicely formatted code blocks 😄 )

uojiaku commented 7 years ago

[uojiaku@mylaptop plugins]$ sudo ruby -v ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]

So I tried this and got a good result:

[uojiaku@mylaptop plugins]$ /opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-fs-writable.rb -d /tmp CheckFSWritable OK: All filesystems are writable

But when I tried:

[uojiaku@mylaptop plugins]$ sudo /opt/sensu/embedded/bin/ruby /etc/sensu/plugins/check-fs-writable.rb -a CheckFSWritable WARNING: No mount points found

I know I have mount points listed.

GhostLyrics commented 7 years ago

well, what does your /etc/fstab say?

majormoses commented 7 years ago

If I had to take a guess it would be this: https://github.com/sensu-plugins/sensu-plugins-filesystem-checks/blob/master/bin/check-fs-writable.rb#L71-L73

  def acquire_vol_groups
    `vgdisplay|grep 'VG Name'|awk '{print $3}'`
  end

When it shells back out it is no longer using its sudo privs. We could maybe enhance it with an option to sudo this.

majormoses commented 7 years ago

closing due to inactivity, if you would still like help please comment back with the requested information and we will be more than happy re-open and work through your issue.