.Events undefined Error while building wmibeats


(Sunil Raj) #1

I am trying to build the wmibeats code in windows 7 with the following command

E:\Go_Prj\src\github.com\eskibars\wmibeat>go build

and I get this error

#github.com/eskibars/wmibeat/beater
*beater\wmibeat.go:177: b.Events undefined (type beat.Beat has no field or method Events)

When I try to run the command
E:\Go_Prj\src\github.com\eskibars\wmibeat>make
i get the following error

glide update --no-recursive
make: glide: Command not found
make: *** [Makefile:14: init] Error 127

I am very new to the go programming language and finding it difficult to debug it.
Please guide
Sunil


(Sunil Raj) #2

Ok, just figured it out. I had to download glide from here and set it an the Path variable.
That fixed it


(Mike ) #3

Hi Sunil-

I have downloaded the Release file (https://github.com/eskibars/wmibeat/releases) of wmibeats and tried building it with the command (./wmibeat -c wmibeat.yml -e -d "*") on my windows-7 machine.

But, I get this error message "Start error: loading config file error: Failed to apply config wmibeat.yml: type mismatch. Exiting."

The downloaded release version has only couple of files, wmibeat.exe and .yml files.

Please let me know, how do I resolve this issue. Thanks !


(Steffen Siering) #4

this error message seems to be related to your config file.


(Mike ) #5

Thanks for your reply Steffens.
I downloaded the wimbeat as a zip file from GIt repository; I've got only .exe and .yml files. I don't see any config files.
Download Path: (https://github.com/eskibars/wmibeat/releases)

I do not want to the build the project again, I was trying to download, configure it and run the service.

Could you please point me to the right path to download the full content of winbeat files. Thanks !

Prakash.


(Tudor Golubenco) #6

Can you post the full log file, please? I assume you didn't change anything in the yml file?


(Mike ) #7

Hi @tudor

Attached is my YML file

I don't have any logs created.

After I download the wimbeat release file, I've had only couple of files wimbeat.exe file and wimbeat.yml file.


(Mike ) #8

Could some one help me out here please.
how do I start the wmibeat ?


(Ofir Granot) #9

Hi,

I gave up when tried to rebuild it because I still had that issue after I completed implemeting for the client windows environment all the prerequired components git & goland & elastic beats & go-ole & glide.

C:\Go\src\github.com\eskibars\wmibeat>go build

github.com/eskibars/wmibeat/beater

beater\wmibeat.go:174: b.Name undefined (type *beat.Beat has no field or method Name)
beater\wmibeat.go:177: b.Events undefined (type *beat.Beat has no field or method Events)

so I took and used the relased build which contain the wmibeat.exe & wmibeat.yml, configued the executed it successfully (using wmibeat -c wmibeat.yml -e -d "*")
The only issues I had to figure out was for places at the yml config file where I used the TAB key - only regular spaces allowed.
My sample configuration:

################### WMIBeat Configuration Example #########################

############################# wmibeat ######################################

wmibeat:
  # Defines how often an event is sent to the output
  period: 30s
  
  classes:
	- class: Win32_OperatingSystem
	  fields:
	  - FreePhysicalMemory
	  - FreeSpaceInPagingFiles
	  - FreeVirtualMemory
	  - NumberOfProcesses
	  - NumberOfUsers
	- class: Win32_PerfFormattedData_PerfDisk_LogicalDisk
	  fields:
	  - Name
	  - FreeMegabytes
	  - PercentFreeSpace
	  - CurrentDiskQueueLength
	  - DiskReadsPerSec
	  - DiskWritesPerSec
	  - DiskBytesPerSec
	  - PercentDiskReadTime
	  - PercentDiskWriteTime
	  - PercentDiskTime
	  whereclause: Name != "_Total"
	  objecttitlecolumn: Name
	- class: Win32_PerfFormattedData_PerfOS_Memory
	  fields:
	  - CommittedBytes
	  - AvailableBytes
	  - PercentCommittedBytesInUse
output:
  logstash:
	hosts: ["xxx.yy.zzzz.net:5044"]
	# Number of workers per Logstash host.
	worker: 1
	index: wmibeat

	# Optional TLS. By default is off.
	tls:
	  certificate_authorities: ["C:/XXX/logstash-forwarder_xxx.crt"]
############################# Logging #########################################

# There are three options for the log ouput: syslog, file, stderr.
# Under Windows systems, the log files are per default sent to the file output,
# under all other system per default to syslog.
logging:

  # Send all logging output to syslog. On Windows default is false, otherwise
  # default is true.
  #to_syslog: true

  # Write all logging output to files. Beats automatically rotate files if rotateeverybytes
  # limit is reached.
  #to_files: false
  to_files: true
  # To enable logging to files, to_files option has to be set to true
  files:
	# The directory where the log files will written to.
	#path: /var/log/mybeat
	path: C:/XXX/YYY/ELK Stack/wmibeatLog
	# The name of the files where the logs are written to.
	#name: mybeat
	name: wmibeat
	# Configure log file size limit. If limit is reached, log file will be
	# automatically rotated
	rotateeverybytes: 10485760 # = 10MB

	# Number of rotated log files to keep. Oldest files will be deleted first.
	keepfiles: 7

  # Enable debug output for selected components. To enable all selectors use ["*"]
  # Other available selectors are beat, publish, service
  # Multiple selectors can be chained.
  #selectors: [ ]

  # Sets log level. The default log level is error.
  # Available log levels are: critical, error, warning, info, debug
  level: error

(system) #10