[collectd] How can I determine network interface status? (up/down)

Николай Кучумов kuchumovn at gmail.com
Fri Apr 18 19:07:16 CEST 2014


For anyone who will be searching for this: the exec plugin works.
I'm sure this isn't the most optimal solution, but it's the only one that
works so far.
If you know a more efficient way, send me a note.

LoadPlugin exec

<Plugin exec>
Exec "nobody:nogroup" "/home/kuchumovn/monitoring/tools/interface_state.sh"
"eth0"
</Plugin>


The script itself:

HOSTNAME="${COLLECTD_HOSTNAME:-localhost}"
INTERVAL="${COLLECTD_INTERVAL:-60}"

while sleep "$INTERVAL"; do
VALUE=`cat /sys/class/net/$1/carrier`
echo "PUTVAL \"$HOSTNAME/exec-interface_state/gauge-state\"
interval=$INTERVAL N:$VALUE"
done




2014-04-18 19:29 GMT+04:00 Николай Кучумов <kuchumovn at gmail.com>:

> Thanks bill, it was.
> We have a software that needs to monitor itself, i.e. the server.
> We chose collectd as we found no other sane alternatives.
> We managed to get hdd stats, ram stats, network stats and cpu stats, but
> what is left is interface status.
> We don't need nagios, this is a requirement for collectd.
> I found a way though: to read the /sys/class/net/eth0/carrier file: 1 for
> up, 0 for down (i suppose).
> Another issue i've faced is that the "tail" plugin (for reading files)
> doesn't work - it always returns "null".
> Maybe I'll find yet another plugin, maybe it'll be the "Exec" plugin and
> "cat /sys/class/net/eth0/carrier" script.
>
>
> 2014-04-18 19:02 GMT+04:00 bill <bilsch at gmail.com>:
>
> I think what the question was really about was monitoring. not just metrics
>>
>> the use if metrics in an overall monitoring solution is important.
>> collectd itself I view more as a metrics collection framework
>>
>> what is really needed as part of the answer is that collectd itself is
>> not an alerting framework. eg they need I look at something like nagios.
>> getting nagios checks to do threshold checks against historical metrics (
>> say link errors in the last 30 seconds ) is very helpful
>>
>> collectd itself does not necessarily know not care about individual link
>> state
>>
>> original requester - hope that helps. was that really more your
>> question/direction?
>>
>>
>> Bill Schwanitz
>>
>> If A is a success in life, then A equals x plus y plus z. Work is x; y is
>> play; and z is keeping your mouth shut. - Albert Einstein.
>>
>> > On Apr 18, 2014, at 10:21 AM, "G.W. Haywood" <
>> collectd at jubileegroup.co.uk> wrote:
>> >
>> > B0;278;0cHi there,
>> >
>> >> On Fri, 18 Apr 2014, (??????? ???????) wrote:
>> >>
>> >> How can I determine network interface status? (up/down)
>> >
>> > man ip
>> > man ifconfig
>> >
>> > --
>> >
>> > 73,
>> > Ged.
>> >
>> > _______________________________________________
>> > collectd mailing list
>> > collectd at verplant.org
>> > http://mailman.verplant.org/listinfo/collectd
>>
>> _______________________________________________
>> collectd mailing list
>> collectd at verplant.org
>> http://mailman.verplant.org/listinfo/collectd
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20140418/d5f7f438/attachment.html>


More information about the collectd mailing list