Skip to content
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

Parsing fgHaStatsSyncDatimeUnsucc and fgHaStatsSyncDatimeSucc #48

Open
enotspe opened this issue Oct 7, 2021 · 2 comments
Open

Parsing fgHaStatsSyncDatimeUnsucc and fgHaStatsSyncDatimeSucc #48

enotspe opened this issue Oct 7, 2021 · 2 comments

Comments

@enotspe
Copy link

enotspe commented Oct 7, 2021

Hi,

According to Fortinet MIB, those OIDs (fgHaStatsSyncDatimeUnsucc and fgHaStatsSyncDatimeSucc) should return DateAndTime octect string with the specified format. However, I can not manage to parse that data type.

Most of the times I get
00 00 01 01 00 00 00 00
or
07 E5 08 14 0A 1A 10 00

How can I convert it to human readable and meaningful format? It would be great to convert it to uptime or unixtime formats so we can create an alert for those OIDs.

Have you been able to parse them?? I am running 6.4.X by the way.

@enotspe
Copy link
Author

enotspe commented Oct 7, 2021

I made this script, kinds of works.... just add it to preprocessing

`var splitData = value.split(" ");

year = parseInt(splitData[0]+splitData[1], 16);
month = parseInt(splitData[2], 16);
day = parseInt(splitData[3], 16);
hour = parseInt(splitData[4], 16);
minute = parseInt(splitData[5], 16);
second = parseInt(splitData[6], 16);
deci_sec = parseInt(splitData[7], 16);

date = year + '-' + month + '-' + day;
time = hour + ':' + minute + ':' + second + '.' + deci_sec;

date_time = date + ' ' + time;

return date_time;`

@mbdraks
Copy link
Owner

mbdraks commented Oct 7, 2021

@enotspe Looks good, I'll test and merge it once I can properly validate.

I believe there's some other fields that could benefit from this approach too, tks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants