Install telegraf without systemd

Hi!
I´m trying to install telegraf 1.25.1(telegraf-1.25.1-1.x86_64.rpm) on a Red Hat Enterprise Linux Server release 6.8 (Santiago) that does not have systemd active.
The installation completes, the command telegraf is available, but it does not can start as a service if run: service telegraf start.
[root@SERVER opt]# which telegraf
/usr/bin/telegraf
[root@SERVER opt]# service telegraf start
telegraf: unrecognized service
No reference is created on /etc/init.d/

Is there something wrong with this install process?
I´ll place a verbose install using rpm below
Thanks!

[root@SERVER opt]# rpm -ivv telegraf-1.25.1-1.x86_64.rpm
D: ============== telegraf-1.25.1-1.x86_64.rpm
D: loading keyring from pubkeys in /var/lib/rpm/pubkeys/.key
D: couldn’t find any keys in /var/lib/rpm/pubkeys/
.key
D: loading keyring from rpmdb
D: opening db environment /var/lib/rpm cdb:mpool:joinenv
D: opening db index /var/lib/rpm/Packages rdonly mode=0x0
D: locked db index /var/lib/rpm/Packages
D: opening db index /var/lib/rpm/Name rdonly mode=0x0
D: Expected size: 44819315 = lead(96)+sigs(4404)+pad(4)+data(44814811)
D: Actual size: 44819315
D: telegraf-1.25.1-1.x86_64.rpm: Header SHA1 digest: OK (6894f04b2794d7d318f63a86f87816b3d5a840dd)
D: ========== relocations
D: added binary package [0]
D: found 0 source and 1 binary packages
D: ========== +++ telegraf-1.25.1-1 x86_64/linux 0x0
D: opening db index /var/lib/rpm/Basenames rdonly mode=0x0
D: read h# 16 Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
D: Requires: /bin/sh YES (db files)
D: Requires: /bin/sh YES (cached)
D: Requires: /bin/sh YES (cached)
D: Requires: /bin/sh YES (cached)
D: opening db index /var/lib/rpm/Providename rdonly mode=0x0
D: read h# 198 Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
D: Requires: coreutils YES (db provides)
D: Requires: rpmlib(CompressedFileNames) <= 3.0.4-1 YES (rpmlib provides)
D: Requires: rpmlib(FileDigests) <= 4.6.0-1 YES (rpmlib provides)
D: Requires: rpmlib(PayloadFilesHavePrefix) <= 4.0-1 YES (rpmlib provides)
D: read h# 354 Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
D: Requires: shadow-utils YES (db provides)
D: opening db index /var/lib/rpm/Conflictname rdonly mode=0x0
D: ========== recording tsort relations
D: ========== tsorting packages (order, #predecessors, #succesors, tree, depth)
D: 0 0 0 0 1 +telegraf-1.25.1-1.x86_64
D: installing binary packages
D: closed db index /var/lib/rpm/Conflictname
D: closed db index /var/lib/rpm/Providename
D: closed db index /var/lib/rpm/Basenames
D: closed db index /var/lib/rpm/Name
D: closed db index /var/lib/rpm/Packages
D: closed db environment /var/lib/rpm
D: opening db environment /var/lib/rpm cdb:mpool:joinenv
D: opening db index /var/lib/rpm/Packages create mode=0x42
D: sanity checking 1 elements
D: opening db index /var/lib/rpm/Name create mode=0x42
D: running pre-transaction scripts
D: computing 7 file fingerprints
Preparing packages for installation…
D: computing file dispositions
D: opening db index /var/lib/rpm/Basenames create mode=0x42
D: 0x00000801 4096 4054971 2687272 /
D: 0x00000805 4096 17566441 4724671 /var
D: ========== +++ telegraf-1.25.1-1 x86_64-linux 0x0
D: Expected size: 44819315 = lead(96)+sigs(4404)+pad(4)+data(44814811)
D: Actual size: 44819315
D: telegraf-1.25.1-1.x86_64: Header SHA1 digest: OK (6894f04b2794d7d318f63a86f87816b3d5a840dd)
D: install: telegraf-1.25.1-1 has 7 files, test = 0
D: opening db index /var/lib/rpm/Triggername create mode=0x42
D: install: %pre(telegraf-1.25.1-1.x86_64) scriptlet start
D: install: %pre(telegraf-1.25.1-1.x86_64) execv(/bin/sh) pid 21639

  • grep ‘^telegraf:’ /etc/group
  • groupadd -r telegraf
  • id telegraf
  • useradd -r -M telegraf -s /bin/false -d /etc/telegraf -g telegraf
  • [[ -d /etc/opt/telegraf ]]
    D: install: waitpid(21639) rc 21639 status 0 secs 0.781
    telegraf-1.25.1-1
    D: ========== Directories not explicitly included in package:
    D: 0 /etc/logrotate.d/
    D: 1 /etc/telegraf/
    D: 2 /usr/bin/
    D: 3 /usr/lib/telegraf/scripts/
    D: 4 /var/log/
    D: ==========
    D: /etc/telegraf directory created with perms 0755, context system_u:object_r:etc_t:s0.
    D: /usr/lib/telegraf directory created with perms 0755, context system_u:object_r:lib_t:s0.
    D: /usr/lib/telegraf/scripts directory created with perms 0755, context system_u:object_r:lib_t:s0.
    D: fini 100644 1 ( 0, 0) 131 /etc/logrotate.d/telegraf;63e4f15e
    D: fini 100644 1 ( 0, 0) 407942 /etc/telegraf/telegraf.conf;63e4f15e
    D: fini 040755 1 ( 0, 0) 0 /etc/telegraf/telegraf.d
    D: fini 100755 1 ( 0, 0) 160923648 /usr/bin/telegraf;63e4f15e
    D: fini 100755 1 ( 0, 0) 5803 /usr/lib/telegraf/scripts/init.sh;63e4f15e
    D: fini 100644 1 ( 0, 0) 481 /usr/lib/telegraf/scripts/telegraf.service;63e4f15e
    D: fini 040755 1 ( 0, 0) 0 /var/log/telegraf
    GZDIO: 19695 reads, 161339120 total bytes in 1.023786 secs
    D: +++ h# 631 Header SHA1 digest: OK (6894f04b2794d7d318f63a86f87816b3d5a840dd)
    D: adding “telegraf” to Name index.
    D: adding 7 entries to Basenames index.
    D: opening db index /var/lib/rpm/Group create mode=0x42
    D: adding “default” to Group index.
    D: opening db index /var/lib/rpm/Requirename create mode=0x42
    D: adding 9 entries to Requirename index.
    D: opening db index /var/lib/rpm/Providename create mode=0x42
    D: adding 2 entries to Providename index.
    D: opening db index /var/lib/rpm/Dirnames create mode=0x42
    D: adding 5 entries to Dirnames index.
    D: opening db index /var/lib/rpm/Requireversion create mode=0x42
    D: adding 9 entries to Requireversion index.
    D: opening db index /var/lib/rpm/Provideversion create mode=0x42
    D: adding 2 entries to Provideversion index.
    D: opening db index /var/lib/rpm/Installtid create mode=0x42
    D: adding 1 entries to Installtid index.
    D: opening db index /var/lib/rpm/Sigmd5 create mode=0x42
    D: adding 1 entries to Sigmd5 index.
    D: opening db index /var/lib/rpm/Sha1header create mode=0x42
    D: adding “6894f04b2794d7d318f63a86f87816b3d5a840dd” to Sha1header index.
    D: opening db index /var/lib/rpm/Filedigests create mode=0x42
    D: adding 7 entries to Filedigests index.
    D: install: %post(telegraf-1.25.1-1.x86_64) scriptlet start
    D: install: %post(telegraf-1.25.1-1.x86_64) execv(/bin/sh) pid 21709
  • [[ -L /etc/init.d/telegraf ]]
  • [[ -L /etc/systemd/system/telegraf.service ]]
  • [[ ! -f /etc/default/telegraf ]]
  • touch /etc/default/telegraf
  • [[ ! -d /etc/telegraf/telegraf.d ]]
  • [[ ! -f /etc/telegraf/telegraf.conf ]]
  • LOG_DIR=/var/log/telegraf
  • test -d /var/log/telegraf
  • chown -R -L telegraf:telegraf /var/log/telegraf
  • chmod 755 /var/log/telegraf
  • [[ -d /run/systemd/system ]]
    D: install: waitpid(21709) rc 21709 status 0 secs 0.017
    D: running post-transaction scripts
    D: read h# 631 Header SHA1 digest: OK (6894f04b2794d7d318f63a86f87816b3d5a840dd)
    D: (null): %posttrans(telegraf-1.25.1-1.x86_64) scriptlet start
    D: (null): %posttrans(telegraf-1.25.1-1.x86_64) execv(/bin/sh) pid 21713
  • [[ -L /etc/init.d/telegraf ]]
  • [[ -L /etc/systemd/system/telegraf.service ]]
  • [[ ! -f /etc/default/telegraf ]]
  • [[ ! -d /etc/telegraf/telegraf.d ]]
  • [[ ! -f /etc/telegraf/telegraf.conf ]]
  • LOG_DIR=/var/log/telegraf
  • test -d /var/log/telegraf
  • chown -R -L telegraf:telegraf /var/log/telegraf
  • chmod 755 /var/log/telegraf
  • [[ -d /run/systemd/system ]]
    D: (null): waitpid(21713) rc 21713 status 0 secs 0.007
    D: closed db index /var/lib/rpm/Filedigests
    D: closed db index /var/lib/rpm/Sha1header
    D: closed db index /var/lib/rpm/Sigmd5
    D: closed db index /var/lib/rpm/Installtid
    D: closed db index /var/lib/rpm/Provideversion
    D: closed db index /var/lib/rpm/Requireversion
    D: closed db index /var/lib/rpm/Dirnames
    D: closed db index /var/lib/rpm/Triggername
    D: closed db index /var/lib/rpm/Providename
    D: closed db index /var/lib/rpm/Requirename
    D: closed db index /var/lib/rpm/Group
    D: closed db index /var/lib/rpm/Basenames
    D: closed db index /var/lib/rpm/Name
    D: closed db index /var/lib/rpm/Packages
    D: closed db environment /var/lib/rpm

Hi,

The latest version of telegraf provide support for OS platforms that are in standard support, not extended support. As a result, RHEL 6 is not a platform we try to maintain compatibility for anymore.

That said, we do have a service file init.sh in the repo. You could try installing that and using it.

1 Like

Thanks for the file!
I did the following:
cp init.sh /etc/init.d/telegraf
chkconfig --add telegraf
chkconfig telegraf on
Now its possible to use “service telegraf start / stop / restart” and it loads at startup
Thanks