public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* Re: vnstat 2.6 - testing
       [not found] <fec66a3e-fe99-c64e-f2e3-c96ed3877a1b@ipfire.org>
@ 2020-03-22 13:16 ` Matthias Fischer
  2020-03-22 15:32   ` Arne Fitzenreiter
  0 siblings, 1 reply; 3+ messages in thread
From: Matthias Fischer @ 2020-03-22 13:16 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 919 bytes --]

Hi,

it seems that I found a (fast) solution for starting/stopping 'vnstatd':

1. In '/etc/init.d/vnstat' I changed:

start)
	if use_ramdisk; then
		boot_mesg "Mounting vnstat ramdisk..."
		mount_ramdisk "${VNSTATLOG}"
		evaluate_retval
	fi
	;;

To:

start)
	boot_mesg "Starting vnstatd..."
	loadproc /usr/sbin/vnstatd -d --alwaysadd
	sleep 2
	evaluate_retval

	if use_ramdisk; then
		boot_mesg "Mounting vnstat ramdisk..."
		mount_ramdisk "${VNSTATLOG}"
		evaluate_retval
	fi
	;;

2. Changed:

stop)
	umount_ramdisk "${VNSTATLOG}"
	;;

To:

stop)
	boot_mesg "Stopping vnstatd..."
	killproc /usr/sbin/vnstatd
	sleep 2
	evaluate_retval
	umount_ramdisk "${VNSTATLOG}"
	;;

Tested. Worked.

But this doesn't check whether the old interface files were imported
correctly...

Opinions?

Best,
Matthias

P.S.:
'cached memory' is now at 90.42%.
Used: 4.18%
Buffered: 1.39%
Free: 4.00%
On a 2 GB / 32bit-machine (offline).
Hm.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: vnstat 2.6 - testing
  2020-03-22 13:16 ` vnstat 2.6 - testing Matthias Fischer
@ 2020-03-22 15:32   ` Arne Fitzenreiter
  2020-03-22 16:49     ` Matthias Fischer
  0 siblings, 1 reply; 3+ messages in thread
From: Arne Fitzenreiter @ 2020-03-22 15:32 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 1468 bytes --]

Hi,

this works not as intended! If you start the vnstatd before creating the 
ramdisk it
creates filehandles to the files on the disk so the ramdisk is not used 
at all.
How large is the database and how have you created the traffic for the 
test?
All readed files are put to the cache so it might be normal that the 
cache is fuller
after ramdisk mount and copying.

Arne

Am 2020-03-22 14:16, schrieb Matthias Fischer:
> Hi,
> 
> it seems that I found a (fast) solution for starting/stopping 
> 'vnstatd':
> 
> 1. In '/etc/init.d/vnstat' I changed:
> 
> start)
> 	if use_ramdisk; then
> 		boot_mesg "Mounting vnstat ramdisk..."
> 		mount_ramdisk "${VNSTATLOG}"
> 		evaluate_retval
> 	fi
> 	;;
> 
> To:
> 
> start)
> 	boot_mesg "Starting vnstatd..."
> 	loadproc /usr/sbin/vnstatd -d --alwaysadd
> 	sleep 2
> 	evaluate_retval
> 
> 	if use_ramdisk; then
> 		boot_mesg "Mounting vnstat ramdisk..."
> 		mount_ramdisk "${VNSTATLOG}"
> 		evaluate_retval
> 	fi
> 	;;
> 
> 2. Changed:
> 
> stop)
> 	umount_ramdisk "${VNSTATLOG}"
> 	;;
> 
> To:
> 
> stop)
> 	boot_mesg "Stopping vnstatd..."
> 	killproc /usr/sbin/vnstatd
> 	sleep 2
> 	evaluate_retval
> 	umount_ramdisk "${VNSTATLOG}"
> 	;;
> 
> Tested. Worked.
> 
> But this doesn't check whether the old interface files were imported
> correctly...
> 
> Opinions?
> 
> Best,
> Matthias
> 
> P.S.:
> 'cached memory' is now at 90.42%.
> Used: 4.18%
> Buffered: 1.39%
> Free: 4.00%
> On a 2 GB / 32bit-machine (offline).
> Hm.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: vnstat 2.6 - testing
  2020-03-22 15:32   ` Arne Fitzenreiter
