Hi,
I'm kind of new in Nagios, and i'm trying to search a way to monitor the content of a CSV file.
I need to monitor 12 different rows separately inside it, which every row has 1 or a 0,
If one of those rows change from 1 to 0 -> PROBLEM in ## row
If one of those rows change from 0 to 1 -> row ## is OK
is it possible??
Monitoring CSV or XLXS content
Re: Monitoring CSV or XLXS content
I'm not finding an existing plugin to do exactly this, but fortunately something along these lines should be pretty easy to script. Is the file located on a web site or another system? Linux or Windows or other? Can you provide a sample of the file that would be read?
Creating a new plugin is a viable option if you're familiar with any programming or scripting languages. Here are some good resources to help:
https://exchange.nagios.org/directory/T ... pt/details
https://assets.nagios.com/downloads/nag ... inapi.html
https://assets.nagios.com/downloads/nag ... inapi.html
http://nagios-plugins.org/doc/guidelines.html
Creating a new plugin is a viable option if you're familiar with any programming or scripting languages. Here are some good resources to help:
https://exchange.nagios.org/directory/T ... pt/details
https://assets.nagios.com/downloads/nag ... inapi.html
https://assets.nagios.com/downloads/nag ... inapi.html
http://nagios-plugins.org/doc/guidelines.html
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Monitoring CSV or XLXS content
Hi cdienger,
thanks for the reply,
The csv file in located in a Windows OS, in a folder, it goes like this:
snapshot: https://imgur.com/90DTU05
or an example here:
SERVICE | OUTPUT
serviceA | #
serviceB | #
serviceC | #
serviceD | #
serviceE | #
serviceF | #
thanks for the reply,
The csv file in located in a Windows OS, in a folder, it goes like this:
snapshot: https://imgur.com/90DTU05
or an example here:
SERVICE | OUTPUT
serviceA | #
serviceB | #
serviceC | #
serviceD | #
serviceE | #
serviceF | #
Re: Monitoring CSV or XLXS content
Hi cdienger,cdienger wrote:I'm not finding an existing plugin to do exactly this, but fortunately something along these lines should be pretty easy to script. Is the file located on a web site or another system? Linux or Windows or other? Can you provide a sample of the file that would be read?
Creating a new plugin is a viable option if you're familiar with any programming or scripting languages. Here are some good resources to help:
https://exchange.nagios.org/directory/T ... pt/details
https://assets.nagios.com/downloads/nag ... inapi.html
https://assets.nagios.com/downloads/nag ... inapi.html
http://nagios-plugins.org/doc/guidelines.html
Thanks for the response! i'm not that good with scripts and bash, i was hoping to have some help here from an expert
It's a file located in windows OS not on a website, I added a snapshot of the looks of the file: imgur.com/a/A0tlg
is it possible to track rows in a csv as this?
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Monitoring CSV or XLXS content
It is possible, however, it would be a custom solution you would have to create, and that is going to involve writing a script/program to do it unfortunately.Dotzek wrote: is it possible to track rows in a csv as this?
If you aren't a developer maybe you programmer on your team you can work with.
Re: Monitoring CSV or XLXS content
I would recommend installing ncpa on the Windows machine and configuring it to use external script to check the file.
https://www.nagios.org/ncpa/
https://www.nagios.org/ncpa/getting-started.php
https://support.nagios.com/kb/article/n ... a-722.html
I've made an rough pass at doing this in powershell with promising results:
Note the above hasn't been thoroughly tested and we don't typically write custom scripts. It's meant more as a proof of concept and will likely need to be modified to fit your needs exactly.
https://www.nagios.org/ncpa/
https://www.nagios.org/ncpa/getting-started.php
https://support.nagios.com/kb/article/n ... a-722.html
I've made an rough pass at doing this in powershell with promising results:
Code: Select all
$lines = import-csv "c:\file.csv" -header Unit,Collected
ForEach ($line in $lines){
$Unit = $($line.Unit)
$Collected = $($line.Collected)
If ($Collected -eq 0){
$not = $not + $Unit + ","
}
}
If ($not){
Write-Host $not
exit 2
}else{
Write-Host "All is good!"
exit 0
}
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Monitoring CSV or XLXS content
Thanks alot for the help, i've tried it and it's not working yet, i'll work on it and hopefuly will make it work,cdienger wrote:I would recommend installing ncpa on the Windows machine and configuring it to use external script to check the file.
https://www.nagios.org/ncpa/
https://www.nagios.org/ncpa/getting-started.php
https://support.nagios.com/kb/article/n ... a-722.html
I've made an rough pass at doing this in powershell with promising results:
Note the above hasn't been thoroughly tested and we don't typically write custom scripts. It's meant more as a proof of concept and will likely need to be modified to fit your needs exactly.Code: Select all
$lines = import-csv "c:\file.csv" -header Unit,Collected ForEach ($line in $lines){ $Unit = $($line.Unit) $Collected = $($line.Collected) If ($Collected -eq 0){ $not = $not + $Unit + "," } } If ($not){ Write-Host $not exit 2 }else{ Write-Host "All is good!" exit 0 }
thank you for the help !!
Re: Monitoring CSV or XLXS content
No problem : )
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.