adejoux / nmon2influxdb

Make NMON data dynamic with InfluxDB
GNU Affero General Public License v3.0
80 stars 29 forks source link

panic #53

Closed opeyrega closed 6 years ago

opeyrega commented 6 years ago

Hello,

when i try 0.9 version all works perfectly with nmon linux file. But with latest version, i have this kind of error :


REC[root@FRLLOGR01 ~/test2]# /app/nmon/bin/nmon2influxdb  --debug --debug-file test -d toto  import /log/REC1/fve/nmon/old/FRLURCOR02_170804_1900.nmon
2017/08/11 15:37:15 Generating default configuration file : /root/.nmon2influxdb.cfg
2017/08/11 15:37:15 Using configuration file /root/.nmon2influxdb.cfg
panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x7fa800, 0xc420012110)
        /usr/lib/golang/src/runtime/panic.go:500 +0x1a1
github.com/adejoux/influxdbclient.(*InfluxDB).ReadLastPoint(0xc4200a43f0, 0x87d46c, 0x5, 0xc420136540, 0x87f02d, 0x9, 0x0, 0x1, 0x0, 0x0, ...)
        /app/nmon/nmon2influxdb/src/github.com/adejoux/influxdbclient/api.go:296 +0x2b7
github.com/adejoux/nmon2influxdb/nmon.Import(0xc42009cb00)
        /app/nmon/nmon2influxdb/src/github.com/adejoux/nmon2influxdb/nmon/import.go:84 +0x5d6
github.com/codegangsta/cli.HandleAction(0x7d7680, 0x8bf348, 0xc42009cb00, 0xc420072f00, 0x0)
        /app/nmon/nmon2influxdb/src/github.com/codegangsta/cli/app.go:492 +0x7c
github.com/codegangsta/cli.Command.Run(0x87d8f4, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x882430, 0x11, 0x0, ...)
        /app/nmon/nmon2influxdb/src/github.com/codegangsta/cli/command.go:210 +0xbb9
github.com/codegangsta/cli.(*App).Run(0xc420067d40, 0xc420088000, 0x8, 0x8, 0x0, 0x0)
        /app/nmon/nmon2influxdb/src/github.com/codegangsta/cli/app.go:255 +0x7b2
main.main()
        /app/nmon/nmon2influxdb/src/github.com/adejoux/nmon2influxdb/main.go:317 +0x22fc

 cat test
2017/08/11 15:37:15 NEW NMON2INFLUXDB EXECUTION
2017/08/11 15:37:15 Creating InfluxDB database toto
2017/08/11 15:37:15 SetRetentionPolicy: CREATE RETENTION POLICY "log_retention" ON "nmon2influxdb_log" DURATION 2d REPLICATION 1 DEFAULT
2017/08/11 15:37:15 configuration: {Debug:true DebugFile:test Timezone:Europe/Paris InfluxdbUser:secretuser InfluxdbPassword:secret InfluxdbServer:localhost InfluxdbPort:8086 InfluxdbSecure:false InfluxdbSkipCertCheck:false InfluxdbDatabase:toto GrafanaUser:secretuser GrafanaPassword:secret GrafanaURL: GrafanaAccess: GrafanaDatasource: HMCServer: HMCUser:secretuser HMCPassword:secret HMCDatabase:nmon2influxdbHMC HMCDataRetention: HMCManagedSystem: HMCManagedSystemOnly:false HMCSamples:0 ImportSkipDisks:false ImportAllCpus:false ImportBuildDashboard:false ImportForce:false ImportSkipMetrics:JFSINODE|TOP|PCPU ImportLogDatabase:nmon2influxdb_log ImportLogRetention:2d ImportDataRetention: ImportSSHUser:root ImportSSHKey:/root/.ssh/id_rsa DashboardWriteFile:false StatsLimit:0 StatsSort:mean StatsFilter: StatsFrom: StatsTo: StatsHost: Metric: ListFilter: ListHost: Inputs:[]}
2017/08/11 15:37:15 Adding serie CPU_ALL
2017/08/11 15:37:15 Adding serie DISKBSIZE
2017/08/11 15:37:15 Adding serie DISKBUSY
2017/08/11 15:37:15 Adding serie DISKREAD
2017/08/11 15:37:15 Adding serie DISKWRITE
2017/08/11 15:37:15 Adding serie DISKXFER
2017/08/11 15:37:15 Adding serie JFSFILE
2017/08/11 15:37:15 Adding serie MEM
2017/08/11 15:37:15 Adding serie NET
2017/08/11 15:37:15 Adding serie NETPACKET
2017/08/11 15:37:15 Adding serie PROC
2017/08/11 15:37:15 ERROR: parsing the following line : TOP,%CPU Utilisation
2017/08/11 15:37:16 Adding serie VM
2017/08/11 15:37:16 NMON file separator: ,
2017/08/11 15:37:16 query: SELECT last("value") FROM "timestamp" WHERE "file" = 'FRLURCOR02_170804_1900.nmon'