@ 2020-03-22 16:49     ` Matthias Fischer
  0 siblings, 0 replies; 3+ messages in thread
From: Matthias Fischer @ 2020-03-22 16:49 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 2376 bytes --]

Hi,

On 22.03.2020 16:32, Arne Fitzenreiter wrote:
> Hi,
> 
> this works not as intended! If you start the vnstatd before creating the 
> ramdisk it
> creates filehandles to the files on the disk so the ramdisk is not used 
> at all.

Thinking of, it you're right! Thanks.

I didn't get any boot messages concerning the ramdisk, so I didn't
thought of that and overlooked it.

How about the other way around?

> How large is the database and how have you created the traffic for the 
> test?

'/var/log/vnstat.db' has now exactly 69632 Bytes - see attachment.

It was created by copying the old interface files
(/var/log/vnstat/.blue0, blue0, .green0, green0, .red0, red0) from my
production machine to my testmachine. That is all it took. 'vnstatd'
imported them at first start.

The other traffic from today was created through copying some *really*
big video files to the testmachine.

> All readed files are put to the cache so it might be normal that the 
> cache is fuller
> after ramdisk mount and copying.

I changed order: I placed 'vnstatd' start and stop routines *behind* the
ramdisk entries (init is attached). Would that be better?

At first look it works as intended...

Best,
Matthias

> Arne
> 
> Am 2020-03-22 14:16, schrieb Matthias Fischer:
>> Hi,
>> 
>> it seems that I found a (fast) solution for starting/stopping 
>> 'vnstatd':
>> 
>> 1. In '/etc/init.d/vnstat' I changed:
>> 
>> start)
>> 	if use_ramdisk; then
>> 		boot_mesg "Mounting vnstat ramdisk..."
>> 		mount_ramdisk "${VNSTATLOG}"
>> 		evaluate_retval
>> 	fi
>> 	;;
>> 
>> To:
>> 
>> start)
>> 	boot_mesg "Starting vnstatd..."
>> 	loadproc /usr/sbin/vnstatd -d --alwaysadd
>> 	sleep 2
>> 	evaluate_retval
>> 
>> 	if use_ramdisk; then
>> 		boot_mesg "Mounting vnstat ramdisk..."
>> 		mount_ramdisk "${VNSTATLOG}"
>> 		evaluate_retval
>> 	fi
>> 	;;
>> 
>> 2. Changed:
>> 
>> stop)
>> 	umount_ramdisk "${VNSTATLOG}"
>> 	;;
>> 
>> To:
>> 
>> stop)
>> 	boot_mesg "Stopping vnstatd..."
>> 	killproc /usr/sbin/vnstatd
>> 	sleep 2
>> 	evaluate_retval
>> 	umount_ramdisk "${VNSTATLOG}"
>> 	;;
>> 
>> Tested. Worked.
>> 
>> But this doesn't check whether the old interface files were imported
>> correctly...
>> 
>> Opinions?
>> 
>> Best,
>> Matthias
>> 
>> P.S.:
>> 'cached memory' is now at 90.42%.
>> Used: 4.18%
>> Buffered: 1.39%
>> Free: 4.00%
>> On a 2 GB / 32bit-machine (offline).
>> Hm.
> 




[-- Attachment #2: vnstat.db --]
[-- Type: application/octet-stream, Size: 69632 bytes --]

[-- Attachment #3: init_vnstat.txt --]
[-- Type: text/plain, Size: 804 bytes --]

#!/bin/sh
# Begin $rc_base/init.d/vnstat

. /etc/sysconfig/rc
. $rc_functions

eval $(/usr/local/bin/readhash /var/ipfire/main/settings)

if [ "$VNSTATLOG" = '' ]; then
	VNSTATLOG=/var/log/vnstat
fi

case "$1" in
	start)
		if use_ramdisk; then
			boot_mesg "Mounting vnstat ramdisk..."
			mount_ramdisk "${VNSTATLOG}"
			evaluate_retval
		fi

		boot_mesg "Starting vnstatd..."
		loadproc /usr/sbin/vnstatd -d --alwaysadd
		sleep 2
		evaluate_retval
		;;
	stop)
		umount_ramdisk "${VNSTATLOG}"

		boot_mesg "Stopping vnstatd..."
		killproc /usr/sbin/vnstatd
		sleep 2
		evaluate_retval
		;;

	backup)
		# Backup all data if ramdisk is used
		if mountpoint "${RRDLOG}" &>/dev/null; then
			${0} restart
		fi
		;;

	*)
		echo "Usage: $0 {start|stop|backup}"
		exit 1
		;;
esac

# End $rc_base/init.d/vnstat

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-22 16:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <fec66a3e-fe99-c64e-f2e3-c96ed3877a1b@ipfire.org>
2020-03-22 13:16 ` vnstat 2.6 - testing Matthias Fischer
2020-03-22 15:32   ` Arne Fitzenreiter
2020-03-22 16:49     ` Matthias Fischer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox