Setting up Node Exporter on init and systems systems

Node exporter default collectors:


Enabled by default

--collector.systemd.enable-task-metrics
--collector.systemd.enable-restarts-metrics
--collector.systemd.enable-start-time-metrics
--collector.arp Enable the arp collector (default: enabled).
--collector.bcache Enable the bcache collector (default: enabled).
--collector.bonding Enable the bonding collector (default: enabled).
--collector.btrfs Enable the btrfs collector (default: enabled).
--collector.conntrack Enable the conntrack collector (default: enabled).
--collector.cpu Enable the cpu collector (default: enabled).
--collector.cpufreq Enable the cpufreq collector (default: enabled).
--collector.diskstats Enable the diskstats collector (default: enabled).
--collector.edac Enable the edac collector (default: enabled).
--collector.entropy Enable the entropy collector (default: enabled).
--collector.fibrechannel Enable the fibrechannel collector (default: enabled).
--collector.filefd Enable the filefd collector (default: enabled).
--collector.filesystem Enable the filesystem collector (default: enabled).
--collector.hwmon Enable the hwmon collector (default: enabled).
--collector.infiniband Enable the infiniband collector (default: enabled).
--collector.ipvs Enable the ipvs collector (default: enabled).
--collector.loadavg Enable the loadavg collector (default: enabled).
--collector.mdadm Enable the mdadm collector (default: enabled).
--collector.meminfo Enable the meminfo collector (default: enabled).
--collector.netclass Enable the netclass collector (default: enabled).
--collector.netdev Enable the netdev collector (default: enabled).
--collector.netstat Enable the netstat collector (default: enabled).
--collector.nfs Enable the nfs collector (default: enabled).
--collector.nfsd Enable the nfsd collector (default: enabled).
Enable the powersupplyclass collector (default: enabled).
--collector.pressure Enable the pressure collector (default: enabled).
--collector.rapl Enable the rapl collector (default: enabled).
--collector.schedstat Enable the schedstat collector (default: enabled).
--collector.sockstat Enable the sockstat collector (default: enabled).
--collector.softnet Enable the softnet collector (default: enabled).
--collector.stat Enable the stat collector (default: enabled).
--collector.textfile Enable the textfile collector (default: enabled).
--collector.thermal_zone Enable the thermal_zone collector (default: enabled).
--collector.time Enable the time collector (default: enabled).
--collector.timex Enable the timex collector (default: enabled).
--collector.udp_queues Enable the udp_queues collector (default: enabled).
--collector.uname Enable the uname collector (default: enabled).
--collector.vmstat Enable the vmstat collector (default: enabled).
--collector.xfs Enable the xfs collector (default: enabled).
--collector.zfs Enable the zfs collector (default: enabled).
--web.config="" [EXPERIMENTAL] Path to config yaml file that can enable TLS or authentication.


Disabled by default

--collector.buddyinfo Enable the buddyinfo collector (default: disabled).
--collector.drbd Enable the drbd collector (default: disabled).
--collector.interrupts Enable the interrupts collector (default: disabled).
--collector.ksmd Enable the ksmd collector (default: disabled).
--collector.logind Enable the logind collector (default: disabled).
--collector.meminfo_numa Enable the meminfo_numa collector (default: disabled).
--collector.mountstats Enable the mountstats collector (default: disabled).
--collector.network_route Enable the network_route collector (default: disabled).
--collector.ntp Enable the ntp collector (default: disabled).
--collector.perf Enable the perf collector (default: disabled).
--collector.processes Enable the processes collector (default: disabled).
--collector.qdisc Enable the qdisc collector (default: disabled).
--collector.runit Enable the runit collector (default: disabled).
--collector.supervisord Enable the supervisord collector (default: disabled).
--collector.systemd Enable the systemd collector (default: disabled).
--collector.tcpstat Enable the tcpstat collector (default: disabled).
--collector.wifi Enable the wifi collector (default: disabled).
--collector.zoneinfo Enable the zoneinfo collector (default: disabled).
--web.disable-exporter-metrics
--web.max-requests=40 Maximum number of parallel scrape requests. Use 0 to disable.
--collector.disable-defaults
Set all collectors to disabled by default.