` No database were created

Regards

adejoux commented 6 years ago

Hello,

Sorry for the late answer. I was in vacation with poor internet connection.

I couldn't reproduce the problem with the sample linux file I have in the repository.

Is it possible for you to attach your nmon file?

Regards,

Alain

opeyrega commented 6 years ago

Hello,

test.zip

/app/nmon/bin/nmon2influxdb -h

NAME: nmon2influxdb - upload NMON stats to InfluxDB database

USAGE: nmon2influxdb [global options] command [command options] [arguments...]

VERSION: 0.9.0

/app/nmon/bin/nmon2influxdb -d TEST import /root/test.nmon

Generating default configuration file : /root/.nmon2influxdb.cfg ################################################### File /root/test.nmon imported : 512046 points !

--> It's OK

--> so I delete configuration file and db in influxdb.

rm /root/.nmon2influxdb.cfg rm: remove regular file `/root/.nmon2influxdb.cfg'? y

influx

Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring. Connected to http://localhost:8086 version 0.12.1 InfluxDB shell 0.12.1

show databases name: databases

name _internal TEST nmon2influxdb_log

DROP DATABASE TEST DROP DATABASE nmon2influxdb_log

/root/nmon2influxdb -h

2017/08/28 10:18:01 Generating default configuration file : /root/.nmon2influxdb.cfg 2017/08/28 10:18:01 Using configuration file /root/.nmon2influxdb.cfg NAME: nmon2influxdb - upload NMON stats to InfluxDB database

USAGE: nmon2influxdb [global options] command [command options] [arguments...]

VERSION: 2.1.3

/root/nmon2influxdb -d TEST import /root/test.nmon

2017/08/28 10:18:33 Using configuration file /root/.nmon2influxdb.cfg 2017/08/28 10:18:33 Creating InfluxDB database TEST panic: runtime error: index out of range

goroutine 1 [running]: panic(0x7faac0, 0xc420012100) /usr/local/go/src/runtime/panic.go:500 +0x1a1 github.com/adejoux/influxdbclient.(InfluxDB).ReadLastPoint(0xc420210240, 0x87c7ee, 0x5, 0xc4201745d0, 0x87e3b7, 0x9, 0x0, 0x1, 0x0, 0x0, ...) /home/adejoux/go/src/github.com/adejoux/influxdbclient/api.go:285 +0x2b7 github.com/adejoux/nmon2influxdb/nmon.Import(0xc420097cc0) /home/adejoux/go/src/github.com/adejoux/nmon2influxdb/nmon/import.go:83 +0x53e github.com/codegangsta/cli.HandleAction(0x7d7f00, 0x8ce580, 0xc420097cc0, 0xc420018f00, 0x0) /home/adejoux/go/src/github.com/codegangsta/cli/app.go:487 +0x7c github.com/codegangsta/cli.Command.Run(0x87cc7c, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8817df, 0x11, 0x0, ...) /home/adejoux/go/src/github.com/codegangsta/cli/command.go:207 +0xb96 github.com/codegangsta/cli.(App).Run(0xc420091380, 0xc42000c0a0, 0x5, 0x5, 0x0, 0x0) /home/adejoux/go/src/github.com/codegangsta/cli/app.go:250 +0x812 main.main() /home/adejoux/go/src/github.com/adejoux/nmon2influxdb/main.go:301 +0x2160

adejoux commented 6 years ago

Hello,

Thanks for your input. it's really clear. I imported the file with my latest version and it seems to work.

╭─adejoux@adejoux-VirtualBox ~/devel/go/src/github.com/adejoux/go-ldap-manager ‹master*› ╰─$ nmon2influxdb import ~/Downloads/test.nmon 2017/08/29 15:39:41 Using configuration file /home/adejoux/.nmon2influxdb.cfg 2017/08/29 15:39:43 NMON file separator: , ##################################################################################### File /home/adejoux/Downloads/test.nmon imported : 427383 points !

Can you try with this binary?

nmon2influxdb.gz

Regards,

Alain

opeyrega commented 6 years ago

Hi,

Thanks for your reply, I think my mistake was on old influxdb version. I take your last binary with last version of influxdb and all works perfectly.

Thanks for all your work

Regards,

Olivier

adejoux commented 6 years ago

Great news. Thanks :)