Init systems:


Service file

cat /etc/init.d/node_exporter
#!/bin/bash
OPTIONS=`cat /etc/sysconfig/node_exporter`
RETVAL=0
PROG="node_exporter"
EXEC="/usr/local/bin/node_exporter"
LOCKFILE="/var/lock/subsys/$PROG"
LOGFILE=/var/log/node_exporter.log
ErrLOGFILE=/var/log/node_exporter_error.log
# Source function library.
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
else
echo "/etc/rc.d/init.d/functions is not exists"
exit 0
fi
start() {
if [ -f $LOCKFILE ]
then
echo "$PROG is already running!"
else
echo -n "Starting $PROG: "
nohup $EXEC $OPTIONS > $LOGFILE 2> $ErrLOGFILE &
RETVAL=$?
[ $RETVAL -eq 0 ] && touch $LOCKFILE && success || failure
echo
return $RETVAL
fi
}
stop() {
echo -n "Stopping $PROG: "
killproc $EXEC
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -r $LOCKFILE && success || failure
echo
}
restart ()
{
stop
sleep 1
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $PROG
;;
restart)
restart
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit $RETVAL


Config file

cat /etc/sysconfig/node_exporter
--collector.filesystem.mount-points-exclude=^/(home|proc|run/credentials/.+|sys|var/lib/docker/.+)($|/) --collector.filesystem.fs-types-exclude=^(nfs|nfs4|fuse.vmware-vmblock|autofs|binfmt_misc|bpf|cgroup2?|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|iso9660|mqueue|nsfs|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|selinuxfs|squashfs|sysfs|tracefs)$ --no-collector.arp --no-collector.btrfs --no-collector.fibrechannel --no-collector.infiniband --no-collector.nfs --no-collector.tapestats --no-collector.thermal_zone --collector.textfile.directory /var/lib/node_exporter/textfile_collector


Systemd systems:

Service file

cat /etc/systemd/system/node_exporter.service
[Unit]
Description=Node Exporter

[Service]
User=node_exporter
EnvironmentFile=/etc/sysconfig/node_exporter
ExecStart=/usr/sbin/node_exporter $OPTIONS

[Install]
WantedBy=multi-user.target


Config file

cat /etc/sysconfig/node_exporter
OPTIONS="--collector.textfile.directory /var/lib/node_exporter/textfile_collector --collector.filesystem.fs-types-exclude=\"^(nfs|autofs|binfmt_misc|bpf|cgroup2?|configfs|debugfs|devpts|devtmpfs|fusectl|hugetlbfs|iso9660|mqueue|nsfs|overlay|proc|procfs|pstore|rpc_pipefs|securityfs|selinuxfs|squashfs|sysfs|tracefs)$\""





 

Set static IP on Ubuntu

  1. In /etc/network/interfaces

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    auto eth0
    iface eth0 inet static
            address "insert the IP you want to set"
            netmask "insert subnet mask"
            gateway "insert gateway"
            dns-domain yourdomain.com
            dns-search yourdomain.com
            dns-nameservers "insert your nameservers IP address separated by spaces"

  2. Please make sure there are no "" in  /etc/network/interfaces file.

  3. Restart networking by running following command:
    sudo /etc/init.d/networking restart

  4. Please leave a comment or g +1 or share on f or share on t below if this post helped you. This will keep me motivating.

Set STATIC IP on Fedora 21

  1. From ip link show command, find the network interface you want to make static.

    [0]ip link show
    1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: em1: mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
        link/ether 2c:27:d7:2b:ee:76 brd ff:ff:ff:ff:ff:ff

  2. In /etc/sysconfig/network-scripts/ifcfg-em1

    TYPE="Ethernet"
    DEVICE="em1"
    ONBOOT="yes"
    NM_CONTROLLED="no"
    BOOTPROTO="static"
    IPADDR=172.17.172.79
    NETMASK=255.255.252.0
    GATEWAY=172.17.172.1

  3. In /etc/resolv.conf

    search yourdomain.com
    nameserver 172.xx.xx.xx
    nameserver 172.xx.xx.xx

  4. Please leave a comment or g +1 or share on f or share on t below if this post helped you. This will keep me motivating.